agentic-qe 3.11.5 → 3.12.1

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 (374) 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 +14 -1
  8. package/.claude/skills/skills-manifest.json +1 -1
  9. package/CHANGELOG.md +87 -0
  10. package/assets/skills/skills-manifest.json +1 -1
  11. package/dist/adapters/a2a/auth/routes.js +59 -28
  12. package/dist/cli/bundle.js +6 -6
  13. package/dist/cli/chunks/adapter-X4UEC6UJ.js +2 -0
  14. package/dist/cli/chunks/{agent-booster-wasm-CSTBLNYZ.js → agent-booster-wasm-P4VYM5KK.js} +2 -2
  15. package/dist/cli/chunks/{agent-handler-M4W4GTXN.js → agent-handler-PBQ7L2TO.js} +2 -2
  16. package/dist/cli/chunks/{agent-memory-branch-VGXFYLSQ.js → agent-memory-branch-UPWO3X6V.js} +2 -2
  17. package/dist/cli/chunks/aqe-learning-engine-5FG7JCY7.js +2 -0
  18. package/dist/cli/chunks/{arena-IQBRGWAG.js → arena-LEUTILZ7.js} +2 -2
  19. package/dist/cli/chunks/{arena-FKSD3LLM.js → arena-QYTP3FG6.js} +4 -4
  20. package/dist/cli/chunks/{audit-7NSGRR4Z.js → audit-TB6M2YLK.js} +3 -3
  21. package/dist/cli/chunks/base-CWPMFSZG.js +2 -0
  22. package/dist/cli/chunks/{hnswlib-node-E6NSZPP2.js → better-sqlite3-IPKCAVLS.js} +2 -2
  23. package/dist/cli/chunks/{brain-handler-M6A3UB66.js → brain-handler-JF3OK35F.js} +3 -3
  24. package/dist/cli/chunks/{branch-enumerator-2JGKY4BB.js → branch-enumerator-WEIP3DXB.js} +2 -2
  25. package/dist/cli/chunks/{browser-J43WQPJL.js → browser-HY6VLXHZ.js} +2 -2
  26. package/dist/cli/chunks/browser-workflow-A77OFBVY.js +2 -0
  27. package/dist/cli/chunks/{chunk-7BCRULCP.js → chunk-2PQ7YADF.js} +2 -2
  28. package/dist/cli/chunks/{chunk-XKQY2Z3Q.js → chunk-3I3Z4C5X.js} +1 -1
  29. package/dist/cli/chunks/{chunk-MCHEUSY4.js → chunk-3W2FZXFD.js} +1 -1
  30. package/dist/cli/chunks/{chunk-WMZ2QGGS.js → chunk-42GFB7VX.js} +2 -2
  31. package/dist/cli/chunks/{chunk-UBI2EOS3.js → chunk-42PYEEYQ.js} +1 -1
  32. package/dist/cli/chunks/{chunk-HJWT4KME.js → chunk-45QNHMTP.js} +1 -1
  33. package/dist/cli/chunks/{chunk-AGJOGUP5.js → chunk-4KI72C2E.js} +1 -1
  34. package/dist/cli/chunks/{chunk-5WMU7XCF.js → chunk-4LKQZW2H.js} +1 -1
  35. package/dist/cli/chunks/{chunk-SUL3I6QZ.js → chunk-4U5MJX2H.js} +2 -2
  36. package/dist/cli/chunks/{chunk-DFRRWOEX.js → chunk-55MQ2SFP.js} +2 -2
  37. package/dist/cli/chunks/{chunk-KP3R2M2G.js → chunk-5H5A74U2.js} +1 -1
  38. package/dist/cli/chunks/{chunk-YBPLJRVT.js → chunk-5HMGDB7B.js} +2 -2
  39. package/dist/cli/chunks/{chunk-YZSTZUGJ.js → chunk-6432JORM.js} +1 -1
  40. package/dist/cli/chunks/{chunk-CDJP6COA.js → chunk-6BCVKCG5.js} +2 -2
  41. package/dist/cli/chunks/{chunk-TBT3OFRW.js → chunk-6ONUCDVL.js} +2 -2
  42. package/dist/cli/chunks/{chunk-3LY7OCSO.js → chunk-6RX5QZMU.js} +1 -1
  43. package/dist/cli/chunks/chunk-74VIADSJ.js +2 -0
  44. package/dist/cli/chunks/{chunk-K4I7UIU5.js → chunk-75AVUS5U.js} +1 -1
  45. package/dist/cli/chunks/{chunk-KVVJVMDM.js → chunk-774X6OJY.js} +2 -2
  46. package/dist/cli/chunks/chunk-7KHIOWBN.js +2 -0
  47. package/dist/cli/chunks/{chunk-62OTU2AP.js → chunk-7KK6XSYK.js} +2 -2
  48. package/dist/cli/chunks/{chunk-RFLHPLET.js → chunk-7N2SCRWJ.js} +1 -1
  49. package/dist/cli/chunks/{chunk-OS2HHJTM.js → chunk-AGWKCY42.js} +2 -2
  50. package/dist/cli/chunks/chunk-BAHXVVX3.js +4 -0
  51. package/dist/cli/chunks/{chunk-6T65OKUM.js → chunk-BALFQQB7.js} +2 -2
  52. package/dist/cli/chunks/{chunk-I3ANRYQ6.js → chunk-BBNQDHGF.js} +2 -2
  53. package/dist/cli/chunks/{chunk-LOE2JETO.js → chunk-BCBITOMT.js} +2 -2
  54. package/dist/cli/chunks/{chunk-FII3WCCY.js → chunk-BKKJEKNT.js} +2 -2
  55. package/dist/cli/chunks/{chunk-TTJJ4DQE.js → chunk-BLU7OLQZ.js} +2 -2
  56. package/dist/cli/chunks/{chunk-AL5VJJN4.js → chunk-BNMV5DCM.js} +1 -1
  57. package/dist/cli/chunks/{chunk-4XJ2A3HY.js → chunk-BPM7NEHS.js} +4 -4
  58. package/dist/cli/chunks/{chunk-3V36WMIO.js → chunk-BWNMAXV7.js} +1 -1
  59. package/dist/cli/chunks/{chunk-EDOGRFAG.js → chunk-BXIJY6SB.js} +1 -1
  60. package/dist/cli/chunks/{chunk-ZXEWTZFR.js → chunk-C2K4LQI5.js} +1 -1
  61. package/dist/cli/chunks/{chunk-3WR35GFF.js → chunk-C7HGYLNF.js} +2 -2
  62. package/dist/cli/chunks/{chunk-7YSBATSN.js → chunk-CDVKFAYP.js} +2 -2
  63. package/dist/cli/chunks/{chunk-JBKZ5TUM.js → chunk-CJTXZI37.js} +2 -2
  64. package/dist/cli/chunks/{chunk-VMWRMINE.js → chunk-CP4GSICY.js} +1 -1
  65. package/dist/cli/chunks/{chunk-2XPMATEK.js → chunk-CXUHD2O5.js} +2 -2
  66. package/dist/cli/chunks/{chunk-W7TYKPLY.js → chunk-CYYT6YEV.js} +2 -2
  67. package/dist/cli/chunks/{chunk-SO6G4IX3.js → chunk-D72N5V2S.js} +2 -2
  68. package/dist/cli/chunks/{chunk-4LODYRNV.js → chunk-DQ3J7ZT6.js} +2 -2
  69. package/dist/cli/chunks/{chunk-PVDXNQPL.js → chunk-DSNFOX22.js} +2 -2
  70. package/dist/cli/chunks/{chunk-LPR2R3AN.js → chunk-EOBZJDJR.js} +3 -3
  71. package/dist/cli/chunks/{chunk-6R3YOAKO.js → chunk-FBYFDD7L.js} +2 -2
  72. package/dist/cli/chunks/{chunk-ZPP57WQU.js → chunk-FFSS3Y6W.js} +2 -2
  73. package/dist/cli/chunks/chunk-FNMEVLSN.js +2 -0
  74. package/dist/cli/chunks/{chunk-7KXPNNMR.js → chunk-GASACVTU.js} +2 -2
  75. package/dist/cli/chunks/{chunk-ABU64UWB.js → chunk-GGF5FZWS.js} +1 -1
  76. package/dist/cli/chunks/{chunk-M6FW56MV.js → chunk-GLO53MUQ.js} +2 -2
  77. package/dist/cli/chunks/{chunk-52U5BFZP.js → chunk-GW3M7GQH.js} +2 -2
  78. package/dist/cli/chunks/chunk-GXMNCW2M.js +2 -0
  79. package/dist/cli/chunks/{chunk-D45QLJEL.js → chunk-HDI3FD4G.js} +1 -1
  80. package/dist/cli/chunks/{chunk-26WEI3P4.js → chunk-HGKSU4QV.js} +2 -2
  81. package/dist/cli/chunks/{chunk-B2VBDMDI.js → chunk-HHMTQQUE.js} +2 -2
  82. package/dist/cli/chunks/{chunk-4Y3LGBKJ.js → chunk-HZGFER4N.js} +3 -3
  83. package/dist/cli/chunks/{chunk-AXKWV5NF.js → chunk-I4BZLVFE.js} +3 -3
  84. package/dist/cli/chunks/{chunk-JDSHUECG.js → chunk-IC6SOVGO.js} +2 -2
  85. package/dist/cli/chunks/{chunk-YFCULQBP.js → chunk-IE6FDICX.js} +2 -2
  86. package/dist/cli/chunks/{chunk-FGD6HINU.js → chunk-IHWWZOHP.js} +1 -1
  87. package/dist/cli/chunks/{chunk-HC6KTVFR.js → chunk-J4IAMQZI.js} +2 -2
  88. package/dist/cli/chunks/{chunk-VMFAANWX.js → chunk-J6ZCULWG.js} +2 -2
  89. package/dist/cli/chunks/{chunk-YGVDP6X7.js → chunk-JDZIBSMY.js} +1 -1
  90. package/dist/cli/chunks/{chunk-WPSK237F.js → chunk-JIM4VSLF.js} +3 -3
  91. package/dist/cli/chunks/{chunk-EK3HPH6A.js → chunk-JRHRC2MP.js} +1 -1
  92. package/dist/cli/chunks/{chunk-3JF5A72M.js → chunk-JRNDFC23.js} +2 -2
  93. package/dist/cli/chunks/chunk-JWZNWVLG.js +153 -0
  94. package/dist/cli/chunks/{chunk-Q5TR6ETB.js → chunk-KQV5644J.js} +3 -3
  95. package/dist/cli/chunks/{chunk-4RTWPR3X.js → chunk-LAJHHR3Q.js} +1 -1
  96. package/dist/cli/chunks/{chunk-AOXJFDH5.js → chunk-LF5XOYR7.js} +10 -10
  97. package/dist/cli/chunks/{chunk-I3NWKPXJ.js → chunk-LRWBOJ5Y.js} +2 -2
  98. package/dist/cli/chunks/{chunk-354367AP.js → chunk-LZ6TJ7XL.js} +2 -2
  99. package/dist/cli/chunks/{chunk-4QOI5JS7.js → chunk-M5P5WNXA.js} +1 -1
  100. package/dist/cli/chunks/{chunk-SE3JFUKP.js → chunk-MCUILJ33.js} +1 -1
  101. package/dist/cli/chunks/{chunk-ZG5UAEEO.js → chunk-MIAY35K6.js} +2 -2
  102. package/dist/cli/chunks/{chunk-6Q57K4YD.js → chunk-N3PSRG6F.js} +2 -2
  103. package/dist/cli/chunks/{chunk-FMNXHVIN.js → chunk-NEXJUTHF.js} +2 -2
  104. package/dist/cli/chunks/{chunk-RJN2RM76.js → chunk-NHRBKOYD.js} +2 -2
  105. package/dist/cli/chunks/{chunk-BJLA2IX7.js → chunk-NK2Z6FGF.js} +2 -2
  106. package/dist/cli/chunks/{chunk-Y25PO65W.js → chunk-NOCPO55P.js} +2 -2
  107. package/dist/cli/chunks/{chunk-XT4TDLOB.js → chunk-NTMN2ZJY.js} +2 -2
  108. package/dist/cli/chunks/{chunk-7DTMENY6.js → chunk-NVXSM7UO.js} +2 -2
  109. package/dist/cli/chunks/{chunk-CKOF27L7.js → chunk-O65OPAZH.js} +2 -2
  110. package/dist/cli/chunks/{chunk-OGNTCZKK.js → chunk-OEXSBR72.js} +1 -1
  111. package/dist/cli/chunks/{chunk-Y6DWJKHU.js → chunk-OJORNYN3.js} +3 -3
  112. package/dist/cli/chunks/{chunk-DPL762HU.js → chunk-ONSNNY6J.js} +1 -1
  113. package/dist/cli/chunks/{chunk-IBDQWKI3.js → chunk-OXVAGR64.js} +2 -2
  114. package/dist/cli/chunks/{chunk-C5C4W572.js → chunk-P7G5LGUE.js} +2 -2
  115. package/dist/cli/chunks/{chunk-XLT3FYS7.js → chunk-PDS5P5QD.js} +2 -2
  116. package/dist/cli/chunks/{chunk-IU5RSN6M.js → chunk-PQ4NSXZM.js} +2 -2
  117. package/dist/cli/chunks/{chunk-4MHN7JWC.js → chunk-PRA73XZY.js} +12 -12
  118. package/dist/cli/chunks/{chunk-2XQHG56O.js → chunk-PZ3Q34OT.js} +2 -2
  119. package/dist/cli/chunks/{chunk-EEKG35K5.js → chunk-PZZDAECU.js} +3 -3
  120. package/dist/cli/chunks/{chunk-J6PFPY7V.js → chunk-QJXUK54J.js} +2 -2
  121. package/dist/cli/chunks/{chunk-7P6X4BFO.js → chunk-QOAI6ETC.js} +3 -3
  122. package/dist/cli/chunks/{chunk-53YOYZW5.js → chunk-QORWBION.js} +2 -2
  123. package/dist/cli/chunks/{chunk-OS62Y77J.js → chunk-QXZOUETY.js} +2 -2
  124. package/dist/cli/chunks/{chunk-G2ZIJZJ7.js → chunk-QZBPXJ5C.js} +2 -2
  125. package/dist/cli/chunks/{chunk-WHHQIL4F.js → chunk-R4A6PY5D.js} +2 -2
  126. package/dist/cli/chunks/{chunk-ZLBY25MB.js → chunk-R7XEACKR.js} +1 -1
  127. package/dist/cli/chunks/{chunk-K4C25BWV.js → chunk-RAS7WRN5.js} +2 -2
  128. package/dist/cli/chunks/{chunk-MHMQ6MCT.js → chunk-REJGZP27.js} +2 -2
  129. package/dist/cli/chunks/{chunk-PW72M2FE.js → chunk-RIASOMB2.js} +2 -2
  130. package/dist/cli/chunks/{chunk-TEIWJ3GJ.js → chunk-RJ7TU2MP.js} +1 -1
  131. package/dist/cli/chunks/{chunk-W72FJA2H.js → chunk-S42RFOZJ.js} +2 -2
  132. package/dist/cli/chunks/chunk-SFQFBLWQ.js +2 -0
  133. package/dist/cli/chunks/{chunk-O7J54OHN.js → chunk-SHKOPOPD.js} +1 -1
  134. package/dist/cli/chunks/{chunk-QKK7VBVB.js → chunk-TGIKKD43.js} +2 -2
  135. package/dist/cli/chunks/chunk-TMPRR3FZ.js +2 -0
  136. package/dist/cli/chunks/{chunk-GW6XWMX2.js → chunk-U55X2ZUM.js} +2 -2
  137. package/dist/cli/chunks/{chunk-C4EZNOWK.js → chunk-U5ITD7ZD.js} +1 -1
  138. package/dist/cli/chunks/{chunk-RKXZLTWR.js → chunk-UBPJQKYS.js} +2 -2
  139. package/dist/cli/chunks/{chunk-DVW66FPU.js → chunk-UBWSYDO5.js} +1 -1
  140. package/dist/cli/chunks/chunk-UEC53US3.js +316 -0
  141. package/dist/cli/chunks/{chunk-UBY322ED.js → chunk-UGPBL7LX.js} +2 -2
  142. package/dist/cli/chunks/{chunk-MMEXHZUC.js → chunk-UKF4V7LE.js} +5 -5
  143. package/dist/cli/chunks/{chunk-FIPKIIMS.js → chunk-UR655D4K.js} +2 -2
  144. package/dist/cli/chunks/{chunk-GODAWJMZ.js → chunk-USTUWUCE.js} +2 -2
  145. package/dist/cli/chunks/{chunk-FGSIID5C.js → chunk-UZXDYT6O.js} +2 -2
  146. package/dist/cli/chunks/{chunk-JATLFS6A.js → chunk-VFRWLSQO.js} +1 -1
  147. package/dist/cli/chunks/{chunk-AF6P5RWY.js → chunk-VHJCQBD2.js} +2 -2
  148. package/dist/cli/chunks/{chunk-J5XDKVI7.js → chunk-VTFYY4SH.js} +2 -2
  149. package/dist/cli/chunks/{chunk-BTLUWH4R.js → chunk-W52R3G22.js} +2 -2
  150. package/dist/cli/chunks/{chunk-AOQYORVA.js → chunk-WBDV4V3H.js} +2 -2
  151. package/dist/cli/chunks/{chunk-3I4TCMOJ.js → chunk-WPEGG6DX.js} +1 -1
  152. package/dist/cli/chunks/{chunk-KQVIWE3W.js → chunk-WPG5LXR7.js} +2 -2
  153. package/dist/cli/chunks/{chunk-DLBVADWQ.js → chunk-X2CEX4KC.js} +42 -42
  154. package/dist/cli/chunks/{chunk-MTBGOWJA.js → chunk-X2K3BTI4.js} +2 -2
  155. package/dist/cli/chunks/{chunk-NCSXLMDL.js → chunk-XDRAU3W6.js} +2 -2
  156. package/dist/cli/chunks/{chunk-URP75DL4.js → chunk-XJTGLG7G.js} +1 -1
  157. package/dist/cli/chunks/{chunk-TRNBQFFG.js → chunk-XS6BIOPQ.js} +2 -2
  158. package/dist/cli/chunks/{chunk-MEIU7457.js → chunk-XTAXSKPC.js} +2 -2
  159. package/dist/cli/chunks/{chunk-VN2HHBZN.js → chunk-XYV6YUWS.js} +2 -2
  160. package/dist/cli/chunks/{chunk-UORTQXJ2.js → chunk-YGB3MT3R.js} +1 -1
  161. package/dist/cli/chunks/{chunk-37ZUF5NX.js → chunk-YNXQMJGJ.js} +1 -1
  162. package/dist/cli/chunks/{chunk-BLPWJQTY.js → chunk-ZCDGLNJ7.js} +2 -2
  163. package/dist/cli/chunks/{chunk-62UM7Q5N.js → chunk-ZNITDSWL.js} +1 -1
  164. package/dist/cli/chunks/{ci-CBNVLOOQ.js → ci-IU5HVUL5.js} +2 -2
  165. package/dist/cli/chunks/{ci-output-I4HY2FYJ.js → ci-output-CLI4A43F.js} +2 -2
  166. package/dist/cli/chunks/{circuit-breaker-5VRBKGWL.js → circuit-breaker-ZR5OFMW7.js} +2 -2
  167. package/dist/cli/chunks/{claude-flow-setup-XPJPKHIO.js → claude-flow-setup-UBMA6ZHJ.js} +2 -2
  168. package/dist/cli/chunks/client-KKCFGD7R.js +2 -0
  169. package/dist/cli/chunks/{cline-installer-OFRDUUWZ.js → cline-installer-EWYELOBI.js} +2 -2
  170. package/dist/cli/chunks/{code-QIZQVB3E.js → code-YSPF4MXN.js} +2 -2
  171. package/dist/cli/chunks/{code-index-extractor-LMUUWEX4.js → code-index-extractor-WW5OKSTN.js} +2 -2
  172. package/dist/cli/chunks/{codex-installer-N2MKIZ2S.js → codex-installer-GLADK5PY.js} +2 -2
  173. package/dist/cli/chunks/{completions-Y36S3C5J.js → completions-2KTWZ3AK.js} +2 -2
  174. package/dist/cli/chunks/{complexity-analyzer-73YS3WUD.js → complexity-analyzer-KMX4OWKB.js} +2 -2
  175. package/dist/cli/chunks/{continuedev-installer-SAOTP6J3.js → continuedev-installer-4FHU4OEJ.js} +2 -2
  176. package/dist/cli/chunks/{copilot-installer-A4HXF6HE.js → copilot-installer-AKR4WE7B.js} +2 -2
  177. package/dist/cli/chunks/core-handlers-KRSSJEO5.js +2 -0
  178. package/dist/cli/chunks/{cost-tracker-P26XUVZS.js → cost-tracker-BUJ6WEWY.js} +2 -2
  179. package/dist/cli/chunks/{coverage-HVNHSMVJ.js → coverage-OB6HVQS4.js} +3 -3
  180. package/dist/cli/chunks/cross-domain-router-27QGWU27.js +2 -0
  181. package/dist/cli/chunks/{cursor-installer-46BQFTYZ.js → cursor-installer-3AOE4O3Q.js} +2 -2
  182. package/dist/cli/chunks/{daemon-Y54O3FLT.js → daemon-4RAL5URG.js} +3 -3
  183. package/dist/cli/chunks/{daemon-YE7K2AZF.js → daemon-JGSPLYGO.js} +4 -4
  184. package/dist/cli/chunks/{dag-attention-scheduler-ETA7YY52.js → dag-attention-scheduler-DSBTHIMH.js} +2 -2
  185. package/dist/cli/chunks/{detect-5WLQ2J3E.js → detect-6CVW2VUQ.js} +2 -2
  186. package/dist/cli/chunks/{dist-node-45WW6I7J.js → dist-node-EWPKBTYA.js} +2 -2
  187. package/dist/cli/chunks/{domain-handler-J7DQV74M.js → domain-handler-HLVIJU25.js} +2 -2
  188. package/dist/cli/chunks/{domain-transfer-GD2EGQVR.js → domain-transfer-7Y3BR3YU.js} +2 -2
  189. package/dist/cli/chunks/dream-M6K47Q4H.js +2 -0
  190. package/dist/cli/chunks/{embed-and-insert-pattern-JELNEA2D.js → embed-and-insert-pattern-ZMJ3263X.js} +2 -2
  191. package/dist/cli/chunks/{eval-A4PA5G2U.js → eval-73XW2WJD.js} +2 -2
  192. package/dist/cli/chunks/{experience-capture-middleware-MLHTYWTA.js → experience-capture-middleware-OGJ3JOSQ.js} +3 -3
  193. package/dist/cli/chunks/{fast-paths-QYDTITRV.js → fast-paths-5XCY3Y6U.js} +2 -2
  194. package/dist/cli/chunks/{feature-flags-H4MSY26Z.js → feature-flags-R5V2FRJR.js} +2 -2
  195. package/dist/cli/chunks/{feature-flags-MQYYRHIK.js → feature-flags-VULQI6KY.js} +2 -2
  196. package/dist/cli/chunks/{file-discovery-RMFVJNGL.js → file-discovery-HW33C3HC.js} +2 -2
  197. package/dist/cli/chunks/{fleet-7KZQOTAC.js → fleet-NH3XR5OY.js} +3 -3
  198. package/dist/cli/chunks/{gnn-wrapper-NMZFTGVH.js → gnn-wrapper-L3XMLPTG.js} +2 -2
  199. package/dist/cli/chunks/{heartbeat-handler-7BQDK7MG.js → heartbeat-handler-TIQFBT4D.js} +4 -4
  200. package/dist/cli/chunks/heartbeat-scheduler-URXBF5RW.js +2 -0
  201. package/dist/cli/chunks/hnsw-adapter-WWAGM6HK.js +2 -0
  202. package/dist/cli/chunks/hnsw-index-UFV2HSZE.js +2 -0
  203. package/dist/cli/chunks/{hnsw-legacy-bridge-TPPGBPKF.js → hnsw-legacy-bridge-YL2SUIPA.js} +2 -2
  204. package/dist/cli/chunks/{better-sqlite3-2KR4LQRU.js → hnswlib-node-62RTSHAY.js} +2 -2
  205. package/dist/cli/chunks/{hooks-CYZIUYSH.js → hooks-UR2ZF54G.js} +10 -10
  206. package/dist/cli/chunks/hybrid-router-3U6Q6OTL.js +2 -0
  207. package/dist/cli/chunks/{hypergraph-engine-WC6DMTYQ.js → hypergraph-engine-NX45AOPY.js} +2 -2
  208. package/dist/cli/chunks/{hypergraph-handler-GTGA3TXJ.js → hypergraph-handler-LUM4YI4K.js} +3 -3
  209. package/dist/cli/chunks/impact-analyzer-EUEX6ZRO.js +2 -0
  210. package/dist/cli/chunks/{init-handler-N3Z72JNI.js → init-handler-YTKKNTVV.js} +6 -6
  211. package/dist/cli/chunks/init-wizard-POKY2LRY.js +2 -0
  212. package/dist/cli/chunks/kernel-HPAONLZY.js +2 -0
  213. package/dist/cli/chunks/{kilocode-installer-FUX4V6II.js → kilocode-installer-ZW7DVH7T.js} +2 -2
  214. package/dist/cli/chunks/{kiro-installer-ZSNZT7ZR.js → kiro-installer-IA7INW4N.js} +2 -2
  215. package/dist/cli/chunks/knowledge-graph-2WCUFG63.js +2 -0
  216. package/dist/cli/chunks/{learning-UQY64COU.js → learning-4AZ5PGTT.js} +3 -3
  217. package/dist/cli/chunks/{llm-router-CMHGGX6N.js → llm-router-WQ4E3AOP.js} +4 -4
  218. package/dist/cli/chunks/llm-router-service-D5VMG6SD.js +2 -0
  219. package/dist/cli/chunks/{load-E6WH4QN2.js → load-4FAH7CZO.js} +2 -2
  220. package/dist/cli/chunks/load-test-DHG26REU.js +2 -0
  221. package/dist/cli/chunks/{mcp-UM5VTW6N.js → mcp-KLLHI6DG.js} +2 -2
  222. package/dist/cli/chunks/{memory-7Q3XDUE5.js → memory-Q5HLIUC6.js} +5 -5
  223. package/dist/cli/chunks/memory-backend-GLWQ4DAL.js +2 -0
  224. package/dist/cli/chunks/memory-handlers-P72I4VV4.js +2 -0
  225. package/dist/cli/chunks/{multi-model-executor-LZENWVRR.js → multi-model-executor-ABI73AFV.js} +2 -2
  226. package/dist/cli/chunks/{opencode-installer-O2JAIPLF.js → opencode-installer-KRPQ6JOJ.js} +2 -2
  227. package/dist/cli/chunks/{orchestrator-DKZWXDRI.js → orchestrator-SUPEONRG.js} +18 -18
  228. package/dist/cli/chunks/pattern-null-store-Y2YFTE3V.js +2 -0
  229. package/dist/cli/chunks/{pattern-usage-recorder-CLUL4M55.js → pattern-usage-recorder-R4GKK6RZ.js} +2 -2
  230. package/dist/cli/chunks/{pipeline-2VDLTR5J.js → pipeline-LCUETNGD.js} +2 -2
  231. package/dist/cli/chunks/{platform-4N4Q5XYX.js → platform-WJDIB4X3.js} +2 -2
  232. package/dist/cli/chunks/{plugin-GY5AU5CS.js → plugin-2X5NY2RF.js} +2 -2
  233. package/dist/cli/chunks/{prime-radiant-advanced-wasm-TQ4DKDZS.js → prime-radiant-advanced-wasm-3T665QC6.js} +2 -2
  234. package/dist/cli/chunks/protocol-executor-HNT67NN5.js +2 -0
  235. package/dist/cli/chunks/{protocol-handler-T3LZ3WRG.js → protocol-handler-JTXRF7GU.js} +2 -2
  236. package/dist/cli/chunks/{prove-OV7S5J4W.js → prove-BFPWWPOC.js} +2 -2
  237. package/dist/cli/chunks/provider-manager-5YGPZIEZ.js +2 -0
  238. package/dist/cli/chunks/qe-reasoning-bank-Z5UGOA3F.js +2 -0
  239. package/dist/cli/chunks/{quality-AXD4NLQA.js → quality-F7UZU4RN.js} +2 -2
  240. package/dist/cli/chunks/quality-gate-R5L4UZIX.js +7 -0
  241. package/dist/cli/chunks/queen-coordinator-P5LU5NWI.js +2 -0
  242. package/dist/cli/chunks/{real-embeddings-2PUCC7FG.js → real-embeddings-LZD6HTQF.js} +2 -2
  243. package/dist/cli/chunks/{roocode-installer-WJ5ARGLW.js → roocode-installer-6TTG7VSH.js} +2 -2
  244. package/dist/cli/chunks/router-CRGHUAVR.js +2 -0
  245. package/dist/cli/chunks/routing-feedback-BVX5ZBCF.js +2 -0
  246. package/dist/cli/chunks/{routing-handler-CU6657SZ.js → routing-handler-SW442GK7.js} +2 -2
  247. package/dist/cli/chunks/{ruvector-commands-IIF6VSFW.js → ruvector-commands-CLFGKXMW.js} +2 -2
  248. package/dist/cli/chunks/{rvf-dual-writer-YMQI7XO2.js → rvf-dual-writer-EVPPXXXS.js} +2 -2
  249. package/dist/cli/chunks/{rvf-migration-adapter-HDE3PR2W.js → rvf-migration-adapter-NOHDIRIP.js} +2 -2
  250. package/dist/cli/chunks/{rvf-migration-coordinator-MQV5OA7K.js → rvf-migration-coordinator-BYJ3M7WZ.js} +2 -2
  251. package/dist/cli/chunks/rvf-native-adapter-FZJSQOJM.js +2 -0
  252. package/dist/cli/chunks/safe-db-USYNEOC6.js +2 -0
  253. package/dist/cli/chunks/schedule-KCRCQ3PS.js +2 -0
  254. package/dist/cli/chunks/scheduler-CX3UHI4U.js +2 -0
  255. package/dist/cli/chunks/{security-UM3IGDSM.js → security-IXDKBPSG.js} +3 -3
  256. package/dist/cli/chunks/{shared-rvf-adapter-I3SOJ6M4.js → shared-rvf-adapter-VCOK3OVD.js} +2 -2
  257. package/dist/cli/chunks/{shared-rvf-dual-writer-KQGC2UO7.js → shared-rvf-dual-writer-FFKBKYNL.js} +2 -2
  258. package/dist/cli/chunks/sqlite-persistence-K23C4TFH.js +2 -0
  259. package/dist/cli/chunks/{status-handler-OX4CJZME.js → status-handler-M5W64S5U.js} +2 -2
  260. package/dist/cli/chunks/{structural-health-PYUMVBXJ.js → structural-health-55X6BTLT.js} +2 -2
  261. package/dist/cli/chunks/{sync-VALFNTA6.js → sync-BUGDXW3Y.js} +2 -2
  262. package/dist/cli/chunks/{sync-2TED3YTY.js → sync-NUG67HGK.js} +2 -2
  263. package/dist/cli/chunks/{task-handler-VPGAJVPC.js → task-handler-T6ZKXV4S.js} +2 -2
  264. package/dist/cli/chunks/{task-handlers-IB4UAMU6.js → task-handlers-H63TB2UI.js} +3 -3
  265. package/dist/cli/chunks/{test-OMRJOZB6.js → test-VEK76SBT.js} +4 -4
  266. package/dist/cli/chunks/{test-scheduling-ZL3YFPBU.js → test-scheduling-QZM6PNZH.js} +3 -3
  267. package/dist/cli/chunks/{token-bootstrap-DNWZI7SH.js → token-bootstrap-W5IAMJW4.js} +2 -2
  268. package/dist/cli/chunks/{token-usage-IYO7RGFF.js → token-usage-OBY6UEUR.js} +2 -2
  269. package/dist/cli/chunks/{transformers-53ALC34T.js → transformers-EFNY2MRX.js} +2 -2
  270. package/dist/cli/chunks/{tree-sitter-wasm-parser-WUKJ2I2Q.js → tree-sitter-wasm-parser-EU2S5NVM.js} +2 -2
  271. package/dist/cli/chunks/{types-47FTEPMV.js → types-3DYRKX23.js} +2 -2
  272. package/dist/cli/chunks/unified-memory-NCDBQLLF.js +2 -0
  273. package/dist/cli/chunks/unified-memory-hnsw-T7NSGQ2H.js +2 -0
  274. package/dist/cli/chunks/unified-persistence-XUAYDCMM.js +2 -0
  275. package/dist/cli/chunks/{upgrade-QPLMJA5Z.js → upgrade-H5V53FRF.js} +2 -2
  276. package/dist/cli/chunks/{validate-3GVKZOVF.js → validate-IL22VB5I.js} +2 -2
  277. package/dist/cli/chunks/{validate-swarm-XCRTLVM6.js → validate-swarm-WZKECK3W.js} +2 -2
  278. package/dist/cli/chunks/{vibium-CH4VPKVZ.js → vibium-KKM23OTQ.js} +2 -2
  279. package/dist/cli/chunks/visual-security-3TUC4GPP.js +2 -0
  280. package/dist/cli/chunks/{web-tree-sitter-JDBNAZTV.js → web-tree-sitter-NJM5YBOY.js} +2 -2
  281. package/dist/cli/chunks/{windsurf-installer-3MNPVJBP.js → windsurf-installer-SLP43TVT.js} +2 -2
  282. package/dist/cli/chunks/witness-chain-QLOKUZXC.js +2 -0
  283. package/dist/cli/chunks/{witness-chain-HR5UBV5J.js → witness-chain-XBEPT4XD.js} +2 -2
  284. package/dist/cli/chunks/{witness-key-manager-G5SQTIBZ.js → witness-key-manager-DAAMNYOW.js} +2 -2
  285. package/dist/cli/chunks/{workflow-43EMD5FY.js → workflow-SZOOU6D3.js} +4 -4
  286. package/dist/cli/chunks/workflow-orchestrator-6JAYTZ7L.js +2 -0
  287. package/dist/cli/chunks/{wrappers-3N7AYNM3.js → wrappers-I2CBKWGF.js} +2 -2
  288. package/dist/cli/commands/quality-gate.d.ts +24 -0
  289. package/dist/cli/commands/quality-gate.js +135 -0
  290. package/dist/cli/index.js +5 -0
  291. package/dist/coordination/mincut/dream-integration.d.ts +11 -0
  292. package/dist/coordination/mincut/dream-integration.js +39 -12
  293. package/dist/init/init-wizard-hooks.js +11 -25
  294. package/dist/init/phases/07-hooks.js +15 -25
  295. package/dist/init/settings-merge.d.ts +44 -0
  296. package/dist/init/settings-merge.js +119 -4
  297. package/dist/integrations/ruvector/feature-flags.js +7 -0
  298. package/dist/learning/pattern-lifecycle.d.ts +16 -0
  299. package/dist/learning/pattern-lifecycle.js +77 -1
  300. package/dist/learning/provenance-tier.d.ts +52 -0
  301. package/dist/learning/provenance-tier.js +64 -0
  302. package/dist/learning/qe-flywheel/corpus-scorer.d.ts +55 -0
  303. package/dist/learning/qe-flywheel/corpus-scorer.js +293 -0
  304. package/dist/learning/qe-flywheel/coupled-anchor.d.ts +91 -0
  305. package/dist/learning/qe-flywheel/coupled-anchor.js +181 -0
  306. package/dist/learning/qe-flywheel/generation.d.ts +121 -0
  307. package/dist/learning/qe-flywheel/generation.js +167 -0
  308. package/dist/learning/qe-flywheel/policy.d.ts +37 -0
  309. package/dist/learning/qe-flywheel/policy.js +66 -0
  310. package/dist/learning/qe-flywheel/receipt-store.d.ts +31 -0
  311. package/dist/learning/qe-flywheel/receipt-store.js +89 -0
  312. package/dist/learning/qe-flywheel/receipt.d.ts +62 -0
  313. package/dist/learning/qe-flywheel/receipt.js +97 -0
  314. package/dist/mcp/bundle.js +396 -390
  315. package/dist/mcp/tools/quality-assessment/gate.d.ts +38 -0
  316. package/dist/mcp/tools/quality-assessment/gate.js +86 -0
  317. package/dist/mcp/tools/registry.d.ts +1 -0
  318. package/dist/mcp/tools/registry.js +3 -0
  319. package/dist/shared/safe-db.js +23 -4
  320. package/dist/validation/anchor-set.d.ts +74 -0
  321. package/dist/validation/anchor-set.js +78 -0
  322. package/dist/validation/frontier-judge.d.ts +99 -0
  323. package/dist/validation/frontier-judge.js +234 -0
  324. package/dist/validation/gate-reexecute.d.ts +165 -0
  325. package/dist/validation/gate-reexecute.js +255 -0
  326. package/dist/validation/quality-gate-runner.d.ts +49 -0
  327. package/dist/validation/quality-gate-runner.js +62 -0
  328. package/dist/validation/quality-verdict.d.ts +94 -0
  329. package/dist/validation/quality-verdict.js +120 -0
  330. package/package.json +1 -1
  331. package/dist/cli/chunks/adapter-KNM5R47J.js +0 -2
  332. package/dist/cli/chunks/aqe-learning-engine-MXPJLVR3.js +0 -2
  333. package/dist/cli/chunks/base-X4EXQ2AS.js +0 -2
  334. package/dist/cli/chunks/browser-workflow-4HX6RP5F.js +0 -2
  335. package/dist/cli/chunks/chunk-FHTYEAQ3.js +0 -2
  336. package/dist/cli/chunks/chunk-MIU5RUBJ.js +0 -149
  337. package/dist/cli/chunks/chunk-SK754ZSH.js +0 -316
  338. package/dist/cli/chunks/chunk-V6NAB5UZ.js +0 -2
  339. package/dist/cli/chunks/chunk-YR2JKBZO.js +0 -2
  340. package/dist/cli/chunks/chunk-ZMPAM4DY.js +0 -2
  341. package/dist/cli/chunks/client-AHXNCOHK.js +0 -2
  342. package/dist/cli/chunks/core-handlers-EEFLLMAZ.js +0 -2
  343. package/dist/cli/chunks/cross-domain-router-LT3H4SNJ.js +0 -2
  344. package/dist/cli/chunks/dream-4K3BK4IG.js +0 -2
  345. package/dist/cli/chunks/heartbeat-scheduler-IMPPGQUK.js +0 -2
  346. package/dist/cli/chunks/hnsw-adapter-EIAA6R2L.js +0 -2
  347. package/dist/cli/chunks/hnsw-index-ZXXP6AXZ.js +0 -2
  348. package/dist/cli/chunks/hybrid-router-LXWG4MLH.js +0 -2
  349. package/dist/cli/chunks/impact-analyzer-TP5LRFYH.js +0 -2
  350. package/dist/cli/chunks/init-wizard-AIOA5KOY.js +0 -2
  351. package/dist/cli/chunks/kernel-SQALRU6Q.js +0 -2
  352. package/dist/cli/chunks/knowledge-graph-JFVT6SNN.js +0 -2
  353. package/dist/cli/chunks/llm-router-service-XHFKTH3I.js +0 -2
  354. package/dist/cli/chunks/load-test-JEIFJKNN.js +0 -2
  355. package/dist/cli/chunks/memory-backend-NT7I37CP.js +0 -2
  356. package/dist/cli/chunks/memory-handlers-746D7NE7.js +0 -2
  357. package/dist/cli/chunks/pattern-null-store-6QU6WHDW.js +0 -2
  358. package/dist/cli/chunks/protocol-executor-GT2MZYUU.js +0 -2
  359. package/dist/cli/chunks/provider-manager-OATJ7R3D.js +0 -2
  360. package/dist/cli/chunks/qe-reasoning-bank-IJXNQ67O.js +0 -2
  361. package/dist/cli/chunks/queen-coordinator-6RBHWCUG.js +0 -2
  362. package/dist/cli/chunks/router-XKQRT5JK.js +0 -2
  363. package/dist/cli/chunks/routing-feedback-ACPSD4LW.js +0 -2
  364. package/dist/cli/chunks/rvf-native-adapter-SIWRKE33.js +0 -2
  365. package/dist/cli/chunks/safe-db-LCPUYMX4.js +0 -2
  366. package/dist/cli/chunks/schedule-HIQJCWXG.js +0 -2
  367. package/dist/cli/chunks/scheduler-QE5EJ5LE.js +0 -2
  368. package/dist/cli/chunks/sqlite-persistence-EU54UTMH.js +0 -2
  369. package/dist/cli/chunks/unified-memory-CJLMC2I4.js +0 -2
  370. package/dist/cli/chunks/unified-memory-hnsw-FDGR4D2J.js +0 -2
  371. package/dist/cli/chunks/unified-persistence-UFH5GLDN.js +0 -2
  372. package/dist/cli/chunks/visual-security-4ARJ7J2Y.js +0 -2
  373. package/dist/cli/chunks/witness-chain-73QC33ED.js +0 -2
  374. package/dist/cli/chunks/workflow-orchestrator-RKMMPXNA.js +0 -2
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Provenance tiers for learning writes (ADR-121).
3
+ *
4
+ * Every learning write carries an explicit evidence tier. Authority tracks
5
+ * evidence strength: an execution-observed outcome is ground truth, an LLM
6
+ * judgment is a noisy opinion (ADR-119), a structural/co-occurrence inference
7
+ * is a weak guess. Only `oracle:test-exec` (or an explicitly-budgeted
8
+ * `judge:llm`) may change fleet behavior; `proxy:structural` is written and
9
+ * searchable but never auto-promoted.
10
+ *
11
+ * Mirrors ruflo ADR-174's in-code tier gate (not prose). Shared across every
12
+ * promotion path (pattern promotion, dream apply, flywheel accept) so the gate
13
+ * is defined once.
14
+ */
15
+ /** Ordered strongest → weakest. Index is the rank (0 = strongest). */
16
+ export const PROVENANCE_TIERS = [
17
+ 'oracle:test-exec',
18
+ 'judge:llm',
19
+ 'proxy:structural',
20
+ ];
21
+ /**
22
+ * Conservative default for undifferentiated / legacy / unknown writes.
23
+ * The backfill (ADR-121 §4) tags all pre-existing rows with this — it can
24
+ * never over-credit, only under-credit until a row is re-derived from
25
+ * execution evidence through the normal write path.
26
+ */
27
+ export const DEFAULT_PROVENANCE_TIER = 'proxy:structural';
28
+ /** Rank of a tier (0 = strongest). Unknown tiers rank as the weakest. */
29
+ export function tierRank(tier) {
30
+ const idx = PROVENANCE_TIERS.indexOf(coerceTier(tier));
31
+ return idx < 0 ? PROVENANCE_TIERS.length - 1 : idx;
32
+ }
33
+ /**
34
+ * Normalize any raw value read from storage into a known tier.
35
+ * Null / undefined / unrecognized → the conservative default. Never throws —
36
+ * a bad tier must degrade to "weak", never crash the promotion path.
37
+ */
38
+ export function coerceTier(raw) {
39
+ if (raw && PROVENANCE_TIERS.includes(raw)) {
40
+ return raw;
41
+ }
42
+ return DEFAULT_PROVENANCE_TIER;
43
+ }
44
+ /**
45
+ * The in-code promotion gate (ADR-121 §2). `oracle:test-exec` may always
46
+ * promote; `judge:llm` promotes only under an explicit budget flag;
47
+ * `proxy:structural` is NEVER auto-promoted.
48
+ *
49
+ * This is the single authority consulted by every promotion path. It does not
50
+ * decide whether the *metrics* clear threshold — only whether the *evidence
51
+ * tier* is strong enough to be allowed to change fleet behavior at all.
52
+ */
53
+ export function tierAllowsPromotion(tier, options = {}) {
54
+ switch (coerceTier(tier)) {
55
+ case 'oracle:test-exec':
56
+ return true;
57
+ case 'judge:llm':
58
+ return options.allowJudgeTier === true;
59
+ case 'proxy:structural':
60
+ default:
61
+ return false;
62
+ }
63
+ }
64
+ //# sourceMappingURL=provenance-tier.js.map
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Real corpus scorer for the QE-policy flywheel (ADR-118) — the injected
3
+ * `PolicyScorer` seam that generation.ts DI's. Turns a `RetrievalPolicy` into
4
+ * its two decision signals over the live corpus:
5
+ *
6
+ * 1. heldOut — self-supervised self-retrieval MRR over `qe_patterns`: for
7
+ * each stored pattern, a query is built from its BODY tokens with the
8
+ * SUBJECT (name) tokens WITHHELD; the correct label is the pattern's own
9
+ * id. A pure LEXICAL retriever — parameterized entirely by the policy
10
+ * weights (alpha blends body vs subject match, subject/bodyWeight scale the
11
+ * term contributions, typePenaltyFactor penalizes pattern_type mismatch,
12
+ * mmrLambda controls diversity in the ranked list) — ranks the corpus, and
13
+ * Mean Reciprocal Rank of the true doc is the score. A policy whose weights
14
+ * better match the corpus ranks the true doc higher, so heldOut is the
15
+ * optimization signal. NO model, NO network — deterministic lexical only.
16
+ *
17
+ * 2. anchorMean — grade the ADR-117 frozen anchor via `loadAnchorSet` +
18
+ * `evaluateOracle`, using a gold/reference test per item that kills its
19
+ * mutants (mutationScore >= 0.8 on all items), then take the mean.
20
+ *
21
+ * HONEST SCOPE (ruflo ADR-176 "human anchor held flat"): in this retrieval-only
22
+ * wiring the retrieval policy does NOT feed test generation, so the anchor mean
23
+ * is a FLAT no-regression GUARD — constant across every policy. It is graded
24
+ * ONCE and cached. Coupling retrieval -> test-gen -> anchor (so the anchor moves
25
+ * with the policy) requires a model in the loop and is DEFERRED. Here the anchor
26
+ * is the flat floor the gate must not regress, while heldOut is the signal the
27
+ * flywheel actually optimizes.
28
+ */
29
+ import type BetterSqlite3 from 'better-sqlite3';
30
+ import type { PolicyScorer } from './generation.js';
31
+ type SqliteDb = BetterSqlite3.Database;
32
+ /** Default frozen anchor location (ADR-117), consistent with anchor-set tests. */
33
+ export declare const DEFAULT_ANCHOR_PATH: string;
34
+ export interface CorpusScorerOptions {
35
+ /** Read-only handle to the corpus DB (must expose a `qe_patterns` table). */
36
+ db: SqliteDb;
37
+ /** Frozen anchor path (ADR-117). Defaults to the pinned qe-anchor-v1. */
38
+ anchorPath?: string;
39
+ /**
40
+ * Fraction of patterns used as held-out queries (deterministic id-sorted
41
+ * prefix). Default 1 (query every pattern). Lower it to bound the O(n^2) cost
42
+ * on large corpora — the subject-withholding is the real held-out mechanism.
43
+ */
44
+ heldOutRatio?: number;
45
+ }
46
+ /**
47
+ * Build the real `PolicyScorer` for the flywheel. The corpus is read ONCE and
48
+ * the frozen anchor is graded ONCE (lazily, then cached) — the anchor mean is
49
+ * policy-independent (the honest flat guard), so caching makes the flat-guard
50
+ * property exact and avoids re-spawning the oracle per generation. Only heldOut
51
+ * varies with the policy.
52
+ */
53
+ export declare function createCorpusScorer(opts: CorpusScorerOptions): PolicyScorer;
54
+ export {};
55
+ //# sourceMappingURL=corpus-scorer.d.ts.map
@@ -0,0 +1,293 @@
1
+ /**
2
+ * Real corpus scorer for the QE-policy flywheel (ADR-118) — the injected
3
+ * `PolicyScorer` seam that generation.ts DI's. Turns a `RetrievalPolicy` into
4
+ * its two decision signals over the live corpus:
5
+ *
6
+ * 1. heldOut — self-supervised self-retrieval MRR over `qe_patterns`: for
7
+ * each stored pattern, a query is built from its BODY tokens with the
8
+ * SUBJECT (name) tokens WITHHELD; the correct label is the pattern's own
9
+ * id. A pure LEXICAL retriever — parameterized entirely by the policy
10
+ * weights (alpha blends body vs subject match, subject/bodyWeight scale the
11
+ * term contributions, typePenaltyFactor penalizes pattern_type mismatch,
12
+ * mmrLambda controls diversity in the ranked list) — ranks the corpus, and
13
+ * Mean Reciprocal Rank of the true doc is the score. A policy whose weights
14
+ * better match the corpus ranks the true doc higher, so heldOut is the
15
+ * optimization signal. NO model, NO network — deterministic lexical only.
16
+ *
17
+ * 2. anchorMean — grade the ADR-117 frozen anchor via `loadAnchorSet` +
18
+ * `evaluateOracle`, using a gold/reference test per item that kills its
19
+ * mutants (mutationScore >= 0.8 on all items), then take the mean.
20
+ *
21
+ * HONEST SCOPE (ruflo ADR-176 "human anchor held flat"): in this retrieval-only
22
+ * wiring the retrieval policy does NOT feed test generation, so the anchor mean
23
+ * is a FLAT no-regression GUARD — constant across every policy. It is graded
24
+ * ONCE and cached. Coupling retrieval -> test-gen -> anchor (so the anchor moves
25
+ * with the policy) requires a model in the loop and is DEFERRED. Here the anchor
26
+ * is the flat floor the gate must not regress, while heldOut is the signal the
27
+ * flywheel actually optimizes.
28
+ */
29
+ import { join } from 'node:path';
30
+ import { loadAnchorSet, anchorMean } from '../../validation/anchor-set.js';
31
+ import { evaluateOracle } from '../../validation/oracle-eval.js';
32
+ /** Default frozen anchor location (ADR-117), consistent with anchor-set tests. */
33
+ export const DEFAULT_ANCHOR_PATH = join(process.cwd(), 'verification/anchors/qe-anchor-v1.json');
34
+ /** Lowercase, split on non-alphanumerics, keep tokens of length >= 2, dedupe. */
35
+ function tokenize(...parts) {
36
+ const out = new Set();
37
+ for (const part of parts) {
38
+ if (!part)
39
+ continue;
40
+ for (const tok of part.toLowerCase().split(/[^a-z0-9]+/)) {
41
+ if (tok.length >= 2)
42
+ out.add(tok);
43
+ }
44
+ }
45
+ return out;
46
+ }
47
+ function loadCorpus(db) {
48
+ const rows = db
49
+ .prepare(`SELECT id, pattern_type, name, description, template_json, context_json
50
+ FROM qe_patterns`)
51
+ .all();
52
+ return rows.map((r) => {
53
+ const subjectTokens = tokenize(r.name);
54
+ const bodyTokens = tokenize(r.description, r.template_json, r.context_json);
55
+ const allTokens = new Set([...subjectTokens, ...bodyTokens]);
56
+ return {
57
+ id: r.id,
58
+ patternType: r.pattern_type ?? '',
59
+ subjectTokens,
60
+ bodyTokens,
61
+ allTokens,
62
+ };
63
+ });
64
+ }
65
+ // ---------------------------------------------------------------------------
66
+ // Held-out self-retrieval MRR (the optimization signal)
67
+ // ---------------------------------------------------------------------------
68
+ /** Count of query tokens present in the doc's token set (distinct overlap). */
69
+ function overlap(query, docTokens) {
70
+ let n = 0;
71
+ for (const t of query)
72
+ if (docTokens.has(t))
73
+ n++;
74
+ return n;
75
+ }
76
+ /** Jaccard similarity of two token sets (for MMR diversity). */
77
+ function jaccard(a, b) {
78
+ if (a.size === 0 && b.size === 0)
79
+ return 0;
80
+ let inter = 0;
81
+ for (const t of a)
82
+ if (b.has(t))
83
+ inter++;
84
+ const union = a.size + b.size - inter;
85
+ return union === 0 ? 0 : inter / union;
86
+ }
87
+ /**
88
+ * Policy-parameterized lexical relevance of `doc` to a body-only `query` drawn
89
+ * from held-out pattern `queried`. alpha blends the body and subject channels;
90
+ * subject/bodyWeight scale each channel; typePenaltyFactor discounts docs whose
91
+ * pattern_type differs from the queried pattern's.
92
+ */
93
+ function relevance(query, doc, queried, policy) {
94
+ const bodyMatch = overlap(query, doc.bodyTokens);
95
+ const subjectMatch = overlap(query, doc.subjectTokens);
96
+ let rel = policy.alpha * policy.bodyWeight * bodyMatch +
97
+ (1 - policy.alpha) * policy.subjectWeight * subjectMatch;
98
+ if (doc.patternType !== queried.patternType) {
99
+ rel *= 1 - policy.typePenaltyFactor;
100
+ }
101
+ return rel;
102
+ }
103
+ /**
104
+ * Greedy MMR rerank: select next by lambda * normalized-relevance −
105
+ * (1 − lambda) * max-similarity-to-already-selected. lambda = 1 is pure
106
+ * relevance; lower lambda rewards diversity. Ties break by id for determinism.
107
+ */
108
+ function rankMMR(scored, lambda) {
109
+ const remaining = [...scored].sort((a, b) => b.nrel - a.nrel || a.id.localeCompare(b.id));
110
+ const chosen = [];
111
+ while (remaining.length > 0) {
112
+ let bestIdx = 0;
113
+ let bestScore = -Infinity;
114
+ for (let i = 0; i < remaining.length; i++) {
115
+ const sim = chosen.length === 0
116
+ ? 0
117
+ : Math.max(...chosen.map((c) => jaccard(remaining[i].tokens, c.tokens)));
118
+ const mmr = lambda * remaining[i].nrel - (1 - lambda) * sim;
119
+ if (mmr > bestScore ||
120
+ (mmr === bestScore && remaining[i].id.localeCompare(remaining[bestIdx].id) < 0)) {
121
+ bestScore = mmr;
122
+ bestIdx = i;
123
+ }
124
+ }
125
+ chosen.push(remaining.splice(bestIdx, 1)[0]);
126
+ }
127
+ return chosen.map((c) => c.id);
128
+ }
129
+ /**
130
+ * MMR candidate-pool cap. The greedy MMR rerank is O(pool^2 * tokens) per query,
131
+ * so reranking the WHOLE corpus is cubic in corpus size and hangs on a real
132
+ * (hundreds of patterns) corpus. Standard practice is to rerank only the top-K
133
+ * by relevance — the true doc (queried by its own body) ranks into this pool, so
134
+ * MRR is unchanged, while cost stays bounded. Below this size the behavior is
135
+ * identical to reranking everything (so small-corpus tests are unaffected).
136
+ */
137
+ const MMR_POOL_SIZE = 50;
138
+ /** Deterministic held-out query split: id-sorted prefix of `ratio` of the corpus. */
139
+ function selectHeldOut(docs, ratio) {
140
+ const clamped = Math.min(1, Math.max(0, ratio));
141
+ const sorted = [...docs].sort((a, b) => a.id.localeCompare(b.id));
142
+ const n = Math.max(1, Math.ceil(sorted.length * clamped));
143
+ return sorted.slice(0, n);
144
+ }
145
+ /**
146
+ * Mean Reciprocal Rank of each held-out pattern's own id when its BODY tokens
147
+ * are used as the query (subject withheld) and the whole corpus is the
148
+ * candidate pool. In [0, 1]; higher = the policy weights better recover the
149
+ * corpus from its own body signal.
150
+ */
151
+ function scoreHeldOut(docs, policy, ratio) {
152
+ if (docs.length === 0)
153
+ return 0;
154
+ const queries = selectHeldOut(docs, ratio);
155
+ if (queries.length === 0)
156
+ return 0;
157
+ let sumReciprocalRank = 0;
158
+ for (const queried of queries) {
159
+ const query = queried.bodyTokens; // subject deliberately withheld
160
+ const rels = docs.map((d) => ({ doc: d, rel: relevance(query, d, queried, policy) }));
161
+ const maxRel = rels.reduce((m, r) => Math.max(m, r.rel), 0);
162
+ const scored = rels.map((r) => ({
163
+ id: r.doc.id,
164
+ nrel: maxRel > 0 ? r.rel / maxRel : 0,
165
+ tokens: r.doc.allTokens,
166
+ }));
167
+ // Rerank only the top-K by relevance (bounded MMR cost). Force-include the
168
+ // true doc so its rank is always measurable even if it fell just outside K.
169
+ const pool = scored
170
+ .slice()
171
+ .sort((a, b) => b.nrel - a.nrel || a.id.localeCompare(b.id))
172
+ .slice(0, MMR_POOL_SIZE);
173
+ if (!pool.some((s) => s.id === queried.id)) {
174
+ const trueDoc = scored.find((s) => s.id === queried.id);
175
+ if (trueDoc)
176
+ pool.push(trueDoc);
177
+ }
178
+ const ranked = rankMMR(pool, policy.mmrLambda);
179
+ const rank = ranked.indexOf(queried.id) + 1; // 1-based; 0 -> not found
180
+ sumReciprocalRank += rank > 0 ? 1 / rank : 0;
181
+ }
182
+ return sumReciprocalRank / queries.length;
183
+ }
184
+ // ---------------------------------------------------------------------------
185
+ // Anchor flat guard (the no-regression floor)
186
+ // ---------------------------------------------------------------------------
187
+ /**
188
+ * Gold/reference tests for the frozen qe-anchor-v1 items — each is a minimal
189
+ * CORRECT test written to kill its item's operator mutants (verified >= 0.8 via
190
+ * evaluateOracle). Keyed by moduleName. These stand in for the "human anchor"
191
+ * that a policy-independent, model-free wiring cannot generate itself.
192
+ */
193
+ const GOLD_TESTS = {
194
+ inRange: `import test from 'node:test';
195
+ import assert from 'node:assert/strict';
196
+ import { inRange } from '../src/inRange.mjs';
197
+ test('inRange', () => {
198
+ assert.equal(inRange(2, 1, 3), true);
199
+ assert.equal(inRange(1, 1, 3), true);
200
+ assert.equal(inRange(3, 1, 3), true);
201
+ assert.equal(inRange(0, 1, 3), false);
202
+ assert.equal(inRange(5, 1, 3), false);
203
+ });
204
+ `,
205
+ letterGrade: `import test from 'node:test';
206
+ import assert from 'node:assert/strict';
207
+ import { letterGrade } from '../src/letterGrade.mjs';
208
+ test('letterGrade', () => {
209
+ assert.equal(letterGrade(95), 'A');
210
+ assert.equal(letterGrade(90), 'A');
211
+ assert.equal(letterGrade(89), 'D');
212
+ assert.equal(letterGrade(60), 'D');
213
+ assert.equal(letterGrade(59), 'F');
214
+ });
215
+ `,
216
+ isBlank: `import test from 'node:test';
217
+ import assert from 'node:assert/strict';
218
+ import { isBlank } from '../src/isBlank.mjs';
219
+ test('isBlank', () => {
220
+ assert.equal(isBlank(''), true);
221
+ assert.equal(isBlank(' '), true);
222
+ assert.equal(isBlank(null), true);
223
+ assert.equal(isBlank(undefined), true);
224
+ assert.equal(isBlank('abc'), false);
225
+ });
226
+ `,
227
+ countAbove: `import test from 'node:test';
228
+ import assert from 'node:assert/strict';
229
+ import { countAbove } from '../src/countAbove.mjs';
230
+ test('countAbove', () => {
231
+ assert.equal(countAbove([1, 2, 3], 2), 1);
232
+ assert.equal(countAbove([2, 3], 2), 1);
233
+ assert.equal(countAbove([1, 1], 2), 0);
234
+ assert.equal(countAbove([], 2), 0);
235
+ });
236
+ `,
237
+ parseBool: `import test from 'node:test';
238
+ import assert from 'node:assert/strict';
239
+ import { parseBool } from '../src/parseBool.mjs';
240
+ test('parseBool', () => {
241
+ assert.equal(parseBool('true'), true);
242
+ assert.equal(parseBool('TRUE'), true);
243
+ assert.equal(parseBool('false'), false);
244
+ assert.throws(() => parseBool('nope'));
245
+ });
246
+ `,
247
+ };
248
+ /** Grade one anchor item with its gold test; returns the oracle mutation score. */
249
+ function gradeAnchorItem(item) {
250
+ const goldTest = GOLD_TESTS[item.moduleName];
251
+ if (!goldTest) {
252
+ throw new Error(`No gold reference test for anchor item "${item.id}" (module "${item.moduleName}"). ` +
253
+ `The corpus scorer's flat guard is wired for qe-anchor-v1; a re-frozen anchor ` +
254
+ `needs matching gold tests added here.`);
255
+ }
256
+ const result = evaluateOracle({
257
+ moduleName: item.moduleName,
258
+ referenceImpl: item.referenceImpl,
259
+ generatedTest: goldTest,
260
+ threshold: 0.8,
261
+ });
262
+ return result.mutationScore;
263
+ }
264
+ /** Grade the whole frozen anchor -> mean of per-item mutation scores (the flat floor). */
265
+ function gradeAnchor(anchorPath) {
266
+ const anchor = loadAnchorSet(anchorPath); // throws on hash drift (ADR-117)
267
+ const scores = anchor.items.map(gradeAnchorItem);
268
+ return anchorMean(scores);
269
+ }
270
+ // ---------------------------------------------------------------------------
271
+ // Factory
272
+ // ---------------------------------------------------------------------------
273
+ /**
274
+ * Build the real `PolicyScorer` for the flywheel. The corpus is read ONCE and
275
+ * the frozen anchor is graded ONCE (lazily, then cached) — the anchor mean is
276
+ * policy-independent (the honest flat guard), so caching makes the flat-guard
277
+ * property exact and avoids re-spawning the oracle per generation. Only heldOut
278
+ * varies with the policy.
279
+ */
280
+ export function createCorpusScorer(opts) {
281
+ const anchorPath = opts.anchorPath ?? DEFAULT_ANCHOR_PATH;
282
+ const ratio = opts.heldOutRatio ?? 1;
283
+ const corpus = loadCorpus(opts.db);
284
+ let anchorMeanCached = null;
285
+ return (policy) => {
286
+ const heldOut = scoreHeldOut(corpus, policy, ratio);
287
+ if (anchorMeanCached === null) {
288
+ anchorMeanCached = gradeAnchor(anchorPath);
289
+ }
290
+ return { heldOut, anchorMean: anchorMeanCached };
291
+ };
292
+ }
293
+ //# sourceMappingURL=corpus-scorer.js.map
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Coupled anchor scorer — retrieval → test-gen → anchor (ADR-118 / ADR-117).
3
+ *
4
+ * In the retrieval-only wiring the anchor was policy-INDEPENDENT (a flat guard):
5
+ * the retrieval policy didn't feed test generation, so it couldn't move the
6
+ * oracle score, and the no-regression guard was inert. This closes that loop:
7
+ *
8
+ * retrieve(inputUnderTest, policy) → few-shot examples
9
+ * → generate(inputUnderTest, examples) → a test
10
+ * → evaluateOracle(referenceImpl, test) → mutation kill rate
11
+ *
12
+ * Now `anchorMean` VARIES with the retrieval policy — a policy that surfaces
13
+ * more useful examples yields better generated tests and a higher oracle score.
14
+ * The guard gets teeth: a candidate that games the cheap self-retrieval proxy
15
+ * but produces WORSE tests drops the anchor mean and is rejected (ADR-117
16
+ * no-regression), and the promotion is now genuinely oracle:test-exec-backed
17
+ * (ADR-121) rather than a framing stretch.
18
+ *
19
+ * `retrieve` and `generate` are injected seams: fake/deterministic in tests,
20
+ * a real policy-weighted DB retriever + an LLM test generator in production
21
+ * (the LLM step is the metered part — bind it deliberately).
22
+ */
23
+ import type { Database as DatabaseType } from 'better-sqlite3';
24
+ import type { RetrievalPolicy } from './policy.js';
25
+ import type { PolicyScorer } from './generation.js';
26
+ /** A pattern retrieved as a few-shot example for test generation. */
27
+ export interface RetrievedExample {
28
+ id: string;
29
+ name: string;
30
+ body: string;
31
+ }
32
+ /** Retrieve few-shot examples for a query under a given retrieval policy. */
33
+ export type RetrieveFn = (query: string, policy: RetrievalPolicy) => RetrievedExample[] | Promise<RetrievedExample[]>;
34
+ /** Generate a test for `inputUnderTest`, optionally conditioned on examples. */
35
+ export type TestGenerator = (inputUnderTest: string, examples: RetrievedExample[]) => string | Promise<string>;
36
+ export interface CoupledAnchorOptions {
37
+ anchorPath?: string;
38
+ retrieve: RetrieveFn;
39
+ generate: TestGenerator;
40
+ /** Oracle mutation-kill threshold per item (default 0.8 — the ADR-117 High bar). */
41
+ threshold?: number;
42
+ /** Cap on mutants per item for speed (forwarded to evaluateOracle). */
43
+ maxMutants?: number;
44
+ }
45
+ /**
46
+ * Build the coupled anchorMean scorer: `(policy) => Promise<number>`.
47
+ * Grades each frozen anchor item by generating a test from policy-retrieved
48
+ * examples and scoring its mutation kill rate. The anchor now moves with the
49
+ * policy.
50
+ */
51
+ export declare function createCoupledAnchorScorer(opts: CoupledAnchorOptions): (policy: RetrievalPolicy) => Promise<number>;
52
+ export interface CoupledScorerOptions extends CoupledAnchorOptions {
53
+ /** DB handle for the self-retrieval held-out signal (read-only). */
54
+ db: DatabaseType;
55
+ /** Held-out query ratio for the proxy signal (bounds cost). */
56
+ heldOutRatio?: number;
57
+ }
58
+ /**
59
+ * A full PolicyScorer where `heldOut` is the cheap self-retrieval proxy (train
60
+ * signal) and `anchorMean` is the COUPLED oracle test-gen quality (the guard
61
+ * that now moves). The flywheel's accept() then requires a proxy gain WITHOUT an
62
+ * oracle-quality regression — the proxy-overfitting veto ADR-117 exists for.
63
+ */
64
+ export declare function createCoupledScorer(opts: CoupledScorerOptions): PolicyScorer;
65
+ /**
66
+ * A real policy-weighted DB retriever over `qe_patterns` — token overlap on the
67
+ * query, scaled by the policy's body/subject weights, top-K by score. Read-only.
68
+ * Injected as `retrieve` for live runs; tests use a deterministic fake instead.
69
+ */
70
+ export declare function createDbRetriever(db: DatabaseType, topK?: number): RetrieveFn;
71
+ export interface SemanticRetrieverOptions {
72
+ /** Read-only DB with `qe_patterns` + `qe_pattern_embeddings`. */
73
+ db: DatabaseType;
74
+ /** Embed a query into the pattern-embedding space. Default: all-MiniLM-L6-v2. */
75
+ embed?: (text: string) => Promise<number[]>;
76
+ topK?: number;
77
+ }
78
+ /**
79
+ * Policy-sensitive SEMANTIC retriever over the pre-computed `qe_pattern_embeddings`
80
+ * (all-MiniLM-L6-v2). Fixes the lexical retriever's honest-null: the anchor
81
+ * queries (toy functions) have ~0 lexical overlap with the corpus, so lexical
82
+ * scores were identical for every policy. Cosine similarity is a real, varying
83
+ * signal, and the policy re-shapes retrieval three ways:
84
+ * - `alpha` blends semantic cosine vs lexical overlap,
85
+ * - `subjectWeight`/`bodyWeight` scale the lexical component,
86
+ * - `mmrLambda` trades relevance for diversity in a greedy MMR rerank
87
+ * (this is the lever that reorders even when lexical overlap is 0).
88
+ * Query embeddings are cached (same query across policies embeds once).
89
+ */
90
+ export declare function createSemanticRetriever(opts: SemanticRetrieverOptions): RetrieveFn;
91
+ //# sourceMappingURL=coupled-anchor.d.ts.map