agentic-qe 3.9.30 → 3.9.32
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 +208 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/bridge/captured-experience-bridge.js +31 -2
- package/dist/cli/bundle.js +5 -5
- package/dist/cli/chunks/adapter-CDQOF5TF.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-TOSXWTUQ.js → agent-booster-wasm-WKS3E6KT.js} +2 -2
- package/dist/cli/chunks/{agent-handler-2BU6TYZZ.js → agent-handler-LYCAWE7S.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-JFG3BXZY.js → agent-memory-branch-XF7IOMRK.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-RZK22CJB.js +2 -0
- package/dist/cli/chunks/{audit-4IGZZKUW.js → audit-D2AY3HFP.js} +2 -2
- package/dist/cli/chunks/base-UGH6TVO4.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-STKRZIU3.js → better-sqlite3-K2VWFDKT.js} +2 -2
- package/dist/cli/chunks/{brain-handler-RIDW27HH.js → brain-handler-NNW4TAO2.js} +4 -4
- package/dist/cli/chunks/{branch-enumerator-GMYHLLWD.js → branch-enumerator-OM5HNZKV.js} +2 -2
- package/dist/cli/chunks/{browser-N76A3I2P.js → browser-Y2FU2NV4.js} +2 -2
- package/dist/cli/chunks/browser-workflow-SGOL3FCJ.js +2 -0
- package/dist/cli/chunks/{chunk-ETEHVG76.js → chunk-2L5GAOST.js} +2 -2
- package/dist/cli/chunks/{chunk-ECX6VXMW.js → chunk-2XC4XVCI.js} +1 -1
- package/dist/cli/chunks/{chunk-L7X3A36M.js → chunk-2Z2IQBIJ.js} +1 -1
- package/dist/cli/chunks/{chunk-UYLHIGNC.js → chunk-33PGBYTC.js} +2 -2
- package/dist/cli/chunks/{chunk-OOFWYDG6.js → chunk-3MHWBCSC.js} +1 -1
- package/dist/cli/chunks/{chunk-FI4HRS2G.js → chunk-3R4CMTWF.js} +2 -2
- package/dist/cli/chunks/{chunk-IP6ZTXNJ.js → chunk-45N22VAB.js} +2 -2
- package/dist/cli/chunks/{chunk-FG5GL26L.js → chunk-4H4PEZUX.js} +2 -2
- package/dist/cli/chunks/{chunk-CNNVL5W4.js → chunk-4VAZSCTZ.js} +2 -2
- package/dist/cli/chunks/{chunk-AWWD3EI3.js → chunk-5A6LBGRU.js} +2 -2
- package/dist/cli/chunks/{chunk-ER6BT4GS.js → chunk-5DSANX6S.js} +2 -2
- package/dist/cli/chunks/chunk-5R5WOLZM.js +5 -0
- package/dist/cli/chunks/{chunk-RNO6CE7I.js → chunk-5WR42V5O.js} +2 -2
- package/dist/cli/chunks/{chunk-UEXOMDRS.js → chunk-5XY6SULI.js} +2 -2
- package/dist/cli/chunks/{chunk-WVODEWH5.js → chunk-62UXGD5J.js} +14 -8
- package/dist/cli/chunks/{chunk-EWNJ6OAT.js → chunk-667I4RTC.js} +1 -1
- package/dist/cli/chunks/{chunk-ND6VCNN5.js → chunk-6EKXBWJD.js} +2 -2
- package/dist/cli/chunks/{chunk-Y57V4FDT.js → chunk-6R6QCGNU.js} +2 -2
- package/dist/cli/chunks/{chunk-VRP4GB4Y.js → chunk-6SYP7QX6.js} +4 -4
- package/dist/cli/chunks/{chunk-BFJLKG3D.js → chunk-6YGFAJ3X.js} +1 -1
- package/dist/cli/chunks/{chunk-UWWX4RK7.js → chunk-6ZG6TBWF.js} +4 -4
- package/dist/cli/chunks/{chunk-QSV4ROZD.js → chunk-7AISRWBS.js} +2 -2
- package/dist/cli/chunks/{chunk-SJCEPKZO.js → chunk-7IDPVSTF.js} +1 -1
- package/dist/cli/chunks/{chunk-HQIWLMDS.js → chunk-7PTW3M67.js} +2 -2
- package/dist/cli/chunks/{chunk-TA3QYAZ6.js → chunk-A4UNK5SY.js} +2 -2
- package/dist/cli/chunks/chunk-A6VI5BZU.js +95 -0
- package/dist/cli/chunks/{chunk-XVTZXCHI.js → chunk-BBPOTFIY.js} +2 -2
- package/dist/cli/chunks/{chunk-OEGFOMXP.js → chunk-BDXEL3GM.js} +2 -2
- package/dist/cli/chunks/{chunk-YETPSL6H.js → chunk-BGRC4676.js} +3 -3
- package/dist/cli/chunks/chunk-BQML7B4W.js +180 -0
- package/dist/cli/chunks/{chunk-DEDFPHJL.js → chunk-BV3SGEV7.js} +1 -1
- package/dist/cli/chunks/{chunk-FGMHVSLV.js → chunk-DBE2LIYG.js} +2 -2
- package/dist/cli/chunks/{chunk-2GBBZLXT.js → chunk-DFY7F4TE.js} +1 -1
- package/dist/cli/chunks/{chunk-LDGNVPBZ.js → chunk-EFEJLZDN.js} +1 -1
- package/dist/cli/chunks/{chunk-ZKZTSYPU.js → chunk-ESNBKAT6.js} +2 -2
- package/dist/cli/chunks/{chunk-5F26LSG2.js → chunk-EVSUZKD5.js} +2 -2
- package/dist/cli/chunks/{chunk-QOJ7EAF5.js → chunk-FFBF5BLQ.js} +1 -1
- package/dist/cli/chunks/{chunk-3AICELMQ.js → chunk-FIONYUVH.js} +2 -2
- package/dist/cli/chunks/{chunk-UROPIIB2.js → chunk-FNQCWEVJ.js} +2 -2
- package/dist/cli/chunks/{chunk-5DJAJPBG.js → chunk-FV2MU6CY.js} +2 -2
- package/dist/cli/chunks/{chunk-QTS2DS42.js → chunk-FWEYOD3S.js} +2 -2
- package/dist/cli/chunks/{chunk-XK6YXCS7.js → chunk-G6AJMFWL.js} +3 -3
- package/dist/cli/chunks/{chunk-R57J3O6I.js → chunk-G6VVOUUF.js} +2 -2
- package/dist/cli/chunks/{chunk-2O5TT3UT.js → chunk-G77CYF7H.js} +3 -3
- package/dist/cli/chunks/{chunk-TULNR2AH.js → chunk-H7YKTJMY.js} +2 -2
- package/dist/cli/chunks/{chunk-GEXVUFK4.js → chunk-HGWQC7PR.js} +2 -2
- package/dist/cli/chunks/{chunk-QLNS6DGB.js → chunk-HHBFI3YA.js} +2 -2
- package/dist/cli/chunks/{chunk-WP6X67YI.js → chunk-HPQZSXED.js} +1 -1
- package/dist/cli/chunks/{chunk-HA7N45KB.js → chunk-HR6NX6DW.js} +2 -2
- package/dist/cli/chunks/{chunk-HB52S6IV.js → chunk-I6Q6BPVH.js} +1 -1
- package/dist/cli/chunks/{chunk-BM73MJLE.js → chunk-IGEZVFOM.js} +2 -2
- package/dist/cli/chunks/{chunk-QBDXUI2H.js → chunk-IGQPGXP7.js} +2 -2
- package/dist/cli/chunks/{chunk-Q26GG6WO.js → chunk-IJQJV7BC.js} +3 -3
- package/dist/cli/chunks/chunk-JDW6GN3A.js +2 -0
- package/dist/cli/chunks/{chunk-GZ3U2QT2.js → chunk-JRYNHFZA.js} +1 -1
- package/dist/cli/chunks/{chunk-MV3NUANS.js → chunk-KHZRNJ3A.js} +1 -1
- package/dist/cli/chunks/chunk-LHDTXTS7.js +2 -0
- package/dist/cli/chunks/{chunk-52TRKIAQ.js → chunk-LI2IOJMM.js} +1 -1
- package/dist/cli/chunks/{heartbeat-scheduler-CNJBAO5C.js → chunk-LR5VW3OS.js} +2 -2
- package/dist/cli/chunks/{chunk-2NFGUFYU.js → chunk-LTSNDM5N.js} +2 -2
- package/dist/cli/chunks/{chunk-3EP2YZSY.js → chunk-M5PYPGBC.js} +2 -2
- package/dist/cli/chunks/{chunk-JCWHX4XV.js → chunk-MEHNT37H.js} +2 -2
- package/dist/cli/chunks/{chunk-QHKK2H4H.js → chunk-MERMCKPG.js} +1 -1
- package/dist/cli/chunks/{chunk-Q53UMLLC.js → chunk-MIHQIAVK.js} +2 -2
- package/dist/cli/chunks/{chunk-VOBNJWZF.js → chunk-MMVSERJQ.js} +2 -2
- package/dist/cli/chunks/{chunk-37I6K7QO.js → chunk-MQQANXFS.js} +2 -2
- package/dist/cli/chunks/{chunk-YKFURJNP.js → chunk-MTOHV22P.js} +1 -1
- package/dist/cli/chunks/{chunk-MOLOWMON.js → chunk-NVZHCAEB.js} +2 -2
- package/dist/cli/chunks/{chunk-YXR5RYRE.js → chunk-NW5FYGDE.js} +2 -2
- package/dist/cli/chunks/{chunk-NMBHF7ZD.js → chunk-NZRJWK5H.js} +61 -121
- package/dist/cli/chunks/chunk-O5NEZCTB.js +2 -0
- package/dist/cli/chunks/{chunk-E7UHOKKL.js → chunk-O5UGJ3OI.js} +2 -2
- package/dist/cli/chunks/{chunk-Q4HJRYQB.js → chunk-OK2TFTXP.js} +2 -2
- package/dist/cli/chunks/{chunk-FGDEM4HU.js → chunk-OKEHGXIS.js} +2 -2
- package/dist/cli/chunks/{chunk-C6TNYLD7.js → chunk-OKRY4LNE.js} +3 -3
- package/dist/cli/chunks/{chunk-3WIU2E2Y.js → chunk-OMOGD2NN.js} +2 -2
- package/dist/cli/chunks/{chunk-DJRWVNHK.js → chunk-ONNTJXU7.js} +2 -2
- package/dist/cli/chunks/chunk-OPOGZAN5.js +14 -0
- package/dist/cli/chunks/{chunk-OTFJCZNY.js → chunk-PG5F2VHA.js} +2 -2
- package/dist/cli/chunks/{chunk-MYF7F3ZP.js → chunk-PHRMWRXA.js} +2 -2
- package/dist/cli/chunks/{chunk-7D2DM23U.js → chunk-PIXUX2NR.js} +2 -2
- package/dist/cli/chunks/{chunk-IWC6GR24.js → chunk-PLGMPG7S.js} +2 -2
- package/dist/cli/chunks/{chunk-T2DIMSQF.js → chunk-PPS6VN24.js} +1 -1
- package/dist/cli/chunks/{chunk-AUNNGKLN.js → chunk-PQAYCK2U.js} +2 -2
- package/dist/cli/chunks/{chunk-FU74OETU.js → chunk-PS6ISBED.js} +2 -2
- package/dist/cli/chunks/{chunk-JNRRDG7O.js → chunk-QPYNQSWD.js} +2 -2
- package/dist/cli/chunks/{chunk-MHPK4ZPK.js → chunk-QRTZ67BC.js} +2 -2
- package/dist/cli/chunks/{chunk-Z3TXQOS7.js → chunk-REW3W3ZW.js} +1 -1
- package/dist/cli/chunks/{chunk-3PZDXE5E.js → chunk-RHXYZ6AZ.js} +127 -127
- package/dist/cli/chunks/{chunk-IEGAEXQX.js → chunk-RZXAXWBD.js} +2 -2
- package/dist/cli/chunks/{chunk-4UZQSPR4.js → chunk-S4M7U6CZ.js} +2 -2
- package/dist/cli/chunks/{chunk-H27XUYWZ.js → chunk-SJETAUZA.js} +1 -1
- package/dist/cli/chunks/{chunk-MZ7M2CDV.js → chunk-SLH7LFVY.js} +2 -2
- package/dist/cli/chunks/{chunk-6EP3GHED.js → chunk-SRJ5N7LD.js} +2 -2
- package/dist/cli/chunks/{chunk-XDYTQPJM.js → chunk-T5ADVYPH.js} +1 -1
- package/dist/cli/chunks/{chunk-TYZGEVP6.js → chunk-THYGFSTA.js} +12 -6
- package/dist/cli/chunks/{chunk-XKH4E2IQ.js → chunk-TX2DBLTL.js} +1 -1
- package/dist/cli/chunks/{chunk-HJDHQBMJ.js → chunk-UJMGNO6L.js} +1 -1
- package/dist/cli/chunks/{chunk-MCXRS2TZ.js → chunk-UUQ3SOKM.js} +1 -1
- package/dist/cli/chunks/{chunk-USN2JKUW.js → chunk-V5RLGPEW.js} +2 -2
- package/dist/cli/chunks/chunk-V6HM2BKJ.js +2 -0
- package/dist/cli/chunks/{chunk-R5IW5ARI.js → chunk-V7I6FTLG.js} +1 -1
- package/dist/cli/chunks/{chunk-2MKSEL6F.js → chunk-V7ZBPSVG.js} +1 -1
- package/dist/cli/chunks/{chunk-IOINZWNA.js → chunk-VJL7DNUU.js} +29 -17
- package/dist/cli/chunks/{chunk-JCDEMPJS.js → chunk-VKCWWR6C.js} +1 -1
- package/dist/cli/chunks/chunk-VKNCMGOJ.js +29 -0
- package/dist/cli/chunks/{chunk-GRPEDIYG.js → chunk-W2VTHUDK.js} +2 -2
- package/dist/cli/chunks/{chunk-SAVITYEX.js → chunk-W3JB3G7C.js} +2 -2
- package/dist/cli/chunks/{chunk-WTXRPYNN.js → chunk-WQ4MT74X.js} +1 -1
- package/dist/cli/chunks/{chunk-GY4EGQO3.js → chunk-WTNM7NA4.js} +1 -1
- package/dist/cli/chunks/chunk-XB3SIYGU.js +62 -0
- package/dist/cli/chunks/{chunk-IHRFR5SV.js → chunk-XCUNQ3FK.js} +2 -2
- package/dist/cli/chunks/{chunk-ITBPDVK5.js → chunk-XHQFVTFD.js} +1 -1
- package/dist/cli/chunks/{chunk-KJZXBZQR.js → chunk-YBUUAFKR.js} +1 -1
- package/dist/cli/chunks/{chunk-KR2PGNXX.js → chunk-YJV6TTCW.js} +2 -2
- package/dist/cli/chunks/{chunk-BQLFOJ5G.js → chunk-YUSGT2CU.js} +1 -1
- package/dist/cli/chunks/{chunk-5E3YCZC5.js → chunk-YUTSN5BK.js} +2 -2
- package/dist/cli/chunks/{chunk-DDMFTEJP.js → chunk-YVMJTBXB.js} +3 -3
- package/dist/cli/chunks/chunk-YVQ4PR4H.js +2 -0
- package/dist/cli/chunks/{chunk-RYMHYTOK.js → chunk-Z2EDNMCQ.js} +3 -3
- package/dist/cli/chunks/{chunk-QNSUPXUU.js → chunk-ZESMMAKZ.js} +2 -2
- package/dist/cli/chunks/chunk-ZIVOT3B7.js +2 -0
- package/dist/cli/chunks/{ci-BYCH3NPL.js → ci-NSF6OHB4.js} +2 -2
- package/dist/cli/chunks/{ci-output-P7P4XH6F.js → ci-output-ZPDJ42U3.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-VLX556ZI.js → circuit-breaker-Y2RUJDYG.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-JPR425PL.js → claude-flow-setup-OH6G6KM2.js} +2 -2
- package/dist/cli/chunks/client-QQGRKAY7.js +2 -0
- package/dist/cli/chunks/{cline-installer-FOY47NSH.js → cline-installer-IHH4F27G.js} +2 -2
- package/dist/cli/chunks/{code-57SN4ZDY.js → code-SFAHWFTX.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-GT7UFRYU.js → code-index-extractor-GXECMOM2.js} +2 -2
- package/dist/cli/chunks/{codex-installer-JAGWONAV.js → codex-installer-UPMSAFCQ.js} +2 -2
- package/dist/cli/chunks/{completions-7YLHPGSV.js → completions-5TX6LDHY.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-TQUF6BEI.js → complexity-analyzer-J2ZR3XZB.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-TICV6IGT.js → continuedev-installer-GWYZKB5A.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-A6PDMI52.js → copilot-installer-DQZMQWI7.js} +2 -2
- package/dist/cli/chunks/{cost-tracker-NZPNHNV2.js → cost-tracker-V7KIGCLZ.js} +2 -2
- package/dist/cli/chunks/{coverage-HBEB2LKS.js → coverage-3X6LA2GZ.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-3SHAGRVP.js +2 -0
- package/dist/cli/chunks/{cursor-installer-R4FM7MGN.js → cursor-installer-ENDG4JIU.js} +2 -2
- package/dist/cli/chunks/daemon-4XVAO7GT.js +16 -0
- package/dist/cli/chunks/daemon-TC65CQFK.js +10 -0
- package/dist/cli/chunks/{dag-attention-scheduler-2L7VCYZ3.js → dag-attention-scheduler-JOSCDRZC.js} +2 -2
- package/dist/cli/chunks/{detect-EEWB4IYE.js → detect-KWZX3OMK.js} +2 -2
- package/dist/cli/chunks/{dist-node-7RM6BB2X.js → dist-node-R4U2PJ47.js} +2 -2
- package/dist/cli/chunks/{domain-handler-RVGHBDUJ.js → domain-handler-BMYYZO2L.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-M5MERQG5.js → domain-transfer-MSDBBDLC.js} +2 -2
- package/dist/cli/chunks/dream-OCZK42FM.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-MS55QS73.js → embed-and-insert-pattern-MFINPOLS.js} +2 -2
- package/dist/cli/chunks/{eval-MBTMI7KN.js → eval-OER6UNUY.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-Z5XB7D6A.js → experience-capture-middleware-F5I77ECG.js} +3 -3
- package/dist/cli/chunks/{fast-paths-FSWLHI4I.js → fast-paths-P3KT5DUQ.js} +2 -2
- package/dist/cli/chunks/{feature-flags-QUPNH2J5.js → feature-flags-5EBWQ5WU.js} +2 -2
- package/dist/cli/chunks/{feature-flags-ATYOPR5D.js → feature-flags-DYFZSQLV.js} +2 -2
- package/dist/cli/chunks/{file-discovery-SOJJEQ2E.js → file-discovery-MOBVABSM.js} +2 -2
- package/dist/cli/chunks/{fleet-PWBTDWVG.js → fleet-J3R3NQNC.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-2N67VQOQ.js → gnn-wrapper-QD76SULF.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-5PSG2UPO.js → heartbeat-handler-AJEWTPZ4.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-EAVZR6TJ.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-BY4XB7FB.js +2 -0
- package/dist/cli/chunks/hnsw-index-657CZRG7.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-YIXH5T4U.js → hnsw-legacy-bridge-5VRM5N7K.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-3U2AVWQ3.js → hnswlib-node-BWUH4OQT.js} +2 -2
- package/dist/cli/chunks/hooks-7PMVKQOE.js +248 -0
- package/dist/cli/chunks/{hybrid-router-RL47S47Z.js → hybrid-router-2K2LW45J.js} +2 -2
- package/dist/cli/chunks/{hypergraph-engine-XW2IHFWW.js → hypergraph-engine-2CQ735JO.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-AQXKY4UF.js → hypergraph-handler-AQ53GVIW.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-GI6UVAMT.js +2 -0
- package/dist/cli/chunks/{init-handler-KXYGJQI5.js → init-handler-ZOVJPAWO.js} +6 -6
- package/dist/cli/chunks/init-wizard-HOH577MH.js +2 -0
- package/dist/cli/chunks/kernel-JDYBG5GE.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-VSULDGRO.js → kilocode-installer-GWQCNLKI.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-SH4D2UXW.js → kiro-installer-6KVES4MO.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-RAQOWLG3.js +2 -0
- package/dist/cli/chunks/learning-6XMNWXRT.js +117 -0
- package/dist/cli/chunks/{llm-router-YXXSQX5K.js → llm-router-GS4AZJJC.js} +4 -4
- package/dist/cli/chunks/{load-S52R2SLL.js → load-FEMEQNE6.js} +2 -2
- package/dist/cli/chunks/load-test-3MEJ43U2.js +2 -0
- package/dist/cli/chunks/{mcp-ZWMAJIU7.js → mcp-6V2H7EXU.js} +2 -2
- package/dist/cli/chunks/{memory-4YTWWDK7.js → memory-YLGPOB2H.js} +5 -5
- package/dist/cli/chunks/memory-backend-2A47ZRGO.js +2 -0
- package/dist/cli/chunks/memory-handlers-UBTBC7D2.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-F3VEM2UF.js → multi-model-executor-SL2EKAH2.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-Z2CUJQ6D.js → opencode-installer-ADOJVGNA.js} +2 -2
- package/dist/cli/chunks/{orchestrator-UPXR2XOF.js → orchestrator-O4IWW2VU.js} +37 -18
- package/dist/cli/chunks/{pipeline-6MEMAIXM.js → pipeline-5BD5YQNQ.js} +2 -2
- package/dist/cli/chunks/{platform-H72FLOM7.js → platform-HXSUOOJH.js} +2 -2
- package/dist/cli/chunks/{plugin-GIMQFDVR.js → plugin-HOLH5CUH.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-DM5FR5SV.js → prime-radiant-advanced-wasm-PJTL7OLS.js} +2 -2
- package/dist/cli/chunks/protocol-executor-3FR7FBVM.js +2 -0
- package/dist/cli/chunks/{protocol-handler-YW3N333B.js → protocol-handler-K27YGLC7.js} +2 -2
- package/dist/cli/chunks/{prove-IJY524KK.js → prove-MHCLHQQ6.js} +2 -2
- package/dist/cli/chunks/{provider-manager-FNG6YR2V.js → provider-manager-3645PPXX.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-CHNYPYQW.js +2 -0
- package/dist/cli/chunks/{quality-EZLAMSCP.js → quality-NDE6EDOY.js} +2 -2
- package/dist/cli/chunks/queen-coordinator-J6ZRYTBX.js +2 -0
- package/dist/cli/chunks/{real-embeddings-MFRCC6GH.js → real-embeddings-VD3EVV3U.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-H3ZIRGWU.js → roocode-installer-63Y45UUG.js} +2 -2
- package/dist/cli/chunks/router-23HRN2Z6.js +2 -0
- package/dist/cli/chunks/routing-feedback-R6A4B6ZG.js +2 -0
- package/dist/cli/chunks/{routing-handler-T2A7FYHW.js → routing-handler-76XISU2E.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-TCLWBP2M.js → ruvector-commands-AEKOZZHZ.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-BE3JCPYC.js → rvf-dual-writer-4DMUIZQF.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-MLUX5YGR.js → rvf-migration-adapter-YUTXFOZ3.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-OAQXTASZ.js → rvf-migration-coordinator-XJ5N2W37.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-QINEJZM7.js +2 -0
- package/dist/cli/chunks/safe-db-YXMCSKFH.js +2 -0
- package/dist/cli/chunks/schedule-XVFD27P5.js +2 -0
- package/dist/cli/chunks/scheduler-NWH2IDEU.js +2 -0
- package/dist/cli/chunks/{security-SHWJWJ4M.js → security-6YS6GQGO.js} +3 -3
- package/dist/cli/chunks/shared-rvf-adapter-FTZY35WI.js +2 -0
- package/dist/cli/chunks/{shared-rvf-dual-writer-BKSR2FFK.js → shared-rvf-dual-writer-MH2Y65HA.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-BR6YJF5P.js +2 -0
- package/dist/cli/chunks/{status-handler-QK5KMKYC.js → status-handler-57JQMPY5.js} +2 -2
- package/dist/cli/chunks/{structural-health-3BRNCAYQ.js → structural-health-34D5VWRD.js} +2 -2
- package/dist/cli/chunks/sync-HJD2US5P.js +2 -0
- package/dist/cli/chunks/sync-TTQ6ZB5D.js +17 -0
- package/dist/cli/chunks/{task-handler-VH2CLUIA.js → task-handler-4RF57637.js} +2 -2
- package/dist/cli/chunks/{task-handlers-BUZNV2VX.js → task-handlers-BRSK7HDE.js} +3 -3
- package/dist/cli/chunks/{test-K24JQQZ2.js → test-GMUW2VR3.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-MHXRV5VI.js → test-scheduling-7LF24IFV.js} +3 -3
- package/dist/cli/chunks/{token-bootstrap-3NZDLG52.js → token-bootstrap-VYT4RTHU.js} +2 -2
- package/dist/cli/chunks/{token-usage-C4BGA2O7.js → token-usage-NFNCPQGW.js} +2 -2
- package/dist/cli/chunks/{transformers-ZIIFB2V4.js → transformers-GGD5GIEY.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-GES2AV7A.js → tree-sitter-wasm-parser-GKYG6NKT.js} +2 -2
- package/dist/cli/chunks/{types-L3MO5VNC.js → types-WJ3ZTRD5.js} +2 -2
- package/dist/cli/chunks/unified-memory-AT3Z4CY7.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-6FOIGINN.js +2 -0
- package/dist/cli/chunks/unified-persistence-TCJB7MQS.js +2 -0
- package/dist/cli/chunks/{upgrade-EKJYS5S5.js → upgrade-IMBT4F6K.js} +2 -2
- package/dist/cli/chunks/{validate-WYWWB5PQ.js → validate-76OVF45Z.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-SBSWKJ3H.js → validate-swarm-HH2ZYWXA.js} +2 -2
- package/dist/cli/chunks/{vibium-VEMTLNFV.js → vibium-74WQNDBX.js} +2 -2
- package/dist/cli/chunks/visual-security-IBAUX2K5.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-STW2WR2J.js → web-tree-sitter-W6RGE4SL.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-6ZXMJASZ.js → windsurf-installer-7DMSFCA2.js} +2 -2
- package/dist/cli/chunks/{witness-chain-PTULB4MR.js → witness-chain-BLZ4ZKAD.js} +2 -2
- package/dist/cli/chunks/witness-chain-GNNF23XU.js +2 -0
- package/dist/cli/chunks/{workflow-TEBAAHNR.js → workflow-RNSDKRZ4.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-S2YONHGM.js +2 -0
- package/dist/cli/chunks/{wrappers-DVMVRKXK.js → wrappers-J7RXMIOY.js} +2 -2
- package/dist/cli/commands/hooks-handlers/editing-hooks.js +9 -3
- package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +16 -24
- package/dist/cli/commands/hooks-handlers/hooks-shared.d.ts +1 -1
- package/dist/cli/commands/hooks-handlers/hooks-shared.js +8 -1
- package/dist/cli/commands/hooks-handlers/routing-hooks.js +15 -3
- package/dist/cli/commands/hooks-handlers/task-hooks.js +37 -46
- package/dist/cli/commands/learning.js +194 -0
- package/dist/domains/learning-optimization/services/learning-coordinator.js +37 -17
- package/dist/init/phases/10-workers.js +20 -1
- package/dist/kernel/hybrid-backend.d.ts +17 -7
- package/dist/kernel/hybrid-backend.js +24 -10
- package/dist/kernel/interfaces.d.ts +33 -6
- package/dist/kernel/kernel.d.ts +1 -0
- package/dist/kernel/kernel.js +57 -0
- package/dist/kernel/memory-backend.d.ts +5 -5
- package/dist/kernel/memory-backend.js +14 -7
- package/dist/kernel/unified-memory-schemas.d.ts +1 -1
- package/dist/kernel/unified-memory-schemas.js +7 -1
- package/dist/learning/agent-routing.d.ts +134 -1
- package/dist/learning/agent-routing.js +185 -2
- package/dist/learning/dream/dream-insights-pruner.d.ts +49 -0
- package/dist/learning/dream/dream-insights-pruner.js +53 -0
- package/dist/learning/dream/dream-scheduler.js +17 -0
- package/dist/learning/loop-health.d.ts +84 -0
- package/dist/learning/loop-health.js +91 -0
- package/dist/learning/pattern-usage-recorder.d.ts +58 -0
- package/dist/learning/pattern-usage-recorder.js +72 -0
- package/dist/learning/qe-reasoning-bank-types.d.ts +11 -0
- package/dist/learning/qe-reasoning-bank.d.ts +11 -0
- package/dist/learning/qe-reasoning-bank.js +86 -3
- package/dist/learning/routing-topology-gate.d.ts +40 -0
- package/dist/learning/routing-topology-gate.js +55 -0
- package/dist/learning/sqlite-persistence.d.ts +6 -1
- package/dist/learning/sqlite-persistence.js +14 -20
- package/dist/mcp/bundle.js +3837 -3811
- package/dist/mcp/handlers/core-handlers.js +21 -0
- package/dist/routing/routing-feedback.js +7 -3
- package/dist/routing/routing-outcomes-migration.d.ts +31 -0
- package/dist/routing/routing-outcomes-migration.js +60 -0
- package/dist/workers/interfaces.d.ts +26 -0
- package/dist/workers/worker-manager.d.ts +15 -12
- package/dist/workers/worker-manager.js +11 -0
- package/dist/workers/workers/learning-consolidation.d.ts +28 -0
- package/dist/workers/workers/learning-consolidation.js +302 -71
- package/package.json +3 -1
- package/dist/cli/chunks/adapter-HV42JOZD.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-GL22PE2V.js +0 -2
- package/dist/cli/chunks/base-4KQ2FGUX.js +0 -2
- package/dist/cli/chunks/browser-workflow-CTE7BDM4.js +0 -2
- package/dist/cli/chunks/chunk-3NGNSKL3.js +0 -14
- package/dist/cli/chunks/chunk-6HSFZ6SL.js +0 -180
- package/dist/cli/chunks/chunk-7Z3GBQNV.js +0 -2
- package/dist/cli/chunks/chunk-AQJ6XS34.js +0 -2
- package/dist/cli/chunks/chunk-H2IMXQCJ.js +0 -2
- package/dist/cli/chunks/chunk-SPCANEJY.js +0 -95
- package/dist/cli/chunks/client-FRVNMXQO.js +0 -2
- package/dist/cli/chunks/cross-domain-router-BVCPAWG2.js +0 -2
- package/dist/cli/chunks/daemon-PHIZPZIE.js +0 -19
- package/dist/cli/chunks/dream-77ODIFIF.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-CQGQS3V7.js +0 -2
- package/dist/cli/chunks/hnsw-index-2ACF6FOJ.js +0 -2
- package/dist/cli/chunks/hooks-YROFO6PE.js +0 -259
- package/dist/cli/chunks/impact-analyzer-LWEGK23B.js +0 -2
- package/dist/cli/chunks/init-wizard-7BS3QMWR.js +0 -2
- package/dist/cli/chunks/kernel-TX67WXSI.js +0 -2
- package/dist/cli/chunks/knowledge-graph-TDSP2UE2.js +0 -2
- package/dist/cli/chunks/learning-RRWV3SEL.js +0 -107
- package/dist/cli/chunks/load-test-GEBBBUMV.js +0 -2
- package/dist/cli/chunks/memory-backend-WQS2MLW2.js +0 -2
- package/dist/cli/chunks/memory-handlers-RTY5MBA5.js +0 -2
- package/dist/cli/chunks/protocol-executor-DT7XHMLL.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-LDNETZVA.js +0 -2
- package/dist/cli/chunks/queen-coordinator-AF7HCQSM.js +0 -2
- package/dist/cli/chunks/router-OWQ5EI72.js +0 -2
- package/dist/cli/chunks/routing-feedback-B43DEQMK.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-XBJDXHNI.js +0 -2
- package/dist/cli/chunks/safe-db-RT3LEDUG.js +0 -2
- package/dist/cli/chunks/schedule-EHUDCKS2.js +0 -2
- package/dist/cli/chunks/scheduler-GEGZ4J3C.js +0 -2
- package/dist/cli/chunks/shared-rvf-adapter-LNBUNRAM.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-3DGRJH3K.js +0 -2
- package/dist/cli/chunks/sync-5CDYOT3H.js +0 -23
- package/dist/cli/chunks/unified-memory-ZSBX4LYU.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-Y6EKAMRP.js +0 -2
- package/dist/cli/chunks/unified-persistence-2PDVU2U5.js +0 -2
- package/dist/cli/chunks/visual-security-RHMFLKVQ.js +0 -2
- package/dist/cli/chunks/witness-chain-QO237QOF.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-RHM5MIGE.js +0 -2
|
@@ -34,8 +34,8 @@ export class InMemoryBackend {
|
|
|
34
34
|
const fullKey = this.buildKey(key, options?.namespace);
|
|
35
35
|
this.store.set(fullKey, entry);
|
|
36
36
|
}
|
|
37
|
-
async get(key,
|
|
38
|
-
const fullKey = this.buildKey(key, namespace);
|
|
37
|
+
async get(key, options) {
|
|
38
|
+
const fullKey = this.buildKey(key, options?.namespace);
|
|
39
39
|
const entry = this.store.get(fullKey);
|
|
40
40
|
if (!entry) {
|
|
41
41
|
return undefined;
|
|
@@ -47,20 +47,27 @@ export class InMemoryBackend {
|
|
|
47
47
|
}
|
|
48
48
|
return entry.value;
|
|
49
49
|
}
|
|
50
|
-
async delete(key,
|
|
51
|
-
const fullKey = this.buildKey(key, namespace);
|
|
50
|
+
async delete(key, options) {
|
|
51
|
+
const fullKey = this.buildKey(key, options?.namespace);
|
|
52
52
|
return this.store.delete(fullKey);
|
|
53
53
|
}
|
|
54
|
-
async has(key,
|
|
55
|
-
const value = await this.get(key,
|
|
54
|
+
async has(key, options) {
|
|
55
|
+
const value = await this.get(key, options);
|
|
56
56
|
return value !== undefined;
|
|
57
57
|
}
|
|
58
|
-
async search(pattern, limit = MEMORY_CONSTANTS.DEFAULT_SEARCH_LIMIT) {
|
|
58
|
+
async search(pattern, limit = MEMORY_CONSTANTS.DEFAULT_SEARCH_LIMIT, options) {
|
|
59
59
|
// Escape regex-special chars first, then convert glob wildcards to regex
|
|
60
60
|
const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, '\\$&');
|
|
61
61
|
const regex = new RegExp(escaped.replace(/\*/g, '.*'));
|
|
62
62
|
const results = [];
|
|
63
|
+
// When a namespace is supplied, scope the scan to that prefix. Matches
|
|
64
|
+
// HybridBackend's namespace-aware search and lets LearningCoordinator's
|
|
65
|
+
// namespaced reads behave identically under unit tests that swap in the
|
|
66
|
+
// in-memory backend (#491 Bug 2).
|
|
67
|
+
const nsPrefix = options?.namespace ? `${options.namespace}:` : undefined;
|
|
63
68
|
for (const key of this.store.keys()) {
|
|
69
|
+
if (nsPrefix && !key.startsWith(nsPrefix))
|
|
70
|
+
continue;
|
|
64
71
|
if (regex.test(key)) {
|
|
65
72
|
results.push(key);
|
|
66
73
|
if (results.length >= limit)
|
|
@@ -17,6 +17,6 @@ export declare const QE_PATTERNS_SCHEMA = "\n -- QE Patterns table (unified fro
|
|
|
17
17
|
export declare const MINCUT_SCHEMA = "\n -- MinCut Graph Snapshots (ADR-047)\n CREATE TABLE IF NOT EXISTS mincut_snapshots (\n id TEXT PRIMARY KEY,\n timestamp TEXT NOT NULL DEFAULT (datetime('now')),\n vertex_count INTEGER NOT NULL,\n edge_count INTEGER NOT NULL,\n total_weight REAL NOT NULL DEFAULT 0.0,\n is_connected INTEGER NOT NULL DEFAULT 1,\n component_count INTEGER NOT NULL DEFAULT 1,\n vertices_json TEXT NOT NULL,\n edges_json TEXT NOT NULL,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- MinCut History (time-series MinCut values)\n CREATE TABLE IF NOT EXISTS mincut_history (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n timestamp TEXT NOT NULL DEFAULT (datetime('now')),\n mincut_value REAL NOT NULL,\n vertex_count INTEGER NOT NULL,\n edge_count INTEGER NOT NULL,\n algorithm TEXT NOT NULL DEFAULT 'weighted-degree',\n duration_ms INTEGER,\n snapshot_id TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n FOREIGN KEY (snapshot_id) REFERENCES mincut_snapshots(id) ON DELETE SET NULL\n );\n\n -- MinCut Weak Vertices (detected bottlenecks)\n CREATE TABLE IF NOT EXISTS mincut_weak_vertices (\n id TEXT PRIMARY KEY,\n vertex_id TEXT NOT NULL,\n weighted_degree REAL NOT NULL,\n risk_score REAL NOT NULL,\n reason TEXT NOT NULL,\n domain TEXT,\n vertex_type TEXT NOT NULL,\n suggestions_json TEXT,\n detected_at TEXT NOT NULL DEFAULT (datetime('now')),\n resolved_at TEXT,\n snapshot_id TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n FOREIGN KEY (snapshot_id) REFERENCES mincut_snapshots(id) ON DELETE SET NULL\n );\n\n -- MinCut Alerts\n CREATE TABLE IF NOT EXISTS mincut_alerts (\n id TEXT PRIMARY KEY,\n severity TEXT NOT NULL,\n message TEXT NOT NULL,\n mincut_value REAL NOT NULL,\n threshold REAL NOT NULL,\n affected_vertices_json TEXT,\n remediations_json TEXT,\n acknowledged INTEGER DEFAULT 0,\n acknowledged_at TEXT,\n acknowledged_by TEXT,\n timestamp TEXT NOT NULL DEFAULT (datetime('now')),\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- MinCut Healing Actions (self-healing history)\n CREATE TABLE IF NOT EXISTS mincut_healing_actions (\n id TEXT PRIMARY KEY,\n action_type TEXT NOT NULL,\n action_params_json TEXT NOT NULL,\n success INTEGER NOT NULL,\n mincut_before REAL NOT NULL,\n mincut_after REAL NOT NULL,\n improvement REAL NOT NULL DEFAULT 0.0,\n error_message TEXT,\n duration_ms INTEGER NOT NULL,\n triggered_by TEXT,\n snapshot_before_id TEXT,\n snapshot_after_id TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n FOREIGN KEY (snapshot_before_id) REFERENCES mincut_snapshots(id) ON DELETE SET NULL,\n FOREIGN KEY (snapshot_after_id) REFERENCES mincut_snapshots(id) ON DELETE SET NULL\n );\n\n -- MinCut Strange Loop Observations (P1: self-organizing)\n CREATE TABLE IF NOT EXISTS mincut_observations (\n id TEXT PRIMARY KEY,\n iteration INTEGER NOT NULL,\n mincut_value REAL NOT NULL,\n weak_vertex_count INTEGER NOT NULL DEFAULT 0,\n weak_vertices_json TEXT,\n snapshot_id TEXT,\n prediction_json TEXT,\n actual_vs_predicted_diff REAL,\n timestamp TEXT NOT NULL DEFAULT (datetime('now')),\n FOREIGN KEY (snapshot_id) REFERENCES mincut_snapshots(id) ON DELETE SET NULL\n );\n\n -- MinCut Indexes\n CREATE INDEX IF NOT EXISTS idx_mincut_history_timestamp ON mincut_history(timestamp DESC);\n CREATE INDEX IF NOT EXISTS idx_mincut_history_value ON mincut_history(mincut_value);\n CREATE INDEX IF NOT EXISTS idx_mincut_weak_vertex ON mincut_weak_vertices(vertex_id);\n CREATE INDEX IF NOT EXISTS idx_mincut_weak_risk ON mincut_weak_vertices(risk_score DESC);\n CREATE INDEX IF NOT EXISTS idx_mincut_weak_resolved ON mincut_weak_vertices(resolved_at);\n CREATE INDEX IF NOT EXISTS idx_mincut_alerts_severity ON mincut_alerts(severity);\n CREATE INDEX IF NOT EXISTS idx_mincut_alerts_ack ON mincut_alerts(acknowledged);\n CREATE INDEX IF NOT EXISTS idx_mincut_healing_type ON mincut_healing_actions(action_type);\n CREATE INDEX IF NOT EXISTS idx_mincut_healing_success ON mincut_healing_actions(success);\n CREATE INDEX IF NOT EXISTS idx_mincut_observations_iter ON mincut_observations(iteration);\n";
|
|
18
18
|
export declare const SONA_PATTERNS_SCHEMA = "\n -- SONA Patterns table (ADR-046: Pattern Persistence for Neural Backbone)\n CREATE TABLE IF NOT EXISTS sona_patterns (\n id TEXT PRIMARY KEY,\n type TEXT NOT NULL,\n domain TEXT NOT NULL,\n state_embedding BLOB,\n action_embedding BLOB,\n action_type TEXT NOT NULL,\n action_value TEXT,\n outcome_reward REAL NOT NULL DEFAULT 0.0,\n outcome_success INTEGER NOT NULL DEFAULT 0,\n outcome_quality REAL NOT NULL DEFAULT 0.0,\n confidence REAL DEFAULT 0.5,\n usage_count INTEGER DEFAULT 0,\n success_count INTEGER DEFAULT 0,\n failure_count INTEGER DEFAULT 0,\n metadata TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n updated_at TEXT DEFAULT (datetime('now')),\n last_used_at TEXT\n );\n CREATE INDEX IF NOT EXISTS idx_sona_patterns_type ON sona_patterns(type);\n CREATE INDEX IF NOT EXISTS idx_sona_patterns_domain ON sona_patterns(domain);\n CREATE INDEX IF NOT EXISTS idx_sona_patterns_confidence ON sona_patterns(confidence DESC);\n CREATE INDEX IF NOT EXISTS idx_sona_patterns_updated ON sona_patterns(updated_at DESC);\n";
|
|
19
19
|
export declare const WITNESS_CHAIN_SCHEMA = "\n -- Witness Chain (ADR-070: Cryptographic audit trail for QE decisions)\n CREATE TABLE IF NOT EXISTS witness_chain (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n prev_hash TEXT NOT NULL,\n action_hash TEXT NOT NULL,\n action_type TEXT NOT NULL,\n action_data TEXT,\n timestamp TEXT NOT NULL,\n actor TEXT NOT NULL\n );\n CREATE INDEX IF NOT EXISTS idx_witness_action_type ON witness_chain(action_type);\n CREATE INDEX IF NOT EXISTS idx_witness_timestamp ON witness_chain(timestamp);\n";
|
|
20
|
-
export declare const FEEDBACK_SCHEMA = "\n -- Test outcomes (ADR-023: Quality Feedback Loop)\n CREATE TABLE IF NOT EXISTS test_outcomes (\n id TEXT PRIMARY KEY,\n test_id TEXT NOT NULL,\n test_name TEXT NOT NULL,\n generated_by TEXT NOT NULL,\n pattern_id TEXT,\n framework TEXT NOT NULL,\n language TEXT NOT NULL,\n domain TEXT NOT NULL,\n passed INTEGER NOT NULL,\n error_message TEXT,\n coverage_lines REAL DEFAULT 0,\n coverage_branches REAL DEFAULT 0,\n coverage_functions REAL DEFAULT 0,\n mutation_score REAL,\n execution_time_ms REAL NOT NULL,\n flaky INTEGER DEFAULT 0,\n flakiness_score REAL,\n maintainability_score REAL NOT NULL,\n complexity REAL,\n lines_of_code INTEGER,\n assertion_count INTEGER,\n file_path TEXT,\n source_file_path TEXT,\n metadata_json TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n CREATE INDEX IF NOT EXISTS idx_test_outcomes_pattern ON test_outcomes(pattern_id);\n CREATE INDEX IF NOT EXISTS idx_test_outcomes_agent ON test_outcomes(generated_by);\n CREATE INDEX IF NOT EXISTS idx_test_outcomes_domain ON test_outcomes(domain);\n CREATE INDEX IF NOT EXISTS idx_test_outcomes_created ON test_outcomes(created_at);\n\n -- Routing outcomes (ADR-022: Adaptive QE Agent Routing, ADR-092: advisor_consultation_json)\n CREATE TABLE IF NOT EXISTS routing_outcomes (\n id TEXT PRIMARY KEY,\n task_json TEXT NOT NULL,\n decision_json TEXT NOT NULL,\n used_agent TEXT NOT NULL,\n followed_recommendation INTEGER NOT NULL,\n success INTEGER NOT NULL,\n quality_score REAL NOT NULL,\n duration_ms REAL NOT NULL,\n error TEXT,\n model_tier TEXT,\n advisor_consultation_json TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n CREATE INDEX IF NOT EXISTS idx_routing_outcomes_agent ON routing_outcomes(used_agent);\n CREATE INDEX IF NOT EXISTS idx_routing_outcomes_created ON routing_outcomes(created_at);\n CREATE INDEX IF NOT EXISTS idx_routing_outcomes_tier ON routing_outcomes(model_tier);\n\n -- Coverage sessions (ADR-023: Coverage Learning)\n CREATE TABLE IF NOT EXISTS coverage_sessions (\n id TEXT PRIMARY KEY,\n target_path TEXT NOT NULL,\n agent_id TEXT NOT NULL,\n technique TEXT NOT NULL,\n before_lines REAL DEFAULT 0,\n before_branches REAL DEFAULT 0,\n before_functions REAL DEFAULT 0,\n after_lines REAL DEFAULT 0,\n after_branches REAL DEFAULT 0,\n after_functions REAL DEFAULT 0,\n tests_generated INTEGER DEFAULT 0,\n tests_passed INTEGER DEFAULT 0,\n gaps_json TEXT,\n duration_ms REAL NOT NULL,\n started_at TEXT NOT NULL,\n completed_at TEXT NOT NULL,\n context_json TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n CREATE INDEX IF NOT EXISTS idx_coverage_sessions_technique ON coverage_sessions(technique);\n CREATE INDEX IF NOT EXISTS idx_coverage_sessions_agent ON coverage_sessions(agent_id);\n CREATE INDEX IF NOT EXISTS idx_coverage_sessions_created ON coverage_sessions(created_at);\n";
|
|
20
|
+
export declare const FEEDBACK_SCHEMA = "\n -- Test outcomes (ADR-023: Quality Feedback Loop)\n CREATE TABLE IF NOT EXISTS test_outcomes (\n id TEXT PRIMARY KEY,\n test_id TEXT NOT NULL,\n test_name TEXT NOT NULL,\n generated_by TEXT NOT NULL,\n pattern_id TEXT,\n framework TEXT NOT NULL,\n language TEXT NOT NULL,\n domain TEXT NOT NULL,\n passed INTEGER NOT NULL,\n error_message TEXT,\n coverage_lines REAL DEFAULT 0,\n coverage_branches REAL DEFAULT 0,\n coverage_functions REAL DEFAULT 0,\n mutation_score REAL,\n execution_time_ms REAL NOT NULL,\n flaky INTEGER DEFAULT 0,\n flakiness_score REAL,\n maintainability_score REAL NOT NULL,\n complexity REAL,\n lines_of_code INTEGER,\n assertion_count INTEGER,\n file_path TEXT,\n source_file_path TEXT,\n metadata_json TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n CREATE INDEX IF NOT EXISTS idx_test_outcomes_pattern ON test_outcomes(pattern_id);\n CREATE INDEX IF NOT EXISTS idx_test_outcomes_agent ON test_outcomes(generated_by);\n CREATE INDEX IF NOT EXISTS idx_test_outcomes_domain ON test_outcomes(domain);\n CREATE INDEX IF NOT EXISTS idx_test_outcomes_created ON test_outcomes(created_at);\n\n -- Routing outcomes (ADR-022: Adaptive QE Agent Routing, ADR-092: advisor_consultation_json,\n -- ADR-095: exploration / criticality / q_weight for \u03B5-greedy routing telemetry)\n CREATE TABLE IF NOT EXISTS routing_outcomes (\n id TEXT PRIMARY KEY,\n task_json TEXT NOT NULL,\n decision_json TEXT NOT NULL,\n used_agent TEXT NOT NULL,\n followed_recommendation INTEGER NOT NULL,\n success INTEGER NOT NULL,\n quality_score REAL NOT NULL,\n duration_ms REAL NOT NULL,\n error TEXT,\n model_tier TEXT,\n advisor_consultation_json TEXT,\n -- ADR-095: routing exploration telemetry\n exploration INTEGER NOT NULL DEFAULT 0,\n criticality REAL,\n q_weight REAL,\n created_at TEXT DEFAULT (datetime('now'))\n );\n CREATE INDEX IF NOT EXISTS idx_routing_outcomes_agent ON routing_outcomes(used_agent);\n CREATE INDEX IF NOT EXISTS idx_routing_outcomes_created ON routing_outcomes(created_at);\n CREATE INDEX IF NOT EXISTS idx_routing_outcomes_tier ON routing_outcomes(model_tier);\n CREATE INDEX IF NOT EXISTS idx_routing_outcomes_exploration ON routing_outcomes(exploration);\n\n -- Coverage sessions (ADR-023: Coverage Learning)\n CREATE TABLE IF NOT EXISTS coverage_sessions (\n id TEXT PRIMARY KEY,\n target_path TEXT NOT NULL,\n agent_id TEXT NOT NULL,\n technique TEXT NOT NULL,\n before_lines REAL DEFAULT 0,\n before_branches REAL DEFAULT 0,\n before_functions REAL DEFAULT 0,\n after_lines REAL DEFAULT 0,\n after_branches REAL DEFAULT 0,\n after_functions REAL DEFAULT 0,\n tests_generated INTEGER DEFAULT 0,\n tests_passed INTEGER DEFAULT 0,\n gaps_json TEXT,\n duration_ms REAL NOT NULL,\n started_at TEXT NOT NULL,\n completed_at TEXT NOT NULL,\n context_json TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n CREATE INDEX IF NOT EXISTS idx_coverage_sessions_technique ON coverage_sessions(technique);\n CREATE INDEX IF NOT EXISTS idx_coverage_sessions_agent ON coverage_sessions(agent_id);\n CREATE INDEX IF NOT EXISTS idx_coverage_sessions_created ON coverage_sessions(created_at);\n";
|
|
21
21
|
export declare const STATS_TABLES: string[];
|
|
22
22
|
//# sourceMappingURL=unified-memory-schemas.d.ts.map
|
|
@@ -540,7 +540,8 @@ export const FEEDBACK_SCHEMA = `
|
|
|
540
540
|
CREATE INDEX IF NOT EXISTS idx_test_outcomes_domain ON test_outcomes(domain);
|
|
541
541
|
CREATE INDEX IF NOT EXISTS idx_test_outcomes_created ON test_outcomes(created_at);
|
|
542
542
|
|
|
543
|
-
-- Routing outcomes (ADR-022: Adaptive QE Agent Routing, ADR-092: advisor_consultation_json
|
|
543
|
+
-- Routing outcomes (ADR-022: Adaptive QE Agent Routing, ADR-092: advisor_consultation_json,
|
|
544
|
+
-- ADR-095: exploration / criticality / q_weight for ε-greedy routing telemetry)
|
|
544
545
|
CREATE TABLE IF NOT EXISTS routing_outcomes (
|
|
545
546
|
id TEXT PRIMARY KEY,
|
|
546
547
|
task_json TEXT NOT NULL,
|
|
@@ -553,11 +554,16 @@ export const FEEDBACK_SCHEMA = `
|
|
|
553
554
|
error TEXT,
|
|
554
555
|
model_tier TEXT,
|
|
555
556
|
advisor_consultation_json TEXT,
|
|
557
|
+
-- ADR-095: routing exploration telemetry
|
|
558
|
+
exploration INTEGER NOT NULL DEFAULT 0,
|
|
559
|
+
criticality REAL,
|
|
560
|
+
q_weight REAL,
|
|
556
561
|
created_at TEXT DEFAULT (datetime('now'))
|
|
557
562
|
);
|
|
558
563
|
CREATE INDEX IF NOT EXISTS idx_routing_outcomes_agent ON routing_outcomes(used_agent);
|
|
559
564
|
CREATE INDEX IF NOT EXISTS idx_routing_outcomes_created ON routing_outcomes(created_at);
|
|
560
565
|
CREATE INDEX IF NOT EXISTS idx_routing_outcomes_tier ON routing_outcomes(model_tier);
|
|
566
|
+
CREATE INDEX IF NOT EXISTS idx_routing_outcomes_exploration ON routing_outcomes(exploration);
|
|
561
567
|
|
|
562
568
|
-- Coverage sessions (ADR-023: Coverage Learning)
|
|
563
569
|
CREATE TABLE IF NOT EXISTS coverage_sessions (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agentic QE v3 - Agent Routing
|
|
3
3
|
* ADR-021: QE ReasoningBank for Pattern Learning
|
|
4
|
+
* ADR-095: ε-greedy exploration with Q-value blending and mincut safety gate
|
|
4
5
|
*
|
|
5
6
|
* Static agent capability mapping and routing score calculation
|
|
6
7
|
* used by QEReasoningBank.routeTask().
|
|
@@ -22,11 +23,28 @@ export interface AgentCapabilityProfile {
|
|
|
22
23
|
export declare const AGENT_CAPABILITIES: Record<string, AgentCapabilityProfile>;
|
|
23
24
|
/**
|
|
24
25
|
* Scored agent with reasoning trace.
|
|
26
|
+
*
|
|
27
|
+
* ADR-095 telemetry fields (all optional, populated only when the
|
|
28
|
+
* corresponding signal source is wired):
|
|
29
|
+
* - `staticScore`: the pre-blend score (domain + capability + perf + …)
|
|
30
|
+
* - `qWeight`, `qValue`: when Q-table data was available
|
|
31
|
+
* - `exploration`: true if this agent was promoted to position 0 by the
|
|
32
|
+
* ε-greedy policy rather than scored to the top deterministically
|
|
25
33
|
*/
|
|
26
34
|
export interface ScoredAgent {
|
|
27
35
|
agent: string;
|
|
28
36
|
score: number;
|
|
29
37
|
reasoning: string[];
|
|
38
|
+
/** ADR-095: pre-blend static score for retrospective explainability */
|
|
39
|
+
staticScore?: number;
|
|
40
|
+
/** ADR-095: Q-value influence (0..MAX_Q_WEIGHT) on the final score */
|
|
41
|
+
qWeight?: number;
|
|
42
|
+
/** ADR-095: raw q_value from rl_q_values, for telemetry */
|
|
43
|
+
qValue?: number;
|
|
44
|
+
/** ADR-095: number of (state_key, action_key) visits behind the Q value */
|
|
45
|
+
qVisits?: number;
|
|
46
|
+
/** ADR-095: true when ε-greedy promoted this agent over the greedy winner */
|
|
47
|
+
exploration?: boolean;
|
|
30
48
|
}
|
|
31
49
|
/**
|
|
32
50
|
* Routing weight configuration.
|
|
@@ -38,6 +56,114 @@ export interface RoutingWeights {
|
|
|
38
56
|
/** Weight for language match boost (default: 1.0) */
|
|
39
57
|
language?: number;
|
|
40
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Maximum Q-value influence on the final score.
|
|
61
|
+
*
|
|
62
|
+
* 0.4 means a fully-mature Q-value can move the score by up to ±0.2 (since
|
|
63
|
+
* normalizedQ ranges over (0, 1) and the static contribution clamps the
|
|
64
|
+
* upper bound). This is intentionally bounded so Q-values inform rather
|
|
65
|
+
* than override the static features.
|
|
66
|
+
*
|
|
67
|
+
* Tuning: post-deploy telemetry will tell us whether agents are actually
|
|
68
|
+
* being separated by Q-values. If the avg `q_weight` in routing_outcomes
|
|
69
|
+
* climbs but quality_score doesn't improve, this constant is too high.
|
|
70
|
+
*/
|
|
71
|
+
export declare const MAX_Q_WEIGHT = 0.4;
|
|
72
|
+
/**
|
|
73
|
+
* Number of (state_key, action_key) visits at which qWeight saturates at
|
|
74
|
+
* MAX_Q_WEIGHT. Below this, qWeight ramps linearly from 0.
|
|
75
|
+
*
|
|
76
|
+
* 20 visits at the default 30-min worker tick + typical session cadence
|
|
77
|
+
* implies ~1 week of activity before a (state, agent) pair drives the
|
|
78
|
+
* decision. Adjust downward if cold-start latency proves problematic.
|
|
79
|
+
*/
|
|
80
|
+
export declare const QWEIGHT_RAMP_VISITS = 20;
|
|
81
|
+
/**
|
|
82
|
+
* Q-value lookup callback supplied by the caller (QEReasoningBank.routeTask).
|
|
83
|
+
* Returns undefined when the (stateKey, agentType) pair has no recorded
|
|
84
|
+
* Q-value yet — caller does not need to handle missing-row vs zero-visits.
|
|
85
|
+
*/
|
|
86
|
+
export type QValueLookup = (agentType: string) => {
|
|
87
|
+
qValue: number;
|
|
88
|
+
visits: number;
|
|
89
|
+
} | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Blend a static score with a Q-value contribution.
|
|
92
|
+
*
|
|
93
|
+
* effectiveScore = staticScore * (1 - qWeight) + normalizedQ * qWeight
|
|
94
|
+
*
|
|
95
|
+
* Returns { score, qWeight, qValue, qVisits } so callers can attach the
|
|
96
|
+
* telemetry fields to the ScoredAgent record.
|
|
97
|
+
*/
|
|
98
|
+
export declare function blendStaticAndQValue(staticScore: number, qLookup: {
|
|
99
|
+
qValue: number;
|
|
100
|
+
visits: number;
|
|
101
|
+
} | undefined): {
|
|
102
|
+
score: number;
|
|
103
|
+
qWeight: number;
|
|
104
|
+
qValue: number;
|
|
105
|
+
qVisits: number;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Resolve the per-decision ε for the exploration policy.
|
|
109
|
+
*
|
|
110
|
+
* Priority order:
|
|
111
|
+
* 1. AQE_ROUTER_EXPLORATION_RATE env var (operator override, fixed)
|
|
112
|
+
* 2. Default base rate (0.05)
|
|
113
|
+
* The result is then multiplied by the mincut safety gate (caller passes
|
|
114
|
+
* `topologyCritical` derived from getSharedMinCutMonitor().isCritical()):
|
|
115
|
+
* critical topology → 0.2x dampening, healthy/unknown → 1.0x.
|
|
116
|
+
*
|
|
117
|
+
* Returns a number in [0, 1].
|
|
118
|
+
*/
|
|
119
|
+
export declare function resolveExplorationRate(opts: {
|
|
120
|
+
envOverride?: string;
|
|
121
|
+
topologyCritical?: boolean;
|
|
122
|
+
}): {
|
|
123
|
+
epsilon: number;
|
|
124
|
+
baseEpsilon: number;
|
|
125
|
+
safetyMultiplier: number;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Apply the ε-greedy exploration policy to a sorted score list.
|
|
129
|
+
*
|
|
130
|
+
* With probability ε (computed from resolveExplorationRate), swaps the
|
|
131
|
+
* top-scored agent with a uniformly-random pick from positions 1..3 (or
|
|
132
|
+
* fewer if the list is shorter). Mutates `agentScores` in place. The
|
|
133
|
+
* promoted agent gets `exploration = true`.
|
|
134
|
+
*
|
|
135
|
+
* Uses `crypto.randomInt` for cryptographically-strong uniform sampling —
|
|
136
|
+
* matches the codebase convention (randomUUID is imported from 'crypto'
|
|
137
|
+
* in the same modules). Math.random() would work but breaks consistency.
|
|
138
|
+
*/
|
|
139
|
+
export declare function applyExplorationPolicy(agentScores: ScoredAgent[], epsilon: number): void;
|
|
140
|
+
/**
|
|
141
|
+
* Derive a structural taskType from a free-form task description. Used to
|
|
142
|
+
* build the q-learning state_key shared with the post-task Bellman update
|
|
143
|
+
* (hooks-dream-learning.ts).
|
|
144
|
+
*
|
|
145
|
+
* Exported (rather than kept private in task-hooks) so QEReasoningBank can
|
|
146
|
+
* compute the same state_key at routing time as post-task does at outcome
|
|
147
|
+
* time — without that, the Q-table writer and reader would address
|
|
148
|
+
* different keys.
|
|
149
|
+
*/
|
|
150
|
+
export declare function deriveTaskType(description: string): string;
|
|
151
|
+
/**
|
|
152
|
+
* Build the canonical Q-learning state_key. Must match the format used by
|
|
153
|
+
* `updateHookRouterQValue` in hooks-dream-learning.ts — the writer and
|
|
154
|
+
* reader must agree on the key shape.
|
|
155
|
+
*/
|
|
156
|
+
export declare function buildRoutingStateKey(opts: {
|
|
157
|
+
taskType: string;
|
|
158
|
+
priority?: string;
|
|
159
|
+
domain?: string;
|
|
160
|
+
complexityBucket: number;
|
|
161
|
+
}): string;
|
|
162
|
+
/**
|
|
163
|
+
* Compute the complexity bucket [0, 10] from a task description length.
|
|
164
|
+
* Mirrors the formula in task-hooks.ts pre-task bridge.
|
|
165
|
+
*/
|
|
166
|
+
export declare function deriveComplexityBucket(description: string): number;
|
|
41
167
|
/**
|
|
42
168
|
* Calculate agent scores for a routing request.
|
|
43
169
|
*
|
|
@@ -49,7 +175,14 @@ export interface RoutingWeights {
|
|
|
49
175
|
* @param requestLanguage - Optional language to boost agents with matching language expertise
|
|
50
176
|
* @returns Sorted array of scored agents (highest score first)
|
|
51
177
|
*/
|
|
52
|
-
export declare function calculateAgentScores(detectedDomains: QEDomain[], requestCapabilities: string[] | undefined, agentDomainPatternCounts: Map<string, number>, routingWeights: RoutingWeights, agentCapabilities?: Record<string, AgentCapabilityProfile>, requestLanguage?: string
|
|
178
|
+
export declare function calculateAgentScores(detectedDomains: QEDomain[], requestCapabilities: string[] | undefined, agentDomainPatternCounts: Map<string, number>, routingWeights: RoutingWeights, agentCapabilities?: Record<string, AgentCapabilityProfile>, requestLanguage?: string,
|
|
179
|
+
/**
|
|
180
|
+
* ADR-095: optional per-agent Q-value lookup. When provided, the static
|
|
181
|
+
* score is blended with the Q-value contribution via blendStaticAndQValue.
|
|
182
|
+
* When omitted (or returning undefined for every agent), behavior is
|
|
183
|
+
* identical to the pre-ADR-095 deterministic scoring.
|
|
184
|
+
*/
|
|
185
|
+
qValueLookup?: QValueLookup): ScoredAgent[];
|
|
53
186
|
/**
|
|
54
187
|
* Domain compatibility matrix for cross-domain pattern transfer.
|
|
55
188
|
* Maps each domain to its related domains (same as TransferSpecialistService).
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agentic QE v3 - Agent Routing
|
|
3
3
|
* ADR-021: QE ReasoningBank for Pattern Learning
|
|
4
|
+
* ADR-095: ε-greedy exploration with Q-value blending and mincut safety gate
|
|
4
5
|
*
|
|
5
6
|
* Static agent capability mapping and routing score calculation
|
|
6
7
|
* used by QEReasoningBank.routeTask().
|
|
7
8
|
*/
|
|
9
|
+
import { randomInt } from 'crypto';
|
|
8
10
|
// ============================================================================
|
|
9
11
|
// Agent Capabilities Map
|
|
10
12
|
// ============================================================================
|
|
@@ -72,6 +74,159 @@ export const AGENT_CAPABILITIES = {
|
|
|
72
74
|
performanceScore: 0.75,
|
|
73
75
|
},
|
|
74
76
|
};
|
|
77
|
+
// ============================================================================
|
|
78
|
+
// ADR-095: Q-Value Blending + ε-Greedy Exploration
|
|
79
|
+
// ============================================================================
|
|
80
|
+
/**
|
|
81
|
+
* Maximum Q-value influence on the final score.
|
|
82
|
+
*
|
|
83
|
+
* 0.4 means a fully-mature Q-value can move the score by up to ±0.2 (since
|
|
84
|
+
* normalizedQ ranges over (0, 1) and the static contribution clamps the
|
|
85
|
+
* upper bound). This is intentionally bounded so Q-values inform rather
|
|
86
|
+
* than override the static features.
|
|
87
|
+
*
|
|
88
|
+
* Tuning: post-deploy telemetry will tell us whether agents are actually
|
|
89
|
+
* being separated by Q-values. If the avg `q_weight` in routing_outcomes
|
|
90
|
+
* climbs but quality_score doesn't improve, this constant is too high.
|
|
91
|
+
*/
|
|
92
|
+
export const MAX_Q_WEIGHT = 0.4;
|
|
93
|
+
/**
|
|
94
|
+
* Number of (state_key, action_key) visits at which qWeight saturates at
|
|
95
|
+
* MAX_Q_WEIGHT. Below this, qWeight ramps linearly from 0.
|
|
96
|
+
*
|
|
97
|
+
* 20 visits at the default 30-min worker tick + typical session cadence
|
|
98
|
+
* implies ~1 week of activity before a (state, agent) pair drives the
|
|
99
|
+
* decision. Adjust downward if cold-start latency proves problematic.
|
|
100
|
+
*/
|
|
101
|
+
export const QWEIGHT_RAMP_VISITS = 20;
|
|
102
|
+
/**
|
|
103
|
+
* Sigmoid mapping R → (0, 1) for Q-value normalization before blending.
|
|
104
|
+
* A fresh row with q_value = 0 contributes 0.5 (neutral); negative q_values
|
|
105
|
+
* (after a failure, given the asymmetric -1.0 penalty from ADR-061) push
|
|
106
|
+
* the contribution toward 0, positive q_values toward 1.
|
|
107
|
+
*/
|
|
108
|
+
function sigmoid(x) {
|
|
109
|
+
return 1 / (1 + Math.exp(-x));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Blend a static score with a Q-value contribution.
|
|
113
|
+
*
|
|
114
|
+
* effectiveScore = staticScore * (1 - qWeight) + normalizedQ * qWeight
|
|
115
|
+
*
|
|
116
|
+
* Returns { score, qWeight, qValue, qVisits } so callers can attach the
|
|
117
|
+
* telemetry fields to the ScoredAgent record.
|
|
118
|
+
*/
|
|
119
|
+
export function blendStaticAndQValue(staticScore, qLookup) {
|
|
120
|
+
if (!qLookup || qLookup.visits === 0) {
|
|
121
|
+
return { score: staticScore, qWeight: 0, qValue: 0, qVisits: 0 };
|
|
122
|
+
}
|
|
123
|
+
const qWeight = Math.min(qLookup.visits / QWEIGHT_RAMP_VISITS, 1) * MAX_Q_WEIGHT;
|
|
124
|
+
const normalizedQ = sigmoid(qLookup.qValue);
|
|
125
|
+
return {
|
|
126
|
+
score: staticScore * (1 - qWeight) + normalizedQ * qWeight,
|
|
127
|
+
qWeight,
|
|
128
|
+
qValue: qLookup.qValue,
|
|
129
|
+
qVisits: qLookup.visits,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Resolve the per-decision ε for the exploration policy.
|
|
134
|
+
*
|
|
135
|
+
* Priority order:
|
|
136
|
+
* 1. AQE_ROUTER_EXPLORATION_RATE env var (operator override, fixed)
|
|
137
|
+
* 2. Default base rate (0.05)
|
|
138
|
+
* The result is then multiplied by the mincut safety gate (caller passes
|
|
139
|
+
* `topologyCritical` derived from getSharedMinCutMonitor().isCritical()):
|
|
140
|
+
* critical topology → 0.2x dampening, healthy/unknown → 1.0x.
|
|
141
|
+
*
|
|
142
|
+
* Returns a number in [0, 1].
|
|
143
|
+
*/
|
|
144
|
+
export function resolveExplorationRate(opts) {
|
|
145
|
+
const envValue = opts.envOverride;
|
|
146
|
+
const parsed = envValue !== undefined ? Number.parseFloat(envValue) : NaN;
|
|
147
|
+
const baseEpsilon = Number.isFinite(parsed) && parsed >= 0 && parsed <= 1
|
|
148
|
+
? parsed
|
|
149
|
+
: 0.05;
|
|
150
|
+
const safetyMultiplier = opts.topologyCritical ? 0.2 : 1.0;
|
|
151
|
+
const epsilon = Math.min(Math.max(baseEpsilon * safetyMultiplier, 0), 1);
|
|
152
|
+
return { epsilon, baseEpsilon, safetyMultiplier };
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Apply the ε-greedy exploration policy to a sorted score list.
|
|
156
|
+
*
|
|
157
|
+
* With probability ε (computed from resolveExplorationRate), swaps the
|
|
158
|
+
* top-scored agent with a uniformly-random pick from positions 1..3 (or
|
|
159
|
+
* fewer if the list is shorter). Mutates `agentScores` in place. The
|
|
160
|
+
* promoted agent gets `exploration = true`.
|
|
161
|
+
*
|
|
162
|
+
* Uses `crypto.randomInt` for cryptographically-strong uniform sampling —
|
|
163
|
+
* matches the codebase convention (randomUUID is imported from 'crypto'
|
|
164
|
+
* in the same modules). Math.random() would work but breaks consistency.
|
|
165
|
+
*/
|
|
166
|
+
export function applyExplorationPolicy(agentScores, epsilon) {
|
|
167
|
+
if (epsilon <= 0 || agentScores.length < 2)
|
|
168
|
+
return;
|
|
169
|
+
// Compare in micro-units so randomInt can do uniform sampling without
|
|
170
|
+
// float arithmetic. ε = 0.05 → 50_000 micro-units in 1_000_000.
|
|
171
|
+
const epsilonMicro = Math.round(epsilon * 1_000_000);
|
|
172
|
+
if (epsilonMicro <= 0)
|
|
173
|
+
return;
|
|
174
|
+
if (randomInt(0, 1_000_000) >= epsilonMicro)
|
|
175
|
+
return;
|
|
176
|
+
// Pick from top alternatives (positions 1..min(3, length-1)).
|
|
177
|
+
const ceiling = Math.min(4, agentScores.length);
|
|
178
|
+
const exploreIdx = randomInt(1, ceiling);
|
|
179
|
+
const explored = agentScores[exploreIdx];
|
|
180
|
+
agentScores[exploreIdx] = agentScores[0];
|
|
181
|
+
agentScores[0] = explored;
|
|
182
|
+
agentScores[0].exploration = true;
|
|
183
|
+
agentScores[0].reasoning = [...agentScores[0].reasoning, '(exploration)'];
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Derive a structural taskType from a free-form task description. Used to
|
|
187
|
+
* build the q-learning state_key shared with the post-task Bellman update
|
|
188
|
+
* (hooks-dream-learning.ts).
|
|
189
|
+
*
|
|
190
|
+
* Exported (rather than kept private in task-hooks) so QEReasoningBank can
|
|
191
|
+
* compute the same state_key at routing time as post-task does at outcome
|
|
192
|
+
* time — without that, the Q-table writer and reader would address
|
|
193
|
+
* different keys.
|
|
194
|
+
*/
|
|
195
|
+
export function deriveTaskType(description) {
|
|
196
|
+
const d = description.toLowerCase();
|
|
197
|
+
if (/\bgenerate[- ]?test|\btest[- ]?gen|\bgenerate.+spec/.test(d))
|
|
198
|
+
return 'test-generation';
|
|
199
|
+
if (/\bcoverage|\banalyze.+cover/.test(d))
|
|
200
|
+
return 'coverage-analysis';
|
|
201
|
+
if (/\bquality|\bassess|\baudit/.test(d))
|
|
202
|
+
return 'quality-assessment';
|
|
203
|
+
if (/\bsecurity|\bvulnerab|\bcompliance/.test(d))
|
|
204
|
+
return 'security-compliance';
|
|
205
|
+
if (/\bdefect|\bbug|\bdiagnos/.test(d))
|
|
206
|
+
return 'defect-intelligence';
|
|
207
|
+
if (/\brequirement|\bspec\b/.test(d))
|
|
208
|
+
return 'requirements-validation';
|
|
209
|
+
if (/\brefactor|\brewrite|\boptim/.test(d))
|
|
210
|
+
return 'refactoring';
|
|
211
|
+
if (/\btest|\brun.+test/.test(d))
|
|
212
|
+
return 'test-execution';
|
|
213
|
+
return 'unknown';
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Build the canonical Q-learning state_key. Must match the format used by
|
|
217
|
+
* `updateHookRouterQValue` in hooks-dream-learning.ts — the writer and
|
|
218
|
+
* reader must agree on the key shape.
|
|
219
|
+
*/
|
|
220
|
+
export function buildRoutingStateKey(opts) {
|
|
221
|
+
return `${opts.taskType}|${opts.priority ?? 'normal'}|${opts.domain ?? 'any'}|${opts.complexityBucket}`;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Compute the complexity bucket [0, 10] from a task description length.
|
|
225
|
+
* Mirrors the formula in task-hooks.ts pre-task bridge.
|
|
226
|
+
*/
|
|
227
|
+
export function deriveComplexityBucket(description) {
|
|
228
|
+
return Math.max(0, Math.min(10, Math.round(Math.min(description.length / 200, 1) * 10)));
|
|
229
|
+
}
|
|
75
230
|
/**
|
|
76
231
|
* Calculate agent scores for a routing request.
|
|
77
232
|
*
|
|
@@ -83,7 +238,14 @@ export const AGENT_CAPABILITIES = {
|
|
|
83
238
|
* @param requestLanguage - Optional language to boost agents with matching language expertise
|
|
84
239
|
* @returns Sorted array of scored agents (highest score first)
|
|
85
240
|
*/
|
|
86
|
-
export function calculateAgentScores(detectedDomains, requestCapabilities, agentDomainPatternCounts, routingWeights, agentCapabilities = AGENT_CAPABILITIES, requestLanguage
|
|
241
|
+
export function calculateAgentScores(detectedDomains, requestCapabilities, agentDomainPatternCounts, routingWeights, agentCapabilities = AGENT_CAPABILITIES, requestLanguage,
|
|
242
|
+
/**
|
|
243
|
+
* ADR-095: optional per-agent Q-value lookup. When provided, the static
|
|
244
|
+
* score is blended with the Q-value contribution via blendStaticAndQValue.
|
|
245
|
+
* When omitted (or returning undefined for every agent), behavior is
|
|
246
|
+
* identical to the pre-ADR-095 deterministic scoring.
|
|
247
|
+
*/
|
|
248
|
+
qValueLookup) {
|
|
87
249
|
const agentScores = [];
|
|
88
250
|
for (const [agentType, profile] of Object.entries(agentCapabilities)) {
|
|
89
251
|
let score = 0;
|
|
@@ -128,7 +290,28 @@ export function calculateAgentScores(detectedDomains, requestCapabilities, agent
|
|
|
128
290
|
score += patternBoost;
|
|
129
291
|
reasoning.push(`Pattern matches: ${patternCount}`);
|
|
130
292
|
}
|
|
131
|
-
|
|
293
|
+
// ADR-095: blend Q-value if a lookup is provided
|
|
294
|
+
const staticScore = score;
|
|
295
|
+
if (qValueLookup) {
|
|
296
|
+
const q = qValueLookup(agentType);
|
|
297
|
+
const blended = blendStaticAndQValue(staticScore, q);
|
|
298
|
+
score = blended.score;
|
|
299
|
+
if (blended.qWeight > 0) {
|
|
300
|
+
reasoning.push(`Q-bonus (w=${blended.qWeight.toFixed(2)}, v=${blended.qVisits})`);
|
|
301
|
+
}
|
|
302
|
+
agentScores.push({
|
|
303
|
+
agent: agentType,
|
|
304
|
+
score,
|
|
305
|
+
reasoning,
|
|
306
|
+
staticScore,
|
|
307
|
+
qWeight: blended.qWeight,
|
|
308
|
+
qValue: blended.qValue,
|
|
309
|
+
qVisits: blended.qVisits,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
agentScores.push({ agent: agentType, score, reasoning, staticScore });
|
|
314
|
+
}
|
|
132
315
|
}
|
|
133
316
|
// Sort by score descending
|
|
134
317
|
agentScores.sort((a, b) => b.score - a.score);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dream Insights Pruner (#488 C.2)
|
|
3
|
+
*
|
|
4
|
+
* Periodic retention sweep for the `dream_insights` table.
|
|
5
|
+
*
|
|
6
|
+
* dream_insights accumulate forever in default deployments — the schema has
|
|
7
|
+
* `created_at` but no `expires_at`, no foreign-key cascade that fires on
|
|
8
|
+
* regular cycle delete (cycles aren't routinely purged either), and no
|
|
9
|
+
* equivalent of `pattern-lifecycle.ts`'s decay/deprecation pass.
|
|
10
|
+
*
|
|
11
|
+
* Observed in state-rich shops (per #488 reporter): 120+ rows accumulated
|
|
12
|
+
* over ~30h of activity, with most at `applied = 0`. Without pruning, this
|
|
13
|
+
* grows linearly with hook activity. Over months the table becomes a slow
|
|
14
|
+
* `getPendingInsights` target and vector embeddings (if attached) grow
|
|
15
|
+
* unbounded.
|
|
16
|
+
*
|
|
17
|
+
* Strategy: delete only insights that:
|
|
18
|
+
* - have never been applied (`applied = 0`), AND
|
|
19
|
+
* - are older than the retention window (default 30 days)
|
|
20
|
+
*
|
|
21
|
+
* Applied insights stay forever — they're part of the audit trail for
|
|
22
|
+
* pattern changes. Recently-created insights stay regardless of applied
|
|
23
|
+
* state — they might still be picked up by a future `applyInsight` pass.
|
|
24
|
+
*
|
|
25
|
+
* Called from `LearningConsolidationWorker.runContinuousLearningLoop` on
|
|
26
|
+
* the 30-min worker tick. Failures are non-fatal — the worker continues
|
|
27
|
+
* with the rest of its lifecycle work.
|
|
28
|
+
*/
|
|
29
|
+
import type { Database as DatabaseType } from 'better-sqlite3';
|
|
30
|
+
export interface PruneStaleDreamInsightsOptions {
|
|
31
|
+
/**
|
|
32
|
+
* How many days old an `applied = 0` insight must be before it's
|
|
33
|
+
* eligible for deletion. Defaults to 30 days — matches the
|
|
34
|
+
* `staleDaysThreshold` used by `pattern-lifecycle.ts` for consistency.
|
|
35
|
+
*/
|
|
36
|
+
retentionDays?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface PruneResult {
|
|
39
|
+
/** Number of rows deleted. Zero if the table is empty or no rows qualify. */
|
|
40
|
+
pruned: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Delete stale unapplied insights. Idempotent — safe to call on every tick.
|
|
44
|
+
*
|
|
45
|
+
* Returns `{ pruned: 0 }` if the table doesn't exist (init hasn't created
|
|
46
|
+
* the dream schema yet) or if no rows qualify.
|
|
47
|
+
*/
|
|
48
|
+
export declare function pruneStaleDreamInsights(db: DatabaseType, options?: PruneStaleDreamInsightsOptions): PruneResult;
|
|
49
|
+
//# sourceMappingURL=dream-insights-pruner.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dream Insights Pruner (#488 C.2)
|
|
3
|
+
*
|
|
4
|
+
* Periodic retention sweep for the `dream_insights` table.
|
|
5
|
+
*
|
|
6
|
+
* dream_insights accumulate forever in default deployments — the schema has
|
|
7
|
+
* `created_at` but no `expires_at`, no foreign-key cascade that fires on
|
|
8
|
+
* regular cycle delete (cycles aren't routinely purged either), and no
|
|
9
|
+
* equivalent of `pattern-lifecycle.ts`'s decay/deprecation pass.
|
|
10
|
+
*
|
|
11
|
+
* Observed in state-rich shops (per #488 reporter): 120+ rows accumulated
|
|
12
|
+
* over ~30h of activity, with most at `applied = 0`. Without pruning, this
|
|
13
|
+
* grows linearly with hook activity. Over months the table becomes a slow
|
|
14
|
+
* `getPendingInsights` target and vector embeddings (if attached) grow
|
|
15
|
+
* unbounded.
|
|
16
|
+
*
|
|
17
|
+
* Strategy: delete only insights that:
|
|
18
|
+
* - have never been applied (`applied = 0`), AND
|
|
19
|
+
* - are older than the retention window (default 30 days)
|
|
20
|
+
*
|
|
21
|
+
* Applied insights stay forever — they're part of the audit trail for
|
|
22
|
+
* pattern changes. Recently-created insights stay regardless of applied
|
|
23
|
+
* state — they might still be picked up by a future `applyInsight` pass.
|
|
24
|
+
*
|
|
25
|
+
* Called from `LearningConsolidationWorker.runContinuousLearningLoop` on
|
|
26
|
+
* the 30-min worker tick. Failures are non-fatal — the worker continues
|
|
27
|
+
* with the rest of its lifecycle work.
|
|
28
|
+
*/
|
|
29
|
+
const DEFAULT_RETENTION_DAYS = 30;
|
|
30
|
+
/**
|
|
31
|
+
* Delete stale unapplied insights. Idempotent — safe to call on every tick.
|
|
32
|
+
*
|
|
33
|
+
* Returns `{ pruned: 0 }` if the table doesn't exist (init hasn't created
|
|
34
|
+
* the dream schema yet) or if no rows qualify.
|
|
35
|
+
*/
|
|
36
|
+
export function pruneStaleDreamInsights(db, options = {}) {
|
|
37
|
+
const retentionDays = options.retentionDays ?? DEFAULT_RETENTION_DAYS;
|
|
38
|
+
// Guard against the table not existing yet — a freshly-init'd shop may
|
|
39
|
+
// have started the worker before the dream schema was applied.
|
|
40
|
+
const tableExists = db
|
|
41
|
+
.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='dream_insights'")
|
|
42
|
+
.get();
|
|
43
|
+
if (!tableExists) {
|
|
44
|
+
return { pruned: 0 };
|
|
45
|
+
}
|
|
46
|
+
const result = db
|
|
47
|
+
.prepare(`DELETE FROM dream_insights
|
|
48
|
+
WHERE applied = 0
|
|
49
|
+
AND created_at < datetime('now', ?)`)
|
|
50
|
+
.run(`-${retentionDays} days`);
|
|
51
|
+
return { pruned: result.changes };
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=dream-insights-pruner.js.map
|
|
@@ -17,6 +17,9 @@ import { LoggerFactory } from '../../logging/index.js';
|
|
|
17
17
|
// ADR-062: Meta-learning integration
|
|
18
18
|
import { MetaLearningEngine, DEFAULT_META_LEARNING_CONFIG, } from '../aqe-learning-engine.js';
|
|
19
19
|
import { LearningMetricsTracker, } from '../metrics-tracker.js';
|
|
20
|
+
// ADR-094 / #488 B.2: record per-tick liveness so `aqe learning loop-health`
|
|
21
|
+
// surfaces the kernel-side dream loop as live.
|
|
22
|
+
import { recordLoopHealth } from '../loop-health.js';
|
|
20
23
|
const logger = LoggerFactory.create('DreamScheduler');
|
|
21
24
|
/**
|
|
22
25
|
* Default DreamScheduler configuration
|
|
@@ -333,6 +336,7 @@ export class DreamScheduler {
|
|
|
333
336
|
}
|
|
334
337
|
this.dreaming = true;
|
|
335
338
|
logger.info('Starting dream cycle', { durationMs });
|
|
339
|
+
let dreamError;
|
|
336
340
|
try {
|
|
337
341
|
// Ensure concepts are loaded before dreaming
|
|
338
342
|
const loaded = await this.dreamEngine.ensureConceptsLoaded();
|
|
@@ -372,8 +376,21 @@ export class DreamScheduler {
|
|
|
372
376
|
logger.info('Dream completed', { insightsGenerated: result.insights.length });
|
|
373
377
|
return result;
|
|
374
378
|
}
|
|
379
|
+
catch (err) {
|
|
380
|
+
dreamError = err instanceof Error ? err : new Error(String(err));
|
|
381
|
+
throw err;
|
|
382
|
+
}
|
|
375
383
|
finally {
|
|
376
384
|
this.dreaming = false;
|
|
385
|
+
// ADR-094 / #488 B.2: record liveness so `aqe learning loop-health`
|
|
386
|
+
// can show the kernel-side dream scheduler as live. Best-effort —
|
|
387
|
+
// recordLoopHealth itself never throws.
|
|
388
|
+
if (this.memoryBackend) {
|
|
389
|
+
await recordLoopHealth(this.memoryBackend, 'dreamScheduler', {
|
|
390
|
+
success: !dreamError,
|
|
391
|
+
error: dreamError,
|
|
392
|
+
});
|
|
393
|
+
}
|
|
377
394
|
}
|
|
378
395
|
}
|
|
379
396
|
/**
|