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,89 @@
1
+ /**
2
+ * Durable, append-only persistence for flywheel evolve receipts (ADR-118 §4).
3
+ *
4
+ * The generational lineage is only trustworthy if it survives the process: a
5
+ * third party must be able to reload the receipts and re-verify each one
6
+ * (signature + frozen-gate re-execution) offline. This stores every receipt —
7
+ * promoted OR rejected — in an append-only table in the unified `memory.db`.
8
+ *
9
+ * Data safety (unified-memory rule): CREATE TABLE IF NOT EXISTS is additive;
10
+ * writes are INSERT-only (no UPDATE/DELETE/DROP in this API); the caller opens
11
+ * the DB and is responsible for backups. The `db` handle is injected so tests
12
+ * run against an in-memory database.
13
+ */
14
+ import { reconstructLineage } from './generation.js';
15
+ /** Idempotent, additive migration — creates the receipts table if absent. */
16
+ export function ensureReceiptTable(db) {
17
+ db.exec(`
18
+ CREATE TABLE IF NOT EXISTS flywheel_receipts (
19
+ seq INTEGER PRIMARY KEY AUTOINCREMENT,
20
+ generation INTEGER NOT NULL,
21
+ rule_version TEXT NOT NULL,
22
+ rule_fingerprint TEXT NOT NULL,
23
+ sealed_hash TEXT NOT NULL,
24
+ sealed_json TEXT NOT NULL,
25
+ verdict TEXT NOT NULL,
26
+ baseline_policy_id TEXT NOT NULL,
27
+ candidate_policy_id TEXT NOT NULL,
28
+ signer_key_id TEXT NOT NULL,
29
+ public_key_pem TEXT NOT NULL,
30
+ signature TEXT NOT NULL,
31
+ created_at TEXT DEFAULT (datetime('now'))
32
+ )
33
+ `);
34
+ }
35
+ /** Append one receipt (INSERT-only). Returns its assigned seq. */
36
+ export function persistReceipt(db, receipt) {
37
+ ensureReceiptTable(db);
38
+ const info = db.prepare(`
39
+ INSERT INTO flywheel_receipts
40
+ (generation, rule_version, rule_fingerprint, sealed_hash, sealed_json,
41
+ verdict, baseline_policy_id, candidate_policy_id, signer_key_id,
42
+ public_key_pem, signature)
43
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
44
+ `).run(receipt.generation, receipt.ruleVersion, receipt.ruleFingerprint, receipt.sealedHash, JSON.stringify(receipt.sealed), receipt.verdict, receipt.baselinePolicyId, receipt.candidatePolicyId, receipt.signerKeyId, receipt.publicKeyPem, receipt.signature);
45
+ return Number(info.lastInsertRowid);
46
+ }
47
+ /** Append many receipts in one transaction (still INSERT-only). */
48
+ export function persistReceipts(db, receipts) {
49
+ ensureReceiptTable(db);
50
+ const tx = db.transaction((rs) => {
51
+ for (const r of rs)
52
+ persistReceipt(db, r);
53
+ });
54
+ tx(receipts);
55
+ return receipts.length;
56
+ }
57
+ /** Load persisted receipts back into EvolveReceipt objects, ordered by seq. */
58
+ export function loadReceipts(db) {
59
+ ensureReceiptTable(db);
60
+ const rows = db.prepare(`
61
+ SELECT generation, rule_version, rule_fingerprint, sealed_hash, sealed_json,
62
+ verdict, baseline_policy_id, candidate_policy_id, signer_key_id,
63
+ public_key_pem, signature
64
+ FROM flywheel_receipts
65
+ ORDER BY seq ASC
66
+ `).all();
67
+ return rows.map((r) => ({
68
+ generation: r.generation,
69
+ ruleVersion: r.rule_version,
70
+ ruleFingerprint: r.rule_fingerprint,
71
+ sealed: JSON.parse(r.sealed_json),
72
+ sealedHash: r.sealed_hash,
73
+ verdict: r.verdict === 'promote' ? 'promote' : 'reject',
74
+ baselinePolicyId: r.baseline_policy_id,
75
+ candidatePolicyId: r.candidate_policy_id,
76
+ signerKeyId: r.signer_key_id,
77
+ publicKeyPem: r.public_key_pem,
78
+ signature: r.signature,
79
+ }));
80
+ }
81
+ /**
82
+ * Reload the persisted lineage and re-verify it end-to-end (signatures +
83
+ * frozen-gate re-execution + compounding chain). This is the offline
84
+ * "trust the re-run, not the log" check applied to what's actually on disk.
85
+ */
86
+ export function verifyPersistedLineage(db) {
87
+ return reconstructLineage(loadReceipts(db));
88
+ }
89
+ //# sourceMappingURL=receipt-store.js.map
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Ed25519-signed evolve receipts for the QE-policy flywheel (ADR-118 §4).
3
+ *
4
+ * Every generation — promoted OR rejected — emits a signed receipt into an
5
+ * append-only lineage. A receipt seals the decision inputs (composing ADR-116 /
6
+ * ADR-120) and signs the whole body, so a third party can (a) re-execute the
7
+ * frozen rule on the sealed inputs (ADR-120 verifyPromotion) and (b) verify the
8
+ * signature — trusting the SIGNATURE and the RE-RUN, not the producer.
9
+ *
10
+ * Ed25519 via Node's built-in crypto — dependency-free (ADR-118 §6).
11
+ */
12
+ import type { SealedInputs, PromotionReceipt } from '../../validation/gate-reexecute.js';
13
+ export interface Signer {
14
+ /** Stable id for the signing key (hash of the public key). */
15
+ keyId: string;
16
+ /** SPKI PEM of the public key — travels in the receipt for verification. */
17
+ publicKeyPem: string;
18
+ /** Sign a message, returning a hex signature. */
19
+ sign(message: string): string;
20
+ }
21
+ /**
22
+ * Create an Ed25519 signer. With a 32-byte seed (hex or Buffer) the keypair is
23
+ * DETERMINISTIC — same seed ⇒ same key ⇒ reproducible receipts (useful for
24
+ * replay bundles and tests). Without a seed, a fresh random keypair is used.
25
+ */
26
+ export declare function createSigner(seed?: string | Buffer): Signer;
27
+ /** Verify an Ed25519 signature against a public key PEM. Never throws. */
28
+ export declare function verifySignature(publicKeyPem: string, message: string, signatureHex: string): boolean;
29
+ /** A signed evolve receipt — the durable, verifiable record of one generation. */
30
+ export interface EvolveReceipt {
31
+ generation: number;
32
+ /** Frozen acceptance rule this decision used (ADR-120). */
33
+ ruleVersion: string;
34
+ ruleFingerprint: string;
35
+ /** Sealed decision inputs + their content hash (ADR-116/120). */
36
+ sealed: SealedInputs;
37
+ sealedHash: string;
38
+ /** The verdict this generation recorded. */
39
+ verdict: 'promote' | 'reject';
40
+ /** Lineage links: which policy was the baseline, which the candidate. */
41
+ baselinePolicyId: string;
42
+ candidatePolicyId: string;
43
+ /** Signer identity + public key (for offline verification). */
44
+ signerKeyId: string;
45
+ publicKeyPem: string;
46
+ /** Ed25519 signature over the canonical receipt body. */
47
+ signature: string;
48
+ }
49
+ /** The signed portion of a receipt (everything except the signature itself). */
50
+ export type ReceiptBody = Omit<EvolveReceipt, 'signature'>;
51
+ /** Canonical serialization of the receipt body for signing/verifying. */
52
+ export declare function receiptBodyString(body: ReceiptBody): string;
53
+ /** Sign a receipt body, producing a complete signed receipt. */
54
+ export declare function signReceipt(body: ReceiptBody, signer: Signer): EvolveReceipt;
55
+ /** Verify a receipt's Ed25519 signature (does NOT re-execute the gate — see ADR-120). */
56
+ export declare function verifyReceiptSignature(receipt: EvolveReceipt): boolean;
57
+ /**
58
+ * Adapt an EvolveReceipt to the ADR-120 PromotionReceipt shape so it can be
59
+ * re-verified by `verifyPromotion` (maps `verdict` → `recordedVerdict`).
60
+ */
61
+ export declare function toPromotionReceipt(receipt: EvolveReceipt): PromotionReceipt;
62
+ //# sourceMappingURL=receipt.d.ts.map
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Ed25519-signed evolve receipts for the QE-policy flywheel (ADR-118 §4).
3
+ *
4
+ * Every generation — promoted OR rejected — emits a signed receipt into an
5
+ * append-only lineage. A receipt seals the decision inputs (composing ADR-116 /
6
+ * ADR-120) and signs the whole body, so a third party can (a) re-execute the
7
+ * frozen rule on the sealed inputs (ADR-120 verifyPromotion) and (b) verify the
8
+ * signature — trusting the SIGNATURE and the RE-RUN, not the producer.
9
+ *
10
+ * Ed25519 via Node's built-in crypto — dependency-free (ADR-118 §6).
11
+ */
12
+ import { generateKeyPairSync, createPrivateKey, createPublicKey, sign as edSign, verify as edVerify, createHash, } from 'node:crypto';
13
+ /** Derive a stable key id from a public key PEM. */
14
+ function keyIdOf(publicKeyPem) {
15
+ return createHash('sha256').update(publicKeyPem).digest('hex').slice(0, 16);
16
+ }
17
+ /**
18
+ * Create an Ed25519 signer. With a 32-byte seed (hex or Buffer) the keypair is
19
+ * DETERMINISTIC — same seed ⇒ same key ⇒ reproducible receipts (useful for
20
+ * replay bundles and tests). Without a seed, a fresh random keypair is used.
21
+ */
22
+ export function createSigner(seed) {
23
+ let privateKey;
24
+ let publicKey;
25
+ if (seed !== undefined) {
26
+ const raw = typeof seed === 'string' ? Buffer.from(seed, 'hex') : seed;
27
+ if (raw.length !== 32) {
28
+ throw new Error(`Ed25519 seed must be 32 bytes (got ${raw.length}).`);
29
+ }
30
+ // PKCS#8 wrapper for a raw Ed25519 seed: fixed 16-byte prefix + 32-byte seed.
31
+ const pkcs8 = Buffer.concat([
32
+ Buffer.from('302e020100300506032b657004220420', 'hex'),
33
+ raw,
34
+ ]);
35
+ privateKey = createPrivateKey({ key: pkcs8, format: 'der', type: 'pkcs8' });
36
+ publicKey = createPublicKey(privateKey);
37
+ }
38
+ else {
39
+ ({ privateKey, publicKey } = generateKeyPairSync('ed25519'));
40
+ }
41
+ const publicKeyPem = publicKey.export({ format: 'pem', type: 'spki' }).toString();
42
+ return {
43
+ keyId: keyIdOf(publicKeyPem),
44
+ publicKeyPem,
45
+ sign(message) {
46
+ return edSign(null, Buffer.from(message, 'utf8'), privateKey).toString('hex');
47
+ },
48
+ };
49
+ }
50
+ /** Verify an Ed25519 signature against a public key PEM. Never throws. */
51
+ export function verifySignature(publicKeyPem, message, signatureHex) {
52
+ try {
53
+ const publicKey = createPublicKey(publicKeyPem);
54
+ return edVerify(null, Buffer.from(message, 'utf8'), publicKey, Buffer.from(signatureHex, 'hex'));
55
+ }
56
+ catch {
57
+ return false;
58
+ }
59
+ }
60
+ /** Canonical serialization of the receipt body for signing/verifying. */
61
+ export function receiptBodyString(body) {
62
+ // Field order is fixed here (not sorted) so it is explicit and stable.
63
+ return JSON.stringify({
64
+ generation: body.generation,
65
+ ruleVersion: body.ruleVersion,
66
+ ruleFingerprint: body.ruleFingerprint,
67
+ sealedHash: body.sealedHash,
68
+ verdict: body.verdict,
69
+ baselinePolicyId: body.baselinePolicyId,
70
+ candidatePolicyId: body.candidatePolicyId,
71
+ signerKeyId: body.signerKeyId,
72
+ });
73
+ }
74
+ /** Sign a receipt body, producing a complete signed receipt. */
75
+ export function signReceipt(body, signer) {
76
+ const signature = signer.sign(receiptBodyString(body));
77
+ return { ...body, signature };
78
+ }
79
+ /** Verify a receipt's Ed25519 signature (does NOT re-execute the gate — see ADR-120). */
80
+ export function verifyReceiptSignature(receipt) {
81
+ const { signature, ...body } = receipt;
82
+ return verifySignature(receipt.publicKeyPem, receiptBodyString(body), signature);
83
+ }
84
+ /**
85
+ * Adapt an EvolveReceipt to the ADR-120 PromotionReceipt shape so it can be
86
+ * re-verified by `verifyPromotion` (maps `verdict` → `recordedVerdict`).
87
+ */
88
+ export function toPromotionReceipt(receipt) {
89
+ return {
90
+ ruleVersion: receipt.ruleVersion,
91
+ ruleFingerprint: receipt.ruleFingerprint,
92
+ sealedHash: receipt.sealedHash,
93
+ sealed: receipt.sealed,
94
+ recordedVerdict: receipt.verdict,
95
+ };
96
+ }
97
+ //# sourceMappingURL=receipt.js.map
@@ -343,16 +343,12 @@ export class QEReasoningBank {
343
343
  if (!this.config.enableLearning) {
344
344
  return ok(undefined);
345
345
  }
346
- const result = await this.patternStore.recordUsage(outcome.patternId, outcome.success);
347
- // Persist usage to SQLite (updates qe_patterns row AND inserts qe_pattern_usage)
348
- try {
349
- const store = this.getSqliteStore();
350
- store.recordUsage(outcome.patternId, outcome.success, outcome.metrics, outcome.feedback);
351
- }
352
- catch (persistError) {
353
- // Non-critical — don't fail if persistence fails
354
- logger.warn('SQLite pattern usage persist failed', { error: toErrorMessage(persistError) });
355
- }
346
+ // Single writer (#486 Gap B): patternStore.recordUsage() persists to SQLite
347
+ // itself (updates qe_patterns row AND inserts qe_pattern_usage) when a
348
+ // SQLitePatternStore is wired via setSqliteStore(). A second explicit
349
+ // SQLite write here previously double-counted every outcome — two
350
+ // qe_pattern_usage rows and a +2 usage_count for one recordOutcome() call.
351
+ const result = await this.patternStore.recordUsage(outcome.patternId, outcome.success, outcome.metrics, outcome.feedback);
356
352
  if (result.success) {
357
353
  this.stats.learningOutcomes++;
358
354
  if (outcome.success) {
@@ -608,9 +604,18 @@ export class QEReasoningBank {
608
604
  // DB fallback (#454): in-memory `this.stats` is reset on every process
609
605
  // start, but every hook invocation spawns a fresh node. Without a DB
610
606
  // fallback, `aqe hooks stats` always reports zeros even when historical
611
- // routing_outcomes / qe_pattern_usage rows exist. We use the in-memory
612
- // counters when they're non-zero (live, current-process data), otherwise
613
- // fall back to aggregated DB totals.
607
+ // routing_outcomes / qe_pattern_usage rows exist.
608
+ //
609
+ // routing_outcomes / qe_pattern_usage are written synchronously on every
610
+ // recordOutcome()/routeTask() call, so the DB aggregate is always a
611
+ // superset of (>=) the in-memory counters for this process. Previously
612
+ // this only consulted the DB when the in-memory counter was exactly
613
+ // zero, which made reported totals regress the moment in-memory ticked
614
+ // past zero mid-session — a cold-start call would correctly report the
615
+ // historical DB total, then the very next call after one recordOutcome()
616
+ // would drop to reporting just "1" instead of "historical total + 1".
617
+ // Taking the max keeps the number monotonic while still tolerating a
618
+ // failed/unavailable DB aggregate (falls back to in-memory).
614
619
  let routingRequests = this.stats.routingRequests;
615
620
  let avgRoutingConfidence = this.stats.routingRequests > 0
616
621
  ? this.stats.totalRoutingConfidence / this.stats.routingRequests
@@ -619,27 +624,25 @@ export class QEReasoningBank {
619
624
  let patternSuccessRate = this.stats.learningOutcomes > 0
620
625
  ? this.stats.successfulOutcomes / this.stats.learningOutcomes
621
626
  : 0;
622
- if (routingRequests === 0 || learningOutcomes === 0) {
623
- try {
624
- const agg = this.getSqliteStore().getAggregateOutcomeStats();
625
- if (routingRequests === 0 && agg.routingRequests > 0) {
626
- routingRequests = agg.routingRequests;
627
- avgRoutingConfidence = agg.avgRoutingConfidence;
628
- }
629
- if (learningOutcomes === 0 && agg.learningOutcomes > 0) {
630
- learningOutcomes = agg.learningOutcomes;
631
- // Prefer per-usage success rate (closer to recordOutcome semantics);
632
- // fall back to qe_patterns.success_rate aggregate when no usage rows.
633
- patternSuccessRate =
634
- agg.learningOutcomes > 0
635
- ? agg.successfulOutcomes / agg.learningOutcomes
636
- : agg.avgPatternSuccessRate;
637
- }
627
+ try {
628
+ const agg = this.getSqliteStore().getAggregateOutcomeStats();
629
+ if (agg.routingRequests > routingRequests) {
630
+ routingRequests = agg.routingRequests;
631
+ avgRoutingConfidence = agg.avgRoutingConfidence;
638
632
  }
639
- catch {
640
- // best-effort — never let stats reporting crash the host
633
+ if (agg.learningOutcomes > learningOutcomes) {
634
+ learningOutcomes = agg.learningOutcomes;
635
+ // Prefer per-usage success rate (closer to recordOutcome semantics);
636
+ // fall back to qe_patterns.success_rate aggregate when no usage rows.
637
+ patternSuccessRate =
638
+ agg.learningOutcomes > 0
639
+ ? agg.successfulOutcomes / agg.learningOutcomes
640
+ : agg.avgPatternSuccessRate;
641
641
  }
642
642
  }
643
+ catch {
644
+ // best-effort — never let stats reporting crash the host
645
+ }
643
646
  return {
644
647
  totalPatterns: patternStoreStats.totalPatterns,
645
648
  byDomain,
@@ -20,8 +20,18 @@
20
20
  * permanently dampened in the exact deployment case ADR-095 was meant
21
21
  * to help.
22
22
  *
23
- * Treat empty/uninitialized graph as "no signal" (full ε rate). Only
24
- * consult `isCritical()` when the graph has actual vertices.
23
+ * A16 correction (2026-07-06): `graph.isEmpty()` alone doesn't catch
24
+ * this `QueenMinCutBridge` always seeds ~14 `domain:*` scaffold
25
+ * vertices + workflow edges on init, so `isEmpty()` is false as soon as
26
+ * Queen starts, even with zero real agents ever spawned. The mincut
27
+ * over those scaffold-only edges (one-directional, `defect-intelligence`
28
+ * a pure sink) computes to exactly 0.0 — still degenerate, still
29
+ * "critical" by the threshold check. Check for real `agent:*` vertices
30
+ * specifically (same fix `QueenMinCutBridge.isEmptyTopology()` already
31
+ * applies internally), not raw vertex count.
32
+ *
33
+ * Treat a graph with no real agent vertices as "no signal" (full ε rate).
34
+ * Only consult `isCritical()` once at least one agent has actually spawned.
25
35
  */
26
36
  /**
27
37
  * Returns true ONLY when:
@@ -20,8 +20,18 @@
20
20
  * permanently dampened in the exact deployment case ADR-095 was meant
21
21
  * to help.
22
22
  *
23
- * Treat empty/uninitialized graph as "no signal" (full ε rate). Only
24
- * consult `isCritical()` when the graph has actual vertices.
23
+ * A16 correction (2026-07-06): `graph.isEmpty()` alone doesn't catch
24
+ * this `QueenMinCutBridge` always seeds ~14 `domain:*` scaffold
25
+ * vertices + workflow edges on init, so `isEmpty()` is false as soon as
26
+ * Queen starts, even with zero real agents ever spawned. The mincut
27
+ * over those scaffold-only edges (one-directional, `defect-intelligence`
28
+ * a pure sink) computes to exactly 0.0 — still degenerate, still
29
+ * "critical" by the threshold check. Check for real `agent:*` vertices
30
+ * specifically (same fix `QueenMinCutBridge.isEmptyTopology()` already
31
+ * applies internally), not raw vertex count.
32
+ *
33
+ * Treat a graph with no real agent vertices as "no signal" (full ε rate).
34
+ * Only consult `isCritical()` once at least one agent has actually spawned.
25
35
  */
26
36
  import { getSharedMinCutGraph, getSharedMinCutMonitor, isSharedMinCutGraphInitialized, isSharedMinCutMonitorInitialized, } from '../coordination/mincut/shared-singleton.js';
27
37
  /**
@@ -44,7 +54,9 @@ export function resolveTopologyCriticalFromSharedMincut() {
44
54
  if (!isSharedMinCutGraphInitialized())
45
55
  return false;
46
56
  const graph = getSharedMinCutGraph();
47
- if (graph.isEmpty())
57
+ // Domain-coordinator scaffold vertices/edges are always present once
58
+ // Queen initializes; they don't count as "the graph has real signal".
59
+ if (graph.getVerticesByType('agent').length === 0)
48
60
  return false;
49
61
  return getSharedMinCutMonitor().isCritical();
50
62
  }
@@ -63,7 +63,7 @@ export declare class RvfPatternStore implements IPatternStore {
63
63
  create(options: CreateQEPatternOptions): Promise<Result<QEPattern>>;
64
64
  get(id: string): Promise<QEPattern | null>;
65
65
  search(query: string | number[], options?: PatternSearchOptions): Promise<Result<PatternSearchResult[]>>;
66
- recordUsage(id: string, success: boolean): Promise<Result<void>>;
66
+ recordUsage(id: string, success: boolean, metrics?: Record<string, unknown>, feedback?: string): Promise<Result<void>>;
67
67
  promote(id: string): Promise<Result<void>>;
68
68
  delete(id: string): Promise<Result<void>>;
69
69
  getStats(): Promise<PatternStoreStats>;
@@ -372,12 +372,12 @@ export class RvfPatternStore {
372
372
  // --------------------------------------------------------------------------
373
373
  // IPatternStore — Mutation operations
374
374
  // --------------------------------------------------------------------------
375
- async recordUsage(id, success) {
375
+ async recordUsage(id, success, metrics, feedback) {
376
376
  if (!this.sqliteStore) {
377
377
  return err(new Error('No SQLite store attached'));
378
378
  }
379
379
  try {
380
- this.sqliteStore.recordUsage(id, success);
380
+ this.sqliteStore.recordUsage(id, success, metrics, feedback);
381
381
  return ok(undefined);
382
382
  }
383
383
  catch (error) {
@@ -419,18 +419,31 @@ export class RvfPatternStore {
419
419
  }
420
420
  async getStats() {
421
421
  const rvfStatus = this.adapter?.status();
422
- // Get pattern count from RVF if available, otherwise fall back to SQLite
423
- let totalPatterns = rvfStatus?.totalVectors ?? 0;
424
- if (totalPatterns === 0 && this.sqliteStore) {
422
+ // qe_patterns (SQLite) is the source of truth for pattern count and
423
+ // domain/tier breakdown the RVF vector index only covers patterns
424
+ // that have actually been embedded, and is reported separately via
425
+ // hnswStats.vectorCount. Previously this used RVF's totalVectors as the
426
+ // headline count, which silently hid any pattern stored without a
427
+ // matching embedding (#553).
428
+ let totalPatterns = 0;
429
+ let byDomain = {};
430
+ let byTier = { shortTerm: 0, longTerm: 0 };
431
+ if (this.sqliteStore) {
425
432
  try {
426
- totalPatterns = this.sqliteStore.getStats().totalPatterns;
433
+ const sqliteStats = this.sqliteStore.getStats();
434
+ totalPatterns = sqliteStats.totalPatterns;
435
+ byDomain = sqliteStats.byDomain;
436
+ byTier = {
437
+ shortTerm: sqliteStats.byTier['short-term'] ?? 0,
438
+ longTerm: sqliteStats.byTier['long-term'] ?? 0,
439
+ };
427
440
  }
428
441
  catch { /* best effort */ }
429
442
  }
430
443
  return {
431
444
  totalPatterns,
432
- byTier: { shortTerm: 0, longTerm: 0 },
433
- byDomain: {},
445
+ byTier,
446
+ byDomain,
434
447
  byType: {},
435
448
  avgConfidence: 0,
436
449
  avgQualityScore: 0,
@@ -391,24 +391,27 @@ export class SQLitePatternStore {
391
391
  if (!insertPattern || !insertEmbedding) {
392
392
  throw new Error('Prepared statements not ready');
393
393
  }
394
+ let actualId = id;
394
395
  // Use transaction for atomicity
395
396
  const transaction = this.db.transaction(() => {
396
397
  insertPattern.run(id, pattern.patternType, pattern.qeDomain, pattern.domain, pattern.name, pattern.description || '', pattern.confidence, pattern.tier || 'short-term', JSON.stringify(pattern.template), JSON.stringify(pattern.context));
398
+ // #447: ON CONFLICT(name, qe_domain, pattern_type) preserves the
399
+ // existing row's id instead of `id`. Resolve the actual id BEFORE
400
+ // inserting the embedding — qe_pattern_embeddings.pattern_id has a
401
+ // FOREIGN KEY on qe_patterns(id), so inserting under the discarded
402
+ // `id` (no such row) throws "FOREIGN KEY constraint failed".
403
+ const actualRow = this.db
404
+ .prepare('SELECT id FROM qe_patterns WHERE name = ? AND qe_domain = ? AND pattern_type = ?')
405
+ .get(pattern.name, pattern.qeDomain ?? '', pattern.patternType ?? '');
406
+ actualId = actualRow ? actualRow.id : id;
397
407
  if (embedding) {
398
408
  // Store embedding as BLOB (Float32Array)
399
409
  const buffer = Buffer.from(new Float32Array(embedding).buffer);
400
- insertEmbedding.run(id, buffer, embedding.length, 'all-MiniLM-L6-v2');
410
+ insertEmbedding.run(actualId, buffer, embedding.length, 'all-MiniLM-L6-v2');
401
411
  }
402
412
  });
403
413
  transaction();
404
- // #447: ON CONFLICT(name, qe_domain, pattern_type) preserves the existing
405
- // row's id, so the new `id` we just tried to insert may not be what's
406
- // actually stored. SELECT the actual id back so callers (rvf-pattern-store,
407
- // qe-hooks) can stay consistent with HNSW and downstream usage tables.
408
- const actualRow = this.db
409
- .prepare('SELECT id FROM qe_patterns WHERE name = ? AND qe_domain = ? AND pattern_type = ?')
410
- .get(pattern.name, pattern.qeDomain ?? '', pattern.patternType ?? '');
411
- return actualRow ? actualRow.id : id;
414
+ return actualId;
412
415
  }
413
416
  /**
414
417
  * Get a pattern by ID