agentic-qe 3.14.4 → 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 +169 -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 +43 -126
- package/dist/audit/witness-findings.js +4 -1
- package/dist/cli/bundle.js +13 -10
- 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-RDNTK4CA.js → agent-handler-D5SSQYNU.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-NAAMBWIR.js → agent-memory-branch-YHPLTITV.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-JR5AVQXR.js +2 -0
- package/dist/cli/chunks/{arena-KXFHRWX4.js → arena-7BGOXGXO.js} +2 -2
- package/dist/cli/chunks/{arena-HXTWJ5YY.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-UICJZIDG.js → better-sqlite3-PMUNGASU.js} +2 -2
- package/dist/cli/chunks/brain-handler-QPUFYX7F.js +94 -0
- package/dist/cli/chunks/{branch-enumerator-SS7UNVIA.js → branch-enumerator-WKFDGRN4.js} +2 -2
- package/dist/cli/chunks/{browser-77GI6KBE.js → browser-VY5HKH5X.js} +2 -2
- package/dist/cli/chunks/browser-workflow-CJ7T3MXF.js +2 -0
- package/dist/cli/chunks/{chunk-PZJOPURC.js → chunk-257E2A5M.js} +5 -5
- package/dist/cli/chunks/{chunk-55RWDRJD.js → chunk-2JVWITNK.js} +4 -4
- package/dist/cli/chunks/{chunk-BOARZKU3.js → chunk-2NPKIBAZ.js} +2 -2
- package/dist/cli/chunks/chunk-2TMWAQQ3.js +13 -0
- package/dist/cli/chunks/{chunk-M4WJKGVK.js → chunk-2YXGBZWV.js} +1 -1
- package/dist/cli/chunks/{chunk-3VOQRIQM.js → chunk-3EA536JF.js} +2 -2
- package/dist/cli/chunks/{chunk-ZZDIMOOV.js → chunk-3EZOZN25.js} +2 -2
- package/dist/cli/chunks/{chunk-MNW6QGNJ.js → chunk-3HZS4M3O.js} +2 -2
- package/dist/cli/chunks/{chunk-EKQ673SA.js → chunk-3NIG7S5W.js} +1 -1
- package/dist/cli/chunks/{chunk-7D777LTF.js → chunk-4N23RFDU.js} +2 -2
- package/dist/cli/chunks/{chunk-BOZZYWCR.js → chunk-5J6W7SIA.js} +1 -1
- package/dist/cli/chunks/{chunk-HIVA55CJ.js → chunk-5OOMJGFN.js} +1 -1
- package/dist/cli/chunks/{chunk-W7BWUTVV.js → chunk-5QQSIGUA.js} +2 -2
- package/dist/cli/chunks/{chunk-PAWXJ73E.js → chunk-5VFPCSK7.js} +1 -1
- package/dist/cli/chunks/{chunk-KPA7MZ6C.js → chunk-62N4NUJH.js} +2 -2
- package/dist/cli/chunks/chunk-64VGZQLB.js +2 -0
- package/dist/cli/chunks/{chunk-64PFWE2F.js → chunk-66VWCR67.js} +2 -2
- package/dist/cli/chunks/{chunk-XRT2WRMS.js → chunk-6LIHFV7O.js} +2 -2
- package/dist/cli/chunks/{chunk-STJCATGN.js → chunk-6OS76PHI.js} +2 -2
- package/dist/cli/chunks/{chunk-ZNPKDCZR.js → chunk-6RE3X4V5.js} +2 -2
- package/dist/cli/chunks/{chunk-BFP7KO7P.js → chunk-6SH5VZUD.js} +2 -2
- package/dist/cli/chunks/chunk-6SQM2MUX.js +4 -0
- package/dist/cli/chunks/{chunk-IPR4QP3H.js → chunk-6U7LNMWZ.js} +2 -2
- package/dist/cli/chunks/{chunk-MIQTXNBG.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-JZ3ORVZ3.js → chunk-7J6QC567.js} +3 -3
- package/dist/cli/chunks/{chunk-4OYFXLBK.js → chunk-7LPR6HJG.js} +2 -2
- package/dist/cli/chunks/{chunk-4MHXCAG2.js → chunk-7NITCZWD.js} +1 -1
- package/dist/cli/chunks/{chunk-M5QUBZY6.js → chunk-7Z5LHRC3.js} +2 -2
- package/dist/cli/chunks/{chunk-CSU5NYOX.js → chunk-AHKELLIO.js} +4 -4
- package/dist/cli/chunks/{chunk-DHJPWQBR.js → chunk-AIRGNL55.js} +2 -2
- package/dist/cli/chunks/{chunk-C2WU3533.js → chunk-AJRUJAAK.js} +1 -1
- package/dist/cli/chunks/{chunk-HIYXCDEP.js → chunk-AVBJYI5I.js} +1 -1
- package/dist/cli/chunks/{chunk-U5K45TFH.js → chunk-B6D2CHEH.js} +1 -1
- package/dist/cli/chunks/{chunk-FRH6VAUS.js → chunk-B6MOJC3X.js} +1 -1
- package/dist/cli/chunks/{chunk-HUWNIPZ5.js → chunk-BAMN2CHI.js} +1 -1
- package/dist/cli/chunks/{chunk-ONII3572.js → chunk-BBT64TII.js} +3 -3
- package/dist/cli/chunks/{chunk-KSKEF7LZ.js → chunk-BJTJLJRZ.js} +3 -3
- package/dist/cli/chunks/chunk-BMAPORJ7.js +15 -0
- package/dist/cli/chunks/{chunk-CIZ5JPDC.js → chunk-BPEDWS6O.js} +3 -3
- package/dist/cli/chunks/{chunk-Z3RHREWF.js → chunk-BVR7RMC5.js} +1 -1
- package/dist/cli/chunks/{chunk-HDSAM2RE.js → chunk-C6KWXUFJ.js} +2 -2
- package/dist/cli/chunks/{chunk-ZBAKA4YB.js → chunk-CCK4BF76.js} +1 -1
- package/dist/cli/chunks/{chunk-IFCLB7FJ.js → chunk-CD542DNJ.js} +1 -1
- package/dist/cli/chunks/{chunk-6KJABXAR.js → chunk-CF2ISEOJ.js} +2 -2
- package/dist/cli/chunks/chunk-CM7U6TAX.js +5 -0
- package/dist/cli/chunks/{chunk-3X3DJZJJ.js → chunk-D45SG6CP.js} +1 -1
- package/dist/cli/chunks/{chunk-DAEFDCJ4.js → chunk-D6CJIGRU.js} +89 -83
- package/dist/cli/chunks/{chunk-MVPCNSPY.js → chunk-DBDPRORT.js} +2 -2
- package/dist/cli/chunks/{chunk-AUXFKCQL.js → chunk-DHVX5UB2.js} +2 -2
- package/dist/cli/chunks/{chunk-GPLQ6DOK.js → chunk-DK4XN4CU.js} +2 -2
- package/dist/cli/chunks/{chunk-SRKETSFF.js → chunk-DPYSUDAO.js} +1 -1
- package/dist/cli/chunks/{chunk-CNG6GQEZ.js → chunk-DUYOVM5I.js} +2 -2
- package/dist/cli/chunks/{chunk-VIHTL3U2.js → chunk-DZ3AUAAB.js} +2 -2
- package/dist/cli/chunks/{chunk-CU46J64M.js → chunk-E6G2RD5H.js} +2 -2
- package/dist/cli/chunks/{chunk-5YPYDPBJ.js → chunk-EAY2JMZG.js} +2 -2
- package/dist/cli/chunks/{chunk-V3QLFNA2.js → chunk-ELLBS5RP.js} +4 -4
- package/dist/cli/chunks/chunk-ENGZ4D5V.js +2 -0
- package/dist/cli/chunks/chunk-FBMN7B46.js +4 -0
- package/dist/cli/chunks/{chunk-EDJ3O7RH.js → chunk-FWASDOT2.js} +2 -2
- package/dist/cli/chunks/{chunk-MDWCE7YW.js → chunk-FZOBD67M.js} +1 -1
- package/dist/cli/chunks/{chunk-A4FYONNU.js → chunk-GDSXITFH.js} +2 -2
- package/dist/cli/chunks/{chunk-2JW3BCGG.js → chunk-GGRHV6D7.js} +1 -1
- package/dist/cli/chunks/{chunk-ISDMD6EU.js → chunk-GPYVDFB3.js} +90 -90
- package/dist/cli/chunks/{chunk-CDKG6EI7.js → chunk-GSF6MB64.js} +2 -2
- package/dist/cli/chunks/{chunk-WLG5AJ4N.js → chunk-H52HZ67P.js} +2 -2
- package/dist/cli/chunks/{chunk-FGYMFUE2.js → chunk-H5BS5VH7.js} +2 -2
- package/dist/cli/chunks/{chunk-34WO57CW.js → chunk-H6ZM3PUT.js} +1 -1
- package/dist/cli/chunks/{chunk-6CQN24ZK.js → chunk-HM6ZSCPI.js} +1 -1
- package/dist/cli/chunks/{chunk-DPFRKBOG.js → chunk-HNFVJP4I.js} +2 -2
- package/dist/cli/chunks/{chunk-TPGED2IF.js → chunk-I33ERSGB.js} +2 -2
- package/dist/cli/chunks/{chunk-UEM7ZF5K.js → chunk-IAF6T27S.js} +2 -2
- package/dist/cli/chunks/{chunk-KCZR45PA.js → chunk-IB27QACC.js} +2 -2
- package/dist/cli/chunks/{chunk-SGYJ4NFZ.js → chunk-ICTXTNQZ.js} +1 -1
- package/dist/cli/chunks/chunk-IG5GNEC6.js +4 -0
- package/dist/cli/chunks/{chunk-KHFNNVJA.js → chunk-IQO7UCFR.js} +2 -2
- package/dist/cli/chunks/{chunk-3TW5W5LX.js → chunk-IV5UZOHH.js} +2 -2
- package/dist/cli/chunks/{chunk-7ZIOFPL3.js → chunk-JBTPOIAC.js} +2 -2
- package/dist/cli/chunks/{chunk-ZNEMGX5O.js → chunk-JIXUMYKZ.js} +1 -1
- package/dist/cli/chunks/{chunk-MTZH7AHC.js → chunk-JMONHE4B.js} +1 -1
- package/dist/cli/chunks/{chunk-TDZ53WO2.js → chunk-JVNTSNWU.js} +2 -2
- package/dist/cli/chunks/{chunk-PFR4G3DJ.js → chunk-JXGFRBUO.js} +2 -2
- package/dist/cli/chunks/chunk-JZOS5FCX.js +2 -0
- package/dist/cli/chunks/{chunk-STM3UDNO.js → chunk-KNNISEDY.js} +2 -2
- package/dist/cli/chunks/{chunk-TWAWHOP7.js → chunk-L4RUBPLR.js} +2 -2
- package/dist/cli/chunks/chunk-LL3IGZBI.js +2 -0
- package/dist/cli/chunks/{chunk-CIKSHTEQ.js → chunk-MBRHSU6W.js} +10 -10
- package/dist/cli/chunks/{chunk-G6T45OIC.js → chunk-MJS53PRX.js} +2 -2
- package/dist/cli/chunks/{chunk-PO3IXGMQ.js → chunk-MQROI74N.js} +2 -2
- package/dist/cli/chunks/{chunk-DOTK76IJ.js → chunk-MUOG6QXR.js} +2 -2
- package/dist/cli/chunks/{chunk-MVNP7GIR.js → chunk-MW2GGZZ5.js} +1 -1
- package/dist/cli/chunks/{chunk-FWGOHAAB.js → chunk-NHWGMJAP.js} +2 -2
- package/dist/cli/chunks/{chunk-ZBJ4XOOV.js → chunk-NMAIY4PX.js} +4 -4
- package/dist/cli/chunks/{chunk-CDHQFHRP.js → chunk-NQZ5AR3D.js} +2 -2
- package/dist/cli/chunks/{chunk-FLYOJOKN.js → chunk-P6OYS755.js} +1 -1
- package/dist/cli/chunks/{chunk-BGE6FOLM.js → chunk-PI7TJS62.js} +2 -2
- package/dist/cli/chunks/chunk-PX5YDCRH.js +4 -0
- package/dist/cli/chunks/{chunk-Q5DO24IJ.js → chunk-PZPWRQ2M.js} +3 -3
- package/dist/cli/chunks/{chunk-R4VL6E65.js → chunk-Q5XTSMWR.js} +2 -2
- package/dist/cli/chunks/{chunk-JBNEE5UH.js → chunk-Q7EAGKAE.js} +2 -2
- package/dist/cli/chunks/{chunk-R5NE6B2M.js → chunk-QDFTT3RF.js} +2 -2
- package/dist/cli/chunks/{chunk-DFZCKIGY.js → chunk-QGA55PFM.js} +3 -3
- package/dist/cli/chunks/{chunk-RJCYCLZV.js → chunk-QW6VMTBR.js} +2 -2
- package/dist/cli/chunks/{chunk-6VRA2QGL.js → chunk-QZANMBIT.js} +1 -1
- package/dist/cli/chunks/{chunk-MEGDYJPV.js → chunk-RETBYIAC.js} +4 -4
- package/dist/cli/chunks/{chunk-XJ7QNVI5.js → chunk-RFNPJK6N.js} +3 -3
- package/dist/cli/chunks/{chunk-NJBGXDQ7.js → chunk-RG52OKAM.js} +1 -1
- package/dist/cli/chunks/{chunk-DA5K5754.js → chunk-RSXXCL4A.js} +1 -1
- package/dist/cli/chunks/{chunk-HV2J7KKQ.js → chunk-RTFO5UQH.js} +2 -2
- package/dist/cli/chunks/{chunk-6UWGMOND.js → chunk-RZZCUIAI.js} +2 -2
- package/dist/cli/chunks/chunk-SDRHUMJB.js +2 -0
- package/dist/cli/chunks/{chunk-TSRSV3LD.js → chunk-SE4WIB26.js} +1 -1
- package/dist/cli/chunks/{chunk-ODKLFVYC.js → chunk-SESK3ARK.js} +2 -2
- package/dist/cli/chunks/{chunk-AWWNB2T7.js → chunk-SJUXE4IC.js} +2 -2
- package/dist/cli/chunks/{chunk-QGIU2WRL.js → chunk-SMDN3BQZ.js} +1 -1
- package/dist/cli/chunks/{chunk-VD6QRULW.js → chunk-SNOBH4AZ.js} +2 -2
- package/dist/cli/chunks/{chunk-OSLYSG3B.js → chunk-SPV2VKC5.js} +2 -2
- package/dist/cli/chunks/chunk-TCHGOB2N.js +2 -0
- package/dist/cli/chunks/{chunk-MOBNBMFW.js → chunk-TVYY3OCX.js} +1 -1
- package/dist/cli/chunks/{chunk-UGVHCMUN.js → chunk-UCFQALXO.js} +3 -3
- package/dist/cli/chunks/{chunk-3QHGWY7T.js → chunk-UKA2KOXE.js} +2 -2
- package/dist/cli/chunks/{chunk-MCUJEZT6.js → chunk-UNFFDHER.js} +16 -11
- package/dist/cli/chunks/{chunk-6QYNWR7U.js → chunk-UQ32JHES.js} +2 -2
- package/dist/cli/chunks/{chunk-OULHKEVH.js → chunk-V4DM6ELU.js} +2 -2
- package/dist/cli/chunks/{chunk-M2JBBZQB.js → chunk-VGFFFKGK.js} +2 -2
- package/dist/cli/chunks/{chunk-OCWWP5PL.js → chunk-VMNWDJIZ.js} +2 -2
- package/dist/cli/chunks/chunk-W6HXLH5G.js +180 -0
- package/dist/cli/chunks/{chunk-AIHDEEJO.js → chunk-WCJBU2KI.js} +2 -2
- package/dist/cli/chunks/{chunk-ZBQY5GLF.js → chunk-WGM35YWL.js} +2 -2
- package/dist/cli/chunks/chunk-WO4QMXIG.js +3 -0
- package/dist/cli/chunks/{chunk-3UPAMMCB.js → chunk-XAS3XRYM.js} +1 -1
- package/dist/cli/chunks/chunk-Y3LZ35OG.js +2 -0
- package/dist/cli/chunks/{chunk-5R3QL7WN.js → chunk-Y3UOUNHM.js} +2 -2
- package/dist/cli/chunks/{chunk-ZJ26AQA5.js → chunk-YFBSPLJG.js} +1 -1
- package/dist/cli/chunks/{chunk-BDESSCVR.js → chunk-YHKEDEAA.js} +3 -3
- package/dist/cli/chunks/{chunk-CXQPR5MY.js → chunk-YS4FCTWF.js} +1 -1
- package/dist/cli/chunks/{chunk-CLTMDCSE.js → chunk-YSLL6VSL.js} +2 -2
- package/dist/cli/chunks/chunk-Z6GGIRQQ.js +65 -0
- package/dist/cli/chunks/{chunk-F3SBRQC6.js → chunk-Z7WODOTH.js} +2 -2
- package/dist/cli/chunks/chunk-ZCRTRYXK.js +14 -0
- package/dist/cli/chunks/{chunk-XRYF6JV7.js → chunk-ZEV3YTO7.js} +2 -2
- package/dist/cli/chunks/{chunk-YNXS6CGV.js → chunk-ZL6SYKUK.js} +1 -1
- package/dist/cli/chunks/{chunk-5SJHQ2CO.js → chunk-ZSPU4MOS.js} +2 -2
- package/dist/cli/chunks/{chunk-UDHKLT4C.js → chunk-ZVWVV4EX.js} +1 -1
- package/dist/cli/chunks/{ci-464KPQNP.js → ci-W6K6G2KZ.js} +2 -2
- package/dist/cli/chunks/{ci-output-I7FX2RSO.js → ci-output-LDT24TS3.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-3FW237WW.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-UWFHT6VY.js → cline-installer-G7TJOAEX.js} +2 -2
- package/dist/cli/chunks/{code-KQSUT3FS.js → code-PGE6A42V.js} +3 -3
- package/dist/cli/chunks/{code-index-extractor-PABBNUSC.js → code-index-extractor-RNITH372.js} +2 -2
- package/dist/cli/chunks/codex-installer-LBX77AI3.js +14 -0
- package/dist/cli/chunks/{completions-7RWHAUAR.js → completions-4AWLAARX.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-XPOAF33E.js → complexity-analyzer-ZPNSS476.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-V4F2FIZP.js → continuedev-installer-UAPWX6OA.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-JMICURQB.js → copilot-installer-BJN2YJGI.js} +2 -2
- package/dist/cli/chunks/core-handlers-HING5RRG.js +2 -0
- package/dist/cli/chunks/{cost-tracker-5OFHEYFJ.js → cost-tracker-MHP2VJ63.js} +2 -2
- package/dist/cli/chunks/{coverage-QKN57JDS.js → coverage-PQB4IEFG.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-PQTD6AZN.js +2 -0
- package/dist/cli/chunks/{cursor-installer-GBJ7YXSM.js → cursor-installer-ZXBWYAS3.js} +2 -2
- package/dist/cli/chunks/{daemon-GKP7CMEK.js → daemon-64C7R6OJ.js} +3 -3
- package/dist/cli/chunks/{daemon-IAVSO6HK.js → daemon-N2BEGEFY.js} +4 -4
- package/dist/cli/chunks/{dag-attention-scheduler-S225TCI7.js → dag-attention-scheduler-SPZDAPNL.js} +2 -2
- package/dist/cli/chunks/{detect-IUYH422U.js → detect-LXJBSSZW.js} +2 -2
- package/dist/cli/chunks/{dist-node-2YRE6A7C.js → dist-node-U3TKZ2IZ.js} +2 -2
- package/dist/cli/chunks/{domain-handler-PL2TZC6H.js → domain-handler-3DDWUVSR.js} +2 -2
- package/dist/cli/chunks/{domain-plugins-HCGLXKIT.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-JPAR7TXX.js +3 -0
- package/dist/cli/chunks/{eval-WCK7KNFN.js → eval-SOLG23EA.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-2MSQWSAR.js → experience-capture-middleware-T7G2VOOD.js} +4 -4
- package/dist/cli/chunks/{fast-paths-VYOSIBKF.js → fast-paths-32N3ELI4.js} +2 -2
- package/dist/cli/chunks/{feature-flags-WCFUKHNQ.js → feature-flags-APJDQ4N7.js} +2 -2
- package/dist/cli/chunks/{feature-flags-UJRHFBRX.js → feature-flags-NAHKLDRN.js} +2 -2
- package/dist/cli/chunks/{file-discovery-JDGL4ZWS.js → file-discovery-YKVM3MDB.js} +2 -2
- package/dist/cli/chunks/{fleet-ROXVMZ2F.js → fleet-55M5CJS4.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-NIO4ZCO3.js → gnn-wrapper-UD6E6S6Z.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-PI42WD3C.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-YLC7SPK2.js → hnsw-legacy-bridge-HBYIS3ZW.js} +2 -2
- package/dist/cli/chunks/{hnswlib-node-LG6OS3B7.js → hnswlib-node-EQPM42OU.js} +2 -2
- package/dist/cli/chunks/{hooks-WVALP5GX.js → hooks-5ZSSJWO6.js} +10 -10
- package/dist/cli/chunks/hybrid-backend-CCF7URKI.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-GJEMW3EG.js → hypergraph-engine-XBGVQ4PD.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-BLF6LXEV.js → hypergraph-handler-CAWAQ673.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-HGKAZWIG.js +2 -0
- package/dist/cli/chunks/{init-handler-K25RWRYY.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-BXN6WZ7G.js → kilocode-installer-F7LXBM7I.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-PM362DLN.js → kiro-installer-NM723ZRG.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-DG44IPEI.js +2 -0
- package/dist/cli/chunks/{learning-CPERDDRG.js → learning-5QYIDHH3.js} +3 -3
- package/dist/cli/chunks/{llm-router-GOAV5FPI.js → llm-router-43HKWPSX.js} +4 -4
- package/dist/cli/chunks/llm-router-service-24KXFX32.js +2 -0
- package/dist/cli/chunks/{load-2BG6SHAK.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-4NHBYT6S.js → memory-FWCPCQFP.js} +6 -6
- 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-ATZLLK74.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-7VE4XDAI.js → pattern-usage-recorder-7CEUC3J7.js} +2 -2
- package/dist/cli/chunks/{pipeline-LQZSNDD2.js → pipeline-IGUQPPPO.js} +2 -2
- package/dist/cli/chunks/platform-2P636I7B.js +2 -0
- package/dist/cli/chunks/{plugin-EJ6K2MGU.js → plugin-NY6SWDPE.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-OIHTKJMN.js → prime-radiant-advanced-wasm-2UUDTIO2.js} +2 -2
- package/dist/cli/chunks/project-root-IOISG5KX.js +2 -0
- package/dist/cli/chunks/protocol-executor-IBYEII5Q.js +2 -0
- package/dist/cli/chunks/{protocol-handler-NRBROAU7.js → protocol-handler-ZTPCRQ5W.js} +2 -2
- package/dist/cli/chunks/{prove-EJOGEGD3.js → prove-SQX5A3IG.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-7IETWW6W.js +2 -0
- package/dist/cli/chunks/{quality-E55UC73D.js → quality-DROILKRY.js} +2 -2
- package/dist/cli/chunks/{quality-gate-OIQATNT3.js → quality-gate-PWKWDJY2.js} +3 -3
- package/dist/cli/chunks/queen-coordinator-NHUK2MWJ.js +2 -0
- package/dist/cli/chunks/real-embeddings-P5U3MGYC.js +2 -0
- package/dist/cli/chunks/{ref-validation-OPO6J7OL.js → ref-validation-KY73NQXD.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-ODY5KRWU.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-KQM6VWLC.js → routing-handler-VTJIVFUO.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-U2GVV6PF.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-R53URRIO.js +2 -0
- package/dist/cli/chunks/rvf-native-adapter-MOF3E7BR.js +2 -0
- package/dist/cli/chunks/{rvf-store-integrity-KMIHD3LP.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-P5NM353C.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-2CSG7C4W.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-M4LWAAYZ.js +2 -0
- package/dist/cli/chunks/{status-handler-6TU6O37R.js → status-handler-YYFV6OZL.js} +2 -2
- package/dist/cli/chunks/{structural-health-KBIJSTXJ.js → structural-health-27E6LLKB.js} +2 -2
- package/dist/cli/chunks/sync-26CEGSTC.js +2 -0
- package/dist/cli/chunks/{sync-LNHI5SB7.js → sync-J3LJ56WN.js} +2 -2
- package/dist/cli/chunks/task-handler-4MCEBQZL.js +54 -0
- package/dist/cli/chunks/task-handlers-GYBAWKE2.js +9 -0
- package/dist/cli/chunks/{test-DHAAI3DU.js → test-MPC5HRH5.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-XDBZ3QC2.js → test-scheduling-ZJBFRZ3J.js} +3 -3
- package/dist/cli/chunks/token-bootstrap-2Y2XITBX.js +2 -0
- package/dist/cli/chunks/{token-usage-Q2YG5YQN.js → token-usage-3X5WMTG2.js} +2 -2
- package/dist/cli/chunks/{transformers-F5UQTQCY.js → transformers-MVL4C5IX.js} +2 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-SLW65ZFO.js +2 -0
- package/dist/cli/chunks/{types-JQ7EQO5Q.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-TJRVGHGD.js → upgrade-ETBHDEPY.js} +2 -2
- package/dist/cli/chunks/{validate-BWPCVHBN.js → validate-C2A73LZK.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-QVVKCQLP.js → validate-swarm-67XN42ML.js} +2 -2
- package/dist/cli/chunks/{vibium-ZFATIWHO.js → vibium-NILGKHLN.js} +2 -2
- package/dist/cli/chunks/visual-security-4VZXPEVG.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-KPLY7ONR.js → web-tree-sitter-USJN77P4.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-H7XM7ISA.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-DFRL42GE.js → witness-key-manager-ZWEIK3VJ.js} +2 -2
- package/dist/cli/chunks/{workflow-2ZQO6WYI.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/commands/mcp.js +6 -0
- package/dist/cli/commands/memory.d.ts +1 -1
- package/dist/cli/commands/memory.js +8 -8
- package/dist/cli/commands/platform.js +15 -2
- package/dist/cli/commands/upgrade.d.ts +3 -3
- package/dist/cli/commands/upgrade.js +3 -3
- package/dist/cli/handlers/init-handler.d.ts +10 -0
- package/dist/cli/handlers/task-handler.js +24 -3
- package/dist/cli/helpers/standalone-memory.d.ts +12 -0
- package/dist/cli/helpers/standalone-memory.js +46 -0
- package/dist/cli/index.js +39 -42
- package/dist/cli/log-gate.d.ts +66 -0
- package/dist/cli/log-gate.js +170 -0
- package/dist/init/agents-installer.d.ts +4 -0
- package/dist/init/agents-installer.js +24 -11
- package/dist/init/codex-installer.js +22 -8
- package/dist/init/idempotent-write.d.ts +53 -0
- package/dist/init/idempotent-write.js +160 -0
- package/dist/init/orchestrator.js +1 -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/09-assets.d.ts +10 -0
- package/dist/init/phases/09-assets.js +3 -0
- 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/token-bootstrap.d.ts +1 -1
- package/dist/init/token-bootstrap.js +12 -2
- package/dist/init/types.d.ts +16 -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/brain-exporter.js +17 -0
- package/dist/integrations/ruvector/brain-import-audit.d.ts +20 -0
- package/dist/integrations/ruvector/brain-import-audit.js +22 -0
- package/dist/integrations/ruvector/brain-rvf-exporter.js +16 -0
- package/dist/integrations/ruvector/brain-shared.js +1 -1
- package/dist/integrations/ruvector/rvf-dual-writer.js +6 -1
- package/dist/integrations/ruvector/shared-rvf-adapter.d.ts +23 -0
- package/dist/integrations/ruvector/shared-rvf-adapter.js +24 -0
- package/dist/kernel/hybrid-backend.d.ts +6 -0
- package/dist/kernel/hybrid-backend.js +18 -0
- package/dist/kernel/kernel.js +12 -16
- package/dist/kernel/project-root.d.ts +1 -1
- package/dist/kernel/project-root.js +24 -3
- package/dist/learning/embedder-identity-store.js +4 -3
- package/dist/learning/pattern-store.d.ts +11 -0
- package/dist/learning/pattern-store.js +31 -9
- 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/real-embeddings.d.ts +8 -0
- package/dist/learning/real-embeddings.js +16 -0
- package/dist/learning/rvf-pattern-store.js +30 -10
- 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 +463 -449
- package/dist/mcp/entry.js +2 -0
- package/dist/mcp/handlers/core-handlers.js +5 -4
- package/dist/mcp/handlers/memory-handlers.d.ts +6 -1
- package/dist/mcp/handlers/memory-handlers.js +44 -22
- package/dist/mcp/handlers/task-handlers.js +14 -1
- package/dist/mcp/protocol-server.js +3 -1
- package/dist/mcp/services/session-store.js +5 -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/dist/plugins/cache.d.ts +2 -0
- package/dist/plugins/cache.js +15 -2
- package/dist/plugins/lifecycle.js +15 -2
- package/dist/plugins/manifest.js +7 -5
- package/dist/plugins/resolver.d.ts +13 -22
- package/dist/plugins/resolver.js +169 -61
- package/dist/plugins/version-policy.d.ts +13 -0
- package/dist/plugins/version-policy.js +18 -0
- package/dist/shared/types/index.d.ts +6 -0
- package/dist/shared/types/index.js +8 -0
- package/package.json +2 -1
- package/dist/cli/chunks/adapter-TNNNJRDG.js +0 -2
- package/dist/cli/chunks/agent-booster-wasm-5PC7D2FW.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-5ZRMYJLB.js +0 -2
- package/dist/cli/chunks/audit-YSGA7UWT.js +0 -3
- package/dist/cli/chunks/base-KWZHOPSH.js +0 -2
- package/dist/cli/chunks/brain-handler-ET6YAP4B.js +0 -90
- package/dist/cli/chunks/browser-workflow-2FZTKDUL.js +0 -2
- package/dist/cli/chunks/chunk-33YYYWBQ.js +0 -4
- package/dist/cli/chunks/chunk-5Z6XZV7K.js +0 -65
- package/dist/cli/chunks/chunk-6J62K3SW.js +0 -2
- package/dist/cli/chunks/chunk-6TPKK7LD.js +0 -15
- package/dist/cli/chunks/chunk-DEYLEDJN.js +0 -27
- package/dist/cli/chunks/chunk-J6GNQS62.js +0 -5
- package/dist/cli/chunks/chunk-KGT36Z42.js +0 -14
- package/dist/cli/chunks/chunk-NA7B2QYB.js +0 -2
- package/dist/cli/chunks/chunk-NDPFGIMJ.js +0 -13
- package/dist/cli/chunks/chunk-OBAP2TXZ.js +0 -2
- package/dist/cli/chunks/chunk-PEPFCPES.js +0 -2
- package/dist/cli/chunks/chunk-T6BVLVI5.js +0 -2
- package/dist/cli/chunks/chunk-TT23RRB7.js +0 -2
- package/dist/cli/chunks/chunk-XC7DYDSY.js +0 -180
- package/dist/cli/chunks/chunk-XWMZ6D6N.js +0 -2
- package/dist/cli/chunks/chunk-Y3MW3YBC.js +0 -3
- package/dist/cli/chunks/claude-flow-setup-6JKMBPGU.js +0 -2
- package/dist/cli/chunks/client-7E4LM2WW.js +0 -2
- package/dist/cli/chunks/codex-installer-CQ24DTP5.js +0 -14
- package/dist/cli/chunks/core-handlers-IFG3757P.js +0 -2
- package/dist/cli/chunks/cross-domain-router-EK7W4PGP.js +0 -2
- package/dist/cli/chunks/domain-transfer-KQJRUPXA.js +0 -2
- package/dist/cli/chunks/dream-NFSCSLY7.js +0 -2
- package/dist/cli/chunks/embed-and-insert-pattern-ZPAG7235.js +0 -3
- package/dist/cli/chunks/heartbeat-scheduler-ZATCDJDK.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-WXQABRCA.js +0 -2
- package/dist/cli/chunks/hnsw-index-TPSWLEA5.js +0 -2
- package/dist/cli/chunks/impact-analyzer-HNIU45P5.js +0 -2
- package/dist/cli/chunks/init-wizard-JUIPBMHG.js +0 -2
- package/dist/cli/chunks/kernel-5BOZQ754.js +0 -2
- package/dist/cli/chunks/knowledge-graph-EWDAENWM.js +0 -2
- package/dist/cli/chunks/llm-router-service-3YT7JGBS.js +0 -2
- package/dist/cli/chunks/load-test-BP2CPLIV.js +0 -2
- package/dist/cli/chunks/mcp-5TTB37DC.js +0 -2
- package/dist/cli/chunks/memory-backend-4PYQBPRM.js +0 -2
- package/dist/cli/chunks/memory-handlers-2B27NITS.js +0 -2
- package/dist/cli/chunks/multi-model-executor-KCWSGCDT.js +0 -14
- package/dist/cli/chunks/orchestrator-RKB7XJRG.js +0 -393
- package/dist/cli/chunks/pattern-null-store-OYOQOV2O.js +0 -2
- package/dist/cli/chunks/platform-OD5H5U6G.js +0 -2
- package/dist/cli/chunks/protocol-executor-3ATJTXWG.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-LLMYZT4X.js +0 -2
- package/dist/cli/chunks/queen-coordinator-RN7L6KG5.js +0 -2
- package/dist/cli/chunks/real-embeddings-FPFFNOSZ.js +0 -2
- package/dist/cli/chunks/router-MDHITQ2V.js +0 -2
- package/dist/cli/chunks/routing-feedback-5XLNJ3Y3.js +0 -2
- package/dist/cli/chunks/rvf-dual-writer-JBW4O3II.js +0 -2
- package/dist/cli/chunks/rvf-migration-adapter-BPPQL4XJ.js +0 -2
- package/dist/cli/chunks/rvf-migration-coordinator-V2GHCJKN.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-S4562CG5.js +0 -2
- package/dist/cli/chunks/safe-db-FIRHSXVF.js +0 -2
- package/dist/cli/chunks/schedule-RVXFB4HK.js +0 -2
- package/dist/cli/chunks/scheduler-IKKAMAOO.js +0 -2
- package/dist/cli/chunks/shared-rvf-adapter-LVIUOO4S.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-SQ3HCUQ7.js +0 -2
- package/dist/cli/chunks/sync-UHOX6RJW.js +0 -2
- package/dist/cli/chunks/task-handler-AVDHMLGI.js +0 -49
- package/dist/cli/chunks/task-handlers-KYK4VTRA.js +0 -9
- package/dist/cli/chunks/token-bootstrap-GUTTLPZX.js +0 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-DEGOHS6F.js +0 -2
- package/dist/cli/chunks/unified-memory-CXHLHB5I.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-I7WAE54M.js +0 -2
- package/dist/cli/chunks/unified-persistence-6CPF65WI.js +0 -2
- package/dist/cli/chunks/visual-security-GNPHME5H.js +0 -2
- package/dist/cli/chunks/witness-chain-RRN6NDCH.js +0 -2
- package/dist/cli/chunks/witness-chain-VT4UHHBR.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-DB3HIECD.js +0 -2
- package/dist/cli/chunks/wrappers-SUS6XEJD.js +0 -2
|
@@ -0,0 +1,152 @@
|
|
|
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 type { Database as DatabaseType } from 'better-sqlite3';
|
|
37
|
+
import type { WitnessEntry } from './witness-chain.js';
|
|
38
|
+
import type { WitnessKeyManager } from './witness-key-manager.js';
|
|
39
|
+
export declare const CHAIN_REANCHOR_ACTION = "CHAIN_REANCHOR";
|
|
40
|
+
export interface VerifyOptions {
|
|
41
|
+
/** Also verify Ed25519 signatures of every row. Requires keyManager on the chain. */
|
|
42
|
+
checkSignatures?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Also walk `witness_chain_archive` and validate it as part of the same
|
|
45
|
+
* hash chain (archived rows are hash-linked to each other and to the live
|
|
46
|
+
* table exactly like un-archived rows). Off by default: the live-only walk
|
|
47
|
+
* is enough to catch tampering with current data and already correctly
|
|
48
|
+
* bridges the archival boundary; this option adds full historical coverage
|
|
49
|
+
* for a deep CI gate at the cost of reading the (potentially large) archive.
|
|
50
|
+
*/
|
|
51
|
+
includeArchive?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* - `valid`: no breaks.
|
|
55
|
+
* - `valid-with-forks`: forks exist and every one is acknowledged by a CHAIN_REANCHOR.
|
|
56
|
+
* - `forked`: unacknowledged forks, no tampering. `valid` is false.
|
|
57
|
+
* - `tampered`: a tamper-class break or a signature failure. `valid` is false.
|
|
58
|
+
*/
|
|
59
|
+
export type ChainStatus = 'valid' | 'valid-with-forks' | 'forked' | 'tampered';
|
|
60
|
+
export type TamperReason = 'action-hash-mismatch' | 'genesis-link-mismatch' | 'unlinked-genesis-prev-hash' | 'unlinked-prev-hash' | 'id-gap' | 'live-chain-missing' | 'fork-signature-invalid' | 'reanchor-signature-invalid' | 'reanchored-row-changed' | 'signature-invalid';
|
|
61
|
+
export interface WitnessForkInfo {
|
|
62
|
+
id: number;
|
|
63
|
+
parentId: number;
|
|
64
|
+
prevHash: string;
|
|
65
|
+
actionHash: string;
|
|
66
|
+
table: 'live' | 'archive';
|
|
67
|
+
acknowledged: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface VerifyResult {
|
|
70
|
+
/** True only for status `valid` or `valid-with-forks`. */
|
|
71
|
+
valid: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* First break that makes the chain invalid, in walk order: the first
|
|
74
|
+
* unacknowledged fork, else the tamper row. Same id pre-#753 verify reported.
|
|
75
|
+
*/
|
|
76
|
+
brokenAt?: number;
|
|
77
|
+
/** Rows walked (all rows unless a tamper stopped the walk). */
|
|
78
|
+
entriesChecked: number;
|
|
79
|
+
signatureFailures?: number;
|
|
80
|
+
status: ChainStatus;
|
|
81
|
+
/** True for any tamper-class break or signature failure. Never true for forks alone. */
|
|
82
|
+
tampered: boolean;
|
|
83
|
+
tamperedAt?: number;
|
|
84
|
+
tamperReason?: TamperReason;
|
|
85
|
+
/** Ids of every fork-class row found (acknowledged or not). */
|
|
86
|
+
forks: number[];
|
|
87
|
+
/** Subset of `forks` acknowledged by a verified CHAIN_REANCHOR entry. */
|
|
88
|
+
acknowledgedForks: number[];
|
|
89
|
+
forkDetails: WitnessForkInfo[];
|
|
90
|
+
}
|
|
91
|
+
/** One fork acknowledgement inside a CHAIN_REANCHOR entry's action_data. */
|
|
92
|
+
export interface ReanchorForkRecord {
|
|
93
|
+
id: number;
|
|
94
|
+
parentId: number;
|
|
95
|
+
prevHash: string;
|
|
96
|
+
actionHash: string;
|
|
97
|
+
}
|
|
98
|
+
/** A row hash frozen by a CHAIN_REANCHOR entry (dead-end rows nothing else links to). */
|
|
99
|
+
export interface ReanchorPin {
|
|
100
|
+
id: number;
|
|
101
|
+
hash: string;
|
|
102
|
+
}
|
|
103
|
+
/** Row hash under the row's own algorithm (how pins are recorded). */
|
|
104
|
+
export declare function ownHash(row: WitnessEntry): string;
|
|
105
|
+
/** Stateful single-use walker; see file header for the classification rules. */
|
|
106
|
+
export declare class WitnessChainVerifier {
|
|
107
|
+
private readonly db;
|
|
108
|
+
private readonly keyManager;
|
|
109
|
+
private readonly options;
|
|
110
|
+
private archiveRows;
|
|
111
|
+
private readonly parentIndex;
|
|
112
|
+
private readonly acks;
|
|
113
|
+
private readonly pins;
|
|
114
|
+
private readonly forks;
|
|
115
|
+
private tamper;
|
|
116
|
+
private signatureFailures;
|
|
117
|
+
private firstSignatureFailure;
|
|
118
|
+
private entriesChecked;
|
|
119
|
+
private archiveExists;
|
|
120
|
+
constructor(db: DatabaseType, keyManager: WitnessKeyManager | null, options?: VerifyOptions);
|
|
121
|
+
run(): VerifyResult;
|
|
122
|
+
private walk;
|
|
123
|
+
private classify;
|
|
124
|
+
private findEntryById;
|
|
125
|
+
private getArchive;
|
|
126
|
+
/** Stores written before archiving existed (or opened read-only) may lack the archive table. */
|
|
127
|
+
private hasArchive;
|
|
128
|
+
/** hash → id over every row (live + archive), built lazily per hash algo on the first fork candidate. */
|
|
129
|
+
private lookupParent;
|
|
130
|
+
/**
|
|
131
|
+
* True when every id strictly between `from` and `to` exists in live ∪
|
|
132
|
+
* archive. AUTOINCREMENT ids are never reused and a rolled-back insert does
|
|
133
|
+
* not consume one, so a missing id means a row was deleted.
|
|
134
|
+
*/
|
|
135
|
+
private idsContiguous;
|
|
136
|
+
/**
|
|
137
|
+
* Signature status of one row against the keys this verifier holds. A row
|
|
138
|
+
* signed by a key it does not hold is `unverifiable` (e.g. a key from before
|
|
139
|
+
* persistent key storage) — classified on structure alone, like unsigned rows.
|
|
140
|
+
*/
|
|
141
|
+
private checkSignature;
|
|
142
|
+
/** Legacy `checkSignatures` option: every signed row must verify (unknown key = failure). */
|
|
143
|
+
private checkAllSignatures;
|
|
144
|
+
private registerReanchor;
|
|
145
|
+
/** Rows frozen by a verified re-anchor must still exist with the same hash. */
|
|
146
|
+
private checkPins;
|
|
147
|
+
private result;
|
|
148
|
+
}
|
|
149
|
+
export declare function verifyWitnessChain(db: DatabaseType, keyManager: WitnessKeyManager | null, options?: VerifyOptions): VerifyResult;
|
|
150
|
+
/** True when `name` is a table in the connected database. */
|
|
151
|
+
export declare function tableExists(db: DatabaseType, name: string): boolean;
|
|
152
|
+
//# sourceMappingURL=witness-chain-verifier.d.ts.map
|
|
@@ -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
|