agentic-qe 3.13.12 → 3.14.1
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/helpers/brain-checkpoint.cjs +2 -1
- package/.claude/helpers/validate-v3-config.sh +6 -5
- package/.claude/hooks/aqe-hook.cjs +14 -14
- package/.claude/skills/qe-browser/evals/qe-browser.yaml +30 -41
- package/.claude/skills/qe-browser/fixtures/serve-skills.js +37 -0
- package/.claude/skills/qe-browser/scripts/lib/vibium.js +1 -1
- package/.claude/skills/qe-browser/scripts/smoke-test.sh +56 -25
- package/.claude/skills/qe-browser/scripts/visual-diff.js +24 -15
- package/.claude/skills/qe-court/SKILL.md +4 -4
- package/.claude/skills/qe-court/config-schema.json +38 -0
- package/.claude/skills/qe-court/evals/qe-court.yaml +8 -8
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +130 -0
- package/assets/skills/qe-browser/evals/qe-browser.yaml +30 -41
- package/assets/skills/qe-browser/fixtures/serve-skills.js +37 -0
- package/assets/skills/qe-browser/scripts/lib/vibium.js +1 -1
- package/assets/skills/qe-browser/scripts/smoke-test.sh +56 -25
- package/assets/skills/qe-browser/scripts/visual-diff.js +24 -15
- package/assets/skills/qe-court/SKILL.md +4 -4
- package/assets/skills/qe-court/config-schema.json +38 -0
- package/assets/skills/qe-court/evals/qe-court.yaml +8 -8
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/cli/brain-commands.d.ts +1 -0
- package/dist/cli/brain-commands.js +1 -0
- package/dist/cli/bundle.js +7 -7
- package/dist/cli/chunks/adapter-I2N7PEKG.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-7I7LZFNC.js → agent-booster-wasm-OY5Y2CUM.js} +2 -2
- package/dist/cli/chunks/{agent-handler-QZZT52BH.js → agent-handler-TUOH55LD.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-MLQS5Y26.js → agent-memory-branch-XM3IYKT3.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-U4ALUH6A.js +2 -0
- package/dist/cli/chunks/{arena-WRIY37EJ.js → arena-DOCLIEBL.js} +4 -4
- package/dist/cli/chunks/{arena-IM4CP6LP.js → arena-UMFJZKG7.js} +2 -2
- package/dist/cli/chunks/{audit-BSAQ4EFN.js → audit-KZLU5VLW.js} +3 -3
- package/dist/cli/chunks/base-RCYIBNHM.js +2 -0
- package/dist/cli/chunks/{better-sqlite3-X2XZUXWZ.js → better-sqlite3-MIEZBNUI.js} +2 -2
- package/dist/cli/chunks/brain-handler-6PZN46B7.js +90 -0
- package/dist/cli/chunks/{branch-enumerator-NI4Q7DSJ.js → branch-enumerator-XCETHA4F.js} +2 -2
- package/dist/cli/chunks/{browser-PXBLORUZ.js → browser-UEXISDCJ.js} +2 -2
- package/dist/cli/chunks/browser-workflow-L6TDB5O5.js +2 -0
- package/dist/cli/chunks/{chunk-5PNQNBDZ.js → chunk-3AYNHOWS.js} +1 -1
- package/dist/cli/chunks/{chunk-NL2SCAGJ.js → chunk-3BRR2FLH.js} +3 -3
- package/dist/cli/chunks/chunk-3FFMUB3B.js +14 -0
- package/dist/cli/chunks/{chunk-GJJWXRAD.js → chunk-3JMSXOU4.js} +2 -2
- package/dist/cli/chunks/{chunk-MB2KLJ6Q.js → chunk-3TMUCJNJ.js} +1 -1
- package/dist/cli/chunks/{chunk-JVFZAJ5N.js → chunk-3WSH4HD2.js} +2 -2
- package/dist/cli/chunks/{chunk-SCQNISGS.js → chunk-3XRXUVUI.js} +1 -1
- package/dist/cli/chunks/{chunk-Z56BBX77.js → chunk-45S5553E.js} +2 -2
- package/dist/cli/chunks/{chunk-6BSZHNOC.js → chunk-4MT62HKK.js} +1 -1
- package/dist/cli/chunks/{chunk-PVINNJ4P.js → chunk-4ZLFUO4I.js} +2 -2
- package/dist/cli/chunks/{chunk-MYVKTG55.js → chunk-5F5V4QYU.js} +3 -3
- package/dist/cli/chunks/{chunk-2W3D5A4R.js → chunk-5KP62DC3.js} +2 -2
- package/dist/cli/chunks/{chunk-BODFJ3DC.js → chunk-5NSSJUWW.js} +2 -2
- package/dist/cli/chunks/{chunk-KXSUDN46.js → chunk-5T6PAUZD.js} +1 -1
- package/dist/cli/chunks/{chunk-7ZVO7I4Q.js → chunk-5TYGSQOL.js} +1 -1
- package/dist/cli/chunks/{chunk-M7CPJW53.js → chunk-5Y2QFSVZ.js} +2 -2
- package/dist/cli/chunks/{chunk-VQD2ELNL.js → chunk-6B77GPWL.js} +2 -2
- package/dist/cli/chunks/{chunk-GJUGG6UR.js → chunk-6DDMHZWH.js} +2 -2
- package/dist/cli/chunks/{chunk-IPZEBALY.js → chunk-6HMNN2Y2.js} +54 -54
- package/dist/cli/chunks/{chunk-M73KM3AZ.js → chunk-6YIMLUH6.js} +160 -26
- package/dist/cli/chunks/{chunk-UBOGJHWC.js → chunk-6Z6Y3YBX.js} +1 -1
- package/dist/cli/chunks/{chunk-M3354CE4.js → chunk-75SC3GEX.js} +2 -2
- package/dist/cli/chunks/{chunk-TJVTV3HP.js → chunk-7AF55H2D.js} +2 -2
- package/dist/cli/chunks/{chunk-3XVZHJQT.js → chunk-7AYTM426.js} +1 -1
- package/dist/cli/chunks/{chunk-U5G6OC2C.js → chunk-7GF6IRSU.js} +2 -2
- package/dist/cli/chunks/{chunk-LRO74LPA.js → chunk-7XL2D56F.js} +4 -4
- package/dist/cli/chunks/{chunk-MGKH4LCM.js → chunk-A6RB34Y6.js} +1 -1
- package/dist/cli/chunks/{chunk-X2SZCVDA.js → chunk-AESYVAPH.js} +8 -7
- package/dist/cli/chunks/{chunk-3ASVQILY.js → chunk-AZUC7E5S.js} +2 -2
- package/dist/cli/chunks/{chunk-R7LGVJMZ.js → chunk-B6Y6AF4M.js} +2 -2
- package/dist/cli/chunks/chunk-C3XNFIOM.js +2 -0
- package/dist/cli/chunks/{chunk-ZSAGRDXA.js → chunk-CBWF42ET.js} +2 -2
- package/dist/cli/chunks/{chunk-VNODKACB.js → chunk-CCZZZBAO.js} +2 -2
- package/dist/cli/chunks/{chunk-5E76HULA.js → chunk-CGDW47WP.js} +2 -2
- package/dist/cli/chunks/chunk-CGZ7LTUK.js +2 -0
- package/dist/cli/chunks/{chunk-6KI6LAAZ.js → chunk-D6RCRTTR.js} +2 -2
- package/dist/cli/chunks/{chunk-TB2N3CAK.js → chunk-DFXQLHQM.js} +2 -2
- package/dist/cli/chunks/chunk-DKSLJZVA.js +2 -0
- package/dist/cli/chunks/{chunk-JTYCOFTD.js → chunk-DKUKGBJE.js} +1 -1
- package/dist/cli/chunks/{chunk-AN5CGTTJ.js → chunk-DKXSJDII.js} +2 -2
- package/dist/cli/chunks/chunk-EEJP3WTQ.js +4 -0
- package/dist/cli/chunks/{chunk-ZMYV4R32.js → chunk-EHW62JL2.js} +1 -1
- package/dist/cli/chunks/{chunk-WYFAPA2G.js → chunk-EPBWFTHH.js} +2 -2
- package/dist/cli/chunks/{chunk-P6EFKHNI.js → chunk-ERTGGFXZ.js} +2 -2
- package/dist/cli/chunks/{chunk-G45AOQDZ.js → chunk-F7TRO2OM.js} +1 -1
- package/dist/cli/chunks/{chunk-XT473WPO.js → chunk-FFRKTZYP.js} +2 -2
- package/dist/cli/chunks/{chunk-5VSS2RBD.js → chunk-FH7SCX2I.js} +2 -2
- package/dist/cli/chunks/{chunk-44NPKZGI.js → chunk-FHBGALBG.js} +2 -2
- package/dist/cli/chunks/{chunk-NTALX2YC.js → chunk-FOAFRC2W.js} +2 -2
- package/dist/cli/chunks/{chunk-7LATB5IR.js → chunk-FPBQ7BXU.js} +2 -2
- package/dist/cli/chunks/{chunk-AKUDUB3O.js → chunk-FRRRDCXY.js} +2 -2
- package/dist/cli/chunks/{chunk-NG6A7LCG.js → chunk-FZ47ZCRL.js} +1 -1
- package/dist/cli/chunks/{chunk-VD53LBF7.js → chunk-GH3NJOTC.js} +3 -3
- package/dist/cli/chunks/{chunk-NDRZZSD5.js → chunk-GO66DCIZ.js} +2 -2
- package/dist/cli/chunks/{chunk-Z6DSYLAG.js → chunk-GRVR3Y6I.js} +1 -1
- package/dist/cli/chunks/chunk-GYTWUOKU.js +65 -0
- package/dist/cli/chunks/{chunk-6KKVMPPR.js → chunk-H2DX36SC.js} +2 -2
- package/dist/cli/chunks/{chunk-NJ3QXJ54.js → chunk-H5LSXVWY.js} +2 -2
- package/dist/cli/chunks/{chunk-HQWFZQMJ.js → chunk-HBAQVJDP.js} +2 -2
- package/dist/cli/chunks/{chunk-33YZGOT6.js → chunk-HCCILQGN.js} +2 -2
- package/dist/cli/chunks/{chunk-KRZYWVS3.js → chunk-HJD52N32.js} +2 -2
- package/dist/cli/chunks/{chunk-IPDM3CAK.js → chunk-HKU5PPS7.js} +1 -1
- package/dist/cli/chunks/{chunk-7RVLVIAI.js → chunk-HPQU6XZH.js} +1 -1
- package/dist/cli/chunks/{chunk-TWUWLSGQ.js → chunk-HRUQWABO.js} +10 -10
- package/dist/cli/chunks/{chunk-HAJG44BD.js → chunk-IGRTQ6VT.js} +2 -2
- package/dist/cli/chunks/{chunk-WXU7FAEB.js → chunk-IIBXGHZT.js} +2 -2
- package/dist/cli/chunks/{chunk-QG5L2JM5.js → chunk-IYB3GRXF.js} +10 -10
- package/dist/cli/chunks/{chunk-NNLZAVFH.js → chunk-IYIMLLUV.js} +1 -1
- package/dist/cli/chunks/{chunk-SXFSJJZF.js → chunk-J2VF7ZO7.js} +2 -2
- package/dist/cli/chunks/{chunk-4FVOJBEU.js → chunk-J33LKXVH.js} +1 -1
- package/dist/cli/chunks/{chunk-IOJ34SXJ.js → chunk-J7VAD4RG.js} +2 -2
- package/dist/cli/chunks/{chunk-VQCLSX7T.js → chunk-JJ4GUO4K.js} +1 -1
- package/dist/cli/chunks/{chunk-QM4Z7TQH.js → chunk-JMULRLD4.js} +1 -1
- package/dist/cli/chunks/{chunk-LXVT6JXO.js → chunk-JNSTKE3K.js} +2 -2
- package/dist/cli/chunks/{chunk-SOS37ECY.js → chunk-JZUWPDVS.js} +1 -1
- package/dist/cli/chunks/chunk-KHUO4NCW.js +11 -0
- package/dist/cli/chunks/chunk-KXMW7XTJ.js +2 -0
- package/dist/cli/chunks/{chunk-4AITMWFZ.js → chunk-KXTN3FR4.js} +2 -2
- package/dist/cli/chunks/{chunk-4Z4X2ND4.js → chunk-L4WATX6B.js} +2 -2
- package/dist/cli/chunks/{chunk-GMLRIZ4E.js → chunk-L66BWYQH.js} +1 -1
- package/dist/cli/chunks/{chunk-52VGZJSD.js → chunk-LJ63HPPN.js} +1 -1
- package/dist/cli/chunks/{chunk-WE3VKDMK.js → chunk-LMPK63PO.js} +3 -3
- package/dist/cli/chunks/{chunk-S6WHYOWV.js → chunk-LQDFWLKK.js} +27 -25
- package/dist/cli/chunks/{chunk-EG73WYAW.js → chunk-LSXQPMPI.js} +2 -2
- package/dist/cli/chunks/{chunk-NJ4YVAG7.js → chunk-MDLLEUFN.js} +3 -3
- package/dist/cli/chunks/{chunk-YQOQVSYU.js → chunk-MFAN5W27.js} +1 -1
- package/dist/cli/chunks/{chunk-A5RWLPVT.js → chunk-MZ2PJUN6.js} +2 -2
- package/dist/cli/chunks/{chunk-HRTSYT4N.js → chunk-N22LMACN.js} +2 -2
- package/dist/cli/chunks/{chunk-L3GBNX7B.js → chunk-NAJCQJSK.js} +2 -2
- package/dist/cli/chunks/{chunk-XM5I7J5S.js → chunk-ND6JBUVH.js} +2 -2
- package/dist/cli/chunks/{chunk-YL2GOJF6.js → chunk-NEEZ6M4W.js} +2 -2
- package/dist/cli/chunks/{chunk-DGFINXUE.js → chunk-NNJ63W77.js} +1 -1
- package/dist/cli/chunks/{chunk-G6FJHDUG.js → chunk-O7KF3GBV.js} +1 -1
- package/dist/cli/chunks/{chunk-RP2BRRLX.js → chunk-OBKMLOHU.js} +2 -2
- package/dist/cli/chunks/{chunk-AOOCV56W.js → chunk-OBLHI4HA.js} +1 -1
- package/dist/cli/chunks/{chunk-OZ53BIY5.js → chunk-ODNLKYOM.js} +1 -1
- package/dist/cli/chunks/{chunk-VBHA4SDU.js → chunk-PMREFRPP.js} +2 -2
- package/dist/cli/chunks/{chunk-ASWWBNX2.js → chunk-PMUF7WU6.js} +2 -2
- package/dist/cli/chunks/{chunk-I5SXLV7D.js → chunk-PS5NIMWJ.js} +2 -2
- package/dist/cli/chunks/chunk-PS6Y662P.js +13 -0
- package/dist/cli/chunks/{chunk-N4OQ4D4V.js → chunk-PYAH4K2U.js} +2 -2
- package/dist/cli/chunks/{chunk-H3GAR4SV.js → chunk-PZZX57ZA.js} +2 -2
- package/dist/cli/chunks/chunk-QAE4BOIV.js +2 -0
- package/dist/cli/chunks/{chunk-7A4WTRWI.js → chunk-QIY43XQJ.js} +1 -1
- package/dist/cli/chunks/{chunk-MLXLGBQZ.js → chunk-QM6EJHP5.js} +1 -1
- package/dist/cli/chunks/{chunk-4ANJV6I4.js → chunk-QMTBWHGR.js} +3 -3
- package/dist/cli/chunks/{chunk-IT5QIUUA.js → chunk-RCHDSUVU.js} +2 -2
- package/dist/cli/chunks/{chunk-AYH3DMW2.js → chunk-RUEHSOE6.js} +1 -1
- package/dist/cli/chunks/{chunk-DCVFHVPR.js → chunk-RVCMZUSJ.js} +2 -2
- package/dist/cli/chunks/{chunk-2JAC57JE.js → chunk-RXHI6CKK.js} +1 -1
- package/dist/cli/chunks/{chunk-QXO35J6F.js → chunk-RXPHQ4ZE.js} +2 -2
- package/dist/cli/chunks/{chunk-FI6J3UHJ.js → chunk-RYHCYTFE.js} +1 -1
- package/dist/cli/chunks/{chunk-DFLASG3B.js → chunk-S4WIAKPL.js} +1 -1
- package/dist/cli/chunks/{chunk-2VY7FL6A.js → chunk-S53ZUAVI.js} +2 -2
- package/dist/cli/chunks/{chunk-4M7YZ2X7.js → chunk-SEKOMKNG.js} +1 -1
- package/dist/cli/chunks/{chunk-UC4EIULB.js → chunk-SZRDEPUY.js} +19 -19
- package/dist/cli/chunks/chunk-T7XYQX5G.js +24 -0
- package/dist/cli/chunks/{chunk-OG3DBHIV.js → chunk-TF33GKWA.js} +2 -2
- package/dist/cli/chunks/{chunk-2VTX4SYW.js → chunk-TGFJUL6M.js} +2 -2
- package/dist/cli/chunks/{chunk-4THFPRFM.js → chunk-TLD727EF.js} +2 -2
- package/dist/cli/chunks/{chunk-7PCIN7UN.js → chunk-TQ2JZVZ3.js} +2 -2
- package/dist/cli/chunks/{chunk-UWZYXI3R.js → chunk-TT7DF2GX.js} +2 -2
- package/dist/cli/chunks/{chunk-X3JNFQW2.js → chunk-UCJEAK7D.js} +2 -2
- package/dist/cli/chunks/{chunk-AM42ROKZ.js → chunk-UN7EHLRV.js} +1 -1
- package/dist/cli/chunks/{chunk-42AS3HPO.js → chunk-UUE5CBZQ.js} +2 -2
- package/dist/cli/chunks/{chunk-E67ZXRG6.js → chunk-UWRMPRY5.js} +1 -1
- package/dist/cli/chunks/{chunk-4YFXF5AQ.js → chunk-VEWYUEVY.js} +5 -5
- package/dist/cli/chunks/{chunk-UJUK6T4V.js → chunk-VUXHJPUS.js} +2 -2
- package/dist/cli/chunks/{chunk-VA2ORJB5.js → chunk-VVP2ROXD.js} +2 -2
- package/dist/cli/chunks/{chunk-BZIPYXSW.js → chunk-WFJKLM6Z.js} +3 -3
- package/dist/cli/chunks/{chunk-MLFELTJX.js → chunk-X5G3UDWP.js} +2 -2
- package/dist/cli/chunks/{chunk-IQH2RDN3.js → chunk-Y63V33M6.js} +5 -5
- package/dist/cli/chunks/{chunk-XIKYUBIV.js → chunk-YXN47QOI.js} +2 -2
- package/dist/cli/chunks/{chunk-RP5VFZJO.js → chunk-Z5YU2TDS.js} +2 -2
- package/dist/cli/chunks/{chunk-KYJBJ56M.js → chunk-ZAHCVRR7.js} +2 -2
- package/dist/cli/chunks/{chunk-66OQ7AB3.js → chunk-ZC3HC6FO.js} +1 -1
- package/dist/cli/chunks/{ci-QAUD62WH.js → ci-Q2VX75PS.js} +2 -2
- package/dist/cli/chunks/{ci-output-TZDVTNE7.js → ci-output-MD5GTVR2.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-ZWPHJ7YJ.js → circuit-breaker-JMRLG2XI.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-SCB4EURN.js → claude-flow-setup-IMXYALBU.js} +2 -2
- package/dist/cli/chunks/client-L4PIXCGV.js +2 -0
- package/dist/cli/chunks/{cline-installer-EHZLMLXF.js → cline-installer-HWFASEGE.js} +2 -2
- package/dist/cli/chunks/{code-3N6PBJMK.js → code-3V37TCAD.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-6DIKHNRI.js → code-index-extractor-5V54WGFL.js} +2 -2
- package/dist/cli/chunks/codex-installer-UCA5AVE6.js +14 -0
- package/dist/cli/chunks/{completions-5MKWWCCE.js → completions-2DMRCQU6.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-TPM4IPEK.js → complexity-analyzer-MMQRXBTD.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-VXODKGVX.js → continuedev-installer-FAARXP3S.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-PVD5O56P.js → copilot-installer-AKQALMB5.js} +2 -2
- package/dist/cli/chunks/core-handlers-KROSXP4V.js +2 -0
- package/dist/cli/chunks/{cost-tracker-JOMZEQF3.js → cost-tracker-AXWHDND5.js} +2 -2
- package/dist/cli/chunks/{coverage-HTXLEV3B.js → coverage-ZLSKKCG5.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-WMTYBOON.js +2 -0
- package/dist/cli/chunks/{cursor-installer-SHKDTDDZ.js → cursor-installer-UALCQKVD.js} +2 -2
- package/dist/cli/chunks/{daemon-FCFEWVVJ.js → daemon-4LNOPJGN.js} +3 -3
- package/dist/cli/chunks/{daemon-PN4FEPLE.js → daemon-K3DFGCXC.js} +4 -4
- package/dist/cli/chunks/{dag-attention-scheduler-PLOHU5SR.js → dag-attention-scheduler-LCQ7MYKC.js} +2 -2
- package/dist/cli/chunks/{detect-F3H4ZEZY.js → detect-P7PEN3MZ.js} +2 -2
- package/dist/cli/chunks/{dist-node-5TC665N6.js → dist-node-I72BJC2D.js} +2 -2
- package/dist/cli/chunks/{domain-handler-ZIWVFXCU.js → domain-handler-LROF6KWN.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-7Q5JYMYR.js → domain-transfer-M2ZSSTPV.js} +2 -2
- package/dist/cli/chunks/dream-AV63YQ2Y.js +2 -0
- package/dist/cli/chunks/embed-and-insert-pattern-MTBPUGO4.js +3 -0
- package/dist/cli/chunks/{eval-E2K2T75A.js → eval-O24ALB3W.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-Z5SE2O53.js → experience-capture-middleware-7JXEOGRE.js} +3 -3
- package/dist/cli/chunks/{fast-paths-3H52RSUK.js → fast-paths-4CFYJV4U.js} +2 -2
- package/dist/cli/chunks/{feature-flags-ONIKUZVK.js → feature-flags-CHPUA7IM.js} +2 -2
- package/dist/cli/chunks/{feature-flags-LUHSMHPS.js → feature-flags-E6PIM6ZB.js} +2 -2
- package/dist/cli/chunks/{file-discovery-FLYSYSS4.js → file-discovery-2ANIAUCP.js} +2 -2
- package/dist/cli/chunks/{fleet-6OJUAAKV.js → fleet-2MQ3OGCP.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-PUL6B7KZ.js → gnn-wrapper-P7JW3622.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-HGHHDUDY.js → heartbeat-handler-WWWZSA7V.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-5IZUGMC2.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-NV2NNBJL.js +2 -0
- package/dist/cli/chunks/hnsw-index-GRJ3KA2O.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-NDZSNMYX.js → hnsw-legacy-bridge-W634ZOTV.js} +2 -2
- package/dist/cli/chunks/{hnswlib-node-PISLKSO2.js → hnswlib-node-SLZDLMKM.js} +2 -2
- package/dist/cli/chunks/{hooks-WYG54MRI.js → hooks-3BFAZGG7.js} +10 -10
- package/dist/cli/chunks/{hypergraph-engine-EDHKHZZ2.js → hypergraph-engine-XJSGXP2J.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-OCHZAPPL.js → hypergraph-handler-RVUWZMOX.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-YM4QUWVH.js +2 -0
- package/dist/cli/chunks/{init-handler-5TCJ672H.js → init-handler-FYOZNNNO.js} +9 -8
- package/dist/cli/chunks/init-wizard-YESXGIK6.js +2 -0
- package/dist/cli/chunks/kernel-VH5SKESU.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-SWUQRCTZ.js → kilocode-installer-MAAKFVSB.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-L22EBAM5.js → kiro-installer-GX3TLZC5.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-F3NL4WJV.js +2 -0
- package/dist/cli/chunks/learning-T4QZ6C26.js +122 -0
- package/dist/cli/chunks/{llm-router-F2L4LFT2.js → llm-router-N2M4WXOC.js} +14 -14
- package/dist/cli/chunks/llm-router-service-HQYCJMPK.js +2 -0
- package/dist/cli/chunks/{load-A4ZF2KHC.js → load-6RU3G4P2.js} +2 -2
- package/dist/cli/chunks/load-test-GWRGKWMN.js +2 -0
- package/dist/cli/chunks/{mcp-T2Z46NNK.js → mcp-EFBO7BAU.js} +2 -2
- package/dist/cli/chunks/{memory-PUC3J6XC.js → memory-AXU2M3DN.js} +5 -5
- package/dist/cli/chunks/memory-backend-7A2PFKPV.js +2 -0
- package/dist/cli/chunks/memory-handlers-65CXN76C.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-U5L4FI4O.js → multi-model-executor-W7AFGVNH.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-UWI6KHYH.js → opencode-installer-KJE2RLCH.js} +2 -2
- package/dist/cli/chunks/{orchestrator-3BEI7R5D.js → orchestrator-CL6MLGVU.js} +22 -24
- package/dist/cli/chunks/pattern-null-store-K2WPRYCP.js +2 -0
- package/dist/cli/chunks/{pattern-usage-recorder-EGWUI5LU.js → pattern-usage-recorder-7SNSJ7K2.js} +2 -2
- package/dist/cli/chunks/{pipeline-JG6M4RHD.js → pipeline-3UU6ON3F.js} +2 -2
- package/dist/cli/chunks/platform-SNMPIDIT.js +2 -0
- package/dist/cli/chunks/{plugin-EEGN3PMK.js → plugin-65IIUUCU.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-7KZAINFT.js → prime-radiant-advanced-wasm-WWWJRLRP.js} +2 -2
- package/dist/cli/chunks/protocol-executor-TJDLEHND.js +2 -0
- package/dist/cli/chunks/{protocol-handler-UCEHYK2R.js → protocol-handler-SEBHCLLJ.js} +2 -2
- package/dist/cli/chunks/{prove-JSNG75VD.js → prove-N4X7CCJ4.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-CGRMFPDM.js +2 -0
- package/dist/cli/chunks/{quality-7SRM2HBM.js → quality-LBCJWXMU.js} +2 -2
- package/dist/cli/chunks/quality-gate-KZIQI7QT.js +7 -0
- package/dist/cli/chunks/queen-coordinator-FKP6QZAQ.js +2 -0
- package/dist/cli/chunks/real-embeddings-XCZFHFME.js +2 -0
- package/dist/cli/chunks/{roocode-installer-UYQK64BZ.js → roocode-installer-P3O6B7PT.js} +2 -2
- package/dist/cli/chunks/router-KZ5BISAM.js +2 -0
- package/dist/cli/chunks/routing-feedback-O4Y5TTR6.js +2 -0
- package/dist/cli/chunks/{routing-handler-PY3KPDTH.js → routing-handler-OXZ4DOV4.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-GCAOUTYS.js → ruvector-commands-PSY5IDSL.js} +2 -2
- package/dist/cli/chunks/rvf-dual-writer-NG3UF3D5.js +2 -0
- package/dist/cli/chunks/rvf-migration-adapter-PUHVTKQY.js +2 -0
- package/dist/cli/chunks/rvf-migration-coordinator-4SUT7GTJ.js +2 -0
- package/dist/cli/chunks/rvf-native-adapter-ODXFKZ6G.js +2 -0
- package/dist/cli/chunks/{rvf-store-integrity-HNDKOM4L.js → rvf-store-integrity-TCKC22FH.js} +2 -2
- package/dist/cli/chunks/safe-db-BUQDNH2R.js +2 -0
- package/dist/cli/chunks/schedule-ZXNDZNNB.js +2 -0
- package/dist/cli/chunks/scheduler-YUQQWWW3.js +2 -0
- package/dist/cli/chunks/{security-MQ2VB7PY.js → security-RQGUQGSI.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-TAZEU6QK.js → shared-rvf-adapter-ZJFN52C2.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-B7N6AOCY.js → shared-rvf-dual-writer-V2R37HWV.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-HVSX46C7.js +2 -0
- package/dist/cli/chunks/{status-handler-NZP7DFHE.js → status-handler-XEKWNVDR.js} +2 -2
- package/dist/cli/chunks/{structural-health-ALLUQ4X6.js → structural-health-QMIW6WUN.js} +2 -2
- package/dist/cli/chunks/{sync-WJJG5J6V.js → sync-GDYJ2ULT.js} +2 -2
- package/dist/cli/chunks/{sync-MM7OCUYD.js → sync-H5SXWXPP.js} +2 -2
- package/dist/cli/chunks/{task-handler-CAQUEEB4.js → task-handler-EPLKCQHY.js} +2 -2
- package/dist/cli/chunks/{task-handlers-25BJ7D3W.js → task-handlers-22NTLWTC.js} +3 -3
- package/dist/cli/chunks/{test-HW7GVGVN.js → test-WHJFRZ3F.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-HTMFJMSP.js → test-scheduling-KZVFZOQN.js} +3 -3
- package/dist/cli/chunks/token-bootstrap-BW5WA6PY.js +2 -0
- package/dist/cli/chunks/{token-usage-RJZDMBDP.js → token-usage-4A4O57R6.js} +2 -2
- package/dist/cli/chunks/{transformers-3YFW3EUO.js → transformers-FYTBRV46.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-U3PQPIK7.js → tree-sitter-wasm-parser-TZIJPLF3.js} +2 -2
- package/dist/cli/chunks/{types-7Q762WDO.js → types-B2L6LKFA.js} +2 -2
- package/dist/cli/chunks/unified-memory-AHN4RVBP.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-XB7JPF74.js +2 -0
- package/dist/cli/chunks/unified-persistence-53KWNFQJ.js +2 -0
- package/dist/cli/chunks/{upgrade-F7MKJWBQ.js → upgrade-O6U7EA7V.js} +2 -2
- package/dist/cli/chunks/{validate-B27AVRA6.js → validate-FHNZ5XL3.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-GYZR3GNL.js → validate-swarm-YOLLUEHE.js} +2 -2
- package/dist/cli/chunks/{vibium-W4XQMPJP.js → vibium-UXRPEIXB.js} +2 -2
- package/dist/cli/chunks/visual-security-CRPYS7L7.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-I7CDCFJU.js → web-tree-sitter-JJ5UIYFD.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-UYLHFDHU.js → windsurf-installer-I4QMQPIL.js} +2 -2
- package/dist/cli/chunks/witness-chain-5WCR2CAS.js +2 -0
- package/dist/cli/chunks/{witness-chain-B66SYZKU.js → witness-chain-BIJ7WDGS.js} +2 -2
- package/dist/cli/chunks/{witness-key-manager-U4JPAHVW.js → witness-key-manager-3SMMLJLP.js} +2 -2
- package/dist/cli/chunks/{workflow-DYMO47FF.js → workflow-33PUXXJV.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-RZWCLTT5.js +2 -0
- package/dist/cli/chunks/{wrappers-7S6DQTEA.js → wrappers-ASAU36VK.js} +2 -2
- package/dist/cli/commands/learning.js +44 -0
- package/dist/cli/commands/llm-router.js +27 -21
- package/dist/cli/commands/platform.d.ts +1 -0
- package/dist/cli/commands/platform.js +28 -6
- package/dist/cli/commands/quality-gate.js +25 -3
- package/dist/cli/handlers/brain-handler.js +2 -0
- package/dist/cli/handlers/init-handler.d.ts +5 -0
- package/dist/cli/handlers/init-handler.js +6 -0
- package/dist/cli/index.js +4 -1
- package/dist/context/compaction/index.d.ts +1 -0
- package/dist/context/compaction/index.js +3 -0
- package/dist/context/compaction/instruction-provenance.d.ts +20 -0
- package/dist/context/compaction/instruction-provenance.js +18 -0
- package/dist/context/compaction/tier2-session-summary.d.ts +8 -0
- package/dist/context/compaction/tier2-session-summary.js +20 -0
- package/dist/context/compaction/tier3-llm-compact.d.ts +4 -0
- package/dist/context/compaction/tier3-llm-compact.js +32 -4
- package/dist/contracts/verdicts.d.ts +625 -0
- package/dist/contracts/verdicts.js +202 -14
- package/dist/coordination/handlers/coverage-handlers.js +8 -1
- package/dist/domains/chaos-resilience/diagnosis/corpus.d.ts +5 -0
- package/dist/domains/chaos-resilience/diagnosis/corpus.js +141 -0
- package/dist/domains/chaos-resilience/diagnosis/detectors.d.ts +11 -0
- package/dist/domains/chaos-resilience/diagnosis/detectors.js +109 -0
- package/dist/domains/chaos-resilience/diagnosis/index.d.ts +5 -0
- package/dist/domains/chaos-resilience/diagnosis/index.js +5 -0
- package/dist/domains/chaos-resilience/diagnosis/scorer.d.ts +8 -0
- package/dist/domains/chaos-resilience/diagnosis/scorer.js +128 -0
- package/dist/domains/chaos-resilience/diagnosis/types.d.ts +171 -0
- package/dist/domains/chaos-resilience/diagnosis/types.js +3 -0
- package/dist/domains/chaos-resilience/index.d.ts +1 -0
- package/dist/domains/chaos-resilience/index.js +1 -0
- package/dist/domains/index.d.ts +1 -0
- package/dist/domains/index.js +1 -0
- package/dist/early-exit/early-exit-controller.d.ts +4 -2
- package/dist/early-exit/early-exit-controller.js +95 -7
- package/dist/early-exit/index.d.ts +1 -1
- package/dist/early-exit/speculative-executor.js +3 -0
- package/dist/early-exit/types.d.ts +51 -0
- package/dist/early-exit/types.js +3 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -1
- package/dist/init/browser-engine-installer.d.ts +11 -0
- package/dist/init/browser-engine-installer.js +35 -5
- package/dist/init/codex-installer.d.ts +11 -1
- package/dist/init/codex-installer.js +90 -24
- package/dist/init/init-wizard-hooks.js +11 -11
- package/dist/init/orchestrator.js +2 -0
- package/dist/init/phases/07-hooks.d.ts +3 -3
- package/dist/init/phases/07-hooks.js +19 -21
- package/dist/init/phases/09-assets.d.ts +4 -0
- package/dist/init/phases/09-assets.js +13 -10
- package/dist/init/phases/phase-interface.d.ts +2 -0
- package/dist/init/types.d.ts +4 -0
- package/dist/integrations/embeddings/base/EmbeddingGenerator.js +4 -2
- package/dist/integrations/ruvector/brain-exporter.d.ts +1 -1
- package/dist/integrations/ruvector/brain-exporter.js +15 -3
- package/dist/integrations/ruvector/brain-rvf-exporter.d.ts +4 -0
- package/dist/integrations/ruvector/brain-rvf-exporter.js +118 -37
- package/dist/integrations/ruvector/brain-search.d.ts +1 -1
- package/dist/integrations/ruvector/brain-search.js +1 -1
- package/dist/integrations/ruvector/brain-shared.d.ts +4 -2
- package/dist/integrations/ruvector/brain-shared.js +11 -4
- package/dist/integrations/ruvector/brain-table-ddl.d.ts +2 -2
- package/dist/integrations/ruvector/brain-table-ddl.js +20 -8
- package/dist/integrations/ruvector/cognitive-container.js +1 -1
- package/dist/integrations/ruvector/rvf-dual-writer.d.ts +4 -0
- package/dist/integrations/ruvector/rvf-dual-writer.js +57 -9
- package/dist/integrations/ruvector/rvf-store-integrity.js +1 -1
- package/dist/kernel/unified-memory-schemas.d.ts +4 -3
- package/dist/kernel/unified-memory-schemas.js +19 -9
- package/dist/kernel/unified-memory.d.ts +2 -0
- package/dist/kernel/unified-memory.js +19 -0
- package/dist/learning/embed-and-insert-pattern.js +6 -3
- package/dist/learning/embedding-space.d.ts +50 -0
- package/dist/learning/embedding-space.js +128 -0
- package/dist/learning/evidence-admission-store.d.ts +15 -0
- package/dist/learning/evidence-admission-store.js +68 -0
- package/dist/learning/index.d.ts +7 -0
- package/dist/learning/index.js +4 -0
- package/dist/learning/learning-evidence-admission.d.ts +44 -0
- package/dist/learning/learning-evidence-admission.js +97 -0
- package/dist/learning/pattern-mutation-error.d.ts +9 -0
- package/dist/learning/pattern-mutation-error.js +14 -0
- package/dist/learning/pattern-store.d.ts +5 -0
- package/dist/learning/pattern-store.js +60 -9
- package/dist/learning/qe-flywheel/coupled-anchor.d.ts +8 -0
- package/dist/learning/qe-flywheel/coupled-anchor.js +46 -3
- package/dist/learning/qe-reasoning-bank.js +28 -5
- package/dist/learning/real-embeddings.d.ts +3 -0
- package/dist/learning/real-embeddings.js +40 -3
- package/dist/learning/real-qe-reasoning-bank.js +7 -3
- package/dist/learning/rvf-pattern-migration.d.ts +2 -0
- package/dist/learning/rvf-pattern-migration.js +5 -3
- package/dist/learning/rvf-pattern-store.d.ts +3 -0
- package/dist/learning/rvf-pattern-store.js +44 -6
- package/dist/learning/sqlite-persistence.d.ts +7 -2
- package/dist/learning/sqlite-persistence.js +58 -21
- package/dist/learning/structural-retrieval/corpus.d.ts +5 -0
- package/dist/learning/structural-retrieval/corpus.js +97 -0
- package/dist/learning/structural-retrieval/evaluate.d.ts +7 -0
- package/dist/learning/structural-retrieval/evaluate.js +124 -0
- package/dist/learning/structural-retrieval/index.d.ts +6 -0
- package/dist/learning/structural-retrieval/index.js +4 -0
- package/dist/learning/structural-retrieval/receipt.d.ts +14 -0
- package/dist/learning/structural-retrieval/receipt.js +36 -0
- package/dist/learning/structural-retrieval/types.d.ts +83 -0
- package/dist/learning/structural-retrieval/types.js +2 -0
- package/dist/mcp/bundle.js +589 -433
- package/dist/mcp/handlers/memory-handlers.js +6 -2
- package/dist/mcp/services/session-resume.d.ts +15 -19
- package/dist/mcp/services/session-resume.js +204 -194
- package/dist/mcp/tools/quality-assessment/gate.d.ts +8 -5
- package/dist/mcp/tools/quality-assessment/gate.js +9 -4
- package/dist/migrations/20260830_add_learning_evidence_tables.d.ts +7 -0
- package/dist/migrations/20260830_add_learning_evidence_tables.js +173 -0
- package/dist/persistence/rvf-migration-adapter.d.ts +2 -0
- package/dist/persistence/rvf-migration-adapter.js +56 -12
- package/dist/shared/llm/llm-router-service.d.ts +8 -0
- package/dist/shared/llm/llm-router-service.js +21 -3
- package/dist/shared/sql-safety.js +4 -0
- package/dist/skills/qe-court/cli.d.ts +3 -0
- package/dist/skills/qe-court/cli.js +54 -0
- package/dist/validation/quality-gate-runner.d.ts +27 -4
- package/dist/validation/quality-gate-runner.js +33 -4
- package/dist/validation/verification-reach.d.ts +90 -0
- package/dist/validation/verification-reach.js +187 -0
- package/dist/verification/adversarial-verify/calibrate.d.ts +46 -2
- package/dist/verification/adversarial-verify/calibrate.js +104 -2
- package/dist/verification/adversarial-verify/index.d.ts +2 -2
- package/dist/verification/adversarial-verify/index.js +1 -1
- package/dist/verification/adversarial-verify/measurement-receipt.d.ts +13 -0
- package/dist/verification/adversarial-verify/measurement-receipt.js +136 -0
- package/dist/verification/adversarial-verify/synthesize.js +7 -10
- package/dist/verification/adversarial-verify/types.d.ts +35 -0
- package/dist/verification/adversarial-verify/verify.js +6 -1
- package/package.json +14 -6
- package/schemas/coverage-gap.schema.json +41 -0
- package/schemas/finding-verdict.schema.json +470 -0
- package/schemas/risk-decision.schema.json +41 -0
- package/dist/cli/chunks/adapter-FUV6LBJT.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-QNFNA3J4.js +0 -2
- package/dist/cli/chunks/base-37W2XIXC.js +0 -2
- package/dist/cli/chunks/brain-handler-TVTTWZGP.js +0 -89
- package/dist/cli/chunks/browser-workflow-PDIUEK7B.js +0 -2
- package/dist/cli/chunks/chunk-5PI75QYP.js +0 -4
- package/dist/cli/chunks/chunk-EDRPTLAX.js +0 -2
- package/dist/cli/chunks/chunk-GEQWCK4F.js +0 -2
- package/dist/cli/chunks/chunk-GQLJYTXN.js +0 -2
- package/dist/cli/chunks/chunk-NLZUGANH.js +0 -11
- package/dist/cli/chunks/chunk-O4BWESH5.js +0 -2
- package/dist/cli/chunks/chunk-PGFCKE4G.js +0 -12
- package/dist/cli/chunks/chunk-RACWX2ZX.js +0 -9
- package/dist/cli/chunks/chunk-SNC73DWF.js +0 -2
- package/dist/cli/chunks/chunk-TDVMILKO.js +0 -2
- package/dist/cli/chunks/chunk-TK5XLF3Z.js +0 -65
- package/dist/cli/chunks/chunk-UQ4UCHO7.js +0 -2
- package/dist/cli/chunks/chunk-VZGP77YU.js +0 -12
- package/dist/cli/chunks/chunk-WA6CSEOX.js +0 -2
- package/dist/cli/chunks/chunk-WYIXNHPF.js +0 -2
- package/dist/cli/chunks/client-4W3KWTAU.js +0 -2
- package/dist/cli/chunks/codex-installer-P7DPQMYL.js +0 -15
- package/dist/cli/chunks/core-handlers-BDU2XBLO.js +0 -2
- package/dist/cli/chunks/cross-domain-router-BPB6IHN4.js +0 -2
- package/dist/cli/chunks/dream-WFCZGFDY.js +0 -2
- package/dist/cli/chunks/embed-and-insert-pattern-VESJQSYD.js +0 -3
- package/dist/cli/chunks/heartbeat-scheduler-HWS4SHRM.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-7QOBHKRB.js +0 -2
- package/dist/cli/chunks/hnsw-index-6WUKYJH7.js +0 -2
- package/dist/cli/chunks/hybrid-router-525JTRA5.js +0 -2
- package/dist/cli/chunks/impact-analyzer-GG6CJEOK.js +0 -2
- package/dist/cli/chunks/init-wizard-4VFAOK4Y.js +0 -2
- package/dist/cli/chunks/kernel-N3FQGOST.js +0 -2
- package/dist/cli/chunks/knowledge-graph-I5QIHB4G.js +0 -2
- package/dist/cli/chunks/learning-TQOGG3CR.js +0 -119
- package/dist/cli/chunks/llm-router-service-NCJZYJLG.js +0 -2
- package/dist/cli/chunks/load-test-DCJEYIXD.js +0 -2
- package/dist/cli/chunks/memory-backend-O6KO2KTX.js +0 -2
- package/dist/cli/chunks/memory-handlers-4Z43WEKD.js +0 -2
- package/dist/cli/chunks/pattern-null-store-5WIJKX2K.js +0 -2
- package/dist/cli/chunks/platform-F76G6RUI.js +0 -2
- package/dist/cli/chunks/protocol-executor-5TPNAZTB.js +0 -2
- package/dist/cli/chunks/provider-manager-3VMOZ6HV.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-BATV4NTT.js +0 -2
- package/dist/cli/chunks/quality-gate-A5MPWHST.js +0 -7
- package/dist/cli/chunks/queen-coordinator-EIHGYBUO.js +0 -2
- package/dist/cli/chunks/real-embeddings-ZBF5EQOG.js +0 -2
- package/dist/cli/chunks/router-EMVGY4HU.js +0 -2
- package/dist/cli/chunks/routing-feedback-JUP4OFB2.js +0 -2
- package/dist/cli/chunks/rvf-dual-writer-BUNP4SKD.js +0 -2
- package/dist/cli/chunks/rvf-migration-adapter-VSOAPLMB.js +0 -2
- package/dist/cli/chunks/rvf-migration-coordinator-LSWEHAWX.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-LOC42TQ6.js +0 -2
- package/dist/cli/chunks/safe-db-WQ62IQKV.js +0 -2
- package/dist/cli/chunks/schedule-XJRP57TE.js +0 -2
- package/dist/cli/chunks/scheduler-EZH5SDIM.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-HPEVCTIB.js +0 -2
- package/dist/cli/chunks/token-bootstrap-F2DCLWGW.js +0 -2
- package/dist/cli/chunks/unified-memory-ATILROKR.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-XJXAX7DW.js +0 -2
- package/dist/cli/chunks/unified-persistence-3TN5PBWE.js +0 -2
- package/dist/cli/chunks/visual-security-VFWRBCNA.js +0 -2
- package/dist/cli/chunks/witness-chain-JC5LEXRV.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-TKQUF2KN.js +0 -2
|
@@ -16,7 +16,8 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
16
16
|
import { safeJsonParse } from '../shared/safe-json.js';
|
|
17
17
|
import { toErrorMessage } from '../shared/error-utils.js';
|
|
18
18
|
import { getUnifiedMemory } from '../kernel/unified-memory.js';
|
|
19
|
-
import { computeBatchEmbeddings, getEmbeddingDimension, isUsingEndpoint, } from './real-embeddings.js';
|
|
19
|
+
import { computeBatchEmbeddings, getEmbeddingDimension, isUsingEndpoint, getActiveEmbeddingSpaceIdentity, } from './real-embeddings.js';
|
|
20
|
+
import { EMBEDDING_SPACE_CANARY, inspectEmbeddingSpaceRows, } from './embedding-space.js';
|
|
20
21
|
import { recordPatternUsage } from './pattern-usage-recorder.js';
|
|
21
22
|
export const DEFAULT_SQLITE_CONFIG = {
|
|
22
23
|
// LEGACY: Ignored when useUnified=true (the default). All data goes to memory.db
|
|
@@ -106,6 +107,8 @@ export class SQLitePatternStore {
|
|
|
106
107
|
}
|
|
107
108
|
// Run deduplication migration (one-time, idempotent)
|
|
108
109
|
this.deduplicatePatterns();
|
|
110
|
+
// Legacy rows remain NULL/unverified; only new writes receive provenance.
|
|
111
|
+
this.ensureEmbeddingSpaceSchema();
|
|
109
112
|
// Prepare statements
|
|
110
113
|
this.prepareStatements();
|
|
111
114
|
this.initialized = true;
|
|
@@ -143,11 +146,12 @@ export class SQLitePatternStore {
|
|
|
143
146
|
);
|
|
144
147
|
|
|
145
148
|
-- Pattern embeddings table (BLOB storage for vectors)
|
|
146
|
-
CREATE TABLE IF NOT EXISTS qe_pattern_embeddings (
|
|
149
|
+
CREATE TABLE IF NOT EXISTS qe_pattern_embeddings (
|
|
147
150
|
pattern_id TEXT PRIMARY KEY,
|
|
148
151
|
embedding BLOB NOT NULL,
|
|
149
152
|
dimension INTEGER NOT NULL,
|
|
150
|
-
model TEXT DEFAULT 'all-MiniLM-L6-v2',
|
|
153
|
+
model TEXT DEFAULT 'all-MiniLM-L6-v2',
|
|
154
|
+
space_id TEXT,
|
|
151
155
|
created_at TEXT DEFAULT (datetime('now')),
|
|
152
156
|
FOREIGN KEY (pattern_id) REFERENCES qe_patterns(id) ON DELETE CASCADE
|
|
153
157
|
);
|
|
@@ -298,6 +302,15 @@ export class SQLitePatternStore {
|
|
|
298
302
|
/**
|
|
299
303
|
* Prepare commonly used statements
|
|
300
304
|
*/
|
|
305
|
+
ensureEmbeddingSpaceSchema() {
|
|
306
|
+
if (!this.db)
|
|
307
|
+
throw new Error('Database not initialized');
|
|
308
|
+
const columns = this.db.prepare("PRAGMA table_info('qe_pattern_embeddings')").all();
|
|
309
|
+
if (!columns.some((column) => column.name === 'space_id')) {
|
|
310
|
+
this.db.exec('ALTER TABLE qe_pattern_embeddings ADD COLUMN space_id TEXT');
|
|
311
|
+
}
|
|
312
|
+
this.db.exec('CREATE INDEX IF NOT EXISTS idx_qe_pattern_embeddings_space ON qe_pattern_embeddings(space_id)');
|
|
313
|
+
}
|
|
301
314
|
prepareStatements() {
|
|
302
315
|
if (!this.db)
|
|
303
316
|
throw new Error('Database not initialized');
|
|
@@ -323,14 +336,14 @@ export class SQLitePatternStore {
|
|
|
323
336
|
updated_at = datetime('now')
|
|
324
337
|
`));
|
|
325
338
|
this.prepared.set('insertEmbedding', this.db.prepare(`
|
|
326
|
-
INSERT OR REPLACE INTO qe_pattern_embeddings (pattern_id, embedding, dimension, model)
|
|
327
|
-
VALUES (?, ?, ?, ?)
|
|
339
|
+
INSERT OR REPLACE INTO qe_pattern_embeddings (pattern_id, embedding, dimension, model, space_id)
|
|
340
|
+
VALUES (?, ?, ?, ?, ?)
|
|
328
341
|
`));
|
|
329
342
|
this.prepared.set('getPattern', this.db.prepare(`
|
|
330
343
|
SELECT * FROM qe_patterns WHERE id = ?
|
|
331
344
|
`));
|
|
332
345
|
this.prepared.set('getPatternWithEmbedding', this.db.prepare(`
|
|
333
|
-
SELECT p.*, e.embedding, e.dimension
|
|
346
|
+
SELECT p.*, e.embedding, e.dimension, e.space_id
|
|
334
347
|
FROM qe_patterns p
|
|
335
348
|
LEFT JOIN qe_pattern_embeddings e ON p.id = e.pattern_id
|
|
336
349
|
WHERE p.id = ?
|
|
@@ -360,13 +373,13 @@ export class SQLitePatternStore {
|
|
|
360
373
|
SELECT * FROM qe_patterns WHERE qe_domain = ? ORDER BY quality_score DESC LIMIT ?
|
|
361
374
|
`));
|
|
362
375
|
this.prepared.set('getAllEmbeddings', this.db.prepare(`
|
|
363
|
-
SELECT pattern_id, embedding, dimension FROM qe_pattern_embeddings
|
|
376
|
+
SELECT pattern_id, embedding, dimension, space_id FROM qe_pattern_embeddings
|
|
364
377
|
`));
|
|
365
378
|
// Recent-first variant used by the RVF backfill path. Order by
|
|
366
379
|
// qe_patterns.last_used_at (then created_at) so the bounded backfill keeps
|
|
367
380
|
// the most actively-used patterns when the cap is hit.
|
|
368
381
|
this.prepared.set('getRecentEmbeddings', this.db.prepare(`
|
|
369
|
-
SELECT e.pattern_id, e.embedding, e.dimension
|
|
382
|
+
SELECT e.pattern_id, e.embedding, e.dimension, e.space_id
|
|
370
383
|
FROM qe_pattern_embeddings e
|
|
371
384
|
LEFT JOIN qe_patterns p ON p.id = e.pattern_id
|
|
372
385
|
ORDER BY COALESCE(p.last_used_at, p.created_at, e.created_at) DESC
|
|
@@ -382,7 +395,7 @@ export class SQLitePatternStore {
|
|
|
382
395
|
/**
|
|
383
396
|
* Store a pattern
|
|
384
397
|
*/
|
|
385
|
-
storePattern(pattern, embedding) {
|
|
398
|
+
storePattern(pattern, embedding, embeddingSpaceId) {
|
|
386
399
|
if (!this.db)
|
|
387
400
|
throw new Error('Database not initialized');
|
|
388
401
|
const id = pattern.id || uuidv4();
|
|
@@ -405,9 +418,13 @@ export class SQLitePatternStore {
|
|
|
405
418
|
.get(pattern.name, pattern.qeDomain ?? '', pattern.patternType ?? '');
|
|
406
419
|
actualId = actualRow ? actualRow.id : id;
|
|
407
420
|
if (embedding) {
|
|
421
|
+
const spaceId = embeddingSpaceId ?? getActiveEmbeddingSpaceIdentity()?.spaceId;
|
|
422
|
+
if (!spaceId) {
|
|
423
|
+
throw new Error('VECTOR_SPACE_UNVERIFIED: refusing to persist an embedding without runtime provenance');
|
|
424
|
+
}
|
|
408
425
|
// Store embedding as BLOB (Float32Array)
|
|
409
426
|
const buffer = Buffer.from(new Float32Array(embedding).buffer);
|
|
410
|
-
insertEmbedding.run(actualId, buffer, embedding.length, 'all-MiniLM-L6-v2');
|
|
427
|
+
insertEmbedding.run(actualId, buffer, embedding.length, 'all-MiniLM-L6-v2', spaceId);
|
|
411
428
|
}
|
|
412
429
|
});
|
|
413
430
|
transaction();
|
|
@@ -529,6 +546,7 @@ export class SQLitePatternStore {
|
|
|
529
546
|
return rows.map(row => ({
|
|
530
547
|
patternId: row.pattern_id,
|
|
531
548
|
embedding: Array.from(new Float32Array(row.embedding.buffer, row.embedding.byteOffset, row.dimension)),
|
|
549
|
+
spaceId: row.space_id,
|
|
532
550
|
}));
|
|
533
551
|
}
|
|
534
552
|
/**
|
|
@@ -549,8 +567,15 @@ export class SQLitePatternStore {
|
|
|
549
567
|
return rows.map(row => ({
|
|
550
568
|
patternId: row.pattern_id,
|
|
551
569
|
embedding: Array.from(new Float32Array(row.embedding.buffer, row.embedding.byteOffset, row.dimension)),
|
|
570
|
+
spaceId: row.space_id,
|
|
552
571
|
}));
|
|
553
572
|
}
|
|
573
|
+
getEmbeddingSpaceDiagnostics(activeSpaceId = getActiveEmbeddingSpaceIdentity()?.spaceId ?? null) {
|
|
574
|
+
if (!this.db)
|
|
575
|
+
throw new Error('Database not initialized');
|
|
576
|
+
const rows = this.db.prepare('SELECT space_id AS spaceId FROM qe_pattern_embeddings').all();
|
|
577
|
+
return inspectEmbeddingSpaceRows(rows, activeSpaceId);
|
|
578
|
+
}
|
|
554
579
|
/**
|
|
555
580
|
* Record pattern usage.
|
|
556
581
|
*
|
|
@@ -788,7 +813,7 @@ export class SQLitePatternStore {
|
|
|
788
813
|
/**
|
|
789
814
|
* Store embedding for an existing pattern
|
|
790
815
|
*/
|
|
791
|
-
storePatternEmbedding(patternId, embedding) {
|
|
816
|
+
storePatternEmbedding(patternId, embedding, embeddingSpaceId) {
|
|
792
817
|
if (!this.db)
|
|
793
818
|
throw new Error('Database not initialized');
|
|
794
819
|
const insertEmbedding = this.prepared.get('insertEmbedding');
|
|
@@ -797,7 +822,11 @@ export class SQLitePatternStore {
|
|
|
797
822
|
}
|
|
798
823
|
// Convert embedding to Buffer for storage
|
|
799
824
|
const buffer = Buffer.from(new Float32Array(embedding).buffer);
|
|
800
|
-
|
|
825
|
+
const spaceId = embeddingSpaceId ?? getActiveEmbeddingSpaceIdentity()?.spaceId;
|
|
826
|
+
if (!spaceId) {
|
|
827
|
+
throw new Error('VECTOR_SPACE_UNVERIFIED: refusing to persist an embedding without runtime provenance');
|
|
828
|
+
}
|
|
829
|
+
insertEmbedding.run(patternId, buffer, embedding.length, 'all-MiniLM-L6-v2', spaceId);
|
|
801
830
|
}
|
|
802
831
|
/**
|
|
803
832
|
* Record pattern reuse for metrics tracking (Phase 5.4)
|
|
@@ -935,14 +964,22 @@ export class SQLitePatternStore {
|
|
|
935
964
|
if (!this.db)
|
|
936
965
|
throw new Error('Database not initialized');
|
|
937
966
|
const dimension = getEmbeddingDimension(); // 384
|
|
938
|
-
//
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
967
|
+
// Initialize the executable identity before choosing repair candidates.
|
|
968
|
+
// The canary is cached by the embedding layer and is never persisted.
|
|
969
|
+
await computeBatchEmbeddings([EMBEDDING_SPACE_CANARY]);
|
|
970
|
+
const activeSpaceId = getActiveEmbeddingSpaceIdentity()?.spaceId;
|
|
971
|
+
if (!activeSpaceId) {
|
|
972
|
+
throw new Error('VECTOR_SPACE_UNVERIFIED: backfill embedder has no runtime provenance');
|
|
973
|
+
}
|
|
974
|
+
// Repair absent, legacy/unverified, and mismatched embeddings.
|
|
975
|
+
const patternsWithout = this.db.prepare(`
|
|
976
|
+
SELECT p.id, p.name, p.description, p.pattern_type, p.qe_domain
|
|
977
|
+
FROM qe_patterns p
|
|
978
|
+
LEFT JOIN qe_pattern_embeddings e ON e.pattern_id = p.id
|
|
979
|
+
WHERE (e.pattern_id IS NULL OR e.space_id IS NULL OR e.space_id <> ?)
|
|
980
|
+
AND p.id NOT LIKE 'bench-%'
|
|
981
|
+
ORDER BY p.quality_score DESC
|
|
982
|
+
`).all(activeSpaceId);
|
|
946
983
|
const alreadyHad = this.db.prepare(`
|
|
947
984
|
SELECT COUNT(*) as c FROM qe_pattern_embeddings
|
|
948
985
|
`).get();
|
|
@@ -1012,7 +1049,7 @@ export class SQLitePatternStore {
|
|
|
1012
1049
|
continue;
|
|
1013
1050
|
}
|
|
1014
1051
|
const buffer = Buffer.from(new Float32Array(embedding).buffer);
|
|
1015
|
-
insertEmbedding.run(textsWithIds[j].id, buffer, dimension, embeddingTag);
|
|
1052
|
+
insertEmbedding.run(textsWithIds[j].id, buffer, dimension, embeddingTag, activeSpaceId);
|
|
1016
1053
|
processed++;
|
|
1017
1054
|
}
|
|
1018
1055
|
catch (e) {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { StructuralRetrievalCorpus, StructuralTransformation } from './types.js';
|
|
2
|
+
export declare function createStructuralRetrievalCorpus(): StructuralRetrievalCorpus;
|
|
3
|
+
export declare const STRUCTURAL_RETRIEVAL_TRANSFORMATIONS: readonly StructuralTransformation[];
|
|
4
|
+
export declare function verifyStructuralRetrievalCorpus(corpus: StructuralRetrievalCorpus): boolean;
|
|
5
|
+
//# sourceMappingURL=corpus.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
const REVISION = 'aqe-structural-transfer-2026-09-06';
|
|
3
|
+
const TRANSFORMATIONS = [
|
|
4
|
+
'rename', 'framework-transfer', 'reordered-steps',
|
|
5
|
+
'distractor-terminology', 'cross-domain-transfer',
|
|
6
|
+
];
|
|
7
|
+
const SEEDS = [
|
|
8
|
+
['async-race', 'observe completion before assertion', 'await the operation', 'increase the timeout', 'completion probe', 'unit', 'vitest'],
|
|
9
|
+
['stale-cache', 'invalidate on every state mutation', 'invalidate the cache', 'retry the read', 'freshness assertion', 'integration', 'redis'],
|
|
10
|
+
['transaction-leak', 'rollback isolates each test', 'rollback the transaction', 'truncate a shared table', 'row-count check', 'database', 'postgres'],
|
|
11
|
+
['clock-skew', 'compare times in one clock domain', 'inject a monotonic clock', 'widen the time window', 'clock boundary check', 'unit', 'node'],
|
|
12
|
+
['event-loss', 'subscribe before publishing', 'register the listener first', 'publish twice', 'delivery assertion', 'events', 'eventemitter'],
|
|
13
|
+
['resource-leak', 'release resources on every exit', 'close in a finally block', 'raise the pool limit', 'handle-count check', 'integration', 'playwright'],
|
|
14
|
+
['eventual-consistency', 'poll the observable state', 'poll with a bounded deadline', 'sleep for a fixed delay', 'state convergence', 'distributed', 'kubernetes'],
|
|
15
|
+
['identity-confusion', 'compare canonical identities', 'normalize the identifier', 'use display names', 'identity equality', 'security', 'oauth'],
|
|
16
|
+
['partial-write', 'publish only complete state', 'commit through an atomic swap', 'ignore missing fields', 'atomicity check', 'filesystem', 'node'],
|
|
17
|
+
['order-dependence', 'tests start from isolated state', 'reset state in setup', 'force alphabetical order', 'shuffle repeat', 'unit', 'jest'],
|
|
18
|
+
['schema-drift', 'validate at the boundary', 'reject the incompatible schema', 'cast the payload', 'schema validator', 'api', 'zod'],
|
|
19
|
+
['backpressure-loss', 'producer respects consumer capacity', 'await the drain signal', 'increase buffer memory', 'loss counter', 'performance', 'streams'],
|
|
20
|
+
['retry-duplication', 'retries preserve idempotency', 'attach an idempotency key', 'disable all retries', 'duplicate detector', 'api', 'fetch'],
|
|
21
|
+
['permission-bypass', 'authorization precedes mutation', 'check permission before write', 'hide the user interface', 'denial assertion', 'security', 'express'],
|
|
22
|
+
['encoding-mismatch', 'encode and decode with one charset', 'set UTF-8 explicitly', 'strip non-ASCII text', 'round-trip equality', 'api', 'json'],
|
|
23
|
+
['pagination-gap', 'cursor advances from the last item', 'use the returned cursor', 'increase page size', 'set equality', 'api', 'graphql'],
|
|
24
|
+
['cancellation-leak', 'cancellation propagates to children', 'forward the abort signal', 'wait for natural completion', 'abort observation', 'integration', 'abortcontroller'],
|
|
25
|
+
['floating-point-boundary', 'compare numeric results by tolerance', 'use an error bound', 'round every input', 'relative-error check', 'unit', 'vitest'],
|
|
26
|
+
['locale-dependence', 'format under an explicit locale', 'pass the locale explicitly', 'update the snapshot locally', 'multi-locale check', 'ui', 'intl'],
|
|
27
|
+
['lock-starvation', 'lock acquisition remains fair', 'queue lock waiters', 'raise retry count', 'bounded-wait check', 'concurrency', 'mutex'],
|
|
28
|
+
].map(([mechanism, invariant, action, wrongAction, oracle, domain, framework]) => ({
|
|
29
|
+
mechanism, invariant, action, wrongAction, oracle, domain, framework,
|
|
30
|
+
}));
|
|
31
|
+
function splitFor(index) {
|
|
32
|
+
if (index < 12)
|
|
33
|
+
return 'train';
|
|
34
|
+
if (index < 16)
|
|
35
|
+
return 'calibration';
|
|
36
|
+
return 'audit';
|
|
37
|
+
}
|
|
38
|
+
function stableHash(value) {
|
|
39
|
+
return createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
40
|
+
}
|
|
41
|
+
function deepFreeze(value) {
|
|
42
|
+
if (value && typeof value === 'object' && !Object.isFrozen(value)) {
|
|
43
|
+
Object.freeze(value);
|
|
44
|
+
for (const child of Object.values(value))
|
|
45
|
+
deepFreeze(child);
|
|
46
|
+
}
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
function queryText(seed, transformation, index) {
|
|
50
|
+
const object = `component-${index + 41}`;
|
|
51
|
+
switch (transformation) {
|
|
52
|
+
case 'rename': return `${object} intermittently fails; ensure ${seed.invariant} by applying: ${seed.action}`;
|
|
53
|
+
case 'framework-transfer': return `In an alternative runtime, ${seed.mechanism} appears. Preserve this rule: ${seed.invariant}`;
|
|
54
|
+
case 'reordered-steps': return `Verify with ${seed.oracle}; first arrange the fixture, then ${seed.action}; fault: ${seed.mechanism}`;
|
|
55
|
+
case 'distractor-terminology': return `${seed.wrongAction} is tempting for ${seed.mechanism}, but the required invariant is ${seed.invariant}`;
|
|
56
|
+
case 'cross-domain-transfer': return `A ${seed.domain} workflow moved to service-${index}; reuse the mechanism ${seed.mechanism} and ${seed.action}`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export function createStructuralRetrievalCorpus() {
|
|
60
|
+
const patterns = [];
|
|
61
|
+
const queries = [];
|
|
62
|
+
SEEDS.forEach((seed, index) => {
|
|
63
|
+
const familyId = `family-${String(index + 1).padStart(2, '0')}`;
|
|
64
|
+
const correctId = `${familyId}-structural`;
|
|
65
|
+
const distractorId = `${familyId}-surface-distractor`;
|
|
66
|
+
const counterexampleId = `${familyId}-counterexample`;
|
|
67
|
+
patterns.push({ id: correctId, familyId, framework: seed.framework, domain: seed.domain,
|
|
68
|
+
failureMechanism: seed.mechanism, invariant: seed.invariant, actions: [seed.action], oracle: seed.oracle,
|
|
69
|
+
text: `${seed.framework} ${seed.domain} ${seed.mechanism}: ${seed.action}; verify ${seed.oracle}` }, { id: distractorId, familyId, framework: seed.framework, domain: seed.domain,
|
|
70
|
+
failureMechanism: `symptom resembling ${seed.mechanism}`, invariant: 'mask the observed symptom',
|
|
71
|
+
actions: [seed.wrongAction], oracle: 'single rerun',
|
|
72
|
+
text: `${seed.framework} ${seed.domain} ${seed.mechanism}: ${seed.wrongAction}; quick ${seed.oracle}` }, { id: counterexampleId, familyId, framework: seed.framework, domain: seed.domain,
|
|
73
|
+
failureMechanism: seed.mechanism, invariant: `environment forbids ${seed.action}`,
|
|
74
|
+
actions: [`escalate instead of ${seed.action}`], oracle: 'environment constraint check',
|
|
75
|
+
text: `${seed.mechanism} ${seed.action} ${seed.framework}, but environment forbids the action` });
|
|
76
|
+
TRANSFORMATIONS.forEach((transformation) => queries.push({
|
|
77
|
+
id: `${familyId}-${transformation}`,
|
|
78
|
+
familyId,
|
|
79
|
+
split: splitFor(index),
|
|
80
|
+
transformation,
|
|
81
|
+
text: queryText(seed, transformation, index),
|
|
82
|
+
relevantPatternIds: [correctId],
|
|
83
|
+
mustNotRankAbove: [
|
|
84
|
+
{ lowerPatternId: distractorId, higherPatternId: correctId },
|
|
85
|
+
{ lowerPatternId: counterexampleId, higherPatternId: correctId },
|
|
86
|
+
],
|
|
87
|
+
}));
|
|
88
|
+
});
|
|
89
|
+
const payload = { schemaVersion: 'aqe-structural-retrieval/v1', corpusRevision: REVISION, patterns, queries };
|
|
90
|
+
return deepFreeze({ ...payload, lineageHash: stableHash(payload) });
|
|
91
|
+
}
|
|
92
|
+
export const STRUCTURAL_RETRIEVAL_TRANSFORMATIONS = Object.freeze([...TRANSFORMATIONS]);
|
|
93
|
+
export function verifyStructuralRetrievalCorpus(corpus) {
|
|
94
|
+
const { lineageHash: _lineageHash, ...payload } = corpus;
|
|
95
|
+
return stableHash(payload) === corpus.lineageHash;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=corpus.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { QueryRetrievalResult, RetrievalDiagnostic, StructuralRetrievalCorpus, StructuralRetrievalQuery, StructuralRetrievalReport } from './types.js';
|
|
2
|
+
export declare function diagnoseRetrieval(query: StructuralRetrievalQuery, result: QueryRetrievalResult, k: number): RetrievalDiagnostic;
|
|
3
|
+
export declare function evaluateStructuralRetrieval(corpus: StructuralRetrievalCorpus, results: QueryRetrievalResult[], options: {
|
|
4
|
+
rankerVersion: string;
|
|
5
|
+
k?: number;
|
|
6
|
+
}): StructuralRetrievalReport;
|
|
7
|
+
//# sourceMappingURL=evaluate.d.ts.map
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { verifyStructuralRetrievalCorpus } from './corpus.js';
|
|
2
|
+
function queryScores(query, result, k) {
|
|
3
|
+
const relevant = new Set(query.relevantPatternIds);
|
|
4
|
+
const rank = result.candidates.findIndex(candidate => relevant.has(candidate.patternId));
|
|
5
|
+
const topKHits = result.candidates.slice(0, k).filter(candidate => relevant.has(candidate.patternId)).length;
|
|
6
|
+
const idealCount = Math.min(k, relevant.size);
|
|
7
|
+
const dcg = result.candidates.slice(0, k).reduce((sum, candidate, index) => sum + (relevant.has(candidate.patternId) ? 1 / Math.log2(index + 2) : 0), 0);
|
|
8
|
+
const idcg = Array.from({ length: idealCount }, (_, index) => 1 / Math.log2(index + 2)).reduce((a, b) => a + b, 0);
|
|
9
|
+
const relevantScore = rank >= 0 ? result.candidates[rank].score : 0;
|
|
10
|
+
const bestWrong = Math.max(0, ...result.candidates.filter(c => !relevant.has(c.patternId)).map(c => c.score));
|
|
11
|
+
return {
|
|
12
|
+
recall: relevant.size === 0 ? 0 : topKHits / relevant.size,
|
|
13
|
+
hit: rank === 0 ? 1 : 0,
|
|
14
|
+
reciprocalRank: rank < 0 ? 0 : 1 / (rank + 1),
|
|
15
|
+
ndcg: idcg === 0 ? 0 : dcg / idcg,
|
|
16
|
+
margin: relevantScore - bestWrong,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function mean(values) {
|
|
20
|
+
return values.length === 0 ? 0 : values.reduce((sum, value) => sum + value, 0) / values.length;
|
|
21
|
+
}
|
|
22
|
+
function estimate(values, seed) {
|
|
23
|
+
if (values.length === 0)
|
|
24
|
+
return { value: 0, confidenceInterval: { lower: 0, upper: 0, level: 0.95 } };
|
|
25
|
+
let state = seed >>> 0;
|
|
26
|
+
const random = () => ((state = (1664525 * state + 1013904223) >>> 0) / 0x100000000);
|
|
27
|
+
const bootstraps = Array.from({ length: 1000 }, () => mean(Array.from({ length: values.length }, () => values[Math.floor(random() * values.length)]))).sort((a, b) => a - b);
|
|
28
|
+
return {
|
|
29
|
+
value: mean(values),
|
|
30
|
+
confidenceInterval: {
|
|
31
|
+
lower: bootstraps[Math.floor(bootstraps.length * 0.025)],
|
|
32
|
+
upper: bootstraps[Math.floor(bootstraps.length * 0.975)],
|
|
33
|
+
level: 0.95,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function metricSet(scores) {
|
|
38
|
+
return {
|
|
39
|
+
support: scores.length,
|
|
40
|
+
recallAtK: estimate(scores.map(s => s.recall), 11),
|
|
41
|
+
hitAt1: estimate(scores.map(s => s.hit), 13),
|
|
42
|
+
mrr: estimate(scores.map(s => s.reciprocalRank), 17),
|
|
43
|
+
ndcg: estimate(scores.map(s => s.ndcg), 19),
|
|
44
|
+
top1Margin: estimate(scores.map(s => s.margin), 23),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function diagnoseRetrieval(query, result, k) {
|
|
48
|
+
const relevant = new Set(query.relevantPatternIds);
|
|
49
|
+
const relevantCandidates = result.candidates.slice(0, k).filter(c => relevant.has(c.patternId));
|
|
50
|
+
if (relevantCandidates.length === 0)
|
|
51
|
+
return 'not_retrieved';
|
|
52
|
+
if (!relevant.has(result.candidates[0]?.patternId ?? ''))
|
|
53
|
+
return 'retrieved_misranked';
|
|
54
|
+
const applied = result.appliedPatternIds ?? [];
|
|
55
|
+
if (applied.length === 0 || !applied.some(id => relevant.has(id)))
|
|
56
|
+
return 'ranked_not_used';
|
|
57
|
+
if (result.outcomeImproved !== true)
|
|
58
|
+
return 'used_no_benefit';
|
|
59
|
+
return 'success';
|
|
60
|
+
}
|
|
61
|
+
export function evaluateStructuralRetrieval(corpus, results, options) {
|
|
62
|
+
const k = options.k ?? 10;
|
|
63
|
+
if (!Number.isInteger(k) || k < 1)
|
|
64
|
+
throw new Error('k must be a positive integer');
|
|
65
|
+
if (!verifyStructuralRetrievalCorpus(corpus))
|
|
66
|
+
throw new Error('corpus lineage hash mismatch');
|
|
67
|
+
if (results.length !== corpus.queries.length) {
|
|
68
|
+
throw new Error('results must contain exactly one entry for every corpus query');
|
|
69
|
+
}
|
|
70
|
+
const byQuery = new Map(results.map(result => [result.queryId, result]));
|
|
71
|
+
if (byQuery.size !== corpus.queries.length || corpus.queries.some(query => !byQuery.has(query.id))) {
|
|
72
|
+
throw new Error('results must contain exactly one entry for every corpus query');
|
|
73
|
+
}
|
|
74
|
+
const knownPatterns = new Set(corpus.patterns.map(pattern => pattern.id));
|
|
75
|
+
for (const result of results) {
|
|
76
|
+
const candidateIds = new Set();
|
|
77
|
+
for (const candidate of result.candidates) {
|
|
78
|
+
if (!knownPatterns.has(candidate.patternId))
|
|
79
|
+
throw new Error(`unknown candidate pattern: ${candidate.patternId}`);
|
|
80
|
+
if (!Number.isFinite(candidate.score))
|
|
81
|
+
throw new Error(`candidate score must be finite: ${candidate.patternId}`);
|
|
82
|
+
if (candidateIds.has(candidate.patternId))
|
|
83
|
+
throw new Error(`duplicate candidate pattern: ${candidate.patternId}`);
|
|
84
|
+
candidateIds.add(candidate.patternId);
|
|
85
|
+
}
|
|
86
|
+
for (const appliedId of result.appliedPatternIds ?? []) {
|
|
87
|
+
if (!candidateIds.has(appliedId))
|
|
88
|
+
throw new Error(`applied pattern was not a candidate: ${appliedId}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const rows = corpus.queries.map(query => {
|
|
92
|
+
const result = byQuery.get(query.id);
|
|
93
|
+
return { query, result, scores: queryScores(query, result, k) };
|
|
94
|
+
});
|
|
95
|
+
const diagnosticNames = [
|
|
96
|
+
'success', 'not_retrieved', 'retrieved_misranked', 'ranked_not_used', 'used_no_benefit',
|
|
97
|
+
];
|
|
98
|
+
const diagnostics = Object.fromEntries(diagnosticNames.map(name => [name, 0]));
|
|
99
|
+
for (const row of rows)
|
|
100
|
+
diagnostics[diagnoseRetrieval(row.query, row.result, k)] += 1;
|
|
101
|
+
const relationViolations = rows.reduce((count, { query, result }) => {
|
|
102
|
+
const ranks = new Map(result.candidates.map((candidate, index) => [candidate.patternId, index]));
|
|
103
|
+
return count + query.mustNotRankAbove.filter(relation => {
|
|
104
|
+
const low = ranks.get(relation.lowerPatternId);
|
|
105
|
+
const high = ranks.get(relation.higherPatternId);
|
|
106
|
+
return low !== undefined && (high === undefined || low < high);
|
|
107
|
+
}).length;
|
|
108
|
+
}, 0);
|
|
109
|
+
const slices = {};
|
|
110
|
+
for (const transformation of new Set(corpus.queries.map(query => query.transformation))) {
|
|
111
|
+
slices[transformation] = metricSet(rows.filter(row => row.query.transformation === transformation).map(row => row.scores));
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
corpusRevision: corpus.corpusRevision,
|
|
115
|
+
corpusLineageHash: corpus.lineageHash,
|
|
116
|
+
rankerVersion: options.rankerVersion,
|
|
117
|
+
k,
|
|
118
|
+
overall: metricSet(rows.map(row => row.scores)),
|
|
119
|
+
slices,
|
|
120
|
+
diagnostics,
|
|
121
|
+
relationViolations,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=evaluate.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createStructuralRetrievalCorpus, verifyStructuralRetrievalCorpus, STRUCTURAL_RETRIEVAL_TRANSFORMATIONS, } from './corpus.js';
|
|
2
|
+
export { diagnoseRetrieval, evaluateStructuralRetrieval } from './evaluate.js';
|
|
3
|
+
export { createRetrievalReceipt } from './receipt.js';
|
|
4
|
+
export type * from './types.js';
|
|
5
|
+
export type { CreateRetrievalReceiptInput } from './receipt.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createStructuralRetrievalCorpus, verifyStructuralRetrievalCorpus, STRUCTURAL_RETRIEVAL_TRANSFORMATIONS, } from './corpus.js';
|
|
2
|
+
export { diagnoseRetrieval, evaluateStructuralRetrieval } from './evaluate.js';
|
|
3
|
+
export { createRetrievalReceipt } from './receipt.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { RankedCandidate, RetrievalReceipt } from './types.js';
|
|
2
|
+
export interface CreateRetrievalReceiptInput {
|
|
3
|
+
revision: string;
|
|
4
|
+
queryId: string;
|
|
5
|
+
queryRepresentationVersion: string;
|
|
6
|
+
embeddingSpaceId: string;
|
|
7
|
+
rankerVersion: string;
|
|
8
|
+
candidates: RankedCandidate[];
|
|
9
|
+
appliedPatternIds?: string[];
|
|
10
|
+
outcomeRef?: string | null;
|
|
11
|
+
outcomeImproved?: boolean | null;
|
|
12
|
+
}
|
|
13
|
+
export declare function createRetrievalReceipt(input: CreateRetrievalReceiptInput): RetrievalReceipt;
|
|
14
|
+
//# sourceMappingURL=receipt.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
function deepFreeze(value) {
|
|
3
|
+
if (value && typeof value === 'object' && !Object.isFrozen(value)) {
|
|
4
|
+
Object.freeze(value);
|
|
5
|
+
for (const child of Object.values(value))
|
|
6
|
+
deepFreeze(child);
|
|
7
|
+
}
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
export function createRetrievalReceipt(input) {
|
|
11
|
+
if (!input.revision || !input.queryId || !input.queryRepresentationVersion || !input.embeddingSpaceId || !input.rankerVersion) {
|
|
12
|
+
throw new Error('retrieval receipt provenance fields must be non-empty');
|
|
13
|
+
}
|
|
14
|
+
const candidateIds = new Set(input.candidates.map(candidate => candidate.patternId));
|
|
15
|
+
if (candidateIds.size !== input.candidates.length || input.candidates.some(candidate => !candidate.patternId || !Number.isFinite(candidate.score))) {
|
|
16
|
+
throw new Error('retrieval receipt candidates must have an id and finite score');
|
|
17
|
+
}
|
|
18
|
+
if ((input.appliedPatternIds ?? []).some(id => !candidateIds.has(id))) {
|
|
19
|
+
throw new Error('retrieval receipt applied patterns must be present in candidates');
|
|
20
|
+
}
|
|
21
|
+
const payload = {
|
|
22
|
+
schemaVersion: 'aqe-retrieval-receipt/v1',
|
|
23
|
+
revision: input.revision,
|
|
24
|
+
queryId: input.queryId,
|
|
25
|
+
queryRepresentationVersion: input.queryRepresentationVersion,
|
|
26
|
+
embeddingSpaceId: input.embeddingSpaceId,
|
|
27
|
+
rankerVersion: input.rankerVersion,
|
|
28
|
+
candidates: input.candidates.map(candidate => ({ ...candidate })),
|
|
29
|
+
appliedPatternIds: [...(input.appliedPatternIds ?? [])],
|
|
30
|
+
outcomeRef: input.outcomeRef ?? null,
|
|
31
|
+
outcomeImproved: input.outcomeImproved ?? null,
|
|
32
|
+
};
|
|
33
|
+
const receiptId = createHash('sha256').update(JSON.stringify(payload)).digest('hex');
|
|
34
|
+
return deepFreeze({ ...payload, receiptId });
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=receipt.js.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export type StructuralTransformation = 'rename' | 'framework-transfer' | 'reordered-steps' | 'distractor-terminology' | 'cross-domain-transfer';
|
|
2
|
+
export type CorpusSplit = 'train' | 'calibration' | 'audit';
|
|
3
|
+
export interface StructuralPattern {
|
|
4
|
+
id: string;
|
|
5
|
+
familyId: string;
|
|
6
|
+
framework: string;
|
|
7
|
+
domain: string;
|
|
8
|
+
failureMechanism: string;
|
|
9
|
+
invariant: string;
|
|
10
|
+
actions: string[];
|
|
11
|
+
oracle: string;
|
|
12
|
+
text: string;
|
|
13
|
+
}
|
|
14
|
+
export interface StructuralRetrievalQuery {
|
|
15
|
+
id: string;
|
|
16
|
+
familyId: string;
|
|
17
|
+
split: CorpusSplit;
|
|
18
|
+
transformation: StructuralTransformation;
|
|
19
|
+
text: string;
|
|
20
|
+
relevantPatternIds: string[];
|
|
21
|
+
mustNotRankAbove: Array<{
|
|
22
|
+
lowerPatternId: string;
|
|
23
|
+
higherPatternId: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
export interface StructuralRetrievalCorpus {
|
|
27
|
+
schemaVersion: 'aqe-structural-retrieval/v1';
|
|
28
|
+
corpusRevision: string;
|
|
29
|
+
lineageHash: string;
|
|
30
|
+
patterns: StructuralPattern[];
|
|
31
|
+
queries: StructuralRetrievalQuery[];
|
|
32
|
+
}
|
|
33
|
+
export interface RankedCandidate {
|
|
34
|
+
patternId: string;
|
|
35
|
+
score: number;
|
|
36
|
+
}
|
|
37
|
+
export type RetrievalDiagnostic = 'success' | 'not_retrieved' | 'retrieved_misranked' | 'ranked_not_used' | 'used_no_benefit';
|
|
38
|
+
export interface QueryRetrievalResult {
|
|
39
|
+
queryId: string;
|
|
40
|
+
candidates: RankedCandidate[];
|
|
41
|
+
appliedPatternIds?: string[];
|
|
42
|
+
outcomeImproved?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface MetricEstimate {
|
|
45
|
+
value: number;
|
|
46
|
+
confidenceInterval: {
|
|
47
|
+
lower: number;
|
|
48
|
+
upper: number;
|
|
49
|
+
level: 0.95;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface RetrievalMetricSet {
|
|
53
|
+
support: number;
|
|
54
|
+
recallAtK: MetricEstimate;
|
|
55
|
+
hitAt1: MetricEstimate;
|
|
56
|
+
mrr: MetricEstimate;
|
|
57
|
+
ndcg: MetricEstimate;
|
|
58
|
+
top1Margin: MetricEstimate;
|
|
59
|
+
}
|
|
60
|
+
export interface StructuralRetrievalReport {
|
|
61
|
+
corpusRevision: string;
|
|
62
|
+
corpusLineageHash: string;
|
|
63
|
+
rankerVersion: string;
|
|
64
|
+
k: number;
|
|
65
|
+
overall: RetrievalMetricSet;
|
|
66
|
+
slices: Partial<Record<StructuralTransformation, RetrievalMetricSet>>;
|
|
67
|
+
diagnostics: Record<RetrievalDiagnostic, number>;
|
|
68
|
+
relationViolations: number;
|
|
69
|
+
}
|
|
70
|
+
export interface RetrievalReceipt {
|
|
71
|
+
schemaVersion: 'aqe-retrieval-receipt/v1';
|
|
72
|
+
receiptId: string;
|
|
73
|
+
revision: string;
|
|
74
|
+
queryId: string;
|
|
75
|
+
queryRepresentationVersion: string;
|
|
76
|
+
embeddingSpaceId: string;
|
|
77
|
+
rankerVersion: string;
|
|
78
|
+
candidates: RankedCandidate[];
|
|
79
|
+
appliedPatternIds: string[];
|
|
80
|
+
outcomeRef: string | null;
|
|
81
|
+
outcomeImproved: boolean | null;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=types.d.ts.map
|