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.
Files changed (426) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +76 -0
  3. package/assets/skills/skills-manifest.json +1 -1
  4. package/dist/adapters/ag-ui/event-types.d.ts +1 -1
  5. package/dist/audit/witness-chain-hash.d.ts +18 -0
  6. package/dist/audit/witness-chain-hash.js +37 -0
  7. package/dist/audit/witness-chain-repair.d.ts +71 -0
  8. package/dist/audit/witness-chain-repair.js +203 -0
  9. package/dist/audit/witness-chain-verifier.d.ts +152 -0
  10. package/dist/audit/witness-chain-verifier.js +293 -0
  11. package/dist/audit/witness-chain.d.ts +10 -43
  12. package/dist/audit/witness-chain.js +16 -106
  13. package/dist/audit/witness-findings.js +4 -1
  14. package/dist/cli/bundle.js +7 -7
  15. package/dist/cli/chunks/adapter-UYOJPTOX.js +2 -0
  16. package/dist/cli/chunks/agent-booster-wasm-2YGML6OU.js +2 -0
  17. package/dist/cli/chunks/{agent-handler-V6CZ7Q6S.js → agent-handler-D5SSQYNU.js} +2 -2
  18. package/dist/cli/chunks/{agent-memory-branch-ZMD6ULC3.js → agent-memory-branch-YHPLTITV.js} +2 -2
  19. package/dist/cli/chunks/aqe-learning-engine-JR5AVQXR.js +2 -0
  20. package/dist/cli/chunks/{arena-QLSBESC7.js → arena-7BGOXGXO.js} +2 -2
  21. package/dist/cli/chunks/{arena-4UPAEHFT.js → arena-MCE6EU7K.js} +4 -4
  22. package/dist/cli/chunks/audit-BMWTQECB.js +4 -0
  23. package/dist/cli/chunks/base-DRZ2LS6X.js +2 -0
  24. package/dist/cli/chunks/{better-sqlite3-4DSBPDRH.js → better-sqlite3-PMUNGASU.js} +2 -2
  25. package/dist/cli/chunks/{brain-handler-GBY4EZ4P.js → brain-handler-QPUFYX7F.js} +3 -3
  26. package/dist/cli/chunks/{branch-enumerator-XYBVXCNO.js → branch-enumerator-WKFDGRN4.js} +2 -2
  27. package/dist/cli/chunks/{browser-32F6MREU.js → browser-VY5HKH5X.js} +2 -2
  28. package/dist/cli/chunks/browser-workflow-CJ7T3MXF.js +2 -0
  29. package/dist/cli/chunks/{chunk-C3Z4VVHP.js → chunk-257E2A5M.js} +5 -5
  30. package/dist/cli/chunks/{chunk-EFV4ADMO.js → chunk-2JVWITNK.js} +2 -2
  31. package/dist/cli/chunks/{chunk-IGBEJ4UJ.js → chunk-2NPKIBAZ.js} +2 -2
  32. package/dist/cli/chunks/{chunk-KIP6WZGV.js → chunk-2TMWAQQ3.js} +3 -3
  33. package/dist/cli/chunks/{chunk-DLF5BOJD.js → chunk-2YXGBZWV.js} +1 -1
  34. package/dist/cli/chunks/{chunk-KEY43ANX.js → chunk-3EA536JF.js} +2 -2
  35. package/dist/cli/chunks/{chunk-WX6RRIGW.js → chunk-3EZOZN25.js} +2 -2
  36. package/dist/cli/chunks/{chunk-BYG36QC5.js → chunk-3HZS4M3O.js} +2 -2
  37. package/dist/cli/chunks/{chunk-G3L5L6YQ.js → chunk-3NIG7S5W.js} +1 -1
  38. package/dist/cli/chunks/{chunk-CZO4BJG5.js → chunk-4N23RFDU.js} +2 -2
  39. package/dist/cli/chunks/{chunk-QWUXCG2L.js → chunk-5J6W7SIA.js} +1 -1
  40. package/dist/cli/chunks/{chunk-RD2VGOUH.js → chunk-5OOMJGFN.js} +1 -1
  41. package/dist/cli/chunks/{chunk-YDFL445W.js → chunk-5QQSIGUA.js} +2 -2
  42. package/dist/cli/chunks/{chunk-TUSSPKRM.js → chunk-5VFPCSK7.js} +1 -1
  43. package/dist/cli/chunks/{chunk-WLXK2KNU.js → chunk-62N4NUJH.js} +2 -2
  44. package/dist/cli/chunks/{chunk-JSZ663MU.js → chunk-64VGZQLB.js} +1 -1
  45. package/dist/cli/chunks/{chunk-UMGFMKDW.js → chunk-66VWCR67.js} +2 -2
  46. package/dist/cli/chunks/{chunk-6ITZZIQX.js → chunk-6LIHFV7O.js} +2 -2
  47. package/dist/cli/chunks/{chunk-DKUBQQFG.js → chunk-6OS76PHI.js} +2 -2
  48. package/dist/cli/chunks/{chunk-Y5L3ES4L.js → chunk-6RE3X4V5.js} +2 -2
  49. package/dist/cli/chunks/{chunk-CVMNJSCB.js → chunk-6SH5VZUD.js} +2 -2
  50. package/dist/cli/chunks/chunk-6SQM2MUX.js +4 -0
  51. package/dist/cli/chunks/{chunk-6CR4VQBQ.js → chunk-6U7LNMWZ.js} +2 -2
  52. package/dist/cli/chunks/{chunk-HYEJJJY3.js → chunk-72KXSMWI.js} +1 -1
  53. package/dist/cli/chunks/chunk-7CUQCCMD.js +27 -0
  54. package/dist/cli/chunks/chunk-7D3V65N5.js +2 -0
  55. package/dist/cli/chunks/{chunk-K7NJHFLZ.js → chunk-7J6QC567.js} +3 -3
  56. package/dist/cli/chunks/{chunk-6LKDHEBY.js → chunk-7LPR6HJG.js} +2 -2
  57. package/dist/cli/chunks/{chunk-RGGK6VZ7.js → chunk-7NITCZWD.js} +1 -1
  58. package/dist/cli/chunks/{chunk-IYTLXUBO.js → chunk-7Z5LHRC3.js} +2 -2
  59. package/dist/cli/chunks/{chunk-ZCWERUYB.js → chunk-AHKELLIO.js} +3 -3
  60. package/dist/cli/chunks/{chunk-IJHCIXJC.js → chunk-AIRGNL55.js} +2 -2
  61. package/dist/cli/chunks/{chunk-2OMLTYQK.js → chunk-AJRUJAAK.js} +1 -1
  62. package/dist/cli/chunks/{chunk-QYOGD2VW.js → chunk-AVBJYI5I.js} +1 -1
  63. package/dist/cli/chunks/{chunk-PSPKSUF6.js → chunk-B6D2CHEH.js} +1 -1
  64. package/dist/cli/chunks/{chunk-M23ZOZVY.js → chunk-B6MOJC3X.js} +1 -1
  65. package/dist/cli/chunks/{chunk-VD5IO5EO.js → chunk-BAMN2CHI.js} +1 -1
  66. package/dist/cli/chunks/{chunk-KO4FNAUR.js → chunk-BBT64TII.js} +3 -3
  67. package/dist/cli/chunks/{chunk-7JZJJA7U.js → chunk-BJTJLJRZ.js} +3 -3
  68. package/dist/cli/chunks/{chunk-LULD4JV2.js → chunk-BMAPORJ7.js} +2 -2
  69. package/dist/cli/chunks/{chunk-GTKCGPJZ.js → chunk-BPEDWS6O.js} +2 -2
  70. package/dist/cli/chunks/{chunk-3DDXWYMO.js → chunk-BVR7RMC5.js} +1 -1
  71. package/dist/cli/chunks/{chunk-52L77RMG.js → chunk-C6KWXUFJ.js} +2 -2
  72. package/dist/cli/chunks/{chunk-BJPL6THQ.js → chunk-CCK4BF76.js} +1 -1
  73. package/dist/cli/chunks/{chunk-RP2ZKPYV.js → chunk-CD542DNJ.js} +1 -1
  74. package/dist/cli/chunks/{chunk-AFEDJ3RU.js → chunk-CF2ISEOJ.js} +2 -2
  75. package/dist/cli/chunks/chunk-CM7U6TAX.js +5 -0
  76. package/dist/cli/chunks/{chunk-R74ZKREV.js → chunk-D45SG6CP.js} +1 -1
  77. package/dist/cli/chunks/{chunk-YXP6BKGS.js → chunk-D6CJIGRU.js} +89 -83
  78. package/dist/cli/chunks/{chunk-NVYBM3R4.js → chunk-DBDPRORT.js} +2 -2
  79. package/dist/cli/chunks/{chunk-CYE2TJFV.js → chunk-DHVX5UB2.js} +2 -2
  80. package/dist/cli/chunks/{chunk-XUR2M2WB.js → chunk-DK4XN4CU.js} +2 -2
  81. package/dist/cli/chunks/{chunk-W2XCZU62.js → chunk-DPYSUDAO.js} +1 -1
  82. package/dist/cli/chunks/{chunk-WJHWH5D2.js → chunk-DUYOVM5I.js} +2 -2
  83. package/dist/cli/chunks/{chunk-XLAUGSW7.js → chunk-DZ3AUAAB.js} +2 -2
  84. package/dist/cli/chunks/{chunk-37TUN44F.js → chunk-E6G2RD5H.js} +2 -2
  85. package/dist/cli/chunks/{chunk-ELBZON4V.js → chunk-EAY2JMZG.js} +2 -2
  86. package/dist/cli/chunks/{chunk-HSVKZ5KI.js → chunk-ELLBS5RP.js} +2 -2
  87. package/dist/cli/chunks/chunk-ENGZ4D5V.js +2 -0
  88. package/dist/cli/chunks/chunk-FBMN7B46.js +4 -0
  89. package/dist/cli/chunks/{chunk-F34OAHOM.js → chunk-FWASDOT2.js} +2 -2
  90. package/dist/cli/chunks/{chunk-E4AZXCT5.js → chunk-FZOBD67M.js} +1 -1
  91. package/dist/cli/chunks/{chunk-QZMUXJHZ.js → chunk-GDSXITFH.js} +2 -2
  92. package/dist/cli/chunks/{chunk-LSUILON7.js → chunk-GGRHV6D7.js} +1 -1
  93. package/dist/cli/chunks/{chunk-3YUB5HER.js → chunk-GPYVDFB3.js} +101 -101
  94. package/dist/cli/chunks/{chunk-4FWTLJEP.js → chunk-GSF6MB64.js} +2 -2
  95. package/dist/cli/chunks/{chunk-3KDL6QDK.js → chunk-H52HZ67P.js} +2 -2
  96. package/dist/cli/chunks/{chunk-2JGEZHWY.js → chunk-H5BS5VH7.js} +2 -2
  97. package/dist/cli/chunks/{chunk-SQF6HRXR.js → chunk-H6ZM3PUT.js} +1 -1
  98. package/dist/cli/chunks/{chunk-OEIQTWQP.js → chunk-HM6ZSCPI.js} +1 -1
  99. package/dist/cli/chunks/{chunk-URVHZPWY.js → chunk-HNFVJP4I.js} +2 -2
  100. package/dist/cli/chunks/{chunk-RD6TEZ64.js → chunk-I33ERSGB.js} +2 -2
  101. package/dist/cli/chunks/{chunk-IUDWEOLX.js → chunk-IAF6T27S.js} +2 -2
  102. package/dist/cli/chunks/{chunk-XZSMZHM2.js → chunk-IB27QACC.js} +2 -2
  103. package/dist/cli/chunks/{chunk-I6X3EGJI.js → chunk-ICTXTNQZ.js} +1 -1
  104. package/dist/cli/chunks/chunk-IG5GNEC6.js +4 -0
  105. package/dist/cli/chunks/{chunk-6A44AOGN.js → chunk-IQO7UCFR.js} +2 -2
  106. package/dist/cli/chunks/{chunk-R6IU3EWP.js → chunk-IV5UZOHH.js} +2 -2
  107. package/dist/cli/chunks/{chunk-VTOVWHEM.js → chunk-JBTPOIAC.js} +2 -2
  108. package/dist/cli/chunks/{chunk-KLTP5IDB.js → chunk-JIXUMYKZ.js} +1 -1
  109. package/dist/cli/chunks/{chunk-3VIXOHMS.js → chunk-JMONHE4B.js} +1 -1
  110. package/dist/cli/chunks/{chunk-SX4JLSLV.js → chunk-JVNTSNWU.js} +2 -2
  111. package/dist/cli/chunks/{chunk-JVQBWYHW.js → chunk-JXGFRBUO.js} +2 -2
  112. package/dist/cli/chunks/{chunk-HVXJC3OC.js → chunk-JZOS5FCX.js} +2 -2
  113. package/dist/cli/chunks/{chunk-XEZIIQYJ.js → chunk-KNNISEDY.js} +1 -1
  114. package/dist/cli/chunks/{chunk-73EI4C2E.js → chunk-L4RUBPLR.js} +2 -2
  115. package/dist/cli/chunks/{chunk-AF4XKLXO.js → chunk-LL3IGZBI.js} +2 -2
  116. package/dist/cli/chunks/{chunk-UJWAWIRV.js → chunk-MBRHSU6W.js} +10 -10
  117. package/dist/cli/chunks/{chunk-J5UNP6W3.js → chunk-MJS53PRX.js} +2 -2
  118. package/dist/cli/chunks/{chunk-EOR2UT72.js → chunk-MQROI74N.js} +2 -2
  119. package/dist/cli/chunks/{chunk-BXVAVFGU.js → chunk-MUOG6QXR.js} +2 -2
  120. package/dist/cli/chunks/{chunk-O3JTQ7N4.js → chunk-MW2GGZZ5.js} +1 -1
  121. package/dist/cli/chunks/{chunk-IIAR5S7Q.js → chunk-NHWGMJAP.js} +2 -2
  122. package/dist/cli/chunks/{chunk-WOIGKU2N.js → chunk-NMAIY4PX.js} +3 -3
  123. package/dist/cli/chunks/{chunk-QIRL6B3C.js → chunk-NQZ5AR3D.js} +2 -2
  124. package/dist/cli/chunks/{chunk-6TU7FEMD.js → chunk-P6OYS755.js} +1 -1
  125. package/dist/cli/chunks/{chunk-HVU64GP5.js → chunk-PI7TJS62.js} +2 -2
  126. package/dist/cli/chunks/{chunk-N7H767TP.js → chunk-PX5YDCRH.js} +2 -2
  127. package/dist/cli/chunks/{chunk-3EZ5DR2R.js → chunk-PZPWRQ2M.js} +2 -2
  128. package/dist/cli/chunks/{chunk-RKOUXVZZ.js → chunk-Q5XTSMWR.js} +2 -2
  129. package/dist/cli/chunks/{chunk-K27SU3RE.js → chunk-Q7EAGKAE.js} +2 -2
  130. package/dist/cli/chunks/{chunk-M5AEL7IS.js → chunk-QDFTT3RF.js} +2 -2
  131. package/dist/cli/chunks/{chunk-TY5WC3FT.js → chunk-QGA55PFM.js} +3 -3
  132. package/dist/cli/chunks/{chunk-NQI7FWCS.js → chunk-QW6VMTBR.js} +2 -2
  133. package/dist/cli/chunks/{chunk-BHFR2EXL.js → chunk-QZANMBIT.js} +1 -1
  134. package/dist/cli/chunks/{chunk-5D36YHS3.js → chunk-RETBYIAC.js} +4 -4
  135. package/dist/cli/chunks/{chunk-UKGXWW64.js → chunk-RFNPJK6N.js} +3 -3
  136. package/dist/cli/chunks/{chunk-G3W6BMVJ.js → chunk-RG52OKAM.js} +1 -1
  137. package/dist/cli/chunks/{chunk-DO6EI5KB.js → chunk-RSXXCL4A.js} +1 -1
  138. package/dist/cli/chunks/{chunk-E3W6XQ57.js → chunk-RTFO5UQH.js} +2 -2
  139. package/dist/cli/chunks/{chunk-DDCIYOGT.js → chunk-RZZCUIAI.js} +2 -2
  140. package/dist/cli/chunks/{chunk-C3HQL6S4.js → chunk-SDRHUMJB.js} +2 -2
  141. package/dist/cli/chunks/{chunk-KYA5LARK.js → chunk-SE4WIB26.js} +1 -1
  142. package/dist/cli/chunks/{chunk-NU7UTXMP.js → chunk-SESK3ARK.js} +2 -2
  143. package/dist/cli/chunks/{chunk-YQGPQBCX.js → chunk-SJUXE4IC.js} +2 -2
  144. package/dist/cli/chunks/{chunk-HBCGYMQU.js → chunk-SMDN3BQZ.js} +1 -1
  145. package/dist/cli/chunks/{chunk-D6OUCB2H.js → chunk-SNOBH4AZ.js} +2 -2
  146. package/dist/cli/chunks/{chunk-QRCIZFNK.js → chunk-SPV2VKC5.js} +2 -2
  147. package/dist/cli/chunks/chunk-TCHGOB2N.js +2 -0
  148. package/dist/cli/chunks/{chunk-2KJQ2UQE.js → chunk-TVYY3OCX.js} +1 -1
  149. package/dist/cli/chunks/{chunk-RIZVC4XY.js → chunk-UCFQALXO.js} +2 -2
  150. package/dist/cli/chunks/{chunk-XFPPERA2.js → chunk-UKA2KOXE.js} +2 -2
  151. package/dist/cli/chunks/{chunk-UTBYJ4RF.js → chunk-UNFFDHER.js} +16 -11
  152. package/dist/cli/chunks/{chunk-6VAZAHQG.js → chunk-UQ32JHES.js} +2 -2
  153. package/dist/cli/chunks/{chunk-CPC7FN52.js → chunk-V4DM6ELU.js} +2 -2
  154. package/dist/cli/chunks/{chunk-67YV75XP.js → chunk-VGFFFKGK.js} +2 -2
  155. package/dist/cli/chunks/{chunk-WK7B4B6Y.js → chunk-VMNWDJIZ.js} +2 -2
  156. package/dist/cli/chunks/chunk-W6HXLH5G.js +180 -0
  157. package/dist/cli/chunks/{chunk-7VFY7TUR.js → chunk-WCJBU2KI.js} +2 -2
  158. package/dist/cli/chunks/{chunk-JROVR6YS.js → chunk-WGM35YWL.js} +2 -2
  159. package/dist/cli/chunks/{chunk-IUHB5GVS.js → chunk-WO4QMXIG.js} +2 -2
  160. package/dist/cli/chunks/{chunk-JES6R5KP.js → chunk-XAS3XRYM.js} +1 -1
  161. package/dist/cli/chunks/chunk-Y3LZ35OG.js +2 -0
  162. package/dist/cli/chunks/{chunk-75QJ5HWE.js → chunk-Y3UOUNHM.js} +2 -2
  163. package/dist/cli/chunks/{chunk-WJTSY5MC.js → chunk-YFBSPLJG.js} +1 -1
  164. package/dist/cli/chunks/{chunk-DPBRWP4J.js → chunk-YHKEDEAA.js} +3 -3
  165. package/dist/cli/chunks/{chunk-NRE4NAVA.js → chunk-YS4FCTWF.js} +1 -1
  166. package/dist/cli/chunks/{chunk-I2NENQ44.js → chunk-YSLL6VSL.js} +2 -2
  167. package/dist/cli/chunks/chunk-Z6GGIRQQ.js +65 -0
  168. package/dist/cli/chunks/{chunk-E4EYPYR3.js → chunk-Z7WODOTH.js} +2 -2
  169. package/dist/cli/chunks/{chunk-7DETTOPZ.js → chunk-ZCRTRYXK.js} +2 -2
  170. package/dist/cli/chunks/{chunk-FUNGTIF2.js → chunk-ZEV3YTO7.js} +2 -2
  171. package/dist/cli/chunks/{chunk-SQKW3B6B.js → chunk-ZL6SYKUK.js} +1 -1
  172. package/dist/cli/chunks/{chunk-AMMQOV35.js → chunk-ZSPU4MOS.js} +2 -2
  173. package/dist/cli/chunks/{chunk-KKHYJF5U.js → chunk-ZVWVV4EX.js} +1 -1
  174. package/dist/cli/chunks/{ci-RACDAJMR.js → ci-W6K6G2KZ.js} +2 -2
  175. package/dist/cli/chunks/{ci-output-EHRSZBKG.js → ci-output-LDT24TS3.js} +2 -2
  176. package/dist/cli/chunks/{circuit-breaker-GBV7M5XG.js → circuit-breaker-F5V4KITU.js} +2 -2
  177. package/dist/cli/chunks/claude-flow-setup-DT6WQQVD.js +2 -0
  178. package/dist/cli/chunks/client-KHWJT6FB.js +2 -0
  179. package/dist/cli/chunks/{cline-installer-W4NMXJSG.js → cline-installer-G7TJOAEX.js} +2 -2
  180. package/dist/cli/chunks/{code-JWXJMYXB.js → code-PGE6A42V.js} +3 -3
  181. package/dist/cli/chunks/{code-index-extractor-RVI2IFTM.js → code-index-extractor-RNITH372.js} +2 -2
  182. package/dist/cli/chunks/{codex-installer-3BORJINH.js → codex-installer-LBX77AI3.js} +6 -6
  183. package/dist/cli/chunks/{completions-A55NCTAO.js → completions-4AWLAARX.js} +2 -2
  184. package/dist/cli/chunks/{complexity-analyzer-JCXHGGLY.js → complexity-analyzer-ZPNSS476.js} +2 -2
  185. package/dist/cli/chunks/{continuedev-installer-PUVFMGYW.js → continuedev-installer-UAPWX6OA.js} +2 -2
  186. package/dist/cli/chunks/{copilot-installer-4DCMYWHB.js → copilot-installer-BJN2YJGI.js} +2 -2
  187. package/dist/cli/chunks/core-handlers-HING5RRG.js +2 -0
  188. package/dist/cli/chunks/{cost-tracker-5TV2GGKY.js → cost-tracker-MHP2VJ63.js} +2 -2
  189. package/dist/cli/chunks/{coverage-NNWM7TX3.js → coverage-PQB4IEFG.js} +3 -3
  190. package/dist/cli/chunks/cross-domain-router-PQTD6AZN.js +2 -0
  191. package/dist/cli/chunks/{cursor-installer-4NCHGJGK.js → cursor-installer-ZXBWYAS3.js} +2 -2
  192. package/dist/cli/chunks/{daemon-T4JO4IXP.js → daemon-64C7R6OJ.js} +3 -3
  193. package/dist/cli/chunks/{daemon-QIKCXKWO.js → daemon-N2BEGEFY.js} +4 -4
  194. package/dist/cli/chunks/{dag-attention-scheduler-RPAAIDAD.js → dag-attention-scheduler-SPZDAPNL.js} +2 -2
  195. package/dist/cli/chunks/{detect-SBEEVDSN.js → detect-LXJBSSZW.js} +2 -2
  196. package/dist/cli/chunks/{dist-node-ZHI6NCSU.js → dist-node-U3TKZ2IZ.js} +2 -2
  197. package/dist/cli/chunks/{domain-handler-LBC3GJ7Z.js → domain-handler-3DDWUVSR.js} +2 -2
  198. package/dist/cli/chunks/{domain-plugins-H6IZ5USZ.js → domain-plugins-JJVWI4OQ.js} +2 -2
  199. package/dist/cli/chunks/domain-transfer-M36KUJ2U.js +2 -0
  200. package/dist/cli/chunks/dream-WUGRSNCV.js +2 -0
  201. package/dist/cli/chunks/{embed-and-insert-pattern-AHTR7CRU.js → embed-and-insert-pattern-JPAR7TXX.js} +2 -2
  202. package/dist/cli/chunks/{eval-DZU2KISM.js → eval-SOLG23EA.js} +2 -2
  203. package/dist/cli/chunks/{experience-capture-middleware-5IQCWKSL.js → experience-capture-middleware-T7G2VOOD.js} +3 -3
  204. package/dist/cli/chunks/{fast-paths-2KLDUWCY.js → fast-paths-32N3ELI4.js} +2 -2
  205. package/dist/cli/chunks/{feature-flags-N6UAEZY4.js → feature-flags-APJDQ4N7.js} +2 -2
  206. package/dist/cli/chunks/{feature-flags-7AC3XDZA.js → feature-flags-NAHKLDRN.js} +2 -2
  207. package/dist/cli/chunks/{file-discovery-5SDIW4V2.js → file-discovery-YKVM3MDB.js} +2 -2
  208. package/dist/cli/chunks/{fleet-ZIQCAZ2Y.js → fleet-55M5CJS4.js} +3 -3
  209. package/dist/cli/chunks/{gnn-wrapper-DUMBZJEV.js → gnn-wrapper-UD6E6S6Z.js} +2 -2
  210. package/dist/cli/chunks/{heartbeat-handler-6HVM6ZMR.js → heartbeat-handler-OYVW3VSC.js} +4 -4
  211. package/dist/cli/chunks/heartbeat-scheduler-33XX5XNQ.js +2 -0
  212. package/dist/cli/chunks/hnsw-adapter-XQPERX3H.js +2 -0
  213. package/dist/cli/chunks/hnsw-index-2GNXTWHH.js +2 -0
  214. package/dist/cli/chunks/{hnsw-legacy-bridge-5DRL5FLX.js → hnsw-legacy-bridge-HBYIS3ZW.js} +2 -2
  215. package/dist/cli/chunks/{hnswlib-node-GW67GTCL.js → hnswlib-node-EQPM42OU.js} +2 -2
  216. package/dist/cli/chunks/{hooks-QHH6FVO4.js → hooks-5ZSSJWO6.js} +10 -10
  217. package/dist/cli/chunks/hybrid-backend-CCF7URKI.js +2 -0
  218. package/dist/cli/chunks/{hypergraph-engine-7XDCCVG2.js → hypergraph-engine-XBGVQ4PD.js} +2 -2
  219. package/dist/cli/chunks/{hypergraph-handler-QHF7NOU5.js → hypergraph-handler-CAWAQ673.js} +3 -3
  220. package/dist/cli/chunks/impact-analyzer-HGKAZWIG.js +2 -0
  221. package/dist/cli/chunks/{init-handler-5UIVOM7K.js → init-handler-PRHXSARK.js} +6 -6
  222. package/dist/cli/chunks/init-wizard-72MFBI3G.js +2 -0
  223. package/dist/cli/chunks/kernel-BRCBVMSK.js +2 -0
  224. package/dist/cli/chunks/{kilocode-installer-TGGV6K5Q.js → kilocode-installer-F7LXBM7I.js} +2 -2
  225. package/dist/cli/chunks/{kiro-installer-4XYBHZWW.js → kiro-installer-NM723ZRG.js} +2 -2
  226. package/dist/cli/chunks/knowledge-graph-DG44IPEI.js +2 -0
  227. package/dist/cli/chunks/{learning-STE5W6BS.js → learning-5QYIDHH3.js} +3 -3
  228. package/dist/cli/chunks/{llm-router-NKF7J3RI.js → llm-router-43HKWPSX.js} +4 -4
  229. package/dist/cli/chunks/llm-router-service-24KXFX32.js +2 -0
  230. package/dist/cli/chunks/{load-B2T77UJQ.js → load-5YDBWSCS.js} +2 -2
  231. package/dist/cli/chunks/load-test-N4TAYJY3.js +2 -0
  232. package/dist/cli/chunks/mcp-UMAPMNMY.js +2 -0
  233. package/dist/cli/chunks/{memory-WRFZKG56.js → memory-FWCPCQFP.js} +5 -5
  234. package/dist/cli/chunks/memory-backend-NVYFYVAU.js +2 -0
  235. package/dist/cli/chunks/memory-handlers-UTWCNCHL.js +2 -0
  236. package/dist/cli/chunks/multi-model-executor-2XTBGLE4.js +14 -0
  237. package/dist/cli/chunks/{opencode-installer-J36EMQU7.js → opencode-installer-GIXOJ6NS.js} +2 -2
  238. package/dist/cli/chunks/orchestrator-VW6BKHLI.js +393 -0
  239. package/dist/cli/chunks/pattern-null-store-SBPNYDBR.js +2 -0
  240. package/dist/cli/chunks/{pattern-usage-recorder-BVMTWI3E.js → pattern-usage-recorder-7CEUC3J7.js} +2 -2
  241. package/dist/cli/chunks/{pipeline-OWAHDUAQ.js → pipeline-IGUQPPPO.js} +2 -2
  242. package/dist/cli/chunks/{platform-ANGBFWBV.js → platform-2P636I7B.js} +2 -2
  243. package/dist/cli/chunks/{plugin-OO7ON2YW.js → plugin-NY6SWDPE.js} +2 -2
  244. package/dist/cli/chunks/{prime-radiant-advanced-wasm-HFG3BXWU.js → prime-radiant-advanced-wasm-2UUDTIO2.js} +2 -2
  245. package/dist/cli/chunks/{project-root-LNOYVTYY.js → project-root-IOISG5KX.js} +2 -2
  246. package/dist/cli/chunks/protocol-executor-IBYEII5Q.js +2 -0
  247. package/dist/cli/chunks/{protocol-handler-CE3Q6LY4.js → protocol-handler-ZTPCRQ5W.js} +2 -2
  248. package/dist/cli/chunks/{prove-7XPN53PY.js → prove-SQX5A3IG.js} +2 -2
  249. package/dist/cli/chunks/qe-reasoning-bank-7IETWW6W.js +2 -0
  250. package/dist/cli/chunks/{quality-TT23JRFX.js → quality-DROILKRY.js} +2 -2
  251. package/dist/cli/chunks/{quality-gate-PPPRP255.js → quality-gate-PWKWDJY2.js} +3 -3
  252. package/dist/cli/chunks/queen-coordinator-NHUK2MWJ.js +2 -0
  253. package/dist/cli/chunks/{real-embeddings-EYNZIFJE.js → real-embeddings-P5U3MGYC.js} +2 -2
  254. package/dist/cli/chunks/{ref-validation-QQR64ZXD.js → ref-validation-KY73NQXD.js} +2 -2
  255. package/dist/cli/chunks/{roocode-installer-UIGS7ZJD.js → roocode-installer-6JPPRB3W.js} +2 -2
  256. package/dist/cli/chunks/router-SRSO3IHF.js +2 -0
  257. package/dist/cli/chunks/routing-feedback-PASRE5HY.js +2 -0
  258. package/dist/cli/chunks/{routing-handler-6AENUIRG.js → routing-handler-VTJIVFUO.js} +2 -2
  259. package/dist/cli/chunks/{ruvector-commands-5AWMEV34.js → ruvector-commands-C6RPSJJO.js} +2 -2
  260. package/dist/cli/chunks/rvf-dual-writer-4M4J67OU.js +2 -0
  261. package/dist/cli/chunks/rvf-migration-adapter-TSXGT5LF.js +2 -0
  262. package/dist/cli/chunks/{rvf-migration-coordinator-NWRJ7C22.js → rvf-migration-coordinator-R53URRIO.js} +2 -2
  263. package/dist/cli/chunks/rvf-native-adapter-MOF3E7BR.js +2 -0
  264. package/dist/cli/chunks/{rvf-store-integrity-ISKRP563.js → rvf-store-integrity-MMXN5TEJ.js} +2 -2
  265. package/dist/cli/chunks/safe-db-QJLFO33B.js +2 -0
  266. package/dist/cli/chunks/schedule-YIVXW5O2.js +2 -0
  267. package/dist/cli/chunks/scheduler-AON7DWSJ.js +2 -0
  268. package/dist/cli/chunks/{security-325A7FMB.js → security-3B3R2NL4.js} +3 -3
  269. package/dist/cli/chunks/shared-rvf-adapter-VIJB7JUS.js +2 -0
  270. package/dist/cli/chunks/{shared-rvf-dual-writer-THFDYS2Z.js → shared-rvf-dual-writer-UVWGDUWC.js} +2 -2
  271. package/dist/cli/chunks/sqlite-persistence-75VHKKQB.js +2 -0
  272. package/dist/cli/chunks/{standalone-memory-UD4MJ6GZ.js → standalone-memory-M4LWAAYZ.js} +2 -2
  273. package/dist/cli/chunks/{status-handler-CPFTN4XL.js → status-handler-YYFV6OZL.js} +2 -2
  274. package/dist/cli/chunks/{structural-health-2MG2IVBL.js → structural-health-27E6LLKB.js} +2 -2
  275. package/dist/cli/chunks/sync-26CEGSTC.js +2 -0
  276. package/dist/cli/chunks/{sync-EE4VVKOW.js → sync-J3LJ56WN.js} +2 -2
  277. package/dist/cli/chunks/{task-handler-7H5OYJG4.js → task-handler-4MCEBQZL.js} +2 -2
  278. package/dist/cli/chunks/{task-handlers-NH4GJHCJ.js → task-handlers-GYBAWKE2.js} +3 -3
  279. package/dist/cli/chunks/{test-MPHGT4T6.js → test-MPC5HRH5.js} +4 -4
  280. package/dist/cli/chunks/{test-scheduling-CHQ4ZLLJ.js → test-scheduling-ZJBFRZ3J.js} +3 -3
  281. package/dist/cli/chunks/token-bootstrap-2Y2XITBX.js +2 -0
  282. package/dist/cli/chunks/{token-usage-EBXUJNRB.js → token-usage-3X5WMTG2.js} +2 -2
  283. package/dist/cli/chunks/{transformers-ZEKS2OJZ.js → transformers-MVL4C5IX.js} +2 -2
  284. package/dist/cli/chunks/tree-sitter-wasm-parser-SLW65ZFO.js +2 -0
  285. package/dist/cli/chunks/{types-KYAA5VLV.js → types-TG5P3CRS.js} +2 -2
  286. package/dist/cli/chunks/unified-memory-UCQ6AB32.js +2 -0
  287. package/dist/cli/chunks/unified-memory-hnsw-IXYUMKRR.js +2 -0
  288. package/dist/cli/chunks/unified-persistence-7E6JQ4FZ.js +2 -0
  289. package/dist/cli/chunks/{upgrade-UJBJ5AYM.js → upgrade-ETBHDEPY.js} +2 -2
  290. package/dist/cli/chunks/{validate-RUV6YMWS.js → validate-C2A73LZK.js} +2 -2
  291. package/dist/cli/chunks/{validate-swarm-IVEVMGVM.js → validate-swarm-67XN42ML.js} +2 -2
  292. package/dist/cli/chunks/{vibium-HOGMFJ2Z.js → vibium-NILGKHLN.js} +2 -2
  293. package/dist/cli/chunks/visual-security-4VZXPEVG.js +2 -0
  294. package/dist/cli/chunks/{web-tree-sitter-AVWA6HKE.js → web-tree-sitter-USJN77P4.js} +2 -2
  295. package/dist/cli/chunks/{windsurf-installer-DAH7HI2W.js → windsurf-installer-5GGZXGJW.js} +2 -2
  296. package/dist/cli/chunks/witness-chain-IWS5ZHHL.js +2 -0
  297. package/dist/cli/chunks/witness-chain-JQA2VPZI.js +2 -0
  298. package/dist/cli/chunks/witness-chain-repair-4UA7IPS3.js +2 -0
  299. package/dist/cli/chunks/witness-chain-verifier-3GEADWPE.js +2 -0
  300. package/dist/cli/chunks/{witness-key-manager-JSTBMG43.js → witness-key-manager-ZWEIK3VJ.js} +2 -2
  301. package/dist/cli/chunks/{workflow-TWOIA6LZ.js → workflow-KHMVVBBA.js} +4 -4
  302. package/dist/cli/chunks/workflow-orchestrator-GI5NQH7C.js +2 -0
  303. package/dist/cli/chunks/wrappers-N6XIK5PT.js +2 -0
  304. package/dist/cli/commands/audit.d.ts +20 -2
  305. package/dist/cli/commands/audit.js +158 -16
  306. package/dist/cli/commands/claude-flow-setup.js +5 -4
  307. package/dist/cli/index.js +2 -1
  308. package/dist/init/agents-installer.d.ts +4 -0
  309. package/dist/init/agents-installer.js +24 -11
  310. package/dist/init/codex-installer.js +4 -2
  311. package/dist/init/idempotent-write.d.ts +53 -0
  312. package/dist/init/idempotent-write.js +160 -0
  313. package/dist/init/phases/05-learning.js +3 -1
  314. package/dist/init/phases/07-hooks.js +32 -16
  315. package/dist/init/phases/08-mcp.js +4 -2
  316. package/dist/init/phases/10-workers.js +7 -5
  317. package/dist/init/phases/12-verification.js +7 -2
  318. package/dist/init/project-analyzer.d.ts +9 -0
  319. package/dist/init/project-analyzer.js +20 -1
  320. package/dist/init/self-configurator.d.ts +5 -3
  321. package/dist/init/self-configurator.js +18 -29
  322. package/dist/init/skills-installer.js +4 -2
  323. package/dist/init/types.d.ts +6 -0
  324. package/dist/init/types.js +20 -24
  325. package/dist/integrations/coherence/coherence-service.js +84 -24
  326. package/dist/integrations/coherence/vote-tally.d.ts +38 -0
  327. package/dist/integrations/coherence/vote-tally.js +39 -0
  328. package/dist/integrations/ruvector/shared-rvf-adapter.d.ts +23 -0
  329. package/dist/integrations/ruvector/shared-rvf-adapter.js +24 -0
  330. package/dist/kernel/kernel.js +3 -2
  331. package/dist/learning/pattern-store.d.ts +11 -0
  332. package/dist/learning/pattern-store.js +26 -8
  333. package/dist/learning/qe-patterns.d.ts +6 -0
  334. package/dist/learning/qe-patterns.js +7 -1
  335. package/dist/learning/qe-reasoning-bank.js +3 -0
  336. package/dist/learning/rvf-pattern-store.js +20 -7
  337. package/dist/learning/sqlite-persistence.d.ts +8 -1
  338. package/dist/learning/sqlite-persistence.js +49 -9
  339. package/dist/logging/console-logger.d.ts +2 -5
  340. package/dist/logging/console-logger.js +10 -46
  341. package/dist/logging/index.d.ts +2 -0
  342. package/dist/logging/index.js +1 -0
  343. package/dist/logging/redaction.d.ts +27 -0
  344. package/dist/logging/redaction.js +170 -0
  345. package/dist/mcp/bundle.js +435 -421
  346. package/dist/mcp/handlers/core-handlers.js +5 -4
  347. package/dist/mcp/protocol-server.js +2 -1
  348. package/dist/mcp/tools/base.d.ts +9 -2
  349. package/dist/mcp/tools/base.js +7 -0
  350. package/dist/mcp/tools/coherence/consensus.js +51 -2
  351. package/dist/mcp/tools/planning/goap-plan.d.ts +20 -7
  352. package/dist/mcp/tools/planning/goap-plan.js +92 -20
  353. package/dist/mcp/tools/planning/goap-status.d.ts +37 -12
  354. package/dist/mcp/tools/planning/goap-status.js +52 -23
  355. package/dist/mcp/tools/planning/world-state.d.ts +101 -0
  356. package/dist/mcp/tools/planning/world-state.js +274 -0
  357. package/dist/mcp/types.d.ts +4 -2
  358. package/dist/planning/goap-planner.d.ts +60 -4
  359. package/dist/planning/goap-planner.js +218 -60
  360. package/dist/planning/index.d.ts +1 -1
  361. package/dist/planning/index.js +1 -1
  362. package/dist/planning/plan-executor.d.ts +20 -1
  363. package/dist/planning/plan-executor.js +209 -100
  364. package/dist/planning/types.d.ts +16 -0
  365. package/dist/planning/types.js +17 -0
  366. package/package.json +1 -1
  367. package/dist/cli/chunks/adapter-IYC62SXA.js +0 -2
  368. package/dist/cli/chunks/agent-booster-wasm-EDNKP3SP.js +0 -2
  369. package/dist/cli/chunks/aqe-learning-engine-LLOU2IXD.js +0 -2
  370. package/dist/cli/chunks/audit-CVZQMF55.js +0 -3
  371. package/dist/cli/chunks/base-P3Z4IKCT.js +0 -2
  372. package/dist/cli/chunks/browser-workflow-YYHQQ25X.js +0 -2
  373. package/dist/cli/chunks/chunk-5WOSWNDN.js +0 -2
  374. package/dist/cli/chunks/chunk-7CD7PBHY.js +0 -3
  375. package/dist/cli/chunks/chunk-7X7JYWT4.js +0 -27
  376. package/dist/cli/chunks/chunk-J27F4NSB.js +0 -2
  377. package/dist/cli/chunks/chunk-MI5Q55DG.js +0 -65
  378. package/dist/cli/chunks/chunk-UDHVCKGA.js +0 -5
  379. package/dist/cli/chunks/chunk-XQSIRBKT.js +0 -180
  380. package/dist/cli/chunks/chunk-ZBABIZ2D.js +0 -2
  381. package/dist/cli/chunks/claude-flow-setup-5LVJOFKP.js +0 -2
  382. package/dist/cli/chunks/client-HUVFA5PF.js +0 -2
  383. package/dist/cli/chunks/core-handlers-UEXO3VAA.js +0 -2
  384. package/dist/cli/chunks/cross-domain-router-ODU5IZD6.js +0 -2
  385. package/dist/cli/chunks/domain-transfer-JZA5TMW3.js +0 -2
  386. package/dist/cli/chunks/dream-HE3OX42F.js +0 -2
  387. package/dist/cli/chunks/heartbeat-scheduler-QUIFGGLX.js +0 -2
  388. package/dist/cli/chunks/hnsw-adapter-42KB37KP.js +0 -2
  389. package/dist/cli/chunks/hnsw-index-T2PGO77J.js +0 -2
  390. package/dist/cli/chunks/hybrid-backend-FRNWYRKH.js +0 -2
  391. package/dist/cli/chunks/impact-analyzer-A5QYOYBR.js +0 -2
  392. package/dist/cli/chunks/init-wizard-XBU674YH.js +0 -2
  393. package/dist/cli/chunks/kernel-DV5MTNZD.js +0 -2
  394. package/dist/cli/chunks/knowledge-graph-4ACGVJQK.js +0 -2
  395. package/dist/cli/chunks/llm-router-service-PSMASERT.js +0 -2
  396. package/dist/cli/chunks/load-test-MRUO2VPF.js +0 -2
  397. package/dist/cli/chunks/mcp-JGSFCEMH.js +0 -2
  398. package/dist/cli/chunks/memory-backend-2MPGI6JW.js +0 -2
  399. package/dist/cli/chunks/memory-handlers-XT4HMITB.js +0 -2
  400. package/dist/cli/chunks/multi-model-executor-26Q5BSVG.js +0 -14
  401. package/dist/cli/chunks/orchestrator-D5IFV65I.js +0 -393
  402. package/dist/cli/chunks/pattern-null-store-TGWUL237.js +0 -2
  403. package/dist/cli/chunks/protocol-executor-GEVH5KD6.js +0 -2
  404. package/dist/cli/chunks/qe-reasoning-bank-DJ2JL6QB.js +0 -2
  405. package/dist/cli/chunks/queen-coordinator-F7E3AS26.js +0 -2
  406. package/dist/cli/chunks/router-OZH3QSAU.js +0 -2
  407. package/dist/cli/chunks/routing-feedback-J2E3ADZB.js +0 -2
  408. package/dist/cli/chunks/rvf-dual-writer-HK525Y5Y.js +0 -2
  409. package/dist/cli/chunks/rvf-migration-adapter-Q7FB3BKR.js +0 -2
  410. package/dist/cli/chunks/rvf-native-adapter-5ZRCGUI6.js +0 -2
  411. package/dist/cli/chunks/safe-db-3OYEPVEH.js +0 -2
  412. package/dist/cli/chunks/schedule-AG4C2EIQ.js +0 -2
  413. package/dist/cli/chunks/scheduler-SQS2CZFZ.js +0 -2
  414. package/dist/cli/chunks/shared-rvf-adapter-NFL6QSZ6.js +0 -2
  415. package/dist/cli/chunks/sqlite-persistence-MAKDFSHC.js +0 -2
  416. package/dist/cli/chunks/sync-MBTW5XBF.js +0 -2
  417. package/dist/cli/chunks/token-bootstrap-SSDCYEKK.js +0 -2
  418. package/dist/cli/chunks/tree-sitter-wasm-parser-J6ZMAK37.js +0 -2
  419. package/dist/cli/chunks/unified-memory-DDWMC435.js +0 -2
  420. package/dist/cli/chunks/unified-memory-hnsw-4JA7SGBK.js +0 -2
  421. package/dist/cli/chunks/unified-persistence-F6OSNTXY.js +0 -2
  422. package/dist/cli/chunks/visual-security-25SMBIYT.js +0 -2
  423. package/dist/cli/chunks/witness-chain-PJOQPFUX.js +0 -2
  424. package/dist/cli/chunks/witness-chain-ZW6KKUZU.js +0 -2
  425. package/dist/cli/chunks/workflow-orchestrator-UKSIDM7Q.js +0 -2
  426. package/dist/cli/chunks/wrappers-UR7BLXKV.js +0 -2
@@ -24,6 +24,7 @@ const DEFAULT_CONFIG = {
24
24
  maxRetries: 2,
25
25
  stepTimeoutMs: 60000,
26
26
  replanOnFailure: true,
27
+ maxReplans: 3,
27
28
  parallelExecution: false,
28
29
  recordWorldState: true,
29
30
  useUnified: true, // ADR-046: Default to unified storage
@@ -44,6 +45,24 @@ function safeStringify(value, maxLength = 2000) {
44
45
  return String(value);
45
46
  }
46
47
  }
48
+ /**
49
+ * Issue #535: render the `error` of a domain Result err as text — an Error's
50
+ * message, a string as-is, else a (truncated) JSON rendering.
51
+ */
52
+ function describeDomainError(reason) {
53
+ if (reason === undefined || reason === null)
54
+ return 'unknown error';
55
+ if (reason instanceof Error || typeof reason === 'string')
56
+ return toErrorMessage(reason);
57
+ const message = reason.message;
58
+ return typeof message === 'string' ? message : safeStringify(reason, 500);
59
+ }
60
+ /**
61
+ * Issue #535: goap_execution_steps marker row recording that an execution
62
+ * was cancelled (see persistExecutionResult). Excluded from step lists.
63
+ */
64
+ const CANCELLED_MARKER_ACTION_ID = '__execution_cancelled__';
65
+ const CANCELLED_MARKER_STATUS = 'cancelled';
47
66
  // ============================================================================
48
67
  // Plan Executor Class
49
68
  // ============================================================================
@@ -200,9 +219,30 @@ export class PlanExecutor {
200
219
  */
201
220
  async executeWithCallbacks(plan, onStepStart, onStepComplete, initialState) {
202
221
  await this.initialize();
203
- const startTime = Date.now();
204
222
  const executionId = `exec-${Date.now()}-${randomUUID().slice(0, 8)}`;
205
223
  this.currentExecution = { planId: plan.id, cancelled: false };
224
+ try {
225
+ const result = await this.runPlan(plan, onStepStart, onStepComplete, initialState, {
226
+ excludedActions: new Set(),
227
+ replanDepth: 0,
228
+ });
229
+ // Persist once per top-level execution. Issue #535: replanned
230
+ // sub-plans used to persist their own steps AND hand them back to the
231
+ // parent, which persisted them again under the same step ids
232
+ // ("UNIQUE constraint failed: goap_execution_steps.id").
233
+ await this.persistExecutionResult(executionId, result);
234
+ return result;
235
+ }
236
+ finally {
237
+ this.currentExecution = null;
238
+ }
239
+ }
240
+ /**
241
+ * Run a plan's steps (and any replacement plans after a failure) without
242
+ * persisting or resetting execution tracking — see executeWithCallbacks.
243
+ */
244
+ async runPlan(plan, onStepStart, onStepComplete, initialState, replan) {
245
+ const startTime = Date.now();
206
246
  const result = {
207
247
  planId: plan.id,
208
248
  status: 'completed',
@@ -222,106 +262,115 @@ export class PlanExecutor {
222
262
  stepOrder: index,
223
263
  status: 'pending',
224
264
  }));
225
- try {
226
- for (const step of steps) {
227
- // Check for cancellation
228
- if (this.currentExecution?.cancelled) {
229
- result.status = 'cancelled';
230
- result.error = 'Execution was cancelled';
265
+ for (const step of steps) {
266
+ // Check for cancellation
267
+ if (this.currentExecution?.cancelled) {
268
+ result.status = 'cancelled';
269
+ result.error = 'Execution was cancelled';
270
+ break;
271
+ }
272
+ // Record world state before execution
273
+ if (this.config.recordWorldState) {
274
+ step.worldStateBefore = this.cloneState(currentState);
275
+ }
276
+ // Notify step start
277
+ onStepStart(step);
278
+ // Execute with retries
279
+ let success = false;
280
+ let lastError;
281
+ let retries = 0;
282
+ let output;
283
+ let agentId;
284
+ const stepStartTime = Date.now();
285
+ for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
286
+ const execResult = await this.executeStep(step, currentState);
287
+ if (execResult.success) {
288
+ success = true;
289
+ currentState = execResult.newState;
290
+ output = execResult.output;
291
+ agentId = execResult.agentId;
231
292
  break;
232
293
  }
233
- // Record world state before execution
234
- if (this.config.recordWorldState) {
235
- step.worldStateBefore = this.cloneState(currentState);
236
- }
237
- // Notify step start
238
- onStepStart(step);
239
- // Execute with retries
240
- let success = false;
241
- let lastError;
242
- let retries = 0;
243
- let output;
244
- let agentId;
245
- const stepStartTime = Date.now();
246
- for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
247
- const execResult = await this.executeStep(step, currentState);
248
- if (execResult.success) {
249
- success = true;
250
- currentState = execResult.newState;
251
- output = execResult.output;
252
- agentId = execResult.agentId;
253
- break;
254
- }
255
- lastError = execResult.error;
256
- retries = attempt;
257
- // Wait before retry (exponential backoff)
258
- if (attempt < this.config.maxRetries) {
259
- await this.delay(Math.min(1000 * Math.pow(2, attempt), 5000));
260
- }
294
+ lastError = execResult.error;
295
+ retries = attempt;
296
+ // Issue #535: deterministic failures (no implementation, domain
297
+ // not loaded, missing method, unmet preconditions) cannot succeed
298
+ // on retry — don't burn seconds of backoff on them.
299
+ if (execResult.retryable === false) {
300
+ break;
261
301
  }
262
- // Record executed step
263
- const executedStep = {
264
- ...step,
265
- status: success ? 'completed' : 'failed',
266
- retries,
267
- startedAt: new Date(stepStartTime),
268
- completedAt: new Date(),
269
- durationMs: Date.now() - stepStartTime,
270
- agentId,
271
- agentOutput: output,
272
- worldStateAfter: this.config.recordWorldState
273
- ? this.cloneState(currentState)
274
- : undefined,
275
- error: lastError,
276
- };
277
- result.steps.push(executedStep);
278
- onStepComplete(executedStep);
279
- if (success) {
280
- result.stepsCompleted++;
281
- await this.updateActionStats(step.action.id, true, executedStep.durationMs ?? 0);
302
+ // Wait before retry (exponential backoff)
303
+ if (attempt < this.config.maxRetries) {
304
+ await this.delay(Math.min(1000 * Math.pow(2, attempt), 5000));
282
305
  }
283
- else {
284
- result.stepsFailed++;
285
- await this.updateActionStats(step.action.id, false, 0);
286
- // Try to replan if configured
287
- if (this.config.replanOnFailure) {
288
- const newPlan = await this.replanFromFailure(plan, step.stepOrder, currentState);
289
- if (newPlan) {
290
- // Execute new plan recursively
291
- const replanResult = await this.executeWithCallbacks(newPlan, onStepStart, onStepComplete, currentState);
292
- result.steps.push(...replanResult.steps);
293
- result.stepsCompleted += replanResult.stepsCompleted;
294
- result.stepsFailed += replanResult.stepsFailed;
295
- if (replanResult.status === 'completed' && replanResult.finalWorldState) {
296
- currentState = replanResult.finalWorldState;
297
- }
298
- else {
299
- result.status = 'partial';
300
- result.error = `Replanning partially succeeded: ${replanResult.error || 'unknown error'}`;
301
- }
306
+ }
307
+ // Record executed step
308
+ const executedStep = {
309
+ ...step,
310
+ status: success ? 'completed' : 'failed',
311
+ retries,
312
+ startedAt: new Date(stepStartTime),
313
+ completedAt: new Date(),
314
+ durationMs: Date.now() - stepStartTime,
315
+ agentId,
316
+ agentOutput: output,
317
+ worldStateAfter: this.config.recordWorldState
318
+ ? this.cloneState(currentState)
319
+ : undefined,
320
+ error: lastError,
321
+ };
322
+ result.steps.push(executedStep);
323
+ onStepComplete(executedStep);
324
+ if (success) {
325
+ result.stepsCompleted++;
326
+ await this.updateActionStats(step.action.id, true, executedStep.durationMs ?? 0);
327
+ }
328
+ else {
329
+ result.stepsFailed++;
330
+ await this.updateActionStats(step.action.id, false, 0);
331
+ // Try to replan if configured (bounded — issue #535)
332
+ const maxReplans = this.config.maxReplans ?? 3;
333
+ if (this.config.replanOnFailure && replan.replanDepth < maxReplans) {
334
+ // Accumulate exclusions across successive replans so a chain of
335
+ // failures can't bounce back to an action that already failed.
336
+ replan.excludedActions.add(step.action.id);
337
+ const newPlan = await this.replanFromFailure(plan, step.stepOrder, currentState, [...replan.excludedActions]);
338
+ if (newPlan) {
339
+ const replanResult = await this.runPlan(newPlan, onStepStart, onStepComplete, currentState, { excludedActions: replan.excludedActions, replanDepth: replan.replanDepth + 1 });
340
+ result.steps.push(...replanResult.steps);
341
+ result.stepsCompleted += replanResult.stepsCompleted;
342
+ result.stepsFailed += replanResult.stepsFailed;
343
+ if (replanResult.status === 'completed' && replanResult.finalWorldState) {
344
+ currentState = replanResult.finalWorldState;
302
345
  }
303
346
  else {
304
- result.status = 'failed';
305
- result.error = `Step ${step.stepOrder} failed and replanning unsuccessful: ${lastError}`;
306
- break;
347
+ // The goal was not reached — report it as such rather than
348
+ // the old 'partial' ("Replanning partially succeeded").
349
+ result.status = replanResult.status === 'cancelled' ? 'cancelled' : 'failed';
350
+ result.error =
351
+ `Step ${step.stepOrder} failed (${lastError}); replanning did not recover: ` +
352
+ `${replanResult.error || 'unknown error'}`;
307
353
  }
354
+ // The replacement plan supersedes the rest of this plan —
355
+ // don't keep executing stale steps after it.
356
+ break;
308
357
  }
309
358
  else {
310
359
  result.status = 'failed';
311
- result.error = `Step ${step.stepOrder} failed: ${lastError}`;
360
+ result.error = `Step ${step.stepOrder} failed and replanning unsuccessful: ${lastError}`;
312
361
  break;
313
362
  }
314
363
  }
364
+ else {
365
+ result.status = 'failed';
366
+ result.error = `Step ${step.stepOrder} failed: ${lastError}`;
367
+ break;
368
+ }
315
369
  }
316
- result.finalWorldState = currentState;
317
- result.totalDurationMs = Date.now() - startTime;
318
- // Persist execution result
319
- await this.persistExecutionResult(executionId, result);
320
- return result;
321
- }
322
- finally {
323
- this.currentExecution = null;
324
370
  }
371
+ result.finalWorldState = currentState;
372
+ result.totalDurationMs = Date.now() - startTime;
373
+ return result;
325
374
  }
326
375
  /**
327
376
  * Execute a single step
@@ -334,6 +383,7 @@ export class PlanExecutor {
334
383
  success: false,
335
384
  newState: currentState,
336
385
  error: `Preconditions not met for action: ${action.name}`,
386
+ retryable: false,
337
387
  };
338
388
  }
339
389
  // A14: an action explicitly marked as having no real domain backing
@@ -347,6 +397,7 @@ export class PlanExecutor {
347
397
  success: false,
348
398
  newState: currentState,
349
399
  error: `Action '${action.name}' has no real implementation yet (not simulated — see GOAPAction.implemented)`,
400
+ retryable: false,
350
401
  };
351
402
  }
352
403
  // A14: real dispatch — opt-in via constructor-injected getDomainAPI
@@ -359,9 +410,7 @@ export class PlanExecutor {
359
410
  const taskDescription = this.buildTaskDescription(action);
360
411
  try {
361
412
  // Execute with timeout
362
- const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error(`Step timeout after ${this.config.stepTimeoutMs}ms`)), this.config.stepTimeoutMs));
363
- const spawnPromise = this.spawner.spawn(action.agentType, taskDescription);
364
- const agentResult = await Promise.race([spawnPromise, timeoutPromise]);
413
+ const agentResult = await this.withStepTimeout(this.spawner.spawn(action.agentType, taskDescription));
365
414
  if (agentResult.success) {
366
415
  // Apply action effects to world state
367
416
  const newState = this.applyEffects(currentState, action.effects);
@@ -404,6 +453,7 @@ export class PlanExecutor {
404
453
  success: false,
405
454
  newState: currentState,
406
455
  error: `Action '${action.name}' has no qeDomain to resolve a real API from`,
456
+ retryable: false,
407
457
  };
408
458
  }
409
459
  if (!action.method) {
@@ -411,6 +461,7 @@ export class PlanExecutor {
411
461
  success: false,
412
462
  newState: currentState,
413
463
  error: `Action '${action.name}' is marked implemented but has no method binding`,
464
+ retryable: false,
414
465
  };
415
466
  }
416
467
  let api;
@@ -429,6 +480,7 @@ export class PlanExecutor {
429
480
  success: false,
430
481
  newState: currentState,
431
482
  error: `Domain '${action.qeDomain}' is not available (kernel not initialized, or the domain isn't loaded — try fleet_init)`,
483
+ retryable: false,
432
484
  };
433
485
  }
434
486
  const method = api[action.method];
@@ -437,12 +489,28 @@ export class PlanExecutor {
437
489
  success: false,
438
490
  newState: currentState,
439
491
  error: `Domain '${action.qeDomain}' has no method '${action.method}'`,
492
+ retryable: false,
440
493
  };
441
494
  }
442
495
  try {
443
- const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error(`Step timeout after ${this.config.stepTimeoutMs}ms`)), this.config.stepTimeoutMs));
444
496
  const invokePromise = method.call(api, action.params ?? {});
445
- const result = await Promise.race([invokePromise, timeoutPromise]);
497
+ const result = await this.withStepTimeout(invokePromise);
498
+ // Issue #535: domain APIs return Result<T, Error> ({ success: false,
499
+ // error }) rather than throwing. Treating any resolved value as
500
+ // success reported e.g. detectGaps({}) -> err("missing coverageData")
501
+ // as a completed step and applied its effects — a fabricated success.
502
+ if (typeof result === 'object' &&
503
+ result !== null &&
504
+ result.success === false) {
505
+ const reason = result.error;
506
+ return {
507
+ success: false,
508
+ newState: currentState,
509
+ agentId: `domain:${action.qeDomain}`,
510
+ error: `Domain '${action.qeDomain}' method '${action.method}' returned an error: ` +
511
+ describeDomainError(reason),
512
+ };
513
+ }
446
514
  const newState = this.applyEffects(currentState, action.effects);
447
515
  return {
448
516
  success: true,
@@ -459,6 +527,25 @@ export class PlanExecutor {
459
527
  };
460
528
  }
461
529
  }
530
+ /**
531
+ * Race `work` against the per-step timeout, clearing the timer once the
532
+ * race settles so completed steps don't leave a pending timer behind
533
+ * (codex review, #535: it kept short-lived processes alive for up to
534
+ * stepTimeoutMs and accumulated timers across executions).
535
+ */
536
+ async withStepTimeout(work) {
537
+ let timer;
538
+ const timeout = new Promise((_, reject) => {
539
+ timer = setTimeout(() => reject(new Error(`Step timeout after ${this.config.stepTimeoutMs}ms`)), this.config.stepTimeoutMs);
540
+ });
541
+ try {
542
+ return await Promise.race([work, timeout]);
543
+ }
544
+ finally {
545
+ if (timer !== undefined)
546
+ clearTimeout(timer);
547
+ }
548
+ }
462
549
  /**
463
550
  * Build a task description for an agent
464
551
  */
@@ -494,11 +581,12 @@ export class PlanExecutor {
494
581
  * @param currentState - Current world state at failure point
495
582
  * @returns New plan or null if replanning fails
496
583
  */
497
- async replanFromFailure(originalPlan, failedStepIndex, currentState) {
584
+ async replanFromFailure(originalPlan, failedStepIndex, currentState, additionalExcluded = []) {
498
585
  try {
499
- // Exclude the failed action from replanning
586
+ // Exclude the failed action (and any that failed earlier in this
587
+ // execution) from replanning
500
588
  const failedAction = originalPlan.actions[failedStepIndex];
501
- const excludedActions = [failedAction.id];
589
+ const excludedActions = [...new Set([failedAction.id, ...additionalExcluded])];
502
590
  // Try to find a new plan
503
591
  const newPlan = await this.planner.findPlan(currentState, originalPlan.goalState, { excludedActions });
504
592
  return newPlan;
@@ -555,7 +643,8 @@ export class PlanExecutor {
555
643
  SUM(CASE WHEN status = 'completed' THEN 1 ELSE 0 END) as steps_completed,
556
644
  SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) as steps_failed,
557
645
  SUM(COALESCE(duration_ms, 0)) as total_duration_ms,
558
- COUNT(*) as steps_recorded,
646
+ SUM(CASE WHEN action_id = '${CANCELLED_MARKER_ACTION_ID}' THEN 0 ELSE 1 END) as steps_recorded,
647
+ SUM(CASE WHEN action_id = '${CANCELLED_MARKER_ACTION_ID}' THEN 1 ELSE 0 END) as cancelled_markers,
559
648
  MAX(CASE WHEN status = 'failed' THEN error_message END) as last_error
560
649
  FROM goap_execution_steps
561
650
  `;
@@ -571,9 +660,18 @@ export class PlanExecutor {
571
660
  const steps = await this.getExecutedSteps(row.execution_id);
572
661
  const finalWorldState = [...steps].reverse().find((s) => s.worldStateAfter)?.worldStateAfter;
573
662
  const plannedStepCount = this.getPlannedActionCount(row.plan_id);
663
+ // Issue #535: a failed step followed by a successful replacement plan
664
+ // is a recovered (completed) execution; only a run that ENDS on a
665
+ // failed step failed. Without failures, fewer recorded steps than
666
+ // planned means it was cancelled.
667
+ const lastStep = steps[steps.length - 1];
574
668
  let status;
575
- if (row.steps_failed > 0)
669
+ if (row.cancelled_markers > 0)
670
+ status = 'cancelled';
671
+ else if (lastStep?.status === 'failed')
576
672
  status = 'failed';
673
+ else if (row.steps_failed > 0)
674
+ status = 'completed';
577
675
  else if (plannedStepCount != null && row.steps_recorded < plannedStepCount)
578
676
  status = 'cancelled';
579
677
  else
@@ -605,8 +703,8 @@ export class PlanExecutor {
605
703
  */
606
704
  async getExecutedSteps(executionId) {
607
705
  const rows = this.db
608
- .prepare(`SELECT * FROM goap_execution_steps WHERE execution_id = ? ORDER BY step_order`)
609
- .all(executionId);
706
+ .prepare(`SELECT * FROM goap_execution_steps WHERE execution_id = ? AND action_id != ? ORDER BY step_order`)
707
+ .all(executionId, CANCELLED_MARKER_ACTION_ID);
610
708
  return rows.map((row) => ({
611
709
  id: row.id,
612
710
  planId: row.plan_id,
@@ -662,8 +760,19 @@ export class PlanExecutor {
662
760
  agent_output, world_state_before, world_state_after, error_message
663
761
  ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
664
762
  `);
665
- for (const step of result.steps) {
666
- insertStep.run(step.id, step.planId, executionId, step.action.id, step.stepOrder, step.status, step.retries, step.startedAt.toISOString(), step.durationMs ?? null, step.agentId ?? null, step.agentOutput ?? null, step.worldStateBefore ? JSON.stringify(step.worldStateBefore) : null, step.worldStateAfter ? JSON.stringify(step.worldStateAfter) : null, step.error ?? null);
763
+ // Issue #535: steps from replacement plans (replanning) are recorded
764
+ // under the top-level plan id with a chronological step order, so one
765
+ // execution is one history record for the plan the caller executed —
766
+ // not split across sub-plan ids with colliding step orders.
767
+ result.steps.forEach((step, index) => {
768
+ insertStep.run(step.id, result.planId, executionId, step.action.id, index, step.status, step.retries, step.startedAt.toISOString(), step.durationMs ?? null, step.agentId ?? null, step.agentOutput ?? null, step.worldStateBefore ? JSON.stringify(step.worldStateBefore) : null, step.worldStateAfter ? JSON.stringify(step.worldStateAfter) : null, step.error ?? null);
769
+ });
770
+ // Issue #535 (codex review): an execution's cancellation cannot be
771
+ // inferred from its step rows once replanning is involved (the step
772
+ // count no longer matches the executed plan's action count), so record
773
+ // it explicitly with a marker row that history reads and then hides.
774
+ if (result.status === 'cancelled') {
775
+ insertStep.run(`${executionId}-${CANCELLED_MARKER_STATUS}`, result.planId, executionId, CANCELLED_MARKER_ACTION_ID, result.steps.length, CANCELLED_MARKER_STATUS, 0, new Date().toISOString(), null, null, null, null, null, result.error ?? 'Execution was cancelled');
667
776
  }
668
777
  // Reflects only the most recent execution attempt for this plan — a
669
778
  // deliberate, documented scope limit: goap_plans is one row per plan,
@@ -220,6 +220,12 @@ export interface PlanConstraints {
220
220
  maxCost?: number;
221
221
  /** Maximum total duration in milliseconds */
222
222
  maxDurationMs?: number;
223
+ /**
224
+ * Maximum number of actions (steps) in the returned plan. Must be a
225
+ * positive integer; the planner rejects anything else. Defaults to
226
+ * DEFAULT_MAX_PLAN_STEPS when omitted. Issue #535.
227
+ */
228
+ maxSteps?: number;
223
229
  /** Only use actions that these agent types can execute */
224
230
  requiredAgentTypes?: string[];
225
231
  /** Exclude these specific action IDs */
@@ -227,6 +233,16 @@ export interface PlanConstraints {
227
233
  /** Prefer actions in these QE domains */
228
234
  preferredQeDomains?: QEDomain[];
229
235
  }
236
+ /**
237
+ * Default A* depth limit (plan length cap) when constraints.maxSteps is unset.
238
+ */
239
+ export declare const DEFAULT_MAX_PLAN_STEPS = 20;
240
+ /**
241
+ * Validate a constraints.maxSteps value. Returns an error message, or null
242
+ * when the value is absent or a positive integer. Issue #535: shared by the
243
+ * planner and the goap_plan MCP tool so both boundaries reject the same input.
244
+ */
245
+ export declare function validateMaxSteps(maxSteps: unknown): string | null;
230
246
  /**
231
247
  * Default world state for initialization
232
248
  */
@@ -12,6 +12,23 @@
12
12
  * @module planning/types
13
13
  * @version 3.0.0
14
14
  */
15
+ /**
16
+ * Default A* depth limit (plan length cap) when constraints.maxSteps is unset.
17
+ */
18
+ export const DEFAULT_MAX_PLAN_STEPS = 20;
19
+ /**
20
+ * Validate a constraints.maxSteps value. Returns an error message, or null
21
+ * when the value is absent or a positive integer. Issue #535: shared by the
22
+ * planner and the goap_plan MCP tool so both boundaries reject the same input.
23
+ */
24
+ export function validateMaxSteps(maxSteps) {
25
+ if (maxSteps === undefined)
26
+ return null;
27
+ if (typeof maxSteps !== 'number' || !Number.isInteger(maxSteps) || maxSteps < 1) {
28
+ return `constraints.maxSteps must be a positive integer, got ${String(maxSteps)}`;
29
+ }
30
+ return null;
31
+ }
15
32
  // ============================================================================
16
33
  // Default World State
17
34
  // ============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-qe",
3
- "version": "3.14.5",
3
+ "version": "3.14.6",
4
4
  "description": "Agentic Quality Engineering V3 - Domain-Driven Design Architecture with 13 Bounded Contexts, O(log n) coverage analysis, ReasoningBank learning, 60 specialized QE agents, mathematical Coherence verification, deep Claude Flow integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,2 +0,0 @@
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.5");process.exit(0)}
2
- import{a,b,c}from"./chunk-UKGXWW64.js";import"./chunk-I2NENQ44.js";import"./chunk-DLF5BOJD.js";import"./chunk-IJHCIXJC.js";import"./chunk-J5UNP6W3.js";import"./chunk-JSZ663MU.js";export{a as AgentBoosterAdapter,b as createAgentBoosterAdapter,c as createAgentBoosterAdapterSync};
@@ -1,2 +0,0 @@
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.5");process.exit(0)}
2
- import{a as x}from"./chunk-J27F4NSB.js";import{c as f}from"./chunk-7CD7PBHY.js";import"./chunk-JSZ663MU.js";x();import{createRequire as w}from"module";var S=f.create("agent-booster-wasm"),t={JavaScript:0,TypeScript:1,Python:2,Rust:3,Go:4,Java:5,C:6,Cpp:7},l={ExactReplace:0,FuzzyReplace:1,InsertAfter:2,InsertBefore:3,Append:4},v={0:"JavaScript",1:"TypeScript",2:"Python",3:"Rust",4:"Go",5:"Java",6:"C",7:"Cpp"},a=null,u=null,p=null;async function g(){if(a)return!0;if(p)return!1;try{if(a=w(import.meta.url)("./agent_booster_wasm.js"),!a)throw new Error("WASM module loaded but is null");return u=new a.AgentBoosterWasm,!0}catch(e){return p=e,console.warn("[AgentBoosterWASM] Failed to load WASM module:",e),!1}}function A(e){return{".js":t.JavaScript,".mjs":t.JavaScript,".cjs":t.JavaScript,".jsx":t.JavaScript,".ts":t.TypeScript,".tsx":t.TypeScript,".mts":t.TypeScript,".cts":t.TypeScript,".py":t.Python,".rs":t.Rust,".go":t.Go,".java":t.Java,".c":t.C,".h":t.C,".cpp":t.Cpp,".cc":t.Cpp,".cxx":t.Cpp,".hpp":t.Cpp}[e.toLowerCase()]??t.JavaScript}var M=[{name:"var-to-const",detect:(e,r)=>e.includes("var ")&&r.includes("const "),apply:(e,r)=>e.replace(/\bvar\s+/g,"const ")},{name:"var-to-let",detect:(e,r)=>e.includes("var ")&&r.includes("let "),apply:(e,r)=>e.replace(/\bvar\s+/g,"let ")},{name:"add-types-function",detect:(e,r)=>e.includes("function")&&!e.includes(":")&&r.includes(":"),apply:(e,r)=>r},{name:"async-wrapper",detect:(e,r)=>!e.includes("async")&&r.includes("async")&&r.includes("await"),apply:(e,r)=>r},{name:"try-catch-wrapper",detect:(e,r)=>!e.includes("try {")&&r.includes("try {"),apply:(e,r)=>r},{name:"null-check",detect:(e,r)=>!e.includes("if (!")&&!e.includes("if (!")&&(r.includes("if (!")||r.includes("?.")),apply:(e,r)=>r},{name:"test-assertion",detect:(e,r)=>e.includes("test(")&&!e.includes("expect(")&&r.includes("expect("),apply:(e,r)=>r}];function y(e,r){for(let n of M)if(n.detect(e,r))try{return{success:!0,code:n.apply(e,r),pattern:n.name}}catch(s){S.debug("Pattern transform failed, trying next",{pattern:n.name,error:s instanceof Error?s.message:String(s)});continue}return{success:!1,code:r}}async function b(e,r,n,s={}){let o=performance.now(),{confidenceThreshold:T=.5,allowFallback:d=!0}=s;if(!e.trim())return{success:!0,mergedCode:r,confidence:1,strategy:l.Append,syntaxValid:!0,source:"fallback",latencyMs:performance.now()-o};if(await g()&&u&&a)try{let c=a.WasmLanguage[v[n]],i=u.apply_edit(e,r,c);return{success:!0,mergedCode:i.merged_code,confidence:i.confidence,strategy:i.strategy,syntaxValid:i.syntax_valid,source:"wasm",latencyMs:performance.now()-o}}catch(c){let i=c;if(d){let m=y(e,r);if(m.success)return{success:!0,mergedCode:m.code,confidence:.7,strategy:l.FuzzyReplace,syntaxValid:!0,source:"pattern",latencyMs:performance.now()-o}}return{success:!1,mergedCode:r,confidence:0,strategy:l.Append,syntaxValid:!1,source:"fallback",latencyMs:performance.now()-o,error:i.message}}if(d){let c=y(e,r);return{success:c.success,mergedCode:c.code,confidence:c.success?.7:0,strategy:l.FuzzyReplace,syntaxValid:!0,source:"pattern",latencyMs:performance.now()-o}}return{success:!1,mergedCode:r,confidence:0,strategy:l.Append,syntaxValid:!1,source:"fallback",latencyMs:performance.now()-o,error:p?.message??"WASM not available"}}async function W(e,r={}){return Promise.all(e.map(({original:n,edit:s,language:o})=>b(n,s,o,r)))}async function C(){return g()}async function L(){return await g()&&a?a.AgentBoosterWasm.version():"unavailable"}async function R(){if(await g(),u&&a)try{u.apply_edit("function x() {}","function x() {}",a.WasmLanguage.JavaScript)}catch(e){console.debug("[AgentBoosterWASM] Warmup error:",e instanceof Error?e.message:e)}}var _={transform:b,batchTransform:W,isWasmAvailable:C,getVersion:L,warmup:R,Language:t,MergeStrategy:l,languageFromExtension:A};export{t as Language,l as MergeStrategy,W as batchTransform,_ as default,L as getVersion,C as isWasmAvailable,A as languageFromExtension,b as transform,R as warmup};
@@ -1,2 +0,0 @@
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.5");process.exit(0)}
2
- import{a,b,c,d,e,f}from"./chunk-ZCWERUYB.js";import"./chunk-UDHVCKGA.js";import"./chunk-UJWAWIRV.js";import"./chunk-MI5Q55DG.js";import"./chunk-RP2ZKPYV.js";import"./chunk-6LKDHEBY.js";import"./chunk-5WOSWNDN.js";import"./chunk-BJPL6THQ.js";import"./chunk-WJTSY5MC.js";import"./chunk-BYG36QC5.js";import"./chunk-ZBABIZ2D.js";import"./chunk-SX4JLSLV.js";import"./chunk-HBCGYMQU.js";import"./chunk-6CR4VQBQ.js";import"./chunk-7X7JYWT4.js";import"./chunk-RD6TEZ64.js";import"./chunk-UTBYJ4RF.js";import"./chunk-KIP6WZGV.js";import"./chunk-EFV4ADMO.js";import"./chunk-RKOUXVZZ.js";import"./chunk-IJHCIXJC.js";import"./chunk-NQI7FWCS.js";import"./chunk-C3HQL6S4.js";import"./chunk-QWUXCG2L.js";import"./chunk-XEZIIQYJ.js";import"./chunk-J27F4NSB.js";import"./chunk-7CD7PBHY.js";import"./chunk-J5UNP6W3.js";import"./chunk-W2XCZU62.js";import"./chunk-HVU64GP5.js";import"./chunk-ELBZON4V.js";import"./chunk-52L77RMG.js";import"./chunk-XZSMZHM2.js";import"./chunk-CVMNJSCB.js";import"./chunk-NU7UTXMP.js";import"./chunk-D6OUCB2H.js";import"./chunk-6A44AOGN.js";import"./chunk-WJHWH5D2.js";import"./chunk-JSZ663MU.js";export{b as AQELearningEngine,a as DEFAULT_ENGINE_CONFIG,c as DEFAULT_META_LEARNING_CONFIG,d as MetaLearningEngine,e as createAQELearningEngine,f as createDefaultLearningEngine};
@@ -1,3 +0,0 @@
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.5");process.exit(0)}
2
- import{d as f,e as g,f as m,g as y}from"./chunk-GTKCGPJZ.js";import{o as L}from"./chunk-EFV4ADMO.js";import"./chunk-RKOUXVZZ.js";import"./chunk-IJHCIXJC.js";import"./chunk-NQI7FWCS.js";import{b as l}from"./chunk-C3HQL6S4.js";import"./chunk-J27F4NSB.js";import"./chunk-7CD7PBHY.js";import"./chunk-J5UNP6W3.js";import"./chunk-HVU64GP5.js";import{p as E,q as w}from"./chunk-ELBZON4V.js";import"./chunk-52L77RMG.js";import"./chunk-XZSMZHM2.js";import"./chunk-CVMNJSCB.js";import"./chunk-NU7UTXMP.js";import"./chunk-D6OUCB2H.js";import"./chunk-6A44AOGN.js";import"./chunk-WJHWH5D2.js";import{f as v}from"./chunk-JSZ663MU.js";import{Command as x}from"commander";import c from"chalk";L();import{existsSync as p}from"node:fs";import b from"node:path";function C(n,i){let e=[];e.push(c.bold("Witness Chain Audit Verification")),e.push("");let t=i?c.green("ENABLED"):c.yellow("DISABLED");e.push(` Feature Flag: ${t}`),e.push(` Chain Length: ${n.length} receipts`);let r=n.valid?c.green("VALID"):c.red("BROKEN");return e.push(` Integrity: ${r}`),n.length>0&&e.push(` Last Hash: ${n.lastHash.slice(0,16)}...`),!n.valid&&n.brokenAt>=0&&(e.push(""),e.push(c.red(` Break detected at index ${n.brokenAt}`)),e.push(c.red(` ${n.message}`))),e.push(""),e.join(`
3
- `)}function V(){try{let n=l(),i=b.join(n,".agentic-qe","memory.db");if(!p(i))return null;let e=(w(),v(E)),t=new e(i),r=f(t),s=m(r);return t.close(),s}catch{return null}}async function O(n){let i=y(),t=(V()??g()).verifyChain(),r={featureEnabled:i,chainLength:t.length,integrity:t.valid,brokenAt:t.brokenAt,lastHash:t.lastHash,message:t.message};return n.format==="json"?console.log(JSON.stringify(r,null,2)):console.log(C(t,i)),r}async function j(n){let{WitnessChain:i,hashWith:e,serializeEntry:t}=await import("./witness-chain-ZW6KKUZU.js"),r=l(),s=b.join(r,".agentic-qe","memory.db"),a;if(!p(s))a={featureEnabled:!0,chainLength:0,integrity:!0,brokenAt:-1,lastHash:"",message:`No database found at ${s} \u2014 nothing to verify`};else{let{default:A}=await import("./better-sqlite3-4DSBPDRH.js"),h=new A(s,{readonly:!0});try{let d=new i(h);await d.initialize();let o=d.verify({includeArchive:!0,checkSignatures:!0}),u=h.prepare("SELECT * FROM witness_chain ORDER BY id DESC LIMIT 1").get(),k=u?e(u.hash_algo||"sha256",t(u)):"";a={featureEnabled:!0,chainLength:o.entriesChecked,integrity:o.valid,brokenAt:o.brokenAt??-1,lastHash:k,message:o.valid?`Audit chain verified: ${o.entriesChecked} entries checked, ${o.signatureFailures??0} signature failures`:`Audit chain BROKEN at id=${o.brokenAt} (${o.entriesChecked} entries checked before the break)`}}finally{h.close()}}return n.format==="json"?console.log(JSON.stringify(a,null,2)):console.log(C({valid:a.integrity,length:a.chainLength,brokenAt:a.brokenAt,lastHash:a.lastHash,message:a.message},a.featureEnabled)),a}function R(n,i,e){let t=new x("audit").description("Witness chain audit trail management");return t.command("verify").description("Verify witness chain integrity").option("-F, --format <format>","Output format (json|text)","text").option("-C, --chain <chain>","Which chain to verify: governance (29 decision receipts) or audit (full QE audit trail)","governance").action(async r=>{try{let s=r.format,a=r.chain==="audit"?await j({format:s}):await O({format:s});await i(a.integrity?0:1)}catch(s){console.error("Failed to verify witness chain:",s),await i(1)}}),t}export{R as createAuditCommand,C as formatVerificationText,j as handleAuditChainVerify,O as handleAuditVerify};
@@ -1,2 +0,0 @@
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.5");process.exit(0)}
2
- import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-YDFL445W.js";import"./chunk-LULD4JV2.js";import"./chunk-EFV4ADMO.js";import"./chunk-RKOUXVZZ.js";import"./chunk-IJHCIXJC.js";import"./chunk-NQI7FWCS.js";import"./chunk-C3HQL6S4.js";import"./chunk-J27F4NSB.js";import"./chunk-7CD7PBHY.js";import"./chunk-J5UNP6W3.js";import"./chunk-W2XCZU62.js";import"./chunk-7VFY7TUR.js";import"./chunk-HVU64GP5.js";import"./chunk-ELBZON4V.js";import"./chunk-52L77RMG.js";import"./chunk-XZSMZHM2.js";import"./chunk-CVMNJSCB.js";import"./chunk-NU7UTXMP.js";import"./chunk-D6OUCB2H.js";import"./chunk-6A44AOGN.js";import"./chunk-WJHWH5D2.js";import"./chunk-JSZ663MU.js";export{l as MCPToolBase,k as defaultToolLogger,j as getKernel,i as getLLMRouter,e as getMemoryBackend,g as getSharedLLMRouter,c as getSharedMemoryBackend,a as isMemoryOnlyMode,b as registerRvfResetFn,h as resetSharedLLMRouter,d as resetSharedMemoryBackend,f as setSharedLLMRouter};
@@ -1,2 +0,0 @@
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.5");process.exit(0)}
2
- import{a}from"./chunk-E3W6XQ57.js";import"./chunk-YDFL445W.js";import"./chunk-LULD4JV2.js";import"./chunk-EFV4ADMO.js";import"./chunk-RKOUXVZZ.js";import"./chunk-IJHCIXJC.js";import"./chunk-NQI7FWCS.js";import"./chunk-C3HQL6S4.js";import"./chunk-J27F4NSB.js";import"./chunk-7CD7PBHY.js";import"./chunk-J5UNP6W3.js";import"./chunk-W2XCZU62.js";import"./chunk-7VFY7TUR.js";import"./chunk-HVU64GP5.js";import"./chunk-ELBZON4V.js";import"./chunk-52L77RMG.js";import"./chunk-XZSMZHM2.js";import"./chunk-CVMNJSCB.js";import"./chunk-NU7UTXMP.js";import"./chunk-D6OUCB2H.js";import"./chunk-6A44AOGN.js";import"./chunk-WJHWH5D2.js";import"./chunk-JSZ663MU.js";export{a as BrowserWorkflowTool};
@@ -1,2 +0,0 @@
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.5");process.exit(0)}
2
- var s={"test-generation":/test|spec|describe|it\(|expect|assert|mock|stub|fixture|tdd|bdd/i,"test-execution":/run|execute|parallel|retry|flaky|timeout|worker|orchestrat/i,"coverage-analysis":/coverage|branch|line|uncovered|gap|untested|percentage|sublinear/i,"quality-assessment":/quality|gate|deploy|readiness|metric|threshold|sla|score/i,"defect-intelligence":/defect|bug|predict|root.?cause|regression|failure|incident/i,"requirements-validation":/requirement|bdd|gherkin|testabil|accept|criteri|scenario/i,"code-intelligence":/semantic|knowledge|graph|ast|symbol|reference|impact|depend/i,"security-compliance":/vuln|cve|owasp|xss|sqli|injection|csrf|auth|secret|compliance|sast|dast/i,"contract-testing":/contract|pact|openapi|swagger|graphql|schema|endpoint|api/i,"visual-accessibility":/screenshot|visual|snapshot|pixel|percy|a11y|aria|wcag|screen.?reader|accessible|contrast/i,"chaos-resilience":/chaos|resilience|fault|inject|blast|recover|latency|failure|stress|load/i,"learning-optimization":/learn|pattern|optim|neural|embedding|vector|memory|adapt|train/i};function l(e){for(let[t,a]of Object.entries(s))if(a.test(e))return t;return null}function m(e){let t=[];for(let[a,n]of Object.entries(s))n.test(e)&&t.push(a);return t}function u(e){return e}function d(e){let t=Math.min(e.usageCount/100,1);return e.confidence*.3+t*.2+e.successRate*.5}var c=3;function p(e,t,a=.4){let n=e.tier==="short-term"&&e.successfulUses>=c,r=e.successRate>=.7&&e.confidence>=.6,i=t===void 0||t<a,o;return n?r?i||(o="coherence_violation"):o="low_quality":o="insufficient_usage",{meetsUsageCriteria:n,meetsQualityCriteria:r,meetsCoherenceCriteria:i,blockReason:o}}function y(e){let t=[];if(e.id||t.push("Pattern ID is required"),e.patternType||t.push("Pattern type is required"),e.qeDomain||t.push("QE domain is required"),e.name||t.push("Pattern name is required"),e.template?.content||t.push("Template content is required"),e.confidence!==void 0&&(e.confidence<0||e.confidence>1)&&t.push("Confidence must be between 0 and 1"),e.successRate!==void 0&&(e.successRate<0||e.successRate>1)&&t.push("Success rate must be between 0 and 1"),e.template?.variables){let a=new Set;for(let n of e.template.variables)a.has(n.name)&&t.push(`Duplicate variable name: ${n.name}`),a.add(n.name),e.template.content.includes(`{{${n.name}}}`)||t.push(`Variable ${n.name} not referenced in template`)}return{valid:t.length===0,errors:t}}function f(e,t){let a=e.content;for(let n of e.variables){let r=t[n.name]??n.defaultValue;if(n.required&&r===void 0)throw new Error(`Required variable ${n.name} not provided`);if(r!==void 0){let i=`{{${n.name}}}`,o=typeof r=="object"?JSON.stringify(r):String(r);a=a.split(i).join(o)}}return a}var g=Object.keys(s);export{l as a,m as b,u as c,d,c as e,p as f,y as g,f as h,g as i};
@@ -1,3 +0,0 @@
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.5");process.exit(0)}
2
- import{b as c}from"./chunk-JSZ663MU.js";function u(r){switch(r.toUpperCase()){case"DEBUG":return 0;case"INFO":return 1;case"WARN":case"WARNING":return 2;case"ERROR":return 3;case"SILENT":case"NONE":case"OFF":return 4;default:return 1}}var f,l=c(()=>{"use strict";f={0:"DEBUG",1:"INFO",2:"WARN",3:"ERROR",4:"SILENT"}});var a,s,g,d=c(()=>{"use strict";l();a={includeTimestamp:!0,includeLevel:!0,timestampFormat:"short",prettyPrint:!1,maxContextDepth:3},s=class r{domain;level;config;inheritedContext;constructor(e,n=1,o={},t={}){this.domain=e,this.level=n,this.config={...a,...o},this.inheritedContext=t}debug(e,n){this.level<=0&&this.output(0,e,n)}info(e,n){this.level<=1&&this.output(1,e,n)}warn(e,n){this.level<=2&&this.output(2,e,n)}error(e,n,o){if(this.level<=3){let t={...o};if(n){t.errorName=n.name,t.errorMessage=n.message,n.stack&&(t.stack=n.stack);let i=n;i.cause!==void 0&&(t.cause=String(i.cause))}this.output(3,e,t)}}isEnabled(e){return this.level<=e}getDomain(){return this.domain}child(e){return new r(this.domain,this.level,this.config,{...this.inheritedContext,...e})}output(e,n,o){let t=this.format(e,n,o);switch(e){case 0:console.debug(t);break;case 1:console.info(t);break;case 2:console.warn(t);break;case 3:console.error(t);break}}format(e,n,o){let t=[];this.config.includeTimestamp&&t.push(this.formatTimestamp()),this.config.includeLevel&&t.push(this.formatLevel(e)),t.push(`[${this.domain}]`),t.push(n);let i=this.mergeContext(o);return i&&Object.keys(i).length>0&&t.push(this.formatContext(i)),t.join(" ")}formatTimestamp(){let e=new Date;if(this.config.timestampFormat==="iso")return`[${e.toISOString()}]`;let n=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),t=String(e.getSeconds()).padStart(2,"0"),i=String(e.getMilliseconds()).padStart(3,"0");return`[${n}:${o}:${t}.${i}]`}formatLevel(e){return`[${f[e].padEnd(5)}]`}mergeContext(e){if(!(!e&&Object.keys(this.inheritedContext).length===0))return{...this.inheritedContext,...e}}formatContext(e){try{return this.config.prettyPrint?`
3
- `+JSON.stringify(e,this.createReplacer(),2):JSON.stringify(e,this.createReplacer())}catch{return"[unserializable context]"}}createReplacer(){let e=new WeakSet,n=0;return(o,t)=>{if(typeof t=="object"&&t!==null){if(n>=this.config.maxContextDepth)return"[object]";if(e.has(t))return"[circular]";e.add(t),n++}return t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:typeof t=="bigint"?t.toString():typeof t=="function"?"[function]":typeof t=="symbol"?t.toString():t}}},g=class{domain;constructor(e="null"){this.domain=e}debug(e,n){}info(e,n){}warn(e,n){}error(e,n,o){}isEnabled(e){return!1}getDomain(){return this.domain}child(e){return this}}});function F(r,e){return L.create(r,e)}var v,L,m=c(()=>{"use strict";l();d();v={defaultLevel:1,domainLevels:new Map,consoleConfig:a,silent:!1},L=class{static config={...v};static customProvider=null;static instances=new Map;static setLevel(e){this.config.defaultLevel=e,this.instances.clear()}static setLevelFromString(e){this.setLevel(u(e))}static getLevel(){return this.config.defaultLevel}static setDomainLevel(e,n){this.config.domainLevels.set(e,n),this.instances.delete(e)}static getDomainLevel(e){return this.config.domainLevels.get(e)??this.config.defaultLevel}static clearDomainLevel(e){this.config.domainLevels.delete(e),this.instances.delete(e)}static configure(e){this.config.consoleConfig={...this.config.consoleConfig,...e},this.instances.clear()}static setSilent(e){this.config.silent=e,this.instances.clear()}static isSilent(){return this.config.silent}static setProvider(e){this.customProvider=e,this.instances.clear()}static create(e,n){if(!n&&this.instances.has(e))return this.instances.get(e);let o=this.getDomainLevel(e),t;return this.config.silent?t=new g(e):this.customProvider?t=this.customProvider(e,o,n):t=new s(e,o,this.config.consoleConfig,n),n||this.instances.set(e,t),t}static getLogger(e,n){return this.create(e,n)}static reset(){this.config={defaultLevel:1,domainLevels:new Map,consoleConfig:{...a},silent:!1},this.customProvider=null,this.instances.clear()}static initFromEnv(){let e=process.env.LOG_LEVEL;e&&this.setLevelFromString(e);let n=process.env.LOG_TIMESTAMP;n!==void 0&&this.configure({includeTimestamp:n.toLowerCase()==="true"});let o=process.env.LOG_PRETTY;o!==void 0&&this.configure({prettyPrint:o.toLowerCase()==="true"})}static getStats(){return{cachedLoggers:this.instances.size,domains:Array.from(this.instances.keys()),domainOverrides:this.config.domainLevels.size,currentLevel:this.config.defaultLevel,silent:this.config.silent}}}});export{l as a,d as b,L as c,F as d,m as e};
@@ -1,27 +0,0 @@
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.5");process.exit(0)}
2
- import{b as m}from"./chunk-RD6TEZ64.js";import{k as y,o as L}from"./chunk-EFV4ADMO.js";L();import{createHash as b}from"crypto";var R="0".repeat(64);function N(a){return b("sha256").update(a,"utf-8").digest("hex")}function A(a){try{return b("shake256",{outputLength:32}).update(a,"utf-8").digest("hex")}catch{return N(a)}}function l(a,t){return a==="shake256"?A(t):N(t)}function g(a){return JSON.stringify({id:a.id,prev_hash:a.prev_hash,action_hash:a.action_hash,action_type:a.action_type,action_data:a.action_data,timestamp:a.timestamp,actor:a.actor})}var _=class{constructor(t,i){this.externalDb=t;this.keyManager=i??null}externalDb;db=null;initialized=!1;keyManager=null;async initialize(){if(!this.initialized){if(this.externalDb)this.db=this.externalDb;else{let t=y();await t.initialize(),this.db=t.getDatabase()}this.ensureTable(),this.initialized=!0}}getDatabase(){return this.db}getKeyManager(){return this.keyManager}ensureTable(){if(!this.db)throw new Error("Database not initialized");this.db.exec(`
3
- CREATE TABLE IF NOT EXISTS witness_chain (
4
- id INTEGER PRIMARY KEY AUTOINCREMENT,
5
- prev_hash TEXT NOT NULL, action_hash TEXT NOT NULL, action_type TEXT NOT NULL,
6
- action_data TEXT, timestamp TEXT NOT NULL, actor TEXT NOT NULL,
7
- hash_algo TEXT DEFAULT 'sha256', signature TEXT, signer_key_id TEXT
8
- );
9
- CREATE INDEX IF NOT EXISTS idx_witness_action_type ON witness_chain(action_type);
10
- CREATE INDEX IF NOT EXISTS idx_witness_timestamp ON witness_chain(timestamp);
11
- CREATE INDEX IF NOT EXISTS idx_witness_actor ON witness_chain(actor);
12
- `),this.addColumnIfMissing("hash_algo","TEXT DEFAULT 'sha256'"),this.addColumnIfMissing("signature","TEXT"),this.addColumnIfMissing("signer_key_id","TEXT"),this.db.exec(`
13
- CREATE TABLE IF NOT EXISTS witness_chain_archive (
14
- id INTEGER PRIMARY KEY,
15
- prev_hash TEXT NOT NULL, action_hash TEXT NOT NULL, action_type TEXT NOT NULL,
16
- action_data TEXT, timestamp TEXT NOT NULL, actor TEXT NOT NULL,
17
- hash_algo TEXT DEFAULT 'sha256', signature TEXT, signer_key_id TEXT,
18
- archived_at TEXT NOT NULL
19
- );
20
- `)}addColumnIfMissing(t,i){if(!this.db)return;this.db.prepare("SELECT name FROM pragma_table_info('witness_chain')").all().some(s=>s.name===t)||this.db.exec(`ALTER TABLE witness_chain ADD COLUMN ${t} ${i}`)}append(t,i,e){let s=this.db;if(!s)throw new Error("WitnessChain not initialized");let o=JSON.stringify(i),h="shake256",E=A(o);return s.transaction(()=>{let r=new Date().toISOString(),c=s.prepare("SELECT * FROM witness_chain ORDER BY id DESC LIMIT 1").get(),u=c?l(h,g(c)):R,T=null,p=null;if(this.keyManager){let O=Buffer.from(u+E+t+r+e,"utf-8"),f=this.keyManager.sign(O);T=f.signature.toString("hex"),p=f.keyId}return{id:s.prepare(`INSERT INTO witness_chain
21
- (prev_hash, action_hash, action_type, action_data, timestamp, actor, hash_algo, signature, signer_key_id)
22
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(u,E,t,o,r,e,h,T,p).lastInsertRowid,prev_hash:u,action_hash:E,action_type:t,action_data:o,timestamp:r,actor:e,hash_algo:h,signature:T,signer_key_id:p}}).immediate()}findEntryById(t){if(this.db)return this.db.prepare("SELECT * FROM witness_chain WHERE id = ?").get(t)??this.db.prepare("SELECT * FROM witness_chain_archive WHERE id = ?").get(t)}checkEntryLink(t,i){let e=t.hash_algo||"sha256";if(t.action_hash!==l(e,t.action_data))return!1;if(t.id===1)return t.prev_hash===R;if(i&&t.prev_hash===l(e,g(i)))return!0;let s=this.findEntryById(t.id-1);return s!==void 0&&t.prev_hash===l(e,g(s))}verify(t){if(!this.db)throw new Error("WitnessChain not initialized");let i=this.db.prepare("SELECT * FROM witness_chain ORDER BY id ASC").all();if(i.length===0)return{valid:!0,entriesChecked:0};let e=0,s=t?.checkSignatures===!0&&this.keyManager!==null,o=n=>{if(s&&n.signature&&n.signer_key_id){let r=Buffer.from(n.prev_hash+n.action_hash+n.action_type+n.timestamp+n.actor,"utf-8");this.keyManager.verify(Buffer.from(r),Buffer.from(n.signature,"hex"),n.signer_key_id)||e++}};for(let n=0;n<i.length;n++){let r=i[n];if(!this.checkEntryLink(r,n>0?i[n-1]:void 0))return{valid:!1,brokenAt:r.id,entriesChecked:n+1,signatureFailures:e};o(r)}let h=i.length;if(t?.includeArchive){let n=this.db.prepare("SELECT * FROM witness_chain_archive ORDER BY id ASC").all();for(let r=0;r<n.length;r++){let c=n[r];if(!this.checkEntryLink(c,r>0?n[r-1]:void 0))return{valid:!1,brokenAt:c.id,entriesChecked:h+r+1,signatureFailures:e};o(c)}h+=n.length}return{valid:e===0,entriesChecked:h,signatureFailures:e,...e>0?{brokenAt:i[0].id}:{}}}getEntries(t){if(!this.db)throw new Error("WitnessChain not initialized");let i=[],e=[];t?.action_type&&(i.push("action_type = ?"),e.push(t.action_type)),t?.since&&(i.push("timestamp >= ?"),e.push(t.since)),t?.until&&(i.push("timestamp <= ?"),e.push(t.until)),t?.actor&&(i.push("actor = ?"),e.push(t.actor));let s=i.length>0?`WHERE ${i.join(" AND ")}`:"",o=t?.limit!=null,h=t?.offset!=null,E=o||h?"LIMIT ?":"",n=h?"OFFSET ?":"";return o?e.push(t.limit):h&&e.push(-1),h&&e.push(t.offset),this.db.prepare(`SELECT * FROM witness_chain ${s} ORDER BY id ASC ${E} ${n}`).all(...e)}getPatternLineage(t){if(!this.db)throw new Error("WitnessChain not initialized");return this.db.prepare(`SELECT * FROM witness_chain
23
- WHERE json_extract(action_data, '$.patternId') = ? OR json_extract(action_data, '$.pattern_id') = ?
24
- ORDER BY id ASC`).all(t,t)}getActorHistory(t,i){if(!this.db)throw new Error("WitnessChain not initialized");return i?this.db.prepare("SELECT * FROM witness_chain WHERE actor = ? AND timestamp >= ? ORDER BY id ASC").all(t,i):this.db.prepare("SELECT * FROM witness_chain WHERE actor = ? ORDER BY id ASC").all(t)}archiveEntries(t){if(!this.db)throw new Error("WitnessChain not initialized");let i=new Date().toISOString(),s=this.db.prepare(`INSERT INTO witness_chain_archive
25
- (id, prev_hash, action_hash, action_type, action_data, timestamp, actor, hash_algo, signature, signer_key_id, archived_at)
26
- SELECT id, prev_hash, action_hash, action_type, action_data, timestamp, actor, hash_algo, signature, signer_key_id, ?
27
- FROM witness_chain WHERE timestamp < ? AND id > 1 AND id NOT IN (SELECT id FROM witness_chain_archive)`).run(i,t).changes;return s>0&&this.db.prepare("DELETE FROM witness_chain WHERE timestamp < ? AND id > 1").run(t),{archived:s}}crossVerifyWithRvf(t){let i=this.verify(),e=t.status(),s=e.witnessValid===!0,o=typeof e.witnessEntries=="number"?e.witnessEntries:0;return{sqliteValid:i.valid,rvfValid:s,rvfEntries:o,bothValid:i.valid&&s}}getChainLength(){if(!this.db)throw new Error("WitnessChain not initialized");return this.db.prepare("SELECT COUNT(*) as count FROM witness_chain").get().count}},d=null;async function W(){return d||(d=new _(void 0,m()),await d.initialize()),d}function w(a,t){return new _(a,t)}function D(){d=null}export{R as a,N as b,A as c,l as d,g as e,_ as f,W as g,w as h,D as i};
@@ -1,2 +0,0 @@
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.5");process.exit(0)}
2
- import{a as e,b as g,e as r}from"./chunk-7CD7PBHY.js";import{b as o}from"./chunk-JSZ663MU.js";var L=o(()=>{"use strict";e();g();r()});export{L as a};