agentic-qe 3.14.5 → 3.14.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +76 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/adapters/ag-ui/event-types.d.ts +1 -1
- package/dist/audit/witness-chain-hash.d.ts +18 -0
- package/dist/audit/witness-chain-hash.js +37 -0
- package/dist/audit/witness-chain-repair.d.ts +71 -0
- package/dist/audit/witness-chain-repair.js +203 -0
- package/dist/audit/witness-chain-verifier.d.ts +152 -0
- package/dist/audit/witness-chain-verifier.js +293 -0
- package/dist/audit/witness-chain.d.ts +10 -43
- package/dist/audit/witness-chain.js +16 -106
- package/dist/audit/witness-findings.js +4 -1
- package/dist/cli/bundle.js +7 -7
- package/dist/cli/chunks/adapter-UYOJPTOX.js +2 -0
- package/dist/cli/chunks/agent-booster-wasm-2YGML6OU.js +2 -0
- package/dist/cli/chunks/{agent-handler-V6CZ7Q6S.js → agent-handler-D5SSQYNU.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-ZMD6ULC3.js → agent-memory-branch-YHPLTITV.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-JR5AVQXR.js +2 -0
- package/dist/cli/chunks/{arena-QLSBESC7.js → arena-7BGOXGXO.js} +2 -2
- package/dist/cli/chunks/{arena-4UPAEHFT.js → arena-MCE6EU7K.js} +4 -4
- package/dist/cli/chunks/audit-BMWTQECB.js +4 -0
- package/dist/cli/chunks/base-DRZ2LS6X.js +2 -0
- package/dist/cli/chunks/{better-sqlite3-4DSBPDRH.js → better-sqlite3-PMUNGASU.js} +2 -2
- package/dist/cli/chunks/{brain-handler-GBY4EZ4P.js → brain-handler-QPUFYX7F.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-XYBVXCNO.js → branch-enumerator-WKFDGRN4.js} +2 -2
- package/dist/cli/chunks/{browser-32F6MREU.js → browser-VY5HKH5X.js} +2 -2
- package/dist/cli/chunks/browser-workflow-CJ7T3MXF.js +2 -0
- package/dist/cli/chunks/{chunk-C3Z4VVHP.js → chunk-257E2A5M.js} +5 -5
- package/dist/cli/chunks/{chunk-EFV4ADMO.js → chunk-2JVWITNK.js} +2 -2
- package/dist/cli/chunks/{chunk-IGBEJ4UJ.js → chunk-2NPKIBAZ.js} +2 -2
- package/dist/cli/chunks/{chunk-KIP6WZGV.js → chunk-2TMWAQQ3.js} +3 -3
- package/dist/cli/chunks/{chunk-DLF5BOJD.js → chunk-2YXGBZWV.js} +1 -1
- package/dist/cli/chunks/{chunk-KEY43ANX.js → chunk-3EA536JF.js} +2 -2
- package/dist/cli/chunks/{chunk-WX6RRIGW.js → chunk-3EZOZN25.js} +2 -2
- package/dist/cli/chunks/{chunk-BYG36QC5.js → chunk-3HZS4M3O.js} +2 -2
- package/dist/cli/chunks/{chunk-G3L5L6YQ.js → chunk-3NIG7S5W.js} +1 -1
- package/dist/cli/chunks/{chunk-CZO4BJG5.js → chunk-4N23RFDU.js} +2 -2
- package/dist/cli/chunks/{chunk-QWUXCG2L.js → chunk-5J6W7SIA.js} +1 -1
- package/dist/cli/chunks/{chunk-RD2VGOUH.js → chunk-5OOMJGFN.js} +1 -1
- package/dist/cli/chunks/{chunk-YDFL445W.js → chunk-5QQSIGUA.js} +2 -2
- package/dist/cli/chunks/{chunk-TUSSPKRM.js → chunk-5VFPCSK7.js} +1 -1
- package/dist/cli/chunks/{chunk-WLXK2KNU.js → chunk-62N4NUJH.js} +2 -2
- package/dist/cli/chunks/{chunk-JSZ663MU.js → chunk-64VGZQLB.js} +1 -1
- package/dist/cli/chunks/{chunk-UMGFMKDW.js → chunk-66VWCR67.js} +2 -2
- package/dist/cli/chunks/{chunk-6ITZZIQX.js → chunk-6LIHFV7O.js} +2 -2
- package/dist/cli/chunks/{chunk-DKUBQQFG.js → chunk-6OS76PHI.js} +2 -2
- package/dist/cli/chunks/{chunk-Y5L3ES4L.js → chunk-6RE3X4V5.js} +2 -2
- package/dist/cli/chunks/{chunk-CVMNJSCB.js → chunk-6SH5VZUD.js} +2 -2
- package/dist/cli/chunks/chunk-6SQM2MUX.js +4 -0
- package/dist/cli/chunks/{chunk-6CR4VQBQ.js → chunk-6U7LNMWZ.js} +2 -2
- package/dist/cli/chunks/{chunk-HYEJJJY3.js → chunk-72KXSMWI.js} +1 -1
- package/dist/cli/chunks/chunk-7CUQCCMD.js +27 -0
- package/dist/cli/chunks/chunk-7D3V65N5.js +2 -0
- package/dist/cli/chunks/{chunk-K7NJHFLZ.js → chunk-7J6QC567.js} +3 -3
- package/dist/cli/chunks/{chunk-6LKDHEBY.js → chunk-7LPR6HJG.js} +2 -2
- package/dist/cli/chunks/{chunk-RGGK6VZ7.js → chunk-7NITCZWD.js} +1 -1
- package/dist/cli/chunks/{chunk-IYTLXUBO.js → chunk-7Z5LHRC3.js} +2 -2
- package/dist/cli/chunks/{chunk-ZCWERUYB.js → chunk-AHKELLIO.js} +3 -3
- package/dist/cli/chunks/{chunk-IJHCIXJC.js → chunk-AIRGNL55.js} +2 -2
- package/dist/cli/chunks/{chunk-2OMLTYQK.js → chunk-AJRUJAAK.js} +1 -1
- package/dist/cli/chunks/{chunk-QYOGD2VW.js → chunk-AVBJYI5I.js} +1 -1
- package/dist/cli/chunks/{chunk-PSPKSUF6.js → chunk-B6D2CHEH.js} +1 -1
- package/dist/cli/chunks/{chunk-M23ZOZVY.js → chunk-B6MOJC3X.js} +1 -1
- package/dist/cli/chunks/{chunk-VD5IO5EO.js → chunk-BAMN2CHI.js} +1 -1
- package/dist/cli/chunks/{chunk-KO4FNAUR.js → chunk-BBT64TII.js} +3 -3
- package/dist/cli/chunks/{chunk-7JZJJA7U.js → chunk-BJTJLJRZ.js} +3 -3
- package/dist/cli/chunks/{chunk-LULD4JV2.js → chunk-BMAPORJ7.js} +2 -2
- package/dist/cli/chunks/{chunk-GTKCGPJZ.js → chunk-BPEDWS6O.js} +2 -2
- package/dist/cli/chunks/{chunk-3DDXWYMO.js → chunk-BVR7RMC5.js} +1 -1
- package/dist/cli/chunks/{chunk-52L77RMG.js → chunk-C6KWXUFJ.js} +2 -2
- package/dist/cli/chunks/{chunk-BJPL6THQ.js → chunk-CCK4BF76.js} +1 -1
- package/dist/cli/chunks/{chunk-RP2ZKPYV.js → chunk-CD542DNJ.js} +1 -1
- package/dist/cli/chunks/{chunk-AFEDJ3RU.js → chunk-CF2ISEOJ.js} +2 -2
- package/dist/cli/chunks/chunk-CM7U6TAX.js +5 -0
- package/dist/cli/chunks/{chunk-R74ZKREV.js → chunk-D45SG6CP.js} +1 -1
- package/dist/cli/chunks/{chunk-YXP6BKGS.js → chunk-D6CJIGRU.js} +89 -83
- package/dist/cli/chunks/{chunk-NVYBM3R4.js → chunk-DBDPRORT.js} +2 -2
- package/dist/cli/chunks/{chunk-CYE2TJFV.js → chunk-DHVX5UB2.js} +2 -2
- package/dist/cli/chunks/{chunk-XUR2M2WB.js → chunk-DK4XN4CU.js} +2 -2
- package/dist/cli/chunks/{chunk-W2XCZU62.js → chunk-DPYSUDAO.js} +1 -1
- package/dist/cli/chunks/{chunk-WJHWH5D2.js → chunk-DUYOVM5I.js} +2 -2
- package/dist/cli/chunks/{chunk-XLAUGSW7.js → chunk-DZ3AUAAB.js} +2 -2
- package/dist/cli/chunks/{chunk-37TUN44F.js → chunk-E6G2RD5H.js} +2 -2
- package/dist/cli/chunks/{chunk-ELBZON4V.js → chunk-EAY2JMZG.js} +2 -2
- package/dist/cli/chunks/{chunk-HSVKZ5KI.js → chunk-ELLBS5RP.js} +2 -2
- package/dist/cli/chunks/chunk-ENGZ4D5V.js +2 -0
- package/dist/cli/chunks/chunk-FBMN7B46.js +4 -0
- package/dist/cli/chunks/{chunk-F34OAHOM.js → chunk-FWASDOT2.js} +2 -2
- package/dist/cli/chunks/{chunk-E4AZXCT5.js → chunk-FZOBD67M.js} +1 -1
- package/dist/cli/chunks/{chunk-QZMUXJHZ.js → chunk-GDSXITFH.js} +2 -2
- package/dist/cli/chunks/{chunk-LSUILON7.js → chunk-GGRHV6D7.js} +1 -1
- package/dist/cli/chunks/{chunk-3YUB5HER.js → chunk-GPYVDFB3.js} +101 -101
- package/dist/cli/chunks/{chunk-4FWTLJEP.js → chunk-GSF6MB64.js} +2 -2
- package/dist/cli/chunks/{chunk-3KDL6QDK.js → chunk-H52HZ67P.js} +2 -2
- package/dist/cli/chunks/{chunk-2JGEZHWY.js → chunk-H5BS5VH7.js} +2 -2
- package/dist/cli/chunks/{chunk-SQF6HRXR.js → chunk-H6ZM3PUT.js} +1 -1
- package/dist/cli/chunks/{chunk-OEIQTWQP.js → chunk-HM6ZSCPI.js} +1 -1
- package/dist/cli/chunks/{chunk-URVHZPWY.js → chunk-HNFVJP4I.js} +2 -2
- package/dist/cli/chunks/{chunk-RD6TEZ64.js → chunk-I33ERSGB.js} +2 -2
- package/dist/cli/chunks/{chunk-IUDWEOLX.js → chunk-IAF6T27S.js} +2 -2
- package/dist/cli/chunks/{chunk-XZSMZHM2.js → chunk-IB27QACC.js} +2 -2
- package/dist/cli/chunks/{chunk-I6X3EGJI.js → chunk-ICTXTNQZ.js} +1 -1
- package/dist/cli/chunks/chunk-IG5GNEC6.js +4 -0
- package/dist/cli/chunks/{chunk-6A44AOGN.js → chunk-IQO7UCFR.js} +2 -2
- package/dist/cli/chunks/{chunk-R6IU3EWP.js → chunk-IV5UZOHH.js} +2 -2
- package/dist/cli/chunks/{chunk-VTOVWHEM.js → chunk-JBTPOIAC.js} +2 -2
- package/dist/cli/chunks/{chunk-KLTP5IDB.js → chunk-JIXUMYKZ.js} +1 -1
- package/dist/cli/chunks/{chunk-3VIXOHMS.js → chunk-JMONHE4B.js} +1 -1
- package/dist/cli/chunks/{chunk-SX4JLSLV.js → chunk-JVNTSNWU.js} +2 -2
- package/dist/cli/chunks/{chunk-JVQBWYHW.js → chunk-JXGFRBUO.js} +2 -2
- package/dist/cli/chunks/{chunk-HVXJC3OC.js → chunk-JZOS5FCX.js} +2 -2
- package/dist/cli/chunks/{chunk-XEZIIQYJ.js → chunk-KNNISEDY.js} +1 -1
- package/dist/cli/chunks/{chunk-73EI4C2E.js → chunk-L4RUBPLR.js} +2 -2
- package/dist/cli/chunks/{chunk-AF4XKLXO.js → chunk-LL3IGZBI.js} +2 -2
- package/dist/cli/chunks/{chunk-UJWAWIRV.js → chunk-MBRHSU6W.js} +10 -10
- package/dist/cli/chunks/{chunk-J5UNP6W3.js → chunk-MJS53PRX.js} +2 -2
- package/dist/cli/chunks/{chunk-EOR2UT72.js → chunk-MQROI74N.js} +2 -2
- package/dist/cli/chunks/{chunk-BXVAVFGU.js → chunk-MUOG6QXR.js} +2 -2
- package/dist/cli/chunks/{chunk-O3JTQ7N4.js → chunk-MW2GGZZ5.js} +1 -1
- package/dist/cli/chunks/{chunk-IIAR5S7Q.js → chunk-NHWGMJAP.js} +2 -2
- package/dist/cli/chunks/{chunk-WOIGKU2N.js → chunk-NMAIY4PX.js} +3 -3
- package/dist/cli/chunks/{chunk-QIRL6B3C.js → chunk-NQZ5AR3D.js} +2 -2
- package/dist/cli/chunks/{chunk-6TU7FEMD.js → chunk-P6OYS755.js} +1 -1
- package/dist/cli/chunks/{chunk-HVU64GP5.js → chunk-PI7TJS62.js} +2 -2
- package/dist/cli/chunks/{chunk-N7H767TP.js → chunk-PX5YDCRH.js} +2 -2
- package/dist/cli/chunks/{chunk-3EZ5DR2R.js → chunk-PZPWRQ2M.js} +2 -2
- package/dist/cli/chunks/{chunk-RKOUXVZZ.js → chunk-Q5XTSMWR.js} +2 -2
- package/dist/cli/chunks/{chunk-K27SU3RE.js → chunk-Q7EAGKAE.js} +2 -2
- package/dist/cli/chunks/{chunk-M5AEL7IS.js → chunk-QDFTT3RF.js} +2 -2
- package/dist/cli/chunks/{chunk-TY5WC3FT.js → chunk-QGA55PFM.js} +3 -3
- package/dist/cli/chunks/{chunk-NQI7FWCS.js → chunk-QW6VMTBR.js} +2 -2
- package/dist/cli/chunks/{chunk-BHFR2EXL.js → chunk-QZANMBIT.js} +1 -1
- package/dist/cli/chunks/{chunk-5D36YHS3.js → chunk-RETBYIAC.js} +4 -4
- package/dist/cli/chunks/{chunk-UKGXWW64.js → chunk-RFNPJK6N.js} +3 -3
- package/dist/cli/chunks/{chunk-G3W6BMVJ.js → chunk-RG52OKAM.js} +1 -1
- package/dist/cli/chunks/{chunk-DO6EI5KB.js → chunk-RSXXCL4A.js} +1 -1
- package/dist/cli/chunks/{chunk-E3W6XQ57.js → chunk-RTFO5UQH.js} +2 -2
- package/dist/cli/chunks/{chunk-DDCIYOGT.js → chunk-RZZCUIAI.js} +2 -2
- package/dist/cli/chunks/{chunk-C3HQL6S4.js → chunk-SDRHUMJB.js} +2 -2
- package/dist/cli/chunks/{chunk-KYA5LARK.js → chunk-SE4WIB26.js} +1 -1
- package/dist/cli/chunks/{chunk-NU7UTXMP.js → chunk-SESK3ARK.js} +2 -2
- package/dist/cli/chunks/{chunk-YQGPQBCX.js → chunk-SJUXE4IC.js} +2 -2
- package/dist/cli/chunks/{chunk-HBCGYMQU.js → chunk-SMDN3BQZ.js} +1 -1
- package/dist/cli/chunks/{chunk-D6OUCB2H.js → chunk-SNOBH4AZ.js} +2 -2
- package/dist/cli/chunks/{chunk-QRCIZFNK.js → chunk-SPV2VKC5.js} +2 -2
- package/dist/cli/chunks/chunk-TCHGOB2N.js +2 -0
- package/dist/cli/chunks/{chunk-2KJQ2UQE.js → chunk-TVYY3OCX.js} +1 -1
- package/dist/cli/chunks/{chunk-RIZVC4XY.js → chunk-UCFQALXO.js} +2 -2
- package/dist/cli/chunks/{chunk-XFPPERA2.js → chunk-UKA2KOXE.js} +2 -2
- package/dist/cli/chunks/{chunk-UTBYJ4RF.js → chunk-UNFFDHER.js} +16 -11
- package/dist/cli/chunks/{chunk-6VAZAHQG.js → chunk-UQ32JHES.js} +2 -2
- package/dist/cli/chunks/{chunk-CPC7FN52.js → chunk-V4DM6ELU.js} +2 -2
- package/dist/cli/chunks/{chunk-67YV75XP.js → chunk-VGFFFKGK.js} +2 -2
- package/dist/cli/chunks/{chunk-WK7B4B6Y.js → chunk-VMNWDJIZ.js} +2 -2
- package/dist/cli/chunks/chunk-W6HXLH5G.js +180 -0
- package/dist/cli/chunks/{chunk-7VFY7TUR.js → chunk-WCJBU2KI.js} +2 -2
- package/dist/cli/chunks/{chunk-JROVR6YS.js → chunk-WGM35YWL.js} +2 -2
- package/dist/cli/chunks/{chunk-IUHB5GVS.js → chunk-WO4QMXIG.js} +2 -2
- package/dist/cli/chunks/{chunk-JES6R5KP.js → chunk-XAS3XRYM.js} +1 -1
- package/dist/cli/chunks/chunk-Y3LZ35OG.js +2 -0
- package/dist/cli/chunks/{chunk-75QJ5HWE.js → chunk-Y3UOUNHM.js} +2 -2
- package/dist/cli/chunks/{chunk-WJTSY5MC.js → chunk-YFBSPLJG.js} +1 -1
- package/dist/cli/chunks/{chunk-DPBRWP4J.js → chunk-YHKEDEAA.js} +3 -3
- package/dist/cli/chunks/{chunk-NRE4NAVA.js → chunk-YS4FCTWF.js} +1 -1
- package/dist/cli/chunks/{chunk-I2NENQ44.js → chunk-YSLL6VSL.js} +2 -2
- package/dist/cli/chunks/chunk-Z6GGIRQQ.js +65 -0
- package/dist/cli/chunks/{chunk-E4EYPYR3.js → chunk-Z7WODOTH.js} +2 -2
- package/dist/cli/chunks/{chunk-7DETTOPZ.js → chunk-ZCRTRYXK.js} +2 -2
- package/dist/cli/chunks/{chunk-FUNGTIF2.js → chunk-ZEV3YTO7.js} +2 -2
- package/dist/cli/chunks/{chunk-SQKW3B6B.js → chunk-ZL6SYKUK.js} +1 -1
- package/dist/cli/chunks/{chunk-AMMQOV35.js → chunk-ZSPU4MOS.js} +2 -2
- package/dist/cli/chunks/{chunk-KKHYJF5U.js → chunk-ZVWVV4EX.js} +1 -1
- package/dist/cli/chunks/{ci-RACDAJMR.js → ci-W6K6G2KZ.js} +2 -2
- package/dist/cli/chunks/{ci-output-EHRSZBKG.js → ci-output-LDT24TS3.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-GBV7M5XG.js → circuit-breaker-F5V4KITU.js} +2 -2
- package/dist/cli/chunks/claude-flow-setup-DT6WQQVD.js +2 -0
- package/dist/cli/chunks/client-KHWJT6FB.js +2 -0
- package/dist/cli/chunks/{cline-installer-W4NMXJSG.js → cline-installer-G7TJOAEX.js} +2 -2
- package/dist/cli/chunks/{code-JWXJMYXB.js → code-PGE6A42V.js} +3 -3
- package/dist/cli/chunks/{code-index-extractor-RVI2IFTM.js → code-index-extractor-RNITH372.js} +2 -2
- package/dist/cli/chunks/{codex-installer-3BORJINH.js → codex-installer-LBX77AI3.js} +6 -6
- package/dist/cli/chunks/{completions-A55NCTAO.js → completions-4AWLAARX.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-JCXHGGLY.js → complexity-analyzer-ZPNSS476.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-PUVFMGYW.js → continuedev-installer-UAPWX6OA.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-4DCMYWHB.js → copilot-installer-BJN2YJGI.js} +2 -2
- package/dist/cli/chunks/core-handlers-HING5RRG.js +2 -0
- package/dist/cli/chunks/{cost-tracker-5TV2GGKY.js → cost-tracker-MHP2VJ63.js} +2 -2
- package/dist/cli/chunks/{coverage-NNWM7TX3.js → coverage-PQB4IEFG.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-PQTD6AZN.js +2 -0
- package/dist/cli/chunks/{cursor-installer-4NCHGJGK.js → cursor-installer-ZXBWYAS3.js} +2 -2
- package/dist/cli/chunks/{daemon-T4JO4IXP.js → daemon-64C7R6OJ.js} +3 -3
- package/dist/cli/chunks/{daemon-QIKCXKWO.js → daemon-N2BEGEFY.js} +4 -4
- package/dist/cli/chunks/{dag-attention-scheduler-RPAAIDAD.js → dag-attention-scheduler-SPZDAPNL.js} +2 -2
- package/dist/cli/chunks/{detect-SBEEVDSN.js → detect-LXJBSSZW.js} +2 -2
- package/dist/cli/chunks/{dist-node-ZHI6NCSU.js → dist-node-U3TKZ2IZ.js} +2 -2
- package/dist/cli/chunks/{domain-handler-LBC3GJ7Z.js → domain-handler-3DDWUVSR.js} +2 -2
- package/dist/cli/chunks/{domain-plugins-H6IZ5USZ.js → domain-plugins-JJVWI4OQ.js} +2 -2
- package/dist/cli/chunks/domain-transfer-M36KUJ2U.js +2 -0
- package/dist/cli/chunks/dream-WUGRSNCV.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-AHTR7CRU.js → embed-and-insert-pattern-JPAR7TXX.js} +2 -2
- package/dist/cli/chunks/{eval-DZU2KISM.js → eval-SOLG23EA.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-5IQCWKSL.js → experience-capture-middleware-T7G2VOOD.js} +3 -3
- package/dist/cli/chunks/{fast-paths-2KLDUWCY.js → fast-paths-32N3ELI4.js} +2 -2
- package/dist/cli/chunks/{feature-flags-N6UAEZY4.js → feature-flags-APJDQ4N7.js} +2 -2
- package/dist/cli/chunks/{feature-flags-7AC3XDZA.js → feature-flags-NAHKLDRN.js} +2 -2
- package/dist/cli/chunks/{file-discovery-5SDIW4V2.js → file-discovery-YKVM3MDB.js} +2 -2
- package/dist/cli/chunks/{fleet-ZIQCAZ2Y.js → fleet-55M5CJS4.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-DUMBZJEV.js → gnn-wrapper-UD6E6S6Z.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-6HVM6ZMR.js → heartbeat-handler-OYVW3VSC.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-33XX5XNQ.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-XQPERX3H.js +2 -0
- package/dist/cli/chunks/hnsw-index-2GNXTWHH.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-5DRL5FLX.js → hnsw-legacy-bridge-HBYIS3ZW.js} +2 -2
- package/dist/cli/chunks/{hnswlib-node-GW67GTCL.js → hnswlib-node-EQPM42OU.js} +2 -2
- package/dist/cli/chunks/{hooks-QHH6FVO4.js → hooks-5ZSSJWO6.js} +10 -10
- package/dist/cli/chunks/hybrid-backend-CCF7URKI.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-7XDCCVG2.js → hypergraph-engine-XBGVQ4PD.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-QHF7NOU5.js → hypergraph-handler-CAWAQ673.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-HGKAZWIG.js +2 -0
- package/dist/cli/chunks/{init-handler-5UIVOM7K.js → init-handler-PRHXSARK.js} +6 -6
- package/dist/cli/chunks/init-wizard-72MFBI3G.js +2 -0
- package/dist/cli/chunks/kernel-BRCBVMSK.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-TGGV6K5Q.js → kilocode-installer-F7LXBM7I.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-4XYBHZWW.js → kiro-installer-NM723ZRG.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-DG44IPEI.js +2 -0
- package/dist/cli/chunks/{learning-STE5W6BS.js → learning-5QYIDHH3.js} +3 -3
- package/dist/cli/chunks/{llm-router-NKF7J3RI.js → llm-router-43HKWPSX.js} +4 -4
- package/dist/cli/chunks/llm-router-service-24KXFX32.js +2 -0
- package/dist/cli/chunks/{load-B2T77UJQ.js → load-5YDBWSCS.js} +2 -2
- package/dist/cli/chunks/load-test-N4TAYJY3.js +2 -0
- package/dist/cli/chunks/mcp-UMAPMNMY.js +2 -0
- package/dist/cli/chunks/{memory-WRFZKG56.js → memory-FWCPCQFP.js} +5 -5
- package/dist/cli/chunks/memory-backend-NVYFYVAU.js +2 -0
- package/dist/cli/chunks/memory-handlers-UTWCNCHL.js +2 -0
- package/dist/cli/chunks/multi-model-executor-2XTBGLE4.js +14 -0
- package/dist/cli/chunks/{opencode-installer-J36EMQU7.js → opencode-installer-GIXOJ6NS.js} +2 -2
- package/dist/cli/chunks/orchestrator-VW6BKHLI.js +393 -0
- package/dist/cli/chunks/pattern-null-store-SBPNYDBR.js +2 -0
- package/dist/cli/chunks/{pattern-usage-recorder-BVMTWI3E.js → pattern-usage-recorder-7CEUC3J7.js} +2 -2
- package/dist/cli/chunks/{pipeline-OWAHDUAQ.js → pipeline-IGUQPPPO.js} +2 -2
- package/dist/cli/chunks/{platform-ANGBFWBV.js → platform-2P636I7B.js} +2 -2
- package/dist/cli/chunks/{plugin-OO7ON2YW.js → plugin-NY6SWDPE.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-HFG3BXWU.js → prime-radiant-advanced-wasm-2UUDTIO2.js} +2 -2
- package/dist/cli/chunks/{project-root-LNOYVTYY.js → project-root-IOISG5KX.js} +2 -2
- package/dist/cli/chunks/protocol-executor-IBYEII5Q.js +2 -0
- package/dist/cli/chunks/{protocol-handler-CE3Q6LY4.js → protocol-handler-ZTPCRQ5W.js} +2 -2
- package/dist/cli/chunks/{prove-7XPN53PY.js → prove-SQX5A3IG.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-7IETWW6W.js +2 -0
- package/dist/cli/chunks/{quality-TT23JRFX.js → quality-DROILKRY.js} +2 -2
- package/dist/cli/chunks/{quality-gate-PPPRP255.js → quality-gate-PWKWDJY2.js} +3 -3
- package/dist/cli/chunks/queen-coordinator-NHUK2MWJ.js +2 -0
- package/dist/cli/chunks/{real-embeddings-EYNZIFJE.js → real-embeddings-P5U3MGYC.js} +2 -2
- package/dist/cli/chunks/{ref-validation-QQR64ZXD.js → ref-validation-KY73NQXD.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-UIGS7ZJD.js → roocode-installer-6JPPRB3W.js} +2 -2
- package/dist/cli/chunks/router-SRSO3IHF.js +2 -0
- package/dist/cli/chunks/routing-feedback-PASRE5HY.js +2 -0
- package/dist/cli/chunks/{routing-handler-6AENUIRG.js → routing-handler-VTJIVFUO.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-5AWMEV34.js → ruvector-commands-C6RPSJJO.js} +2 -2
- package/dist/cli/chunks/rvf-dual-writer-4M4J67OU.js +2 -0
- package/dist/cli/chunks/rvf-migration-adapter-TSXGT5LF.js +2 -0
- package/dist/cli/chunks/{rvf-migration-coordinator-NWRJ7C22.js → rvf-migration-coordinator-R53URRIO.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-MOF3E7BR.js +2 -0
- package/dist/cli/chunks/{rvf-store-integrity-ISKRP563.js → rvf-store-integrity-MMXN5TEJ.js} +2 -2
- package/dist/cli/chunks/safe-db-QJLFO33B.js +2 -0
- package/dist/cli/chunks/schedule-YIVXW5O2.js +2 -0
- package/dist/cli/chunks/scheduler-AON7DWSJ.js +2 -0
- package/dist/cli/chunks/{security-325A7FMB.js → security-3B3R2NL4.js} +3 -3
- package/dist/cli/chunks/shared-rvf-adapter-VIJB7JUS.js +2 -0
- package/dist/cli/chunks/{shared-rvf-dual-writer-THFDYS2Z.js → shared-rvf-dual-writer-UVWGDUWC.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-75VHKKQB.js +2 -0
- package/dist/cli/chunks/{standalone-memory-UD4MJ6GZ.js → standalone-memory-M4LWAAYZ.js} +2 -2
- package/dist/cli/chunks/{status-handler-CPFTN4XL.js → status-handler-YYFV6OZL.js} +2 -2
- package/dist/cli/chunks/{structural-health-2MG2IVBL.js → structural-health-27E6LLKB.js} +2 -2
- package/dist/cli/chunks/sync-26CEGSTC.js +2 -0
- package/dist/cli/chunks/{sync-EE4VVKOW.js → sync-J3LJ56WN.js} +2 -2
- package/dist/cli/chunks/{task-handler-7H5OYJG4.js → task-handler-4MCEBQZL.js} +2 -2
- package/dist/cli/chunks/{task-handlers-NH4GJHCJ.js → task-handlers-GYBAWKE2.js} +3 -3
- package/dist/cli/chunks/{test-MPHGT4T6.js → test-MPC5HRH5.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-CHQ4ZLLJ.js → test-scheduling-ZJBFRZ3J.js} +3 -3
- package/dist/cli/chunks/token-bootstrap-2Y2XITBX.js +2 -0
- package/dist/cli/chunks/{token-usage-EBXUJNRB.js → token-usage-3X5WMTG2.js} +2 -2
- package/dist/cli/chunks/{transformers-ZEKS2OJZ.js → transformers-MVL4C5IX.js} +2 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-SLW65ZFO.js +2 -0
- package/dist/cli/chunks/{types-KYAA5VLV.js → types-TG5P3CRS.js} +2 -2
- package/dist/cli/chunks/unified-memory-UCQ6AB32.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-IXYUMKRR.js +2 -0
- package/dist/cli/chunks/unified-persistence-7E6JQ4FZ.js +2 -0
- package/dist/cli/chunks/{upgrade-UJBJ5AYM.js → upgrade-ETBHDEPY.js} +2 -2
- package/dist/cli/chunks/{validate-RUV6YMWS.js → validate-C2A73LZK.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-IVEVMGVM.js → validate-swarm-67XN42ML.js} +2 -2
- package/dist/cli/chunks/{vibium-HOGMFJ2Z.js → vibium-NILGKHLN.js} +2 -2
- package/dist/cli/chunks/visual-security-4VZXPEVG.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-AVWA6HKE.js → web-tree-sitter-USJN77P4.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-DAH7HI2W.js → windsurf-installer-5GGZXGJW.js} +2 -2
- package/dist/cli/chunks/witness-chain-IWS5ZHHL.js +2 -0
- package/dist/cli/chunks/witness-chain-JQA2VPZI.js +2 -0
- package/dist/cli/chunks/witness-chain-repair-4UA7IPS3.js +2 -0
- package/dist/cli/chunks/witness-chain-verifier-3GEADWPE.js +2 -0
- package/dist/cli/chunks/{witness-key-manager-JSTBMG43.js → witness-key-manager-ZWEIK3VJ.js} +2 -2
- package/dist/cli/chunks/{workflow-TWOIA6LZ.js → workflow-KHMVVBBA.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-GI5NQH7C.js +2 -0
- package/dist/cli/chunks/wrappers-N6XIK5PT.js +2 -0
- package/dist/cli/commands/audit.d.ts +20 -2
- package/dist/cli/commands/audit.js +158 -16
- package/dist/cli/commands/claude-flow-setup.js +5 -4
- package/dist/cli/index.js +2 -1
- package/dist/init/agents-installer.d.ts +4 -0
- package/dist/init/agents-installer.js +24 -11
- package/dist/init/codex-installer.js +4 -2
- package/dist/init/idempotent-write.d.ts +53 -0
- package/dist/init/idempotent-write.js +160 -0
- package/dist/init/phases/05-learning.js +3 -1
- package/dist/init/phases/07-hooks.js +32 -16
- package/dist/init/phases/08-mcp.js +4 -2
- package/dist/init/phases/10-workers.js +7 -5
- package/dist/init/phases/12-verification.js +7 -2
- package/dist/init/project-analyzer.d.ts +9 -0
- package/dist/init/project-analyzer.js +20 -1
- package/dist/init/self-configurator.d.ts +5 -3
- package/dist/init/self-configurator.js +18 -29
- package/dist/init/skills-installer.js +4 -2
- package/dist/init/types.d.ts +6 -0
- package/dist/init/types.js +20 -24
- package/dist/integrations/coherence/coherence-service.js +84 -24
- package/dist/integrations/coherence/vote-tally.d.ts +38 -0
- package/dist/integrations/coherence/vote-tally.js +39 -0
- package/dist/integrations/ruvector/shared-rvf-adapter.d.ts +23 -0
- package/dist/integrations/ruvector/shared-rvf-adapter.js +24 -0
- package/dist/kernel/kernel.js +3 -2
- package/dist/learning/pattern-store.d.ts +11 -0
- package/dist/learning/pattern-store.js +26 -8
- package/dist/learning/qe-patterns.d.ts +6 -0
- package/dist/learning/qe-patterns.js +7 -1
- package/dist/learning/qe-reasoning-bank.js +3 -0
- package/dist/learning/rvf-pattern-store.js +20 -7
- package/dist/learning/sqlite-persistence.d.ts +8 -1
- package/dist/learning/sqlite-persistence.js +49 -9
- package/dist/logging/console-logger.d.ts +2 -5
- package/dist/logging/console-logger.js +10 -46
- package/dist/logging/index.d.ts +2 -0
- package/dist/logging/index.js +1 -0
- package/dist/logging/redaction.d.ts +27 -0
- package/dist/logging/redaction.js +170 -0
- package/dist/mcp/bundle.js +435 -421
- package/dist/mcp/handlers/core-handlers.js +5 -4
- package/dist/mcp/protocol-server.js +2 -1
- package/dist/mcp/tools/base.d.ts +9 -2
- package/dist/mcp/tools/base.js +7 -0
- package/dist/mcp/tools/coherence/consensus.js +51 -2
- package/dist/mcp/tools/planning/goap-plan.d.ts +20 -7
- package/dist/mcp/tools/planning/goap-plan.js +92 -20
- package/dist/mcp/tools/planning/goap-status.d.ts +37 -12
- package/dist/mcp/tools/planning/goap-status.js +52 -23
- package/dist/mcp/tools/planning/world-state.d.ts +101 -0
- package/dist/mcp/tools/planning/world-state.js +274 -0
- package/dist/mcp/types.d.ts +4 -2
- package/dist/planning/goap-planner.d.ts +60 -4
- package/dist/planning/goap-planner.js +218 -60
- package/dist/planning/index.d.ts +1 -1
- package/dist/planning/index.js +1 -1
- package/dist/planning/plan-executor.d.ts +20 -1
- package/dist/planning/plan-executor.js +209 -100
- package/dist/planning/types.d.ts +16 -0
- package/dist/planning/types.js +17 -0
- package/package.json +1 -1
- package/dist/cli/chunks/adapter-IYC62SXA.js +0 -2
- package/dist/cli/chunks/agent-booster-wasm-EDNKP3SP.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-LLOU2IXD.js +0 -2
- package/dist/cli/chunks/audit-CVZQMF55.js +0 -3
- package/dist/cli/chunks/base-P3Z4IKCT.js +0 -2
- package/dist/cli/chunks/browser-workflow-YYHQQ25X.js +0 -2
- package/dist/cli/chunks/chunk-5WOSWNDN.js +0 -2
- package/dist/cli/chunks/chunk-7CD7PBHY.js +0 -3
- package/dist/cli/chunks/chunk-7X7JYWT4.js +0 -27
- package/dist/cli/chunks/chunk-J27F4NSB.js +0 -2
- package/dist/cli/chunks/chunk-MI5Q55DG.js +0 -65
- package/dist/cli/chunks/chunk-UDHVCKGA.js +0 -5
- package/dist/cli/chunks/chunk-XQSIRBKT.js +0 -180
- package/dist/cli/chunks/chunk-ZBABIZ2D.js +0 -2
- package/dist/cli/chunks/claude-flow-setup-5LVJOFKP.js +0 -2
- package/dist/cli/chunks/client-HUVFA5PF.js +0 -2
- package/dist/cli/chunks/core-handlers-UEXO3VAA.js +0 -2
- package/dist/cli/chunks/cross-domain-router-ODU5IZD6.js +0 -2
- package/dist/cli/chunks/domain-transfer-JZA5TMW3.js +0 -2
- package/dist/cli/chunks/dream-HE3OX42F.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-QUIFGGLX.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-42KB37KP.js +0 -2
- package/dist/cli/chunks/hnsw-index-T2PGO77J.js +0 -2
- package/dist/cli/chunks/hybrid-backend-FRNWYRKH.js +0 -2
- package/dist/cli/chunks/impact-analyzer-A5QYOYBR.js +0 -2
- package/dist/cli/chunks/init-wizard-XBU674YH.js +0 -2
- package/dist/cli/chunks/kernel-DV5MTNZD.js +0 -2
- package/dist/cli/chunks/knowledge-graph-4ACGVJQK.js +0 -2
- package/dist/cli/chunks/llm-router-service-PSMASERT.js +0 -2
- package/dist/cli/chunks/load-test-MRUO2VPF.js +0 -2
- package/dist/cli/chunks/mcp-JGSFCEMH.js +0 -2
- package/dist/cli/chunks/memory-backend-2MPGI6JW.js +0 -2
- package/dist/cli/chunks/memory-handlers-XT4HMITB.js +0 -2
- package/dist/cli/chunks/multi-model-executor-26Q5BSVG.js +0 -14
- package/dist/cli/chunks/orchestrator-D5IFV65I.js +0 -393
- package/dist/cli/chunks/pattern-null-store-TGWUL237.js +0 -2
- package/dist/cli/chunks/protocol-executor-GEVH5KD6.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-DJ2JL6QB.js +0 -2
- package/dist/cli/chunks/queen-coordinator-F7E3AS26.js +0 -2
- package/dist/cli/chunks/router-OZH3QSAU.js +0 -2
- package/dist/cli/chunks/routing-feedback-J2E3ADZB.js +0 -2
- package/dist/cli/chunks/rvf-dual-writer-HK525Y5Y.js +0 -2
- package/dist/cli/chunks/rvf-migration-adapter-Q7FB3BKR.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-5ZRCGUI6.js +0 -2
- package/dist/cli/chunks/safe-db-3OYEPVEH.js +0 -2
- package/dist/cli/chunks/schedule-AG4C2EIQ.js +0 -2
- package/dist/cli/chunks/scheduler-SQS2CZFZ.js +0 -2
- package/dist/cli/chunks/shared-rvf-adapter-NFL6QSZ6.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-MAKDFSHC.js +0 -2
- package/dist/cli/chunks/sync-MBTW5XBF.js +0 -2
- package/dist/cli/chunks/token-bootstrap-SSDCYEKK.js +0 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-J6ZMAK37.js +0 -2
- package/dist/cli/chunks/unified-memory-DDWMC435.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-4JA7SGBK.js +0 -2
- package/dist/cli/chunks/unified-persistence-F6OSNTXY.js +0 -2
- package/dist/cli/chunks/visual-security-25SMBIYT.js +0 -2
- package/dist/cli/chunks/witness-chain-PJOQPFUX.js +0 -2
- package/dist/cli/chunks/witness-chain-ZW6KKUZU.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-UKSIDM7Q.js +0 -2
- package/dist/cli/chunks/wrappers-UR7BLXKV.js +0 -2
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Witness Chain verification with break classification (ADR-070, issue #753).
|
|
3
|
+
*
|
|
4
|
+
* Before v3.14.5, two AQE processes appending at once could both read the
|
|
5
|
+
* same tail and write a row whose `prev_hash` points at an older row: an
|
|
6
|
+
* accidental FORK. `verify()` used to stop at the first such break, so the
|
|
7
|
+
* rows after it were never checked and a forked store looked exactly like a
|
|
8
|
+
* tampered one.
|
|
9
|
+
*
|
|
10
|
+
* Every row is now classified:
|
|
11
|
+
*
|
|
12
|
+
* - linked: `prev_hash` is the hash of its predecessor (array-adjacent row,
|
|
13
|
+
* or row `id - 1` in either table, which covers the archival boundary), and
|
|
14
|
+
* no id between the two is missing from live ∪ archive.
|
|
15
|
+
* - fork: the row's own `action_hash` recomputes, its `prev_hash` is the exact
|
|
16
|
+
* hash of an EARLIER row that still exists (live or archive), every id
|
|
17
|
+
* between that parent and the row still exists (no deleted history), and,
|
|
18
|
+
* when the row is signed with a key this verifier holds, the Ed25519
|
|
19
|
+
* signature verifies. The walk records the fork and CONTINUES, checking the
|
|
20
|
+
* next row against the fork row exactly as before.
|
|
21
|
+
* - tamper: anything else. The walk stops there.
|
|
22
|
+
*
|
|
23
|
+
* A fork alone does not make the chain valid: it is only accepted once a later,
|
|
24
|
+
* normally linked `CHAIN_REANCHOR` entry (written by `aqe audit repair`) lists
|
|
25
|
+
* that exact row (id + prev_hash + action_hash + parent id). Forks that appear
|
|
26
|
+
* after a re-anchor are unacknowledged again. The re-anchor also pins the hash
|
|
27
|
+
* of every dead-end row (a losing race sibling that no later row links to), so
|
|
28
|
+
* editing or deleting one after the repair is reported as tampering.
|
|
29
|
+
*
|
|
30
|
+
* Limits (documented in ADR-070): for UNSIGNED rows the fork class is
|
|
31
|
+
* structural, not cryptographic. A row whose prev_hash is the genesis sentinel
|
|
32
|
+
* mid-chain (the legacy #759 brain-import splice) is reported as tamper: the
|
|
33
|
+
* sentinel proves nothing about this chain and is exactly what a forged or
|
|
34
|
+
* history-deleting edit produces.
|
|
35
|
+
*/
|
|
36
|
+
import { GENESIS_PREV_HASH, hashWith, serializeEntry, signaturePayload } from './witness-chain-hash.js';
|
|
37
|
+
export const CHAIN_REANCHOR_ACTION = 'CHAIN_REANCHOR';
|
|
38
|
+
/** Row hash under the row's own algorithm (how pins are recorded). */
|
|
39
|
+
export function ownHash(row) {
|
|
40
|
+
return hashWith(row.hash_algo || 'sha256', serializeEntry(row));
|
|
41
|
+
}
|
|
42
|
+
/** Stateful single-use walker; see file header for the classification rules. */
|
|
43
|
+
export class WitnessChainVerifier {
|
|
44
|
+
db;
|
|
45
|
+
keyManager;
|
|
46
|
+
options;
|
|
47
|
+
archiveRows = null;
|
|
48
|
+
parentIndex = new Map();
|
|
49
|
+
acks = new Map();
|
|
50
|
+
pins = [];
|
|
51
|
+
forks = [];
|
|
52
|
+
tamper;
|
|
53
|
+
signatureFailures = 0;
|
|
54
|
+
firstSignatureFailure;
|
|
55
|
+
entriesChecked = 0;
|
|
56
|
+
archiveExists;
|
|
57
|
+
constructor(db, keyManager, options = {}) {
|
|
58
|
+
this.db = db;
|
|
59
|
+
this.keyManager = keyManager;
|
|
60
|
+
this.options = options;
|
|
61
|
+
}
|
|
62
|
+
run() {
|
|
63
|
+
const live = tableExists(this.db, 'witness_chain')
|
|
64
|
+
? this.db.prepare('SELECT * FROM witness_chain ORDER BY id ASC').all()
|
|
65
|
+
: [];
|
|
66
|
+
if (live.length === 0) {
|
|
67
|
+
// Archiving never moves genesis (id 1) out of the live table, so archived
|
|
68
|
+
// rows with no live chain mean the live table was emptied or dropped.
|
|
69
|
+
if (this.getArchive().length > 0) {
|
|
70
|
+
this.tamper = { id: 1, reason: 'live-chain-missing' };
|
|
71
|
+
return this.result(1);
|
|
72
|
+
}
|
|
73
|
+
return { valid: true, entriesChecked: 0, status: 'valid', tampered: false, forks: [], acknowledgedForks: [], forkDetails: [] };
|
|
74
|
+
}
|
|
75
|
+
// Live table first, then the archive as its own contiguous slice — NOT a
|
|
76
|
+
// merged id-sorted array, which would wrongly treat an archived row as the
|
|
77
|
+
// predecessor of a live row appended (and chained to the live tail) after
|
|
78
|
+
// that row was archived.
|
|
79
|
+
if (this.walk(live, 'live') && this.options.includeArchive)
|
|
80
|
+
this.walk(this.getArchive(), 'archive');
|
|
81
|
+
if (!this.tamper)
|
|
82
|
+
this.checkPins();
|
|
83
|
+
return this.result(live[0].id);
|
|
84
|
+
}
|
|
85
|
+
walk(rows, table) {
|
|
86
|
+
for (let i = 0; i < rows.length; i++) {
|
|
87
|
+
const current = rows[i];
|
|
88
|
+
this.entriesChecked++;
|
|
89
|
+
const link = this.classify(current, i > 0 ? rows[i - 1] : undefined);
|
|
90
|
+
if (link.kind === 'tamper') {
|
|
91
|
+
this.tamper = { id: current.id, reason: link.reason };
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
if (link.kind === 'fork') {
|
|
95
|
+
this.forks.push({
|
|
96
|
+
id: current.id, parentId: link.parentId, prevHash: current.prev_hash,
|
|
97
|
+
actionHash: current.action_hash, table, acknowledged: false,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
else if (current.action_type === CHAIN_REANCHOR_ACTION) {
|
|
101
|
+
if (this.checkSignature(current) === 'invalid') {
|
|
102
|
+
this.tamper = { id: current.id, reason: 'reanchor-signature-invalid' };
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
this.registerReanchor(current);
|
|
106
|
+
}
|
|
107
|
+
this.checkAllSignatures(current);
|
|
108
|
+
}
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
classify(current, arrayAdjacent) {
|
|
112
|
+
const algo = current.hash_algo || 'sha256';
|
|
113
|
+
if (current.action_hash !== hashWith(algo, current.action_data)) {
|
|
114
|
+
return { kind: 'tamper', reason: 'action-hash-mismatch' };
|
|
115
|
+
}
|
|
116
|
+
if (current.id === 1) {
|
|
117
|
+
return current.prev_hash === GENESIS_PREV_HASH
|
|
118
|
+
? { kind: 'linked' } : { kind: 'tamper', reason: 'genesis-link-mismatch' };
|
|
119
|
+
}
|
|
120
|
+
if (arrayAdjacent && current.prev_hash === hashWith(algo, serializeEntry(arrayAdjacent))) {
|
|
121
|
+
// Array-adjacent may skip ids that were archived; it may not skip ids that are gone.
|
|
122
|
+
return this.idsContiguous(arrayAdjacent.id, current.id)
|
|
123
|
+
? { kind: 'linked' } : { kind: 'tamper', reason: 'id-gap' };
|
|
124
|
+
}
|
|
125
|
+
const predecessor = this.findEntryById(current.id - 1);
|
|
126
|
+
if (predecessor && current.prev_hash === hashWith(algo, serializeEntry(predecessor))) {
|
|
127
|
+
return { kind: 'linked' };
|
|
128
|
+
}
|
|
129
|
+
const parentId = this.lookupParent(algo, current.prev_hash);
|
|
130
|
+
if (parentId !== undefined && parentId < current.id) {
|
|
131
|
+
if (!this.idsContiguous(parentId, current.id))
|
|
132
|
+
return { kind: 'tamper', reason: 'id-gap' };
|
|
133
|
+
if (this.checkSignature(current) === 'invalid')
|
|
134
|
+
return { kind: 'tamper', reason: 'fork-signature-invalid' };
|
|
135
|
+
return { kind: 'fork', parentId };
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
kind: 'tamper',
|
|
139
|
+
reason: current.prev_hash === GENESIS_PREV_HASH ? 'unlinked-genesis-prev-hash' : 'unlinked-prev-hash',
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
findEntryById(id) {
|
|
143
|
+
return this.db.prepare('SELECT * FROM witness_chain WHERE id = ?').get(id)
|
|
144
|
+
?? (this.hasArchive()
|
|
145
|
+
? this.db.prepare('SELECT * FROM witness_chain_archive WHERE id = ?').get(id)
|
|
146
|
+
: undefined);
|
|
147
|
+
}
|
|
148
|
+
getArchive() {
|
|
149
|
+
if (!this.archiveRows) {
|
|
150
|
+
this.archiveRows = this.hasArchive()
|
|
151
|
+
? this.db.prepare('SELECT * FROM witness_chain_archive ORDER BY id ASC').all()
|
|
152
|
+
: [];
|
|
153
|
+
}
|
|
154
|
+
return this.archiveRows;
|
|
155
|
+
}
|
|
156
|
+
/** Stores written before archiving existed (or opened read-only) may lack the archive table. */
|
|
157
|
+
hasArchive() {
|
|
158
|
+
if (this.archiveExists === undefined)
|
|
159
|
+
this.archiveExists = tableExists(this.db, 'witness_chain_archive');
|
|
160
|
+
return this.archiveExists;
|
|
161
|
+
}
|
|
162
|
+
/** hash → id over every row (live + archive), built lazily per hash algo on the first fork candidate. */
|
|
163
|
+
lookupParent(algo, prevHash) {
|
|
164
|
+
let index = this.parentIndex.get(algo);
|
|
165
|
+
if (!index) {
|
|
166
|
+
index = new Map();
|
|
167
|
+
const live = this.db.prepare('SELECT * FROM witness_chain').iterate();
|
|
168
|
+
for (const row of live)
|
|
169
|
+
index.set(hashWith(algo, serializeEntry(row)), row.id);
|
|
170
|
+
for (const row of this.getArchive()) {
|
|
171
|
+
const h = hashWith(algo, serializeEntry(row));
|
|
172
|
+
if (!index.has(h))
|
|
173
|
+
index.set(h, row.id);
|
|
174
|
+
}
|
|
175
|
+
this.parentIndex.set(algo, index);
|
|
176
|
+
}
|
|
177
|
+
return index.get(prevHash);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* True when every id strictly between `from` and `to` exists in live ∪
|
|
181
|
+
* archive. AUTOINCREMENT ids are never reused and a rolled-back insert does
|
|
182
|
+
* not consume one, so a missing id means a row was deleted.
|
|
183
|
+
*/
|
|
184
|
+
idsContiguous(from, to) {
|
|
185
|
+
const expected = to - from - 1;
|
|
186
|
+
if (expected <= 0)
|
|
187
|
+
return true;
|
|
188
|
+
const row = (this.hasArchive()
|
|
189
|
+
? this.db.prepare(`SELECT COUNT(*) AS n FROM (
|
|
190
|
+
SELECT id FROM witness_chain WHERE id > ? AND id < ?
|
|
191
|
+
UNION SELECT id FROM witness_chain_archive WHERE id > ? AND id < ?)`).get(from, to, from, to)
|
|
192
|
+
: this.db.prepare('SELECT COUNT(*) AS n FROM witness_chain WHERE id > ? AND id < ?').get(from, to));
|
|
193
|
+
return row.n === expected;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Signature status of one row against the keys this verifier holds. A row
|
|
197
|
+
* signed by a key it does not hold is `unverifiable` (e.g. a key from before
|
|
198
|
+
* persistent key storage) — classified on structure alone, like unsigned rows.
|
|
199
|
+
*/
|
|
200
|
+
checkSignature(entry) {
|
|
201
|
+
if (!entry.signature || !entry.signer_key_id)
|
|
202
|
+
return 'unsigned';
|
|
203
|
+
if (!this.keyManager || !this.keyManager.hasKey(entry.signer_key_id))
|
|
204
|
+
return 'unverifiable';
|
|
205
|
+
return this.keyManager.verify(signaturePayload(entry), Buffer.from(entry.signature, 'hex'), entry.signer_key_id)
|
|
206
|
+
? 'ok' : 'invalid';
|
|
207
|
+
}
|
|
208
|
+
/** Legacy `checkSignatures` option: every signed row must verify (unknown key = failure). */
|
|
209
|
+
checkAllSignatures(entry) {
|
|
210
|
+
if (this.options.checkSignatures !== true || !this.keyManager)
|
|
211
|
+
return;
|
|
212
|
+
if (!entry.signature || !entry.signer_key_id)
|
|
213
|
+
return;
|
|
214
|
+
const ok = this.keyManager.verify(signaturePayload(entry), Buffer.from(entry.signature, 'hex'), entry.signer_key_id);
|
|
215
|
+
if (!ok) {
|
|
216
|
+
this.signatureFailures++;
|
|
217
|
+
this.firstSignatureFailure ??= entry.id;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
registerReanchor(entry) {
|
|
221
|
+
let data;
|
|
222
|
+
try {
|
|
223
|
+
data = JSON.parse(entry.action_data) ?? {};
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (Array.isArray(data.forks)) {
|
|
229
|
+
for (const f of data.forks) {
|
|
230
|
+
if (typeof f?.id !== 'number' || f.id >= entry.id)
|
|
231
|
+
continue;
|
|
232
|
+
if (typeof f.parentId !== 'number' || typeof f.prevHash !== 'string' || typeof f.actionHash !== 'string')
|
|
233
|
+
continue;
|
|
234
|
+
const list = this.acks.get(f.id) ?? [];
|
|
235
|
+
list.push({ id: f.id, parentId: f.parentId, prevHash: f.prevHash, actionHash: f.actionHash });
|
|
236
|
+
this.acks.set(f.id, list);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (Array.isArray(data.pins)) {
|
|
240
|
+
for (const p of data.pins) {
|
|
241
|
+
if (typeof p?.id === 'number' && typeof p.hash === 'string')
|
|
242
|
+
this.pins.push({ id: p.id, hash: p.hash });
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/** Rows frozen by a verified re-anchor must still exist with the same hash. */
|
|
247
|
+
checkPins() {
|
|
248
|
+
for (const pin of this.pins) {
|
|
249
|
+
const row = this.findEntryById(pin.id);
|
|
250
|
+
if (!row || ownHash(row) !== pin.hash) {
|
|
251
|
+
this.tamper = { id: pin.id, reason: 'reanchored-row-changed' };
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
result(firstLiveId) {
|
|
257
|
+
for (const fork of this.forks) {
|
|
258
|
+
fork.acknowledged = (this.acks.get(fork.id) ?? []).some((a) => a.parentId === fork.parentId && a.prevHash === fork.prevHash && a.actionHash === fork.actionHash);
|
|
259
|
+
}
|
|
260
|
+
const unacknowledged = this.forks.filter((f) => !f.acknowledged);
|
|
261
|
+
const tampered = this.tamper !== undefined || this.signatureFailures > 0;
|
|
262
|
+
const status = tampered ? 'tampered'
|
|
263
|
+
: unacknowledged.length > 0 ? 'forked'
|
|
264
|
+
: this.forks.length > 0 ? 'valid-with-forks' : 'valid';
|
|
265
|
+
const valid = status === 'valid' || status === 'valid-with-forks';
|
|
266
|
+
// Legacy: a signature failure alone reported brokenAt = first live id.
|
|
267
|
+
const brokenAt = unacknowledged[0]?.id ?? this.tamper?.id
|
|
268
|
+
?? (this.signatureFailures > 0 ? firstLiveId : undefined);
|
|
269
|
+
return {
|
|
270
|
+
valid,
|
|
271
|
+
entriesChecked: this.entriesChecked,
|
|
272
|
+
signatureFailures: this.signatureFailures,
|
|
273
|
+
status,
|
|
274
|
+
tampered,
|
|
275
|
+
forks: this.forks.map((f) => f.id),
|
|
276
|
+
acknowledgedForks: this.forks.filter((f) => f.acknowledged).map((f) => f.id),
|
|
277
|
+
forkDetails: this.forks,
|
|
278
|
+
...(brokenAt !== undefined && !valid ? { brokenAt } : {}),
|
|
279
|
+
...(tampered ? {
|
|
280
|
+
tamperedAt: this.tamper?.id ?? this.firstSignatureFailure,
|
|
281
|
+
tamperReason: this.tamper?.reason ?? 'signature-invalid',
|
|
282
|
+
} : {}),
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
export function verifyWitnessChain(db, keyManager, options) {
|
|
287
|
+
return new WitnessChainVerifier(db, keyManager, options).run();
|
|
288
|
+
}
|
|
289
|
+
/** True when `name` is a table in the connected database. */
|
|
290
|
+
export function tableExists(db, name) {
|
|
291
|
+
return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(name) !== undefined;
|
|
292
|
+
}
|
|
293
|
+
//# sourceMappingURL=witness-chain-verifier.js.map
|
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { type Database as DatabaseType } from 'better-sqlite3';
|
|
9
9
|
import { type WitnessKeyManager } from './witness-key-manager.js';
|
|
10
|
-
|
|
10
|
+
import { GENESIS_PREV_HASH, sha256, shake256, hashWith, serializeEntry, signaturePayload } from './witness-chain-hash.js';
|
|
11
|
+
import { type VerifyOptions, type VerifyResult } from './witness-chain-verifier.js';
|
|
12
|
+
export type { VerifyOptions, VerifyResult, ChainStatus, TamperReason, WitnessForkInfo, ReanchorForkRecord, } from './witness-chain-verifier.js';
|
|
13
|
+
export { CHAIN_REANCHOR_ACTION } from './witness-chain-verifier.js';
|
|
14
|
+
export type WitnessActionType = 'PATTERN_CREATE' | 'PATTERN_UPDATE' | 'PATTERN_PROMOTE' | 'PATTERN_QUARANTINE' | 'DREAM_MERGE' | 'DREAM_DISCARD' | 'QUALITY_GATE_PASS' | 'QUALITY_GATE_FAIL' | 'ROUTING_DECISION' | 'FINDING_DELIVERED' | 'FINDING_BLOCKED' | 'BRANCH_MERGE' | 'BRANCH_DISCARD' | 'HEBBIAN_PENALTY' | 'KEY_ROTATION' | 'BRAIN_IMPORT' | 'CHAIN_REANCHOR';
|
|
11
15
|
export interface WitnessEntry {
|
|
12
16
|
id: number;
|
|
13
17
|
prev_hash: string;
|
|
@@ -28,32 +32,6 @@ export interface WitnessFilter {
|
|
|
28
32
|
limit?: number;
|
|
29
33
|
offset?: number;
|
|
30
34
|
}
|
|
31
|
-
export interface VerifyOptions {
|
|
32
|
-
/** Also verify Ed25519 signatures. Requires keyManager on the chain. */
|
|
33
|
-
checkSignatures?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Also walk `witness_chain_archive` and validate it as part of the same
|
|
36
|
-
* hash chain (archived rows are hash-linked to each other and to the live
|
|
37
|
-
* table exactly like un-archived rows). Off by default: the live-only walk
|
|
38
|
-
* is enough to catch tampering with current data and already correctly
|
|
39
|
-
* bridges the archival boundary; this option adds full historical coverage
|
|
40
|
-
* for a deep CI gate at the cost of reading the (potentially large) archive.
|
|
41
|
-
*/
|
|
42
|
-
includeArchive?: boolean;
|
|
43
|
-
}
|
|
44
|
-
export interface VerifyResult {
|
|
45
|
-
valid: boolean;
|
|
46
|
-
brokenAt?: number;
|
|
47
|
-
entriesChecked: number;
|
|
48
|
-
signatureFailures?: number;
|
|
49
|
-
}
|
|
50
|
-
declare const GENESIS_PREV_HASH: string;
|
|
51
|
-
declare function sha256(data: string): string;
|
|
52
|
-
/** SHAKE-256 (32-byte output) with SHA-256 fallback for older Node.js runtimes. */
|
|
53
|
-
declare function shake256(data: string): string;
|
|
54
|
-
declare function hashWith(algo: string, data: string): string;
|
|
55
|
-
/** Serialize a WitnessEntry to a deterministic string (original 7-field format). */
|
|
56
|
-
declare function serializeEntry(entry: WitnessEntry): string;
|
|
57
35
|
/**
|
|
58
36
|
* Hash-chained append-only audit log with optional Ed25519 signing.
|
|
59
37
|
* New entries use SHAKE-256. Existing SHA-256 entries remain valid.
|
|
@@ -72,22 +50,11 @@ export declare class WitnessChain {
|
|
|
72
50
|
/** Append a new SHAKE-256-hashed entry, optionally Ed25519-signed. */
|
|
73
51
|
append(actionType: WitnessActionType, actionData: Record<string, unknown>, actor: string): WitnessEntry;
|
|
74
52
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*/
|
|
80
|
-
private findEntryById;
|
|
81
|
-
/**
|
|
82
|
-
* Check one entry's self-hash and chain link. `arrayAdjacent` is whatever
|
|
83
|
-
* entry sits immediately before `current` in the array currently being
|
|
84
|
-
* scanned (undefined at the start of that array) — it's tried first since
|
|
85
|
-
* it's free (already fetched); a cross-table lookup by id only runs on a
|
|
86
|
-
* mismatch, e.g. because the true predecessor was moved to the archive by
|
|
87
|
-
* a *different* archival run than the one this scan is walking.
|
|
53
|
+
* Verify chain integrity. Supports mixed SHA-256/SHAKE-256 and optional
|
|
54
|
+
* signature checks. Classifies every break as a fork (pre-3.14.5 concurrent
|
|
55
|
+
* append, #753) or tampering, and keeps walking past forks so later rows are
|
|
56
|
+
* still checked; see witness-chain-verifier.ts for the exact rules.
|
|
88
57
|
*/
|
|
89
|
-
private checkEntryLink;
|
|
90
|
-
/** Verify chain integrity. Supports mixed SHA-256/SHAKE-256 and optional signature checks. */
|
|
91
58
|
verify(options?: VerifyOptions): VerifyResult;
|
|
92
59
|
/** Query entries with optional filters. */
|
|
93
60
|
getEntries(filter?: WitnessFilter): WitnessEntry[];
|
|
@@ -117,5 +84,5 @@ export declare function createWitnessChain(db: DatabaseType, keyManager?: Witnes
|
|
|
117
84
|
* memory growth doesn't compound across the file (issue #448 step 3).
|
|
118
85
|
*/
|
|
119
86
|
export declare function _resetWitnessChainForTests(): void;
|
|
120
|
-
export { GENESIS_PREV_HASH, sha256, shake256, hashWith, serializeEntry };
|
|
87
|
+
export { GENESIS_PREV_HASH, sha256, shake256, hashWith, serializeEntry, signaturePayload };
|
|
121
88
|
//# sourceMappingURL=witness-chain.d.ts.map
|
|
@@ -5,34 +5,11 @@
|
|
|
5
5
|
* SHAKE-256 / SHA-256 hash-chained append-only log with optional Ed25519 signing.
|
|
6
6
|
* Tamper-evident: modifying any entry breaks the hash chain, detectable by verify().
|
|
7
7
|
*/
|
|
8
|
-
import { createHash } from 'crypto';
|
|
9
8
|
import { getUnifiedMemory } from '../kernel/unified-memory.js';
|
|
10
9
|
import { getDefaultWitnessKeyManager } from './witness-key-manager.js';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return createHash('sha256').update(data, 'utf-8').digest('hex');
|
|
15
|
-
}
|
|
16
|
-
/** SHAKE-256 (32-byte output) with SHA-256 fallback for older Node.js runtimes. */
|
|
17
|
-
function shake256(data) {
|
|
18
|
-
try {
|
|
19
|
-
return createHash('shake256', { outputLength: 32 }).update(data, 'utf-8').digest('hex');
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
return sha256(data);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function hashWith(algo, data) {
|
|
26
|
-
return algo === 'shake256' ? shake256(data) : sha256(data);
|
|
27
|
-
}
|
|
28
|
-
/** Serialize a WitnessEntry to a deterministic string (original 7-field format). */
|
|
29
|
-
function serializeEntry(entry) {
|
|
30
|
-
return JSON.stringify({
|
|
31
|
-
id: entry.id, prev_hash: entry.prev_hash, action_hash: entry.action_hash,
|
|
32
|
-
action_type: entry.action_type, action_data: entry.action_data,
|
|
33
|
-
timestamp: entry.timestamp, actor: entry.actor,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
10
|
+
import { GENESIS_PREV_HASH, sha256, shake256, hashWith, serializeEntry, signaturePayload, } from './witness-chain-hash.js';
|
|
11
|
+
import { verifyWitnessChain } from './witness-chain-verifier.js';
|
|
12
|
+
export { CHAIN_REANCHOR_ACTION } from './witness-chain-verifier.js';
|
|
36
13
|
// --- WitnessChain ---
|
|
37
14
|
/**
|
|
38
15
|
* Hash-chained append-only audit log with optional Ed25519 signing.
|
|
@@ -66,6 +43,10 @@ export class WitnessChain {
|
|
|
66
43
|
ensureTable() {
|
|
67
44
|
if (!this.db)
|
|
68
45
|
throw new Error('Database not initialized');
|
|
46
|
+
// A read-only connection (e.g. `aqe audit verify`) must not create or
|
|
47
|
+
// migrate the schema; readers treat missing tables as empty instead.
|
|
48
|
+
if (this.db.readonly)
|
|
49
|
+
return;
|
|
69
50
|
this.db.exec(`
|
|
70
51
|
CREATE TABLE IF NOT EXISTS witness_chain (
|
|
71
52
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -120,8 +101,9 @@ export class WitnessChain {
|
|
|
120
101
|
let signature = null;
|
|
121
102
|
let signerKeyId = null;
|
|
122
103
|
if (this.keyManager) {
|
|
123
|
-
const
|
|
124
|
-
|
|
104
|
+
const result = this.keyManager.sign(signaturePayload({
|
|
105
|
+
prev_hash: prevHash, action_hash: actionHash, action_type: actionType, timestamp, actor,
|
|
106
|
+
}));
|
|
125
107
|
signature = result.signature.toString('hex');
|
|
126
108
|
signerKeyId = result.keyId;
|
|
127
109
|
}
|
|
@@ -137,87 +119,15 @@ export class WitnessChain {
|
|
|
137
119
|
return appendEntry.immediate();
|
|
138
120
|
}
|
|
139
121
|
/**
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*/
|
|
145
|
-
findEntryById(id) {
|
|
146
|
-
if (!this.db)
|
|
147
|
-
return undefined;
|
|
148
|
-
return this.db.prepare('SELECT * FROM witness_chain WHERE id = ?').get(id)
|
|
149
|
-
?? this.db.prepare('SELECT * FROM witness_chain_archive WHERE id = ?').get(id);
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Check one entry's self-hash and chain link. `arrayAdjacent` is whatever
|
|
153
|
-
* entry sits immediately before `current` in the array currently being
|
|
154
|
-
* scanned (undefined at the start of that array) — it's tried first since
|
|
155
|
-
* it's free (already fetched); a cross-table lookup by id only runs on a
|
|
156
|
-
* mismatch, e.g. because the true predecessor was moved to the archive by
|
|
157
|
-
* a *different* archival run than the one this scan is walking.
|
|
122
|
+
* Verify chain integrity. Supports mixed SHA-256/SHAKE-256 and optional
|
|
123
|
+
* signature checks. Classifies every break as a fork (pre-3.14.5 concurrent
|
|
124
|
+
* append, #753) or tampering, and keeps walking past forks so later rows are
|
|
125
|
+
* still checked; see witness-chain-verifier.ts for the exact rules.
|
|
158
126
|
*/
|
|
159
|
-
checkEntryLink(current, arrayAdjacent) {
|
|
160
|
-
const algo = current.hash_algo || 'sha256';
|
|
161
|
-
if (current.action_hash !== hashWith(algo, current.action_data))
|
|
162
|
-
return false;
|
|
163
|
-
if (current.id === 1)
|
|
164
|
-
return current.prev_hash === GENESIS_PREV_HASH; // genesis, never archived
|
|
165
|
-
if (arrayAdjacent && current.prev_hash === hashWith(algo, serializeEntry(arrayAdjacent))) {
|
|
166
|
-
return true;
|
|
167
|
-
}
|
|
168
|
-
const predecessor = this.findEntryById(current.id - 1);
|
|
169
|
-
return predecessor !== undefined && current.prev_hash === hashWith(algo, serializeEntry(predecessor));
|
|
170
|
-
}
|
|
171
|
-
/** Verify chain integrity. Supports mixed SHA-256/SHAKE-256 and optional signature checks. */
|
|
172
127
|
verify(options) {
|
|
173
128
|
if (!this.db)
|
|
174
129
|
throw new Error('WitnessChain not initialized');
|
|
175
|
-
|
|
176
|
-
if (live.length === 0)
|
|
177
|
-
return { valid: true, entriesChecked: 0 };
|
|
178
|
-
let signatureFailures = 0;
|
|
179
|
-
const checkSigs = options?.checkSignatures === true && this.keyManager !== null;
|
|
180
|
-
const checkSignature = (current) => {
|
|
181
|
-
if (checkSigs && current.signature && current.signer_key_id) {
|
|
182
|
-
const sigData = Buffer.from(current.prev_hash + current.action_hash + current.action_type + current.timestamp + current.actor, 'utf-8');
|
|
183
|
-
if (!this.keyManager.verify(Buffer.from(sigData), Buffer.from(current.signature, 'hex'), current.signer_key_id)) {
|
|
184
|
-
signatureFailures++;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
// Live table: always its own valid chain, since append() always chains
|
|
189
|
-
// to whatever the live tail is at write time — array-adjacency is right
|
|
190
|
-
// by construction *except* at a boundary where the true predecessor has
|
|
191
|
-
// since been archived, which checkEntryLink()'s fallback covers.
|
|
192
|
-
for (let i = 0; i < live.length; i++) {
|
|
193
|
-
const current = live[i];
|
|
194
|
-
if (!this.checkEntryLink(current, i > 0 ? live[i - 1] : undefined)) {
|
|
195
|
-
return { valid: false, brokenAt: current.id, entriesChecked: i + 1, signatureFailures };
|
|
196
|
-
}
|
|
197
|
-
checkSignature(current);
|
|
198
|
-
}
|
|
199
|
-
let entriesChecked = live.length;
|
|
200
|
-
if (options?.includeArchive) {
|
|
201
|
-
// The archived segment is its own contiguous slice of history (by id)
|
|
202
|
-
// and is checked the same way — NOT by merging archive+live into one
|
|
203
|
-
// id-sorted array, which would wrongly treat an archived row as the
|
|
204
|
-
// predecessor of a live row that was actually appended (and correctly
|
|
205
|
-
// chained to the live tail) well after that row was archived.
|
|
206
|
-
const archived = this.db.prepare('SELECT * FROM witness_chain_archive ORDER BY id ASC').all();
|
|
207
|
-
for (let i = 0; i < archived.length; i++) {
|
|
208
|
-
const current = archived[i];
|
|
209
|
-
if (!this.checkEntryLink(current, i > 0 ? archived[i - 1] : undefined)) {
|
|
210
|
-
return { valid: false, brokenAt: current.id, entriesChecked: entriesChecked + i + 1, signatureFailures };
|
|
211
|
-
}
|
|
212
|
-
checkSignature(current);
|
|
213
|
-
}
|
|
214
|
-
entriesChecked += archived.length;
|
|
215
|
-
}
|
|
216
|
-
const valid = signatureFailures === 0;
|
|
217
|
-
return {
|
|
218
|
-
valid, entriesChecked, signatureFailures,
|
|
219
|
-
...(signatureFailures > 0 ? { brokenAt: live[0].id } : {}),
|
|
220
|
-
};
|
|
130
|
+
return verifyWitnessChain(this.db, this.keyManager, options);
|
|
221
131
|
}
|
|
222
132
|
/** Query entries with optional filters. */
|
|
223
133
|
getEntries(filter) {
|
|
@@ -330,5 +240,5 @@ export function createWitnessChain(db, keyManager) {
|
|
|
330
240
|
export function _resetWitnessChainForTests() {
|
|
331
241
|
_instance = null;
|
|
332
242
|
}
|
|
333
|
-
export { GENESIS_PREV_HASH, sha256, shake256, hashWith, serializeEntry };
|
|
243
|
+
export { GENESIS_PREV_HASH, sha256, shake256, hashWith, serializeEntry, signaturePayload };
|
|
334
244
|
//# sourceMappingURL=witness-chain.js.map
|
|
@@ -31,7 +31,10 @@ export function recordGateResult(chain, result, actor = DEFAULT_ACTOR) {
|
|
|
31
31
|
export function verifyDeliveryChain(chain, opts) {
|
|
32
32
|
const r = chain.verify({ checkSignatures: opts?.checkSignatures === true });
|
|
33
33
|
if (!r.valid) {
|
|
34
|
-
|
|
34
|
+
const what = r.tampered
|
|
35
|
+
? `tampering detected at entry ${r.tamperedAt ?? r.brokenAt ?? '?'}`
|
|
36
|
+
: `${r.forks.length - r.acknowledgedForks.length} unacknowledged fork(s), first at entry ${r.brokenAt ?? '?'}`;
|
|
37
|
+
throw new Error(`Witness delivery chain INVALID — ${what} (checked ${r.entriesChecked}). Delivered findings cannot be trusted.`);
|
|
35
38
|
}
|
|
36
39
|
if (opts?.checkSignatures && (r.signatureFailures ?? 0) > 0) {
|
|
37
40
|
throw new Error(`Witness delivery chain has ${r.signatureFailures} signature failure(s) — provenance unverifiable.`);
|
package/dist/cli/bundle.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.
|
|
3
|
-
import{b as
|
|
4
|
-
Error: AQE system not initialized in this directory.`)),console.log(l.yellow("Run `aqe init` first to set up this project.\n")),process.exitCode=1,!1)}async function s(){if(t.initialized&&t.kernel&&t.queen)return!0;let e=
|
|
5
|
-
`);let a=3e4,c=new Promise((i,m)=>{setTimeout(()=>m(new Error("Initialization timeout after 30 seconds")),a)});try{return await Promise.race([
|
|
2
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.6");process.exit(0)}
|
|
3
|
+
import{b as E}from"./chunks/chunk-H6ZM3PUT.js";import{b as C,c as k,e as v}from"./chunks/chunk-WO4QMXIG.js";import{a as h}from"./chunks/chunk-KNNISEDY.js";import{a as O}from"./chunks/chunk-TCHGOB2N.js";import{b as w,c as R}from"./chunks/chunk-FBMN7B46.js";import"./chunks/chunk-ENGZ4D5V.js";import{a as f,c as Q}from"./chunks/chunk-MJS53PRX.js";import{Q as y,S as z}from"./chunks/chunk-DUYOVM5I.js";import"./chunks/chunk-64VGZQLB.js";Q();z();import{createRequire as V}from"node:module";import{Command as _}from"commander";import l from"chalk";O();R();function A(e,a,c,i){let m=e.command(a).description(c);if(i)for(let u of i)m.alias(u);return m.helpOption(!1),m.allowUnknownOption(!0),m.allowExcessArguments(!0),m}function L(e,a){let c=e.commands,i=c.indexOf(a);i>=0&&c.splice(i,1)}function n(e,a){let c=A(e,a.name,a.description,a.aliases);c.action(async()=>{try{let i=await a.factory();L(e,c),e.addCommand(i),await e.parseAsync(process.argv)}catch(i){console.error(`Failed to load command '${a.name}':`,i instanceof Error?i.message:i),process.exit(1)}})}function d(e,a,c,i,m,u){let g=A(e,a,c,u);g.action(async()=>{try{let p=await i();L(e,g),p.register(e,m),await e.parseAsync(process.argv)}catch(p){console.error(`Failed to load command '${a}':`,p instanceof Error?p.message:p),process.exit(1)}})}v();var t={kernel:null,queen:null,router:null,workflowOrchestrator:null,scheduledWorkflows:new Map,persistentScheduler:null,initialized:!1};function P(e,a){let c=e.getDomainAPI("visual-accessibility");if(c?.registerWorkflowActions)try{c.registerWorkflowActions(a)}catch(m){console.error(l.yellow(` Warning: Could not register visual-accessibility workflow actions: ${f(m)}`))}let i=e.getDomainAPI("requirements-validation");if(i?.registerWorkflowActions)try{i.registerWorkflowActions(a)}catch(m){console.error(l.yellow(` Warning: Could not register requirements-validation workflow actions: ${f(m)}`))}}async function M(){let{QEKernelImpl:e}=await import("./chunks/kernel-BRCBVMSK.js"),{CrossDomainEventRouter:a}=await import("./chunks/cross-domain-router-PQTD6AZN.js"),{DefaultProtocolExecutor:c}=await import("./chunks/protocol-executor-IBYEII5Q.js"),{WorkflowOrchestrator:i}=await import("./chunks/workflow-orchestrator-GI5NQH7C.js"),{createQueenCoordinator:m}=await import("./chunks/queen-coordinator-NHUK2MWJ.js"),{createPersistentScheduler:u}=await import("./chunks/scheduler-AON7DWSJ.js"),{loadCLIDomainPlugins:g}=await import("./chunks/domain-plugins-JJVWI4OQ.js");t.kernel=new e({maxConcurrentAgents:15,memoryBackend:"sqlite",hnswEnabled:!0,lazyLoading:!0,enabledDomains:[...h],enableExperienceBridge:!1}),await t.kernel.initialize();let p=await g(t.kernel.plugins);t.router=new a(t.kernel.eventBus),await t.router.initialize();let b=q=>t.kernel.getDomainAPI(q),x=new c(t.kernel.eventBus,t.kernel.memory,b);t.workflowOrchestrator=new i(t.kernel.eventBus,t.kernel.memory,t.kernel.coordinator),await t.workflowOrchestrator.initialize(),P(t.kernel,t.workflowOrchestrator),t.persistentScheduler=u(),t.queen=m(t.kernel,t.router,x,void 0,p),await t.queen.initialize();let{adoptExternalFleet:D}=await import("./chunks/core-handlers-HING5RRG.js");D({kernel:t.kernel,queen:t.queen,router:t.router,workflowOrchestrator:t.workflowOrchestrator}),t.initialized=!0}async function I(){if(t.initialized&&t.kernel&&t.queen)return!0;let e=await import("fs"),a=await import("path"),{findProjectRoot:c}=await import("./chunks/project-root-IOISG5KX.js"),i=a.join(c(),".agentic-qe");return e.existsSync(i)?s():(console.error(l.red(`
|
|
4
|
+
Error: AQE system not initialized in this directory.`)),console.log(l.yellow("Run `aqe init` first to set up this project.\n")),process.exitCode=1,!1)}async function s(){if(t.initialized&&t.kernel&&t.queen)return!0;let e=k(1);e&&process.stderr.write(l.gray("Auto-initializing v3 system...")+`
|
|
5
|
+
`);let a=3e4,c=new Promise((i,m)=>{setTimeout(()=>m(new Error("Initialization timeout after 30 seconds")),a)});try{return await Promise.race([M(),c]),e&&process.stderr.write(l.green("System ready")+`
|
|
6
6
|
|
|
7
|
-
`),!0}catch(i){return i.message.includes("timeout")?(console.error(l.red("Initialization timed out after 30 seconds.")),console.log(l.yellow("Try running `aqe init` manually."))):(console.error(l.red("Failed to auto-initialize:"),i),console.log(l.yellow("Try running `aqe init` manually."))),process.exitCode=1,!1}}async function o(e=0){try{t.workflowOrchestrator&&t.workflowOrchestrator.dispose().catch(()=>{}),t.queen&&t.queen.dispose().catch(()=>{}),t.router&&t.router.dispose().catch(()=>{}),t.kernel&&t.kernel.dispose().catch(()=>{})}catch{}process.exit(e)}var r=new
|
|
7
|
+
`),!0}catch(i){return i.message.includes("timeout")?(console.error(l.red("Initialization timed out after 30 seconds.")),console.log(l.yellow("Try running `aqe init` manually."))):(console.error(l.red("Failed to auto-initialize:"),i),console.log(l.yellow("Try running `aqe init` manually."))),process.exitCode=1,!1}}async function o(e=0){try{t.workflowOrchestrator&&t.workflowOrchestrator.dispose().catch(()=>{}),t.queen&&t.queen.dispose().catch(()=>{}),t.router&&t.router.dispose().catch(()=>{}),t.kernel&&t.kernel.dispose().catch(()=>{})}catch{}process.exit(e)}var r=new _,H=V(import.meta.url),Z=H("../../package.json").version,S="3.14.6";r.name("aqe").description("Agentic QE - Domain-Driven Quality Engineering").version(S).addHelpText("after",`
|
|
8
8
|
Environment:
|
|
9
9
|
AQE_LOG_LEVEL Internal log level: debug | info | warn | error | silent (default: warn)
|
|
10
10
|
LOG_LEVEL Same as AQE_LOG_LEVEL; AQE_LOG_LEVEL takes precedence
|
|
11
11
|
AQE_VERBOSE=1 Shorthand for info-level logging (full system-init output)
|
|
12
|
-
Diagnostics are written to stderr; stdout carries command output only.`);r.hook("preAction",(e,a)=>{
|
|
12
|
+
Diagnostics are written to stderr; stdout carries command output only.`);r.hook("preAction",(e,a)=>{C(a.opts())});d(r,"init","Initialize the AQE v3 system",()=>import("./chunks/init-handler-PRHXSARK.js").then(e=>e.createInitHandler(o)),t);d(r,"status","Show system status",()=>import("./chunks/status-handler-YYFV6OZL.js").then(e=>e.createStatusHandler(o,I)),t);d(r,"health","Check system health",()=>import("./chunks/status-handler-YYFV6OZL.js").then(e=>e.createHealthHandler(o,I)),t);d(r,"task","Manage QE tasks",()=>import("./chunks/task-handler-4MCEBQZL.js").then(e=>e.createTaskHandler(o,s)),t);d(r,"agent","Manage QE agents",()=>import("./chunks/agent-handler-D5SSQYNU.js").then(e=>e.createAgentHandler(o,s)),t);d(r,"domain","Domain operations",()=>import("./chunks/domain-handler-3DDWUVSR.js").then(e=>e.createDomainHandler(o,s)),t);d(r,"protocol","Execute coordination protocols",()=>import("./chunks/protocol-handler-ZTPCRQ5W.js").then(e=>e.createProtocolHandler(o,s)),t);d(r,"brain","Export, import, and inspect QE brain state",()=>import("./chunks/brain-handler-QPUFYX7F.js").then(e=>e.createBrainHandler(o,s)),t);d(r,"hypergraph","Query the code knowledge hypergraph",()=>import("./chunks/hypergraph-handler-CAWAQ673.js").then(e=>e.createHypergraphHandler(o,s)),t,["hg"]);d(r,"heartbeat","Manage the token-free heartbeat scheduler",()=>import("./chunks/heartbeat-handler-OYVW3VSC.js").then(e=>e.createHeartbeatHandler(o)),t);d(r,"routing","View routing performance, economics, and accuracy",()=>import("./chunks/routing-handler-VTJIVFUO.js").then(e=>e.createRoutingHandler(o)),t);n(r,{name:"workflow",description:"Manage QE workflows and pipelines (ADR-041)",factory:()=>import("./chunks/workflow-KHMVVBBA.js").then(e=>e.createWorkflowCommand(t,o,s))});n(r,{name:"test",description:"Test generation, execution, scheduling, and load testing",factory:()=>import("./chunks/test-MPC5HRH5.js").then(e=>e.createTestCommand(t,o,s))});n(r,{name:"coverage",description:"Coverage analysis shortcut",factory:()=>import("./chunks/coverage-PQB4IEFG.js").then(e=>e.createCoverageCommand(t,o,s))});n(r,{name:"quality",description:"Quality assessment shortcut",factory:()=>import("./chunks/quality-DROILKRY.js").then(e=>e.createQualityCommand(t,o,s))});n(r,{name:"quality-gate",description:"Two-gate, three-valued quality verdict against a pinned checklist (ADR-119)",factory:()=>import("./chunks/quality-gate-PWKWDJY2.js").then(e=>e.createQualityGateCommand(t,o,s))});n(r,{name:"security",description:"Security scanning and URL validation",factory:()=>import("./chunks/security-3B3R2NL4.js").then(e=>e.createSecurityCommand(t,o,s))});n(r,{name:"arena",description:"Competitive test-strategy tournaments (ADR-104)",factory:()=>import("./chunks/arena-MCE6EU7K.js").then(e=>e.createArenaCommand(t,o,s))});n(r,{name:"code",description:"Code intelligence analysis",factory:()=>import("./chunks/code-PGE6A42V.js").then(e=>e.createCodeCommand(t,o,s))});n(r,{name:"completions",description:"Generate shell completions for aqe",factory:()=>import("./chunks/completions-4AWLAARX.js").then(e=>e.createCompletionsCommand(o))});n(r,{name:"upgrade",description:"Detect optional native bindings and recommend install / flag changes",factory:()=>import("./chunks/upgrade-ETBHDEPY.js").then(e=>e.createUpgradeCommand(o))});n(r,{name:"fleet",description:"Fleet operations with multi-agent progress tracking",factory:()=>import("./chunks/fleet-55M5CJS4.js").then(e=>e.createFleetCommand(t,o,s,P))});n(r,{name:"validate",description:"Validation commands for skills and agents",factory:()=>import("./chunks/validate-swarm-67XN42ML.js").then(e=>e.createValidateSwarmCommand(t,o,s))});n(r,{name:"skill",description:"Skill validation and reporting (ADR-056)",factory:()=>import("./chunks/validate-C2A73LZK.js").then(e=>e.createValidateCommand(t,o,s))});n(r,{name:"eval",description:"Run skill evaluation suites in parallel",factory:()=>import("./chunks/eval-SOLG23EA.js").then(e=>e.createEvalCommand())});n(r,{name:"ci",description:"CI/CD pipeline orchestration",factory:()=>import("./chunks/ci-W6K6G2KZ.js").then(e=>e.createCICommand(t,o,s))});n(r,{name:"token-usage",description:"View and analyze token consumption metrics (ADR-042)",factory:()=>import("./chunks/token-usage-3X5WMTG2.js").then(e=>e.createTokenUsageCommand())});n(r,{name:"llm",description:"LLM Router management (ADR-043)",factory:()=>import("./chunks/llm-router-43HKWPSX.js").then(e=>e.createLLMRouterCommand())});n(r,{name:"sync",description:"Sync local learning data to cloud PostgreSQL",factory:()=>import("./chunks/sync-J3LJ56WN.js").then(e=>e.createSyncCommands())});n(r,{name:"hooks",description:"Self-learning QE hooks for pattern recognition and guidance",factory:()=>import("./chunks/hooks-5ZSSJWO6.js").then(e=>e.createHooksCommand())});n(r,{name:"learning",description:"AQE self-learning system management (standalone, no claude-flow required)",factory:()=>import("./chunks/learning-5QYIDHH3.js").then(e=>e.createLearningCommand())});n(r,{name:"memory",description:"Memory store, retrieve, search, and delete operations",factory:()=>Promise.all([import("./chunks/memory-FWCPCQFP.js"),import("./chunks/standalone-memory-M4LWAAYZ.js")]).then(([e,a])=>e.createMemoryCommand(t,o,a.createEnsureMemoryBackend(t)))});n(r,{name:"mcp",description:"Start the MCP protocol server for Claude Code integration",factory:()=>import("./chunks/mcp-UMAPMNMY.js").then(e=>e.createMcpCommand())});n(r,{name:"platform",description:"Manage coding agent platform configurations",factory:()=>import("./chunks/platform-2P636I7B.js").then(e=>e.createPlatformCommand())});n(r,{name:"prove",description:"Generate a verifiable Proof-of-Quality attestation",factory:()=>import("./chunks/prove-SQX5A3IG.js").then(e=>e.createProveCommand(t,o,s))});n(r,{name:"ruvector",description:"RuVector integration management",factory:()=>import("./chunks/ruvector-commands-C6RPSJJO.js").then(e=>e.createRuVectorCommand())});n(r,{name:"audit",description:"Witness chain audit trail management",factory:()=>import("./chunks/audit-BMWTQECB.js").then(e=>e.createAuditCommand(t,o,s))});n(r,{name:"pipeline",description:"Manage YAML deterministic pipelines (Imp-9)",factory:()=>import("./chunks/pipeline-IGUQPPPO.js").then(e=>e.createPipelineCommand(t,o,s))});n(r,{name:"plugin",description:"Manage external QE domain plugins",factory:()=>import("./chunks/plugin-NY6SWDPE.js").then(e=>e.createPluginCommand())});n(r,{name:"daemon",description:"Manage the QE Quality Daemon",factory:()=>import("./chunks/daemon-64C7R6OJ.js").then(e=>e.createDaemonCommand())});process.on("SIGINT",async()=>{console.log(l.yellow(`
|
|
13
13
|
|
|
14
14
|
Shutting down...`)),console.log(l.green(`Shutdown complete
|
|
15
15
|
`)),await o(0)});process.on("SIGTERM",async()=>{console.log(l.yellow(`
|
|
16
|
-
Received SIGTERM, shutting down gracefully...`)),await o(0)});async function
|
|
16
|
+
Received SIGTERM, shutting down gracefully...`)),await o(0)});async function T(){let{isVersionFastPath:e}=await import("./chunks/fast-paths-32N3ELI4.js");e(process.argv)&&(console.log(S),process.exit(0)),y();let a=process.argv.slice(2).filter(i=>i!=="--");if(!(a[0]==="learning"&&(a[1]==="backup"||a[1]==="restore"))){let{bootstrapTokenTracking:i}=await import("./chunks/token-bootstrap-2Y2XITBX.js");await i({enableOptimization:!0,enablePersistence:!0,verbose:process.env.AQE_VERBOSE==="true"})}await r.parseAsync(),!E()&&await o(process.exitCode??0)}T().catch(async e=>{console.error(l.red("Fatal error:"),w(e)),await o(1)});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.6");process.exit(0)}
|
|
2
|
+
import{a,b,c}from"./chunk-RFNPJK6N.js";import"./chunk-YSLL6VSL.js";import"./chunk-2YXGBZWV.js";import"./chunk-AIRGNL55.js";import"./chunk-MJS53PRX.js";import"./chunk-64VGZQLB.js";export{a as AgentBoosterAdapter,b as createAgentBoosterAdapter,c as createAgentBoosterAdapterSync};
|