agentic-qe 3.10.1 → 3.10.3
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/hooks/README.txt +17 -0
- package/.claude/hooks/aqe-hook.cjs +98 -0
- package/.claude/hooks/cross-phase-memory.yaml +296 -0
- package/.claude/hooks/post-task-sync.sh +113 -0
- package/.claude/hooks/v3-domain-workers.json +121 -0
- package/.claude/skills/release/SKILL.md +10 -10
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +131 -0
- package/assets/grammars/tree-sitter-c_sharp.wasm +0 -0
- package/assets/grammars/tree-sitter-java.wasm +0 -0
- package/assets/grammars/tree-sitter-javascript.wasm +0 -0
- package/assets/grammars/tree-sitter-python.wasm +0 -0
- package/assets/grammars/tree-sitter-rust.wasm +0 -0
- package/assets/grammars/tree-sitter-swift.wasm +0 -0
- package/assets/grammars/tree-sitter-tsx.wasm +0 -0
- package/assets/grammars/tree-sitter-typescript.wasm +0 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/agents/claim-verifier/claim-verifier-service.js +4 -2
- package/dist/agents/claim-verifier/verifiers/test-verifier.js +31 -23
- package/dist/agents/devils-advocate/agent.js +1 -1
- package/dist/cli/bundle.js +5 -5
- package/dist/cli/chunks/adapter-BHPUKMJ5.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-FZLWOPSX.js → agent-booster-wasm-NGC6LSQP.js} +2 -2
- package/dist/cli/chunks/{agent-handler-KAGRVCKS.js → agent-handler-P2IJE4GK.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-JJKFEXQW.js → agent-memory-branch-JXRJ5GKQ.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-JQ5WD2HM.js +2 -0
- package/dist/cli/chunks/{audit-DN5SY4JJ.js → audit-BMQ3VESB.js} +2 -2
- package/dist/cli/chunks/base-E32WLGY2.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-YX6OOBN6.js → better-sqlite3-HP4JZS6K.js} +2 -2
- package/dist/cli/chunks/{brain-handler-O7MP5BGY.js → brain-handler-SACNDFSW.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-ZPTN5J6V.js → branch-enumerator-LFOTVUDA.js} +2 -2
- package/dist/cli/chunks/{browser-PAZE2JSD.js → browser-FK7PRF3W.js} +2 -2
- package/dist/cli/chunks/browser-workflow-LNNXXAJG.js +2 -0
- package/dist/cli/chunks/{chunk-BF7MUYWC.js → chunk-2EQVYYBF.js} +2 -2
- package/dist/cli/chunks/{chunk-BGBSYF3K.js → chunk-2L73WXA4.js} +2 -2
- package/dist/cli/chunks/{chunk-W2DT3CDE.js → chunk-2ULVCLOW.js} +2 -2
- package/dist/cli/chunks/{chunk-FJSR2U65.js → chunk-3HBWDG62.js} +2 -2
- package/dist/cli/chunks/{chunk-WPNZSL4S.js → chunk-3JAOFKEU.js} +2 -2
- package/dist/cli/chunks/{chunk-2TDWCXZ6.js → chunk-3LRK7PYN.js} +2 -2
- package/dist/cli/chunks/{chunk-MVGVD6LS.js → chunk-3RZL4QTT.js} +2 -2
- package/dist/cli/chunks/chunk-3VF3HCG4.js +2 -0
- package/dist/cli/chunks/{chunk-6E7GI2UB.js → chunk-3X2ZQ55B.js} +4 -4
- package/dist/cli/chunks/{chunk-6QFONVEE.js → chunk-4CYLSXA6.js} +2 -2
- package/dist/cli/chunks/{chunk-VOIWDPIU.js → chunk-4OUAHZX2.js} +2 -2
- package/dist/cli/chunks/{chunk-EIROAH6N.js → chunk-4QFAUSWQ.js} +2 -2
- package/dist/cli/chunks/{chunk-ZEMXMDD3.js → chunk-5ER3COX3.js} +2 -2
- package/dist/cli/chunks/{chunk-ECPB7IAH.js → chunk-5EWWA4QP.js} +4 -4
- package/dist/cli/chunks/{chunk-AUVC3DDB.js → chunk-5G5AAEFF.js} +2 -2
- package/dist/cli/chunks/{chunk-RRLQFFCO.js → chunk-5IBJURYB.js} +3 -3
- package/dist/cli/chunks/chunk-5LON3MLI.js +2 -0
- package/dist/cli/chunks/{chunk-WMG5F6R6.js → chunk-5SGEOO2F.js} +2 -2
- package/dist/cli/chunks/{chunk-SQBB2DC6.js → chunk-6B4S7PKP.js} +3 -3
- package/dist/cli/chunks/{chunk-H44WD7QX.js → chunk-6FL3GN4T.js} +2 -2
- package/dist/cli/chunks/{chunk-7MSYTHZM.js → chunk-6GCOIIHY.js} +2 -2
- package/dist/cli/chunks/{chunk-KKNBYXYA.js → chunk-6Q2PPOOF.js} +1 -1
- package/dist/cli/chunks/{chunk-K4T3RDCB.js → chunk-6ZK24V2Y.js} +2 -2
- package/dist/cli/chunks/{chunk-G3BQU3Q6.js → chunk-72LE6PHL.js} +3 -3
- package/dist/cli/chunks/{chunk-F3OVFA6W.js → chunk-7RMZAVGO.js} +2 -2
- package/dist/cli/chunks/{chunk-YYWIA5FX.js → chunk-7SEHQTYD.js} +1 -1
- package/dist/cli/chunks/{chunk-UU2Q6XWF.js → chunk-7YYTTWGY.js} +1 -1
- package/dist/cli/chunks/{chunk-XKOKMS5A.js → chunk-7ZSPCGTI.js} +2 -2
- package/dist/cli/chunks/{chunk-RWYW573C.js → chunk-ADV4DH3W.js} +5 -5
- package/dist/cli/chunks/{chunk-OC3OJWLB.js → chunk-AEJVOJPT.js} +2 -2
- package/dist/cli/chunks/{chunk-2UN4DOBJ.js → chunk-B5MMDMH6.js} +2 -2
- package/dist/cli/chunks/{chunk-WQEZKAUR.js → chunk-BO2OV2RH.js} +2 -2
- package/dist/cli/chunks/{chunk-NPSBMDVU.js → chunk-BT3QLWII.js} +2 -2
- package/dist/cli/chunks/{chunk-6VQ5MFJ6.js → chunk-BWP3UVPE.js} +7 -7
- package/dist/cli/chunks/{chunk-SLNGJW4G.js → chunk-C6BBRM2J.js} +1 -1
- package/dist/cli/chunks/{chunk-4AWJ5PE4.js → chunk-CAMEFWRK.js} +1 -1
- package/dist/cli/chunks/{chunk-BECU52UY.js → chunk-CNEWYJKT.js} +4 -4
- package/dist/cli/chunks/{chunk-EO4B5GS4.js → chunk-CTDO2UB2.js} +1 -1
- package/dist/cli/chunks/{chunk-GTGONWGX.js → chunk-D2FBUOAR.js} +1 -1
- package/dist/cli/chunks/{chunk-OQP5OFRR.js → chunk-DF3MJ2YL.js} +1 -1
- package/dist/cli/chunks/{chunk-KEC5FBAW.js → chunk-DY5KEOHX.js} +1 -1
- package/dist/cli/chunks/{chunk-EBQ6YKP2.js → chunk-E2BJT6A7.js} +3 -3
- package/dist/cli/chunks/{chunk-WDTCCPK4.js → chunk-EETVN2OJ.js} +1 -1
- package/dist/cli/chunks/{chunk-UDVX34ZG.js → chunk-ERYMAYJW.js} +20 -17
- package/dist/cli/chunks/{chunk-ELUERFGA.js → chunk-FJGSEPFL.js} +2 -2
- package/dist/cli/chunks/{chunk-BN7ERYXI.js → chunk-FLTPHVZ3.js} +1 -1
- package/dist/cli/chunks/{chunk-OVENSL64.js → chunk-FND6V2RV.js} +22 -22
- package/dist/cli/chunks/{chunk-5ZCVMR5E.js → chunk-FU77CDEM.js} +2 -2
- package/dist/cli/chunks/{chunk-VKRMVTWU.js → chunk-GELF4ILR.js} +37 -37
- package/dist/cli/chunks/{chunk-H22MMMYY.js → chunk-GHNNJHH3.js} +2 -2
- package/dist/cli/chunks/{chunk-32R7EA7B.js → chunk-GJUGSH7T.js} +3 -3
- package/dist/cli/chunks/{chunk-HPNEZ7YN.js → chunk-GL3HZN3O.js} +1 -1
- package/dist/cli/chunks/{chunk-WL2J6ECN.js → chunk-H56AROF2.js} +2 -2
- package/dist/cli/chunks/{chunk-GTRXZJNX.js → chunk-HAO3SPOE.js} +2 -2
- package/dist/cli/chunks/{chunk-PUXDXIUE.js → chunk-HM523MTQ.js} +1 -1
- package/dist/cli/chunks/{chunk-KRXKU54J.js → chunk-HMFEPKAR.js} +2 -2
- package/dist/cli/chunks/{chunk-3YOPJ7DY.js → chunk-HQJMCTWN.js} +2 -2
- package/dist/cli/chunks/{chunk-LF7URN2X.js → chunk-HRLXU4LH.js} +2 -2
- package/dist/cli/chunks/{chunk-TL5F2S3Z.js → chunk-HWM2XJ3P.js} +24 -24
- package/dist/cli/chunks/{chunk-6A2NIR2E.js → chunk-I42R57ON.js} +2 -2
- package/dist/cli/chunks/chunk-IL2KOW5W.js +2 -0
- package/dist/cli/chunks/{chunk-CR4ERDS2.js → chunk-IRR7YA3Q.js} +2 -2
- package/dist/cli/chunks/{chunk-Y2DPXMOR.js → chunk-JD2PG4KS.js} +1 -1
- package/dist/cli/chunks/{chunk-TFNLXAK5.js → chunk-JE3C7JYN.js} +1 -1
- package/dist/cli/chunks/{chunk-ZTMWJQTZ.js → chunk-JLL27IGU.js} +2 -2
- package/dist/cli/chunks/{chunk-YPOTBXPU.js → chunk-JOLDCS6X.js} +2 -2
- package/dist/cli/chunks/chunk-JP63XACW.js +62 -0
- package/dist/cli/chunks/{chunk-AABKTWXC.js → chunk-JSFYPLMQ.js} +2 -2
- package/dist/cli/chunks/{chunk-KCTH5MHE.js → chunk-JTF6D2RJ.js} +4 -4
- package/dist/cli/chunks/{chunk-GRG3OP34.js → chunk-JTZ3Q2QS.js} +2 -2
- package/dist/cli/chunks/chunk-JXIPRMAY.js +95 -0
- package/dist/cli/chunks/{chunk-TNGGVMPQ.js → chunk-KG5SM36Y.js} +1 -1
- package/dist/cli/chunks/{chunk-QNW335PD.js → chunk-KTRB3L53.js} +2 -2
- package/dist/cli/chunks/{chunk-XRK7FBTY.js → chunk-L74CHKFR.js} +2 -2
- package/dist/cli/chunks/{chunk-IHDUWPFY.js → chunk-LZ6TNTGO.js} +2 -2
- package/dist/cli/chunks/{chunk-Y357YFLF.js → chunk-M5CDW2ZH.js} +2 -2
- package/dist/cli/chunks/{chunk-GRYXNWPF.js → chunk-MBSJ5G4I.js} +12 -12
- package/dist/cli/chunks/{chunk-IPRDHKSI.js → chunk-MC7K44M4.js} +2 -2
- package/dist/cli/chunks/{chunk-TP77PNN6.js → chunk-MQOFFRTA.js} +2 -2
- package/dist/cli/chunks/{chunk-JLKHPIQF.js → chunk-N7IBYDW5.js} +1 -1
- package/dist/cli/chunks/{chunk-G5DTENO3.js → chunk-NEYYLAYS.js} +5 -5
- package/dist/cli/chunks/{chunk-TNVYKYTO.js → chunk-NNVXHC74.js} +3 -3
- package/dist/cli/chunks/{chunk-HRDGN3OK.js → chunk-NNZMEYLT.js} +1 -1
- package/dist/cli/chunks/{chunk-25QGPRWN.js → chunk-NRCL3WCP.js} +2 -2
- package/dist/cli/chunks/{chunk-NRLT44YB.js → chunk-NXPFGPHV.js} +1 -1
- package/dist/cli/chunks/{chunk-PXFQSVA2.js → chunk-NZHOKLII.js} +3 -3
- package/dist/cli/chunks/{chunk-7SQD2TTQ.js → chunk-OG7CWWFR.js} +1 -1
- package/dist/cli/chunks/{chunk-XGUQYVJR.js → chunk-OPDTDKN3.js} +2 -2
- package/dist/cli/chunks/{chunk-2KTRRSKD.js → chunk-OX4R55T3.js} +2 -2
- package/dist/cli/chunks/{chunk-COZDJLIL.js → chunk-PFCAMX6H.js} +1 -1
- package/dist/cli/chunks/{chunk-UDFLR7GR.js → chunk-PL5SLO2W.js} +1 -1
- package/dist/cli/chunks/{chunk-6ZRMQXVL.js → chunk-PZHZPX3O.js} +4 -4
- package/dist/cli/chunks/{chunk-57NJQV57.js → chunk-Q7EBD24B.js} +1 -1
- package/dist/cli/chunks/{chunk-6D57DWQ6.js → chunk-QEODION5.js} +2 -2
- package/dist/cli/chunks/{chunk-K22TPWOJ.js → chunk-QM65UGPV.js} +2 -2
- package/dist/cli/chunks/{chunk-2ETDES5W.js → chunk-QWG76RHA.js} +2 -2
- package/dist/cli/chunks/{chunk-GXJ4BCGC.js → chunk-R5ONQAQL.js} +2 -2
- package/dist/cli/chunks/{chunk-KZJXVIAW.js → chunk-RNF47IJ5.js} +4 -4
- package/dist/cli/chunks/{chunk-IK6AJX3C.js → chunk-RTDHWOAG.js} +1 -1
- package/dist/cli/chunks/{chunk-NQZYUH6S.js → chunk-RZCAA2PZ.js} +1 -1
- package/dist/cli/chunks/{chunk-DQIS6J77.js → chunk-SL6YZAT4.js} +2 -2
- package/dist/cli/chunks/{chunk-RPL6K623.js → chunk-SNTMAVPH.js} +5 -5
- package/dist/cli/chunks/{chunk-MQYTW2IN.js → chunk-SWOG3PBD.js} +2 -2
- package/dist/cli/chunks/{chunk-DMIYWPQQ.js → chunk-T63EK6GH.js} +2 -2
- package/dist/cli/chunks/chunk-U6UK3UMX.js +59 -0
- package/dist/cli/chunks/{chunk-2S4XHK26.js → chunk-U7NMPZE2.js} +2 -2
- package/dist/cli/chunks/{chunk-WS4XVJHI.js → chunk-UDV4YB42.js} +1 -1
- package/dist/cli/chunks/{chunk-P7T5Y735.js → chunk-UHDBM7QS.js} +2 -2
- package/dist/cli/chunks/{chunk-5EU2VQK3.js → chunk-UIJFU4KD.js} +2 -2
- package/dist/cli/chunks/{chunk-Q24OJX44.js → chunk-USFZ4IJD.js} +2 -2
- package/dist/cli/chunks/{chunk-Q5VHBI4U.js → chunk-UZL366ZI.js} +1 -1
- package/dist/cli/chunks/{chunk-GMKGLZJU.js → chunk-VDTFRMES.js} +2 -2
- package/dist/cli/chunks/{chunk-EUJHHXE6.js → chunk-VIWIO27R.js} +3 -3
- package/dist/cli/chunks/{chunk-PLRSKAFZ.js → chunk-VRXY4T22.js} +2 -2
- package/dist/cli/chunks/{chunk-NDCPEXDN.js → chunk-WPVCSFDA.js} +2 -2
- package/dist/cli/chunks/{chunk-TX7SNQKL.js → chunk-WWD5IWTV.js} +1 -1
- package/dist/cli/chunks/{chunk-T3UXMPXX.js → chunk-X2B7SANM.js} +1 -1
- package/dist/cli/chunks/{chunk-7CKVAYP3.js → chunk-X3RJ6SFC.js} +1 -1
- package/dist/cli/chunks/{chunk-6LRCMFLV.js → chunk-XTP2GHI7.js} +2 -2
- package/dist/cli/chunks/{chunk-W6ZF2CPN.js → chunk-YDDZJCKY.js} +1 -1
- package/dist/cli/chunks/{chunk-5KFCH7RH.js → chunk-YDKYLNKZ.js} +1 -1
- package/dist/cli/chunks/{chunk-ELZ67OHQ.js → chunk-YIYV2JB6.js} +2 -2
- package/dist/cli/chunks/{chunk-PW6MOFXG.js → chunk-YX2HY4MX.js} +2 -2
- package/dist/cli/chunks/{chunk-DVOH75S4.js → chunk-YXH2CVAF.js} +1 -1
- package/dist/cli/chunks/{chunk-IITKJCPK.js → chunk-YYAPO3CU.js} +3 -3
- package/dist/cli/chunks/{chunk-5OTYBWRL.js → chunk-Z2K5IZM6.js} +2 -2
- package/dist/cli/chunks/{chunk-NOCYYXK4.js → chunk-ZG4P3DTL.js} +2 -2
- package/dist/cli/chunks/{chunk-YGRTMAWB.js → chunk-ZXQNE4QV.js} +1 -1
- package/dist/cli/chunks/{ci-EHRUN7O6.js → ci-AWZ3S5OT.js} +6 -6
- package/dist/cli/chunks/{ci-output-EXDXVXKB.js → ci-output-JLCYTIMT.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-LM4QRAAL.js → circuit-breaker-BJDKBDIL.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-ZHUCZVW7.js → claude-flow-setup-KKOP5ZMO.js} +2 -2
- package/dist/cli/chunks/client-2UKBYFX4.js +2 -0
- package/dist/cli/chunks/{cline-installer-WMFLQOW2.js → cline-installer-7M525SEA.js} +2 -2
- package/dist/cli/chunks/{code-L7KRLU5E.js → code-27SUVJDO.js} +20 -19
- package/dist/cli/chunks/{code-index-extractor-FTMUYQC6.js → code-index-extractor-TTQQZLAK.js} +2 -2
- package/dist/cli/chunks/{codex-installer-B3F6WI3Z.js → codex-installer-GHNGNPKP.js} +2 -2
- package/dist/cli/chunks/{completions-3JZQRNB6.js → completions-JPJD24DG.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-LB2FFEKX.js → complexity-analyzer-Q74EJV33.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-WH6IMV7R.js → continuedev-installer-ULTRDIML.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-NOIEOFJM.js → copilot-installer-EK52X4CG.js} +2 -2
- package/dist/cli/chunks/{cost-tracker-IKX2VYSA.js → cost-tracker-2GKBRYXL.js} +2 -2
- package/dist/cli/chunks/{coverage-TD37CYSY.js → coverage-YCLC3W2A.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-FPM3L27L.js +2 -0
- package/dist/cli/chunks/{cursor-installer-4NSVGRM5.js → cursor-installer-B3ALFW5E.js} +2 -2
- package/dist/cli/chunks/{daemon-UWEBUIDT.js → daemon-YWINEHG4.js} +4 -4
- package/dist/cli/chunks/{daemon-LYDV7NRW.js → daemon-ZKEBVLJA.js} +3 -3
- package/dist/cli/chunks/{dag-attention-scheduler-NECJGCHC.js → dag-attention-scheduler-OQPJ6ULA.js} +2 -2
- package/dist/cli/chunks/{detect-4XGC7ILO.js → detect-YMYIQH3Q.js} +2 -2
- package/dist/cli/chunks/{dist-node-GGJDXRKJ.js → dist-node-R4FAYQRY.js} +2 -2
- package/dist/cli/chunks/{domain-handler-UOFONAUT.js → domain-handler-IGWXLF2S.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-6JLNOYPA.js → domain-transfer-A7YNO76C.js} +2 -2
- package/dist/cli/chunks/dream-XM33US3V.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-ZM75DQ4J.js → embed-and-insert-pattern-KODZAS7Y.js} +2 -2
- package/dist/cli/chunks/{eval-CYZJTHEB.js → eval-ALQW7Q2S.js} +3 -3
- package/dist/cli/chunks/{experience-capture-middleware-RBOJLDUB.js → experience-capture-middleware-3WK4RXWK.js} +3 -3
- package/dist/cli/chunks/{fast-paths-S5BWZR3L.js → fast-paths-PQWDFIJZ.js} +2 -2
- package/dist/cli/chunks/{feature-flags-DUNQPDU3.js → feature-flags-6X33B3WX.js} +2 -2
- package/dist/cli/chunks/{feature-flags-6E7H3NYP.js → feature-flags-JRUAZCND.js} +2 -2
- package/dist/cli/chunks/{file-discovery-PFFKDGYG.js → file-discovery-SA3YU3IH.js} +2 -2
- package/dist/cli/chunks/{fleet-RCDZZFXN.js → fleet-7TXCAOKQ.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-5AG3WDWF.js → gnn-wrapper-ZKNYACEC.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-O2KAEX4Y.js → heartbeat-handler-KRZRZ23F.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-GM3M2MTG.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-K62GEHIL.js +2 -0
- package/dist/cli/chunks/hnsw-index-VCAK3TWN.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-C7FG6YGW.js → hnsw-legacy-bridge-LVHQ5SG7.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-XGPW4HK5.js → hnswlib-node-64EGGWIC.js} +2 -2
- package/dist/cli/chunks/{hooks-FUHNE2P7.js → hooks-6Y3UHYI2.js} +14 -14
- package/dist/cli/chunks/hybrid-router-432QNCNG.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-LQRYBNPV.js → hypergraph-engine-2EZBZMFK.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-AFFNLZVD.js → hypergraph-handler-GLPWYII2.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-VTSISNN4.js +2 -0
- package/dist/cli/chunks/{init-handler-BQ6IDBX4.js → init-handler-ZSDO5VMA.js} +6 -6
- package/dist/cli/chunks/init-wizard-COB5AH7Q.js +2 -0
- package/dist/cli/chunks/kernel-ROK7X5FM.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-KS72HUSG.js → kilocode-installer-ATYSDWIV.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-2ZEFLGRX.js → kiro-installer-K66YT6PC.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-YUWIDIWW.js +2 -0
- package/dist/cli/chunks/{learning-GGHGJ6B6.js → learning-BVYCC4RI.js} +3 -3
- package/dist/cli/chunks/{llm-router-LP6K5BJF.js → llm-router-VBCXE6DN.js} +12 -12
- package/dist/cli/chunks/llm-router-service-7VLXJ7VE.js +2 -0
- package/dist/cli/chunks/{load-2MLKXOT2.js → load-AREDQE2U.js} +2 -2
- package/dist/cli/chunks/load-test-32524DL3.js +2 -0
- package/dist/cli/chunks/{mcp-CDJBJG5H.js → mcp-NG6H6UC5.js} +2 -2
- package/dist/cli/chunks/{memory-4LAX7JZS.js → memory-Y65EHG6N.js} +5 -5
- package/dist/cli/chunks/memory-backend-BI2V5AAB.js +2 -0
- package/dist/cli/chunks/memory-handlers-NSOFWVFN.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-SLJV73HE.js → multi-model-executor-VRPRFUZT.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-M76SONWV.js → opencode-installer-CKQXPM5R.js} +3 -3
- package/dist/cli/chunks/{orchestrator-TJPUDJMP.js → orchestrator-I7JBKD6G.js} +19 -19
- package/dist/cli/chunks/{pipeline-2PVNFT6J.js → pipeline-MV2RWCBI.js} +2 -2
- package/dist/cli/chunks/{platform-KCSEDKEE.js → platform-VU5P3SOG.js} +2 -2
- package/dist/cli/chunks/{plugin-QX47QF5U.js → plugin-6TERLKCB.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-L6VWL7VR.js → prime-radiant-advanced-wasm-WIUIN2DL.js} +2 -2
- package/dist/cli/chunks/protocol-executor-2UPB7SPI.js +2 -0
- package/dist/cli/chunks/{protocol-handler-WDNJDEUE.js → protocol-handler-HKWBGARO.js} +2 -2
- package/dist/cli/chunks/{prove-3B75DA3S.js → prove-7CQPHBRJ.js} +2 -2
- package/dist/cli/chunks/provider-manager-PDT37MIJ.js +2 -0
- package/dist/cli/chunks/qe-reasoning-bank-AQQ2BI4V.js +2 -0
- package/dist/cli/chunks/{quality-UGASS5WM.js → quality-VLUVXKVG.js} +2 -2
- package/dist/cli/chunks/queen-coordinator-6DVDVEU4.js +2 -0
- package/dist/cli/chunks/{real-embeddings-COBP2LHS.js → real-embeddings-JPZ64KK2.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-TOZ4VLFT.js → roocode-installer-NONVB3UE.js} +2 -2
- package/dist/cli/chunks/router-O2G4KQ6L.js +2 -0
- package/dist/cli/chunks/routing-feedback-TAGTD3KQ.js +2 -0
- package/dist/cli/chunks/{routing-handler-5TDVSILX.js → routing-handler-YYXDT4J2.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-AM63KWQN.js → ruvector-commands-5PFMNDLR.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-UANIFE2M.js → rvf-dual-writer-TF6H7AXH.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-LNPYWAPI.js → rvf-migration-adapter-VNGIUZCO.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-U47L63DQ.js → rvf-migration-coordinator-VA52YAIY.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-46GRWQJR.js +2 -0
- package/dist/cli/chunks/safe-db-LNIPXXHH.js +2 -0
- package/dist/cli/chunks/schedule-AUH3ZALY.js +2 -0
- package/dist/cli/chunks/scheduler-KK3OYPWW.js +2 -0
- package/dist/cli/chunks/{security-KDQ2AH7G.js → security-62HEETBF.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-5MAGLLYJ.js → shared-rvf-adapter-XWTQPGCT.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-GF2OPPM5.js → shared-rvf-dual-writer-JTZK7LRD.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-CYESP7NG.js +2 -0
- package/dist/cli/chunks/{status-handler-XZKEL7LO.js → status-handler-LSUPUKRF.js} +2 -2
- package/dist/cli/chunks/{structural-health-27QKWW25.js → structural-health-Z75A666N.js} +2 -2
- package/dist/cli/chunks/{sync-INNKS6UK.js → sync-M3O4T3A3.js} +2 -2
- package/dist/cli/chunks/{sync-V3HGPEJT.js → sync-VI37UHHH.js} +2 -2
- package/dist/cli/chunks/{task-handler-LDUVOM6G.js → task-handler-AQBSZAQC.js} +2 -2
- package/dist/cli/chunks/{task-handlers-HTCPV7OO.js → task-handlers-BOZP247V.js} +3 -3
- package/dist/cli/chunks/{test-PCUVGVJL.js → test-FTEGPNN2.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-GYVXWCAA.js → test-scheduling-IGR4U2VQ.js} +4 -4
- package/dist/cli/chunks/{token-bootstrap-MJ2ANC4P.js → token-bootstrap-2DFRVMBM.js} +2 -2
- package/dist/cli/chunks/{token-usage-ZREHROTF.js → token-usage-VCHV47EO.js} +3 -3
- package/dist/cli/chunks/{transformers-6B3FWFYL.js → transformers-M27QSNFH.js} +2 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-IIGEJYFU.js +2 -0
- package/dist/cli/chunks/{types-MVZTJI2F.js → types-RQFPUUKA.js} +2 -2
- package/dist/cli/chunks/unified-memory-RISHEANP.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-2IKXGMNZ.js +2 -0
- package/dist/cli/chunks/unified-persistence-ZTTUJNTU.js +2 -0
- package/dist/cli/chunks/{upgrade-MKTFEILD.js → upgrade-VJMYX3AL.js} +2 -2
- package/dist/cli/chunks/{validate-IABGALSW.js → validate-ML7HUAU5.js} +4 -4
- package/dist/cli/chunks/{validate-swarm-RHF53RF6.js → validate-swarm-RCR6EYRC.js} +7 -7
- package/dist/cli/chunks/{vibium-RAKW6FMF.js → vibium-ZOOS3W5L.js} +2 -2
- package/dist/cli/chunks/visual-security-D66DTAO5.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-PYK7F4JZ.js → web-tree-sitter-2YPGYLWK.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-S3U2HWZ4.js → windsurf-installer-GOJWUWC5.js} +2 -2
- package/dist/cli/chunks/{witness-chain-435NKQLB.js → witness-chain-3MGSS3Q4.js} +2 -2
- package/dist/cli/chunks/witness-chain-RHWHHDLV.js +2 -0
- package/dist/cli/chunks/{workflow-5UHJCZ6J.js → workflow-B5Q77BI4.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-OQMFW2TC.js +2 -0
- package/dist/cli/chunks/{wrappers-RD3NCMLK.js → wrappers-MM5VLEPG.js} +2 -2
- package/dist/cli/commands/code.js +6 -0
- package/dist/cli/commands/hooks-handlers/command-hooks.js +1 -1
- package/dist/cli/commands/hooks-handlers/routing-hooks.js +1 -1
- package/dist/cli/commands/hooks-handlers/task-hooks.js +1 -1
- package/dist/cli/commands/learning.js +5 -5
- package/dist/cli/commands/llm-router.js +1 -1
- package/dist/cli/commands/workflow.js +1 -0
- package/dist/coordination/consensus/providers/native-learning-provider.d.ts +1 -1
- package/dist/coordination/consensus/providers/ollama-provider.d.ts +1 -1
- package/dist/coordination/consensus/providers/openrouter-provider.d.ts +1 -1
- package/dist/coordination/handlers/code-intelligence-handlers.js +6 -0
- package/dist/coordination/mincut/neural-goap.js +24 -20
- package/dist/coordination/protocols/code-intelligence-index.js +31 -25
- package/dist/coordination/queen-coordinator.js +4 -0
- package/dist/coordination/queen-work-stealing.js +1 -2
- package/dist/domains/chaos-resilience/coordinator.js +19 -15
- package/dist/domains/chaos-resilience/services/chaos-engineer.js +5 -2
- package/dist/domains/chaos-resilience/services/load-tester.js +15 -11
- package/dist/domains/code-intelligence/interfaces.d.ts +5 -0
- package/dist/domains/code-intelligence/services/c4-model/index.js +12 -6
- package/dist/domains/code-intelligence/services/impact-analyzer.js +6 -2
- package/dist/domains/code-intelligence/services/knowledge-graph.d.ts +42 -0
- package/dist/domains/code-intelligence/services/knowledge-graph.js +278 -93
- package/dist/domains/code-intelligence/services/semantic-analyzer.js +8 -2
- package/dist/domains/contract-testing/coordinator.js +1 -1
- package/dist/domains/coverage-analysis/coordinator.js +4 -2
- package/dist/domains/learning-optimization/coordinator.js +1 -0
- package/dist/domains/quality-assessment/coherence/gate-controller.js +32 -26
- package/dist/domains/requirements-validation/coordinator.js +1 -0
- package/dist/domains/test-execution/services/e2e/wait-condition-handler.js +1 -1
- package/dist/domains/test-execution/services/retry-handler.js +18 -12
- package/dist/domains/test-generation/coordinator.js +1 -1
- package/dist/domains/test-generation/services/pattern-matcher.js +7 -5
- package/dist/domains/test-generation/services/test-generator.js +3 -2
- package/dist/domains/visual-accessibility/coordinator.js +24 -20
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/init/init-wizard-hooks.js +271 -271
- package/dist/init/phases/07-hooks.d.ts +7 -0
- package/dist/init/phases/07-hooks.js +132 -96
- package/dist/init/phases/12-verification.js +3 -3
- package/dist/integrations/agentic-flow/model-router/router.js +1 -1
- package/dist/integrations/embeddings/base/EmbeddingGenerator.js +11 -7
- package/dist/integrations/ruvector/hypergraph-engine.js +2 -2
- package/dist/integrations/ruvector/spectral-math.js +2 -2
- package/dist/integrations/ruvector/spectral-sparsifier.js +1 -1
- package/dist/kernel/kernel.js +1 -1
- package/dist/kernel/unified-memory-hnsw.js +1 -0
- package/dist/learning/agent-routing.d.ts +19 -0
- package/dist/learning/agent-routing.js +27 -1
- package/dist/learning/dream/dream-scheduler.d.ts +11 -36
- package/dist/learning/dream/dream-scheduler.js +44 -0
- package/dist/learning/experience-capture.js +1 -1
- package/dist/learning/experience-consolidation.d.ts +16 -0
- package/dist/learning/experience-consolidation.js +55 -11
- package/dist/learning/pattern-lifecycle.d.ts +21 -0
- package/dist/learning/pattern-lifecycle.js +70 -6
- package/dist/learning/qe-reasoning-bank.js +9 -1
- package/dist/learning/qe-unified-memory.js +8 -6
- package/dist/mcp/bundle.js +371 -368
- package/dist/mcp/handlers/core-handlers.js +2 -2
- package/dist/mcp/handlers/cross-phase-handlers.js +5 -3
- package/dist/mcp/handlers/handler-factory.d.ts +5 -0
- package/dist/mcp/handlers/handler-factory.js +44 -4
- package/dist/mcp/http-server.js +1 -0
- package/dist/mcp/protocol-server.js +15 -16
- package/dist/mcp/tools/code-intelligence/analyze.js +1 -1
- package/dist/mcp/tools/learning-optimization/optimize.js +1 -1
- package/dist/mcp/tools/qx-analysis/heuristics-engine.js +195 -173
- package/dist/mcp/tools/visual-accessibility/index.js +1 -1
- package/dist/mcp/transport/stdio.d.ts +20 -0
- package/dist/mcp/transport/stdio.js +35 -2
- package/dist/mcp/transport/websocket/websocket-transport.js +1 -0
- package/dist/optimization/auto-tuner.js +1 -1
- package/dist/planning/goap-planner.js +1 -0
- package/dist/routing/agent-dependency-graph.js +4 -1
- package/dist/shared/llm/router/config-store.js +1 -1
- package/dist/shared/metrics/system-metrics.js +6 -4
- package/dist/shared/parsers/tree-sitter-wasm-parser.d.ts +12 -0
- package/dist/shared/parsers/tree-sitter-wasm-parser.js +35 -0
- package/dist/shared/parsers/treesitter-ts-extractor.d.ts +39 -0
- package/dist/shared/parsers/treesitter-ts-extractor.js +196 -0
- package/dist/shared/utils/rabitq.d.ts +133 -0
- package/dist/shared/utils/rabitq.js +201 -0
- package/dist/shared/utils/safe-expression-evaluator.js +8 -5
- package/dist/sync/cloud/postgres-writer.js +2 -0
- package/dist/sync/readers/json-reader.js +1 -1
- package/dist/test-scheduling/git-aware/test-selector.js +1 -1
- package/dist/workers/quality-daemon/index.js +26 -24
- package/package.json +12 -5
- package/dist/cli/chunks/adapter-3JS2CN7C.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-Q4GFNGU6.js +0 -2
- package/dist/cli/chunks/base-Q3MAL22Y.js +0 -2
- package/dist/cli/chunks/browser-workflow-JX3M2UWG.js +0 -2
- package/dist/cli/chunks/chunk-622MIAOR.js +0 -59
- package/dist/cli/chunks/chunk-CKECJH2A.js +0 -2
- package/dist/cli/chunks/chunk-IJ4BUSJN.js +0 -95
- package/dist/cli/chunks/chunk-VPCE5CIT.js +0 -2
- package/dist/cli/chunks/chunk-WO7KYT3X.js +0 -62
- package/dist/cli/chunks/client-PA3UJIHH.js +0 -2
- package/dist/cli/chunks/cross-domain-router-BVJRP2ZX.js +0 -2
- package/dist/cli/chunks/dream-BXZUEIW2.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-LEKAWFJF.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-2TCEG5M2.js +0 -2
- package/dist/cli/chunks/hnsw-index-VDPUTEES.js +0 -2
- package/dist/cli/chunks/hybrid-router-2EMDIYIG.js +0 -2
- package/dist/cli/chunks/impact-analyzer-HFD6CPWC.js +0 -2
- package/dist/cli/chunks/init-wizard-552QIVRC.js +0 -2
- package/dist/cli/chunks/kernel-5DN6O6EE.js +0 -2
- package/dist/cli/chunks/knowledge-graph-76Y77MB6.js +0 -2
- package/dist/cli/chunks/llm-router-service-4O6GCEFH.js +0 -2
- package/dist/cli/chunks/load-test-FCI2IWRJ.js +0 -2
- package/dist/cli/chunks/memory-backend-MKNCBNDE.js +0 -2
- package/dist/cli/chunks/memory-handlers-OBAFR4WV.js +0 -2
- package/dist/cli/chunks/protocol-executor-IA7WNT23.js +0 -2
- package/dist/cli/chunks/provider-manager-3K5KB5A6.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-V5Z3BBYY.js +0 -2
- package/dist/cli/chunks/queen-coordinator-QOMPA27Z.js +0 -2
- package/dist/cli/chunks/router-P5RZUPC4.js +0 -2
- package/dist/cli/chunks/routing-feedback-3PS3OZQC.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-TT7OJPKM.js +0 -2
- package/dist/cli/chunks/safe-db-PEW7VBAE.js +0 -2
- package/dist/cli/chunks/schedule-QHOTHBQE.js +0 -2
- package/dist/cli/chunks/scheduler-KXJBYTRT.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-TPXJK34J.js +0 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-JVV234MN.js +0 -2
- package/dist/cli/chunks/unified-memory-ROS2NKR5.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-FLEUF3XO.js +0 -2
- package/dist/cli/chunks/unified-persistence-QC5L7UNQ.js +0 -2
- package/dist/cli/chunks/visual-security-NLIOUQCR.js +0 -2
- package/dist/cli/chunks/witness-chain-U7X6JX5J.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-APE6BAXH.js +0 -2
|
@@ -1027,6 +1027,41 @@ export function isWasmAvailable() {
|
|
|
1027
1027
|
return false;
|
|
1028
1028
|
}
|
|
1029
1029
|
}
|
|
1030
|
+
// Cache of loaded grammars keyed by wasm filename, for the generic loader below.
|
|
1031
|
+
const loadedGrammarsByFile = new Map();
|
|
1032
|
+
/**
|
|
1033
|
+
* Generic grammar loader for callers outside the GRAMMAR_CONFIG set (e.g. the
|
|
1034
|
+
* code-intelligence TS/JS extractor). Reuses the proven WASM init + grammar
|
|
1035
|
+
* path resolution. Returns a `parse(code)` that yields a tree-sitter tree
|
|
1036
|
+
* (caller must call `tree.delete()`), or null if WASM/grammar is unavailable so
|
|
1037
|
+
* the caller can fall back.
|
|
1038
|
+
*/
|
|
1039
|
+
export async function loadWasmGrammar(wasmFile) {
|
|
1040
|
+
if (!isWasmAvailable())
|
|
1041
|
+
return null;
|
|
1042
|
+
try {
|
|
1043
|
+
await ensureTreeSitterInit();
|
|
1044
|
+
let language = loadedGrammarsByFile.get(wasmFile);
|
|
1045
|
+
if (!language) {
|
|
1046
|
+
language = await treeSitterModule.Language.load(resolveGrammarPath(wasmFile));
|
|
1047
|
+
loadedGrammarsByFile.set(wasmFile, language);
|
|
1048
|
+
}
|
|
1049
|
+
return {
|
|
1050
|
+
parse: (code) => {
|
|
1051
|
+
// New parser per call (cheap) to avoid cross-call setLanguage races.
|
|
1052
|
+
const ParserCtor = treeSitterModule.Parser ?? treeSitterModule;
|
|
1053
|
+
const parser = new ParserCtor();
|
|
1054
|
+
parser.setLanguage(language);
|
|
1055
|
+
const tree = parser.parse(code);
|
|
1056
|
+
parser.delete?.();
|
|
1057
|
+
return tree;
|
|
1058
|
+
},
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
catch {
|
|
1062
|
+
return null;
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1030
1065
|
/**
|
|
1031
1066
|
* Reset internal state — for testing only.
|
|
1032
1067
|
*/
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tree-sitter TypeScript/JavaScript extractor for code-intelligence.
|
|
3
|
+
*
|
|
4
|
+
* Extracts functions, classes (+ methods), interfaces and imports from TS/JS/TSX
|
|
5
|
+
* source using bundled tree-sitter WASM grammars — so code-intelligence works
|
|
6
|
+
* WITHOUT the multi-megabyte `typescript` compiler dependency (#511).
|
|
7
|
+
*
|
|
8
|
+
* The KnowledgeGraphService uses this as a fallback when the TypeScript compiler
|
|
9
|
+
* API isn't available. Returns `null` when WASM/grammar can't load so the caller
|
|
10
|
+
* can degrade gracefully.
|
|
11
|
+
*/
|
|
12
|
+
export interface TsFunction {
|
|
13
|
+
name: string;
|
|
14
|
+
startLine: number;
|
|
15
|
+
isAsync: boolean;
|
|
16
|
+
visibility: 'public' | 'private' | 'protected';
|
|
17
|
+
}
|
|
18
|
+
export interface TsClass {
|
|
19
|
+
name: string;
|
|
20
|
+
startLine: number;
|
|
21
|
+
methods: TsFunction[];
|
|
22
|
+
}
|
|
23
|
+
export interface TsInterface {
|
|
24
|
+
name: string;
|
|
25
|
+
startLine: number;
|
|
26
|
+
}
|
|
27
|
+
export interface TsExtraction {
|
|
28
|
+
functions: TsFunction[];
|
|
29
|
+
classes: TsClass[];
|
|
30
|
+
interfaces: TsInterface[];
|
|
31
|
+
imports: string[];
|
|
32
|
+
}
|
|
33
|
+
export declare function isTreeSitterTsExtension(ext: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Extract entities/imports from TS/JS/TSX source. Returns null if the grammar
|
|
36
|
+
* could not be loaded (WASM unavailable) so callers can fall back.
|
|
37
|
+
*/
|
|
38
|
+
export declare function extractTsJs(content: string, extension: string): Promise<TsExtraction | null>;
|
|
39
|
+
//# sourceMappingURL=treesitter-ts-extractor.d.ts.map
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tree-sitter TypeScript/JavaScript extractor for code-intelligence.
|
|
3
|
+
*
|
|
4
|
+
* Extracts functions, classes (+ methods), interfaces and imports from TS/JS/TSX
|
|
5
|
+
* source using bundled tree-sitter WASM grammars — so code-intelligence works
|
|
6
|
+
* WITHOUT the multi-megabyte `typescript` compiler dependency (#511).
|
|
7
|
+
*
|
|
8
|
+
* The KnowledgeGraphService uses this as a fallback when the TypeScript compiler
|
|
9
|
+
* API isn't available. Returns `null` when WASM/grammar can't load so the caller
|
|
10
|
+
* can degrade gracefully.
|
|
11
|
+
*/
|
|
12
|
+
import { loadWasmGrammar } from './tree-sitter-wasm-parser.js';
|
|
13
|
+
/** Map a file extension to its grammar wasm file. */
|
|
14
|
+
function grammarFor(ext) {
|
|
15
|
+
switch (ext) {
|
|
16
|
+
case 'ts':
|
|
17
|
+
case 'mts':
|
|
18
|
+
case 'cts':
|
|
19
|
+
return 'tree-sitter-typescript.wasm';
|
|
20
|
+
case 'tsx':
|
|
21
|
+
return 'tree-sitter-tsx.wasm';
|
|
22
|
+
case 'js':
|
|
23
|
+
case 'jsx':
|
|
24
|
+
case 'mjs':
|
|
25
|
+
case 'cjs':
|
|
26
|
+
return 'tree-sitter-javascript.wasm';
|
|
27
|
+
default:
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function isTreeSitterTsExtension(ext) {
|
|
32
|
+
return grammarFor(ext) !== null;
|
|
33
|
+
}
|
|
34
|
+
const line = (n) => n.startPosition.row + 1;
|
|
35
|
+
const fieldText = (n, field) => n.childForFieldName(field)?.text ?? '';
|
|
36
|
+
/** Whether a declaration node begins with the `async` keyword. */
|
|
37
|
+
function isAsync(n) {
|
|
38
|
+
for (let i = 0; i < n.childCount; i++) {
|
|
39
|
+
const c = n.child(i);
|
|
40
|
+
if (!c)
|
|
41
|
+
continue;
|
|
42
|
+
if (c.type === 'async')
|
|
43
|
+
return true;
|
|
44
|
+
// keyword precedes the function/method keyword; stop once we pass it
|
|
45
|
+
if (c.type === 'function' || c.type === 'function_declaration')
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
function methodVisibility(n) {
|
|
51
|
+
for (let i = 0; i < n.childCount; i++) {
|
|
52
|
+
const t = n.child(i)?.type;
|
|
53
|
+
if (t === 'accessibility_modifier') {
|
|
54
|
+
const text = n.child(i).text;
|
|
55
|
+
if (text === 'private')
|
|
56
|
+
return 'private';
|
|
57
|
+
if (text === 'protected')
|
|
58
|
+
return 'protected';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return 'public';
|
|
62
|
+
}
|
|
63
|
+
function extractClass(node) {
|
|
64
|
+
const name = fieldText(node, 'name') || '(anonymous)';
|
|
65
|
+
const body = node.childForFieldName('body');
|
|
66
|
+
const methods = [];
|
|
67
|
+
if (body) {
|
|
68
|
+
for (let i = 0; i < body.childCount; i++) {
|
|
69
|
+
const m = body.child(i);
|
|
70
|
+
if (m && m.type === 'method_definition') {
|
|
71
|
+
methods.push({
|
|
72
|
+
name: fieldText(m, 'name'),
|
|
73
|
+
startLine: line(m),
|
|
74
|
+
isAsync: isAsync(m),
|
|
75
|
+
visibility: methodVisibility(m),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return { name, startLine: line(node), methods };
|
|
81
|
+
}
|
|
82
|
+
/** Strip surrounding quotes from an import source literal. */
|
|
83
|
+
function unquote(s) {
|
|
84
|
+
return s.replace(/^['"`]|['"`]$/g, '');
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Extract entities/imports from TS/JS/TSX source. Returns null if the grammar
|
|
88
|
+
* could not be loaded (WASM unavailable) so callers can fall back.
|
|
89
|
+
*/
|
|
90
|
+
export async function extractTsJs(content, extension) {
|
|
91
|
+
const wasmFile = grammarFor(extension);
|
|
92
|
+
if (!wasmFile)
|
|
93
|
+
return null;
|
|
94
|
+
const grammar = await loadWasmGrammar(wasmFile);
|
|
95
|
+
if (!grammar)
|
|
96
|
+
return null;
|
|
97
|
+
let tree = null;
|
|
98
|
+
try {
|
|
99
|
+
const parsed = grammar.parse(content);
|
|
100
|
+
tree = parsed;
|
|
101
|
+
const root = parsed.rootNode;
|
|
102
|
+
if (!root)
|
|
103
|
+
return null;
|
|
104
|
+
const out = { functions: [], classes: [], interfaces: [], imports: [] };
|
|
105
|
+
// Iterative walk. We do NOT recurse into function/class bodies (entities are
|
|
106
|
+
// top-level / exported; methods are collected with their class).
|
|
107
|
+
const stack = [root];
|
|
108
|
+
while (stack.length) {
|
|
109
|
+
const node = stack.pop();
|
|
110
|
+
let recurse = true;
|
|
111
|
+
switch (node.type) {
|
|
112
|
+
case 'function_declaration':
|
|
113
|
+
case 'generator_function_declaration':
|
|
114
|
+
out.functions.push({
|
|
115
|
+
name: fieldText(node, 'name'),
|
|
116
|
+
startLine: line(node),
|
|
117
|
+
isAsync: isAsync(node),
|
|
118
|
+
visibility: 'public',
|
|
119
|
+
});
|
|
120
|
+
recurse = false;
|
|
121
|
+
break;
|
|
122
|
+
case 'class_declaration':
|
|
123
|
+
case 'class':
|
|
124
|
+
out.classes.push(extractClass(node));
|
|
125
|
+
recurse = false;
|
|
126
|
+
break;
|
|
127
|
+
case 'interface_declaration':
|
|
128
|
+
out.interfaces.push({ name: fieldText(node, 'name'), startLine: line(node) });
|
|
129
|
+
recurse = false;
|
|
130
|
+
break;
|
|
131
|
+
case 'lexical_declaration':
|
|
132
|
+
case 'variable_declaration': {
|
|
133
|
+
// const/let foo = () => {} | function() {} → treat as a function
|
|
134
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
135
|
+
const d = node.child(i);
|
|
136
|
+
if (!d || d.type !== 'variable_declarator')
|
|
137
|
+
continue;
|
|
138
|
+
const value = d.childForFieldName('value');
|
|
139
|
+
if (value && (value.type === 'arrow_function' ||
|
|
140
|
+
value.type === 'function' ||
|
|
141
|
+
value.type === 'function_expression')) {
|
|
142
|
+
out.functions.push({
|
|
143
|
+
name: fieldText(d, 'name'),
|
|
144
|
+
startLine: line(d),
|
|
145
|
+
isAsync: isAsync(value),
|
|
146
|
+
visibility: 'public',
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
else if (value && value.type === 'call_expression' &&
|
|
150
|
+
value.child(0)?.text === 'require') {
|
|
151
|
+
// const x = require('y')
|
|
152
|
+
const arg = value.childForFieldName('arguments')?.child(1);
|
|
153
|
+
if (arg && arg.type === 'string')
|
|
154
|
+
out.imports.push(unquote(arg.text));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
recurse = false;
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
case 'import_statement': {
|
|
161
|
+
const src = node.childForFieldName('source');
|
|
162
|
+
if (src)
|
|
163
|
+
out.imports.push(unquote(src.text));
|
|
164
|
+
recurse = false;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
case 'call_expression': {
|
|
168
|
+
// require('x')
|
|
169
|
+
const fn = node.child(0);
|
|
170
|
+
if (fn && fn.text === 'require') {
|
|
171
|
+
const args = node.childForFieldName('arguments');
|
|
172
|
+
const arg = args?.child(1); // ( <string> )
|
|
173
|
+
if (arg && (arg.type === 'string'))
|
|
174
|
+
out.imports.push(unquote(arg.text));
|
|
175
|
+
}
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (recurse) {
|
|
180
|
+
for (let i = node.childCount - 1; i >= 0; i--) {
|
|
181
|
+
const c = node.child(i);
|
|
182
|
+
if (c)
|
|
183
|
+
stack.push(c);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return out;
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
finally {
|
|
193
|
+
tree?.delete?.();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=treesitter-ts-extractor.js.map
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RaBitQ-style 1-bit sign signatures for fast vector retrieval.
|
|
3
|
+
*
|
|
4
|
+
* Ports ruflo's perf-M4 optimization: sign-random-projection + Hamming popcount
|
|
5
|
+
* as a cheap prefilter ahead of exact cosine reranking.
|
|
6
|
+
*
|
|
7
|
+
* ## Why this works
|
|
8
|
+
*
|
|
9
|
+
* For unit-normalized embeddings, the sign of each coordinate is a valid
|
|
10
|
+
* Locality-Sensitive Hash (LSH) for cosine similarity: the probability that two
|
|
11
|
+
* vectors agree on the sign of a random projection is `1 - theta/pi`, where
|
|
12
|
+
* `theta` is the angle between them (Charikar 2002, "SimHash"). The AQE
|
|
13
|
+
* canonical embedding dimension is 384 (patterns.rvf dim=384); the coordinate
|
|
14
|
+
* basis itself acts as the random projection family, so `bit_i = (vec[i] >= 0)`
|
|
15
|
+
* yields a Hamming distance that is monotonically related to cosine angle.
|
|
16
|
+
*
|
|
17
|
+
* We therefore use Hamming distance over packed 1-bit signatures as a *cheap*
|
|
18
|
+
* ranking proxy to shrink the candidate pool, then run *exact* cosine on the
|
|
19
|
+
* survivors. With a large enough rerank pool the final top-k is identical to a
|
|
20
|
+
* full exact scan — only the work is reduced.
|
|
21
|
+
*
|
|
22
|
+
* ## Memory
|
|
23
|
+
*
|
|
24
|
+
* A 384-dim Float32 vector costs 1536 bytes. Its sign signature costs 48 bytes
|
|
25
|
+
* (12 × uint32). That is a 32× index-memory reduction for the prefilter stage.
|
|
26
|
+
*
|
|
27
|
+
* Self-contained: no I/O, no side effects, pure functions + one ranking helper.
|
|
28
|
+
*
|
|
29
|
+
* @module shared/utils/rabitq
|
|
30
|
+
*/
|
|
31
|
+
/** AQE canonical embedding dimension (patterns.rvf dim=384). */
|
|
32
|
+
export declare const SIGNATURE_DIM = 384;
|
|
33
|
+
/**
|
|
34
|
+
* Bytes per signature for the canonical 384-dim embedding:
|
|
35
|
+
* ceil(384 / 32) = 12 words × 4 bytes = 48 bytes.
|
|
36
|
+
* (vs 384 × 4 = 1536 bytes for the raw Float32 vector → 32× reduction.)
|
|
37
|
+
*/
|
|
38
|
+
export declare const SIGNATURE_BYTES: number;
|
|
39
|
+
/**
|
|
40
|
+
* Build a 1-bit sign signature from a vector.
|
|
41
|
+
*
|
|
42
|
+
* `bit_i = (vec[i] >= 0)`. Bits are packed LSB-first into Uint32 words:
|
|
43
|
+
* coordinate `i` lives in word `i >> 5` at bit `i & 31`.
|
|
44
|
+
*
|
|
45
|
+
* For a 384-dim input this returns 12 words (48 bytes). Inputs of other
|
|
46
|
+
* dimensions are supported (signature length = ceil(dim / 32) words).
|
|
47
|
+
*
|
|
48
|
+
* @param vec Embedding vector (assumed unit-normalized for the LSH guarantee,
|
|
49
|
+
* but the function works on any real vector).
|
|
50
|
+
* @returns Packed sign bits as a Uint32Array.
|
|
51
|
+
*/
|
|
52
|
+
export declare function signSignature(vec: number[] | Float32Array): Uint32Array;
|
|
53
|
+
/**
|
|
54
|
+
* Hamming distance between two packed signatures: popcount(a XOR b) summed
|
|
55
|
+
* over all words.
|
|
56
|
+
*
|
|
57
|
+
* @throws If the two signatures have different word lengths.
|
|
58
|
+
*/
|
|
59
|
+
export declare function hammingDistance(a: Uint32Array, b: Uint32Array): number;
|
|
60
|
+
/**
|
|
61
|
+
* Hamming similarity in [0, 1]: `1 - hammingDistance / bits`.
|
|
62
|
+
*
|
|
63
|
+
* This is a monotonic proxy for cosine similarity (higher = closer). `bits`
|
|
64
|
+
* should be the true embedding dimension (e.g. 384), not `words × 32`, so that
|
|
65
|
+
* trailing padding bits — which are always 0 in both signatures and never
|
|
66
|
+
* contribute to the distance — don't deflate the normalization.
|
|
67
|
+
*/
|
|
68
|
+
export declare function hammingSimilarity(a: Uint32Array, b: Uint32Array, bits: number): number;
|
|
69
|
+
/** A retrieval candidate. `signature` is optional and lazily built if absent. */
|
|
70
|
+
export interface RaBitQCandidate {
|
|
71
|
+
id: string;
|
|
72
|
+
vector: number[] | Float32Array;
|
|
73
|
+
/** Precomputed sign signature; built on demand from `vector` if omitted. */
|
|
74
|
+
signature?: Uint32Array;
|
|
75
|
+
}
|
|
76
|
+
/** A scored result. `score` is the exact cosine similarity (or Hamming proxy). */
|
|
77
|
+
export interface RaBitQResult {
|
|
78
|
+
id: string;
|
|
79
|
+
score: number;
|
|
80
|
+
}
|
|
81
|
+
/** Tuning knobs for {@link topKBySignature}. */
|
|
82
|
+
export interface TopKOptions {
|
|
83
|
+
/**
|
|
84
|
+
* Below this candidate count, skip RaBitQ entirely and do an exact cosine
|
|
85
|
+
* top-k. RaBitQ's signature-build + Hamming-scan overhead is not worth it for
|
|
86
|
+
* small N. Default 100 (matches ruflo's gate).
|
|
87
|
+
*/
|
|
88
|
+
gateN?: number;
|
|
89
|
+
/**
|
|
90
|
+
* How many Hamming-ranked candidates to feed into the exact rerank.
|
|
91
|
+
*
|
|
92
|
+
* Larger pool → higher recall, more exact-cosine work. **Default is
|
|
93
|
+
* recall-aware**: `max(4 × k, ceil(0.4 × N))`.
|
|
94
|
+
*
|
|
95
|
+
* IMPORTANT — empirically measured tradeoff (384-dim, see
|
|
96
|
+
* scripts/benchmark-rabitq.ts): a 1-bit sign signature is a *coarse*
|
|
97
|
+
* quantization, so a small fixed pool (e.g. `4 × k = 40`) does NOT preserve
|
|
98
|
+
* recall@10 at scale — at N=1000 it captures only ~70-85% of the true top-10,
|
|
99
|
+
* and worse at N=5000. To keep recall@10 ≥ ~0.95 the pool must be a sizeable
|
|
100
|
+
* fraction of N (~40% empirically), which limits the achievable speedup.
|
|
101
|
+
* Callers that can tolerate lower recall may pass a smaller pool for more
|
|
102
|
+
* speed; callers that need exact output should not use RaBitQ at all.
|
|
103
|
+
*/
|
|
104
|
+
rerankPool?: number;
|
|
105
|
+
/**
|
|
106
|
+
* If true (default), run full cosineSimilarity on the Hamming-top pool and
|
|
107
|
+
* return the true top-k by cosine. If false, return the Hamming-only ranking
|
|
108
|
+
* (faster, approximate).
|
|
109
|
+
*/
|
|
110
|
+
exactRerank?: boolean;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Retrieve the top-k candidates for a query using a RaBitQ Hamming prefilter
|
|
114
|
+
* followed by an exact cosine rerank.
|
|
115
|
+
*
|
|
116
|
+
* Behavior:
|
|
117
|
+
* - `candidates.length < gateN` → plain exact cosine top-k (gate; RaBitQ
|
|
118
|
+
* overhead not worth it for small N).
|
|
119
|
+
* - otherwise → build/reuse sign signatures, rank ALL candidates by Hamming
|
|
120
|
+
* distance (cheap), take the top `rerankPool`, then:
|
|
121
|
+
* - `exactRerank=true` (default): run FULL cosine on just that pool and
|
|
122
|
+
* return the true top-k. Output equals an exact scan whenever the true
|
|
123
|
+
* top-k all fall within the Hamming top-`rerankPool` — recall is
|
|
124
|
+
* preserved by the rerank, only speed changes.
|
|
125
|
+
* - `exactRerank=false`: return the Hamming-only top-k (approximate).
|
|
126
|
+
*
|
|
127
|
+
* @param query Query vector (same dimension as candidate vectors).
|
|
128
|
+
* @param candidates Candidate set.
|
|
129
|
+
* @param k Number of results to return.
|
|
130
|
+
* @param opts Tuning knobs (see {@link TopKOptions}).
|
|
131
|
+
*/
|
|
132
|
+
export declare function topKBySignature(query: number[] | Float32Array, candidates: RaBitQCandidate[], k: number, opts?: TopKOptions): RaBitQResult[];
|
|
133
|
+
//# sourceMappingURL=rabitq.d.ts.map
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RaBitQ-style 1-bit sign signatures for fast vector retrieval.
|
|
3
|
+
*
|
|
4
|
+
* Ports ruflo's perf-M4 optimization: sign-random-projection + Hamming popcount
|
|
5
|
+
* as a cheap prefilter ahead of exact cosine reranking.
|
|
6
|
+
*
|
|
7
|
+
* ## Why this works
|
|
8
|
+
*
|
|
9
|
+
* For unit-normalized embeddings, the sign of each coordinate is a valid
|
|
10
|
+
* Locality-Sensitive Hash (LSH) for cosine similarity: the probability that two
|
|
11
|
+
* vectors agree on the sign of a random projection is `1 - theta/pi`, where
|
|
12
|
+
* `theta` is the angle between them (Charikar 2002, "SimHash"). The AQE
|
|
13
|
+
* canonical embedding dimension is 384 (patterns.rvf dim=384); the coordinate
|
|
14
|
+
* basis itself acts as the random projection family, so `bit_i = (vec[i] >= 0)`
|
|
15
|
+
* yields a Hamming distance that is monotonically related to cosine angle.
|
|
16
|
+
*
|
|
17
|
+
* We therefore use Hamming distance over packed 1-bit signatures as a *cheap*
|
|
18
|
+
* ranking proxy to shrink the candidate pool, then run *exact* cosine on the
|
|
19
|
+
* survivors. With a large enough rerank pool the final top-k is identical to a
|
|
20
|
+
* full exact scan — only the work is reduced.
|
|
21
|
+
*
|
|
22
|
+
* ## Memory
|
|
23
|
+
*
|
|
24
|
+
* A 384-dim Float32 vector costs 1536 bytes. Its sign signature costs 48 bytes
|
|
25
|
+
* (12 × uint32). That is a 32× index-memory reduction for the prefilter stage.
|
|
26
|
+
*
|
|
27
|
+
* Self-contained: no I/O, no side effects, pure functions + one ranking helper.
|
|
28
|
+
*
|
|
29
|
+
* @module shared/utils/rabitq
|
|
30
|
+
*/
|
|
31
|
+
import { cosineSimilarity } from './vector-math.js';
|
|
32
|
+
// ============================================================================
|
|
33
|
+
// Constants
|
|
34
|
+
// ============================================================================
|
|
35
|
+
/** Bits packed per Uint32 word. */
|
|
36
|
+
const BITS_PER_WORD = 32;
|
|
37
|
+
/** AQE canonical embedding dimension (patterns.rvf dim=384). */
|
|
38
|
+
export const SIGNATURE_DIM = 384;
|
|
39
|
+
/**
|
|
40
|
+
* Bytes per signature for the canonical 384-dim embedding:
|
|
41
|
+
* ceil(384 / 32) = 12 words × 4 bytes = 48 bytes.
|
|
42
|
+
* (vs 384 × 4 = 1536 bytes for the raw Float32 vector → 32× reduction.)
|
|
43
|
+
*/
|
|
44
|
+
export const SIGNATURE_BYTES = Math.ceil(SIGNATURE_DIM / BITS_PER_WORD) * 4; // 48
|
|
45
|
+
// ============================================================================
|
|
46
|
+
// Popcount (Brian-Kernighan)
|
|
47
|
+
// ============================================================================
|
|
48
|
+
/**
|
|
49
|
+
* Population count (number of set bits) of a 32-bit word.
|
|
50
|
+
*
|
|
51
|
+
* Uses the SWAR (SIMD-within-a-register) bit-twiddle which is branchless and
|
|
52
|
+
* faster than a per-byte table lookup for 32-bit words. The hdc-fingerprint
|
|
53
|
+
* module uses a 256-entry per-byte table + Brian-Kernighan for its Uint8Array
|
|
54
|
+
* vectors; here we operate on Uint32 words, so the SWAR variant is the natural
|
|
55
|
+
* fit and avoids importing/splitting words into bytes.
|
|
56
|
+
*/
|
|
57
|
+
function popcount32(n) {
|
|
58
|
+
// Force unsigned 32-bit semantics.
|
|
59
|
+
n = n >>> 0;
|
|
60
|
+
n = n - ((n >>> 1) & 0x55555555);
|
|
61
|
+
n = (n & 0x33333333) + ((n >>> 2) & 0x33333333);
|
|
62
|
+
n = (n + (n >>> 4)) & 0x0f0f0f0f;
|
|
63
|
+
return (Math.imul(n, 0x01010101) >>> 24) & 0xff;
|
|
64
|
+
}
|
|
65
|
+
// ============================================================================
|
|
66
|
+
// Signature construction
|
|
67
|
+
// ============================================================================
|
|
68
|
+
/**
|
|
69
|
+
* Build a 1-bit sign signature from a vector.
|
|
70
|
+
*
|
|
71
|
+
* `bit_i = (vec[i] >= 0)`. Bits are packed LSB-first into Uint32 words:
|
|
72
|
+
* coordinate `i` lives in word `i >> 5` at bit `i & 31`.
|
|
73
|
+
*
|
|
74
|
+
* For a 384-dim input this returns 12 words (48 bytes). Inputs of other
|
|
75
|
+
* dimensions are supported (signature length = ceil(dim / 32) words).
|
|
76
|
+
*
|
|
77
|
+
* @param vec Embedding vector (assumed unit-normalized for the LSH guarantee,
|
|
78
|
+
* but the function works on any real vector).
|
|
79
|
+
* @returns Packed sign bits as a Uint32Array.
|
|
80
|
+
*/
|
|
81
|
+
export function signSignature(vec) {
|
|
82
|
+
const dim = vec.length;
|
|
83
|
+
const words = Math.ceil(dim / BITS_PER_WORD);
|
|
84
|
+
const sig = new Uint32Array(words);
|
|
85
|
+
for (let i = 0; i < dim; i++) {
|
|
86
|
+
if (vec[i] >= 0) {
|
|
87
|
+
sig[i >> 5] |= 1 << (i & 31);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return sig;
|
|
91
|
+
}
|
|
92
|
+
// ============================================================================
|
|
93
|
+
// Hamming distance / similarity
|
|
94
|
+
// ============================================================================
|
|
95
|
+
/**
|
|
96
|
+
* Hamming distance between two packed signatures: popcount(a XOR b) summed
|
|
97
|
+
* over all words.
|
|
98
|
+
*
|
|
99
|
+
* @throws If the two signatures have different word lengths.
|
|
100
|
+
*/
|
|
101
|
+
export function hammingDistance(a, b) {
|
|
102
|
+
if (a.length !== b.length) {
|
|
103
|
+
throw new Error(`Signature length mismatch: ${a.length} vs ${b.length} words`);
|
|
104
|
+
}
|
|
105
|
+
let dist = 0;
|
|
106
|
+
for (let i = 0; i < a.length; i++) {
|
|
107
|
+
dist += popcount32((a[i] ^ b[i]) >>> 0);
|
|
108
|
+
}
|
|
109
|
+
return dist;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Hamming similarity in [0, 1]: `1 - hammingDistance / bits`.
|
|
113
|
+
*
|
|
114
|
+
* This is a monotonic proxy for cosine similarity (higher = closer). `bits`
|
|
115
|
+
* should be the true embedding dimension (e.g. 384), not `words × 32`, so that
|
|
116
|
+
* trailing padding bits — which are always 0 in both signatures and never
|
|
117
|
+
* contribute to the distance — don't deflate the normalization.
|
|
118
|
+
*/
|
|
119
|
+
export function hammingSimilarity(a, b, bits) {
|
|
120
|
+
if (bits <= 0)
|
|
121
|
+
return 0;
|
|
122
|
+
return 1 - hammingDistance(a, b) / bits;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Exact cosine top-k over all candidates. Shared by the small-N gate and the
|
|
126
|
+
* rerank stage.
|
|
127
|
+
*/
|
|
128
|
+
function exactTopK(query, candidates, k) {
|
|
129
|
+
const scored = new Array(candidates.length);
|
|
130
|
+
for (let i = 0; i < candidates.length; i++) {
|
|
131
|
+
scored[i] = {
|
|
132
|
+
id: candidates[i].id,
|
|
133
|
+
score: cosineSimilarity(query, candidates[i].vector),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
scored.sort((a, b) => b.score - a.score);
|
|
137
|
+
return scored.slice(0, k);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Retrieve the top-k candidates for a query using a RaBitQ Hamming prefilter
|
|
141
|
+
* followed by an exact cosine rerank.
|
|
142
|
+
*
|
|
143
|
+
* Behavior:
|
|
144
|
+
* - `candidates.length < gateN` → plain exact cosine top-k (gate; RaBitQ
|
|
145
|
+
* overhead not worth it for small N).
|
|
146
|
+
* - otherwise → build/reuse sign signatures, rank ALL candidates by Hamming
|
|
147
|
+
* distance (cheap), take the top `rerankPool`, then:
|
|
148
|
+
* - `exactRerank=true` (default): run FULL cosine on just that pool and
|
|
149
|
+
* return the true top-k. Output equals an exact scan whenever the true
|
|
150
|
+
* top-k all fall within the Hamming top-`rerankPool` — recall is
|
|
151
|
+
* preserved by the rerank, only speed changes.
|
|
152
|
+
* - `exactRerank=false`: return the Hamming-only top-k (approximate).
|
|
153
|
+
*
|
|
154
|
+
* @param query Query vector (same dimension as candidate vectors).
|
|
155
|
+
* @param candidates Candidate set.
|
|
156
|
+
* @param k Number of results to return.
|
|
157
|
+
* @param opts Tuning knobs (see {@link TopKOptions}).
|
|
158
|
+
*/
|
|
159
|
+
export function topKBySignature(query, candidates, k, opts = {}) {
|
|
160
|
+
const gateN = opts.gateN ?? 100;
|
|
161
|
+
const exactRerank = opts.exactRerank ?? true;
|
|
162
|
+
const n = candidates.length;
|
|
163
|
+
if (n === 0 || k <= 0)
|
|
164
|
+
return [];
|
|
165
|
+
// Recall-aware default pool: a 1-bit signature in high dimensions is coarse,
|
|
166
|
+
// so the pool must scale with N to keep recall high (see rerankPool docs).
|
|
167
|
+
const rerankPool = opts.rerankPool ?? Math.max(4 * k, Math.ceil(0.4 * n));
|
|
168
|
+
// Small-N gate: exact cosine, skip signature machinery entirely.
|
|
169
|
+
if (n < gateN) {
|
|
170
|
+
return exactTopK(query, candidates, Math.min(k, n));
|
|
171
|
+
}
|
|
172
|
+
const bits = query.length;
|
|
173
|
+
const querySig = signSignature(query);
|
|
174
|
+
// Rank ALL candidates by Hamming distance (cheap popcount scan).
|
|
175
|
+
const hammingRanked = new Array(n);
|
|
176
|
+
for (let i = 0; i < n; i++) {
|
|
177
|
+
const cand = candidates[i];
|
|
178
|
+
const sig = cand.signature ?? signSignature(cand.vector);
|
|
179
|
+
hammingRanked[i] = { idx: i, dist: hammingDistance(querySig, sig) };
|
|
180
|
+
}
|
|
181
|
+
// Ascending distance = descending similarity.
|
|
182
|
+
hammingRanked.sort((a, b) => a.dist - b.dist);
|
|
183
|
+
const poolSize = Math.min(rerankPool, n);
|
|
184
|
+
if (!exactRerank) {
|
|
185
|
+
// Hamming-only ranking: return the top-k by Hamming proxy similarity.
|
|
186
|
+
const topK = Math.min(k, n);
|
|
187
|
+
const out = new Array(topK);
|
|
188
|
+
for (let i = 0; i < topK; i++) {
|
|
189
|
+
const { idx, dist } = hammingRanked[i];
|
|
190
|
+
out[i] = { id: candidates[idx].id, score: 1 - dist / bits };
|
|
191
|
+
}
|
|
192
|
+
return out;
|
|
193
|
+
}
|
|
194
|
+
// Exact rerank: full cosine over the Hamming-top pool, return true top-k.
|
|
195
|
+
const pool = new Array(poolSize);
|
|
196
|
+
for (let i = 0; i < poolSize; i++) {
|
|
197
|
+
pool[i] = candidates[hammingRanked[i].idx];
|
|
198
|
+
}
|
|
199
|
+
return exactTopK(query, pool, Math.min(k, poolSize));
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=rabitq.js.map
|
|
@@ -192,6 +192,7 @@ class Parser {
|
|
|
192
192
|
}
|
|
193
193
|
parseExpression(minPrecedence) {
|
|
194
194
|
let left = this.parseUnary();
|
|
195
|
+
// eslint-disable-next-line no-constant-condition -- tokenizer loop; breaks internally
|
|
195
196
|
while (true) {
|
|
196
197
|
const token = this.current();
|
|
197
198
|
if (token.type !== 'OPERATOR' || !BINARY_OPERATORS.has(token.value)) {
|
|
@@ -229,17 +230,19 @@ class Parser {
|
|
|
229
230
|
case 'IDENTIFIER':
|
|
230
231
|
return this.parseIdentifier();
|
|
231
232
|
case 'LPAREN':
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
233
|
+
{
|
|
234
|
+
this.advance();
|
|
235
|
+
const result = this.parseExpression(0);
|
|
236
|
+
this.expect('RPAREN');
|
|
237
|
+
return result;
|
|
238
|
+
}
|
|
236
239
|
default:
|
|
237
240
|
throw new Error(`Unexpected token: ${token.raw}`);
|
|
238
241
|
}
|
|
239
242
|
}
|
|
240
243
|
parseIdentifier() {
|
|
241
244
|
let value = this.context;
|
|
242
|
-
|
|
245
|
+
const name = this.advance().value;
|
|
243
246
|
// Get initial value from context
|
|
244
247
|
if (typeof value === 'object' && value !== null && name in value) {
|
|
245
248
|
value = value[name];
|
|
@@ -285,6 +285,7 @@ export class PostgresWriter {
|
|
|
285
285
|
let jsonStr = JSON.stringify(value);
|
|
286
286
|
if (columnName && this.isJsonbColumn(columnName)) {
|
|
287
287
|
// Remove NUL chars (PostgreSQL JSONB rejects \u0000)
|
|
288
|
+
// eslint-disable-next-line no-control-regex -- NUL stripping required: PostgreSQL JSONB rejects \u0000
|
|
288
289
|
jsonStr = jsonStr.replace(/\u0000/g, '');
|
|
289
290
|
try {
|
|
290
291
|
JSON.parse(jsonStr);
|
|
@@ -316,6 +317,7 @@ export class PostgresWriter {
|
|
|
316
317
|
}
|
|
317
318
|
// JSONB columns: validate JSON, sanitize NUL chars, wrap if invalid
|
|
318
319
|
if (columnName && this.isJsonbColumn(columnName)) {
|
|
320
|
+
// eslint-disable-next-line no-control-regex -- NUL stripping required: PostgreSQL JSONB rejects \u0000
|
|
319
321
|
const sanitized = value.replace(/\u0000/g, '');
|
|
320
322
|
try {
|
|
321
323
|
JSON.parse(sanitized);
|
|
@@ -50,7 +50,7 @@ export class JSONReader {
|
|
|
50
50
|
const content = fs.readFileSync(this.filePath, 'utf-8');
|
|
51
51
|
const parsed = secureJsonParse.parse(content);
|
|
52
52
|
// Extract data based on JSON path if specified
|
|
53
|
-
|
|
53
|
+
const records = this.extractRecords(parsed);
|
|
54
54
|
// Transform records
|
|
55
55
|
return records.map(record => this.transformRecord(record));
|
|
56
56
|
}
|
|
@@ -191,7 +191,7 @@ export class GitAwareTestSelector {
|
|
|
191
191
|
async mapChangesToTests(changedFiles) {
|
|
192
192
|
const selectedTests = [];
|
|
193
193
|
const mappings = [];
|
|
194
|
-
|
|
194
|
+
const runAllTests = false;
|
|
195
195
|
let runAllReason;
|
|
196
196
|
// Check for config file changes first - these require full test run
|
|
197
197
|
for (const file of changedFiles) {
|