agentic-qe 3.11.4 → 3.12.0

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 (449) hide show
  1. package/.claude/helpers/.helpers-version +1 -0
  2. package/.claude/helpers/auto-memory-hook.mjs +35 -3
  3. package/.claude/helpers/brain-checkpoint.cjs +16 -1
  4. package/.claude/helpers/helpers.manifest.json +12 -0
  5. package/.claude/helpers/hook-handler.cjs +26 -5
  6. package/.claude/helpers/intelligence.cjs +14 -1
  7. package/.claude/hooks/aqe-hook.cjs +57 -10
  8. package/.claude/skills/skills-manifest.json +1 -1
  9. package/CHANGELOG.md +110 -0
  10. package/assets/skills/skills-manifest.json +1 -1
  11. package/dist/adapters/a2a/auth/routes.js +59 -28
  12. package/dist/audit/witness-chain.d.ts +25 -0
  13. package/dist/audit/witness-chain.js +69 -22
  14. package/dist/audit/witness-key-manager.d.ts +11 -0
  15. package/dist/audit/witness-key-manager.js +24 -0
  16. package/dist/cli/brain-commands.js +2 -1
  17. package/dist/cli/bundle.js +6 -6
  18. package/dist/cli/chunks/adapter-6IWRIHF3.js +2 -0
  19. package/dist/cli/chunks/{agent-booster-wasm-62I6ZNRW.js → agent-booster-wasm-IO54X6IQ.js} +2 -2
  20. package/dist/cli/chunks/{agent-handler-E2TZKKBS.js → agent-handler-A57SZUCW.js} +2 -2
  21. package/dist/cli/chunks/{agent-memory-branch-JHAHC2NH.js → agent-memory-branch-BX7LRFGN.js} +2 -2
  22. package/dist/cli/chunks/aqe-learning-engine-FSF5U67K.js +2 -0
  23. package/dist/cli/chunks/{arena-72ZV65BR.js → arena-UTC4YY6Y.js} +4 -4
  24. package/dist/cli/chunks/{arena-KLG3YSSR.js → arena-Y3XTX6O7.js} +2 -2
  25. package/dist/cli/chunks/audit-L4RL2AOY.js +3 -0
  26. package/dist/cli/chunks/base-2CKCJU3O.js +2 -0
  27. package/dist/cli/chunks/{hnswlib-node-LAFK5QZ4.js → better-sqlite3-LRDXKYOJ.js} +2 -2
  28. package/dist/cli/chunks/brain-handler-OHDPI5TQ.js +89 -0
  29. package/dist/cli/chunks/{branch-enumerator-C7MPNYT7.js → branch-enumerator-ZRXE2CQ7.js} +2 -2
  30. package/dist/cli/chunks/{browser-UUDUDYLR.js → browser-NT33FG76.js} +2 -2
  31. package/dist/cli/chunks/browser-workflow-UGYJE64S.js +2 -0
  32. package/dist/cli/chunks/{chunk-7QTB5XIQ.js → chunk-27JCWG5J.js} +2 -2
  33. package/dist/cli/chunks/{chunk-3FJZMQJ7.js → chunk-2ALNNXFF.js} +2 -2
  34. package/dist/cli/chunks/{chunk-LMJUMUQJ.js → chunk-2AOOIAW3.js} +4 -4
  35. package/dist/cli/chunks/{chunk-CNF3ZWLM.js → chunk-2AR4B3DI.js} +2 -2
  36. package/dist/cli/chunks/{chunk-7ADD2ZQL.js → chunk-2KHDGC7N.js} +2 -2
  37. package/dist/cli/chunks/{chunk-P6S6ZVB5.js → chunk-2UMCB7AH.js} +1 -1
  38. package/dist/cli/chunks/{chunk-HH6NCBSP.js → chunk-335GHVJV.js} +22 -22
  39. package/dist/cli/chunks/{chunk-2WPSMQIL.js → chunk-36MPDANH.js} +1 -1
  40. package/dist/cli/chunks/{chunk-Y4AXOHW4.js → chunk-3AFNXU45.js} +1 -1
  41. package/dist/cli/chunks/{chunk-SL3SNOO2.js → chunk-3B4XXFKD.js} +2 -2
  42. package/dist/cli/chunks/{chunk-7IKWF2AD.js → chunk-4GU656WM.js} +1 -1
  43. package/dist/cli/chunks/{chunk-IQBZBUP5.js → chunk-4SALW7OT.js} +2 -2
  44. package/dist/cli/chunks/{chunk-TCVEKRPI.js → chunk-5FR5GBUT.js} +2 -2
  45. package/dist/cli/chunks/chunk-5VBPIJUZ.js +65 -0
  46. package/dist/cli/chunks/chunk-5XFX25AJ.js +4 -0
  47. package/dist/cli/chunks/{chunk-QSDIY3E2.js → chunk-5YGESYBC.js} +1 -1
  48. package/dist/cli/chunks/{chunk-5U2WHPXL.js → chunk-62RELCU6.js} +1 -1
  49. package/dist/cli/chunks/{chunk-QJ5NCYJ3.js → chunk-64M3FFM4.js} +2 -2
  50. package/dist/cli/chunks/{chunk-BMQDELPA.js → chunk-6JNNZGI2.js} +1 -1
  51. package/dist/cli/chunks/{chunk-U34OZXD6.js → chunk-6X3RJBA3.js} +2 -2
  52. package/dist/cli/chunks/{chunk-AE6HXMOG.js → chunk-72VZGAMJ.js} +1 -1
  53. package/dist/cli/chunks/{chunk-4JFH3MVA.js → chunk-7F7U2HUH.js} +1 -1
  54. package/dist/cli/chunks/{chunk-A4OMK3FO.js → chunk-7HJHXSYT.js} +2 -2
  55. package/dist/cli/chunks/chunk-7WX3MKRS.js +2 -0
  56. package/dist/cli/chunks/{chunk-O7PVZ32A.js → chunk-7ZIVDGSN.js} +1 -1
  57. package/dist/cli/chunks/{chunk-EZRHSHOQ.js → chunk-AAATFEIL.js} +2 -2
  58. package/dist/cli/chunks/{chunk-TQ373GGI.js → chunk-AEX75YGI.js} +2 -2
  59. package/dist/cli/chunks/chunk-BA6U7NSR.js +2 -0
  60. package/dist/cli/chunks/chunk-BB4OVXWF.js +14 -0
  61. package/dist/cli/chunks/{chunk-GRQ36XUH.js → chunk-BBC526PL.js} +2 -2
  62. package/dist/cli/chunks/{chunk-EONKMHKO.js → chunk-BGRJZH5Q.js} +2 -2
  63. package/dist/cli/chunks/{chunk-XQ6DW5FV.js → chunk-BUYPRUNY.js} +2 -2
  64. package/dist/cli/chunks/{chunk-TU6YN43Q.js → chunk-BZPF6GTL.js} +1 -1
  65. package/dist/cli/chunks/{chunk-TPMBFARK.js → chunk-C4SZSPXY.js} +67 -22
  66. package/dist/cli/chunks/{chunk-D6CKKNYC.js → chunk-C6GYLCTX.js} +2 -2
  67. package/dist/cli/chunks/{chunk-YNK6SUPU.js → chunk-CC5G3K4X.js} +2 -2
  68. package/dist/cli/chunks/{chunk-ADFKY3X2.js → chunk-CHO54B34.js} +2 -2
  69. package/dist/cli/chunks/{chunk-WQZ2WRO4.js → chunk-CMGYUCM7.js} +1 -1
  70. package/dist/cli/chunks/{chunk-QMC5MTBV.js → chunk-CSEEGX5T.js} +2 -2
  71. package/dist/cli/chunks/{chunk-FSGMRQFC.js → chunk-CVGXB7IX.js} +2 -2
  72. package/dist/cli/chunks/{chunk-5VSQAGA2.js → chunk-DQDFACYW.js} +1 -1
  73. package/dist/cli/chunks/chunk-DR7PCO3S.js +153 -0
  74. package/dist/cli/chunks/{chunk-D5S47YUS.js → chunk-DTOE3NYW.js} +3 -3
  75. package/dist/cli/chunks/{chunk-WZYNY3VF.js → chunk-DXOMRWDC.js} +1 -1
  76. package/dist/cli/chunks/{chunk-HJ24KMC2.js → chunk-EGH3H7QO.js} +1 -1
  77. package/dist/cli/chunks/{chunk-JFLSQH2X.js → chunk-EM2JIIAQ.js} +2 -2
  78. package/dist/cli/chunks/{chunk-MWFJC5HR.js → chunk-ESDGCTC4.js} +1 -1
  79. package/dist/cli/chunks/{chunk-SRVTNG6L.js → chunk-EZE2HRQB.js} +2 -2
  80. package/dist/cli/chunks/{chunk-ZFCVT43J.js → chunk-FEEMJDUF.js} +2 -2
  81. package/dist/cli/chunks/{chunk-HJO4RNOW.js → chunk-FI5SSLEF.js} +2 -2
  82. package/dist/cli/chunks/{chunk-XHRLBJTM.js → chunk-FKPUPQQT.js} +2 -2
  83. package/dist/cli/chunks/{chunk-ODZSQVEW.js → chunk-FOPS6DRZ.js} +1 -1
  84. package/dist/cli/chunks/{chunk-AQIEK4SY.js → chunk-FU5RNEXV.js} +2 -2
  85. package/dist/cli/chunks/{chunk-PQUXFSN6.js → chunk-FZIHOMGY.js} +2 -2
  86. package/dist/cli/chunks/{chunk-Z2REKBD6.js → chunk-FZRU73M4.js} +2 -2
  87. package/dist/cli/chunks/{chunk-NBBLPDJX.js → chunk-G5JQLUUO.js} +2 -2
  88. package/dist/cli/chunks/{chunk-4BFCLSDN.js → chunk-G6LR7FK7.js} +2 -2
  89. package/dist/cli/chunks/{chunk-QEVX4GWF.js → chunk-G6RKUEGL.js} +2 -2
  90. package/dist/cli/chunks/{chunk-HWBMYR5W.js → chunk-GCF42L7M.js} +5 -5
  91. package/dist/cli/chunks/{chunk-TSWF3AGQ.js → chunk-GGMQOEZZ.js} +2 -2
  92. package/dist/cli/chunks/{chunk-PFWJQPUC.js → chunk-HAEUPIKW.js} +2 -2
  93. package/dist/cli/chunks/{chunk-63QUN3JK.js → chunk-HDJMD6UH.js} +1 -1
  94. package/dist/cli/chunks/{chunk-JPENUVCI.js → chunk-HW62TB4T.js} +1 -1
  95. package/dist/cli/chunks/{chunk-WMIRAD3J.js → chunk-I6WHYRWB.js} +2 -2
  96. package/dist/cli/chunks/{chunk-YZ5EQR37.js → chunk-ICK3B24H.js} +2 -2
  97. package/dist/cli/chunks/{chunk-FRFVN6AA.js → chunk-IDLNLSQI.js} +2 -2
  98. package/dist/cli/chunks/{chunk-VQU7DMEY.js → chunk-IJUYHIKN.js} +2 -2
  99. package/dist/cli/chunks/{chunk-6JUOH6L4.js → chunk-IKVNYK7Y.js} +2 -2
  100. package/dist/cli/chunks/{chunk-ZKCKOQJI.js → chunk-JOBCMNTP.js} +2 -2
  101. package/dist/cli/chunks/{chunk-ARPBG6FQ.js → chunk-JYX7AZHE.js} +2 -2
  102. package/dist/cli/chunks/{chunk-SFDUT5WM.js → chunk-JYXSVSH2.js} +2 -2
  103. package/dist/cli/chunks/{chunk-VJGHRWMH.js → chunk-K5SN66B4.js} +2 -2
  104. package/dist/cli/chunks/{chunk-DNOU2HVQ.js → chunk-KDLYTJ5C.js} +2 -2
  105. package/dist/cli/chunks/{chunk-T76RFXQX.js → chunk-KI5BP4X5.js} +2 -2
  106. package/dist/cli/chunks/{chunk-7AWK43JN.js → chunk-KJWQ7ENF.js} +2 -2
  107. package/dist/cli/chunks/{chunk-BRLUNIR4.js → chunk-KN5GOEYK.js} +2 -2
  108. package/dist/cli/chunks/{chunk-VKJQAKYG.js → chunk-KZ37VHMJ.js} +2 -2
  109. package/dist/cli/chunks/{chunk-NV3TXXOW.js → chunk-KZMRU7DL.js} +2 -2
  110. package/dist/cli/chunks/{chunk-LLUPRGOR.js → chunk-L5ZLOW3K.js} +2 -2
  111. package/dist/cli/chunks/{chunk-THKZVOZV.js → chunk-LMJUQWR7.js} +1 -1
  112. package/dist/cli/chunks/{chunk-2KNFS3L5.js → chunk-MBF3Q7FQ.js} +1 -1
  113. package/dist/cli/chunks/chunk-MDT3LIXS.js +2 -0
  114. package/dist/cli/chunks/{chunk-B5XUWHKQ.js → chunk-MJPYNGZ7.js} +1 -1
  115. package/dist/cli/chunks/{chunk-UCYTY4LG.js → chunk-MK3J7JVZ.js} +2 -2
  116. package/dist/cli/chunks/{chunk-MCT4CD5M.js → chunk-MUAHFGIX.js} +2 -2
  117. package/dist/cli/chunks/{chunk-3SBUL72V.js → chunk-MUV56BPK.js} +2 -2
  118. package/dist/cli/chunks/{chunk-WNMDWP5A.js → chunk-NLHISTL2.js} +2 -2
  119. package/dist/cli/chunks/{chunk-UJMTKXPI.js → chunk-NNGCUJWQ.js} +2 -2
  120. package/dist/cli/chunks/chunk-NW7G57NR.js +27 -0
  121. package/dist/cli/chunks/{chunk-3SRPFBU7.js → chunk-O3C5RRDQ.js} +3 -3
  122. package/dist/cli/chunks/{chunk-AYGEWPN4.js → chunk-OHSVDMF7.js} +1 -1
  123. package/dist/cli/chunks/{chunk-AJXGGTX7.js → chunk-OPIWFXME.js} +1 -1
  124. package/dist/cli/chunks/{chunk-ZSBJNE35.js → chunk-P52YORQG.js} +2 -2
  125. package/dist/cli/chunks/chunk-PM566XEO.js +2 -0
  126. package/dist/cli/chunks/chunk-POKMJTD2.js +2 -0
  127. package/dist/cli/chunks/{chunk-GOQ4P2PB.js → chunk-PQMLIVGV.js} +2 -2
  128. package/dist/cli/chunks/{chunk-IB3ZPLFA.js → chunk-PT3FTGKZ.js} +2 -2
  129. package/dist/cli/chunks/{chunk-U3AVZGQA.js → chunk-Q5YRPS4P.js} +1 -1
  130. package/dist/cli/chunks/{chunk-5Z4FBCBK.js → chunk-QJ6H2HQQ.js} +1 -1
  131. package/dist/cli/chunks/{chunk-DRMHVY4T.js → chunk-RG552ROA.js} +4 -4
  132. package/dist/cli/chunks/{chunk-PEIQDQXN.js → chunk-RHC7TFPU.js} +2 -2
  133. package/dist/cli/chunks/{chunk-JNQN5DNS.js → chunk-RMFRFING.js} +1 -1
  134. package/dist/cli/chunks/{chunk-4YT5YN5G.js → chunk-RQN4HWGV.js} +2 -2
  135. package/dist/cli/chunks/{chunk-5P7Q5YNC.js → chunk-RYUSZ43T.js} +1 -1
  136. package/dist/cli/chunks/{chunk-O5NEJIHB.js → chunk-RZDNCTOA.js} +2 -2
  137. package/dist/cli/chunks/chunk-SCMXIBI7.js +2 -0
  138. package/dist/cli/chunks/{chunk-6545AS2J.js → chunk-SPEUF7ZL.js} +2 -2
  139. package/dist/cli/chunks/{chunk-LW5DHT3Z.js → chunk-SSXAW3ER.js} +2 -2
  140. package/dist/cli/chunks/{chunk-Q7ORVHJB.js → chunk-TC2JE5OK.js} +3 -3
  141. package/dist/cli/chunks/{chunk-MALOUGSF.js → chunk-TED4KOSK.js} +2 -2
  142. package/dist/cli/chunks/{chunk-ICCTQ5LO.js → chunk-TJ6N4CCX.js} +2 -2
  143. package/dist/cli/chunks/{chunk-6GYGAW53.js → chunk-TJEJ4UVX.js} +2 -2
  144. package/dist/cli/chunks/{chunk-VO6YJGB4.js → chunk-TO5PQSDD.js} +2 -2
  145. package/dist/cli/chunks/{chunk-LKURMUBU.js → chunk-TR5GOGH3.js} +37 -12
  146. package/dist/cli/chunks/{chunk-JCTCM6IR.js → chunk-UGJQJSPB.js} +1 -1
  147. package/dist/cli/chunks/{chunk-4RHNPRAP.js → chunk-USB44IHJ.js} +2 -2
  148. package/dist/cli/chunks/{chunk-JDFPAJGB.js → chunk-UUOXV3NS.js} +92 -92
  149. package/dist/cli/chunks/chunk-UVVKFBF7.js +2 -0
  150. package/dist/cli/chunks/{chunk-VCUCD3B5.js → chunk-V2MD5EDD.js} +2 -2
  151. package/dist/cli/chunks/{chunk-RFQBDMAP.js → chunk-VA7TEOPM.js} +1 -1
  152. package/dist/cli/chunks/{chunk-IF3HPQNV.js → chunk-VMP4M5PB.js} +1 -1
  153. package/dist/cli/chunks/{chunk-KUZMVH6N.js → chunk-VS4GMNJK.js} +3 -3
  154. package/dist/cli/chunks/{chunk-ZYZT2CDX.js → chunk-VWJSWXHG.js} +1 -1
  155. package/dist/cli/chunks/{chunk-54B6P2WS.js → chunk-VZ67ZDB3.js} +3 -3
  156. package/dist/cli/chunks/{chunk-NSPCZPTB.js → chunk-W2OMW6UU.js} +2 -2
  157. package/dist/cli/chunks/{chunk-3SKIZDKL.js → chunk-W766S4SK.js} +1 -1
  158. package/dist/cli/chunks/{chunk-N2BJN6AO.js → chunk-WJYTLRA5.js} +3 -3
  159. package/dist/cli/chunks/{chunk-X64BEXUY.js → chunk-WNASEUBW.js} +117 -113
  160. package/dist/cli/chunks/{chunk-HT6WAYIR.js → chunk-WT4ZDDFM.js} +1 -1
  161. package/dist/cli/chunks/chunk-XEYW3V5I.js +2 -0
  162. package/dist/cli/chunks/{chunk-6W3QHS45.js → chunk-XIFPIVZI.js} +2 -2
  163. package/dist/cli/chunks/{chunk-3E7D3A35.js → chunk-Y2MCIIJD.js} +1 -1
  164. package/dist/cli/chunks/{chunk-YUHM72VQ.js → chunk-YKOTOCO6.js} +2 -2
  165. package/dist/cli/chunks/{chunk-YKSWC7I4.js → chunk-Z3W3R4CW.js} +8 -20
  166. package/dist/cli/chunks/chunk-ZT2WHCVM.js +2 -0
  167. package/dist/cli/chunks/{chunk-G3TFNY4T.js → chunk-ZVPAFX4I.js} +2 -2
  168. package/dist/cli/chunks/{chunk-NFJT7XXR.js → chunk-ZWC6CM4R.js} +1 -1
  169. package/dist/cli/chunks/{ci-HQCRSCC7.js → ci-RJH5LAL3.js} +2 -2
  170. package/dist/cli/chunks/{ci-output-YBVXLA6O.js → ci-output-62SGMGB2.js} +2 -2
  171. package/dist/cli/chunks/{circuit-breaker-ULGMF2QN.js → circuit-breaker-QXTS5ZAW.js} +2 -2
  172. package/dist/cli/chunks/{claude-flow-setup-MKZ2LJXK.js → claude-flow-setup-BBCCT5WV.js} +2 -2
  173. package/dist/cli/chunks/client-E2XUBCLK.js +2 -0
  174. package/dist/cli/chunks/{cline-installer-WZQ6XBWN.js → cline-installer-IZCUJJ3I.js} +2 -2
  175. package/dist/cli/chunks/{code-H3KGH45S.js → code-AWNVOZ7S.js} +2 -2
  176. package/dist/cli/chunks/{code-index-extractor-NUVEAJ7C.js → code-index-extractor-MX65BKMI.js} +2 -2
  177. package/dist/cli/chunks/{codex-installer-JQI6E6CV.js → codex-installer-EQT6JVLM.js} +2 -2
  178. package/dist/cli/chunks/{completions-NDF4PFE7.js → completions-WOJAM45W.js} +2 -2
  179. package/dist/cli/chunks/{complexity-analyzer-XCZH66HG.js → complexity-analyzer-3DJB7V3K.js} +2 -2
  180. package/dist/cli/chunks/{continuedev-installer-Z4AJGZ7S.js → continuedev-installer-P4KWUTCJ.js} +2 -2
  181. package/dist/cli/chunks/{copilot-installer-K4IPAL7C.js → copilot-installer-FFZWTMWQ.js} +2 -2
  182. package/dist/cli/chunks/core-handlers-46Z5VOO6.js +2 -0
  183. package/dist/cli/chunks/{cost-tracker-35KXAB23.js → cost-tracker-CYBOV3NI.js} +2 -2
  184. package/dist/cli/chunks/{coverage-QW5I4TYZ.js → coverage-GTZJBSC4.js} +3 -3
  185. package/dist/cli/chunks/cross-domain-router-SXQ3HFRY.js +2 -0
  186. package/dist/cli/chunks/{cursor-installer-P4Z7RMIZ.js → cursor-installer-WZIVXGGB.js} +2 -2
  187. package/dist/cli/chunks/daemon-JWMHEJEN.js +10 -0
  188. package/dist/cli/chunks/{daemon-WQWTCYBM.js → daemon-MSFN2LXY.js} +3 -3
  189. package/dist/cli/chunks/{dag-attention-scheduler-7XD2VGON.js → dag-attention-scheduler-4TWOTTQE.js} +2 -2
  190. package/dist/cli/chunks/{detect-GZ3P4DI7.js → detect-YZ6AGQPB.js} +2 -2
  191. package/dist/cli/chunks/{dist-node-6WWAW7OP.js → dist-node-3EM2XH54.js} +2 -2
  192. package/dist/cli/chunks/{domain-handler-3GTLWARQ.js → domain-handler-4XU5BINU.js} +2 -2
  193. package/dist/cli/chunks/domain-transfer-HUFC7I52.js +2 -0
  194. package/dist/cli/chunks/dream-R6MQQQ3N.js +2 -0
  195. package/dist/cli/chunks/{embed-and-insert-pattern-BGIMA77V.js → embed-and-insert-pattern-J5ZFM6YX.js} +2 -2
  196. package/dist/cli/chunks/{eval-SXV6DRDD.js → eval-XYOA3EH2.js} +2 -2
  197. package/dist/cli/chunks/{experience-capture-middleware-TT6WCT2S.js → experience-capture-middleware-E3RYQB6Z.js} +3 -3
  198. package/dist/cli/chunks/{fast-paths-HTAZHEQP.js → fast-paths-DKIYN2YS.js} +2 -2
  199. package/dist/cli/chunks/{feature-flags-DIE3Z2B4.js → feature-flags-S2RNZATS.js} +2 -2
  200. package/dist/cli/chunks/{feature-flags-WBUKU54W.js → feature-flags-ZB63Z7N5.js} +2 -2
  201. package/dist/cli/chunks/{file-discovery-SKDETFS3.js → file-discovery-USJJLYQU.js} +2 -2
  202. package/dist/cli/chunks/{fleet-WCWEPAVU.js → fleet-4MUPHSF5.js} +4 -4
  203. package/dist/cli/chunks/{gnn-wrapper-KWZOWBYS.js → gnn-wrapper-PYOQZKX6.js} +2 -2
  204. package/dist/cli/chunks/{heartbeat-handler-3AGYHVG2.js → heartbeat-handler-HLO5XCG7.js} +4 -4
  205. package/dist/cli/chunks/heartbeat-scheduler-OSDPJT6A.js +2 -0
  206. package/dist/cli/chunks/hnsw-adapter-KMGSHBIN.js +2 -0
  207. package/dist/cli/chunks/hnsw-index-IMFRAOPE.js +2 -0
  208. package/dist/cli/chunks/{hnsw-legacy-bridge-6OJJDZHL.js → hnsw-legacy-bridge-FZEH2KLM.js} +2 -2
  209. package/dist/cli/chunks/{better-sqlite3-URULPKRF.js → hnswlib-node-VS6L5VUG.js} +2 -2
  210. package/dist/cli/chunks/{hooks-OXEBTLXV.js → hooks-R2757K57.js} +48 -52
  211. package/dist/cli/chunks/hybrid-router-57QSWSWC.js +2 -0
  212. package/dist/cli/chunks/{hypergraph-engine-NL74PRHD.js → hypergraph-engine-EAV3GJ5D.js} +2 -2
  213. package/dist/cli/chunks/{hypergraph-handler-KZ54AEEL.js → hypergraph-handler-5ERXAVGH.js} +3 -3
  214. package/dist/cli/chunks/impact-analyzer-OC4MPBGA.js +2 -0
  215. package/dist/cli/chunks/{init-handler-XKZXRXPG.js → init-handler-RXUSEMG7.js} +6 -6
  216. package/dist/cli/chunks/init-wizard-CDBRL4PO.js +2 -0
  217. package/dist/cli/chunks/kernel-CQ7R3AAV.js +2 -0
  218. package/dist/cli/chunks/{kilocode-installer-WISQMJK7.js → kilocode-installer-ZUBVBHGT.js} +2 -2
  219. package/dist/cli/chunks/{kiro-installer-O7TBB3GM.js → kiro-installer-TRTRQDGL.js} +2 -2
  220. package/dist/cli/chunks/knowledge-graph-UXNH7RY4.js +2 -0
  221. package/dist/cli/chunks/{learning-6IZBGVRU.js → learning-UYXWAU5D.js} +3 -3
  222. package/dist/cli/chunks/{llm-router-QDMQPPQ7.js → llm-router-TB5OJPEV.js} +4 -4
  223. package/dist/cli/chunks/llm-router-service-UV34YXBE.js +2 -0
  224. package/dist/cli/chunks/{load-KLAJJGL5.js → load-ELPSUIPV.js} +2 -2
  225. package/dist/cli/chunks/load-test-2VEN3PQZ.js +2 -0
  226. package/dist/cli/chunks/{mcp-SZOPQZIZ.js → mcp-UX7TK3XV.js} +2 -2
  227. package/dist/cli/chunks/{memory-G3WY74C6.js → memory-W3LG6H6N.js} +5 -5
  228. package/dist/cli/chunks/memory-backend-TZL5U6F3.js +2 -0
  229. package/dist/cli/chunks/memory-handlers-BNXAYS2P.js +2 -0
  230. package/dist/cli/chunks/{multi-model-executor-TDNQGTOT.js → multi-model-executor-227LWZRY.js} +2 -2
  231. package/dist/cli/chunks/{opencode-installer-NGYGEDMV.js → opencode-installer-F4WKVWDL.js} +2 -2
  232. package/dist/cli/chunks/{orchestrator-KPI5DY2C.js → orchestrator-V4DBMGK6.js} +5 -5
  233. package/dist/cli/chunks/pattern-null-store-KLX2RNHM.js +2 -0
  234. package/dist/cli/chunks/pattern-usage-recorder-BY3HEWSU.js +2 -0
  235. package/dist/cli/chunks/{pipeline-CSDCC675.js → pipeline-3F5RIESX.js} +2 -2
  236. package/dist/cli/chunks/{platform-Q5XKEVKH.js → platform-KCGXTZO3.js} +2 -2
  237. package/dist/cli/chunks/{plugin-XKKR3GVL.js → plugin-2H552KOV.js} +2 -2
  238. package/dist/cli/chunks/{prime-radiant-advanced-wasm-22QVNKEN.js → prime-radiant-advanced-wasm-EFKVL7VN.js} +2 -2
  239. package/dist/cli/chunks/protocol-executor-5HJKW6MC.js +2 -0
  240. package/dist/cli/chunks/{protocol-handler-REQKTJGG.js → protocol-handler-ELGYV7D2.js} +2 -2
  241. package/dist/cli/chunks/{prove-NOFUFSQN.js → prove-AYJCQYNI.js} +2 -2
  242. package/dist/cli/chunks/provider-manager-TRZSBXD3.js +2 -0
  243. package/dist/cli/chunks/qe-reasoning-bank-RCEYSLVV.js +2 -0
  244. package/dist/cli/chunks/{quality-3DQ2H5TK.js → quality-HH7L5A7V.js} +2 -2
  245. package/dist/cli/chunks/quality-gate-NAQLXE4C.js +7 -0
  246. package/dist/cli/chunks/queen-coordinator-6JFZD54W.js +2 -0
  247. package/dist/cli/chunks/{real-embeddings-FCGNYWLL.js → real-embeddings-IO3F4ZFR.js} +2 -2
  248. package/dist/cli/chunks/{roocode-installer-HX3CNRIR.js → roocode-installer-X4TU5HO4.js} +2 -2
  249. package/dist/cli/chunks/router-KRLC46NS.js +2 -0
  250. package/dist/cli/chunks/routing-feedback-WW26H6SA.js +2 -0
  251. package/dist/cli/chunks/{routing-handler-YRZ2LDCR.js → routing-handler-ZJKGDDMT.js} +2 -2
  252. package/dist/cli/chunks/{ruvector-commands-GCQVBJ4E.js → ruvector-commands-NXCSUBN2.js} +2 -2
  253. package/dist/cli/chunks/{rvf-dual-writer-B562P3ZC.js → rvf-dual-writer-JMA74SKP.js} +2 -2
  254. package/dist/cli/chunks/{rvf-migration-adapter-NAGFKCMD.js → rvf-migration-adapter-BNTGH2KU.js} +2 -2
  255. package/dist/cli/chunks/{rvf-migration-coordinator-WWFBEJ5Q.js → rvf-migration-coordinator-7T2HHUOH.js} +2 -2
  256. package/dist/cli/chunks/rvf-native-adapter-OVQKPQUH.js +2 -0
  257. package/dist/cli/chunks/safe-db-UQOCQIH2.js +2 -0
  258. package/dist/cli/chunks/schedule-EUX7ZQUK.js +2 -0
  259. package/dist/cli/chunks/scheduler-MALHQKNR.js +2 -0
  260. package/dist/cli/chunks/{security-IFOYTD75.js → security-XSK2QHB3.js} +3 -3
  261. package/dist/cli/chunks/{shared-rvf-adapter-TYD5TQ35.js → shared-rvf-adapter-WLRKI7RY.js} +2 -2
  262. package/dist/cli/chunks/{shared-rvf-dual-writer-YGOOVDQZ.js → shared-rvf-dual-writer-SZW3J7ZK.js} +2 -2
  263. package/dist/cli/chunks/sqlite-persistence-OBCLRP4L.js +2 -0
  264. package/dist/cli/chunks/status-handler-HGCKYJX2.js +46 -0
  265. package/dist/cli/chunks/{structural-health-KZI6YMKV.js → structural-health-4SJCFX63.js} +2 -2
  266. package/dist/cli/chunks/{sync-Z5BDDBMK.js → sync-7WAVNZGL.js} +2 -2
  267. package/dist/cli/chunks/{sync-ABZNNYRC.js → sync-ATR4DUSA.js} +2 -2
  268. package/dist/cli/chunks/{task-handler-5ACZEPJ7.js → task-handler-O6REL34Y.js} +2 -2
  269. package/dist/cli/chunks/{task-handlers-UZWDPL6A.js → task-handlers-WFV2ZYWW.js} +3 -3
  270. package/dist/cli/chunks/{test-APO3MCVV.js → test-4LXUVHEU.js} +4 -4
  271. package/dist/cli/chunks/{test-scheduling-EFZA5G5C.js → test-scheduling-OTN3DMKY.js} +3 -3
  272. package/dist/cli/chunks/{token-bootstrap-J2OPLNUK.js → token-bootstrap-VA7T4P42.js} +2 -2
  273. package/dist/cli/chunks/{token-usage-VHWVNN4R.js → token-usage-TLT6OXXR.js} +2 -2
  274. package/dist/cli/chunks/{transformers-PX4HPO75.js → transformers-JI7LZRQ3.js} +2 -2
  275. package/dist/cli/chunks/{tree-sitter-wasm-parser-44HA2Z3F.js → tree-sitter-wasm-parser-QNIMHB4K.js} +2 -2
  276. package/dist/cli/chunks/{types-IMOP7F4R.js → types-DJNWOAC6.js} +2 -2
  277. package/dist/cli/chunks/unified-memory-A5BS3LGX.js +2 -0
  278. package/dist/cli/chunks/unified-memory-hnsw-WJLJO5MY.js +2 -0
  279. package/dist/cli/chunks/unified-persistence-CFC2BKI5.js +2 -0
  280. package/dist/cli/chunks/{upgrade-OZ3O6ZZI.js → upgrade-VEW4FL23.js} +2 -2
  281. package/dist/cli/chunks/{validate-DRY5BMWX.js → validate-O3P6PF7B.js} +2 -2
  282. package/dist/cli/chunks/{validate-swarm-QD3LYPUF.js → validate-swarm-M2HXHZVC.js} +2 -2
  283. package/dist/cli/chunks/{vibium-2J3H2ITD.js → vibium-GOU55LUO.js} +2 -2
  284. package/dist/cli/chunks/visual-security-VPB6KVYJ.js +2 -0
  285. package/dist/cli/chunks/{web-tree-sitter-KRNUOGKI.js → web-tree-sitter-MXOI4GH3.js} +2 -2
  286. package/dist/cli/chunks/{windsurf-installer-PQIPH3WP.js → windsurf-installer-6GKT53IH.js} +2 -2
  287. package/dist/cli/chunks/{witness-chain-HPLOYPS7.js → witness-chain-OXGQGL26.js} +2 -2
  288. package/dist/cli/chunks/witness-chain-ZZAUAXDY.js +2 -0
  289. package/dist/cli/chunks/witness-key-manager-PGFSQXUJ.js +2 -0
  290. package/dist/cli/chunks/{workflow-OAQ3FWCY.js → workflow-ENBWRMBA.js} +4 -4
  291. package/dist/cli/chunks/workflow-orchestrator-S4LBFTYD.js +2 -0
  292. package/dist/cli/chunks/{wrappers-UPIU6S5S.js → wrappers-MHLNYANQ.js} +2 -2
  293. package/dist/cli/commands/audit.d.ts +12 -0
  294. package/dist/cli/commands/audit.js +64 -4
  295. package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +45 -19
  296. package/dist/cli/commands/hooks-handlers/hooks-shared.d.ts +13 -0
  297. package/dist/cli/commands/hooks-handlers/hooks-shared.js +38 -0
  298. package/dist/cli/commands/hooks-handlers/task-hooks.js +19 -1
  299. package/dist/cli/commands/quality-gate.d.ts +24 -0
  300. package/dist/cli/commands/quality-gate.js +135 -0
  301. package/dist/cli/handlers/status-handler.d.ts +18 -0
  302. package/dist/cli/handlers/status-handler.js +47 -0
  303. package/dist/cli/index.js +5 -0
  304. package/dist/coordination/mincut/dream-integration.d.ts +11 -0
  305. package/dist/coordination/mincut/dream-integration.js +39 -12
  306. package/dist/coordination/mincut/queen-integration.js +24 -7
  307. package/dist/coordination/protocol-executor.js +2 -1
  308. package/dist/coordination/queen-lifecycle.js +4 -1
  309. package/dist/domains/code-intelligence/coordinator.js +10 -6
  310. package/dist/domains/code-intelligence/services/product-factors-bridge.js +3 -1
  311. package/dist/domains/defect-intelligence/services/defect-predictor.d.ts +6 -0
  312. package/dist/domains/defect-intelligence/services/defect-predictor.js +21 -0
  313. package/dist/domains/learning-optimization/interfaces.d.ts +7 -0
  314. package/dist/domains/learning-optimization/plugin.js +5 -0
  315. package/dist/domains/learning-optimization/services/learning-coordinator.d.ts +10 -0
  316. package/dist/domains/learning-optimization/services/learning-coordinator.js +57 -0
  317. package/dist/domains/test-execution/plugin.js +2 -2
  318. package/dist/domains/test-execution/services/flaky-detector.js +1 -1
  319. package/dist/domains/test-generation/coordinator.js +22 -8
  320. package/dist/domains/test-generation/interfaces.d.ts +3 -0
  321. package/dist/domains/test-generation/services/test-generator.js +9 -1
  322. package/dist/integrations/ruvector/delta-tracker.js +10 -1
  323. package/dist/integrations/ruvector/feature-flags.js +7 -0
  324. package/dist/integrations/ruvector/sona-persistence.d.ts +24 -0
  325. package/dist/integrations/ruvector/sona-persistence.js +76 -0
  326. package/dist/integrations/ruvector/sona-three-loop.d.ts +15 -0
  327. package/dist/integrations/ruvector/sona-three-loop.js +17 -0
  328. package/dist/kernel/unified-memory-schemas.d.ts +2 -2
  329. package/dist/kernel/unified-memory-schemas.js +48 -2
  330. package/dist/kernel/unified-memory.d.ts +22 -0
  331. package/dist/kernel/unified-memory.js +43 -0
  332. package/dist/learning/aqe-learning-engine.js +3 -1
  333. package/dist/learning/dream/concept-graph.d.ts +31 -1
  334. package/dist/learning/dream/concept-graph.js +109 -3
  335. package/dist/learning/dream/dream-engine.d.ts +13 -1
  336. package/dist/learning/dream/dream-engine.js +146 -10
  337. package/dist/learning/dream/index.d.ts +1 -1
  338. package/dist/learning/dream/types.d.ts +23 -0
  339. package/dist/learning/pattern-lifecycle.d.ts +16 -0
  340. package/dist/learning/pattern-lifecycle.js +77 -1
  341. package/dist/learning/pattern-store.d.ts +2 -2
  342. package/dist/learning/pattern-store.js +14 -3
  343. package/dist/learning/provenance-tier.d.ts +52 -0
  344. package/dist/learning/provenance-tier.js +64 -0
  345. package/dist/learning/qe-flywheel/corpus-scorer.d.ts +55 -0
  346. package/dist/learning/qe-flywheel/corpus-scorer.js +293 -0
  347. package/dist/learning/qe-flywheel/coupled-anchor.d.ts +91 -0
  348. package/dist/learning/qe-flywheel/coupled-anchor.js +181 -0
  349. package/dist/learning/qe-flywheel/generation.d.ts +121 -0
  350. package/dist/learning/qe-flywheel/generation.js +167 -0
  351. package/dist/learning/qe-flywheel/policy.d.ts +37 -0
  352. package/dist/learning/qe-flywheel/policy.js +66 -0
  353. package/dist/learning/qe-flywheel/receipt-store.d.ts +31 -0
  354. package/dist/learning/qe-flywheel/receipt-store.js +89 -0
  355. package/dist/learning/qe-flywheel/receipt.d.ts +62 -0
  356. package/dist/learning/qe-flywheel/receipt.js +97 -0
  357. package/dist/learning/qe-reasoning-bank.js +34 -31
  358. package/dist/learning/routing-topology-gate.d.ts +12 -2
  359. package/dist/learning/routing-topology-gate.js +15 -3
  360. package/dist/learning/rvf-pattern-store.d.ts +1 -1
  361. package/dist/learning/rvf-pattern-store.js +21 -8
  362. package/dist/learning/sqlite-persistence.js +12 -9
  363. package/dist/mcp/bundle.js +540 -460
  364. package/dist/mcp/qe-tool-bridge.js +7 -2
  365. package/dist/mcp/tools/base.d.ts +29 -0
  366. package/dist/mcp/tools/base.js +25 -0
  367. package/dist/mcp/tools/coverage-analysis/index.js +6 -4
  368. package/dist/mcp/tools/learning-optimization/dream.d.ts +4 -13
  369. package/dist/mcp/tools/learning-optimization/dream.js +10 -96
  370. package/dist/mcp/tools/planning/goap-execute.d.ts +13 -1
  371. package/dist/mcp/tools/planning/goap-execute.js +33 -18
  372. package/dist/mcp/tools/quality-assessment/gate.d.ts +38 -0
  373. package/dist/mcp/tools/quality-assessment/gate.js +86 -0
  374. package/dist/mcp/tools/registry.d.ts +1 -0
  375. package/dist/mcp/tools/registry.js +10 -2
  376. package/dist/persistence/rvf-migration-coordinator.js +2 -1
  377. package/dist/planning/actions/qe-action-library.js +124 -1
  378. package/dist/planning/goap-planner.d.ts +14 -2
  379. package/dist/planning/goap-planner.js +51 -9
  380. package/dist/planning/index.d.ts +1 -1
  381. package/dist/planning/plan-executor.d.ts +84 -4
  382. package/dist/planning/plan-executor.js +221 -56
  383. package/dist/planning/types.d.ts +27 -0
  384. package/dist/shared/events/domain-events.d.ts +2 -0
  385. package/dist/shared/safe-db.js +23 -4
  386. package/dist/validation/anchor-set.d.ts +74 -0
  387. package/dist/validation/anchor-set.js +78 -0
  388. package/dist/validation/frontier-judge.d.ts +99 -0
  389. package/dist/validation/frontier-judge.js +234 -0
  390. package/dist/validation/gate-reexecute.d.ts +165 -0
  391. package/dist/validation/gate-reexecute.js +255 -0
  392. package/dist/validation/quality-gate-runner.d.ts +49 -0
  393. package/dist/validation/quality-gate-runner.js +62 -0
  394. package/dist/validation/quality-verdict.d.ts +94 -0
  395. package/dist/validation/quality-verdict.js +120 -0
  396. package/dist/workers/workers/learning-consolidation.js +21 -1
  397. package/package.json +1 -1
  398. package/dist/cli/chunks/adapter-2HMUXHWY.js +0 -2
  399. package/dist/cli/chunks/aqe-learning-engine-M2NKRVRE.js +0 -2
  400. package/dist/cli/chunks/audit-EPB7ETMT.js +0 -3
  401. package/dist/cli/chunks/base-CCHC2DAC.js +0 -2
  402. package/dist/cli/chunks/brain-handler-FBMYEERK.js +0 -89
  403. package/dist/cli/chunks/browser-workflow-4DGHFYY3.js +0 -2
  404. package/dist/cli/chunks/chunk-37ZDGJ3H.js +0 -2
  405. package/dist/cli/chunks/chunk-5AQ7FXYG.js +0 -27
  406. package/dist/cli/chunks/chunk-KYTFIP6R.js +0 -2
  407. package/dist/cli/chunks/chunk-MYMIEQSZ.js +0 -65
  408. package/dist/cli/chunks/chunk-RCPD6F4R.js +0 -2
  409. package/dist/cli/chunks/chunk-TCWR6TDN.js +0 -2
  410. package/dist/cli/chunks/chunk-UQ72K44T.js +0 -149
  411. package/dist/cli/chunks/chunk-XXRTWG7O.js +0 -2
  412. package/dist/cli/chunks/chunk-ZSA6V5FH.js +0 -2
  413. package/dist/cli/chunks/client-2OVEDWGU.js +0 -2
  414. package/dist/cli/chunks/core-handlers-UXRRYP52.js +0 -2
  415. package/dist/cli/chunks/cross-domain-router-PV3VQVLO.js +0 -2
  416. package/dist/cli/chunks/daemon-ESUEM6VB.js +0 -10
  417. package/dist/cli/chunks/domain-transfer-TQYO3SVG.js +0 -2
  418. package/dist/cli/chunks/dream-UFUXVJQC.js +0 -2
  419. package/dist/cli/chunks/heartbeat-scheduler-MBG3SARO.js +0 -2
  420. package/dist/cli/chunks/hnsw-adapter-5HXA3QB3.js +0 -2
  421. package/dist/cli/chunks/hnsw-index-PZRQWBRG.js +0 -2
  422. package/dist/cli/chunks/hybrid-router-NQRIE2GG.js +0 -2
  423. package/dist/cli/chunks/impact-analyzer-46347ZDV.js +0 -2
  424. package/dist/cli/chunks/init-wizard-CJYP4WKO.js +0 -2
  425. package/dist/cli/chunks/kernel-22KQZ56U.js +0 -2
  426. package/dist/cli/chunks/knowledge-graph-KM3JDBGR.js +0 -2
  427. package/dist/cli/chunks/llm-router-service-IFO6GRRO.js +0 -2
  428. package/dist/cli/chunks/load-test-TTKCYAPB.js +0 -2
  429. package/dist/cli/chunks/memory-backend-ELHCX2ZT.js +0 -2
  430. package/dist/cli/chunks/memory-handlers-3SKYQZTL.js +0 -2
  431. package/dist/cli/chunks/pattern-null-store-TMXAYD43.js +0 -2
  432. package/dist/cli/chunks/protocol-executor-BPLR5EJC.js +0 -2
  433. package/dist/cli/chunks/provider-manager-4MMD5QKL.js +0 -2
  434. package/dist/cli/chunks/qe-reasoning-bank-P7KNT3WZ.js +0 -2
  435. package/dist/cli/chunks/queen-coordinator-NBZZ4MGC.js +0 -2
  436. package/dist/cli/chunks/router-2RXR6J2Q.js +0 -2
  437. package/dist/cli/chunks/routing-feedback-AVAA76TK.js +0 -2
  438. package/dist/cli/chunks/rvf-native-adapter-X2YDJA55.js +0 -2
  439. package/dist/cli/chunks/safe-db-4PRU65BK.js +0 -2
  440. package/dist/cli/chunks/schedule-2AST5CHW.js +0 -2
  441. package/dist/cli/chunks/scheduler-SW6II7OU.js +0 -2
  442. package/dist/cli/chunks/sqlite-persistence-OB5NEGAK.js +0 -2
  443. package/dist/cli/chunks/status-handler-HFPWSCBY.js +0 -45
  444. package/dist/cli/chunks/unified-memory-X7OJYGSD.js +0 -2
  445. package/dist/cli/chunks/unified-memory-hnsw-O6HOD5YL.js +0 -2
  446. package/dist/cli/chunks/unified-persistence-C332CER2.js +0 -2
  447. package/dist/cli/chunks/visual-security-MPUG5HPI.js +0 -2
  448. package/dist/cli/chunks/witness-chain-Q4BZHPDF.js +0 -2
  449. package/dist/cli/chunks/workflow-orchestrator-4NDWECYK.js +0 -2
@@ -0,0 +1 @@
1
+ 3.25.4
@@ -27,10 +27,23 @@ const CYAN = '\x1b[0;36m';
27
27
  const DIM = '\x1b[2m';
28
28
  const RESET = '\x1b[0m';
29
29
 
30
+ const YELLOW = '\x1b[0;33m';
30
31
  const log = (msg) => console.log(`${CYAN}[AutoMemory] ${msg}${RESET}`);
31
32
  const success = (msg) => console.log(`${GREEN}[AutoMemory] ✓ ${msg}${RESET}`);
32
33
  const dim = (msg) => console.log(` ${DIM}${msg}${RESET}`);
33
34
 
35
+ // #2545: fail LOUD instead of a silent dim skip. When @claude-flow/memory cannot
36
+ // be resolved, self-learning imports are a no-op — the user must see this and be
37
+ // told exactly how to fix it (on both stdout, so it shows in the Claude Code hook
38
+ // transcript, and stderr, per the issue's requested channel).
39
+ function warnMemoryUnavailable() {
40
+ const line1 = `[AutoMemory] @claude-flow/memory not resolvable from ${PROJECT_ROOT} — self-learning imports are DISABLED.`;
41
+ const line2 = ' Fix: npm i -D @claude-flow/memory (or re-run: npx ruflo@latest init, then npx ruflo@latest doctor --fix)';
42
+ console.log(`${YELLOW}${line1}${RESET}`);
43
+ console.log(`${YELLOW}${line2}${RESET}`);
44
+ process.stderr.write(`${line1}\n${line2}\n`);
45
+ }
46
+
34
47
  const DEBUG = !!(process.env.RUFLO_DEBUG || process.env.DEBUG);
35
48
 
36
49
  // ── Graceful shutdown (FIX 3) ───────────────────────────────────────────────
@@ -152,6 +165,21 @@ class JsonFileBackend {
152
165
  // ============================================================================
153
166
 
154
167
  async function loadMemoryPackage() {
168
+ // Strategy 0 (#2545): sidecar recorded by `init` / `doctor --fix`. On the
169
+ // documented `npx ruflo` path @claude-flow/memory (an optionalDependency of
170
+ // the CLI) lands in the npx cache, which is NOT on the walk-up path from the
171
+ // project — so init resolves it from the CLI's own context and records the
172
+ // absolute path here. This is the only strategy that works on that install.
173
+ try {
174
+ const sidecar = join(PROJECT_ROOT, '.claude-flow', 'memory-package.json');
175
+ if (existsSync(sidecar)) {
176
+ const rec = JSON.parse(readFileSync(sidecar, 'utf-8'));
177
+ if (rec?.distPath && existsSync(rec.distPath)) {
178
+ return await import(`file://${rec.distPath}`);
179
+ }
180
+ }
181
+ } catch { /* fall through */ }
182
+
155
183
  // Strategy 1: Local dev (built dist)
156
184
  const localDist = join(PROJECT_ROOT, 'v3/@claude-flow/memory/dist/index.js');
157
185
  if (existsSync(localDist)) {
@@ -235,7 +263,7 @@ async function doImport() {
235
263
 
236
264
  const memPkg = await loadMemoryPackage();
237
265
  if (!memPkg || !memPkg.AutoMemoryBridge) {
238
- dim('Memory package not available — skipping auto memory import');
266
+ warnMemoryUnavailable();
239
267
  return;
240
268
  }
241
269
 
@@ -288,7 +316,7 @@ async function doSync() {
288
316
 
289
317
  const memPkg = await loadMemoryPackage();
290
318
  if (!memPkg || !memPkg.AutoMemoryBridge) {
291
- dim('Memory package not available — skipping sync');
319
+ warnMemoryUnavailable();
292
320
  return;
293
321
  }
294
322
 
@@ -346,8 +374,12 @@ async function doStatus() {
346
374
  const memPkg = await loadMemoryPackage();
347
375
  const config = readConfig();
348
376
 
377
+ const sidecar = join(PROJECT_ROOT, '.claude-flow', 'memory-package.json');
378
+ const hasSidecar = existsSync(sidecar);
379
+
349
380
  console.log('\n=== Auto Memory Bridge Status ===\n');
350
- console.log(` Package: ${memPkg ? '✅ Available' : '❌ Not found'}`);
381
+ console.log(` Package: ${memPkg ? '✅ Available' : '❌ Not found — self-learning DISABLED (fix: npm i -D @claude-flow/memory)'}`);
382
+ console.log(` Resolver: ${hasSidecar ? '✅ .claude-flow/memory-package.json' : '⏸ no sidecar (run: npx ruflo@latest doctor --fix)'}`);
351
383
  console.log(` Store: ${existsSync(STORE_PATH) ? '✅ ' + STORE_PATH : '⏸ Not initialized'}`);
352
384
  console.log(` LearningBridge: ${config.learningBridge.enabled ? '✅ Enabled' : '⏸ Disabled'}`);
353
385
  console.log(` MemoryGraph: ${config.memoryGraph.enabled ? '✅ Enabled' : '⏸ Disabled'}`);
@@ -18,6 +18,16 @@ const RVF_PATH = path.join(AQE_DIR, 'aqe.rvf');
18
18
  const DB_PATH = path.join(AQE_DIR, 'memory.db');
19
19
  const MAX_AGE_HOURS = 24;
20
20
 
21
+ // Mount-local kill switch. `brain export` (below) spawns a native RVF writer
22
+ // that, on a macOS Docker virtiofs bind mount, deadlocks in a futex and IGNORES
23
+ // the SIGTERM that execFileSync's timeout sends — so the 60s timeout can't reap
24
+ // it and orphaned exporters pile up (~1.5GB RSS observed 2026-07-08). Disable
25
+ // via env `AQE_DISABLE_BRAIN_CHECKPOINT=1` or a `.agentic-qe/DISABLE_BRAIN_CHECKPOINT`
26
+ // marker file. Opt-in: shipped installs without the flag behave exactly as before.
27
+ const CHECKPOINT_DISABLED =
28
+ process.env.AQE_DISABLE_BRAIN_CHECKPOINT === '1' ||
29
+ fs.existsSync(path.join(AQE_DIR, 'DISABLE_BRAIN_CHECKPOINT'));
30
+
21
31
  function log(msg) { process.stderr.write('[brain-checkpoint] ' + msg + '\n'); }
22
32
 
23
33
  function exportBrain() {
@@ -54,5 +64,10 @@ function verifyBrain() {
54
64
  }
55
65
 
56
66
  const cmd = process.argv[2] || 'verify';
57
- const result = cmd === 'export' ? exportBrain() : verifyBrain();
67
+ let result;
68
+ if (CHECKPOINT_DISABLED) {
69
+ result = { disabled: true, reason: 'brain-checkpoint disabled on this mount' };
70
+ } else {
71
+ result = cmd === 'export' ? exportBrain() : verifyBrain();
72
+ }
58
73
  if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result));
@@ -0,0 +1,12 @@
1
+ {
2
+ "manifest": {
3
+ "version": "3.25.4",
4
+ "files": {
5
+ "auto-memory-hook.mjs": "68be7e9a9eba7bf9c4e8a230db7bf61a243b965639f8504842799d6c6ca28762",
6
+ "hook-handler.cjs": "bc4d2d26823d49b3ab1dded2946b66369f1f67bd76b4c30dca9f3b6df3cca8f0",
7
+ "intelligence.cjs": "bd1f8e4b034944aee1df0391dc47ac2e8cc4b3aa542c65407a59d49620bbf76b"
8
+ }
9
+ },
10
+ "signature": "F3TIRoNcQTCkNeMEk5Isah5CWkV/zddUKR/6pieOlAWoYgI2BEUO7avQj8B8UP4vhvgT9TSgbYsis2UnnnQyBg==",
11
+ "algorithm": "ed25519"
12
+ }
@@ -124,6 +124,25 @@ async function main() {
124
124
  const prompt = hookInput.prompt || hookInput.command || toolInput.command
125
125
  || process.env.PROMPT || process.env.TOOL_INPUT_command || args.join(' ') || '';
126
126
 
127
+ // ADR-174: capture FAILURES so the learning substrate has negative examples.
128
+ // Claude Code's PostToolUse payload carries the tool result; a failed
129
+ // Write/Edit/Bash surfaces as tool_response.is_error / an error string /
130
+ // a non-zero exit code. Conservative — only a positive error signal counts
131
+ // as failure (mirrors isToolFailure() in helpers-generator.ts).
132
+ const toolFailed = (function (hi) {
133
+ if (!hi || typeof hi !== 'object') return false;
134
+ const tr = hi.tool_response != null ? hi.tool_response : (hi.toolResponse != null ? hi.toolResponse : hi.result);
135
+ if (tr == null) return false;
136
+ if (typeof tr === 'string') return /\b(error|failed|failure|exception|not found|no such|permission denied|traceback)\b/i.test(tr);
137
+ if (typeof tr === 'object') {
138
+ if (tr.is_error === true || tr.isError === true || tr.success === false || tr.error != null) return true;
139
+ const code = tr.exit_code != null ? tr.exit_code : (tr.exitCode != null ? tr.exitCode : tr.code);
140
+ if (typeof code === 'number' && code !== 0) return true;
141
+ if (Array.isArray(tr.content) && tr.is_error === true) return true;
142
+ }
143
+ return false;
144
+ })(hookInput);
145
+
127
146
  const handlers = {
128
147
  'route': () => {
129
148
  // Inject ranked intelligence context before routing
@@ -178,10 +197,10 @@ const handlers = {
178
197
  try {
179
198
  const file = hookInput.file_path || toolInput.file_path
180
199
  || process.env.TOOL_INPUT_file_path || args[0] || '';
181
- intelligence.recordEdit(file);
200
+ intelligence.recordEdit(file, !toolFailed);
182
201
  } catch (e) { /* non-fatal */ }
183
202
  }
184
- console.log('[OK] Edit recorded');
203
+ console.log(toolFailed ? '[LEARN] Edit FAILURE recorded' : '[OK] Edit recorded');
185
204
  },
186
205
 
187
206
  'session-restore': async () => {
@@ -246,13 +265,15 @@ const handlers = {
246
265
  },
247
266
 
248
267
  'post-task': () => {
249
- // Implicit success feedback for intelligence
268
+ // ADR-174: feed the REAL outcome (feedback() boosts confidence on success,
269
+ // decays it on failure) instead of a hardcoded true — no more all-positive
270
+ // signal that the substrate can't learn from.
250
271
  if (intelligence && intelligence.feedback) {
251
272
  try {
252
- intelligence.feedback(true);
273
+ intelligence.feedback(!toolFailed);
253
274
  } catch (e) { /* non-fatal */ }
254
275
  }
255
- console.log('[OK] Task completed');
276
+ console.log(toolFailed ? '[LEARN] Task FAILURE recorded' : '[OK] Task completed');
256
277
  },
257
278
 
258
279
  'stats': () => {
@@ -575,15 +575,28 @@ function getContext(prompt) {
575
575
  * recordEdit(file) — Called from post-edit. Budget: <2ms.
576
576
  * Appends to pending-insights.jsonl.
577
577
  */
578
- function recordEdit(file) {
578
+ function recordEdit(file, success) {
579
579
  ensureDataDir();
580
580
  const entry = JSON.stringify({
581
581
  type: 'edit',
582
582
  file: file || 'unknown',
583
+ // ADR-174: record failures too, not just successes — the learning substrate
584
+ // needs negative examples. Defaults true; an explicit false is a failed edit.
585
+ success: success !== false,
583
586
  timestamp: Date.now(),
584
587
  sessionId: sessionGet('sessionId') || null,
585
588
  });
586
589
  fs.appendFileSync(PENDING_PATH, entry + '\n', 'utf-8');
590
+ // Runaway-storage guard: pending-insights is append-only and only drained by
591
+ // consolidation. If it grows past ~512KB (thousands of un-consolidated edits
592
+ // — e.g. the daemon never ran), keep only the most recent 2000 lines so it
593
+ // can never grow unbounded. Cheap (a statSync per edit; rewrite only when over).
594
+ try {
595
+ if (fs.statSync(PENDING_PATH).size > 512 * 1024) {
596
+ const lines = fs.readFileSync(PENDING_PATH, 'utf-8').split('\n').filter(Boolean);
597
+ if (lines.length > 2000) fs.writeFileSync(PENDING_PATH, lines.slice(-2000).join('\n') + '\n', 'utf-8');
598
+ }
599
+ } catch (e) { /* non-fatal */ }
587
600
  }
588
601
 
589
602
  /**
@@ -87,21 +87,24 @@ const FATAL_MARKERS = [
87
87
  'was compiled against a different Node.js version',
88
88
  ];
89
89
 
90
- function recordHookHealth(stderr) {
90
+ // Internal timeout for the spawned bundle process. Kept BELOW the harness's
91
+ // own hook timeout (settings.json) so THIS script observes and logs a stall
92
+ // itself — if the harness timeout fires first, this whole process is killed
93
+ // too and never gets to write the log line. (2026-06-02 postmortem: a 5s
94
+ // harness timeout vs. this shim's own admitted ~30-60s cold start left
95
+ // routing_outcomes writes silently dropped for a month — nothing recorded
96
+ // the mismatch because nothing was watching for it.)
97
+ const SPAWN_TIMEOUT_MS = Number(process.env.AQE_HOOK_TIMEOUT_MS) || 18000;
98
+
99
+ function recordHookHealth(line) {
91
100
  try {
92
- if (!stderr) return;
93
- const hit = FATAL_MARKERS.find((m) => stderr.includes(m));
94
- if (!hit) return;
95
101
  const logPath = path.join(PROJECT, '.agentic-qe', 'hooks-health.log');
96
102
  // Throttle: skip if we logged within the last 5 min (avoid a line/turn).
97
103
  try {
98
104
  const st = fs.statSync(logPath);
99
105
  if (Date.now() - st.mtimeMs < 5 * 60 * 1000) return;
100
106
  } catch { /* no log yet — fall through and create it */ }
101
- const subcmd = args[0] || 'unknown';
102
- const line = `[${new Date().toISOString()}] FATAL hook persistence failure `
103
- + `(cmd=${subcmd}): "${hit}". Learning is NOT being captured. `
104
- + `Fix: \`npm rebuild better-sqlite3\` (host/container native-binary mismatch).\n`;
107
+ fs.mkdirSync(path.dirname(logPath), { recursive: true });
105
108
  fs.appendFileSync(logPath, line);
106
109
  } catch { /* health logging must never block a turn */ }
107
110
  }
@@ -109,12 +112,56 @@ function recordHookHealth(stderr) {
109
112
  let out = '';
110
113
  try {
111
114
  const res = spawnSync(cmd, cmdArgs, {
112
- stdio: ['ignore', 'pipe', 'pipe'], // swallow stdin; capture stderr to scan
115
+ // Claude Code delivers hook event data (prompt, tool_input, etc.) as JSON
116
+ // on stdin — `$PROMPT`/`$TOOL_INPUT_*` env-var substitution is NOT
117
+ // reliable on every hook surface (see hooks-shared.ts:readStdinJsonEvent's
118
+ // own docstring). Discarding stdin here silently broke the CLI's
119
+ // existing, already-safe stdin fallback (500ms internal timeout, never
120
+ // hangs) — inherit it instead so that fallback can actually run.
121
+ stdio: ['inherit', 'pipe', 'pipe'],
113
122
  encoding: 'utf8',
114
123
  maxBuffer: 16 * 1024 * 1024,
124
+ timeout: SPAWN_TIMEOUT_MS,
115
125
  });
116
126
  out = (res && res.stdout) || '';
117
- recordHookHealth((res && res.stderr) || ''); // tee fatal markers to health log
127
+ const subcmd = args[0] || 'unknown';
128
+ const stderr = (res && res.stderr) || '';
129
+ const hit = FATAL_MARKERS.find((m) => stderr.includes(m));
130
+ const ts = () => new Date().toISOString();
131
+ if (hit) {
132
+ // The fix depends on WHICH failure hit. A native-binary marker (invalid ELF
133
+ // header / ERR_DLOPEN_FAILED / wrong Node version) is a real rebuild case.
134
+ // But "Failed to initialize UnifiedMemoryManager" is almost always LOCK
135
+ // CONTENTION — another AQE process (MCP server, daemon, hooks) holding
136
+ // memory.db, often amplified by a WAL-hostile bind mount — NOT a bad binary.
137
+ // Suggesting `npm rebuild` there sends people down the wrong path (verified
138
+ // 2026-07-08: better-sqlite3 loaded fine while this marker still fired).
139
+ const nativeMismatch = /invalid ELF header|ERR_DLOPEN_FAILED|different Node\.js version/.test(hit);
140
+ const fix = nativeMismatch
141
+ ? '`npm rebuild better-sqlite3` (host/container native-binary mismatch).'
142
+ : 'lock contention — check for concurrent AQE processes holding memory.db '
143
+ + '(MCP server / daemon / other hooks) and WAL safety on bind mounts '
144
+ + '(AQE_DISABLE_WAL); NOT a native-binary rebuild.';
145
+ recordHookHealth(`[${ts()}] FATAL hook persistence failure `
146
+ + `(cmd=${subcmd}): "${hit}". Learning is NOT being captured. `
147
+ + `Fix: ${fix}\n`);
148
+ } else if (res && res.signal) {
149
+ // Killed by our own SPAWN_TIMEOUT_MS (or another signal) before finishing.
150
+ // No output means no persistence happened for this invocation.
151
+ recordHookHealth(`[${ts()}] TIMEOUT hook did not complete `
152
+ + `(cmd=${subcmd}, signal=${res.signal}, budget=${SPAWN_TIMEOUT_MS}ms). `
153
+ + `Learning for this invocation was NOT captured.\n`);
154
+ } else if (res && res.error) {
155
+ // spawnSync couldn't even launch the child (ENOENT/EACCES/etc).
156
+ recordHookHealth(`[${ts()}] SPAWN-FAILED hook could not start `
157
+ + `(cmd=${subcmd}): ${res.error.message || res.error}. `
158
+ + `Learning for this invocation was NOT captured.\n`);
159
+ } else if (res && res.status !== 0 && !out.includes('{')) {
160
+ // Child exited non-zero with no JSON payload — e.g. an empty-task throw
161
+ // when the harness didn't populate $PROMPT/$TOOL_INPUT_*.
162
+ recordHookHealth(`[${ts()}] EMPTY-RESULT hook exited status=${res.status} `
163
+ + `with no JSON output (cmd=${subcmd}). stderr: ${stderr.slice(0, 300)}\n`);
164
+ }
118
165
  } catch { /* never block a turn */ }
119
166
 
120
167
  // Emit only the top-level JSON object: the first line beginning with '{' through
@@ -939,7 +939,7 @@
939
939
  },
940
940
  "metadata": {
941
941
  "generatedBy": "Agentic QE Fleet",
942
- "fleetVersion": "3.11.4",
942
+ "fleetVersion": "3.12.0",
943
943
  "manifestVersion": "1.4.0",
944
944
  "lastUpdated": "2026-04-13T00:00:00.000Z",
945
945
  "contributors": [
package/CHANGELOG.md CHANGED
@@ -5,6 +5,116 @@ All notable changes to the Agentic QE project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.12.0] - 2026-07-10
9
+
10
+ Adds a **learning-integrity layer** so the self-learning system can only promote
11
+ what it can prove. Test-quality is now measured against a frozen, hash-pinned
12
+ oracle benchmark; promotions are gated by the *quality of their evidence*
13
+ (real test execution beats an LLM judge beats a structural heuristic), recorded
14
+ as cryptographically-signed, replayable receipts, and re-checked against the
15
+ exact frozen rule before they take effect. A new two-gate quality command
16
+ (mechanical checks + an independent frontier-model judge) is exposed on both the
17
+ CLI and MCP. Ships with a designed-experiment tool that measures — with real
18
+ statistics — whether a given harness feature actually improves test quality or
19
+ just adds cost. See ADRs
20
+ [117](docs/implementation/adrs/ADR-117-frozen-oracle-anchor-set.md)–[122](docs/implementation/adrs/ADR-122-designed-experiment-harness-gate.md)
21
+ and [v3.12.0 release notes](docs/releases/v3.12.0.md).
22
+
23
+ ### Added
24
+
25
+ - **`aqe quality-gate` CLI command and `qe/quality/gate` MCP tool** — a two-gate
26
+ quality verdict: a mechanical gate (the code must actually run and kill
27
+ mutations) plus an independent frontier-model judge that checks the test
28
+ against the spec. Returns a three-valued verdict (pass / fail / inconclusive)
29
+ and degrades honestly to "inconclusive" when the judge is unavailable rather
30
+ than guessing.
31
+ - **Frozen oracle anchor set** — a hash-pinned benchmark of graded test items
32
+ with a constant denominator, so a drop in the learning system's test-quality
33
+ is detectable as a real regression instead of being hidden by a moving target.
34
+ - **Provenance-tiered promotion** — every learning promotion now carries an
35
+ evidence tier (test-execution > LLM-judge > structural heuristic), and a
36
+ policy can require a minimum tier before anything is promoted.
37
+ - **Receipt-gated policy flywheel** — retrieval-policy improvements are recorded
38
+ as Ed25519-signed, replayable receipts with a compounding lineage, so every
39
+ promotion is auditable, re-verifiable offline, and reversible.
40
+ - **Gate re-execution on promotion paths** — before a promotion takes effect the
41
+ frozen accept-rule is re-run on the sealed inputs, catching any promotion that
42
+ was logged but that the rule would actually reject.
43
+ - **Designed-experiment harness tool** (`scripts/doe-run.ts` +
44
+ `scripts/doe-aggregate.mjs`) — runs a factorial screen (model × prompt ×
45
+ retrieval × scaffold) with replicates and a real main-effects ANOVA, so you
46
+ can tell whether a harness feature helps reliability or is just cost. First
47
+ screen found that heavy scaffolding *lowers* reliability and that retrieval
48
+ adds no measurable quality on already-known tasks.
49
+
50
+ ### Fixed
51
+
52
+ - **Brain-export hook no longer leaks** deadlocked background exports that could
53
+ respawn, and database backups are hardened for virtiofs bind-mounts (a
54
+ VACUUM-INTO backup path that avoids the WAL-corruption failure mode).
55
+ - **`AQE_DISABLE_WAL` / `AQE_JOURNAL_MODE` env override** for SQLite journal mode,
56
+ so environments prone to bind-mount WAL corruption can opt into a safer mode.
57
+ - **Pattern-lifecycle promotion** now records and gates on provenance tier
58
+ (additive column migration, conservative backfill).
59
+
60
+ ## [3.11.5] - 2026-07-07
61
+
62
+ A system-integrity sweep of the self-learning loop: dream-cycle insights now
63
+ genuinely turn into reusable patterns instead of silently piling up, pattern
64
+ usage stats are accurate again (no more double-counting or mid-session
65
+ regressions), and the witness-chain audit trail, agent-topology tracking, GOAP
66
+ plan execution, and SONA continual learning all had real dormant-code or
67
+ data-integrity bugs fixed. See
68
+ [SYSTEM-INTEGRITY-AUDIT-2026-07-04](docs/analysis/SYSTEM-INTEGRITY-AUDIT-2026-07-04.md)
69
+ and the [remediation plan](docs/plans/SYSTEM-INTEGRITY-REMEDIATION-GOAP-PLAN-2026-07-04.md)
70
+ for full findings and verification evidence.
71
+
72
+ ### Fixed
73
+
74
+ - **Dream-cycle insights now genuinely become reusable patterns** — a gate in
75
+ the concept-loading path meant the fix that lets `detectGaps`/
76
+ `detectOptimizations`/`detectPatternMerges` see real failure/success data
77
+ only ever ran in manual tests, never in real scheduled dream cycles. Also
78
+ fixed the mechanism that marks an insight "applied": it previously
79
+ incremented a counter on the 3 newest insights on every successful task
80
+ regardless of whether anything was actually promoted (proven live in
81
+ production, with counts as high as 16) — it now only marks an insight
82
+ applied when it's genuinely turned into a new pattern.
83
+ - **`aqe learning stats` reported the wrong pattern counts** — Total and "By
84
+ Domain" now come from the real pattern store instead of an incomplete
85
+ vector-index count that silently excluded any pattern without an embedding.
86
+ - **Pattern usage was recorded twice per outcome**, inflating usage counts and
87
+ success-rate stats 2x; now written once.
88
+ - **Pattern lookups could silently fail after a name collision** ("Pattern not
89
+ found") because an internal id could go out of sync between the in-memory
90
+ cache and the database; fixed for both pattern-store backends.
91
+ - **Learning stats could regress mid-session** — reported totals could drop
92
+ below the real historical count right after the first pattern-usage event
93
+ in a session; now always reports the correct, non-decreasing total.
94
+ - **Witness-chain audit trail** — cryptographic signing now covers all new
95
+ entries, and a bug that silently broke chain verification for every entry
96
+ after an archival operation is fixed, plus a new CI gate to catch
97
+ regressions.
98
+ - **Agent-topology tracking (mincut)** now reflects real agent activity
99
+ instead of a constant placeholder reading, removing a false "critical"
100
+ routing state that could occur on an empty graph.
101
+ - **GOAP plan execution** now dispatches real domain-API calls for the
102
+ majority of actions instead of always simulating (mocking) results.
103
+ - **SONA continual-learning cold start** — the self-learning weight-update
104
+ mechanism no longer needs 100 requests to accumulate within a single
105
+ process lifetime before it can save its first update; progress now
106
+ persists across restarts.
107
+ - Assorted smaller integrity fixes: pattern-null (failure record) capture
108
+ wasn't wired into the production learning path; a stale/expired daemon
109
+ process could look "healthy"; a TTL bug caused several cache entries to
110
+ live 1000x longer than intended.
111
+
112
+ ### Changed
113
+
114
+ - Cleaned up dead data left over from now-fixed bugs (degenerate agent-topology
115
+ snapshots, orphaned GOAP test-fixture rows, a corrupted insight-tracking
116
+ counter) — internal only, no user-facing behavior change.
117
+
8
118
  ## [3.11.4] - 2026-07-01
9
119
 
10
120
  Better free local-model support, a tamper-evident guard for AQE's learning
@@ -939,7 +939,7 @@
939
939
  },
940
940
  "metadata": {
941
941
  "generatedBy": "Agentic QE Fleet",
942
- "fleetVersion": "3.11.0",
942
+ "fleetVersion": "3.12.0",
943
943
  "manifestVersion": "1.4.0",
944
944
  "lastUpdated": "2026-04-13T00:00:00.000Z",
945
945
  "contributors": [
@@ -421,41 +421,72 @@ export function createOAuthRoutes(config) {
421
421
  * @returns True if URI is allowed
422
422
  */
423
423
  export function validateRedirectUri(uri, allowedUris) {
424
+ let target;
424
425
  try {
425
- const parsed = new URL(uri);
426
- for (const allowed of allowedUris) {
427
- // Exact match
428
- if (allowed === uri) {
429
- return true;
430
- }
431
- // Wildcard match (e.g., "https://*.example.com/callback")
432
- if (allowed.includes('*')) {
433
- const pattern = allowed
434
- .replace(/[.+?^${}()|[\]\\]/g, '\\$&')
435
- .replace(/\*/g, '.*');
436
- const regex = new RegExp(`^${pattern}$`);
437
- if (regex.test(uri)) {
438
- return true;
439
- }
440
- }
441
- // Same origin match
426
+ target = new URL(uri);
427
+ }
428
+ catch {
429
+ return false;
430
+ }
431
+ for (const allowed of allowedUris) {
432
+ // Exact match
433
+ if (allowed === uri) {
434
+ return true;
435
+ }
436
+ // Wildcard match (e.g., "https://*.example.com/callback"). Compared
437
+ // STRUCTURALLY on parsed URL components — NEVER by building a RegExp from a
438
+ // URL string. A regex approach (`.replace(/\*/g, '.*')`) let an attacker
439
+ // spoof the host via the PATH, e.g. "https://evil.com/x.example.com/cb"
440
+ // satisfied "^https://.*\.example\.com/cb$" (open redirect; also the CodeQL
441
+ // js/incomplete-hostname-regexp finding). Here only the single leftmost
442
+ // subdomain label may be wildcarded, and it must be a non-empty, dot-free
443
+ // label — so the host cannot be spoofed via extra dots or path segments.
444
+ if (allowed.includes('*')) {
445
+ const MARKER = 'wildcardlabelplaceholder';
446
+ let pattern;
442
447
  try {
443
- const allowedParsed = new URL(allowed);
444
- if (parsed.protocol === allowedParsed.protocol &&
445
- parsed.host === allowedParsed.host &&
446
- parsed.pathname.startsWith(allowedParsed.pathname)) {
447
- return true;
448
- }
448
+ // Replace EVERY '*' (global) — a first-occurrence-only replace would leave
449
+ // later '*' chars in the string. Any multi-wildcard pattern still gets
450
+ // rejected below because its suffix would then contain MARKER, which no
451
+ // real host can end with.
452
+ pattern = new URL(allowed.replace(/\*/g, MARKER));
449
453
  }
450
454
  catch {
451
- // Invalid allowed URI, skip
455
+ continue; // malformed wildcard entry skip
452
456
  }
457
+ if (pattern.protocol !== target.protocol)
458
+ continue;
459
+ if (pattern.port !== target.port)
460
+ continue;
461
+ // The wildcard must be the leftmost host label: "<MARKER>.<suffix>".
462
+ if (!pattern.hostname.startsWith(`${MARKER}.`))
463
+ continue;
464
+ const suffix = pattern.hostname.slice(MARKER.length); // ".example.com"
465
+ if (!target.hostname.endsWith(suffix))
466
+ continue;
467
+ const label = target.hostname.slice(0, target.hostname.length - suffix.length);
468
+ if (label.length === 0 || label.includes('.'))
469
+ continue; // exactly one label
470
+ // Path matches exactly or as a prefix (same semantics as the same-origin case).
471
+ if (target.pathname === pattern.pathname || target.pathname.startsWith(pattern.pathname)) {
472
+ return true;
473
+ }
474
+ continue;
475
+ }
476
+ // Same origin match (exact protocol + host, path-prefix)
477
+ try {
478
+ const allowedParsed = new URL(allowed);
479
+ if (target.protocol === allowedParsed.protocol &&
480
+ target.host === allowedParsed.host &&
481
+ target.pathname.startsWith(allowedParsed.pathname)) {
482
+ return true;
483
+ }
484
+ }
485
+ catch {
486
+ // Invalid allowed URI, skip
453
487
  }
454
- return false;
455
- }
456
- catch {
457
- return false;
458
488
  }
489
+ return false;
459
490
  }
460
491
  /**
461
492
  * Generate PKCE code challenge from verifier
@@ -31,6 +31,15 @@ export interface WitnessFilter {
31
31
  export interface VerifyOptions {
32
32
  /** Also verify Ed25519 signatures. Requires keyManager on the chain. */
33
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;
34
43
  }
35
44
  export interface VerifyResult {
36
45
  valid: boolean;
@@ -62,6 +71,22 @@ export declare class WitnessChain {
62
71
  private addColumnIfMissing;
63
72
  /** Append a new SHAKE-256-hashed entry, optionally Ed25519-signed. */
64
73
  append(actionType: WitnessActionType, actionData: Record<string, unknown>, actor: string): WitnessEntry;
74
+ /**
75
+ * Find the entry with the given id, checking the live table first and then
76
+ * the archive. Used to recover a predecessor that array-adjacency can't
77
+ * see directly (it was archived, possibly by an earlier archival run than
78
+ * the one that affects the entry currently being checked).
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.
88
+ */
89
+ private checkEntryLink;
65
90
  /** Verify chain integrity. Supports mixed SHA-256/SHAKE-256 and optional signature checks. */
66
91
  verify(options?: VerifyOptions): VerifyResult;
67
92
  /** Query entries with optional filters. */