agentic-qe 3.15.9 → 3.15.11
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 +365 -0
- package/README.md +8 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/adapters/a2a/agent-cards/generator.js +6 -3
- package/dist/adapters/a2a/tasks/task-router.js +3 -1
- package/dist/adapters/a2ui/catalog/component-schemas.js +2 -1
- package/dist/adapters/a2ui/data/json-pointer-resolver.js +10 -5
- package/dist/adapters/a2ui/integration/agui-sync.js +10 -6
- package/dist/adapters/a2ui/integration/surface-state-bridge.js +9 -5
- package/dist/adapters/ag-ui/json-patch.js +10 -6
- package/dist/adapters/trajectory-adapter.js +1 -1
- package/dist/agents/claim-verifier/verifiers/output-verifier.d.ts +3 -1
- package/dist/agents/claim-verifier/verifiers/output-verifier.js +31 -2
- package/dist/agents/overlay-loader.js +26 -21
- package/dist/audit/witness-chain.d.ts +1 -1
- package/dist/cli/bundle.js +6 -6
- package/dist/cli/chunks/adapter-V4GSGOOK.js +2 -0
- package/dist/cli/chunks/agent-booster-wasm-TIDSQ3ZK.js +2 -0
- package/dist/cli/chunks/{agent-handler-RIYHTHVZ.js → agent-handler-G3EPBVA7.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-WSUCUHOO.js → agent-memory-branch-ARC5C7GW.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-6WQTM5YR.js +2 -0
- package/dist/cli/chunks/{arena-YAJZX6MC.js → arena-36DTATJV.js} +4 -4
- package/dist/cli/chunks/{arena-KRIBMIXX.js → arena-K4I4QDXB.js} +2 -2
- package/dist/cli/chunks/{audit-7ZNOXWP3.js → audit-WQSJSJZF.js} +3 -3
- package/dist/cli/chunks/base-AK7BXBX2.js +2 -0
- package/dist/cli/chunks/{better-sqlite3-ZQAT4I6H.js → better-sqlite3-BB4K67MT.js} +2 -2
- package/dist/cli/chunks/{brain-handler-452WCPZC.js → brain-handler-CU3GOIU3.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-IJFXJRPN.js → branch-enumerator-NJQX7ZNB.js} +2 -2
- package/dist/cli/chunks/browser-6YJF4FQW.js +4 -0
- package/dist/cli/chunks/browser-workflow-VTDFBW7T.js +2 -0
- package/dist/cli/chunks/{chunk-LMU5DUDK.js → chunk-25P77WA5.js} +1 -1
- package/dist/cli/chunks/chunk-2CW7VRPH.js +141 -0
- package/dist/cli/chunks/chunk-2DTX7YAZ.js +6 -0
- package/dist/cli/chunks/{chunk-4JCY45KV.js → chunk-2KFFEKSI.js} +2 -2
- package/dist/cli/chunks/chunk-2VLYUF7U.js +2 -0
- package/dist/cli/chunks/{chunk-55HRSNGN.js → chunk-325QCVDI.js} +2 -2
- package/dist/cli/chunks/{chunk-2TDIS6YK.js → chunk-35M2X3C5.js} +2 -2
- package/dist/cli/chunks/{chunk-J5KNRVXR.js → chunk-3RHOPP7A.js} +1 -1
- package/dist/cli/chunks/{chunk-NTAD5UX4.js → chunk-4HJKQIX5.js} +2 -2
- package/dist/cli/chunks/chunk-4MUBW4RT.js +7 -0
- package/dist/cli/chunks/{chunk-VQHVHVSF.js → chunk-4RAQ7PJA.js} +8 -8
- package/dist/cli/chunks/{chunk-JWGRWMZP.js → chunk-4RH5I24Q.js} +2 -2
- package/dist/cli/chunks/{chunk-QQ5SZH4D.js → chunk-4UBVAJFO.js} +3 -3
- package/dist/cli/chunks/{chunk-ZBDRLF43.js → chunk-4UX35V7P.js} +2 -2
- package/dist/cli/chunks/{chunk-ZANDSVCK.js → chunk-4X4MWMHB.js} +2 -2
- package/dist/cli/chunks/{chunk-47TYABPD.js → chunk-55CH76ZO.js} +3 -3
- package/dist/cli/chunks/{chunk-LEAKYZ37.js → chunk-57LNKSW7.js} +2 -2
- package/dist/cli/chunks/chunk-5ERFHEEE.js +14 -0
- package/dist/cli/chunks/{chunk-HGTWAZWU.js → chunk-5HQP4SLM.js} +2 -2
- package/dist/cli/chunks/{chunk-XYCKHYBM.js → chunk-5MNASJOH.js} +2 -2
- package/dist/cli/chunks/{chunk-2HL3UM5P.js → chunk-5MTWCCZJ.js} +2 -2
- package/dist/cli/chunks/{chunk-4SUOVLJ6.js → chunk-5N25I53C.js} +2 -2
- package/dist/cli/chunks/{chunk-XOVNZT7F.js → chunk-5WYZHDIZ.js} +1 -1
- package/dist/cli/chunks/{chunk-J3DTDJDT.js → chunk-5YLOLACR.js} +2 -2
- package/dist/cli/chunks/{chunk-TSYQDRNK.js → chunk-672XOJDG.js} +2 -2
- package/dist/cli/chunks/{chunk-KLGYIEJK.js → chunk-6NA3KZZT.js} +10 -10
- package/dist/cli/chunks/chunk-72ZBJD2E.js +3 -0
- package/dist/cli/chunks/{chunk-2I2UPJS7.js → chunk-76SNL7GU.js} +2 -2
- package/dist/cli/chunks/{chunk-F3PQZX44.js → chunk-7HEMJHPP.js} +2 -2
- package/dist/cli/chunks/{chunk-FV7VAG74.js → chunk-7R5HC56U.js} +1 -1
- package/dist/cli/chunks/{chunk-L42JPFCC.js → chunk-AFFN6E6Q.js} +2 -2
- package/dist/cli/chunks/{chunk-NDKLQW6N.js → chunk-AMZKAJLJ.js} +2 -2
- package/dist/cli/chunks/{chunk-K5DJXMAA.js → chunk-AP3ADWDK.js} +2 -2
- package/dist/cli/chunks/{chunk-BHKXMIWX.js → chunk-APPZATXA.js} +2 -2
- package/dist/cli/chunks/{chunk-XDBD4GXO.js → chunk-AUUJBXWX.js} +25 -20
- package/dist/cli/chunks/{chunk-AJ4YDSOI.js → chunk-BTVWA35P.js} +2 -2
- package/dist/cli/chunks/{chunk-WGDR2KIR.js → chunk-BZPE3LDO.js} +2 -2
- package/dist/cli/chunks/{chunk-HZ5NC6U5.js → chunk-CFWGGRE7.js} +1 -1
- package/dist/cli/chunks/{chunk-UYLYMWV5.js → chunk-CIAL4YRY.js} +2 -2
- package/dist/cli/chunks/{chunk-D6XVGFTI.js → chunk-CO3DX2AX.js} +2 -2
- package/dist/cli/chunks/{chunk-N3KEY4XJ.js → chunk-DDEOZPWJ.js} +2 -2
- package/dist/cli/chunks/{chunk-XWIUFYM3.js → chunk-DOBZPSKE.js} +1 -1
- package/dist/cli/chunks/{chunk-PX2B5TS2.js → chunk-DOFREOPQ.js} +2 -2
- package/dist/cli/chunks/{chunk-47V7FQGX.js → chunk-E44NNCEU.js} +2 -2
- package/dist/cli/chunks/{chunk-I6S35FRO.js → chunk-E6PF35JZ.js} +2 -2
- package/dist/cli/chunks/chunk-EBPJY4DI.js +3 -0
- package/dist/cli/chunks/{chunk-4V27J6YN.js → chunk-EH2S6AOR.js} +2 -2
- package/dist/cli/chunks/{chunk-AQTVVLNP.js → chunk-EIDJNT5C.js} +1 -1
- package/dist/cli/chunks/{chunk-SVHUYVUR.js → chunk-EJPK7OTR.js} +2 -2
- package/dist/cli/chunks/{chunk-HAROIAJE.js → chunk-EK5GMOSO.js} +1 -1
- package/dist/cli/chunks/{chunk-LCJTEUDC.js → chunk-ERN43HOX.js} +430 -433
- package/dist/cli/chunks/chunk-ETVAYGCB.js +180 -0
- package/dist/cli/chunks/chunk-EWPUQCN4.js +2 -0
- package/dist/cli/chunks/{chunk-AOFO4N32.js → chunk-FL32MTKT.js} +2 -2
- package/dist/cli/chunks/chunk-FLU5FDSC.js +742 -0
- package/dist/cli/chunks/{chunk-KR3M44CF.js → chunk-FUYOOKTH.js} +5 -5
- package/dist/cli/chunks/chunk-FWSGPE3V.js +12 -0
- package/dist/cli/chunks/chunk-FZHSG75I.js +3 -0
- package/dist/cli/chunks/{chunk-5D2I7JUP.js → chunk-G2IJFNZS.js} +2 -2
- package/dist/cli/chunks/{chunk-ABFDB4X3.js → chunk-G4CKPWF6.js} +1 -1
- package/dist/cli/chunks/{chunk-ETG7O5E5.js → chunk-G4FAPO57.js} +5 -5
- package/dist/cli/chunks/{chunk-W32YU3VI.js → chunk-G77MLBDF.js} +2 -2
- package/dist/cli/chunks/{chunk-5JWGCIQW.js → chunk-GBFUANTC.js} +1 -1
- package/dist/cli/chunks/{chunk-UOWHE77F.js → chunk-GVKVJJQX.js} +2 -2
- package/dist/cli/chunks/{chunk-2YH62JCN.js → chunk-GWJWSLDA.js} +2 -2
- package/dist/cli/chunks/{chunk-FLASM2XB.js → chunk-H43AFUKL.js} +2 -2
- package/dist/cli/chunks/chunk-H7BLYMNU.js +59 -0
- package/dist/cli/chunks/{chunk-5NS3USRW.js → chunk-HDJUYAZG.js} +1 -1
- package/dist/cli/chunks/{chunk-A6YIH4C4.js → chunk-HDNWSKHA.js} +2 -2
- package/dist/cli/chunks/{chunk-763SUL4B.js → chunk-HFFPYC4G.js} +2 -2
- package/dist/cli/chunks/{chunk-DGTLJNJH.js → chunk-HJ3XNTTJ.js} +2 -2
- package/dist/cli/chunks/{chunk-GBUIG3FS.js → chunk-HYXUN7BW.js} +1 -1
- package/dist/cli/chunks/{chunk-3LYU7BLY.js → chunk-I36CRDHF.js} +2 -2
- package/dist/cli/chunks/{chunk-GII5WVAK.js → chunk-I4K2HTQU.js} +1 -1
- package/dist/cli/chunks/chunk-IENZSO3K.js +4 -0
- package/dist/cli/chunks/chunk-IO5537OM.js +2 -0
- package/dist/cli/chunks/{chunk-AVB5QY2Q.js → chunk-IOZRKXR5.js} +2 -2
- package/dist/cli/chunks/chunk-ITL3IN2E.js +3 -0
- package/dist/cli/chunks/{chunk-YRBBBUJX.js → chunk-ITPGWGQS.js} +14 -14
- package/dist/cli/chunks/{chunk-JNNZK7KH.js → chunk-IW6WDGHM.js} +1 -1
- package/dist/cli/chunks/{chunk-SNBYYO6F.js → chunk-J4JMCZVA.js} +2 -2
- package/dist/cli/chunks/{chunk-PVIA2FPD.js → chunk-JFLU7L3W.js} +2 -2
- package/dist/cli/chunks/{chunk-GCWSX2NY.js → chunk-JGJXXAS6.js} +4 -4
- package/dist/cli/chunks/{chunk-KFUUIAR4.js → chunk-JUMICXM6.js} +2 -2
- package/dist/cli/chunks/{chunk-A4RU67VX.js → chunk-K2HBNYAZ.js} +2 -2
- package/dist/cli/chunks/{chunk-CTZJUV5I.js → chunk-K7V2WZNF.js} +1 -1
- package/dist/cli/chunks/{chunk-VRGCKBF7.js → chunk-KDI5JOYZ.js} +2 -2
- package/dist/cli/chunks/{chunk-C6RTMTEH.js → chunk-KJCIMNHS.js} +1 -1
- package/dist/cli/chunks/{chunk-N3NP6PTT.js → chunk-KKYO2NKV.js} +2 -2
- package/dist/cli/chunks/{chunk-XQ3DDY7X.js → chunk-KSE5TDM5.js} +2 -2
- package/dist/cli/chunks/{chunk-YZGSJG34.js → chunk-KSLLHFVY.js} +1 -1
- package/dist/cli/chunks/{chunk-VCMINU7K.js → chunk-KXS3Y2AX.js} +2 -2
- package/dist/cli/chunks/{chunk-REUFWGMA.js → chunk-LBX7M4LW.js} +2 -2
- package/dist/cli/chunks/{chunk-HCYQHWI2.js → chunk-LCVEEII4.js} +2 -2
- package/dist/cli/chunks/{chunk-OCESWNAZ.js → chunk-LD5CFK53.js} +54 -33
- package/dist/cli/chunks/{chunk-XOLDMK23.js → chunk-LPU6PAJE.js} +2 -2
- package/dist/cli/chunks/{chunk-KVBEGOJE.js → chunk-LQ4NUC6Q.js} +2 -2
- package/dist/cli/chunks/chunk-LRL56ZYL.js +21 -0
- package/dist/cli/chunks/{chunk-FL3OYGCS.js → chunk-LXQ3B4RY.js} +2 -2
- package/dist/cli/chunks/{chunk-PMCRCEW5.js → chunk-M5RQ6U3G.js} +2 -2
- package/dist/cli/chunks/{chunk-EFBLP43U.js → chunk-M5XYIQYZ.js} +2 -2
- package/dist/cli/chunks/chunk-M7XFBSIK.js +2 -0
- package/dist/cli/chunks/{chunk-Q3JVJRVJ.js → chunk-MIK4RBEH.js} +1 -1
- package/dist/cli/chunks/{chunk-NHZIWIQZ.js → chunk-NC6K7SCQ.js} +2 -2
- package/dist/cli/chunks/{chunk-TUYJ53V4.js → chunk-NKTWKYHB.js} +2 -2
- package/dist/cli/chunks/{chunk-2URBI52G.js → chunk-NPZOBSAN.js} +2 -2
- package/dist/cli/chunks/{chunk-7KII4CQG.js → chunk-NQZNMCZU.js} +2 -2
- package/dist/cli/chunks/{chunk-7JKB3Q7O.js → chunk-NT7JRHMH.js} +1 -1
- package/dist/cli/chunks/{chunk-MZS32SYS.js → chunk-NTB342NJ.js} +1 -1
- package/dist/cli/chunks/{chunk-ZVSLCEVC.js → chunk-O4JAKWWM.js} +13 -13
- package/dist/cli/chunks/chunk-OD5D4LSZ.js +2 -0
- package/dist/cli/chunks/{chunk-HWK5L7IJ.js → chunk-OH5V5EJW.js} +2 -2
- package/dist/cli/chunks/{chunk-7QTB5VJZ.js → chunk-OHR7C777.js} +2 -2
- package/dist/cli/chunks/{chunk-JAV5WPSY.js → chunk-OURITHFV.js} +2 -2
- package/dist/cli/chunks/{chunk-3CJCROMW.js → chunk-OV5RPLKV.js} +2 -2
- package/dist/cli/chunks/{chunk-ZXBCCO2H.js → chunk-OYJC3YON.js} +2 -2
- package/dist/cli/chunks/{chunk-2BA45H64.js → chunk-QDESWOZP.js} +2 -2
- package/dist/cli/chunks/chunk-R5GRABPQ.js +2 -0
- package/dist/cli/chunks/{chunk-GKPQ2GRR.js → chunk-R5LGV6GZ.js} +2 -2
- package/dist/cli/chunks/chunk-RBZCA7SD.js +12 -0
- package/dist/cli/chunks/chunk-RQMCZQN2.js +2 -0
- package/dist/cli/chunks/chunk-RTFKTKSO.js +4 -0
- package/dist/cli/chunks/{chunk-IFEIY3NQ.js → chunk-RTY7VSZB.js} +2 -2
- package/dist/cli/chunks/{chunk-UOJBR4J3.js → chunk-S6IYEBAI.js} +2 -2
- package/dist/cli/chunks/{chunk-JP4P3P3D.js → chunk-SMVVAVN2.js} +2 -2
- package/dist/cli/chunks/{chunk-TNMQVG4A.js → chunk-T5KHJ3J7.js} +5 -5
- package/dist/cli/chunks/{chunk-7QGYJ5OY.js → chunk-TCYSBC7Y.js} +1 -1
- package/dist/cli/chunks/{chunk-WRRCQ2UE.js → chunk-TFW7CCKS.js} +1 -1
- package/dist/cli/chunks/chunk-TL6OFMXF.js +6 -0
- package/dist/cli/chunks/{chunk-UNUTC6TX.js → chunk-U3LJNNVJ.js} +5 -5
- package/dist/cli/chunks/chunk-UKKYMW3S.js +3 -0
- package/dist/cli/chunks/{chunk-HTZJSQ3C.js → chunk-UMVSWQNB.js} +2 -2
- package/dist/cli/chunks/{chunk-PBZI2ZPV.js → chunk-UTTSH4NH.js} +3 -3
- package/dist/cli/chunks/{chunk-DDPPSSHW.js → chunk-V5AADCBC.js} +1 -1
- package/dist/cli/chunks/{chunk-OXTFSIGN.js → chunk-V7DA4HAK.js} +1 -1
- package/dist/cli/chunks/{chunk-32UTLDNY.js → chunk-VBK2YAYY.js} +2 -2
- package/dist/cli/chunks/{chunk-F4JYIRW2.js → chunk-VEEYL2CZ.js} +2 -2
- package/dist/cli/chunks/{chunk-BXO536GT.js → chunk-VLD7Z2ED.js} +3 -3
- package/dist/cli/chunks/chunk-VO3DRK4P.js +3 -0
- package/dist/cli/chunks/{chunk-6EPHNJTL.js → chunk-VWUZSNVC.js} +1 -1
- package/dist/cli/chunks/{chunk-XUIA5KMS.js → chunk-VYTILW4R.js} +2 -2
- package/dist/cli/chunks/{chunk-YZYDTABJ.js → chunk-WCAVIJ64.js} +1 -1
- package/dist/cli/chunks/{chunk-KIKWJM6J.js → chunk-WCVCOT4E.js} +2 -2
- package/dist/cli/chunks/{chunk-OG2UI6A3.js → chunk-WM3SRRA6.js} +2 -2
- package/dist/cli/chunks/chunk-X3PZCXWG.js +2 -0
- package/dist/cli/chunks/{chunk-P73W2K7T.js → chunk-X4J73KP3.js} +1 -1
- package/dist/cli/chunks/{chunk-37BIGMJI.js → chunk-XDI5X3FR.js} +1 -1
- package/dist/cli/chunks/{chunk-V5PXQSFS.js → chunk-XGBU3KEM.js} +2 -2
- package/dist/cli/chunks/{chunk-ICP2ORGI.js → chunk-XGPTZUKQ.js} +2 -2
- package/dist/cli/chunks/{chunk-6OOYIO3W.js → chunk-XJKZ7FTR.js} +2 -2
- package/dist/cli/chunks/{chunk-H3KBIWTO.js → chunk-XNLIWQYE.js} +2 -2
- package/dist/cli/chunks/{chunk-4W4DYVSH.js → chunk-XS2XF3YG.js} +6 -5
- package/dist/cli/chunks/chunk-Y7B5EUIJ.js +180 -0
- package/dist/cli/chunks/{chunk-QTVWUQTB.js → chunk-YBBT3YYG.js} +1 -1
- package/dist/cli/chunks/{chunk-7X2Y727E.js → chunk-YNOCQ2SL.js} +1 -1
- package/dist/cli/chunks/{chunk-DINZR5CF.js → chunk-YOCULVHR.js} +1 -1
- package/dist/cli/chunks/{chunk-KIXYKUCI.js → chunk-YPX2TV3M.js} +1 -1
- package/dist/cli/chunks/{chunk-OXZLKP6C.js → chunk-Z2EA7A4Z.js} +1 -1
- package/dist/cli/chunks/{chunk-W5VJRDDG.js → chunk-ZMC543GI.js} +2 -2
- package/dist/cli/chunks/chunk-ZMHCMJ4J.js +2 -0
- package/dist/cli/chunks/{chunk-72AMFDC7.js → chunk-ZP75ASUU.js} +1 -1
- package/dist/cli/chunks/{chunk-JUVHZG7I.js → chunk-ZQHDA4O7.js} +1 -1
- package/dist/cli/chunks/{ci-7SGRCFPS.js → ci-6GUFAZMJ.js} +2 -2
- package/dist/cli/chunks/{ci-config-MX3URPZA.js → ci-config-J665XNOX.js} +2 -2
- package/dist/cli/chunks/{ci-output-M47NJY6D.js → ci-output-PEQQQWVD.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-5GAK45SW.js → circuit-breaker-HHB2JSKH.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-YXYSRH4Y.js → claude-flow-setup-JKUJRWPN.js} +2 -2
- package/dist/cli/chunks/client-HL2COSFM.js +2 -0
- package/dist/cli/chunks/{cline-installer-DLJ5QD5N.js → cline-installer-Y77BWTAN.js} +2 -2
- package/dist/cli/chunks/{code-ONKLMVQ2.js → code-LV2HAGJY.js} +3 -3
- package/dist/cli/chunks/{code-index-extractor-2232LGZN.js → code-index-extractor-4GKKSETB.js} +2 -2
- package/dist/cli/chunks/{codex-installer-UOWLYCMH.js → codex-installer-WMKBYE5Y.js} +2 -2
- package/dist/cli/chunks/{completions-MHX7GCC7.js → completions-SBGFAOIJ.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-43ZUJKZU.js → complexity-analyzer-AQHFIJXC.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-6Q5JR4FF.js → continuedev-installer-26AYFS2E.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-CZUMVHSI.js → copilot-installer-4UD3DK55.js} +2 -2
- package/dist/cli/chunks/core-handlers-IX7ATLM6.js +2 -0
- package/dist/cli/chunks/{cost-tracker-VS5ZW3XN.js → cost-tracker-TP4NZCG4.js} +2 -2
- package/dist/cli/chunks/{coverage-VWKTWZ6D.js → coverage-B2KIXHAI.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-YYKLAPJO.js +2 -0
- package/dist/cli/chunks/{cursor-installer-YIFEMORH.js → cursor-installer-AVZEQZ4W.js} +2 -2
- package/dist/cli/chunks/daemon-P574WWBW.js +18 -0
- package/dist/cli/chunks/{daemon-SHWJSJW5.js → daemon-XM2A7LQU.js} +3 -3
- package/dist/cli/chunks/{dag-attention-scheduler-TCC2WM46.js → dag-attention-scheduler-MIWOZ6ET.js} +2 -2
- package/dist/cli/chunks/{detect-IGTWSQMA.js → detect-TYR7HT23.js} +2 -2
- package/dist/cli/chunks/{dist-node-TCOTJVQX.js → dist-node-2DGVQGLS.js} +2 -2
- package/dist/cli/chunks/{domain-handler-55ZVYODR.js → domain-handler-RRA4ZOMF.js} +2 -2
- package/dist/cli/chunks/{domain-plugins-GJRWOHQP.js → domain-plugins-IVZEZ5RB.js} +2 -2
- package/dist/cli/chunks/domain-transfer-DOBI67K6.js +2 -0
- package/dist/cli/chunks/dream-T6EP7B3F.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-XAMNIKQL.js → embed-and-insert-pattern-VNIEOVPO.js} +2 -2
- package/dist/cli/chunks/{eval-GO22R4OZ.js → eval-QV4LVPUF.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-F2BRMJ3Y.js → experience-capture-middleware-DAPKT763.js} +3 -3
- package/dist/cli/chunks/{fast-paths-6RGPYALD.js → fast-paths-WVRFPHX7.js} +2 -2
- package/dist/cli/chunks/{feature-flags-ZGS3KLPH.js → feature-flags-DEFTUIYT.js} +2 -2
- package/dist/cli/chunks/{feature-flags-MIWQIOHU.js → feature-flags-O7ZXDDCD.js} +2 -2
- package/dist/cli/chunks/file-discovery-JYMVTDMU.js +2 -0
- package/dist/cli/chunks/fleet-FVAUMKUT.js +46 -0
- package/dist/cli/chunks/{gnn-wrapper-ALBJVW6T.js → gnn-wrapper-LS4LZJDR.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-ZMM53NDY.js → heartbeat-handler-RFTERD4K.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-4N5MUJ7S.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-ZPAJDSLR.js +2 -0
- package/dist/cli/chunks/hnsw-index-4CTH6RHB.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-RYUJPA7B.js → hnsw-legacy-bridge-GPKGFFHY.js} +2 -2
- package/dist/cli/chunks/{hnswlib-node-XM6XF3YV.js → hnswlib-node-PHL3F2PR.js} +2 -2
- package/dist/cli/chunks/{hooks-X62O7TJO.js → hooks-GYJ6D4QM.js} +36 -36
- package/dist/cli/chunks/hybrid-backend-AW6UTXQS.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-ZBWUPTVD.js → hypergraph-engine-YGEQPCKJ.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-DUMF6SJV.js → hypergraph-handler-ZIMM647V.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-MZK3JMSV.js +2 -0
- package/dist/cli/chunks/{init-guard-S4I2R46S.js → init-guard-VOMBXJXG.js} +2 -2
- package/dist/cli/chunks/{init-handler-L4KJHVWS.js → init-handler-PSMUBWK5.js} +26 -25
- package/dist/cli/chunks/init-wizard-FUC7KDVX.js +2 -0
- package/dist/cli/chunks/kernel-ZCPMCVMW.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-GNNB5FCZ.js → kilocode-installer-2YNTFBWJ.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-HR6ZAH7T.js → kiro-installer-XHJDPVAZ.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-NUJKEDNF.js +2 -0
- package/dist/cli/chunks/{learning-4IEEOHJS.js → learning-GNSIDRNG.js} +24 -24
- package/dist/cli/chunks/{llm-router-ZFMORP36.js → llm-router-LQDM7IU2.js} +4 -4
- package/dist/cli/chunks/llm-router-service-B2BFBQ76.js +2 -0
- package/dist/cli/chunks/{load-ZM43WGDO.js → load-YATHI72E.js} +2 -2
- package/dist/cli/chunks/load-test-ZHQ2MUGO.js +2 -0
- package/dist/cli/chunks/mcp-4Y6GDLYK.js +2 -0
- package/dist/cli/chunks/{memory-W5FZGVAD.js → memory-OUW3L7H2.js} +5 -5
- package/dist/cli/chunks/memory-backend-AAMQG6WH.js +2 -0
- package/dist/cli/chunks/memory-handlers-G3LFF53U.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-SXXGAQ2G.js → multi-model-executor-UBZJXAD2.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-PIRBUAB5.js → opencode-installer-AMMNWVH5.js} +2 -2
- package/dist/cli/chunks/{orchestrator-H5SQCQTB.js → orchestrator-Y44WDOER.js} +69 -25
- package/dist/cli/chunks/pattern-null-store-RFNVA46O.js +2 -0
- package/dist/cli/chunks/{pattern-usage-recorder-XZTWDI2T.js → pattern-usage-recorder-ESR42RME.js} +2 -2
- package/dist/cli/chunks/pipeline-EDTS6OSC.js +19 -0
- package/dist/cli/chunks/{platform-KJDABL5C.js → platform-5WONJSUX.js} +2 -2
- package/dist/cli/chunks/{plugin-V4KSBVVM.js → plugin-IJXPCLD4.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-JDHTKQAT.js → prime-radiant-advanced-wasm-5ECKGZK6.js} +2 -2
- package/dist/cli/chunks/project-root-7QL4KP5C.js +2 -0
- package/dist/cli/chunks/protocol-executor-2NW5BD4R.js +2 -0
- package/dist/cli/chunks/{protocol-handler-BNRONTQV.js → protocol-handler-DRD3GVNW.js} +2 -2
- package/dist/cli/chunks/{prove-ELLL6XMX.js → prove-KTGW2HMJ.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-G2JZOGKD.js +2 -0
- package/dist/cli/chunks/{quality-NH2QA4D4.js → quality-DV2WPRRS.js} +2 -2
- package/dist/cli/chunks/{quality-gate-JTKLF7GW.js → quality-gate-HFUAFVZC.js} +3 -3
- package/dist/cli/chunks/queen-coordinator-GRG5FT2A.js +2 -0
- package/dist/cli/chunks/{real-embeddings-J3KCKLPB.js → real-embeddings-RQRVOKVM.js} +2 -2
- package/dist/cli/chunks/{ref-validation-HNXQRP4F.js → ref-validation-QWSKS5OY.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-COJ6CX6S.js → roocode-installer-RBAYRCHX.js} +2 -2
- package/dist/cli/chunks/router-LQB5SWAF.js +2 -0
- package/dist/cli/chunks/routing-feedback-OEEXA55N.js +2 -0
- package/dist/cli/chunks/{routing-handler-WM33ZILE.js → routing-handler-FMPP3XKO.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-BBLXEA7A.js → ruvector-commands-KZZT4HWF.js} +2 -2
- package/dist/cli/chunks/rvf-dual-writer-BZK4M7BO.js +2 -0
- package/dist/cli/chunks/rvf-migration-adapter-EZZUJL2E.js +2 -0
- package/dist/cli/chunks/{rvf-migration-coordinator-P7H6HCAG.js → rvf-migration-coordinator-7CHEV35N.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-6COXTQZ3.js +2 -0
- package/dist/cli/chunks/{rvf-store-integrity-R5SPVRFP.js → rvf-store-integrity-Q2TH52SN.js} +2 -2
- package/dist/cli/chunks/safe-db-PE6G3L55.js +2 -0
- package/dist/cli/chunks/schedule-OLKQ6QYW.js +2 -0
- package/dist/cli/chunks/scheduler-LSGBDFAT.js +2 -0
- package/dist/cli/chunks/{security-AUDTRX3I.js → security-CUEA3UIM.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-PVDGBGI2.js → shared-rvf-adapter-DROMBRV2.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-LZ2GMSS2.js → shared-rvf-dual-writer-DBNABOP7.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-HH4DNTYH.js +2 -0
- package/dist/cli/chunks/{standalone-memory-XNOAI4G4.js → standalone-memory-IAHA3M6B.js} +2 -2
- package/dist/cli/chunks/{status-handler-K72XZE4T.js → status-handler-AFUCASTX.js} +2 -2
- package/dist/cli/chunks/{structural-health-NF3YY7U5.js → structural-health-AQRV6JJ6.js} +2 -2
- package/dist/cli/chunks/{sync-VBD5Y3E2.js → sync-GX7FMJHL.js} +2 -2
- package/dist/cli/chunks/sync-XW5TLZ7M.js +2 -0
- package/dist/cli/chunks/{task-handler-24S3WFVJ.js → task-handler-TFKVUTNF.js} +2 -2
- package/dist/cli/chunks/task-handlers-SS4ZDXNF.js +9 -0
- package/dist/cli/chunks/{test-XFSGQELD.js → test-D2XDJNDX.js} +17 -17
- package/dist/cli/chunks/test-runner-process-PSSBNNGR.js +2 -0
- package/dist/cli/chunks/{test-scheduling-VYUQ4CDE.js → test-scheduling-TS6I2PR7.js} +3 -3
- package/dist/cli/chunks/token-bootstrap-HBBLPCZ3.js +2 -0
- package/dist/cli/chunks/{token-usage-VLQ6WO2L.js → token-usage-3MBUX4PR.js} +2 -2
- package/dist/cli/chunks/{transformers-TOFMWWNM.js → transformers-ZWMQO3L2.js} +2 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-TYRQRJ2W.js +2 -0
- package/dist/cli/chunks/{types-JTWLBAZJ.js → types-5YEMGPSQ.js} +2 -2
- package/dist/cli/chunks/unified-memory-AGDZQ5XD.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-X5TJ3JDE.js +2 -0
- package/dist/cli/chunks/unified-persistence-UCV7YETW.js +2 -0
- package/dist/cli/chunks/{upgrade-4ABM72T4.js → upgrade-2TPBKIHI.js} +2 -2
- package/dist/cli/chunks/{validate-UDJCWKXI.js → validate-XRAXXFW6.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-TODOUWNN.js → validate-swarm-IYSCS3BZ.js} +2 -2
- package/dist/cli/chunks/visual-security-ZLXRIQZV.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-WBMAJPM5.js → web-tree-sitter-PZQ3ZG2P.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-BTT53TUL.js → windsurf-installer-U6XWFRVT.js} +2 -2
- package/dist/cli/chunks/witness-chain-CVIWYTD2.js +2 -0
- package/dist/cli/chunks/witness-chain-VBKORKOX.js +2 -0
- package/dist/cli/chunks/witness-chain-repair-K7YX2AO6.js +2 -0
- package/dist/cli/chunks/{witness-chain-verifier-FRY3LMGH.js → witness-chain-verifier-GUTC3W7N.js} +2 -2
- package/dist/cli/chunks/{witness-key-manager-X7QHQQWL.js → witness-key-manager-YBNKMOP6.js} +2 -2
- package/dist/cli/chunks/{workflow-QMZPAWQW.js → workflow-UAJUILFQ.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-3ZN7MVCE.js +2 -0
- package/dist/cli/chunks/wrappers-AVZ3GPAL.js +2 -0
- package/dist/cli/commands/fleet.js +23 -13
- package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +9 -2
- package/dist/cli/commands/hooks-handlers/session-hooks.js +2 -2
- package/dist/cli/commands/hooks-handlers/stats-hooks.js +3 -2
- package/dist/cli/commands/hooks-handlers/tool-loop-guardrail.js +11 -6
- package/dist/cli/commands/learning.js +5 -3
- package/dist/cli/commands/ruvector-commands.js +2 -1
- package/dist/cli/commands/test.js +11 -2
- package/dist/cli/handlers/init-handler.d.ts +12 -0
- package/dist/cli/handlers/init-handler.js +27 -12
- package/dist/cli/utils/ci-output.d.ts +11 -0
- package/dist/cli/utils/ci-output.js +2 -0
- package/dist/cli/utils/fleet-operation.d.ts +32 -0
- package/dist/cli/utils/fleet-operation.js +71 -0
- package/dist/cli/utils/fleet-result.d.ts +31 -0
- package/dist/cli/utils/fleet-result.js +124 -0
- package/dist/cli/utils/progress.d.ts +16 -2
- package/dist/cli/utils/progress.js +31 -14
- package/dist/context/sources/git-source.js +6 -2
- package/dist/coordination/consensus/consensus-engine.js +3 -1
- package/dist/coordination/handlers/code-intelligence-handlers.js +63 -7
- package/dist/coordination/handlers/coverage-collection.js +3 -1
- package/dist/coordination/handlers/coverage-handlers.js +10 -1
- package/dist/coordination/handlers/coverage-runner.d.ts +3 -8
- package/dist/coordination/handlers/coverage-runner.js +6 -22
- package/dist/coordination/handlers/coverage-stderr.d.ts +23 -0
- package/dist/coordination/handlers/coverage-stderr.js +39 -0
- package/dist/coordination/handlers/coverage-target.js +6 -3
- package/dist/coordination/handlers/handler-utils.js +3 -1
- package/dist/coordination/handlers/requirements-handlers.js +18 -3
- package/dist/coordination/handlers/security-handlers.js +45 -21
- package/dist/coordination/handlers/test-execution-handlers.js +25 -7
- package/dist/coordination/mincut/queen-integration.d.ts +39 -1
- package/dist/coordination/mincut/queen-integration.js +83 -6
- package/dist/coordination/protocols/learning-consolidation-archive.d.ts +2 -6
- package/dist/coordination/protocols/learning-consolidation-archive.js +4 -27
- package/dist/coordination/protocols/learning-consolidation.d.ts +24 -0
- package/dist/coordination/protocols/learning-consolidation.js +71 -22
- package/dist/coordination/queen-coordinator.d.ts +1 -1
- package/dist/coordination/queen-coordinator.js +27 -10
- package/dist/coordination/queen-event-handlers.js +13 -0
- package/dist/coordination/queen-task-management.d.ts +18 -24
- package/dist/coordination/queen-task-management.js +62 -168
- package/dist/coordination/queen-task-queue.d.ts +41 -0
- package/dist/coordination/queen-task-queue.js +194 -0
- package/dist/coordination/queen-types.d.ts +1 -1
- package/dist/coordination/queen-work-stealing.d.ts +6 -1
- package/dist/coordination/queen-work-stealing.js +7 -4
- package/dist/coordination/result-saver-adapters.d.ts +15 -0
- package/dist/coordination/result-saver-adapters.js +57 -0
- package/dist/coordination/result-saver.d.ts +1 -1
- package/dist/coordination/result-saver.js +8 -5
- package/dist/coordination/task-executability.d.ts +12 -0
- package/dist/coordination/task-executability.js +27 -0
- package/dist/coordination/workflow-orchestrator.d.ts +6 -0
- package/dist/coordination/workflow-orchestrator.js +22 -8
- package/dist/coordination/yaml-pipeline-loader.js +5 -2
- package/dist/domains/code-intelligence/index-path-guard.d.ts +5 -2
- package/dist/domains/code-intelligence/index-path-guard.js +20 -50
- package/dist/domains/code-intelligence/plugin.js +5 -1
- package/dist/domains/code-intelligence/services/metric-collector/index.d.ts +2 -2
- package/dist/domains/code-intelligence/services/metric-collector/index.js +2 -3
- package/dist/domains/code-intelligence/services/metric-collector/loc-counter.d.ts +1 -1
- package/dist/domains/code-intelligence/services/metric-collector/loc-counter.js +11 -36
- package/dist/domains/code-intelligence/services/metric-collector/test-counter.d.ts +1 -1
- package/dist/domains/code-intelligence/services/metric-collector/test-counter.js +45 -103
- package/dist/domains/code-intelligence/services/product-factors-bridge.js +7 -4
- package/dist/domains/contract-testing/services/api-compatibility.js +7 -6
- package/dist/domains/contract-testing/services/contract-validator.js +6 -4
- package/dist/domains/contract-testing/services/schema-validator.js +8 -5
- package/dist/domains/coverage-analysis/services/coverage-parser.js +19 -10
- package/dist/domains/defect-intelligence/interfaces.d.ts +2 -0
- package/dist/domains/defect-intelligence/plugin.js +11 -2
- package/dist/domains/defect-intelligence/prediction-history.d.ts +27 -0
- package/dist/domains/defect-intelligence/prediction-history.js +68 -0
- package/dist/domains/defect-intelligence/services/defect-predictor.js +25 -10
- package/dist/domains/enterprise-integration/services/message-broker-service.js +3 -2
- package/dist/domains/enterprise-integration/services/odata-service.js +2 -1
- package/dist/domains/enterprise-integration/services/sap-integration-service.js +3 -2
- package/dist/domains/learning-optimization/active-patterns.d.ts +2 -2
- package/dist/domains/learning-optimization/active-patterns.js +2 -2
- package/dist/domains/learning-optimization/coordinator.js +9 -5
- package/dist/domains/learning-optimization/interfaces.d.ts +8 -2
- package/dist/domains/learning-optimization/pattern-archive.d.ts +31 -0
- package/dist/domains/learning-optimization/pattern-archive.js +56 -0
- package/dist/domains/learning-optimization/pattern-consolidation.d.ts +12 -0
- package/dist/domains/learning-optimization/pattern-consolidation.js +41 -0
- package/dist/domains/learning-optimization/reward-source.d.ts +13 -0
- package/dist/domains/learning-optimization/reward-source.js +8 -1
- package/dist/domains/learning-optimization/services/learning-coordinator.d.ts +5 -3
- package/dist/domains/learning-optimization/services/learning-coordinator.js +47 -59
- package/dist/domains/learning-optimization/services/metrics-optimizer.js +14 -4
- package/dist/domains/learning-optimization/services/production-intel.js +3 -1
- package/dist/domains/security-compliance/generic-finding-dedup.d.ts +40 -0
- package/dist/domains/security-compliance/generic-finding-dedup.js +63 -0
- package/dist/domains/security-compliance/plugin.js +17 -3
- package/dist/domains/security-compliance/sast-path-guard.d.ts +9 -0
- package/dist/domains/security-compliance/sast-path-guard.js +17 -0
- package/dist/domains/security-compliance/services/scanners/dast-auth-testing.js +46 -56
- package/dist/domains/security-compliance/services/scanners/dast-helpers.js +76 -91
- package/dist/domains/security-compliance/services/scanners/dast-injection-testing.js +52 -62
- package/dist/domains/security-compliance/services/scanners/dast-scanner.d.ts +21 -1
- package/dist/domains/security-compliance/services/scanners/dast-scanner.js +29 -24
- package/dist/domains/security-compliance/services/scanners/dependency-resolver.js +14 -6
- package/dist/domains/security-compliance/services/scanners/sast-scanner.js +4 -2
- package/dist/domains/security-compliance/services/scanners/scanner-orchestrator.js +4 -1
- package/dist/domains/security-compliance/services/security-auditor-sast.js +2 -2
- package/dist/domains/security-compliance/services/security-auditor-secrets.js +2 -2
- package/dist/domains/security-compliance/services/security-auditor.js +3 -2
- package/dist/domains/test-execution/coordinator.d.ts +6 -0
- package/dist/domains/test-execution/coordinator.js +28 -22
- package/dist/domains/test-execution/interfaces.d.ts +36 -1
- package/dist/domains/test-execution/plugin.js +19 -4
- package/dist/domains/test-execution/services/flaky-detector.js +9 -7
- package/dist/domains/test-execution/services/retry-handler.js +46 -7
- package/dist/domains/test-execution/services/retry-outcome.d.ts +18 -0
- package/dist/domains/test-execution/services/retry-outcome.js +53 -0
- package/dist/domains/test-execution/services/runner-test-cases.d.ts +11 -0
- package/dist/domains/test-execution/services/runner-test-cases.js +20 -2
- package/dist/domains/test-execution/services/test-executor.js +8 -8
- package/dist/domains/test-generation/coordinator.js +2 -2
- package/dist/domains/test-generation/plugin.js +7 -2
- package/dist/domains/test-generation/services/pattern-matcher.js +4 -4
- package/dist/domains/test-generation/services/test-data-generator.js +3 -1
- package/dist/domains/test-generation/services/test-generator.js +2 -2
- package/dist/domains/visual-accessibility/services/axe-core-audit.js +1 -1
- package/dist/governance/evolution-pipeline-integration.js +3 -1
- package/dist/hooks/cross-phase-hooks.js +5 -2
- package/dist/init/init-wizard-steps.js +5 -1
- package/dist/init/phases/04-database.js +7 -0
- package/dist/init/phases/10-workers.js +50 -6
- package/dist/init/phases/12-verification.js +14 -4
- package/dist/init/settings-merge.js +7 -4
- package/dist/integrations/agentic-flow/reasoning-bank/experience-replay.d.ts +7 -0
- package/dist/integrations/agentic-flow/reasoning-bank/experience-replay.js +31 -2
- package/dist/integrations/agentic-flow/reasoning-bank/index.d.ts +3 -1
- package/dist/integrations/agentic-flow/reasoning-bank/index.js +5 -0
- package/dist/integrations/browser/agent-browser/client.js +37 -52
- package/dist/integrations/browser/agent-browser/command-executor.d.ts +33 -27
- package/dist/integrations/browser/agent-browser/command-executor.js +53 -54
- package/dist/integrations/browser/agent-browser/session-manager.d.ts +1 -1
- package/dist/integrations/browser/agent-browser/session-manager.js +8 -9
- package/dist/integrations/browser/web-content-fetcher.js +9 -3
- package/dist/integrations/ruvector/filter-adapter.js +2 -1
- package/dist/integrations/vibium/client.js +2 -2
- package/dist/integrations/vibium/runtime.d.ts +1 -1
- package/dist/integrations/vibium/runtime.js +14 -11
- package/dist/kernel/unified-memory-schemas.d.ts +3 -2
- package/dist/kernel/unified-memory-schemas.js +3 -2
- package/dist/kernel/unified-memory.js +25 -6
- package/dist/learning/dream/dream-commit.d.ts +65 -0
- package/dist/learning/dream/dream-commit.js +104 -0
- package/dist/learning/dream/dream-engine.d.ts +81 -31
- package/dist/learning/dream/dream-engine.js +225 -168
- package/dist/learning/dream/dream-insights-pruner.d.ts +9 -3
- package/dist/learning/dream/dream-insights-pruner.js +16 -30
- package/dist/learning/dream/index.d.ts +3 -2
- package/dist/learning/dream/index.js +3 -1
- package/dist/learning/dream/insight-generator.js +5 -4
- package/dist/learning/dream/rvcow-branch-manager.d.ts +8 -1
- package/dist/learning/dream/rvcow-branch-manager.js +8 -1
- package/dist/learning/dream/speculative-dreamer.d.ts +50 -74
- package/dist/learning/dream/speculative-dreamer.js +64 -111
- package/dist/learning/dream/spreading-activation.d.ts +2 -1
- package/dist/learning/dream/spreading-activation.js +15 -6
- package/dist/learning/experience-capture.d.ts +9 -0
- package/dist/learning/experience-capture.js +18 -4
- package/dist/learning/memory-auditor.js +3 -1
- package/dist/learning/qe-patterns.js +2 -1
- package/dist/learning/qe-reasoning-bank-types.d.ts +17 -2
- package/dist/learning/qe-reasoning-bank.js +22 -11
- package/dist/learning/real-qe-reasoning-bank.d.ts +19 -0
- package/dist/learning/real-qe-reasoning-bank.js +70 -38
- package/dist/learning/sqlite-persistence.d.ts +6 -0
- package/dist/learning/sqlite-persistence.js +16 -2
- package/dist/learning/usage-outcome.d.ts +68 -0
- package/dist/learning/usage-outcome.js +84 -0
- package/dist/mcp/background-workers.d.ts +13 -1
- package/dist/mcp/background-workers.js +17 -3
- package/dist/mcp/bundle.js +612 -580
- package/dist/mcp/handlers/core-handlers.js +11 -0
- package/dist/mcp/handlers/domain-handler-configs.d.ts +7 -0
- package/dist/mcp/handlers/domain-handler-configs.js +19 -5
- package/dist/mcp/handlers/handler-factory.d.ts +2 -1
- package/dist/mcp/handlers/handler-factory.js +36 -15
- package/dist/mcp/handlers/orchestrate-routes.d.ts +36 -0
- package/dist/mcp/handlers/orchestrate-routes.js +88 -0
- package/dist/mcp/handlers/task-handlers.d.ts +16 -0
- package/dist/mcp/handlers/task-handlers.js +77 -24
- package/dist/mcp/handlers/validation-pipeline-handler.js +14 -10
- package/dist/mcp/protocol-server.js +10 -8
- package/dist/mcp/qe-tool-bridge.js +3 -0
- package/dist/mcp/security/schema-validator.js +3 -2
- package/dist/mcp/services/reasoning-bank-service.d.ts +3 -1
- package/dist/mcp/services/reasoning-bank-service.js +4 -0
- package/dist/mcp/tool-annotations.js +4 -1
- package/dist/mcp/tools/code-intelligence/c4.js +11 -1
- package/dist/mcp/tools/coherence/check.js +1 -0
- package/dist/mcp/tools/coherence/consensus.js +4 -2
- package/dist/mcp/tools/coverage-analysis/index.js +31 -2
- package/dist/mcp/tools/learning-optimization/dream.d.ts +8 -8
- package/dist/mcp/tools/learning-optimization/dream.js +38 -34
- package/dist/mcp/tools/learning-optimization/optimize.d.ts +18 -2
- package/dist/mcp/tools/learning-optimization/optimize.js +59 -12
- package/dist/mcp/tools/mincut/index.js +3 -0
- package/dist/mcp/tools/quality-assessment/gate.js +19 -1
- package/dist/mcp/tools/qx-analysis/analyze.js +1 -0
- package/dist/mcp/tools/requirements-validation/quality-criteria.js +17 -3
- package/dist/mcp/tools/security-compliance/scan.js +4 -2
- package/dist/mcp/tools/test-execution/e2e-execute.js +2 -2
- package/dist/mcp/tools/test-execution/execute.js +3 -2
- package/dist/memory/crdt/crdt-store.js +5 -0
- package/dist/memory/crdt/lww-register.js +12 -2
- package/dist/migration/agent-compat.js +7 -5
- package/dist/migrations/20261018_add_dream_insights_archive.d.ts +27 -0
- package/dist/migrations/20261018_add_dream_insights_archive.js +57 -0
- package/dist/optimization/early-exit-token-optimizer.js +3 -1
- package/dist/planning/goap-planner.js +5 -0
- package/dist/planning/plan-executor.js +5 -0
- package/dist/shared/git/git-analyzer.d.ts +49 -0
- package/dist/shared/git/git-analyzer.js +159 -319
- package/dist/shared/git/git-process.d.ts +22 -0
- package/dist/shared/git/git-process.js +37 -0
- package/dist/shared/git/index.d.ts +1 -0
- package/dist/shared/git/index.js +1 -0
- package/dist/shared/io/confined-read.d.ts +74 -0
- package/dist/shared/io/confined-read.js +256 -0
- package/dist/shared/io/file-reader.d.ts +6 -6
- package/dist/shared/io/file-reader.js +16 -42
- package/dist/shared/io/payload-path-guard.d.ts +75 -0
- package/dist/shared/io/payload-path-guard.js +190 -0
- package/dist/shared/llm/providers/claude-code.js +4 -1
- package/dist/shared/llm/router/agent-router-config.js +2 -1
- package/dist/shared/llm/translation/tool-translator.js +2 -1
- package/dist/shared/native-module-errors.d.ts +51 -0
- package/dist/shared/native-module-errors.js +129 -0
- package/dist/shared/safe-db.js +14 -4
- package/dist/shared/security/osv-client.js +4 -1
- package/dist/shared/test-runner-args.d.ts +5 -0
- package/dist/shared/test-runner-args.js +6 -1
- package/dist/shared/test-runner-process.d.ts +6 -0
- package/dist/shared/test-runner-process.js +14 -0
- package/dist/shared/test-runner-verdict.d.ts +9 -1
- package/dist/shared/test-runner-verdict.js +15 -4
- package/dist/shared/types/test-frameworks.js +2 -2
- package/dist/shared/utils/namespaced-search.d.ts +14 -0
- package/dist/shared/utils/namespaced-search.js +19 -1
- package/dist/shared/utils/safe-expression-evaluator.js +4 -3
- package/dist/strange-loop/infra-healing/recovery-playbook.js +13 -3
- package/dist/sync/readers/json-reader.js +2 -1
- package/dist/validation/anchor-set.d.ts +6 -0
- package/dist/validation/anchor-set.js +9 -1
- package/dist/validation/gate-reexecute.js +7 -4
- package/dist/validation/quality-gate-runner.d.ts +7 -1
- package/dist/validation/quality-gate-runner.js +3 -3
- package/dist/workers/daemon.js +13 -1
- package/dist/workers/quality-daemon/git-watcher.js +9 -9
- package/dist/workers/workers/defect-predictor.d.ts +8 -3
- package/dist/workers/workers/defect-predictor.js +48 -49
- package/dist/workers/workers/learning-consolidation.d.ts +2 -0
- package/dist/workers/workers/learning-consolidation.js +12 -1
- package/dist/workflows/browser/workflow-loader.js +8 -5
- package/package.json +1 -1
- package/dist/cli/chunks/adapter-R2Q4QGXQ.js +0 -2
- package/dist/cli/chunks/agent-booster-wasm-427FRKWG.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-3RENLQWP.js +0 -2
- package/dist/cli/chunks/base-67DXSAYM.js +0 -2
- package/dist/cli/chunks/browser-CT3MTV6G.js +0 -4
- package/dist/cli/chunks/browser-workflow-NDXRROWZ.js +0 -2
- package/dist/cli/chunks/chunk-2XITOPYV.js +0 -6
- package/dist/cli/chunks/chunk-4URT6JO2.js +0 -2
- package/dist/cli/chunks/chunk-5LAAZLUC.js +0 -4
- package/dist/cli/chunks/chunk-6PXA2BQJ.js +0 -742
- package/dist/cli/chunks/chunk-6YL6JOQB.js +0 -4
- package/dist/cli/chunks/chunk-7DMA5NYL.js +0 -4
- package/dist/cli/chunks/chunk-AR2E4B7K.js +0 -6
- package/dist/cli/chunks/chunk-F2SQPP6U.js +0 -4
- package/dist/cli/chunks/chunk-FJ4VTLLK.js +0 -2
- package/dist/cli/chunks/chunk-FV3NHVC7.js +0 -59
- package/dist/cli/chunks/chunk-G3BKZNFL.js +0 -120
- package/dist/cli/chunks/chunk-GR3JYE5A.js +0 -2
- package/dist/cli/chunks/chunk-J3WGK22W.js +0 -2
- package/dist/cli/chunks/chunk-JEP4ULR6.js +0 -21
- package/dist/cli/chunks/chunk-JK2ME6IT.js +0 -2
- package/dist/cli/chunks/chunk-KHSRIPBP.js +0 -180
- package/dist/cli/chunks/chunk-KTSLTZSG.js +0 -2
- package/dist/cli/chunks/chunk-N5PDFGCQ.js +0 -180
- package/dist/cli/chunks/chunk-O3JLOVZX.js +0 -4
- package/dist/cli/chunks/chunk-P2CXVNKK.js +0 -4
- package/dist/cli/chunks/chunk-THAY7WHO.js +0 -12
- package/dist/cli/chunks/chunk-VU2EL424.js +0 -14
- package/dist/cli/chunks/chunk-VXZJOKOX.js +0 -2
- package/dist/cli/chunks/chunk-VYLM2YV5.js +0 -12
- package/dist/cli/chunks/chunk-XZJ2O3VC.js +0 -2
- package/dist/cli/chunks/client-ZP3CTVRF.js +0 -2
- package/dist/cli/chunks/core-handlers-JSRXQWPE.js +0 -2
- package/dist/cli/chunks/cross-domain-router-7UKODQWG.js +0 -2
- package/dist/cli/chunks/daemon-YIFT46FH.js +0 -34
- package/dist/cli/chunks/domain-transfer-6EF75EKU.js +0 -2
- package/dist/cli/chunks/dream-UDLM6M55.js +0 -2
- package/dist/cli/chunks/file-discovery-THWOUQ7Z.js +0 -2
- package/dist/cli/chunks/fleet-ADL57COA.js +0 -44
- package/dist/cli/chunks/heartbeat-scheduler-HGOC5KH3.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-EPSA6AP7.js +0 -2
- package/dist/cli/chunks/hnsw-index-RMFOPYGY.js +0 -2
- package/dist/cli/chunks/hybrid-backend-NZ3G4WBX.js +0 -2
- package/dist/cli/chunks/impact-analyzer-WZC6NHFP.js +0 -2
- package/dist/cli/chunks/init-wizard-422UZYQ5.js +0 -2
- package/dist/cli/chunks/kernel-N7PJ6FCE.js +0 -2
- package/dist/cli/chunks/knowledge-graph-SZCVQF37.js +0 -2
- package/dist/cli/chunks/llm-router-service-4DE5WDUZ.js +0 -2
- package/dist/cli/chunks/load-test-POMIF4Q4.js +0 -2
- package/dist/cli/chunks/mcp-CRZKZE37.js +0 -2
- package/dist/cli/chunks/memory-backend-4P6AHSOY.js +0 -2
- package/dist/cli/chunks/memory-handlers-NK6NV3GE.js +0 -2
- package/dist/cli/chunks/pattern-null-store-CCHQHGQG.js +0 -2
- package/dist/cli/chunks/pipeline-5LMLBIJ7.js +0 -19
- package/dist/cli/chunks/project-root-X72FSM2F.js +0 -2
- package/dist/cli/chunks/protocol-executor-QW6XN6QN.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-ZD3WF647.js +0 -2
- package/dist/cli/chunks/queen-coordinator-S4U4MKK2.js +0 -2
- package/dist/cli/chunks/router-CXZKOOTR.js +0 -2
- package/dist/cli/chunks/routing-feedback-IYFANYY5.js +0 -2
- package/dist/cli/chunks/rvf-dual-writer-HCLQ5WUQ.js +0 -2
- package/dist/cli/chunks/rvf-migration-adapter-XCLUWOO3.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-MRT5H3IP.js +0 -2
- package/dist/cli/chunks/safe-db-WFODRGVZ.js +0 -2
- package/dist/cli/chunks/schedule-RO55OQXG.js +0 -2
- package/dist/cli/chunks/scheduler-XXMJCH24.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-AWRIS4MK.js +0 -2
- package/dist/cli/chunks/sync-UVXA6CT2.js +0 -2
- package/dist/cli/chunks/task-handlers-GUYW2EPJ.js +0 -9
- package/dist/cli/chunks/token-bootstrap-EDK6FNQ3.js +0 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-MI3NZKUD.js +0 -2
- package/dist/cli/chunks/unified-memory-6JWHV6EF.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-4UANU6NU.js +0 -2
- package/dist/cli/chunks/unified-persistence-KGGNA46H.js +0 -2
- package/dist/cli/chunks/visual-security-6VZNQLH7.js +0 -2
- package/dist/cli/chunks/witness-chain-AKKHWEWU.js +0 -2
- package/dist/cli/chunks/witness-chain-TATPXQRK.js +0 -2
- package/dist/cli/chunks/witness-chain-repair-2HGJGE7O.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-4GAW7HNZ.js +0 -2
- package/dist/cli/chunks/wrappers-ZD5NBHYI.js +0 -2
|
@@ -0,0 +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.11");process.exit(0)}
|
|
2
|
+
import{a}from"./chunk-HFFPYC4G.js";import"./chunk-ZMHCMJ4J.js";import"./chunk-RTY7VSZB.js";import"./chunk-OV5RPLKV.js";import"./chunk-LD5CFK53.js";import"./chunk-XGPTZUKQ.js";import"./chunk-JFLU7L3W.js";import"./chunk-WM3SRRA6.js";import"./chunk-XGBU3KEM.js";import"./chunk-G2IJFNZS.js";import"./chunk-M5XYIQYZ.js";import"./chunk-NQZNMCZU.js";import"./chunk-5N25I53C.js";import"./chunk-OYJC3YON.js";import"./chunk-EJPK7OTR.js";import"./chunk-7R5HC56U.js";import"./chunk-QDESWOZP.js";import"./chunk-IO5537OM.js";import"./chunk-FZHSG75I.js";import"./chunk-VO3DRK4P.js";import"./chunk-HJ3XNTTJ.js";import"./chunk-76SNL7GU.js";import"./chunk-EH2S6AOR.js";import"./chunk-XNLIWQYE.js";import"./chunk-4MUBW4RT.js";import"./chunk-DDEOZPWJ.js";import"./chunk-XJKZ7FTR.js";import"./chunk-CFWGGRE7.js";export{a as BrowserWorkflowTool};
|
|
@@ -1 +1 @@
|
|
|
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.11");process.exit(0)}
|
|
@@ -0,0 +1,141 @@
|
|
|
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.11");process.exit(0)}
|
|
2
|
+
import{a as ie}from"./chunk-57LNKSW7.js";import{c as te,d as ne}from"./chunk-FWSGPE3V.js";import{a as ee}from"./chunk-JGJXXAS6.js";import{c as R}from"./chunk-4RH5I24Q.js";import{b as A,d as Y}from"./chunk-JFLU7L3W.js";import{b as J,c as K,e as ue}from"./chunk-WM3SRRA6.js";import{a as N,b as X,d as le}from"./chunk-M5XYIQYZ.js";import{i as D}from"./chunk-7R5HC56U.js";import{a as Z,d as he}from"./chunk-QDESWOZP.js";import{a as Q}from"./chunk-IO5537OM.js";import{c as _}from"./chunk-FZHSG75I.js";import{a as C,e as F}from"./chunk-DDEOZPWJ.js";var k={dbPath:".agentic-qe/dream.db",similarityThreshold:.5,maxEdgesPerNode:20,walMode:!0,debug:!1};Y();F();var T=class d{config;db=null;persistence=null;prepared=new Map;initialized=!1;constructor(e){this.config={...k,...e}}async initialize(){if(!this.initialized)try{if(this.persistence=R(),this.persistence.isInitialized()||await this.persistence.initialize(),this.db=this.persistence.getDatabase(),this.prepareStatements(),this.initialized=!0,this.config.debug){let e=await this.getStats();console.log(`[ConceptGraph] Initialized: ${this.persistence.getDbPath()}`,e)}}catch(e){throw new Error(`Failed to initialize ConceptGraph: ${C(e)}`)}}prepareStatements(){if(!this.db)throw new Error("Database not initialized");this.prepared.set("insertNode",this.db.prepare(`
|
|
3
|
+
INSERT INTO concept_nodes
|
|
4
|
+
(id, concept_type, content, embedding, activation_level, last_activated, pattern_id, metadata)
|
|
5
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
6
|
+
`)),this.prepared.set("getNode",this.db.prepare(`
|
|
7
|
+
SELECT * FROM concept_nodes WHERE id = ?
|
|
8
|
+
`)),this.prepared.set("updateActivation",this.db.prepare(`
|
|
9
|
+
UPDATE concept_nodes
|
|
10
|
+
SET activation_level = ?, last_activated = datetime('now')
|
|
11
|
+
WHERE id = ?
|
|
12
|
+
`)),this.prepared.set("getActiveNodes",this.db.prepare(`
|
|
13
|
+
SELECT * FROM concept_nodes
|
|
14
|
+
WHERE activation_level >= ?
|
|
15
|
+
ORDER BY activation_level DESC
|
|
16
|
+
`)),this.prepared.set("getNodesByType",this.db.prepare(`
|
|
17
|
+
SELECT * FROM concept_nodes WHERE concept_type = ?
|
|
18
|
+
`)),this.prepared.set("getAllNodes",this.db.prepare(`
|
|
19
|
+
SELECT * FROM concept_nodes
|
|
20
|
+
`)),this.prepared.set("insertEdge",this.db.prepare(`
|
|
21
|
+
INSERT INTO concept_edges
|
|
22
|
+
(id, source, target, edge_type, weight, evidence)
|
|
23
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
24
|
+
`)),this.prepared.set("getEdge",this.db.prepare(`
|
|
25
|
+
SELECT * FROM concept_edges WHERE source = ? AND target = ?
|
|
26
|
+
`)),this.prepared.set("updateEdge",this.db.prepare(`
|
|
27
|
+
UPDATE concept_edges
|
|
28
|
+
SET weight = ?, evidence = evidence + 1, updated_at = datetime('now')
|
|
29
|
+
WHERE source = ? AND target = ?
|
|
30
|
+
`)),this.prepared.set("getOutgoingEdges",this.db.prepare(`
|
|
31
|
+
SELECT * FROM concept_edges WHERE source = ?
|
|
32
|
+
`)),this.prepared.set("getIncomingEdges",this.db.prepare(`
|
|
33
|
+
SELECT * FROM concept_edges WHERE target = ?
|
|
34
|
+
`)),this.prepared.set("countNodes",this.db.prepare(`
|
|
35
|
+
SELECT COUNT(*) as count FROM concept_nodes
|
|
36
|
+
`)),this.prepared.set("countEdges",this.db.prepare(`
|
|
37
|
+
SELECT COUNT(*) as count FROM concept_edges
|
|
38
|
+
`)),this.prepared.set("countByType",this.db.prepare(`
|
|
39
|
+
SELECT concept_type, COUNT(*) as count FROM concept_nodes GROUP BY concept_type
|
|
40
|
+
`))}async addNode(e){this.ensureInitialized();let t=D(),n=new Date().toISOString(),i=this.prepared.get("insertNode");if(!i)throw new Error("Prepared statement not found: insertNode");let s=e.embedding?Buffer.from(new Float32Array(e.embedding).buffer):null;return i.run(t,e.conceptType,e.content,s,0,n,e.patternId||null,e.metadata?JSON.stringify(e.metadata):null),this.config.debug&&console.log(`[ConceptGraph] Added node: ${t} (${e.conceptType})`),t}async getNode(e){this.ensureInitialized();let t=this.prepared.get("getNode");if(!t)throw new Error("Prepared statement not found: getNode");let n=t.get(e);return n?this.rowToNode(n):null}async updateActivation(e,t){this.ensureInitialized();let n=this.prepared.get("updateActivation");if(!n)throw new Error("Prepared statement not found: updateActivation");let i=Math.max(0,Math.min(1,t));n.run(i,e)}async getActiveNodes(e=.1){this.ensureInitialized();let t=this.prepared.get("getActiveNodes");if(!t)throw new Error("Prepared statement not found: getActiveNodes");return t.all(e).map(i=>this.rowToNode(i))}async getNodesByType(e){this.ensureInitialized();let t=this.prepared.get("getNodesByType");if(!t)throw new Error("Prepared statement not found: getNodesByType");return t.all(e).map(i=>this.rowToNode(i))}async addEdge(e,t,n,i=1){this.ensureInitialized();let s=await this.getEdgeBetween(e,t);if(s)return await this.strengthenEdge(e,t,.1),s.id;let r=D(),o=this.prepared.get("insertEdge");if(!o)throw new Error("Prepared statement not found: insertEdge");return o.run(r,e,t,n,Math.max(0,Math.min(1,i)),1),this.config.debug&&console.log(`[ConceptGraph] Added edge: ${e} -> ${t} (${n})`),r}async strengthenEdge(e,t,n=.1){this.ensureInitialized();let i=await this.getEdgeBetween(e,t);if(!i)return;let s=Math.min(1,i.weight+n),r=this.prepared.get("updateEdge");if(!r)throw new Error("Prepared statement not found: updateEdge");r.run(s,e,t)}async getNeighbors(e){this.ensureInitialized();let t=[],n=this.prepared.get("getOutgoingEdges");if(!n)throw new Error("Prepared statement not found: getOutgoingEdges");let i=n.all(e);for(let o of i){let a=await this.getNode(o.target);a&&t.push({node:a,edge:this.rowToEdge(o)})}let s=this.prepared.get("getIncomingEdges");if(!s)throw new Error("Prepared statement not found: getIncomingEdges");let r=s.all(e);for(let o of r){let a=await this.getNode(o.source);a&&t.push({node:a,edge:this.rowToEdge(o)})}return t}async findPath(e,t,n=5){this.ensureInitialized();let i=new Set,s=[{nodeId:e,path:[e]}];for(;s.length>0;){let r=s.shift();if(r.nodeId===t){let a=[];for(let c of r.path){let p=await this.getNode(c);p&&a.push(p)}return a}if(r.path.length>n||i.has(r.nodeId))continue;i.add(r.nodeId);let o=await this.getNeighbors(r.nodeId);for(let{node:a}of o)i.has(a.id)||s.push({nodeId:a.id,path:[...r.path,a.id]})}return[]}async getCluster(e,t=2){this.ensureInitialized();let n=new Set,i=[],s=async(r,o)=>{if(n.has(r)||o>t)return;n.add(r);let a=await this.getNode(r);if(a&&(i.push(a),o<t)){let c=await this.getNeighbors(r);for(let{node:p}of c)await s(p.id,o+1)}};return await s(e,0),i}static TECHNIQUE_PATTERN_TYPES=new Set(["coverage-strategy","mutation-strategy","refactor-safe","error-handling","meta-optimization"]);async loadFromPatterns(e){this.ensureInitialized();let t=0,n=[],i=new Map;for(let s of e)try{if(await this.findNodeByPatternId(s.id))continue;let o=s.patternType&&d.TECHNIQUE_PATTERN_TYPES.has(s.patternType)?"technique":"pattern",a=await this.addNode({conceptType:o,content:`${s.name}: ${s.description}`,patternId:s.id,metadata:{domain:s.domain,patternType:s.patternType,confidence:s.confidence,successRate:s.successRate}});t++,n.push(a);let c=s.domain||"unknown";i.has(c)||i.set(c,[]),i.get(c).push(a);let p=await this.findDomainNode(s.domain);if(!p){let l=await this.addNode({conceptType:"domain",content:s.domain,metadata:{patternCount:1}});p=await this.getNode(l)}p&&await this.addEdge(a,p.id,"co_occurrence",.8)}catch(r){this.config.debug&&console.error(`[ConceptGraph] Failed to load pattern: ${s.id}`,r)}if(t>0){let s=await this.discoverSameDomainEdges(i),r=await this.pruneEdges();this.config.debug&&console.log(`[ConceptGraph] Discovered ${s} same-domain edges, pruned ${r}`)}return console.log(`[ConceptGraph] Loaded ${t} new patterns (${e.length-t} already existed)`),t}async discoverSameDomainEdges(e){if(this.ensureInitialized(),!this.db)return 0;let t=15,n=5e3,i=0;if(e&&e.size>0)for(let[s,r]of e){let o=this.countDomainSimilarityEdges(s);if(o>=n){console.log(`[ConceptGraph] Domain '${s}' already at edge cap (${o}/${n}), skipping`);continue}let a=new Set(r),c=n-o,l=this.db.prepare("SELECT id, metadata FROM concept_nodes WHERE concept_type IN ('pattern', 'technique')").all().filter(u=>{if(a.has(u.id))return!1;let g=u.metadata?A(u.metadata):{};return String(g.domain||"unknown")===s}),h=this.db.transaction(()=>{let u=0;for(let g of r){let f=0;for(let v of l){if(f>=t||u>=c)break;if(!this.prepared.get("getEdge")?.get(g,v.id)){let E=D();this.prepared.get("insertEdge").run(E,g,v.id,"similarity",.6,1),u++,f++}}if(u>=c)break}for(let g=0;g<r.length&&u<c;g++){let f=0;for(let v=g+1;v<r.length&&u<c&&!(f>=t);v++)if(!this.prepared.get("getEdge")?.get(r[g],r[v])){let E=D();this.prepared.get("insertEdge").run(E,r[g],r[v],"similarity",.6,1),u++,f++}}return u});i+=h()}else{let s=this.db.prepare("SELECT id, metadata FROM concept_nodes WHERE concept_type = 'pattern'").all(),r=new Map;for(let a of s){let c=a.metadata?A(a.metadata):{},p=String(c.domain||"unknown");r.has(p)||r.set(p,[]),r.get(p).push(a)}let o=this.db.transaction(()=>{let a=0;for(let[c,p]of r){let l=this.countDomainSimilarityEdges(c);if(l>=n)continue;let h=0,u=n-l;for(let g=0;g<p.length&&h<u;g++){let f=0;for(let v=g+1;v<p.length&&h<u&&!(f>=t);v++)if(!this.prepared.get("getEdge")?.get(p[g].id,p[v].id)){let E=D();this.prepared.get("insertEdge").run(E,p[g].id,p[v].id,"similarity",.6,1),a++,h++,f++}}}return a});i+=o()}return i}connectToDomainMates(e,t,n,i=10){if(!this.db)return;let s=this.db.prepare(`SELECT id FROM concept_nodes
|
|
41
|
+
WHERE concept_type IN ('pattern', 'technique')
|
|
42
|
+
AND json_extract(metadata, '$.domain') = ?
|
|
43
|
+
AND (pattern_id IS NULL OR pattern_id != ?)
|
|
44
|
+
LIMIT ?`).all(t,n,i);for(let r of s)this.prepared.get("getEdge")?.get(e,r.id)||this.prepared.get("insertEdge").run(D(),e,r.id,"co_occurrence",.4,1)}async loadFailuresAsErrors(e){this.ensureInitialized();let t=0;for(let n of e)try{let i=`error:${n.id}`;if(await this.findNodeByPatternId(i))continue;let r=await this.addNode({conceptType:"error",content:n.failureMode,patternId:i,metadata:{domain:n.domain,sourcePatternId:n.sourcePatternId}});t++,this.connectToDomainMates(r,n.domain,n.sourcePatternId)}catch(i){this.config.debug&&console.error(`[ConceptGraph] Failed to load failure: ${n.id}`,i)}return t}async loadSuccessesAsOutcomes(e){this.ensureInitialized();let t=0;for(let n of e)try{let i=`outcome:${n.id}`;if(await this.findNodeByPatternId(i))continue;let r=await this.addNode({conceptType:"outcome",content:n.description,patternId:i,metadata:{domain:n.domain,sourcePatternId:n.sourcePatternId}});t++,this.connectToDomainMates(r,n.domain,n.sourcePatternId)}catch(i){this.config.debug&&console.error(`[ConceptGraph] Failed to load success: ${n.id}`,i)}return t}countDomainSimilarityEdges(e){return this.db?this.db.prepare(`
|
|
45
|
+
SELECT COUNT(*) as count FROM concept_edges e
|
|
46
|
+
JOIN concept_nodes n ON e.source = n.id
|
|
47
|
+
WHERE e.edge_type = 'similarity'
|
|
48
|
+
AND n.concept_type IN ('pattern', 'technique')
|
|
49
|
+
AND json_extract(n.metadata, '$.domain') = ?
|
|
50
|
+
`).get(e).count:0}async pruneEdges(e=15,t=.3){if(this.ensureInitialized(),!this.db)return 0;let n=0;return n=this.db.transaction(()=>{let s=0,r=this.db.prepare(`
|
|
51
|
+
DELETE FROM concept_edges
|
|
52
|
+
WHERE edge_type = 'similarity' AND weight < ?
|
|
53
|
+
`).run(t);s+=r.changes;let o=this.db.prepare(`
|
|
54
|
+
SELECT source, COUNT(*) as cnt FROM concept_edges
|
|
55
|
+
WHERE edge_type = 'similarity'
|
|
56
|
+
GROUP BY source
|
|
57
|
+
HAVING cnt > ?
|
|
58
|
+
`).all(e);for(let{source:a}of o){let c=this.db.prepare(`
|
|
59
|
+
DELETE FROM concept_edges
|
|
60
|
+
WHERE id IN (
|
|
61
|
+
SELECT id FROM concept_edges
|
|
62
|
+
WHERE source = ? AND edge_type = 'similarity'
|
|
63
|
+
ORDER BY weight DESC
|
|
64
|
+
LIMIT -1 OFFSET ?
|
|
65
|
+
)
|
|
66
|
+
`).run(a,e);s+=c.changes}return s})(),n>0&&console.log(`[ConceptGraph] Pruned ${n} edges (maxPerNode=${e}, minWeight=${t})`),n}async getStats(){this.ensureInitialized();let e=this.prepared.get("countNodes"),t=this.prepared.get("countEdges"),n=this.prepared.get("countByType");if(!e||!t||!n)throw new Error("Prepared statements not found");let i=e.get().count,s=t.get().count,r={pattern:0,technique:0,domain:0,outcome:0,error:0},o=n.all();for(let c of o)r[c.concept_type]=c.count;let a=0;return i>0&&(a=this.db.prepare("SELECT AVG(activation_level) as avg FROM concept_nodes").get().avg||0),{nodeCount:i,edgeCount:s,byType:r,avgEdgesPerNode:i>0?s/i:0,avgActivation:a}}async close(){this.prepared.clear(),this.db=null,this.persistence=null,this.initialized=!1}ensureInitialized(){if(!this.initialized||!this.db)throw new Error("ConceptGraph not initialized. Call initialize() first.")}async getEdgeBetween(e,t){let n=this.prepared.get("getEdge");if(!n)throw new Error("Prepared statement not found: getEdge");let i=n.get(e,t);return i?this.rowToEdge(i):null}async findDomainNode(e){if(!this.db)return null;let n=this.db.prepare("SELECT * FROM concept_nodes WHERE concept_type = 'domain' AND content = ?").get(e);return n?this.rowToNode(n):null}async findNodeByPatternId(e){if(!this.db)return null;let n=this.db.prepare("SELECT * FROM concept_nodes WHERE pattern_id = ? LIMIT 1").get(e);return n?this.rowToNode(n):null}rowToNode(e){let t;if(e.embedding){let n=e.embedding,i=new Float32Array(n.buffer,n.byteOffset,n.byteLength/4);t=Array.from(i)}return{id:e.id,conceptType:e.concept_type,content:e.content,embedding:t,activationLevel:e.activation_level||0,lastActivated:e.last_activated?new Date(e.last_activated):void 0,patternId:e.pattern_id||void 0,metadata:e.metadata?A(e.metadata):void 0,createdAt:e.created_at?new Date(e.created_at):void 0}}rowToEdge(e){return{id:e.id,source:e.source,target:e.target,weight:e.weight,edgeType:e.edge_type,evidence:e.evidence,createdAt:e.created_at?new Date(e.created_at):void 0,updatedAt:e.updated_at?new Date(e.updated_at):void 0}}};function me(d){return new T(d)}le();function ge(d,e){if(e<0||e>=d.length)return d[0]??0;let t=0,n=d.length-1;for(;t<n;){let i=t+n>>1;if(d[i]<d[t]){let a=d[t];d[t]=d[i],d[i]=a}if(d[n]<d[t]){let a=d[t];d[t]=d[n],d[n]=a}if(d[i]<d[n]){let a=d[i];d[i]=d[n],d[n]=a}let s=d[n],r=t;for(let a=t;a<n;a++)if(d[a]<=s){let c=d[r];d[r]=d[a],d[a]=c,r++}let o=d[r];if(d[r]=d[n],d[n]=o,r===e)return d[r];r<e?t=r+1:n=r-1}return d[t]}var z=1e4,G=5e4,H=.8,re={decayRate:.1,spreadFactor:.5,threshold:.1,maxIterations:20,noiseLevel:.05},S=class{graph;config;activationHistory=new Map;coActivationCounts=new Map;constructor(e,t={}){this.graph=e,this.config={...re,...t}}async spread(e,t=1,n){let i=e.filter(l=>this.graph.getConcept(l)!==void 0);if(i.length===0)return{iterations:0,nodesActivated:0,peakActivation:0,activatedNodes:[],novelAssociations:[]};for(let l of i)this.graph.setActivation(l,t),this.recordActivation(l,t);let s=0,r=t,o=0,a=0;for(;s<this.config.maxIterations&&!(n!==void 0&&Date.now()>=n);){let l=await this.spreadIteration(),h=this.graph.getActiveNodes(this.config.threshold);for(let u of h)u.activationLevel>r&&(r=u.activationLevel);if(h.length===o&&l===0){if(a++,a>=3)break}else a=0;o=h.length,s++}let c=this.graph.getActiveNodes(this.config.threshold).map(l=>({nodeId:l.id,activation:l.activationLevel})).sort((l,h)=>h.activation-l.activation),p=await this.findNovelAssociations(this.config.threshold);return this.trimHistory(),{iterations:s,nodesActivated:c.length,peakActivation:r,activatedNodes:c,novelAssociations:p.map(l=>({source:l.source.id,target:l.target.id,strength:l.coActivation}))}}async dream(e,t){let n=Date.now(),i=[],s=0,r=0,o=new Set,a=this.graph.getAllConcepts(0);if(a.length===0)return{iterations:0,nodesActivated:0,peakActivation:0,activatedNodes:[],novelAssociations:[]};let c=n+e;for(;Date.now()<c&&!t?.aborted;){let h=X(0,a.length),u=a[h];if(u){let g=this.config.noiseLevel+N()*this.config.noiseLevel*2,f=u.activationLevel,v=Math.min(1,f+g+.3);this.graph.setActivation(u.id,v);let y=await this.spread([u.id],v,c);s+=y.iterations,y.peakActivation>r&&(r=y.peakActivation);for(let E of y.activatedNodes)o.add(E.nodeId);for(let E of y.novelAssociations)i.push(E)}if(Date.now()>=c||t?.aborted)break;await this.sleep(50+N()*50,t)}let p=this.deduplicateAssociations(i),l=Array.from(o).map(h=>{let u=this.graph.getConcept(h);return{nodeId:h,activation:u?.activationLevel??0}}).filter(h=>h.activation>0).sort((h,u)=>u.activation-h.activation);return this.trimHistory(),{iterations:s,nodesActivated:l.length,peakActivation:r,activatedNodes:l,novelAssociations:p.slice(0,20)}}async findNovelAssociations(e){let t=e??this.config.threshold,n=this.graph.getActiveNodes(t);if(n.length<2)return[];let i=200;n.length>i&&(n=n.sort((r,o)=>o.activationLevel-r.activationLevel).slice(0,i));let s=[];for(let r=0;r<n.length;r++)for(let o=r+1;o<n.length;o++){let a=n[r],c=n[o],p=Math.sqrt(a.activationLevel*c.activationLevel),l=this.graph.getEdge(a.id,c.id),h=this.graph.getEdge(c.id,a.id),u=l!==void 0||h!==void 0,g=l?.weight??h?.weight??0,f=!u||g<.3;p>.3&&(s.push({source:a,target:c,coActivation:p,isNovel:f}),this.trackCoActivation(a.id,c.id))}return s.sort((r,o)=>r.isNovel!==o.isNovel?r.isNovel?-1:1:o.coActivation-r.coActivation).slice(0,10)}async reset(){let e=this.graph.getAllConcepts(0);for(let t of e)this.graph.setActivation(t.id,0);this.activationHistory.clear(),this.coActivationCounts.clear()}getConfig(){return{...this.config}}trimActivationHistory(){if(this.activationHistory.size<=z)return;let e=Math.floor(z*H),t=this.activationHistory.size-e,n=Array.from(this.activationHistory.keys()).slice(0,t);for(let i of n)this.activationHistory.delete(i)}trimCoActivationCounts(){if(this.coActivationCounts.size<=G)return;let e=Math.floor(G*H),t=this.coActivationCounts.size-e,n=Array.from(this.coActivationCounts.values()),i=ge(n,t-1),s=[];for(let[r,o]of this.coActivationCounts){if(s.length>=t)break;o<=i&&s.push(r)}for(let r of s)this.coActivationCounts.delete(r)}trimHistory(){this.trimActivationHistory(),this.trimCoActivationCounts()}getHistorySizes(){return{activationHistorySize:this.activationHistory.size,coActivationCountsSize:this.coActivationCounts.size}}async spreadIteration(){let e=this.graph.getActiveNodes(this.config.threshold),t=0,n=[];for(let i of e){let s=this.graph.getEdges(i.id);for(let r of s){let o=this.graph.getConcept(r.target);if(!o)continue;let a=i.activationLevel*r.weight*this.config.spreadFactor;if(a>.01){let c=o.activationLevel,p=Math.min(1,c+a);n.push({nodeId:r.target,newActivation:p})}}}for(let i of n){let s=this.graph.getConcept(i.nodeId);s&&i.newActivation>s.activationLevel&&(this.graph.setActivation(i.nodeId,i.newActivation),this.recordActivation(i.nodeId,i.newActivation),t++)}return this.applyDecay(),this.injectNoise(),t}applyDecay(){let e=1-this.config.decayRate;this.graph.decayActivations(e)}injectNoise(){if(this.config.noiseLevel<=0)return;let e=this.graph.getAllConcepts(0);for(let t of e)if(t.activationLevel>0){let n=(N()-.5)*2*this.config.noiseLevel,i=Math.max(0,Math.min(1,t.activationLevel+n));this.graph.setActivation(t.id,i)}}recordActivation(e,t){let n=this.activationHistory.get(e)||[];n.push(t),n.length>50&&n.shift(),this.activationHistory.set(e,n)}trackCoActivation(e,t){let n=[e,t].sort().join(":"),i=this.coActivationCounts.get(n)||0;this.coActivationCounts.set(n,i+1)}deduplicateAssociations(e){let t=new Map;for(let n of e){let i=[n.source,n.target].sort().join(":"),s=t.get(i);(!s||n.strength>s.strength)&&t.set(i,n)}return Array.from(t.values()).sort((n,i)=>i.strength-n.strength)}sleep(e,t){return new Promise(n=>{let i=setTimeout(s,e);function s(){clearTimeout(i),t?.removeEventListener("abort",s),n()}t?.addEventListener("abort",s,{once:!0})})}};ue();import{randomUUID as fe}from"crypto";var se={minNoveltyScore:.3,minConfidence:.5,maxInsightsPerCycle:10},I=class{graph;config;constructor(e,t={}){this.graph=e,this.config={...se,...t}}async generateFromActivation(e,t){let n=[],i=t.activatedNodes.map(c=>this.graph.getConcept(c.nodeId)).filter(c=>c!==void 0);if(i.length<2)return[];let s=await this.detectPatternMerges(i);for(let c of s)c.cycleId=e,n.push(c);let r=await this.detectNovelAssociations(t.novelAssociations);for(let c of r)c.cycleId=e,n.push(c);let o=await this.detectOptimizations(i);for(let c of o)c.cycleId=e,n.push(c);let a=await this.detectGaps(i);for(let c of a)c.cycleId=e,n.push(c);return n.filter(c=>c.noveltyScore>=this.config.minNoveltyScore).sort((c,p)=>p.noveltyScore-c.noveltyScore).slice(0,this.config.maxInsightsPerCycle)}async detectPatternMerges(e){let t=[],n=e.filter(i=>i.conceptType==="pattern"||i.conceptType==="technique");if(n.length<2)return t;for(let i=0;i<n.length;i++)for(let s=i+1;s<n.length;s++){let r=n[i],o=n[s],a=this.graph.getEdge(r.id,o.id),c=this.graph.getEdge(o.id,r.id),p=Math.max(a?.weight??0,c?.weight??0),l=this.calculateContentSimilarity(r.content,o.content),h=Math.sqrt(r.activationLevel*o.activationLevel),u=p*.4+l*.3+h*.3;if(u>.5){let g=this.calculateNovelty({type:"pattern_merge",sourceConcepts:[r.id,o.id]}),f=this.calculateConfidence({type:"pattern_merge",sourceConcepts:[r.id,o.id],edgeWeight:p,contentSimilarity:l,coActivation:h});t.push({id:this.generateId(),cycleId:"",type:"pattern_merge",sourceConcepts:[r.id,o.id],description:this.generatePatternMergeDescription(r,o,u),noveltyScore:g,confidenceScore:f,actionable:f>=this.config.minConfidence,applied:!1,suggestedAction:f>=this.config.minConfidence?`Merge "${this.truncate(r.content,30)}" with "${this.truncate(o.content,30)}" into a unified pattern.`:void 0,createdAt:new Date})}}return t}async detectNovelAssociations(e){let t=[];for(let n of e){let i=this.graph.getConcept(n.source),s=this.graph.getConcept(n.target);if(!i||!s)continue;let r=this.graph.getEdge(n.source,n.target);if(r&&r.weight>.5)continue;let o=i.conceptType!==s.conceptType,a=this.calculateNovelty({type:"novel_association",sourceConcepts:[n.source,n.target],isCrossDomain:o,strength:n.strength}),c=this.calculateConfidence({type:"novel_association",sourceConcepts:[n.source,n.target],coActivation:n.strength,isCrossDomain:o});t.push({id:this.generateId(),cycleId:"",type:"novel_association",sourceConcepts:[n.source,n.target],description:this.generateNovelAssociationDescription(i,s,n.strength,o),noveltyScore:a,confidenceScore:c,actionable:c>=this.config.minConfidence,applied:!1,suggestedAction:c>=this.config.minConfidence?`Investigate connection between "${this.truncate(i.content,25)}" and "${this.truncate(s.content,25)}".`:void 0,createdAt:new Date})}return t}async detectOptimizations(e){let t=[];for(let n of e){if(n.conceptType!=="pattern"&&n.conceptType!=="technique")continue;let i=n.metadata??{},s=i.successRate,r=i.executionCount,o=i.confidence,a=s!==void 0&&s<.7,c=r!==void 0&&r>10,p=o!==void 0&&o<.6;if(a||c&&p){let l=this.calculateNovelty({type:"optimization",sourceConcepts:[n.id],hasLowSuccess:a,hasHighUsage:c}),h=this.calculateConfidence({type:"optimization",sourceConcepts:[n.id],hasLowSuccess:a,hasHighUsage:c,metadata:i});t.push({id:this.generateId(),cycleId:"",type:"optimization",sourceConcepts:[n.id],description:this.generateOptimizationDescription(n,s,r),noveltyScore:l,confidenceScore:h,actionable:h>=this.config.minConfidence,applied:!1,suggestedAction:h>=this.config.minConfidence?`Review and optimize "${this.truncate(n.content,40)}" to improve success rate.`:void 0,createdAt:new Date})}}return t}async detectGaps(e){let t=[],n={pattern:[],technique:[],domain:[],outcome:[],error:[]};for(let i of e){let s=i.conceptType??"pattern",r=J(n,s)??[];K(n,s,r),r.push(i)}for(let i of n.error??[])if(!this.graph.getEdges(i.id).some(o=>{let a=this.graph.getConcept(o.target);return a&&(a.conceptType==="pattern"||a.conceptType==="technique")})){let o=this.calculateNovelty({type:"gap_detection",sourceConcepts:[i.id],gapType:"missing_resolution"}),a=this.calculateConfidence({type:"gap_detection",sourceConcepts:[i.id],gapType:"missing_resolution"});t.push({id:this.generateId(),cycleId:"",type:"gap_detection",sourceConcepts:[i.id],description:`No resolution pattern found for error: "${this.truncate(i.content,50)}". Consider creating a fix pattern.`,noveltyScore:o,confidenceScore:a,actionable:!0,applied:!1,suggestedAction:`Create a resolution pattern for: "${this.truncate(i.content,40)}".`,createdAt:new Date})}for(let i of n.outcome??[])if(!this.graph.getEdges(i.id).some(o=>{let a=this.graph.getConcept(o.target);return a&&a.conceptType==="technique"})&&(n.technique?.length??0)===0){let o=this.calculateNovelty({type:"gap_detection",sourceConcepts:[i.id],gapType:"missing_technique"}),a=this.calculateConfidence({type:"gap_detection",sourceConcepts:[i.id],gapType:"missing_technique"});t.push({id:this.generateId(),cycleId:"",type:"gap_detection",sourceConcepts:[i.id],description:`Outcome "${this.truncate(i.content,40)}" has no associated technique. Document how this outcome is achieved.`,noveltyScore:o,confidenceScore:a,actionable:!0,applied:!1,suggestedAction:`Document the technique for achieving: "${this.truncate(i.content,35)}".`,createdAt:new Date})}return t}calculateNovelty(e){let t=.5;if(e.isCrossDomain&&(t+=.2),e.strength!==void 0&&e.strength>.5&&(t+=.15),e.type==="gap_detection"&&(t+=.2),e.hasHighUsage&&e.hasLowSuccess&&(t+=.15),e.sourceConcepts.length>=2){let n=this.graph.getEdge(e.sourceConcepts[0],e.sourceConcepts[1]);n?n.weight<.3&&(t+=.05):t+=.1}return Math.min(1,Math.max(0,t))}calculateConfidence(e){let t=.4;if(e.coActivation!==void 0&&(t+=e.coActivation*.3),e.edgeWeight!==void 0&&(t+=e.edgeWeight*.2),e.contentSimilarity!==void 0&&e.type==="pattern_merge"&&(t+=e.contentSimilarity*.2),e.isCrossDomain&&(t-=.1),e.hasHighUsage&&e.hasLowSuccess&&(t+=.15),e.metadata){let n=Math.min(Object.keys(e.metadata).length*.05,.15);t+=n}return e.gapType&&(t+=.1),Math.min(1,Math.max(0,t))}async insightToPattern(e){if(!e.actionable)return null;let t=e.sourceConcepts.map(n=>this.graph.getConcept(n)).filter(n=>n!==void 0);if(t.length===0)return null;switch(e.type){case"pattern_merge":{let[n,i]=t;return{name:`Merged: ${this.truncate(n?.content??"",20)} + ${this.truncate(i?.content??"",20)}`,description:e.description,template:{type:"merged_pattern",sourcePatterns:e.sourceConcepts,mergedContent:t.map(s=>s.content).join(" | "),metadata:{noveltyScore:e.noveltyScore,confidenceScore:e.confidenceScore,createdFrom:"dream_insight"}}}}case"novel_association":{let[n,i]=t;return{name:`Association: ${n?.conceptType} - ${i?.conceptType}`,description:e.description,template:{type:"association_pattern",source:{id:n?.id,type:n?.conceptType,content:n?.content},target:{id:i?.id,type:i?.conceptType,content:i?.content},metadata:{noveltyScore:e.noveltyScore,confidenceScore:e.confidenceScore,createdFrom:"dream_insight"}}}}case"optimization":{let[n]=t;return{name:`Optimized: ${this.truncate(n?.content??"",30)}`,description:e.description,template:{type:"optimization_pattern",originalPattern:n?.id,suggestedAction:e.suggestedAction,metadata:{noveltyScore:e.noveltyScore,confidenceScore:e.confidenceScore,createdFrom:"dream_insight"}}}}case"gap_detection":{let[n]=t;return{name:`Gap Fill: ${this.truncate(n?.content??"",30)}`,description:e.description,template:{type:"gap_fill_pattern",relatedConcept:n?.id,gapType:n?.conceptType==="error"?"missing_resolution":"missing_technique",suggestedAction:e.suggestedAction,metadata:{noveltyScore:e.noveltyScore,confidenceScore:e.confidenceScore,createdFrom:"dream_insight"}}}}default:return null}}generateId(){let e=Date.now(),t=fe().slice(0,8);return`insight-${e}-${t}`}calculateContentSimilarity(e,t){let n=e.toLowerCase().split(/\s+/),i=t.toLowerCase().split(/\s+/),s=new Set(n),r=new Set(i),o=n.filter(c=>r.has(c)),a=s.size+r.size-o.length;return a===0?0:o.length/a}truncate(e,t){return e.length<=t?e:e.substring(0,t-3)+"..."}generatePatternMergeDescription(e,t,n){return`Pattern merge opportunity (${Math.round(n*100)}% match): "${this.truncate(e.content,40)}" and "${this.truncate(t.content,40)}" share similar structure and could be combined.`}generateNovelAssociationDescription(e,t,n,i){let s=Math.round(n*100);return`Novel association discovered${i?" (cross-domain)":""}: [${e.conceptType}] "${this.truncate(e.content,30)}" is connected to [${t.conceptType}] "${this.truncate(t.content,30)}" with ${s}% co-activation strength.`}generateOptimizationDescription(e,t,n){let i=[`Optimization opportunity for "${this.truncate(e.content,40)}":`];return t!==void 0&&i.push(`Success rate is ${Math.round(t*100)}%.`),n!==void 0&&i.push(`Used ${n} times.`),i.push("Consider reviewing and improving this pattern."),i.join(" ")}getConfig(){return{...this.config}}};Y();F();Q();he();import{existsSync as ve,unlinkSync as ye}from"fs";var M={maxPatternCountDrop:.05,maxAvgConfidenceDrop:.02,maxHighConfidenceLoss:.05},$=class{constructor(e,t=M){this.db=e;this.thresholds=t}db;thresholds;activeBranches=new Map;listeners=[];rvfAdapter;useRvfFork=!1;_witnessChain=null;set witnessChain(e){this._witnessChain=e}setRvfAdapter(e,t=!0){this.rvfAdapter=e,this.useRvfFork=t,import("./feature-flags-O7ZXDDCD.js").then(({isRVFPatternStoreEnabled:n})=>{this.useRvfFork=n()}).catch(()=>{})}createBranch(e){if(this.activeBranches.has(e))throw new Error(`Branch '${e}' already exists`);let t=this.sanitizeSavepointName(e),n=this.captureBaseline();this.db.exec(`SAVEPOINT "${t}"`);let i={name:e,createdAt:new Date,status:"active",baselineSnapshot:n};if(this.rvfAdapter&&this.useRvfFork)try{let s=`/tmp/dream-branch-${t}.rvf`,r=this.rvfAdapter.derive(s),o=i;o._rvfBranchPath=s,o._rvfChildAdapter=r}catch{}return this.activeBranches.set(e,i),this.emit("dream:branch_created",i),i}validateBranch(e,t){this.ensureBranchActive(e.name);let n=t??e.baselineSnapshot,i=this.captureBaseline(),s=i.patternCount-n.patternCount,r=i.avgConfidence-n.avgConfidence,o=n.highConfidenceCount-i.highConfidenceCount,a=[],c=!0;if(n.patternCount>0){let l=-s/n.patternCount;l>this.thresholds.maxPatternCountDrop&&(c=!1,a.push(`Pattern count dropped by ${(l*100).toFixed(1)}% (threshold: ${(this.thresholds.maxPatternCountDrop*100).toFixed(1)}%)`))}if(r<-this.thresholds.maxAvgConfidenceDrop&&(c=!1,a.push(`Avg confidence dropped by ${(-r).toFixed(4)} (threshold: ${this.thresholds.maxAvgConfidenceDrop})`)),n.highConfidenceCount>0&&o>0){let l=o/n.highConfidenceCount;l>this.thresholds.maxHighConfidenceLoss&&(c=!1,a.push(`${o} high-confidence patterns lost (${(l*100).toFixed(1)}%, threshold: ${(this.thresholds.maxHighConfidenceLoss*100).toFixed(1)}%)`))}if(this.rvfAdapter&&this.useRvfFork&&n.patternCount>0)try{let l=this.rvfAdapter.dimension?.()??384,h=new Float32Array(l);for(let g=0;g<l;g++)h[g]=Math.sin(g*.1);let u=this.rvfAdapter.search?.(h,10)??[];u.length<Math.min(5,n.patternCount)&&a.push(`Search recall degraded: only ${u.length} results returned (expected \u2265${Math.min(5,n.patternCount)})`)}catch{}let p=c?"All quality checks passed":`Validation failed: ${a.join("; ")}`;return{passed:c,reason:p,patternCountDelta:s,avgConfidenceDelta:r,highConfidenceLost:Math.max(0,o),postDreamMetrics:i}}mergeBranch(e){this.ensureBranchActive(e.name);let t=this.sanitizeSavepointName(e.name);this.db.exec(`RELEASE SAVEPOINT "${t}"`),e.status="merged",this.activeBranches.delete(e.name),this.cleanupRvfBranch(e),this.emit("dream:branch_merged",e);try{this._witnessChain?.append("BRANCH_MERGE",{branchName:e.name},"rvcow-branch-manager")}catch{}}discardBranch(e){this.ensureBranchActive(e.name);let t=this.sanitizeSavepointName(e.name);this.db.exec(`ROLLBACK TO SAVEPOINT "${t}"`),this.db.exec(`RELEASE SAVEPOINT "${t}"`),e.status="discarded",this.activeBranches.delete(e.name),this.cleanupRvfBranch(e),this.emit("dream:branch_discarded",e)}listBranches(){return Array.from(this.activeBranches.values())}onEvent(e){this.listeners.push(e)}offEvent(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}captureBaseline(){let e=this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns").get(),t=this.db.prepare("SELECT AVG(confidence) as avg_conf FROM qe_patterns").get(),n=this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns WHERE confidence >= 0.8").get();return{patternCount:e?.cnt??0,avgConfidence:t?.avg_conf??0,highConfidenceCount:n?.cnt??0,capturedAt:new Date}}ensureBranchActive(e){let t=this.activeBranches.get(e);if(!t)throw new Error(`Branch '${e}' not found or not active`);if(t.status!=="active")throw new Error(`Branch '${e}' is ${t.status}, not active`)}cleanupRvfBranch(e){let t=e;try{t._rvfChildAdapter?.close?.()}catch{}try{let n=t._rvfBranchPath;n&&ve(n)&&ye(n)}catch{}}sanitizeSavepointName(e){return e.replace(/[^a-zA-Z0-9_-]/g,"_")}emit(e,t,n){for(let i of this.listeners)try{i(e,t,n)}catch{}}};function U(d,e){let t=d.prepare(`
|
|
67
|
+
UPDATE concept_nodes
|
|
68
|
+
SET activation_level = ?, last_activated = datetime('now')
|
|
69
|
+
WHERE id = ? AND (? IS NULL OR COALESCE(activation_level, 0) = ?)
|
|
70
|
+
`),n=d.prepare(`
|
|
71
|
+
INSERT INTO dream_insights
|
|
72
|
+
(id, cycle_id, insight_type, source_concepts, description, novelty_score,
|
|
73
|
+
confidence_score, actionable, applied, suggested_action, pattern_id)
|
|
74
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, 0, ?, NULL)
|
|
75
|
+
`),i=d.prepare(`
|
|
76
|
+
INSERT INTO dream_cycles
|
|
77
|
+
(id, start_time, end_time, duration_ms, concepts_processed, associations_found,
|
|
78
|
+
insights_generated, status, error)
|
|
79
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
80
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
81
|
+
end_time = excluded.end_time, duration_ms = excluded.duration_ms,
|
|
82
|
+
concepts_processed = excluded.concepts_processed,
|
|
83
|
+
associations_found = excluded.associations_found,
|
|
84
|
+
insights_generated = excluded.insights_generated,
|
|
85
|
+
status = excluded.status, error = excluded.error
|
|
86
|
+
`),s=d.transaction(()=>{let{cycle:a}=e;i.run(a.id,a.startTime.toISOString(),a.endTime?.toISOString()??null,a.durationMs??null,a.conceptsProcessed,a.associationsFound,a.insightsGenerated,a.status,a.error??null);let c=0;for(let[p,l,h]of e.activations){let u=h??null;c+=t.run(Math.max(0,Math.min(1,l)),p,u,u).changes}for(let p of e.insights)n.run(p.id,p.cycleId,p.type,JSON.stringify(p.sourceConcepts),p.description,p.noveltyScore,p.confidenceScore,p.actionable?1:0,p.suggestedAction??null);return{activationsWritten:c,activationsSkipped:e.activations.length-c,insightsWritten:e.insights.length}}),r=performance.now();return{...s.immediate(),commitDurationMs:performance.now()-r}}var x=600*1e3,Ce="abandoned: process exited";function q(d,e=x,t=Date.now()){let n=new Date(t-e).toISOString();return d.prepare(`
|
|
87
|
+
UPDATE dream_cycles
|
|
88
|
+
SET status = 'interrupted',
|
|
89
|
+
error = ?,
|
|
90
|
+
end_time = COALESCE(end_time, ?)
|
|
91
|
+
WHERE status = 'running' AND start_time < ?
|
|
92
|
+
`).run(Ce,new Date(t).toISOString(),n).changes}var b=_.create("dream-engine"),ae={maxDurationMs:3e4,minConceptsRequired:10,activationConfig:{decayRate:.1,spreadFactor:.5,threshold:.1,maxIterations:20,noiseLevel:.05},insightConfig:{minNoveltyScore:.3,minConfidence:.5,maxInsightsPerCycle:10},enableBranching:!1,branchValidationThresholds:{...M}},De=6e4,L=class extends Error{constructor(t){super(`A dream cycle is already running (cycle ${t}); wait for it to finish or cancel it`);this.cycleId=t;this.name="DreamAlreadyRunningError"}cycleId},W=class{constructor(e){this.graph=e}graph;nodeCache=new Map;edgeCache=new Map;activationLevels=new Map;loadedLevels=new Map;async loadIntoMemory(e){this.nodeCache.clear(),this.edgeCache.clear(),this.activationLevels.clear(),this.loadedLevels.clear();let t=await this.graph.getActiveNodes(0);e&&t.length>e&&(t=t.sort((n,i)=>i.activationLevel-n.activationLevel).slice(0,e));for(let n of t)this.nodeCache.set(n.id,n),this.activationLevels.set(n.id,n.activationLevel),this.loadedLevels.set(n.id,n.activationLevel);for(let n of t){let s=(await this.graph.getNeighbors(n.id)).map(r=>r.edge);this.edgeCache.set(n.id,s)}}activationEntries(){return Array.from(this.activationLevels.entries(),([e,t])=>[e,t,this.loadedLevels.get(e)])}getConcept(e){let t=this.nodeCache.get(e);if(t)return{...t,activationLevel:this.activationLevels.get(e)??t.activationLevel}}getAllConcepts(e){let t=e??0;return Array.from(this.nodeCache.values()).map(n=>({...n,activationLevel:this.activationLevels.get(n.id)??n.activationLevel})).filter(n=>n.activationLevel>=t)}getActiveNodes(e){return this.getAllConcepts(e)}getEdges(e){return this.edgeCache.get(e)??[]}getEdge(e,t){return(this.edgeCache.get(e)??[]).find(i=>i.target===t)}setActivation(e,t){this.activationLevels.set(e,Math.max(0,Math.min(1,t)))}decayActivations(e){let t=Array.from(this.activationLevels.entries());for(let[n,i]of t)this.activationLevels.set(n,i*e)}getStats(){let e=Array.from(this.nodeCache.values()),t={pattern:0,technique:0,domain:0,outcome:0,error:0},n=0;for(let r of e)t[r.conceptType]=(t[r.conceptType]??0)+1,n+=this.activationLevels.get(r.id)??r.activationLevel;let i=0,s=Array.from(this.edgeCache.values());for(let r of s)i+=r.length;return{nodeCount:e.length,edgeCount:i,byType:t,avgEdgesPerNode:e.length>0?i/e.length:0,avgActivation:e.length>0?n/e.length:0}}},w=class{config;persistence=null;graph=null;db=null;interruptActiveDream=null;activeDream=null;activeAbort=null;currentCycle=null;initialized=!1;cancelled=!1;cancelRequests=0;closing=!1;branchEventListeners=[];_witnessChain=null;set witnessChain(e){this._witnessChain=e}set rvfAdapter(e){}constructor(e){this.config={...ae,...e}}async initialize(){if(!this.initialized)try{this.persistence=R(),this.persistence.isInitialized()||await this.persistence.initialize(),this.db=this.persistence.getDatabase();try{this.db.pragma("busy_timeout = 60000")}catch{}this.migrateSchema(),this.graph=new T,await this.graph.initialize(),this.config.enableBranching&&b.warn("DreamConfig.enableBranching is deprecated and ignored (#1060): dream results are committed in one short transaction instead of a SAVEPOINT held across the dream");let e=q(this.db,Math.max(this.config.maxDurationMs,De)+x);e>0&&b.info("Marked abandoned dream cycles as interrupted",{abandoned:e}),this.initialized=!0,this.closing=!1,console.log(`[DreamEngine] Initialized: ${this.persistence.getDbPath()}`)}catch(e){throw new Error(`Failed to initialize DreamEngine: ${C(e)}`)}}migrateSchema(){if(this.db)try{let e=this.db.prepare("PRAGMA table_info(dream_cycles)").all(),t=e.some(a=>a.name==="duration_ms"),n=e.some(a=>a.name==="duration");!t&&n&&this.db.exec("ALTER TABLE dream_cycles RENAME COLUMN duration TO duration_ms");let i=this.db.prepare("PRAGMA table_info(dream_insights)").all(),s=new Set(i.map(a=>a.name)),r=s.has("insight_type"),o=s.has("source_concepts");if(!r)try{this.db.exec("ALTER TABLE dream_insights ADD COLUMN insight_type TEXT NOT NULL DEFAULT 'general'"),b.info("Added insight_type column to dream_insights (safe migration)")}catch{}if(!o)try{this.db.exec("ALTER TABLE dream_insights ADD COLUMN source_concepts TEXT NOT NULL DEFAULT '[]'"),b.info("Added source_concepts column to dream_insights (safe migration)")}catch{}this.db.exec("CREATE INDEX IF NOT EXISTS idx_insight_cycle ON dream_insights(cycle_id)"),this.db.exec("CREATE INDEX IF NOT EXISTS idx_insight_type ON dream_insights(insight_type)"),this.db.exec("CREATE INDEX IF NOT EXISTS idx_insight_novelty ON dream_insights(novelty_score DESC)")}catch(e){b.debug("Dream schema migration skipped",{error:e instanceof Error?e.message:String(e)})}}async dream(e,t={}){if(this.ensureInitialized(),this.closing)throw new Error("Dream engine is closing; no new dream is started");if(this.activeDream)throw new L(this.activeDream.cycleId);let n={id:D(),startTime:new Date,conceptsProcessed:0,associationsFound:0,insightsGenerated:0,status:"running"},i=this.runDream(n,e??this.config.maxDurationMs,t);this.activeDream={cycleId:n.id,done:i.catch(()=>{})};try{return await i}finally{this.activeDream?.cycleId===n.id&&(this.activeDream=null)}}async runDream(e,t,n){let i=this.db,s=this.graph,r=Date.now(),o=new AbortController;this.activeAbort=o,this.cancelled=!1,this.currentCycle=e;let a=n.commit!==!1,c=this.createCycleInterrupter(e,r,o);this.interruptActiveDream=c;let p=Z(c),l=()=>!this.cancelled&&!o.signal.aborted&&this.db===i,h=!1;try{if(a&&await this.saveCycle(e),!l())throw new Error("Dream cycle cancelled");let u=n.minConceptsRequired??this.config.minConceptsRequired,g=await s.getActiveNodes(0);if(g.length<u)throw new Error(`Insufficient concepts: ${g.length} < ${u}`);let f=new W(s);await f.loadIntoMemory(30);let y=await new S(f,{...this.config.activationConfig,...n.activationConfig}).dream(t,o.signal);if(!l())throw new Error("Dream cycle cancelled");e.conceptsProcessed=y.nodesActivated,e.associationsFound=y.novelAssociations.length;let O=await new I(f,this.config.insightConfig).generateFromActivation(e.id,y);if(!l())throw new Error("Dream cycle cancelled");e.insightsGenerated=O.length,e.endTime=new Date,e.durationMs=Date.now()-r,e.status="completed";let j={cycle:e,activations:f.activationEntries(),insights:O},B={cycle:{...e},insights:O,activationStats:{totalIterations:y.iterations,peakActivation:y.peakActivation,nodesActivated:y.nodesActivated},patternsCreated:0};return a?(B.commitDurationMs=this.commitComputed(i,j),h=!0,B):(h=!0,{...B,pending:j})}catch(u){if(!h&&e.status!=="interrupted"&&(e.status=this.cancelled?"interrupted":"failed",e.error=C(u),e.endTime=new Date,e.durationMs=Date.now()-r,a&&this.db===i))try{this.updateCycleSync(e)}catch{}if(!h&&a)try{this._witnessChain?.append("DREAM_DISCARD",{cycleId:e.id,reason:C(u)},"dream-engine")}catch{}throw u}finally{p(),this.interruptActiveDream===c&&(this.interruptActiveDream=null),this.currentCycle===e&&(this.currentCycle=null),this.activeAbort===o&&(this.activeAbort=null)}}commitDreamResult(e){if(this.ensureInitialized(),this.closing)throw new Error("Dream engine is closing; nothing is committed");if(!e.pending)throw new Error("Dream result has nothing pending to commit (it was already committed)");let t=this.commitComputed(this.db,e.pending);return e.pending=void 0,e.commitDurationMs=t,t}commitComputed(e,t){let n=U(e,t);try{this._witnessChain?.append("DREAM_COMMIT",{cycleId:t.cycle.id,insights:n.insightsWritten,activations:n.activationsWritten,commitDurationMs:n.commitDurationMs},"dream-engine")}catch{}return n.commitDurationMs}createCycleInterrupter(e,t,n){return()=>{if(n.abort(),!(e.status!=="running"||!this.db)){e.status="interrupted",e.error="Interrupted: engine closed or process shut down during the dream cycle",e.endTime=new Date,e.durationMs=Date.now()-t;try{this.updateCycleSync(e)}catch{}}}}async loadPatternsAsConcepts(e){return this.ensureInitialized(),this.graph.loadFromPatterns(e)}async loadFailuresAsConcepts(e){return this.ensureInitialized(),this.graph.loadFailuresAsErrors(e)}async loadSuccessesAsConcepts(e){return this.ensureInitialized(),this.graph.loadSuccessesAsOutcomes(e)}async ensureConceptsLoaded(){this.ensureInitialized();try{let n=this.db.prepare(`SELECT n.id as id, n.pattern_id as sourcePatternId, p.qe_domain as domain, n.failure_mode as failureMode
|
|
93
|
+
FROM qe_pattern_nulls n
|
|
94
|
+
JOIN qe_patterns p ON p.id = n.pattern_id
|
|
95
|
+
ORDER BY n.updated_at DESC
|
|
96
|
+
LIMIT 100`).all();n.length>0&&await this.graph.loadFailuresAsErrors(n);let i=this.db.prepare(`SELECT u.id as id, u.pattern_id as sourcePatternId, p.qe_domain as domain,
|
|
97
|
+
('Pattern "' || p.name || '" applied successfully') as description
|
|
98
|
+
FROM qe_pattern_usage u
|
|
99
|
+
JOIN qe_patterns p ON p.id = u.pattern_id
|
|
100
|
+
WHERE u.success = 1
|
|
101
|
+
ORDER BY u.created_at DESC
|
|
102
|
+
LIMIT 100`).all();i.length>0&&await this.graph.loadSuccessesAsOutcomes(i)}catch(n){process.env.DEBUG&&b.debug("Error/outcome concept loading skipped",{error:C(n)})}if((await this.graph.getActiveNodes(0)).length>=this.config.minConceptsRequired)return 0;let t=this.db.prepare(`SELECT * FROM (
|
|
103
|
+
SELECT id, name, description, qe_domain as domain, pattern_type as patternType,
|
|
104
|
+
confidence, success_rate as successRate
|
|
105
|
+
FROM qe_patterns
|
|
106
|
+
WHERE confidence >= 0.3
|
|
107
|
+
ORDER BY quality_score DESC
|
|
108
|
+
LIMIT 160
|
|
109
|
+
)
|
|
110
|
+
UNION
|
|
111
|
+
SELECT * FROM (
|
|
112
|
+
SELECT id, name, description, qe_domain as domain, pattern_type as patternType,
|
|
113
|
+
confidence, success_rate as successRate
|
|
114
|
+
FROM qe_patterns
|
|
115
|
+
WHERE confidence >= 0.3 AND success_rate < 0.7
|
|
116
|
+
ORDER BY usage_count DESC
|
|
117
|
+
LIMIT 40
|
|
118
|
+
)`).all();return t.length===0?0:this.graph.loadFromPatterns(t)}async applyInsight(e){this.ensureInitialized();try{let t=await this.getInsightRowById(e);if(!t)return{success:!1,error:`Insight not found: ${e}`};if(t.actionable!==1)return{success:!1,error:"Insight is not actionable"};if(t.applied===1)return{success:!0,patternId:t.pattern_id??void 0,error:"Insight already applied"};let{getSharedMemoryBackend:n}=await import("./base-AK7BXBX2.js"),{createQEReasoningBank:i}=await import("./qe-reasoning-bank-G2JZOGKD.js"),s=await n(),r=i(s);await r.initialize();try{let{getSharedRvfDualWriter:h}=await import("./shared-rvf-dual-writer-DBNABOP7.js"),u=await h();u&&r.setRvfDualWriter(u)}catch(h){process.env.DEBUG&&b.debug("RVF wiring skipped",{error:C(h)})}let o=[];try{o=A(t.source_concepts)}catch{}let a=await r.storePattern({patternType:Ee(t.insight_type),name:`Dream Insight: ${t.insight_type}`,description:`${t.description} (confidence: ${t.confidence_score.toFixed(2)})`,template:{type:"workflow",content:t.suggested_action||t.description,variables:[]},context:{tags:["dream-generated",t.insight_type,...o.slice(0,3)],complexity:"medium"}}),c=!a.success&&a.error instanceof ee&&a.error.disposition==="COMMITTED_PENDING_INDEX"?a.error:null;if(!a.success&&!c)return{success:!1,error:`Failed to create pattern: ${a.error?.message??"unknown error"}`};let p=a.success?a.value.id:c.patternId;return c&&b.warn("Insight applied; pattern committed with vector index pending",{insightId:e,patternId:p,cause:C(c.cause)}),this.db.prepare(`
|
|
119
|
+
UPDATE dream_insights
|
|
120
|
+
SET applied = 1, pattern_id = ?
|
|
121
|
+
WHERE id = ?
|
|
122
|
+
`).run(p,e),c?{success:!0,patternId:p,indexPending:!0}:{success:!0,patternId:p}}catch(t){return{success:!1,error:C(t)}}}async getPendingInsights(e){this.ensureInitialized();let t=e??20;return this.db.prepare(`
|
|
123
|
+
SELECT * FROM dream_insights
|
|
124
|
+
WHERE applied = 0 AND actionable = 1
|
|
125
|
+
ORDER BY novelty_score DESC, confidence_score DESC
|
|
126
|
+
LIMIT ?
|
|
127
|
+
`).all(t).map(s=>this.rowToInsight(s))}async getDreamHistory(e){this.ensureInitialized();let t=e??20;return this.db.prepare(`
|
|
128
|
+
SELECT * FROM dream_cycles
|
|
129
|
+
ORDER BY start_time DESC
|
|
130
|
+
LIMIT ?
|
|
131
|
+
`).all(t).map(s=>this.rowToCycle(s))}get cancelCount(){return this.cancelRequests}async cancelDream(){this.cancelled=!0,this.cancelRequests++,this.activeAbort?.abort()}isDreaming(){return this.currentCycle!==null&&this.currentCycle.status==="running"}getCurrentCycle(){return this.currentCycle?{...this.currentCycle}:null}async saveCycle(e){if(!this.db)return;this.db.prepare(`
|
|
132
|
+
INSERT INTO dream_cycles
|
|
133
|
+
(id, start_time, end_time, duration_ms, concepts_processed, associations_found,
|
|
134
|
+
insights_generated, status, error, created_at)
|
|
135
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
136
|
+
`).run(e.id,e.startTime.toISOString(),e.endTime?.toISOString()??null,e.durationMs??null,e.conceptsProcessed,e.associationsFound,e.insightsGenerated,e.status,e.error??null,e.startTime.toISOString())}updateCycleSync(e){if(!this.db)return;this.db.prepare(`
|
|
137
|
+
UPDATE dream_cycles
|
|
138
|
+
SET end_time = ?, duration_ms = ?, concepts_processed = ?, associations_found = ?,
|
|
139
|
+
insights_generated = ?, status = ?, error = ?
|
|
140
|
+
WHERE id = ?
|
|
141
|
+
`).run(e.endTime?.toISOString()??null,e.durationMs??null,e.conceptsProcessed,e.associationsFound,e.insightsGenerated,e.status,e.error??null,e.id)}async getInsightRowById(e){return this.db?this.db.prepare("SELECT * FROM dream_insights WHERE id = ?").get(e)??null:null}getBranchManager(){return null}onBranchEvent(e){this.branchEventListeners.push(e)}async close(){this.closing=!0,this.cancelRequests++,this.interruptActiveDream?.(),this.interruptActiveDream=null,this.activeAbort?.abort();let e=this.activeDream?.done;if(e){let t;await Promise.race([e,new Promise(n=>{t=setTimeout(n,2e3)})]),clearTimeout(t)}this.graph&&(await this.graph.close(),this.graph=null),this.db=null,this.persistence=null,this.initialized=!1,this.currentCycle=null}ensureInitialized(){if(!this.initialized||!this.graph||!this.db)throw new Error("DreamEngine not initialized. Call initialize() first.")}rowToCycle(e){return{id:e.id,startTime:new Date(e.start_time),endTime:e.end_time?new Date(e.end_time):void 0,durationMs:e.duration_ms??void 0,conceptsProcessed:e.concepts_processed,associationsFound:e.associations_found,insightsGenerated:e.insights_generated,status:e.status,error:e.error??void 0}}rowToInsight(e){return{id:e.id,cycleId:e.cycle_id,type:e.insight_type,sourceConcepts:A(e.source_concepts),description:e.description,noveltyScore:e.novelty_score,confidenceScore:e.confidence_score,actionable:e.actionable===1,applied:e.applied===1,patternId:e.pattern_id??void 0,suggestedAction:e.suggested_action??void 0,createdAt:new Date(e.created_at)}}};function Ee(d){return{"cross-domain":"coverage-strategy","novel-path":"test-template",cluster:"refactor-safe","high-activation":"assertion-pattern",bridge:"mock-pattern"}[d]||"test-template"}function be(d){let e=new w(d);return import("./feature-flags-O7ZXDDCD.js").then(({isRVFPatternStoreEnabled:t})=>t()?import("./shared-rvf-adapter-DROMBRV2.js"):null).then(t=>{if(!t)return;let n=t.getSharedRvfAdapter();n&&(e.rvfAdapter=n)}).catch(()=>{}),e}var Ae=w;Q();var oe="learning:loop-health";async function ce(d,e,t){try{let n=new Date().toISOString(),i=await d.get(oe)??{overallLastSuccess:"",bootedAt:n,components:{}},s=i.components[e]??{lastSuccessAt:"",ticksSinceBoot:0,successesSinceBoot:0};if(s.ticksSinceBoot+=1,t.success)s.lastSuccessAt=n,s.successesSinceBoot+=1,delete s.lastError;else if(t.error){let o=t.error instanceof Error?t.error.message:String(t.error);s.lastError={message:o,at:n}}i.components[e]=s;let r=Object.values(i.components).map(o=>o?.lastSuccessAt??"").filter(o=>o!=="");i.overallLastSuccess=r.length>0?r.sort().pop():"",await d.set(oe,i)}catch{}}var m=_.create("DreamScheduler"),pe={autoScheduleIntervalMs:36e5,minTimeBetweenDreamsMs:3e5,experienceThreshold:20,enableExperienceTrigger:!0,enableQualityGateFailureTrigger:!0,enableDomainMilestoneTrigger:!1,defaultDreamDurationMs:1e4,quickDreamDurationMs:5e3,fullDreamDurationMs:3e4,autoApplyHighConfidenceInsights:!1,insightConfidenceThreshold:.8},de="dream-scheduler:hook-state",P=class d{config;dreamEngine;eventBus;memoryBackend;initialized=!1;running=!1;dreaming=!1;experienceBuffer=[];lastDreamTime=null;scheduledDreamTimer=null;totalDreamsCompleted=0;subscriptions=[];lastDreamResult=null;metaLearningEngine;metaLearningSnapshots=[];metricsTracker=null;static MAX_META_SNAPSHOTS=20;detectedInsights=[];static MAX_DETECTED_INSIGHTS=100;constructor(e,t){if(!e.dreamEngine)throw new Error("DreamScheduler requires dreamEngine dependency");if(!e.eventBus)throw new Error("DreamScheduler requires eventBus dependency");this.dreamEngine=e.dreamEngine,this.eventBus=e.eventBus,this.memoryBackend=e.memoryBackend,this.config={...pe,...t},this.metaLearningEngine=new ne}async initialize(){if(!this.initialized){if(this.config.enableQualityGateFailureTrigger){let e=this.eventBus.subscribe("quality-assessment:gate:completed",this.handleQualityGateEvent.bind(this));this.subscriptions.push(e)}if(this.config.enableDomainMilestoneTrigger){let e=this.eventBus.subscribe("coordination:milestone:reached",this.handleDomainMilestoneEvent.bind(this));this.subscriptions.push(e)}await this.restoreState(),this.initialized=!0,m.info("Initialized")}}start(){this.ensureInitialized(),!this.running&&(this.running=!0,this.scheduleNextDream(),m.info("Started"))}stop(){this.running&&(this.running=!1,this.clearScheduledDream(),m.info("Stopped"))}async dispose(){this.stop();for(let e of this.subscriptions)e.unsubscribe();this.subscriptions=[],this.metricsTracker&&(this.metricsTracker.close(),this.metricsTracker=null),await this.saveState(),this.initialized=!1,m.info("Disposed")}async triggerDream(e){if(this.ensureInitialized(),!this.canDream()){let t=this.getTimeUntilCanDream();throw new Error(`Cannot start dream: minimum interval not met. Wait ${Math.ceil(t/1e3)}s.`)}return this.executeDream(e??this.config.defaultDreamDurationMs)}async triggerQuickDream(){return this.triggerDream(this.config.quickDreamDurationMs)}async triggerFullDream(){return this.triggerDream(this.config.fullDreamDurationMs)}recordExperience(e){this.experienceBuffer.push(e),this.config.enableExperienceTrigger&&this.experienceBuffer.length>=this.config.experienceThreshold&&this.canDream()&&!this.dreaming&&(m.info("Experience threshold reached, triggering dream",{threshold:this.config.experienceThreshold}),this.executeDream(this.config.defaultDreamDurationMs).catch(t=>{m.error("Experience-triggered dream failed",t instanceof Error?t:void 0)}))}getExperienceBuffer(){return[...this.experienceBuffer]}clearExperienceBuffer(){this.experienceBuffer=[]}getStatus(){let e=this.scheduledDreamTimer?this.getTimeUntilScheduledDream():null;return{initialized:this.initialized,running:this.running,dreaming:this.dreaming,experienceCount:this.experienceBuffer.length,experienceThreshold:this.config.experienceThreshold,timeUntilNextDream:e,totalDreamsCompleted:this.totalDreamsCompleted,lastDreamTime:this.lastDreamTime,autoSchedulingEnabled:this.running}}getLastDreamResult(){return this.lastDreamResult}getMetaInsights(e){let t=[...this.detectedInsights].reverse();return e!==void 0?t.slice(0,e):t}async executeDream(e){if(this.dreaming)throw new Error("A dream is already in progress");this.dreaming=!0,m.info("Starting dream cycle",{durationMs:e});let t;try{let n=await this.dreamEngine.ensureConceptsLoaded();n>0&&m.info("Auto-loaded concepts for dream",{loaded:n});let i=await this.dreamEngine.dream(e);if(this.lastDreamTime=new Date,this.lastDreamResult=i,this.totalDreamsCompleted++,this.clearExperienceBuffer(),await this.reconcileHookState(),this.config.autoApplyHighConfidenceInsights&&await this.autoApplyInsights(i),await this.publishDreamCompletedEvent(i),await this.maybeCompactPatternsRvf(),process.env.AQE_META_LEARNING_ENABLED==="true")try{await this.runPostDreamMetaLearning()}catch(s){m.warn("Post-dream meta-learning failed (non-critical)",{error:s instanceof Error?s.message:String(s)})}return this.running&&this.scheduleNextDream(),m.info("Dream completed",{insightsGenerated:i.insights.length}),i}catch(n){throw t=n instanceof Error?n:new Error(String(n)),n}finally{this.dreaming=!1,this.memoryBackend&&await ce(this.memoryBackend,"dreamScheduler",{success:!t,error:t})}}async autoApplyInsights(e){let t=e.insights.filter(n=>n.actionable&&n.confidenceScore>=this.config.insightConfidenceThreshold);for(let n of t)try{let i=await this.dreamEngine.applyInsight(n.id);i.success&&m.info("Auto-applied insight",{insightId:n.id,patternId:i.patternId})}catch(i){m.error("Failed to auto-apply insight",i instanceof Error?i:void 0,{insightId:n.id})}}async maybeCompactPatternsRvf(){try{let t=(await import("./shared-rvf-adapter-DROMBRV2.js")).compactSharedRvfAdapter();t&&t.bytesReclaimed>0&&m.info("patterns.rvf compacted",{bytesReclaimed:t.bytesReclaimed,segmentsCompacted:t.segmentsCompacted})}catch(e){m.warn("patterns.rvf compaction skipped (non-critical)",{error:e instanceof Error?e.message:String(e)})}try{let t=(await import("./shared-rvf-dual-writer-DBNABOP7.js")).getSharedRvfDualWriterSync();if(t){let n=t.compact();n&&n.bytesReclaimed>0&&m.info("brain.rvf compacted",{bytesReclaimed:n.bytesReclaimed,segmentsCompacted:n.segmentsCompacted})}}catch(e){m.warn("brain.rvf compaction skipped (non-critical)",{error:e instanceof Error?e.message:String(e)})}}async runPostDreamMetaLearning(){this.metricsTracker||(this.metricsTracker=new ie,await this.metricsTracker.initialize());let e=await this.metricsTracker.collectUnifiedSnapshot();for(this.metaLearningSnapshots.push(e);this.metaLearningSnapshots.length>d.MAX_META_SNAPSHOTS;)this.metaLearningSnapshots.shift();let t=te.minSnapshotsForAnalysis;if(this.metaLearningSnapshots.length>=t){let n=this.metaLearningEngine.runMetaLearningCycle(this.metaLearningSnapshots);if(n.length>0){m.info("Meta-learning insights detected",{count:n.length,types:n.map(i=>i.type)});for(let i of n)m.info(`Meta-insight [${i.type}]: ${i.description}`,{confidence:i.confidence.toFixed(2),suggestedAction:i.suggestedAction}),this.detectedInsights.push(i);for(;this.detectedInsights.length>d.MAX_DETECTED_INSIGHTS;)this.detectedInsights.shift();try{this.eventBus.publish({id:D(),type:"meta-learning.insight-detected",timestamp:new Date,source:"learning-optimization",payload:{count:n.length,insights:n.map(i=>({id:i.id,type:i.type,description:i.description,confidence:i.confidence,suggestedAction:i.suggestedAction,detectedAt:i.detectedAt}))}})}catch{m.debug("Failed to publish meta-learning insight event")}}}else m.debug("Meta-learning: accumulating snapshots",{current:this.metaLearningSnapshots.length,required:t})}scheduleNextDream(){if(this.clearScheduledDream(),!this.running)return;let e=this.calculateNextDreamDelay();this.scheduledDreamTimer=setTimeout(async()=>{if(!(!this.running||this.dreaming))try{await this.executeDream(this.config.defaultDreamDurationMs)}catch(t){m.error("Scheduled dream failed",t instanceof Error?t:void 0),this.running&&this.scheduleNextDream()}},e),m.info("Next dream scheduled",{delaySeconds:Math.ceil(e/1e3)})}clearScheduledDream(){this.scheduledDreamTimer&&(clearTimeout(this.scheduledDreamTimer),this.scheduledDreamTimer=null)}calculateNextDreamDelay(){if(!this.lastDreamTime)return this.config.autoScheduleIntervalMs;let e=Date.now()-this.lastDreamTime.getTime(),t=this.config.autoScheduleIntervalMs-e;return Math.max(t,this.config.minTimeBetweenDreamsMs)}getTimeUntilScheduledDream(){return this.calculateNextDreamDelay()}canDream(){return this.lastDreamTime?Date.now()-this.lastDreamTime.getTime()>=this.config.minTimeBetweenDreamsMs:!0}getTimeUntilCanDream(){if(!this.lastDreamTime)return 0;let e=Date.now()-this.lastDreamTime.getTime();return Math.max(0,this.config.minTimeBetweenDreamsMs-e)}async handleQualityGateEvent(e){if(!e.payload.passed){if(!this.canDream()||this.dreaming){m.info("Quality gate failed but cannot start dream yet");return}m.info("Quality gate failed, triggering analysis dream");try{await this.executeDream(this.config.quickDreamDurationMs)}catch(t){m.error("Quality gate triggered dream failed",t instanceof Error?t:void 0)}}}async handleDomainMilestoneEvent(e){if(!this.canDream()||this.dreaming){m.info("Milestone reached but cannot start dream yet");return}m.info("Domain milestone reached, triggering consolidation dream");try{await this.executeDream(this.config.defaultDreamDurationMs)}catch(t){m.error("Milestone triggered dream failed",t instanceof Error?t:void 0)}}async publishDreamCompletedEvent(e){try{await this.eventBus.publish({id:D(),type:"learning-optimization:dream:completed",timestamp:new Date,source:"learning-optimization",payload:{cycleId:e.cycle.id,insightsGenerated:e.insights.length,patternsCreated:e.patternsCreated,duration:e.cycle.durationMs}})}catch(t){m.error("Failed to publish dream completed event",t instanceof Error?t:void 0)}}async reconcileHookState(){if(this.memoryBackend)try{let e=await this.memoryBackend.get(de),t={lastDreamTime:(this.lastDreamTime??new Date).toISOString(),experienceCount:0,sessionStartTime:e?.sessionStartTime,totalDreamsThisSession:(e?.totalDreamsThisSession??0)+1};await this.memoryBackend.set(de,t)}catch(e){m.warn("Dream hook-state reconcile failed (non-critical)",{error:e instanceof Error?e.message:String(e)})}}async saveState(){if(this.memoryBackend)try{await this.memoryBackend.set("dream-scheduler:state",{lastDreamTime:this.lastDreamTime?.toISOString()??null,totalDreamsCompleted:this.totalDreamsCompleted,experienceBuffer:this.experienceBuffer},{namespace:"learning-optimization",persist:!0})}catch(e){m.error("Failed to save state",e instanceof Error?e:void 0)}}async restoreState(){if(this.memoryBackend)try{let e=await this.memoryBackend.get("dream-scheduler:state");e&&(this.lastDreamTime=e.lastDreamTime?new Date(e.lastDreamTime):null,this.totalDreamsCompleted=e.totalDreamsCompleted??0,this.experienceBuffer=e.experienceBuffer??[],m.info("Restored state",{totalDreamsCompleted:this.totalDreamsCompleted,experienceCount:this.experienceBuffer.length}))}catch(e){m.error("Failed to restore state",e instanceof Error?e:void 0)}}ensureInitialized(){if(!this.initialized)throw new Error("DreamScheduler not initialized. Call initialize() first.")}};function Te(d,e){return new P(d,e)}F();var Se=[{name:"aggressive-exploration",description:"High noise, fast decay -- explores widely but forgets quickly",activationConfig:{decayRate:.2,spreadFactor:.7,noiseLevel:.15,maxIterations:30}},{name:"conservative-consolidation",description:"Low noise, slow decay -- strengthens existing associations",activationConfig:{decayRate:.05,spreadFactor:.3,noiseLevel:.02,maxIterations:15}},{name:"balanced-discovery",description:"Moderate parameters -- balanced between exploration and consolidation",activationConfig:{decayRate:.1,spreadFactor:.5,noiseLevel:.05,maxIterations:20}}],V=class{constructor(e){this.engine=e}engine;async dream(e,t={}){if(e.length<1)throw new Error("At least one strategy is required");if(e.length>5)throw new Error("Maximum 5 strategies allowed to limit resource usage");let n=Date.now(),i=[],s=this.engine.cancelCount,r=()=>this.engine.cancelCount!==s;for(let c of e){if(r())break;i.push(await this.executeStrategy(c,t.durationMs))}if(r())return{strategies:i,winner:null,totalDurationMs:Date.now()-n,cancelled:!0};let o=null;for(let c of i)c.result&&(!o||c.score>o.score)&&(o=c);let a;if(o?.result)try{a=this.engine.commitDreamResult(o.result),o.selected=!0}catch(c){o.error=C(c),o=null}return{strategies:i,winner:o,totalDurationMs:Date.now()-n,commitDurationMs:a,cancelled:!1}}async executeStrategy(e,t){let n=Date.now();try{let i=await this.engine.dream(t,{activationConfig:e.activationConfig,commit:!1});return{strategy:e,result:i,score:this.scoreResult(i),selected:!1,durationMs:Date.now()-n}}catch(i){return{strategy:e,result:null,score:Number.NEGATIVE_INFINITY,error:C(i),selected:!1,durationMs:Date.now()-n}}}scoreResult(e){return e.insights.reduce((n,i)=>n+i.confidenceScore*i.noveltyScore,0)+e.cycle.associationsFound*.01}};export{ce as a,pe as b,P as c,Te as d,k as e,T as f,me as g,z as h,G as i,H as j,re as k,S as l,se as m,I as n,M as o,$ as p,U as q,x as r,q as s,ae as t,L as u,w as v,be as w,Ae as x,Se as y,V as z};
|
|
@@ -0,0 +1,6 @@
|
|
|
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.11");process.exit(0)}
|
|
2
|
+
import{a as F,c as $,d as N,e as b,f as L}from"./chunk-72ZBJD2E.js";import{c as _,d as v}from"./chunk-M7XFBSIK.js";import{c as C,e as se}from"./chunk-ITL3IN2E.js";import{c as A,d as re}from"./chunk-EH2S6AOR.js";import*as p from"fs";import*as X from"os";import*as l from"path";import*as f from"fs";import*as O from"os";import*as u from"path";se();function oe(n=process.env){let t=(n.AQE_COVERAGE_NO_EXEC??"").trim().toLowerCase();return t?t!=="false"&&t!=="0"&&t!=="no"&&t!=="off":!1}var ae=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".go",".rs",".java",".rb"]),I=new Set(["node_modules","dist","build","coverage",".git",".claude",".agentic-qe","__pycache__",".venv","target","vendor"]),W=new Set(["tests","test","__tests__","benches","examples","spec"]),ie=[/\.test\./i,/\.spec\./i,/_test\./i,/_spec\./i,/^test_/i,/^test\./i,/^conftest\./i];function y(n,t){let e=n.split(u.sep).join("/"),r=u.basename(e);if(ie.some(s=>s.test(r)))return!0;let o=e;if(t){let s=u.resolve(t).split(u.sep).join("/"),i=u.resolve(n).split(u.sep).join("/");(i===s||i.startsWith(`${s}/`))&&(o=i.slice(s.length).replace(/^\//,""))}return o.split("/").some(s=>W.has(s))}function ce(n){let t=n.split(""),e=n.length,r=0,o=(s,i)=>{for(let a=s;a<i&&a<e;a++)n[a]!==`
|
|
3
|
+
`&&(t[a]=" ")};for(;r<e;){let s=n[r];if(s==="/"&&n[r+1]==="/"){let a=n.indexOf(`
|
|
4
|
+
`,r),c=a===-1?e:a;o(r,c),r=c;continue}if(s==="/"&&n[r+1]==="*"){let a=0,c=r;for(;r<e;){if(n[r]==="/"&&n[r+1]==="*"){a++,r+=2;continue}if(n[r]==="*"&&n[r+1]==="/"){if(a--,r+=2,a===0)break;continue}r++}o(c,r);continue}let i=/^b?r(#*)"/.exec(n.slice(r,r+300));if(i){let a=`"${i[1]}`,c=r+i[0].length,g=n.indexOf(a,c),h=g===-1?e:g+a.length;o(r,h),r=h;continue}if(s==='"'){let a=r;for(r++;r<e;){if(n[r]==="\\"){r+=2;continue}if(n[r]==='"'){r++;break}r++}o(a,r);continue}if(s==="'"){let a=-1;if(n[r+1]==="\\"){let c=n.indexOf("'",r+2);c!==-1&&c<=r+5&&(a=c+1)}else n[r+2]==="'"&&(a=r+3);if(a!==-1){o(r,a),r=a;continue}}r++}return t.join("")}function le(n,t){if(t!==".rs")return[];let e=ce(n).split(`
|
|
5
|
+
`),r=[];for(let o=0;o<e.length;o++){if(!/#\s*\[\s*cfg\s*\(\s*test\s*\)\s*\]/.test(e[o]))continue;let s=-1;for(let c=o;c<Math.min(e.length,o+10);c++){let g=e[c],h=g.indexOf("{"),d=g.indexOf(";");if(d!==-1&&(h===-1||d<h))break;if(h!==-1){let x=e.slice(o,c+1).join(" ");/\bmod\s+\w+/.test(x)&&(s=c);break}}if(s===-1)continue;let i=0,a=-1;for(let c=s;c<e.length;c++){for(let g of e[c])g==="{"?i++:g==="}"&&i--;if(i<=0){a=c;break}}r.push([o+1,(a===-1?e.length-1:a)+1]),o=a===-1?e.length:a}return r}function ue(n){if(n.length===0)return 0;let t=n.split(`
|
|
6
|
+
`);return t[t.length-1]===""&&t.pop(),t.length}function U(n,t=6){let e=u.resolve(n);try{if(!f.existsSync(e))return null;f.statSync(e).isDirectory()||(e=u.dirname(e))}catch{return null}for(let r=0;r<=t;r++){if(f.existsSync(u.join(e,"Cargo.toml")))return f.realpathSync(e);let o=u.dirname(e);if(o===e)break;e=o}return null}function J(n,t=0){if(t>4)return!1;let e;try{e=f.readdirSync(n,{withFileTypes:!0})}catch{return!1}for(let r of e)if(r.isFile()&&u.extname(r.name)===".rs")return!0;for(let r of e)if(r.isDirectory()&&!I.has(r.name)&&J(u.join(n,r.name),t+1))return!0;return!1}function Fe(n){let t=U(n);if(t===null)return!1;let e=u.resolve(n);return e===t||J(e)}async function $e(n,t={}){if(oe())return null;let e=t.timeoutMs??3e5,r=U(n);if(!r)return null;let o=await C("cargo",["llvm-cov","--version"],{cwd:r,timeout:3e4});if(o.error||o.status!==0)return null;let s=u.join(f.mkdtempSync(u.join(O.tmpdir(),"aqe-rust-cov-")),"lcov.info");try{let i=await C("cargo",["llvm-cov","--lcov","--output-path",s],{cwd:r,timeout:e});if(i.error||i.status!==0||!f.existsSync(s))return null;let c=b(f.readFileSync(s,"utf-8")).files.filter(d=>!y(d.path,r));if(c.length===0)return null;let g=z(c),h=c.some(d=>d.branches.total>0);return{data:g,provenance:{method:"cargo-llvm-cov",estimated:!1,branchDataCollected:h,functionDataCollected:c.some(d=>d.functions.total>0),notes:h?[]:["cargo-llvm-cov reported no branch data (Rust branch coverage requires a nightly toolchain with -Z coverage-options=branch). Branch coverage is reported as null rather than assumed."]}}}catch{return null}finally{try{f.rmSync(u.dirname(s),{recursive:!0,force:!0})}catch{}}}var M={".rs":{fn:/\bfn\s+\w+/g,branch:/\b(if|match|while|for)\b|\?\?|\|\||&&/g},".go":{fn:/\bfunc\s+\w*/g,branch:/\b(if|switch|case|for|select)\b|\|\||&&/g},".py":{fn:/\b(def|lambda)\b/g,branch:/\b(if|elif|for|while|except)\b|\band\b|\bor\b/g},".java":{fn:/\b(public|private|protected|static)[\w<>,\s[\]]+\w+\s*\(/g,branch:/\b(if|switch|case|for|while|catch)\b|\|\||&&/g},".rb":{fn:/\bdef\s+\w+/g,branch:/\b(if|elsif|unless|case|when|while)\b|\|\||&&/g},default:{fn:/\bfunction\b|=>|\b\w+\s*\([^)]*\)\s*\{/g,branch:/\b(if|switch|case|for|while|catch)\b|\?\?|\|\||&&/g}};function fe(n){return M[n]??M.default}function P(n,t){return(n.match(new RegExp(t.source,t.flags))||[]).length}function z(n){let t=s=>n.reduce((i,a)=>i+s(a),0),e=(s,i)=>i>0?Math.round(s/i*100):0,r=t(s=>s.lines.total),o=t(s=>s.lines.covered);return{files:n,summary:{line:e(o,r),branch:e(t(s=>s.branches.covered),t(s=>s.branches.total)),function:e(t(s=>s.functions.covered),t(s=>s.functions.total)),statement:e(o,r),files:n.length}}}function pe(n){let t=[],e=n;function r(o,s){if(s>6)return;let i;try{i=f.readdirSync(o,{withFileTypes:!0})}catch{return}for(let a of i){let c=u.join(o,a.name);if(a.isDirectory()){if(I.has(a.name)||W.has(a.name))continue;r(c,s+1)}else if(a.isFile()){if(!ae.has(u.extname(a.name))||y(c,e))continue;t.push(c)}}}return r(n,0),t}function Ne(n){if(!f.existsSync(n)||!f.statSync(n).isDirectory())return null;let t=pe(n);if(t.length===0)return null;let e=t.map(r=>{let o="";try{o=v(r,{outsideRoot:"allow"})}catch{}let s=u.extname(r),i=ue(o),a=le(o,s),c=m=>a.some(([w,R])=>m>=w&&m<=R),g=a.reduce((m,[w,R])=>m+(R-w+1),0),h=Math.max(i-g,0),d=fe(s),x=P(o,d.fn),Y=a.length>0,K=ge(r),Z=Y||K,H=P(o,d.branch),Q=Math.min(H*.005,.15),ee=Math.min(h*1e-4,.1),te=Math.max(.05,Math.min(.95,Z?.85-Q-ee:.2)),j=Math.floor(h*te),D=[];for(let m=1;m<=i;m++)c(m)||D.push(m);let ne=D.slice(j);return{path:r,lines:{covered:j,total:h},branches:{covered:0,total:0},functions:{covered:0,total:x},statements:{covered:j,total:h},uncoveredLines:ne,uncoveredBranches:[]}});return{data:z(e),provenance:{method:"static-estimation",estimated:!0,branchDataCollected:!1,functionDataCollected:!1,notes:["No instrumentation ran. These numbers are a STATIC ESTIMATE derived from source shape (file size, declaration counts, presence of a test file) \u2014 they are not measured coverage and must not be reported as such.","Branch and function coverage were not collected and are reported as null."]}}}function ge(n){let t=u.extname(n),e=n.slice(0,-t.length);return[`${e}.test${t}`,`${e}.spec${t}`,`${e}_test${t}`,`${e}.test${t}`.replace("/src/","/tests/"),`${e}.spec${t}`.replace("/src/","/tests/"),`${e}${t}`.replace("/src/","/tests/")].some(o=>{try{return f.existsSync(o)}catch{return!1}})}re();var he=["package.json","pyproject.toml","setup.py","setup.cfg","go.mod","Cargo.toml","pom.xml","build.gradle","build.gradle.kts",".git"],de=["vitest.config.ts","vitest.config.js","vitest.config.mts","vitest.config.mjs","vitest.config.cts","vitest.config.cjs","vitest.workspace.ts","vitest.workspace.js","vitest.workspace.mts","vitest.workspace.mjs","vitest.workspace.json","vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs","jest.config.ts","jest.config.js","jest.config.mts","jest.config.mjs","jest.config.cts","jest.config.cjs","jest.config.json"];function G(n){return de.some(t=>p.existsSync(l.join(n,t)))?!0:T(n)?.jest!==void 0}function S(n){let t=T(n);if(!t)return null;let e={...t.devDependencies,...t.dependencies};return e.jest||e["@jest/core"]?"jest":e.mocha||e.nyc?"nyc":e.vitest?"vitest":null}function me(n){try{return p.readdirSync(n).some(t=>/^\.(mocharc|nycrc)(\.|$)/.test(t))}catch{return!1}}function ve(n,t){if(me(n))return(S(t)??"vitest")==="nyc";let e=S(n);return e===null||e===(S(t)??"vitest")}function T(n){try{let t=JSON.parse(v(l.join(n,"package.json"),{outsideRoot:"allow"}));return typeof t=="object"&&t!==null?t:null}catch{return null}}function V(n){let t=[],e=!1,o=T(n)?.workspaces,s=Array.isArray(o)?o:typeof o=="object"&&o!==null&&Array.isArray(o.packages)?o.packages:null;o!=null&&typeof o=="object"&&(e=!0),s&&t.push(...s.filter(i=>typeof i=="string"));try{let i=v(l.join(n,"pnpm-workspace.yaml"),{outsideRoot:"allow"});e=!0;let a=!1;for(let c of i.split(/\r?\n/)){let g=c.replace(/\s+#.*$/,"").trimEnd();if(/^packages\s*:/.test(g)){a=!0;continue}if(a){let h=/^\s+-\s+(.+)$/.exec(g);h?t.push(h[1].trim().replace(/^['"]|['"]$/g,"")):/^\S/.test(g)&&(a=!1)}}}catch{}return e?t:null}function be(n){let r=n.replace(/^\.\//,"").replace(/\/+$/,"").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*\//g,"\0").replace(/\*\*/g,"").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]").split("\0").join("(?:.*/)?").split("").join(".*");return new RegExp(`^${r}$`)}function ye(n,t){let e=V(n);if(!e)return!1;let r=l.relative(n,t).split(l.sep).join("/");if(r===""||r.startsWith("..")||l.isAbsolute(r))return!1;let o=!1;for(let s of e){let i=s.startsWith("!"),a=i?s.slice(1):s;l.isAbsolute(a)||/^[A-Za-z]:/.test(a)||a.split(/[\\/]/).includes("..")||be(a).test(r)&&(o=!i)}return o}function k(n,t){let e=l.relative(t,n);return e===""||!e.startsWith("..")&&!l.isAbsolute(e)}function xe(n){try{return p.realpathSync(l.resolve(A(n)))}catch{return null}}function q(n,t=12){let e;try{let a=l.resolve(n);if(!p.existsSync(a))return null;let c=p.realpathSync(a);e=p.statSync(c).isDirectory()?c:l.dirname(c)}catch{return null}let r=null;try{r=p.realpathSync(X.homedir())}catch{r=null}let o=e,s=null,i=null;for(let a=0;a<=t;a++){if(r!==null&&e===r&&e!==o)return s;if(!s&&he.some(g=>p.existsSync(l.join(e,g)))){if(s=e,G(e)||!p.existsSync(l.join(e,"package.json")))return e}else if(s&&V(e)!==null)return i??=xe(o)??"",i&&k(e,i)&&k(s,i)&&ye(e,s)&&G(e)&&ve(s,e)?e:s;if(s&&p.existsSync(l.join(e,".git")))return s;let c=l.dirname(e);if(c===e)return s;e=c}return s}function We(n,t){try{let e=p.realpathSync(t),r=p.realpathSync(l.resolve(n)),o=p.statSync(r).isDirectory()?r:l.dirname(r);for(;o!==e&&k(o,e);){if(p.existsSync(l.join(o,"package.json")))return`${l.relative(e,o).split(l.sep).join("/")}/`;let s=l.dirname(o);if(s===o)break;o=s}}catch{}return null}var je=new Set(["lcov.info","coverage-final.json","coverage-summary.json","coverage.xml","cobertura-coverage.xml","cobertura.xml"]);function we(n){let t=l.basename(n).toLowerCase();return je.has(t)||t.endsWith(".lcov")||t.endsWith(".lcov.info")}async function Re(n){let t;try{t=await _(n,{outsideRoot:"allow"})}catch{return null}if(t.trim().length===0)return null;try{let e=l.basename(n).toLowerCase(),r;if(e.endsWith(".json")){let o=JSON.parse(t);if(Se(o))r=N(t);else if(Ce(o))r=$(t);else return null}else e.endsWith(".xml")?r=L(t):r=b(t);return r.files.length>0?r:null}catch{return null}}function Ce(n){let t=Object.values(n);return t.length>0&&t.every(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.s=="object"&&typeof e.statementMap=="object")}function Se(n){let t=n.total;return typeof t=="object"&&t!==null&&typeof t.lines=="object"}function Ee(n,t){let e=l.relative(t,n);return e===""||!e.startsWith("..")&&!l.isAbsolute(e)}function E(n){try{return p.realpathSync(n)}catch{return l.resolve(n)}}function ke(n,t,e){let r=E(t),o=E(e);return o===r?[...n.files]:n.files.filter(s=>{let i=l.isAbsolute(s.path)?E(s.path):l.resolve(r,s.path);return Ee(i,o)})}function B(n,t,e,r={}){if(r.numTotalTests===0)return{status:"no-data",reason:"no-tests-ran"};let o=ke(n,t,e);if(o.length===0)return{status:"no-data",reason:"target-not-covered"};let s=o.filter(i=>!y(i.path,t));return s.length===0?{status:"no-data",reason:"test-only-report"}:{status:"measured",files:s}}async function Ue(n){let t=l.resolve(n),e;try{e=p.statSync(t)}catch{return{status:"target-missing",target:t}}if(e.isFile()&&we(t)){let s=l.dirname(t),i=q(s)??(l.basename(s)==="coverage"?l.dirname(s):s),a=await Re(t),c=a?B(a,i,i):{status:"no-data",reason:"unreadable-report"};return{status:"evaluated",target:t,projectRoot:i,source:"report-file",evaluation:c}}let r=q(t)??(e.isDirectory()?t:l.dirname(t)),o=await F(r);return o?{status:"evaluated",target:t,projectRoot:r,source:"project-report",evaluation:B(o,r,t)}:{status:"no-report",target:t,projectRoot:r}}function Je(n,t,e){let r=[n.line];e.statement!==!1&&r.push(n.statement),e.branch&&r.push(n.branch),e.function&&r.push(n.function);let o=r.reduce((s,i)=>s+i,0)/r.length;return{overall:o,meetsThreshold:o>=t}}var Te=/^Coverage is [\d.]+% below threshold/i;function ze(n,t,e,r){let o=n.filter(s=>!Te.test(s)&&(r.branch||!/branch coverage/i.test(s))&&(r.function||!/function coverage/i.test(s)));return t.meetsThreshold?o:[`Coverage is ${(e-t.overall).toFixed(1)}% below threshold. Focus on high-risk files first.`,...o]}function Ge(n){return n==="target-not-covered"||n==="no-tests-ran"}function qe(n,t,e){switch(n){case"target-missing":return`Target does not exist: ${t}`;case"unreadable-report":return`Unreadable coverage report: ${t}. It could not be parsed or lists no files. Supported: lcov.info, istanbul coverage-final.json / coverage-summary.json, Cobertura XML. Raw V8 output is not supported \u2014 convert it with c8 or your runner's istanbul reporter.`;case"test-only-report":return"The coverage report contains only test files, so there is no production coverage to report. Coverage OF a test file is not a meaningful metric. Check that your coverage tool is instrumenting your source directory.";case"target-not-covered":return`Target is UNMEASURED: the coverage data for project ${e??"?"} has no entry for any production file under ${t}. This is not 0% coverage \u2014 no measurement exists for it. Check your coverage tool's include/exclude settings, or regenerate the report.`;case"no-tests-ran":return`Target is UNMEASURED: the test runner reported running 0 tests from ${e??"?"}. This is not 0% coverage.`}}export{oe as a,U as b,Fe as c,$e as d,Ne as e,We as f,Re as g,ke as h,B as i,Ue as j,Je as k,ze as l,Ge as m,qe as n};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.
|
|
2
|
-
import{d as g,e as S,p as E,q as _}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.11");process.exit(0)}
|
|
2
|
+
import{d as g,e as S,p as E,q as _}from"./chunk-VLD7Z2ED.js";function R(i,e){return{ingest(t){i.ingest(t)},search(t,r){return i.search(t,r).map(s=>({id:s.id,score:s.score}))},delete(t){i.delete(t)},status(){let t=i.status();return{totalVectors:t.totalVectors,dimensions:e,totalSegments:t.totalSegments,fileSizeBytes:t.fileSizeBytes,epoch:t.epoch,witnessValid:t.witnessValid,witnessEntries:t.witnessEntries}},close(){i.close()},compact(){return i.compact()}}}function f(i,e){return(i.prepare("SELECT COUNT(*) as cnt FROM sqlite_master WHERE type='table' AND name=?").get(e)?.cnt??0)>0}function m(i,e,t){return i.prepare(`PRAGMA table_info(${e})`).all().some(s=>s.name===t)}var h=class{db;config;rvfStore=null;rvfAvailable=!1;constructor(e,t){this.db=e,this.config={...t,dimensions:t.dimensions??384},f(this.db,"qe_pattern_embeddings")&&!m(this.db,"qe_pattern_embeddings","space_id")&&(this.db.exec("ALTER TABLE qe_pattern_embeddings ADD COLUMN space_id TEXT"),this.db.exec("CREATE INDEX IF NOT EXISTS idx_qe_pattern_embeddings_space ON qe_pattern_embeddings(space_id)"))}activeSpaceId(){return this.config.embeddingSpaceId??E()?.spaceId}async initialize(){if(this.config.mode==="sqlite-only"){this.rvfAvailable=!1;return}try{let e=await import("./rvf-native-adapter-6COXTQZ3.js");if(!e.isRvfNativeAvailable()){this.rvfAvailable=!1;return}if(this.activeSpaceId()||await _(),!this.activeSpaceId()){this.rvfAvailable=!1,g();return}let{isRvfLockHeldError:t,removeStaleRvfLock:r,quarantineUnusableStore:s}=await import("./rvf-store-integrity-Q2TH52SN.js"),l=()=>{try{return{store:e.openRvfStore(this.config.rvfPath),error:null}}catch(o){return{store:null,error:o}}},{store:n,error:a}=l();if(!n&&t(a)&&(!r(this.config.rvfPath)||({store:n,error:a}=l(),!n&&t(a))))throw a;if(!n)try{n=e.createRvfStore(this.config.rvfPath,this.config.dimensions)}catch(o){if({store:n,error:a}=l(),!n){if(t(a))throw a;if(!s(this.config.rvfPath,o instanceof Error?o.message:String(o),a))throw o;n=e.createRvfStore(this.config.rvfPath,this.config.dimensions)}}this.rvfStore=R(n,this.config.dimensions),S(this.config.rvfPath,this.activeSpaceId()??null,this.rvfStore.status().totalVectors),this.rvfAvailable=!0}catch(e){try{this.rvfStore?.close()}catch{}this.rvfStore=null,this.rvfAvailable=!1,console.warn(`[RVF] Dual-writer disabled for ${this.config.rvfPath}; falling back to SQLite: ${e instanceof Error?e.message:String(e)}`)}}setRvfStore(e){this.rvfStore=e,this.rvfAvailable=!0}writePattern(e,t){let r={sqliteSuccess:!1,rvfSuccess:!1};if(!m(this.db,"qe_pattern_embeddings","space_id")||!this.activeSpaceId())return{...r,divergence:"VECTOR_SPACE_UNVERIFIED"};try{this.writeSqliteEmbedding(e,t),r.sqliteSuccess=!0}catch{r.sqliteSuccess=!1}if(this.shouldWriteRvf())try{this.rvfStore.ingest([{id:e,vector:t instanceof Float32Array?Array.from(t):t}]),r.rvfSuccess=!0}catch{r.rvfSuccess=!1,r.divergence="rvf-write-failed"}return r}deletePattern(e){let t={sqliteSuccess:!1,rvfSuccess:!1};try{this.deleteSqliteEmbedding(e),t.sqliteSuccess=!0}catch{t.sqliteSuccess=!1}if(this.shouldWriteRvf())try{this.rvfStore.delete([e]),t.rvfSuccess=!0}catch{t.rvfSuccess=!1,t.divergence="rvf-delete-failed"}return t}search(e,t){if(!this.hasCompatibleEmbeddingSpace())return[];if(this.config.mode==="rvf-primary"&&this.rvfAvailable&&this.rvfStore)try{return this.rvfStore.search(e,t)}catch{}return this.searchSqlite(e,t)}getDivergenceReport(){let e={totalChecked:0,divergences:0,details:[]},t=this.getSqliteEmbeddingCount();if(e.totalChecked=t,!this.rvfAvailable||!this.rvfStore)return this.config.mode!=="sqlite-only"&&t>0&&(e.divergences=1,e.details.push({patternId:"*",issue:"count-mismatch"})),e;let s=this.rvfStore.status().totalVectors;return t!==s&&(e.divergences=1,e.details.push({patternId:"*",issue:"count-mismatch"})),e}isPromotionSafe(){return this.getDivergenceReport().divergences===0}status(){let e=this.getSqlitePatternCount(),t=this.getSqliteEmbeddingCount(),r=null;if(this.rvfAvailable&&this.rvfStore)try{r=this.rvfStore.status()}catch{r=null}return{sqlite:{patternCount:e,vectorCount:t},rvf:r,mode:this.config.mode}}close(){if(this.rvfStore){try{this.rvfStore.close()}catch{}this.rvfStore=null,this.rvfAvailable=!1}}compact(){if(!this.rvfStore||!this.rvfAvailable||!this.rvfStore.compact)return null;try{return this.rvfStore.compact()??null}catch{return null}}shouldWriteRvf(){return(this.config.mode==="dual-write"||this.config.mode==="rvf-primary")&&this.rvfAvailable&&this.rvfStore!==null}hasCompatibleEmbeddingSpace(){if(!m(this.db,"qe_pattern_embeddings","space_id"))return!1;let e=this.activeSpaceId();return e?(this.db.prepare(`
|
|
3
3
|
SELECT COUNT(*) AS incompatible
|
|
4
4
|
FROM qe_pattern_embeddings
|
|
5
5
|
WHERE space_id IS NULL OR space_id <> ?
|
|
@@ -0,0 +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.11");process.exit(0)}
|
|
2
|
+
import{d as l,e as o}from"./chunk-ITL3IN2E.js";var t=n=>typeof n=="number"&&Number.isFinite(n)&&n>=0&&n<=100,i=n=>n===null||t(n);function a(n){if(!n||typeof n!="object")return null;let e=n;if(e.measured!==!0||!t(e.line)||!i(e.statement)||!i(e.branch)||!i(e.function))return null;let r=typeof e.files=="number"&&Number.isInteger(e.files)&&e.files>=0?e.files:null;return r===null?null:{line:e.line,branch:e.branch,function:e.function,statement:e.statement,files:r,measured:!0,...e.runStatus==="passed"||e.runStatus==="failed"?{runStatus:e.runStatus}:{}}}function m(n){if(!n||typeof n!="object")return null;let e=n;if(e.measured!==!0||!t(e.line))return null;let r=s=>t(s)?s:null;return{line:e.line,branch:r(e.branch),function:r(e.function),statement:r(e.statement),measured:!0}}o();var u=class extends Error{constructor(e,r){super(`git ${e.join(" ")} timed out after ${Math.max(0,r)}ms`),this.name="GitTimeoutError"}};async function b(n,e){if(e.timeout<=0)throw new u(n,e.timeout);try{return await l("git",n,{cwd:e.cwd,timeout:e.timeout,maxBuffer:e.maxBuffer,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}})}catch(r){throw r.code==="ETIMEDOUT"?new u(n,e.timeout):r}}export{a,m as b,u as c,b as d};
|
|
@@ -1,2 +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{b as m,d 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.11");process.exit(0)}
|
|
2
|
+
import{b as m,d as A}from"./chunk-JFLU7L3W.js";import{a as u,b as C,c as R,e as S}from"./chunk-WM3SRRA6.js";import{a as P}from"./chunk-IO5537OM.js";import{c as b}from"./chunk-FZHSG75I.js";A();S();P();var g=b.create("skill-validation-learner"),y=class{constructor(e){this.reasoningBank=e}reasoningBank;memoryNamespace="skill-validation";feedbackLoop=null;connectFeedbackLoop(e){this.feedbackLoop=e}async recordValidationOutcome(e){await this.reasoningBank.storeQEPattern({patternType:"test-template",name:`${e.skillName}-validation-${e.validationLevel}`,description:`Validation outcome for ${e.skillName} at level ${e.validationLevel}`,context:{tags:["skill-validation",e.skillName,e.model,e.validationLevel],testType:"integration"},template:{type:"config",content:JSON.stringify({outcome:{skillName:e.skillName,trustTier:e.trustTier,validationLevel:e.validationLevel,model:e.model,passed:e.passed,score:e.score,testCaseCount:e.testCaseResults.length,passedTests:e.testCaseResults.filter(a=>a.passed).length,avgReasoningQuality:this.calculateAvgReasoningQuality(e.testCaseResults),timestamp:e.timestamp.toISOString(),runId:e.runId,metadata:e.metadata}}),variables:[]}}),await this.updateSkillConfidence(e),e.validationLevel==="eval"&&await this.trackCrossModelBehavior(e),this.feedbackLoop&&e.runId&&await this.recordToFeedbackLoop(e)}async updateSkillConfidence(e){let a=`skill-confidence-${e.skillName}`,s=await this.reasoningBank.searchQEPatterns(a,{limit:1}),t;if(s.success&&s.value.length>0)try{let i=s.value[0].pattern.template?.content;if(i){let r=m(i);r&&typeof r=="object"&&Array.isArray(r.outcomes)?t=r:t=this.createEmptyConfidence(e.skillName)}else t=this.createEmptyConfidence(e.skillName)}catch(n){g.debug("Confidence history parse failed",{skill:e.skillName,error:n instanceof Error?n.message:String(n)}),t=this.createEmptyConfidence(e.skillName)}else t=this.createEmptyConfidence(e.skillName);t.outcomes.push({score:e.score,timestamp:e.timestamp,model:e.model,validationLevel:e.validationLevel,passed:e.passed}),t.outcomes.length>100&&(t.outcomes=t.outcomes.slice(-100)),t.avgScore=t.outcomes.reduce((n,i)=>n+i.score,0)/t.outcomes.length,t.lastUpdated=new Date,t.trend=this.calculateTrend(t.outcomes),t.byLevel=this.calculateConfidenceByLevel(t.outcomes),await this.reasoningBank.storeQEPattern({patternType:"test-template",name:a,description:`Skill confidence tracking for ${e.skillName}`,context:{tags:["skill-confidence",e.skillName]},template:{type:"config",content:JSON.stringify(t),variables:[]}})}async trackCrossModelBehavior(e){let a=`cross-model-${e.skillName}`,s=await this.reasoningBank.searchQEPatterns(a,{limit:1}),t;if(s.success&&s.value.length>0)try{let l=s.value[0].pattern.template?.content;l?t=this.parseCrossModelAnalysis(l)??this.createEmptyCrossModelAnalysis():t=this.createEmptyCrossModelAnalysis()}catch(o){g.debug("Cross-model analysis parse failed",{error:o instanceof Error?o.message:String(o)}),t=this.createEmptyCrossModelAnalysis()}else t=this.createEmptyCrossModelAnalysis();t.models||(t.models=u());let n=C(t.models,e.model)??{scores:[],passRate:0,avgReasoningQuality:0,sampleCount:0};R(t.models,e.model,n),n.scores.push(e.score),n.sampleCount++,n.scores.length>50&&(n.scores=n.scores.slice(-50));let i=this.calculateAvgReasoningQuality(e.testCaseResults);n.passRate=n.scores.filter(o=>o>=.9).length/n.scores.length,n.avgReasoningQuality=(n.avgReasoningQuality*(n.sampleCount-1)+i)/n.sampleCount;let r=Object.values(t.models).map(o=>o.passRate);if(r.length>1){let o=r.reduce((d,c)=>d+c,0)/r.length,l=r.reduce((d,c)=>d+Math.pow(c-o,2),0)/r.length;t.variance=l,t.hasAnomalies=l>.04,t.anomalies=[];for(let[d,c]of Object.entries(t.models))Math.abs(c.passRate-o)>.2&&t.anomalies.push({model:d,type:c.passRate<o?"low_performance":"high_variance",description:`Model ${d} has ${((c.passRate-o)*100).toFixed(1)}% difference from average`})}t.lastUpdated=new Date,await this.reasoningBank.storeQEPattern({patternType:"test-template",name:a,description:`Cross-model behavior tracking for ${e.skillName}`,context:{tags:["cross-model",e.skillName]},template:{type:"config",content:JSON.stringify(t),variables:[]}})}async recordToFeedbackLoop(e){if(!this.feedbackLoop)return;let a={taskId:e.runId,taskDescription:`Skill validation: ${e.skillName} (${e.validationLevel})`,recommendedAgent:"skill-validator",usedAgent:"skill-validator",followedRecommendation:!0,success:e.passed,qualityScore:e.score,durationMs:e.metadata?.duration||0,timestamp:e.timestamp};await this.feedbackLoop.recordRoutingOutcome(a)}async getSkillConfidence(e){let a=`skill-confidence-${e}`,s=await this.reasoningBank.searchQEPatterns(a,{limit:1});if(s.success&&s.value.length>0)try{let t=s.value[0].pattern.template?.content;if(t)return m(t)}catch(t){g.debug("Skill confidence pattern content invalid",{skill:e,error:t instanceof Error?t.message:String(t)})}return null}async getCrossModelAnalysis(e){let a=`cross-model-${e}`,s=await this.reasoningBank.searchQEPatterns(a,{limit:1});if(s.success&&s.value.length>0)try{let t=s.value[0].pattern.template?.content;if(t)return this.parseCrossModelAnalysis(t)}catch(t){g.debug("Cross-model pattern content invalid",{skill:e,error:t instanceof Error?t.message:String(t)})}return null}async queryValidationPatterns(e,a=10){let s=await this.reasoningBank.searchQEPatterns(`${e} validation`,{limit:a});return s.success?s.value.filter(t=>t.pattern.context?.tags?.includes("skill-validation")).map(t=>t.pattern):[]}async getValidationTrends(e){let a=await this.getSkillConfidence(e),s=await this.getCrossModelAnalysis(e);if(!a)return null;let t=u();if(s)for(let r of Object.keys(s.models)){let o=a.outcomes.filter(l=>l.model===r).map(l=>({score:l.score}));t[r]=this.calculateTrend(o)}let n=a.outcomes.slice(-20),i=n.filter(r=>r.passed).length/n.length;return{overall:a.trend||"stable",byModel:t,recentPassRate:i}}async extractLearnedPatterns(e){let a=await this.queryValidationPatterns(e,50),s=[],t=new Map;for(let n of a)try{let r=m(n.template?.content||"{}").outcome?.metadata?.category||"general";t.has(r)||t.set(r,[]),t.get(r).push(n)}catch(i){g.debug("Invalid pattern during category grouping",{error:i instanceof Error?i.message:String(i)})}for(let[n,i]of Array.from(t.entries())){let r=new Set,o=new Set,l=new Set,d=0;for(let c of i)try{let v=m(c.template?.content||"{}").outcome;if(!v)continue;l.add(v.model),d+=v.score;let k=c.context?.tags||[];v.passed?k.filter(p=>!["skill-validation",e].includes(p)).forEach(p=>r.add(p)):k.filter(p=>!["skill-validation",e].includes(p)).forEach(p=>o.add(p))}catch(f){g.debug("Invalid pattern during category extraction",{error:f instanceof Error?f.message:String(f)})}i.length>0&&s.push({id:`${e}-${n}`,skillName:e,category:n,successIndicators:Array.from(r),failureIndicators:Array.from(o),models:Array.from(l),confidence:d/i.length,observationCount:i.length})}return s}createEmptyConfidence(e){return{skillName:e,avgScore:0,outcomes:[],lastUpdated:new Date}}parseCrossModelAnalysis(e){let a=JSON.parse(e,(s,t)=>t!==null&&typeof t=="object"&&!Array.isArray(t)?Object.assign(u(),t):t);return a&&typeof a=="object"&&a.models&&typeof a.models=="object"&&!Array.isArray(a.models)?a:null}createEmptyCrossModelAnalysis(){return{models:u(),variance:0,hasAnomalies:!1,lastUpdated:new Date}}calculateAvgReasoningQuality(e){return e.length===0?0:e.reduce((a,s)=>a+s.reasoningQuality,0)/e.length}calculateTrend(e){if(e.length<5)return"stable";let a=e.slice(-10),s=e.slice(-20,-10);if(s.length===0)return"stable";let t=a.reduce((r,o)=>r+o.score,0)/a.length,n=s.reduce((r,o)=>r+o.score,0)/s.length,i=t-n;return i>.05?"improving":i<-.05?"declining":"stable"}calculateConfidenceByLevel(e){let a={schema:[],validator:[],eval:[]};for(let t of e)t.validationLevel&&a[t.validationLevel].push(t.score);let s={};for(let[t,n]of Object.entries(a))n.length>0&&(s[t]=n.reduce((i,r)=>i+r,0)/n.length);return s}};function Q(h){return new y(h)}export{Q as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.
|
|
2
|
-
import{b as y,d as p}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.11");process.exit(0)}
|
|
2
|
+
import{b as y,d as p}from"./chunk-DOBZPSKE.js";import{i as h}from"./chunk-7R5HC56U.js";var f={healthyThreshold:3,warningThreshold:2,checkIntervalMs:5e3,maxHistoryEntries:100,alertsEnabled:!0,alertCooldownMs:6e4,selfHealingEnabled:!1,maxHealingActionsPerMinute:5};var g=class{calculator;config;eventBus;persistence;graph;history=[];alerts=new Map;lastAlertTime=new Map;monitoringInterval=null;isMonitoring=!1;constructor(e,t={},r,i){this.graph=e,this.config={...f,...t},this.calculator=p(),this.eventBus=r,this.persistence=i}start(){this.isMonitoring||(this.isMonitoring=!0,this.monitoringInterval=setInterval(()=>this.checkHealth(),this.config.checkIntervalMs),this.checkHealth())}stop(){this.monitoringInterval&&(clearInterval(this.monitoringInterval),this.monitoringInterval=null),this.isMonitoring=!1}updateGraph(e){this.graph=e,this.isMonitoring&&this.checkHealth()}isEmptyTopology(){return this.graph.getVerticesByType("agent").length===0}checkHealth(){let e=this.calculator.getMinCutValue(this.graph),t=this.calculator.findWeakVertices(this.graph),r=this.isEmptyTopology()?"idle":this.determineStatus(e),i=this.calculateTrend();return this.recordHistory(e),this.isEmptyTopology()||this.checkAlertConditions(e,t,r),this.persistence&&t.length>0&&this.persistence.saveWeakVertices(t).catch(n=>console.warn("[MinCutHealthMonitor] Failed to persist weak vertices:",n)),this.emitEvent("mincut.updated",e,{status:r,weakVertexCount:t.length}),{status:r,minCutValue:e,healthyThreshold:this.config.healthyThreshold,warningThreshold:this.config.warningThreshold,weakVertexCount:t.length,topWeakVertices:t.slice(0,5),trend:i,history:this.history.slice(-20),lastUpdated:new Date}}getHealth(){let e=this.calculator.getMinCutValue(this.graph),t=this.calculator.findWeakVertices(this.graph);return{status:this.isEmptyTopology()?"idle":this.determineStatus(e),minCutValue:e,healthyThreshold:this.config.healthyThreshold,warningThreshold:this.config.warningThreshold,weakVertexCount:t.length,topWeakVertices:t.slice(0,5),trend:this.calculateTrend(),history:this.history.slice(-20),lastUpdated:new Date}}getMinCutValue(){return this.calculator.getMinCutValue(this.graph)}getWeakVertices(){return this.calculator.findWeakVertices(this.graph)}isCritical(){return this.calculator.getMinCutValue(this.graph)<this.config.warningThreshold}isHealthy(){return this.calculator.getMinCutValue(this.graph)>=this.config.healthyThreshold}getActiveAlerts(){return Array.from(this.alerts.values()).filter(e=>!e.acknowledged).sort((e,t)=>{let r={critical:0,high:1,medium:2,low:3,info:4};return r[e.severity]-r[t.severity]})}getAllAlerts(){return Array.from(this.alerts.values())}acknowledgeAlert(e){let t=this.alerts.get(e);return t?(t.acknowledged=!0,!0):!1}clearAcknowledgedAlerts(){let e=[];for(let[t,r]of this.alerts)r.acknowledged&&e.push(t);for(let t of e)this.alerts.delete(t);return e.length}getHistory(){return[...this.history]}getTrend(){return this.calculateTrend()}getStats(e=6e4){let t=Date.now()-e,r=this.history.filter(n=>n.timestamp.getTime()>t);if(r.length===0){let n=this.calculator.getMinCutValue(this.graph);return{min:n,max:n,average:n,count:0}}let i=r.map(n=>n.value);return{min:Math.min(...i),max:Math.max(...i),average:i.reduce((n,a)=>n+a,0)/i.length,count:r.length}}updateConfig(e){Object.assign(this.config,e),e.checkIntervalMs&&this.isMonitoring&&(this.stop(),this.start())}getConfig(){return{...this.config}}determineStatus(e){return e>=this.config.healthyThreshold?"healthy":e>=this.config.warningThreshold?"warning":"critical"}calculateTrend(){if(this.history.length<3)return"stable";let e=this.history.slice(-5),t=e[0].value,i=e[e.length-1].value-t,a=e.reduce((o,c)=>o+c.value,0)/e.length*.1;return i>a?"improving":i<-a?"degrading":"stable"}recordHistory(e){let t={timestamp:new Date,value:e,vertexCount:this.graph.vertexCount,edgeCount:this.graph.edgeCount};for(this.history.push(t);this.history.length>this.config.maxHistoryEntries;)this.history.shift()}checkAlertConditions(e,t,r){if(!this.config.alertsEnabled)return;let i=Date.now();r==="critical"?this.maybeGenerateAlert("critical-threshold","critical",`MinCut value (${e.toFixed(2)}) is below critical threshold (${this.config.warningThreshold})`,e,this.config.warningThreshold,t):r==="warning"&&this.maybeGenerateAlert("warning-threshold","high",`MinCut value (${e.toFixed(2)}) is below healthy threshold (${this.config.healthyThreshold})`,e,this.config.healthyThreshold,t);let n=t.filter(o=>o.weightedDegree===0);n.length>0&&this.maybeGenerateAlert("isolated-vertices","high",`${n.length} isolated vertex(es) detected`,e,0,n);let a=t.filter(o=>o.riskScore>.8);a.length>0&&this.maybeGenerateAlert("critical-vertices","medium",`${a.length} critical vertex(es) with high risk score`,e,0,a)}maybeGenerateAlert(e,t,r,i,n,a){let o=Date.now(),c=this.lastAlertTime.get(e)||0;if(o-c<this.config.alertCooldownMs)return;let s={id:h(),severity:t,message:r,minCutValue:i,threshold:n,affectedVertices:a.map(l=>l.vertexId),timestamp:new Date,acknowledged:!1,remediations:a.flatMap(l=>l.suggestions).slice(0,5)};this.alerts.set(s.id,s),this.persistence&&this.persistence.saveAlert(s).catch(l=>console.warn("[MinCutHealthMonitor] Failed to persist alert:",l)),this.lastAlertTime.set(e,o),this.emitEvent("mincut.alert.generated",i,{alert:s})}emitEvent(e,t,r){if(!this.eventBus)return;let i={id:h(),type:e,source:"coordination",timestamp:new Date,correlationId:h(),payload:{minCutValue:t,...r}};this.eventBus.publish(i).catch(n=>{console.error("Failed to publish MinCut event:",n)})}};function v(m,e,t,r){return new g(m,e,t,r)}var d=null,u=null;function C(){return d||(d=y()),d}function P(){return u||(u=v(C())),u}function B(){return d!==null}function F(){return u!==null}export{f as a,v as b,C as c,P as d,B as e,F as f};
|
|
@@ -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.11");process.exit(0)}
|
|
2
2
|
var h=class{executionHistory=[];learnedDurations=new Map;runCount=0;lastPrunedCount=0;learningRate;maxHistorySize;constructor(t){this.learningRate=t?.learningRate??.3,this.maxHistorySize=t?.maxHistorySize??1e4}buildTestDAG(t){let e=new Map,n=new Map;for(let i of t){let s=this.applyLearnedDuration(i);e.set(s.id,s),n.set(s.id,[])}for(let i of t)for(let s of i.dependencies){if(!e.has(s))throw new Error(`Test '${i.id}' depends on '${s}' which does not exist in the test set`);n.get(s).push(i.id)}let o=this.computeCriticalPath(e,n),a=this.computeParallelGroups(e,n);return{nodes:e,edges:n,criticalPath:o,parallelGroups:a}}findCriticalPath(t){return t.criticalPath.map(e=>t.nodes.get(e)).filter(e=>e!==void 0)}findParallelBranches(t){return t.parallelGroups.map(e=>e.map(n=>t.nodes.get(n)).filter(n=>n!==void 0))}pruneByMinCut(t,e){let n=this.sumDurations(t.nodes);if(n<=e)return this.lastPrunedCount=0,t;let o=this.computeAttentionScores(t),a=Array.from(o.entries()).sort((r,l)=>r[1]-l[1]),i=new Set(t.criticalPath),s=new Set,c=n;for(let[r]of a){if(c<=e)break;if(i.has(r)||(t.edges.get(r)??[]).some(p=>!s.has(p)))continue;let d=t.nodes.get(r);d&&(s.add(r),c-=d.estimatedDuration)}this.lastPrunedCount=s.size;let u=Array.from(t.nodes.values()).filter(r=>!s.has(r.id));return this.buildTestDAG(u)}schedule(t){if(t.length===0)return{phases:[],totalEstimatedTime:0,criticalPathTime:0,parallelism:0};let e=this.buildTestDAG(t),o=this.findParallelBranches(e).map(u=>({tests:u,canRunInParallel:u.length>1})),a=this.computeCriticalPathDuration(e),i=this.sumDurations(e.nodes),s=o.reduce((u,r)=>r.canRunInParallel?u+Math.max(...r.tests.map(l=>l.estimatedDuration)):u+r.tests.reduce((l,d)=>l+d.estimatedDuration,0),0),c=s>0?i/s:1;return this.runCount++,{phases:o,totalEstimatedTime:s,criticalPathTime:a,parallelism:c}}getOptimizationStats(){return{totalTests:0,criticalPathLength:0,parallelGroupCount:0,prunedTests:this.lastPrunedCount,estimatedTimeSaved:0,historicalRuns:this.runCount,usingNativeBackend:!1}}recordExecution(t,e,n){this.executionHistory.push({testId:t,actualDuration:e,result:n,timestamp:Date.now()}),this.executionHistory.length>this.maxHistorySize&&(this.executionHistory=this.executionHistory.slice(-this.maxHistorySize));let o=this.learnedDurations.get(t);o!==void 0?this.learnedDurations.set(t,o*(1-this.learningRate)+e*this.learningRate):this.learnedDurations.set(t,e)}getLearnedDuration(t){return this.learnedDurations.get(t)}isNativeBackendAvailable(){return!1}computeCriticalPath(t,e){let n=this.topologicalSort(t,e);if(n.length===0)return[];let o=new Map,a=new Map;for(let r of n)o.set(r,t.get(r).estimatedDuration),a.set(r,null);for(let r of n){let l=o.get(r);for(let d of e.get(r)??[]){let p=t.get(d);if(!p)continue;let g=l+p.estimatedDuration;g>(o.get(d)??0)&&(o.set(d,g),a.set(d,r))}}let i=0,s=null;for(let[r,l]of o)l>i&&(i=l,s=r);if(!s)return[];let c=[],u=s;for(;u!==null;)c.unshift(u),u=a.get(u)??null;return c}computeCriticalPathDuration(t){return t.criticalPath.reduce((e,n)=>e+(t.nodes.get(n)?.estimatedDuration??0),0)}computeParallelGroups(t,e){let n=this.topologicalSort(t,e);if(n.length===0)return[];let o=new Map;for(let[u,r]of t)o.set(u,new Set(r.dependencies));let a=new Map;for(let u of n){let r=-1;for(let l of o.get(u)??new Set){let d=a.get(l);d!==void 0&&d>r&&(r=d)}a.set(u,r+1)}let i=new Map;for(let u of n){let r=a.get(u)??0;i.has(r)||i.set(r,[]),i.get(r).push(u)}let s=Math.max(...Array.from(i.keys()),-1),c=[];for(let u=0;u<=s;u++){let r=i.get(u);r&&r.length>0&&c.push(r)}return c}computeAttentionScores(t){let e=new Map,n=this.countTransitiveDependents(t);for(let[o,a]of t.nodes){let i=a.lastResult==="fail"?2:1,s=n.get(o)??0;e.set(o,a.priority*i*(1+s))}return e}countTransitiveDependents(t){let e=new Map,n=new Map,o=a=>{if(n.has(a))return n.get(a);let i=new Set;for(let s of t.edges.get(a)??[]){i.add(s);for(let c of o(s))i.add(c)}return n.set(a,i),i};for(let a of t.nodes.keys())e.set(a,o(a).size);return e}topologicalSort(t,e){let n=new Map;for(let i of t.keys())n.set(i,0);for(let i of e.values())for(let s of i)n.has(s)&&n.set(s,(n.get(s)??0)+1);let o=[];for(let[i,s]of n)s===0&&o.push(i);let a=[];for(;o.length>0;){let i=o.shift();a.push(i);for(let s of e.get(i)??[]){let c=(n.get(s)??0)-1;n.set(s,c),c===0&&o.push(s)}}if(a.length!==t.size)throw new Error(`Cycle detected in test DAG: sorted ${a.length} of ${t.size} nodes`);return a}applyLearnedDuration(t){let e=this.learnedDurations.get(t.id);return e!==void 0?{...t,estimatedDuration:Math.round(e)}:t}sumDurations(t){let e=0;for(let n of t.values())e+=n.estimatedDuration;return e}};function m(f){return new h(f)}export{h as a,m as b};
|
|
@@ -1,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 L,d as B}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.11");process.exit(0)}
|
|
2
|
+
import{b as L,d as B}from"./chunk-EH2S6AOR.js";import*as a from"fs";import*as v from"path";import{createRequire as K}from"node:module";var Z=K(import.meta.url),b=Z("semver"),F="3.15.11",y=t=>typeof t=="string"&&b.valid(t)===t.split("+")[0],E=t=>b.validRange(t)!==null,x=(t,e)=>b.satisfies(t,e),C=(t,e)=>b.compare(t,e),N=(t,e)=>C(e,t)||t.localeCompare(e);B();var R=class{cacheDir;keepVersions;constructor(e={}){this.cacheDir=e.cacheDir??L("plugins"),this.keepVersions=e.keepVersions??2}has(e,n){let s=this.versionDir(e,n);return a.existsSync(s)&&a.existsSync(v.join(s,"qe-plugin.json"))}get(e,n){if(!this.has(e,n))return;let s=this.versionDir(e,n),i=a.readFileSync(v.join(s,"qe-plugin.json"),"utf-8"),r=JSON.parse(i),l=a.statSync(s);return{manifest:r,path:s,cachedAt:l.birthtime.toISOString()}}store(e,n){let s=this.versionDir(e.name,e.version);if(a.existsSync(s))return s;a.mkdirSync(s,{recursive:!0});try{this.copyDir(n,s),a.writeFileSync(v.join(s,"qe-plugin.json"),JSON.stringify(e,null,2))}catch(i){throw a.rmSync(s,{recursive:!0,force:!0}),i}return this.pruneOldVersions(e.name),s}remove(e,n){let s=this.versionDir(e,n);return a.existsSync(s)?(a.rmSync(s,{recursive:!0,force:!0}),!0):!1}listVersions(e){let n=v.join(this.cacheDir,e);if(!a.existsSync(n))return[];let s=[],i=a.readdirSync(n);for(let r of i){let l=v.join(n,r),d=v.join(l,"qe-plugin.json");if(a.existsSync(d))try{let p=a.readFileSync(d,"utf-8"),m=JSON.parse(p);if(!y(m.version)){console.warn(`[PluginCache] Skipping cached plugin ${e}@${r}: invalid version ${JSON.stringify(m.version)}`);continue}let c=a.statSync(l);s.push({manifest:m,path:l,cachedAt:c.birthtime.toISOString()})}catch{}}return s}listAll(){if(!a.existsSync(this.cacheDir))return[];let e=[],n=a.readdirSync(this.cacheDir);for(let s of n){let i=this.listVersions(s);i.length>0&&(i.sort((r,l)=>N(r.manifest.version,l.manifest.version)),e.push(i[0]))}return e}listCandidates(){return a.existsSync(this.cacheDir)?a.readdirSync(this.cacheDir).flatMap(e=>this.listVersions(e)):[]}versionDir(e,n){return v.join(this.cacheDir,e,n)}pruneOldVersions(e){let n=this.listVersions(e);if(n.length<=this.keepVersions)return;n.sort((i,r)=>i.cachedAt.localeCompare(r.cachedAt));let s=n.slice(0,n.length-this.keepVersions);for(let i of s)a.rmSync(i.path,{recursive:!0,force:!0})}copyDir(e,n){if(!a.existsSync(e))return;let s=a.readdirSync(e,{withFileTypes:!0});for(let i of s){let r=v.join(e,i.name),l=v.join(n,i.name);if(i.isDirectory()){if(i.name===".git"||i.name==="node_modules")continue;a.mkdirSync(l,{recursive:!0}),this.copyDir(r,l)}else a.copyFileSync(r,l)}}};var ee=/^[a-z][a-z0-9-]*$/,se=["aqe-core-","agentic-qe-core-"],G=64,T=500;function k(t){let e=[],n=[];if(!t||typeof t!="object")return{valid:!1,errors:["Manifest must be a non-null object"],warnings:[]};let s=t;if(!s.name||typeof s.name!="string"?e.push("name is required and must be a string"):ne(s.name,e,n),!s.version||typeof s.version!="string"?e.push("version is required and must be a string"):y(s.version)||e.push(`version "${s.version}" is not valid semver (expected: major.minor.patch)`),!s.description||typeof s.description!="string"?e.push("description is required and must be a string"):s.description.length>T&&n.push(`description exceeds ${T} characters`),(!s.author||typeof s.author!="string")&&e.push("author is required and must be a string"),!Array.isArray(s.domains)||s.domains.length===0)e.push("domains is required and must be a non-empty array");else for(let i of s.domains)if(typeof i!="string"){e.push("Each domain must be a string");break}if(!s.entryPoint||typeof s.entryPoint!="string"?e.push("entryPoint is required and must be a string"):te(s.entryPoint,e),s.dependencies!==void 0)if(typeof s.dependencies!="object"||s.dependencies===null||Array.isArray(s.dependencies))e.push("dependencies must be an object mapping plugin names to semver ranges");else for(let[i,r]of Object.entries(s.dependencies))typeof r!="string"?e.push(`Dependency "${i}" must have a string version range`):E(r)||e.push(`Dependency "${i}" has an invalid semver range`);if(s.hooks!==void 0)if(typeof s.hooks!="object"||s.hooks===null||Array.isArray(s.hooks))e.push("hooks must be an object mapping event names to handler paths");else for(let[,i]of Object.entries(s.hooks)){if(typeof i!="string"){e.push("Hook handler paths must be strings");break}i.includes("..")&&e.push(`Hook handler path "${i}" must not contain ".." (path traversal)`)}if(s.minAqeVersion!==void 0&&(typeof s.minAqeVersion!="string"||!y(s.minAqeVersion))&&e.push("minAqeVersion must be valid semver"),s.permissions!==void 0){if(!Array.isArray(s.permissions))e.push("permissions must be an array of strings");else for(let i of s.permissions)if(typeof i!="string"){e.push("Each permission must be a string");break}}return{valid:e.length===0,errors:e,warnings:n}}function U(t){let e=typeof t=="string"?JSON.parse(t):t,n=k(e);if(!n.valid)throw new Error(`Invalid plugin manifest:
|
|
3
3
|
- ${n.errors.join(`
|
|
4
4
|
- `)}`);return e}function ne(t,e,n){t.length>G&&e.push(`name must be ${G} characters or fewer`),ee.test(t)||e.push("name must be lowercase alphanumeric with hyphens, starting with a letter"),/[^\x00-\x7F]/.test(t)&&e.push("name must contain only ASCII characters");for(let s of se)t.startsWith(s)&&e.push(`name cannot start with reserved prefix "${s}"`);["plugin","test","tool"].includes(t)&&n.push(`name "${t}" is very generic \u2014 consider a more descriptive name`)}function te(t,e){t.includes("..")&&e.push('entryPoint must not contain ".." (path traversal)'),(t.startsWith("/")||t.startsWith("\\"))&&e.push("entryPoint must be a relative path"),!t.endsWith(".js")&&!t.endsWith(".ts")&&!t.endsWith(".mjs")&&e.push("entryPoint must end in .js, .ts, or .mjs")}var I=class{constructor(e=F){this.aqeVersion=e}aqeVersion;resolve(e,n){let s=new Map,i=new Map;for(let o of e){let u=s.get(o.name)??[];s.set(o.name,u);let f=this.validateVersions(o);f?i.set(o.name,[...i.get(o.name)??[],f]):u.push(o)}for(let o of s.values())o.sort((u,f)=>N(u.version,f.version));let r=new Map,l=[],d=o=>({ordered:o.map((u,f)=>({manifest:u,order:f})),missing:r,errors:l,selectedVersions:Object.fromEntries(o.map(u=>[u.name,u.version])),aqeVersion:this.aqeVersion}),p=[...n??s.keys()].sort(),m=new Set(p),c=new Map,_=0,h=!1,X=()=>{for(let o of c.values())for(let[u,f]of Object.entries(o.dependencies??{})){let g=c.get(u);if(!(g?[g]:s.get(u)??[]).some(M=>x(M.version,f)))return!1}return!0},A,z=()=>{let o=new Set,u=new Set,f=(g,P)=>{if(u.has(g))return[...P.slice(P.indexOf(g)),g];if(!o.has(g)){u.add(g);for(let M of Object.keys(c.get(g)?.dependencies??{})){let Q=f(M,[...P,g]);if(Q)return Q}u.delete(g),o.add(g)}};for(let g of c.keys()){let P=f(g,[]);if(P)return P}},j=()=>{let o=new Set(p);for(let f of c.values())for(let g of Object.keys(f.dependencies??{}))o.add(g);let u=[...o].sort().find(f=>!c.has(f));if(!u){let f=z();return f?(A=f,!1):!0}m.add(u);for(let f of s.get(u)??[]){if(++_>1e4)return h=!0,!1;if(c.set(u,f),X()&&j())return!0;if(c.delete(u),h)return!1}return!1};if(!j()){if(A&&!h)throw new Error(`Dependency cycle detected: ${A.join(" -> ")}`);for(let o of m)s.get(o)?.length||l.push(...i.get(o)??[]);for(let[o,u]of s){let f=[...new Set(u.flatMap(g=>Object.keys(g.dependencies??{})))].filter(g=>!s.has(g));f.length&&r.set(o,f)}return l.push({code:h?"RESOLUTION_LIMIT":r.size?"MISSING_DEPENDENCY":"UNSATISFIED_DEPENDENCY_RANGE",plugin:p.join(", "),message:h?"Plugin dependency search exceeded 10000 candidates":"No cached plugin selection satisfies all dependency ranges"}),d([])}let O=[],q=new Set,w=new Set,$=(o,u)=>{if(q.has(o))return;if(w.has(o))throw new Error(`Dependency cycle detected: ${[...u.slice(u.indexOf(o)),o].join(" -> ")}`);w.add(o);let f=c.get(o);for(let g of Object.keys(f.dependencies??{}))$(g,[...u,o]);w.delete(o),q.add(o),O.push(f)};for(let o of[...c.keys()].sort())$(o,[]);return d(O)}resolveAvailable(e){let n=[],s=this.resolve(e,[]),i=[],r=new Map;for(let l of[...new Set(e.map(d=>d.name))].sort())try{let d=this.resolve(e,[...n,l]);if(d.errors.length){i.push(...d.errors.map(p=>({...p,plugin:l})));for(let[p,m]of d.missing)r.set(p,m);continue}n.push(l),s=d}catch(d){i.push({code:"DEPENDENCY_CYCLE",plugin:l,message:d instanceof Error?d.message:String(d)})}return{...s,errors:i,missing:r}}canLoad(e,n){let s=Object.entries(e.dependencies??{}).filter(([i,r])=>{let l=n instanceof Set?void 0:n.get(i);return!l||!E(r)||!x(l,r)}).map(([i])=>i);return{canLoad:!this.validateVersions(e)&&s.length===0,missingDeps:s}}validateVersions(e){if(!y(e.version))return{code:"INVALID_PLUGIN_VERSION",plugin:e.name,message:"Invalid plugin version"};for(let n of Object.values(e.dependencies??{}))if(!E(n))return{code:"INVALID_DEPENDENCY_RANGE",plugin:e.name,message:"Invalid dependency range"};if(e.minAqeVersion&&(!y(e.minAqeVersion)||!y(this.aqeVersion)||C(this.aqeVersion,e.minAqeVersion)<0))return{code:"AQE_VERSION_INCOMPATIBLE",plugin:e.name,message:`Requires AQE ${e.minAqeVersion}; running ${this.aqeVersion}`}}};var ie=["aqe-core-","agentic-qe-core-","agentic-qe-internal-"],Y=new Set(["aqe","agentic-qe","ruflo","claude-flow"]),re=["..","~","/etc/","/proc/","/dev/","node_modules/"];function W(t){let e=[];return oe(t.name,e),ae(t.entryPoint,e),ce(t.hooks,e),ue(t.permissions,e),{safe:e.length===0,violations:e}}function oe(t,e){/[^\x20-\x7E]/.test(t)&&e.push(`Plugin name "${t}" contains non-ASCII characters`),Y.has(t.toLowerCase())&&e.push(`Plugin name "${t}" is a reserved name`);for(let s of ie)t.toLowerCase().startsWith(s)&&e.push(`Plugin name "${t}" uses reserved prefix "${s}"`);let n=t.toLowerCase().replace(/[0o]/g,"o").replace(/[1il]/g,"l").replace(/[-_]/g,"");Y.has(n)&&e.push(`Plugin name "${t}" is visually similar to a reserved name`)}function ae(t,e){H(t,"entryPoint",e),(t.startsWith("/")||t.startsWith("\\"))&&e.push("entryPoint must be a relative path, not absolute")}function ce(t,e){if(t)for(let[n,s]of Object.entries(t))H(s,`hook[${n}]`,e)}function H(t,e,n){for(let s of re)t.includes(s)&&n.push(`${e} contains dangerous path pattern "${s}"`);t.includes("\0")&&n.push(`${e} contains null byte (path injection attempt)`)}function ue(t,e){if(!t)return;let n=["fs:write-root","net:arbitrary","exec:shell"];for(let s of t)n.includes(s)&&e.push(`Plugin requests dangerous permission: ${s}`)}import*as S from"fs";import*as V from"path";var D=class{type="local";async resolve(e){let n=V.resolve(e),s=V.join(n,"qe-plugin.json");if(!S.existsSync(s))throw new Error(`No qe-plugin.json found at ${s}`);let i=S.readFileSync(s,"utf-8");return U(i)}async getPluginPath(e){let n=V.resolve(e);if(!S.existsSync(n))throw new Error(`Plugin directory does not exist: ${n}`);return n}};var J=class{cache;resolver;sources=new Map;constructor(e={}){this.cache=e.cache??new R,this.resolver=new I;let n=new D;if(this.sources.set("local",n),e.sources)for(let s of e.sources)this.sources.set(s.type,s)}async install(e,n="local"){if(process.env.AQE_PLUGINS_DISABLED==="true")return{success:!1,errors:["Plugin loading is disabled (AQE_PLUGINS_DISABLED=true)"],securityViolations:[]};let s=[],i=this.sources.get(n);if(!i)return{success:!1,errors:[`Unknown source type: ${n}. Available: ${[...this.sources.keys()].join(", ")}`],securityViolations:[]};let r;try{r=await i.resolve(e)}catch(c){return{success:!1,errors:[`Failed to resolve plugin: ${c instanceof Error?c.message:String(c)}`],securityViolations:[]}}let l=k(r);if(!l.valid)return{success:!1,manifest:r,errors:l.errors,securityViolations:[]};let d=W(r);if(!d.safe)return{success:!1,manifest:r,errors:["Plugin failed security checks"],securityViolations:d.violations};try{let c=this.cache.listCandidates().map(h=>h.manifest).filter(h=>h.name!==r.name),_=this.resolver.resolve([...c,r],[r.name]);if(_.errors.length)return{success:!1,manifest:r,errors:_.errors.map(h=>`${h.code}: ${h.message}`),securityViolations:[]}}catch(c){return{success:!1,manifest:r,errors:[c instanceof Error?c.message:String(c)],securityViolations:[]}}if(this.cache.has(r.name,r.version)){let c=this.cache.get(r.name,r.version);return{success:!0,manifest:r,cachePath:c.path,errors:[],securityViolations:[]}}let p;try{p=await i.getPluginPath(e)}catch(c){return{success:!1,manifest:r,errors:[`Failed to get plugin path: ${c instanceof Error?c.message:String(c)}`],securityViolations:[]}}let m=this.cache.store(r,p);return{success:!0,manifest:r,cachePath:m,errors:s,securityViolations:[]}}remove(e,n){if(n)return this.cache.remove(e,n);let s=this.cache.listVersions(e),i=!1;for(let r of s)this.cache.remove(e,r.manifest.version)&&(i=!0);return i}list(){return this.cache.listAll().map(n=>({name:n.manifest.name,version:n.manifest.version,description:n.manifest.description,domains:n.manifest.domains,source:"cached",cachePath:n.path}))}resolveLoadOrder(){let e=this.cache.listCandidates();return this.resolver.resolveAvailable(e.map(n=>n.manifest))}registerSource(e){this.sources.set(e.type,e)}};export{U as a,R as b,J as c};
|
|
@@ -0,0 +1,7 @@
|
|
|
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.11");process.exit(0)}
|
|
2
|
+
import{a as u,e as I}from"./chunk-DDEOZPWJ.js";import{a as p,q as D}from"./chunk-XJKZ7FTR.js";import{b as E}from"./chunk-CFWGGRE7.js";import{existsSync as l,renameSync as m,copyFileSync as O,readdirSync as F,statSync as N,openSync as j,readSync as B,closeSync as U,writeFileSync as C,rmSync as S}from"node:fs";import{join as _,dirname as Q}from"node:path";function $(e){if(!l(e))return!0;let t;try{t=N(e).size}catch{return!1}if(t===0)return!0;if(t<g.length)return!1;let n;try{n=j(e,"r");let r=Buffer.alloc(g.length);return B(n,r,0,g.length,0),r.equals(g)}catch{return!1}finally{if(n!==void 0)try{U(n)}catch{}}}function W(e){let t;try{return t=new p(e,{readonly:!0,fileMustExist:!0}),t.pragma("integrity_check",{simple:!0})==="ok"}catch{return!1}finally{try{t?.close()}catch{}}}function q(e){return _(Q(e),"backups","verified")}function G(e){if(!l(e))return null;let t=F(e).filter(n=>n.startsWith("memory-")&&n.endsWith(".db")).map(n=>{let r=_(e,n);return{path:r,mtime:N(r).mtimeMs}}).sort((n,r)=>r.mtime-n.mtime);for(let n of t)if(W(n.path))return n.path;return null}function v(e,t){if($(e))return{restored:!1,reason:"healthy"};let n=t?.backupDir??q(e),r=G(n);if(!r)return{restored:!1,reason:"no-verified-backup"};let o=`${e}.restore.lock`;try{C(o,String(process.pid),{flag:"wx"})}catch{return{restored:!1,reason:"restore-in-progress"}}try{if($(e))return{restored:!1,reason:"healthy"};let f=t?.now??Date.now(),a=`${e}.corrupt-${f}`;try{l(e)&&m(e,a);for(let i of["-wal","-shm"])l(e+i)&&m(e+i,a+i)}catch{return{restored:!1,reason:"park-failed"}}let c=`${e}.restoring-${f}`;try{O(r,c),m(c,e)}catch{try{l(c)&&S(c,{force:!0}),!l(e)&&l(a)&&m(a,e)}catch{}return{restored:!1,reason:"copy-failed"}}return{restored:!0,reason:"restored-from-backup",backupUsed:r,parkedTo:a}}finally{try{S(o,{force:!0})}catch{}}}var g,R=E(()=>{"use strict";D();g=Buffer.concat([Buffer.from("SQLite format 3","latin1"),Buffer.from([0])])});function H(e){let t=[],n=e;for(let r=0;n!=null&&r<5;r++){t.push(u(n));let o=n.code;typeof o=="string"&&t.push(o),n=n.cause}return t.join(`
|
|
3
|
+
`)}function Y(e){let t=e.split(`
|
|
4
|
+
`)[0].trim();return t.endsWith("Tried:")?t.slice(0,-6).trimEnd():t}function A(e,t="better-sqlite3"){if(e==null)return null;let n=H(e),r=Y(u(e));return K.some(o=>o.test(n))?{moduleName:t,reason:"missing-binding",detail:r}:V.some(o=>o.test(n))?{moduleName:t,reason:"abi-mismatch",detail:r}:z.some(o=>o.test(n))?{moduleName:t,reason:"load-failed",detail:r}:null}function Z(e){let{moduleName:t}=e;return[`${t} ${h}: ${X[e.reason]}`," Fix a global install (reinstall, naming the package):",` npm install -g agentic-qe --allow-scripts=${J}`," Or rebuild just the native module in an existing global install:",` npm rebuild -g ${t} --allow-scripts=${t}`," For a project-local install (devDependency), run in the project:",` npm install-scripts approve ${t} && npm rebuild ${t}`,` Original error: ${e.detail}`].join(`
|
|
5
|
+
`)}function M(e,t="better-sqlite3"){if(e instanceof d||u(e).includes(h))return e;let n=A(e,t);return n?new d(n,e):e}function se(e){return e instanceof d||u(e).includes(h)||A(e)!==null}var h,J,K,V,z,X,d,x=E(()=>{"use strict";I();h="native module could not be loaded",J="agentic-qe,better-sqlite3,hnswlib-node",K=[/Could not locate the bindings file/i],V=[/NODE_MODULE_VERSION/,/compiled against a different Node\.js version/i,/Module did not self-register/i],z=[/ERR_DLOPEN_FAILED/,/invalid ELF header/i,/wrong ELF class/i,/incompatible architecture/i,/mach-o file, but is an incompatible architecture/i,/\.node: cannot open shared object file/i,/is not a valid Win32 application/i];X={"missing-binding":"its compiled binary is missing. Its install script never ran \u2014 npm 12+ blocks dependency install scripts unless they are allowed (allowScripts).","abi-mismatch":`it was built for a different Node.js version than the one running now (${process.version}). Rebuild it after switching Node versions.`,"load-failed":"the binary exists but the OS refused to load it (wrong platform/architecture or a corrupt build)."};d=class extends Error{moduleName;reason;constructor(t,n){super(Z(t),{cause:n}),this.name="NativeModuleLoadError",this.moduleName=t.moduleName,this.reason=t.reason}}});import{basename as P}from"node:path";function fe(e,t){let n=t?.readonly??!1,r=t?.fileMustExist??!1,o=t?.busyTimeout??5e3,f=t?.walMode??!n;if(t?.autoRestore&&!n){let s=v(e,{backupDir:t.backupDir});s.restored?console.warn(`[safe-db] memory DB at ${e} was malformed; auto-restored from ${s.backupUsed}. Corrupt original parked at ${s.parkedTo}.`):s.reason==="no-verified-backup"&&console.error(`[safe-db] memory DB at ${e} appears malformed and NO verified backup was found to restore from. Leaving it in place for manual inspection.`)}let a=(process.env.AQE_JOURNAL_MODE??"").trim().toUpperCase(),c=process.env.AQE_DISABLE_WAL==="1"||a==="DELETE"||a==="TRUNCATE",i;try{i=new p(e,{readonly:n,fileMustExist:r})}catch(s){throw M(s)}if(i.pragma(`busy_timeout = ${o}`),c){if(!n){let s=(a||"DELETE").toUpperCase(),y=String(i.pragma("journal_mode",{simple:!0})??"").toUpperCase();if(y!==s){try{i.pragma(`journal_mode = ${s}`)}catch(b){let k=b?.code;if(i.close(),k!=="SQLITE_BUSY"&&k!=="SQLITE_LOCKED")throw b;let T=P(e),L=process.env.AQE_DISABLE_WAL==="1"?"AQE_DISABLE_WAL=1":`AQE_JOURNAL_MODE=${a}`;throw new Error(`[safe-db] cannot switch ${e} from '${y}' to '${s}' \u2014 another process holds the database open. ${L} declares WAL unsafe on this filesystem, so writing in '${y}' is NOT safe and this open is refused. Find the holder with:
|
|
6
|
+
for p in /proc/[0-9]*; do for f in $p/fd/*; do readlink "$f" 2>/dev/null | grep -q ${JSON.stringify(T)} && echo "$(basename $p) $(tr '\\0' ' ' < $p/cmdline)"; done; done | sort -u
|
|
7
|
+
then stop it and retry. Original error: ${b.message}`)}let w=String(i.pragma("journal_mode",{simple:!0})??"").toUpperCase();if(w!==s)throw i.close(),new Error(`[safe-db] journal_mode switch to '${s}' silently did not take on ${e} (still '${w}'). Refusing to write in an unsafe mode.`)}}}else f&&i.pragma("journal_mode = WAL");return i}var ee=E(()=>{D();R();x()});export{M as a,se as b,x as c,fe as d,ee as e};
|