agentic-qe 3.11.5 → 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 (369) 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 +52 -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-6IWRIHF3.js +2 -0
  14. package/dist/cli/chunks/{agent-booster-wasm-CSTBLNYZ.js → agent-booster-wasm-IO54X6IQ.js} +2 -2
  15. package/dist/cli/chunks/{agent-handler-M4W4GTXN.js → agent-handler-A57SZUCW.js} +2 -2
  16. package/dist/cli/chunks/{agent-memory-branch-VGXFYLSQ.js → agent-memory-branch-BX7LRFGN.js} +2 -2
  17. package/dist/cli/chunks/aqe-learning-engine-FSF5U67K.js +2 -0
  18. package/dist/cli/chunks/{arena-FKSD3LLM.js → arena-UTC4YY6Y.js} +4 -4
  19. package/dist/cli/chunks/{arena-IQBRGWAG.js → arena-Y3XTX6O7.js} +2 -2
  20. package/dist/cli/chunks/{audit-7NSGRR4Z.js → audit-L4RL2AOY.js} +3 -3
  21. package/dist/cli/chunks/base-2CKCJU3O.js +2 -0
  22. package/dist/cli/chunks/{hnswlib-node-E6NSZPP2.js → better-sqlite3-LRDXKYOJ.js} +2 -2
  23. package/dist/cli/chunks/{brain-handler-M6A3UB66.js → brain-handler-OHDPI5TQ.js} +3 -3
  24. package/dist/cli/chunks/{branch-enumerator-2JGKY4BB.js → branch-enumerator-ZRXE2CQ7.js} +2 -2
  25. package/dist/cli/chunks/{browser-J43WQPJL.js → browser-NT33FG76.js} +2 -2
  26. package/dist/cli/chunks/browser-workflow-UGYJE64S.js +2 -0
  27. package/dist/cli/chunks/{chunk-JDSHUECG.js → chunk-27JCWG5J.js} +2 -2
  28. package/dist/cli/chunks/{chunk-B2VBDMDI.js → chunk-2ALNNXFF.js} +2 -2
  29. package/dist/cli/chunks/{chunk-SK754ZSH.js → chunk-2AOOIAW3.js} +4 -4
  30. package/dist/cli/chunks/{chunk-ZG5UAEEO.js → chunk-2AR4B3DI.js} +2 -2
  31. package/dist/cli/chunks/{chunk-GODAWJMZ.js → chunk-2KHDGC7N.js} +2 -2
  32. package/dist/cli/chunks/{chunk-YZSTZUGJ.js → chunk-2UMCB7AH.js} +1 -1
  33. package/dist/cli/chunks/{chunk-Q5TR6ETB.js → chunk-335GHVJV.js} +3 -3
  34. package/dist/cli/chunks/{chunk-UBI2EOS3.js → chunk-36MPDANH.js} +1 -1
  35. package/dist/cli/chunks/{chunk-C4EZNOWK.js → chunk-3AFNXU45.js} +1 -1
  36. package/dist/cli/chunks/{chunk-7YSBATSN.js → chunk-3B4XXFKD.js} +2 -2
  37. package/dist/cli/chunks/{chunk-DPL762HU.js → chunk-4GU656WM.js} +1 -1
  38. package/dist/cli/chunks/{chunk-I3NWKPXJ.js → chunk-4SALW7OT.js} +2 -2
  39. package/dist/cli/chunks/{chunk-7BCRULCP.js → chunk-5FR5GBUT.js} +2 -2
  40. package/dist/cli/chunks/{chunk-4XJ2A3HY.js → chunk-5VBPIJUZ.js} +4 -4
  41. package/dist/cli/chunks/chunk-5XFX25AJ.js +4 -0
  42. package/dist/cli/chunks/{chunk-UORTQXJ2.js → chunk-5YGESYBC.js} +1 -1
  43. package/dist/cli/chunks/{chunk-ABU64UWB.js → chunk-62RELCU6.js} +1 -1
  44. package/dist/cli/chunks/{chunk-2XQHG56O.js → chunk-64M3FFM4.js} +2 -2
  45. package/dist/cli/chunks/{chunk-K4I7UIU5.js → chunk-6JNNZGI2.js} +1 -1
  46. package/dist/cli/chunks/{chunk-XT4TDLOB.js → chunk-6X3RJBA3.js} +2 -2
  47. package/dist/cli/chunks/{chunk-JATLFS6A.js → chunk-72VZGAMJ.js} +1 -1
  48. package/dist/cli/chunks/{chunk-AGJOGUP5.js → chunk-7F7U2HUH.js} +1 -1
  49. package/dist/cli/chunks/{chunk-ZPP57WQU.js → chunk-7HJHXSYT.js} +2 -2
  50. package/dist/cli/chunks/{chunk-6T65OKUM.js → chunk-7WX3MKRS.js} +2 -2
  51. package/dist/cli/chunks/{chunk-5WMU7XCF.js → chunk-7ZIVDGSN.js} +1 -1
  52. package/dist/cli/chunks/{chunk-M6FW56MV.js → chunk-AAATFEIL.js} +2 -2
  53. package/dist/cli/chunks/{chunk-2XPMATEK.js → chunk-AEX75YGI.js} +2 -2
  54. package/dist/cli/chunks/chunk-BA6U7NSR.js +2 -0
  55. package/dist/cli/chunks/{chunk-4QOI5JS7.js → chunk-BB4OVXWF.js} +1 -1
  56. package/dist/cli/chunks/{chunk-K4C25BWV.js → chunk-BBC526PL.js} +2 -2
  57. package/dist/cli/chunks/{chunk-354367AP.js → chunk-BGRJZH5Q.js} +2 -2
  58. package/dist/cli/chunks/{chunk-7KXPNNMR.js → chunk-BUYPRUNY.js} +2 -2
  59. package/dist/cli/chunks/{chunk-O7J54OHN.js → chunk-BZPF6GTL.js} +1 -1
  60. package/dist/cli/chunks/{chunk-NCSXLMDL.js → chunk-C4SZSPXY.js} +2 -2
  61. package/dist/cli/chunks/{chunk-YBPLJRVT.js → chunk-C6GYLCTX.js} +2 -2
  62. package/dist/cli/chunks/{chunk-53YOYZW5.js → chunk-CC5G3K4X.js} +2 -2
  63. package/dist/cli/chunks/{chunk-UBY322ED.js → chunk-CHO54B34.js} +2 -2
  64. package/dist/cli/chunks/{chunk-EK3HPH6A.js → chunk-CMGYUCM7.js} +1 -1
  65. package/dist/cli/chunks/{chunk-W72FJA2H.js → chunk-CSEEGX5T.js} +2 -2
  66. package/dist/cli/chunks/{chunk-OS2HHJTM.js → chunk-CVGXB7IX.js} +2 -2
  67. package/dist/cli/chunks/{chunk-SE3JFUKP.js → chunk-DQDFACYW.js} +1 -1
  68. package/dist/cli/chunks/chunk-DR7PCO3S.js +153 -0
  69. package/dist/cli/chunks/{chunk-4MHN7JWC.js → chunk-DTOE3NYW.js} +2 -2
  70. package/dist/cli/chunks/{chunk-FGD6HINU.js → chunk-DXOMRWDC.js} +1 -1
  71. package/dist/cli/chunks/{chunk-3V36WMIO.js → chunk-EGH3H7QO.js} +1 -1
  72. package/dist/cli/chunks/{chunk-52U5BFZP.js → chunk-EM2JIIAQ.js} +2 -2
  73. package/dist/cli/chunks/{chunk-ZLBY25MB.js → chunk-ESDGCTC4.js} +1 -1
  74. package/dist/cli/chunks/{chunk-MTBGOWJA.js → chunk-EZE2HRQB.js} +2 -2
  75. package/dist/cli/chunks/{chunk-KVVJVMDM.js → chunk-FEEMJDUF.js} +2 -2
  76. package/dist/cli/chunks/{chunk-JBKZ5TUM.js → chunk-FI5SSLEF.js} +2 -2
  77. package/dist/cli/chunks/{chunk-J5XDKVI7.js → chunk-FKPUPQQT.js} +2 -2
  78. package/dist/cli/chunks/{chunk-URP75DL4.js → chunk-FOPS6DRZ.js} +1 -1
  79. package/dist/cli/chunks/{chunk-GW6XWMX2.js → chunk-FU5RNEXV.js} +2 -2
  80. package/dist/cli/chunks/{chunk-3JF5A72M.js → chunk-FZIHOMGY.js} +2 -2
  81. package/dist/cli/chunks/{chunk-AOQYORVA.js → chunk-FZRU73M4.js} +2 -2
  82. package/dist/cli/chunks/{chunk-MEIU7457.js → chunk-G5JQLUUO.js} +2 -2
  83. package/dist/cli/chunks/{chunk-MHMQ6MCT.js → chunk-G6LR7FK7.js} +2 -2
  84. package/dist/cli/chunks/{chunk-J6PFPY7V.js → chunk-G6RKUEGL.js} +2 -2
  85. package/dist/cli/chunks/{chunk-EEKG35K5.js → chunk-GCF42L7M.js} +3 -3
  86. package/dist/cli/chunks/{chunk-OS62Y77J.js → chunk-GGMQOEZZ.js} +2 -2
  87. package/dist/cli/chunks/{chunk-QKK7VBVB.js → chunk-HAEUPIKW.js} +2 -2
  88. package/dist/cli/chunks/{chunk-4RTWPR3X.js → chunk-HDJMD6UH.js} +1 -1
  89. package/dist/cli/chunks/{chunk-EDOGRFAG.js → chunk-HW62TB4T.js} +1 -1
  90. package/dist/cli/chunks/{chunk-LOE2JETO.js → chunk-I6WHYRWB.js} +2 -2
  91. package/dist/cli/chunks/{chunk-VMFAANWX.js → chunk-ICK3B24H.js} +2 -2
  92. package/dist/cli/chunks/{chunk-C5C4W572.js → chunk-IDLNLSQI.js} +2 -2
  93. package/dist/cli/chunks/{chunk-PVDXNQPL.js → chunk-IJUYHIKN.js} +2 -2
  94. package/dist/cli/chunks/{chunk-3WR35GFF.js → chunk-IKVNYK7Y.js} +2 -2
  95. package/dist/cli/chunks/{chunk-62OTU2AP.js → chunk-JOBCMNTP.js} +2 -2
  96. package/dist/cli/chunks/{chunk-BJLA2IX7.js → chunk-JYX7AZHE.js} +2 -2
  97. package/dist/cli/chunks/{chunk-6Q57K4YD.js → chunk-JYXSVSH2.js} +2 -2
  98. package/dist/cli/chunks/{chunk-CKOF27L7.js → chunk-K5SN66B4.js} +2 -2
  99. package/dist/cli/chunks/{chunk-PW72M2FE.js → chunk-KDLYTJ5C.js} +2 -2
  100. package/dist/cli/chunks/{chunk-4LODYRNV.js → chunk-KI5BP4X5.js} +2 -2
  101. package/dist/cli/chunks/{chunk-CDJP6COA.js → chunk-KJWQ7ENF.js} +2 -2
  102. package/dist/cli/chunks/{chunk-FII3WCCY.js → chunk-KN5GOEYK.js} +2 -2
  103. package/dist/cli/chunks/{chunk-7DTMENY6.js → chunk-KZ37VHMJ.js} +2 -2
  104. package/dist/cli/chunks/{chunk-I3ANRYQ6.js → chunk-KZMRU7DL.js} +2 -2
  105. package/dist/cli/chunks/{chunk-YFCULQBP.js → chunk-L5ZLOW3K.js} +2 -2
  106. package/dist/cli/chunks/{chunk-37ZUF5NX.js → chunk-LMJUQWR7.js} +1 -1
  107. package/dist/cli/chunks/{chunk-HJWT4KME.js → chunk-MBF3Q7FQ.js} +1 -1
  108. package/dist/cli/chunks/chunk-MDT3LIXS.js +2 -0
  109. package/dist/cli/chunks/{chunk-3LY7OCSO.js → chunk-MJPYNGZ7.js} +1 -1
  110. package/dist/cli/chunks/{chunk-SO6G4IX3.js → chunk-MK3J7JVZ.js} +2 -2
  111. package/dist/cli/chunks/{chunk-VN2HHBZN.js → chunk-MUAHFGIX.js} +2 -2
  112. package/dist/cli/chunks/{chunk-6R3YOAKO.js → chunk-MUV56BPK.js} +2 -2
  113. package/dist/cli/chunks/{chunk-XLT3FYS7.js → chunk-NLHISTL2.js} +2 -2
  114. package/dist/cli/chunks/{chunk-26WEI3P4.js → chunk-NNGCUJWQ.js} +2 -2
  115. package/dist/cli/chunks/{chunk-W7TYKPLY.js → chunk-NW7G57NR.js} +2 -2
  116. package/dist/cli/chunks/{chunk-Y6DWJKHU.js → chunk-O3C5RRDQ.js} +3 -3
  117. package/dist/cli/chunks/{chunk-TEIWJ3GJ.js → chunk-OHSVDMF7.js} +1 -1
  118. package/dist/cli/chunks/{chunk-KP3R2M2G.js → chunk-OPIWFXME.js} +1 -1
  119. package/dist/cli/chunks/{chunk-FGSIID5C.js → chunk-P52YORQG.js} +2 -2
  120. package/dist/cli/chunks/chunk-PM566XEO.js +2 -0
  121. package/dist/cli/chunks/chunk-POKMJTD2.js +2 -0
  122. package/dist/cli/chunks/{chunk-HC6KTVFR.js → chunk-PQMLIVGV.js} +2 -2
  123. package/dist/cli/chunks/{chunk-RJN2RM76.js → chunk-PT3FTGKZ.js} +2 -2
  124. package/dist/cli/chunks/{chunk-ZXEWTZFR.js → chunk-Q5YRPS4P.js} +1 -1
  125. package/dist/cli/chunks/{chunk-AL5VJJN4.js → chunk-QJ6H2HQQ.js} +1 -1
  126. package/dist/cli/chunks/{chunk-AXKWV5NF.js → chunk-RG552ROA.js} +3 -3
  127. package/dist/cli/chunks/{chunk-RKXZLTWR.js → chunk-RHC7TFPU.js} +2 -2
  128. package/dist/cli/chunks/{chunk-RFLHPLET.js → chunk-RMFRFING.js} +1 -1
  129. package/dist/cli/chunks/{chunk-WMZ2QGGS.js → chunk-RQN4HWGV.js} +2 -2
  130. package/dist/cli/chunks/{chunk-3I4TCMOJ.js → chunk-RYUSZ43T.js} +1 -1
  131. package/dist/cli/chunks/{chunk-BTLUWH4R.js → chunk-RZDNCTOA.js} +2 -2
  132. package/dist/cli/chunks/chunk-SCMXIBI7.js +2 -0
  133. package/dist/cli/chunks/{chunk-FMNXHVIN.js → chunk-SPEUF7ZL.js} +2 -2
  134. package/dist/cli/chunks/{chunk-IU5RSN6M.js → chunk-SSXAW3ER.js} +2 -2
  135. package/dist/cli/chunks/{chunk-WPSK237F.js → chunk-TC2JE5OK.js} +3 -3
  136. package/dist/cli/chunks/{chunk-DFRRWOEX.js → chunk-TED4KOSK.js} +2 -2
  137. package/dist/cli/chunks/{chunk-SUL3I6QZ.js → chunk-TJ6N4CCX.js} +2 -2
  138. package/dist/cli/chunks/{chunk-Y25PO65W.js → chunk-TJEJ4UVX.js} +2 -2
  139. package/dist/cli/chunks/{chunk-G2ZIJZJ7.js → chunk-TO5PQSDD.js} +2 -2
  140. package/dist/cli/chunks/{chunk-MMEXHZUC.js → chunk-TR5GOGH3.js} +5 -5
  141. package/dist/cli/chunks/{chunk-OGNTCZKK.js → chunk-UGJQJSPB.js} +1 -1
  142. package/dist/cli/chunks/{chunk-AF6P5RWY.js → chunk-USB44IHJ.js} +2 -2
  143. package/dist/cli/chunks/{chunk-DLBVADWQ.js → chunk-UUOXV3NS.js} +42 -42
  144. package/dist/cli/chunks/chunk-UVVKFBF7.js +2 -0
  145. package/dist/cli/chunks/{chunk-FIPKIIMS.js → chunk-V2MD5EDD.js} +2 -2
  146. package/dist/cli/chunks/{chunk-DVW66FPU.js → chunk-VA7TEOPM.js} +1 -1
  147. package/dist/cli/chunks/{chunk-MCHEUSY4.js → chunk-VMP4M5PB.js} +1 -1
  148. package/dist/cli/chunks/{chunk-4Y3LGBKJ.js → chunk-VS4GMNJK.js} +3 -3
  149. package/dist/cli/chunks/{chunk-XKQY2Z3Q.js → chunk-VWJSWXHG.js} +1 -1
  150. package/dist/cli/chunks/{chunk-LPR2R3AN.js → chunk-VZ67ZDB3.js} +3 -3
  151. package/dist/cli/chunks/{chunk-TTJJ4DQE.js → chunk-W2OMW6UU.js} +2 -2
  152. package/dist/cli/chunks/{chunk-62UM7Q5N.js → chunk-W766S4SK.js} +1 -1
  153. package/dist/cli/chunks/{chunk-7P6X4BFO.js → chunk-WJYTLRA5.js} +3 -3
  154. package/dist/cli/chunks/{chunk-AOXJFDH5.js → chunk-WNASEUBW.js} +10 -10
  155. package/dist/cli/chunks/{chunk-YGVDP6X7.js → chunk-WT4ZDDFM.js} +1 -1
  156. package/dist/cli/chunks/{chunk-IBDQWKI3.js → chunk-XEYW3V5I.js} +2 -2
  157. package/dist/cli/chunks/{chunk-BLPWJQTY.js → chunk-XIFPIVZI.js} +2 -2
  158. package/dist/cli/chunks/{chunk-D45QLJEL.js → chunk-Y2MCIIJD.js} +1 -1
  159. package/dist/cli/chunks/{chunk-WHHQIL4F.js → chunk-YKOTOCO6.js} +2 -2
  160. package/dist/cli/chunks/{chunk-TRNBQFFG.js → chunk-Z3W3R4CW.js} +2 -2
  161. package/dist/cli/chunks/{chunk-KQVIWE3W.js → chunk-ZT2WHCVM.js} +2 -2
  162. package/dist/cli/chunks/{chunk-TBT3OFRW.js → chunk-ZVPAFX4I.js} +2 -2
  163. package/dist/cli/chunks/{chunk-VMWRMINE.js → chunk-ZWC6CM4R.js} +1 -1
  164. package/dist/cli/chunks/{ci-CBNVLOOQ.js → ci-RJH5LAL3.js} +2 -2
  165. package/dist/cli/chunks/{ci-output-I4HY2FYJ.js → ci-output-62SGMGB2.js} +2 -2
  166. package/dist/cli/chunks/{circuit-breaker-5VRBKGWL.js → circuit-breaker-QXTS5ZAW.js} +2 -2
  167. package/dist/cli/chunks/{claude-flow-setup-XPJPKHIO.js → claude-flow-setup-BBCCT5WV.js} +2 -2
  168. package/dist/cli/chunks/client-E2XUBCLK.js +2 -0
  169. package/dist/cli/chunks/{cline-installer-OFRDUUWZ.js → cline-installer-IZCUJJ3I.js} +2 -2
  170. package/dist/cli/chunks/{code-QIZQVB3E.js → code-AWNVOZ7S.js} +2 -2
  171. package/dist/cli/chunks/{code-index-extractor-LMUUWEX4.js → code-index-extractor-MX65BKMI.js} +2 -2
  172. package/dist/cli/chunks/{codex-installer-N2MKIZ2S.js → codex-installer-EQT6JVLM.js} +2 -2
  173. package/dist/cli/chunks/{completions-Y36S3C5J.js → completions-WOJAM45W.js} +2 -2
  174. package/dist/cli/chunks/{complexity-analyzer-73YS3WUD.js → complexity-analyzer-3DJB7V3K.js} +2 -2
  175. package/dist/cli/chunks/{continuedev-installer-SAOTP6J3.js → continuedev-installer-P4KWUTCJ.js} +2 -2
  176. package/dist/cli/chunks/{copilot-installer-A4HXF6HE.js → copilot-installer-FFZWTMWQ.js} +2 -2
  177. package/dist/cli/chunks/core-handlers-46Z5VOO6.js +2 -0
  178. package/dist/cli/chunks/{cost-tracker-P26XUVZS.js → cost-tracker-CYBOV3NI.js} +2 -2
  179. package/dist/cli/chunks/{coverage-HVNHSMVJ.js → coverage-GTZJBSC4.js} +3 -3
  180. package/dist/cli/chunks/cross-domain-router-SXQ3HFRY.js +2 -0
  181. package/dist/cli/chunks/{cursor-installer-46BQFTYZ.js → cursor-installer-WZIVXGGB.js} +2 -2
  182. package/dist/cli/chunks/{daemon-YE7K2AZF.js → daemon-JWMHEJEN.js} +4 -4
  183. package/dist/cli/chunks/{daemon-Y54O3FLT.js → daemon-MSFN2LXY.js} +3 -3
  184. package/dist/cli/chunks/{dag-attention-scheduler-ETA7YY52.js → dag-attention-scheduler-4TWOTTQE.js} +2 -2
  185. package/dist/cli/chunks/{detect-5WLQ2J3E.js → detect-YZ6AGQPB.js} +2 -2
  186. package/dist/cli/chunks/{dist-node-45WW6I7J.js → dist-node-3EM2XH54.js} +2 -2
  187. package/dist/cli/chunks/{domain-handler-J7DQV74M.js → domain-handler-4XU5BINU.js} +2 -2
  188. package/dist/cli/chunks/{domain-transfer-GD2EGQVR.js → domain-transfer-HUFC7I52.js} +2 -2
  189. package/dist/cli/chunks/dream-R6MQQQ3N.js +2 -0
  190. package/dist/cli/chunks/{embed-and-insert-pattern-JELNEA2D.js → embed-and-insert-pattern-J5ZFM6YX.js} +2 -2
  191. package/dist/cli/chunks/{eval-A4PA5G2U.js → eval-XYOA3EH2.js} +2 -2
  192. package/dist/cli/chunks/{experience-capture-middleware-MLHTYWTA.js → experience-capture-middleware-E3RYQB6Z.js} +3 -3
  193. package/dist/cli/chunks/{fast-paths-QYDTITRV.js → fast-paths-DKIYN2YS.js} +2 -2
  194. package/dist/cli/chunks/{feature-flags-MQYYRHIK.js → feature-flags-S2RNZATS.js} +2 -2
  195. package/dist/cli/chunks/{feature-flags-H4MSY26Z.js → feature-flags-ZB63Z7N5.js} +2 -2
  196. package/dist/cli/chunks/{file-discovery-RMFVJNGL.js → file-discovery-USJJLYQU.js} +2 -2
  197. package/dist/cli/chunks/{fleet-7KZQOTAC.js → fleet-4MUPHSF5.js} +3 -3
  198. package/dist/cli/chunks/{gnn-wrapper-NMZFTGVH.js → gnn-wrapper-PYOQZKX6.js} +2 -2
  199. package/dist/cli/chunks/{heartbeat-handler-7BQDK7MG.js → heartbeat-handler-HLO5XCG7.js} +4 -4
  200. package/dist/cli/chunks/heartbeat-scheduler-OSDPJT6A.js +2 -0
  201. package/dist/cli/chunks/hnsw-adapter-KMGSHBIN.js +2 -0
  202. package/dist/cli/chunks/hnsw-index-IMFRAOPE.js +2 -0
  203. package/dist/cli/chunks/{hnsw-legacy-bridge-TPPGBPKF.js → hnsw-legacy-bridge-FZEH2KLM.js} +2 -2
  204. package/dist/cli/chunks/{better-sqlite3-2KR4LQRU.js → hnswlib-node-VS6L5VUG.js} +2 -2
  205. package/dist/cli/chunks/{hooks-CYZIUYSH.js → hooks-R2757K57.js} +10 -10
  206. package/dist/cli/chunks/hybrid-router-57QSWSWC.js +2 -0
  207. package/dist/cli/chunks/{hypergraph-engine-WC6DMTYQ.js → hypergraph-engine-EAV3GJ5D.js} +2 -2
  208. package/dist/cli/chunks/{hypergraph-handler-GTGA3TXJ.js → hypergraph-handler-5ERXAVGH.js} +3 -3
  209. package/dist/cli/chunks/impact-analyzer-OC4MPBGA.js +2 -0
  210. package/dist/cli/chunks/{init-handler-N3Z72JNI.js → init-handler-RXUSEMG7.js} +6 -6
  211. package/dist/cli/chunks/init-wizard-CDBRL4PO.js +2 -0
  212. package/dist/cli/chunks/kernel-CQ7R3AAV.js +2 -0
  213. package/dist/cli/chunks/{kilocode-installer-FUX4V6II.js → kilocode-installer-ZUBVBHGT.js} +2 -2
  214. package/dist/cli/chunks/{kiro-installer-ZSNZT7ZR.js → kiro-installer-TRTRQDGL.js} +2 -2
  215. package/dist/cli/chunks/knowledge-graph-UXNH7RY4.js +2 -0
  216. package/dist/cli/chunks/{learning-UQY64COU.js → learning-UYXWAU5D.js} +3 -3
  217. package/dist/cli/chunks/{llm-router-CMHGGX6N.js → llm-router-TB5OJPEV.js} +4 -4
  218. package/dist/cli/chunks/llm-router-service-UV34YXBE.js +2 -0
  219. package/dist/cli/chunks/{load-E6WH4QN2.js → load-ELPSUIPV.js} +2 -2
  220. package/dist/cli/chunks/load-test-2VEN3PQZ.js +2 -0
  221. package/dist/cli/chunks/{mcp-UM5VTW6N.js → mcp-UX7TK3XV.js} +2 -2
  222. package/dist/cli/chunks/{memory-7Q3XDUE5.js → memory-W3LG6H6N.js} +5 -5
  223. package/dist/cli/chunks/memory-backend-TZL5U6F3.js +2 -0
  224. package/dist/cli/chunks/memory-handlers-BNXAYS2P.js +2 -0
  225. package/dist/cli/chunks/{multi-model-executor-LZENWVRR.js → multi-model-executor-227LWZRY.js} +2 -2
  226. package/dist/cli/chunks/{opencode-installer-O2JAIPLF.js → opencode-installer-F4WKVWDL.js} +2 -2
  227. package/dist/cli/chunks/{orchestrator-DKZWXDRI.js → orchestrator-V4DBMGK6.js} +5 -5
  228. package/dist/cli/chunks/pattern-null-store-KLX2RNHM.js +2 -0
  229. package/dist/cli/chunks/{pattern-usage-recorder-CLUL4M55.js → pattern-usage-recorder-BY3HEWSU.js} +2 -2
  230. package/dist/cli/chunks/{pipeline-2VDLTR5J.js → pipeline-3F5RIESX.js} +2 -2
  231. package/dist/cli/chunks/{platform-4N4Q5XYX.js → platform-KCGXTZO3.js} +2 -2
  232. package/dist/cli/chunks/{plugin-GY5AU5CS.js → plugin-2H552KOV.js} +2 -2
  233. package/dist/cli/chunks/{prime-radiant-advanced-wasm-TQ4DKDZS.js → prime-radiant-advanced-wasm-EFKVL7VN.js} +2 -2
  234. package/dist/cli/chunks/protocol-executor-5HJKW6MC.js +2 -0
  235. package/dist/cli/chunks/{protocol-handler-T3LZ3WRG.js → protocol-handler-ELGYV7D2.js} +2 -2
  236. package/dist/cli/chunks/{prove-OV7S5J4W.js → prove-AYJCQYNI.js} +2 -2
  237. package/dist/cli/chunks/provider-manager-TRZSBXD3.js +2 -0
  238. package/dist/cli/chunks/qe-reasoning-bank-RCEYSLVV.js +2 -0
  239. package/dist/cli/chunks/{quality-AXD4NLQA.js → quality-HH7L5A7V.js} +2 -2
  240. package/dist/cli/chunks/quality-gate-NAQLXE4C.js +7 -0
  241. package/dist/cli/chunks/queen-coordinator-6JFZD54W.js +2 -0
  242. package/dist/cli/chunks/{real-embeddings-2PUCC7FG.js → real-embeddings-IO3F4ZFR.js} +2 -2
  243. package/dist/cli/chunks/{roocode-installer-WJ5ARGLW.js → roocode-installer-X4TU5HO4.js} +2 -2
  244. package/dist/cli/chunks/router-KRLC46NS.js +2 -0
  245. package/dist/cli/chunks/routing-feedback-WW26H6SA.js +2 -0
  246. package/dist/cli/chunks/{routing-handler-CU6657SZ.js → routing-handler-ZJKGDDMT.js} +2 -2
  247. package/dist/cli/chunks/{ruvector-commands-IIF6VSFW.js → ruvector-commands-NXCSUBN2.js} +2 -2
  248. package/dist/cli/chunks/{rvf-dual-writer-YMQI7XO2.js → rvf-dual-writer-JMA74SKP.js} +2 -2
  249. package/dist/cli/chunks/{rvf-migration-adapter-HDE3PR2W.js → rvf-migration-adapter-BNTGH2KU.js} +2 -2
  250. package/dist/cli/chunks/{rvf-migration-coordinator-MQV5OA7K.js → rvf-migration-coordinator-7T2HHUOH.js} +2 -2
  251. package/dist/cli/chunks/rvf-native-adapter-OVQKPQUH.js +2 -0
  252. package/dist/cli/chunks/safe-db-UQOCQIH2.js +2 -0
  253. package/dist/cli/chunks/schedule-EUX7ZQUK.js +2 -0
  254. package/dist/cli/chunks/scheduler-MALHQKNR.js +2 -0
  255. package/dist/cli/chunks/{security-UM3IGDSM.js → security-XSK2QHB3.js} +3 -3
  256. package/dist/cli/chunks/{shared-rvf-adapter-I3SOJ6M4.js → shared-rvf-adapter-WLRKI7RY.js} +2 -2
  257. package/dist/cli/chunks/{shared-rvf-dual-writer-KQGC2UO7.js → shared-rvf-dual-writer-SZW3J7ZK.js} +2 -2
  258. package/dist/cli/chunks/sqlite-persistence-OBCLRP4L.js +2 -0
  259. package/dist/cli/chunks/{status-handler-OX4CJZME.js → status-handler-HGCKYJX2.js} +2 -2
  260. package/dist/cli/chunks/{structural-health-PYUMVBXJ.js → structural-health-4SJCFX63.js} +2 -2
  261. package/dist/cli/chunks/{sync-2TED3YTY.js → sync-7WAVNZGL.js} +2 -2
  262. package/dist/cli/chunks/{sync-VALFNTA6.js → sync-ATR4DUSA.js} +2 -2
  263. package/dist/cli/chunks/{task-handler-VPGAJVPC.js → task-handler-O6REL34Y.js} +2 -2
  264. package/dist/cli/chunks/{task-handlers-IB4UAMU6.js → task-handlers-WFV2ZYWW.js} +3 -3
  265. package/dist/cli/chunks/{test-OMRJOZB6.js → test-4LXUVHEU.js} +4 -4
  266. package/dist/cli/chunks/{test-scheduling-ZL3YFPBU.js → test-scheduling-OTN3DMKY.js} +3 -3
  267. package/dist/cli/chunks/{token-bootstrap-DNWZI7SH.js → token-bootstrap-VA7T4P42.js} +2 -2
  268. package/dist/cli/chunks/{token-usage-IYO7RGFF.js → token-usage-TLT6OXXR.js} +2 -2
  269. package/dist/cli/chunks/{transformers-53ALC34T.js → transformers-JI7LZRQ3.js} +2 -2
  270. package/dist/cli/chunks/{tree-sitter-wasm-parser-WUKJ2I2Q.js → tree-sitter-wasm-parser-QNIMHB4K.js} +2 -2
  271. package/dist/cli/chunks/{types-47FTEPMV.js → types-DJNWOAC6.js} +2 -2
  272. package/dist/cli/chunks/unified-memory-A5BS3LGX.js +2 -0
  273. package/dist/cli/chunks/unified-memory-hnsw-WJLJO5MY.js +2 -0
  274. package/dist/cli/chunks/unified-persistence-CFC2BKI5.js +2 -0
  275. package/dist/cli/chunks/{upgrade-QPLMJA5Z.js → upgrade-VEW4FL23.js} +2 -2
  276. package/dist/cli/chunks/{validate-3GVKZOVF.js → validate-O3P6PF7B.js} +2 -2
  277. package/dist/cli/chunks/{validate-swarm-XCRTLVM6.js → validate-swarm-M2HXHZVC.js} +2 -2
  278. package/dist/cli/chunks/{vibium-CH4VPKVZ.js → vibium-GOU55LUO.js} +2 -2
  279. package/dist/cli/chunks/visual-security-VPB6KVYJ.js +2 -0
  280. package/dist/cli/chunks/{web-tree-sitter-JDBNAZTV.js → web-tree-sitter-MXOI4GH3.js} +2 -2
  281. package/dist/cli/chunks/{windsurf-installer-3MNPVJBP.js → windsurf-installer-6GKT53IH.js} +2 -2
  282. package/dist/cli/chunks/{witness-chain-HR5UBV5J.js → witness-chain-OXGQGL26.js} +2 -2
  283. package/dist/cli/chunks/witness-chain-ZZAUAXDY.js +2 -0
  284. package/dist/cli/chunks/{witness-key-manager-G5SQTIBZ.js → witness-key-manager-PGFSQXUJ.js} +2 -2
  285. package/dist/cli/chunks/{workflow-43EMD5FY.js → workflow-ENBWRMBA.js} +4 -4
  286. package/dist/cli/chunks/workflow-orchestrator-S4LBFTYD.js +2 -0
  287. package/dist/cli/chunks/{wrappers-3N7AYNM3.js → wrappers-MHLNYANQ.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/integrations/ruvector/feature-flags.js +7 -0
  294. package/dist/learning/pattern-lifecycle.d.ts +16 -0
  295. package/dist/learning/pattern-lifecycle.js +77 -1
  296. package/dist/learning/provenance-tier.d.ts +52 -0
  297. package/dist/learning/provenance-tier.js +64 -0
  298. package/dist/learning/qe-flywheel/corpus-scorer.d.ts +55 -0
  299. package/dist/learning/qe-flywheel/corpus-scorer.js +293 -0
  300. package/dist/learning/qe-flywheel/coupled-anchor.d.ts +91 -0
  301. package/dist/learning/qe-flywheel/coupled-anchor.js +181 -0
  302. package/dist/learning/qe-flywheel/generation.d.ts +121 -0
  303. package/dist/learning/qe-flywheel/generation.js +167 -0
  304. package/dist/learning/qe-flywheel/policy.d.ts +37 -0
  305. package/dist/learning/qe-flywheel/policy.js +66 -0
  306. package/dist/learning/qe-flywheel/receipt-store.d.ts +31 -0
  307. package/dist/learning/qe-flywheel/receipt-store.js +89 -0
  308. package/dist/learning/qe-flywheel/receipt.d.ts +62 -0
  309. package/dist/learning/qe-flywheel/receipt.js +97 -0
  310. package/dist/mcp/bundle.js +396 -390
  311. package/dist/mcp/tools/quality-assessment/gate.d.ts +38 -0
  312. package/dist/mcp/tools/quality-assessment/gate.js +86 -0
  313. package/dist/mcp/tools/registry.d.ts +1 -0
  314. package/dist/mcp/tools/registry.js +3 -0
  315. package/dist/shared/safe-db.js +23 -4
  316. package/dist/validation/anchor-set.d.ts +74 -0
  317. package/dist/validation/anchor-set.js +78 -0
  318. package/dist/validation/frontier-judge.d.ts +99 -0
  319. package/dist/validation/frontier-judge.js +234 -0
  320. package/dist/validation/gate-reexecute.d.ts +165 -0
  321. package/dist/validation/gate-reexecute.js +255 -0
  322. package/dist/validation/quality-gate-runner.d.ts +49 -0
  323. package/dist/validation/quality-gate-runner.js +62 -0
  324. package/dist/validation/quality-verdict.d.ts +94 -0
  325. package/dist/validation/quality-verdict.js +120 -0
  326. package/package.json +1 -1
  327. package/dist/cli/chunks/adapter-KNM5R47J.js +0 -2
  328. package/dist/cli/chunks/aqe-learning-engine-MXPJLVR3.js +0 -2
  329. package/dist/cli/chunks/base-X4EXQ2AS.js +0 -2
  330. package/dist/cli/chunks/browser-workflow-4HX6RP5F.js +0 -2
  331. package/dist/cli/chunks/chunk-FHTYEAQ3.js +0 -2
  332. package/dist/cli/chunks/chunk-MIU5RUBJ.js +0 -149
  333. package/dist/cli/chunks/chunk-V6NAB5UZ.js +0 -2
  334. package/dist/cli/chunks/chunk-YR2JKBZO.js +0 -2
  335. package/dist/cli/chunks/chunk-ZMPAM4DY.js +0 -2
  336. package/dist/cli/chunks/client-AHXNCOHK.js +0 -2
  337. package/dist/cli/chunks/core-handlers-EEFLLMAZ.js +0 -2
  338. package/dist/cli/chunks/cross-domain-router-LT3H4SNJ.js +0 -2
  339. package/dist/cli/chunks/dream-4K3BK4IG.js +0 -2
  340. package/dist/cli/chunks/heartbeat-scheduler-IMPPGQUK.js +0 -2
  341. package/dist/cli/chunks/hnsw-adapter-EIAA6R2L.js +0 -2
  342. package/dist/cli/chunks/hnsw-index-ZXXP6AXZ.js +0 -2
  343. package/dist/cli/chunks/hybrid-router-LXWG4MLH.js +0 -2
  344. package/dist/cli/chunks/impact-analyzer-TP5LRFYH.js +0 -2
  345. package/dist/cli/chunks/init-wizard-AIOA5KOY.js +0 -2
  346. package/dist/cli/chunks/kernel-SQALRU6Q.js +0 -2
  347. package/dist/cli/chunks/knowledge-graph-JFVT6SNN.js +0 -2
  348. package/dist/cli/chunks/llm-router-service-XHFKTH3I.js +0 -2
  349. package/dist/cli/chunks/load-test-JEIFJKNN.js +0 -2
  350. package/dist/cli/chunks/memory-backend-NT7I37CP.js +0 -2
  351. package/dist/cli/chunks/memory-handlers-746D7NE7.js +0 -2
  352. package/dist/cli/chunks/pattern-null-store-6QU6WHDW.js +0 -2
  353. package/dist/cli/chunks/protocol-executor-GT2MZYUU.js +0 -2
  354. package/dist/cli/chunks/provider-manager-OATJ7R3D.js +0 -2
  355. package/dist/cli/chunks/qe-reasoning-bank-IJXNQ67O.js +0 -2
  356. package/dist/cli/chunks/queen-coordinator-6RBHWCUG.js +0 -2
  357. package/dist/cli/chunks/router-XKQRT5JK.js +0 -2
  358. package/dist/cli/chunks/routing-feedback-ACPSD4LW.js +0 -2
  359. package/dist/cli/chunks/rvf-native-adapter-SIWRKE33.js +0 -2
  360. package/dist/cli/chunks/safe-db-LCPUYMX4.js +0 -2
  361. package/dist/cli/chunks/schedule-HIQJCWXG.js +0 -2
  362. package/dist/cli/chunks/scheduler-QE5EJ5LE.js +0 -2
  363. package/dist/cli/chunks/sqlite-persistence-EU54UTMH.js +0 -2
  364. package/dist/cli/chunks/unified-memory-CJLMC2I4.js +0 -2
  365. package/dist/cli/chunks/unified-memory-hnsw-FDGR4D2J.js +0 -2
  366. package/dist/cli/chunks/unified-persistence-UFH5GLDN.js +0 -2
  367. package/dist/cli/chunks/visual-security-4ARJ7J2Y.js +0 -2
  368. package/dist/cli/chunks/witness-chain-73QC33ED.js +0 -2
  369. package/dist/cli/chunks/workflow-orchestrator-RKMMPXNA.js +0 -2
@@ -0,0 +1,234 @@
1
+ /**
2
+ * Frontier-tier spec judge for the ADR-119 two-gate quality verdict.
3
+ *
4
+ * This is the real spec-gate `Judge` consumed by `computeQualityVerdict`
5
+ * (quality-verdict.ts). It grades an artifact against a pinned,
6
+ * constant-denominator ADR-117 checklist using a FRONTIER model — never the
7
+ * cheap local writer lane (ADR-111: the oracle is the one place you never
8
+ * economize). Two design guarantees flow from the verdict logic:
9
+ *
10
+ * - `preflight()` does a cheap live round-trip to prove the provider and
11
+ * credentials actually respond. On any failure it returns `false`, which the
12
+ * verdict maps to `inconclusive` — a dead provider can never masquerade as a
13
+ * silent pass.
14
+ * - `grade()` returns `ran: false` on ANY tooling failure (timeout,
15
+ * usage-limit, unparseable response). A non-real opinion can never
16
+ * contribute to a `fail`; too few real opinions ⇒ `inconclusive`.
17
+ *
18
+ * The single provider call is isolated behind an injectable `complete(prompt)`
19
+ * seam so the judge is unit-testable with a fake and zero network. Wire the real
20
+ * frontier model with `routerComplete()` / `createRouterFrontierJudge()`.
21
+ */
22
+ import { DEFAULT_OPUS_MODEL } from '../shared/llm/model-registry.js';
23
+ const DEFAULT_TIMEOUT_MS = 60_000;
24
+ const DEFAULT_PING_TIMEOUT_MS = 15_000;
25
+ /**
26
+ * Create the ADR-119 frontier spec judge.
27
+ *
28
+ * The returned object satisfies the `Judge` contract consumed by
29
+ * `computeQualityVerdict`. All provider interaction is behind `opts.complete`.
30
+ */
31
+ export function createFrontierJudge(opts) {
32
+ const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
33
+ const log = opts.logger ?? (() => { });
34
+ const model = opts.model ?? 'frontier';
35
+ const ping = opts.ping ??
36
+ (async () => {
37
+ const text = await withTimeout(opts.complete('Reply with exactly: OK'), Math.min(DEFAULT_PING_TIMEOUT_MS, timeoutMs), 'judge preflight ping');
38
+ return typeof text === 'string' && text.trim().length > 0;
39
+ });
40
+ return {
41
+ async preflight() {
42
+ try {
43
+ const ok = await ping();
44
+ if (!ok)
45
+ log(`frontier-judge preflight: provider (${model}) returned empty — not ready`);
46
+ return ok;
47
+ }
48
+ catch (err) {
49
+ // A dead/unauthenticated provider MUST NOT read as "ready" — that is
50
+ // exactly how an infra hiccup would masquerade as a silent pass.
51
+ log(`frontier-judge preflight failed (${model}): ${errText(err)}`);
52
+ return false;
53
+ }
54
+ },
55
+ async grade(artifact, checklist) {
56
+ const total = checklist.requirements.length;
57
+ try {
58
+ const prompt = buildGradePrompt(artifact, checklist);
59
+ const raw = await withTimeout(opts.complete(prompt), timeoutMs, 'judge grade');
60
+ const unmetIdx = parseUnmetIndices(raw, total);
61
+ if (unmetIdx == null) {
62
+ // Unparseable — a real model ran but we cannot trust the grade, so it
63
+ // is NOT a real opinion (cannot contribute to a fail).
64
+ log(`frontier-judge grade: could not parse response for ${checklist.id}`);
65
+ return { ran: false, coverage: 0, unmet: [] };
66
+ }
67
+ const unmet = [...unmetIdx].sort((a, b) => a - b).map((i) => checklist.requirements[i]);
68
+ // Coverage over the CONSTANT denominator (ADR-117) — comparable across runs.
69
+ const coverage = (total - unmet.length) / total;
70
+ return { ran: true, coverage, unmet };
71
+ }
72
+ catch (err) {
73
+ // Timeout / usage-limit / network — not a real opinion.
74
+ log(`frontier-judge grade failed for ${checklist.id} (${model}): ${errText(err)}`);
75
+ return { ran: false, coverage: 0, unmet: [] };
76
+ }
77
+ },
78
+ };
79
+ }
80
+ /**
81
+ * Build a `complete()` seam backed by the shared HybridRouter, pinned to a
82
+ * frontier model. This is where the ADR-111 "never economize the oracle" rule is
83
+ * enforced: `model` defaults to a frontier Opus and `preferredProvider` lets the
84
+ * caller route to a frontier provider explicitly.
85
+ */
86
+ export function routerComplete(router, opts = {}) {
87
+ const model = opts.model ?? DEFAULT_OPUS_MODEL;
88
+ return async (prompt) => {
89
+ const res = await router.chat({
90
+ messages: [{ role: 'user', content: prompt }],
91
+ model,
92
+ preferredProvider: opts.preferredProvider,
93
+ temperature: opts.temperature ?? 0,
94
+ maxTokens: opts.maxTokens ?? 1024,
95
+ timeoutMs: opts.timeoutMs,
96
+ skipCache: true,
97
+ });
98
+ return res.content ?? '';
99
+ };
100
+ }
101
+ /**
102
+ * Convenience: a frontier judge wired to the shared HybridRouter. The judge is
103
+ * ALWAYS frontier-tier — `model` defaults to a frontier Opus.
104
+ */
105
+ export function createRouterFrontierJudge(router, opts = {}) {
106
+ const model = opts.model ?? DEFAULT_OPUS_MODEL;
107
+ return createFrontierJudge({
108
+ complete: routerComplete(router, { ...opts, model }),
109
+ model,
110
+ timeoutMs: opts.timeoutMs,
111
+ logger: opts.logger,
112
+ });
113
+ }
114
+ /**
115
+ * A judge for when no frontier provider is available (no LLM router / no
116
+ * credentials). `preflight()` returns false so the verdict is `inconclusive` —
117
+ * NEVER a silent pass. Both CLI and MCP use this fallback so they stay in parity.
118
+ */
119
+ export function createUnavailableJudge(_reason) {
120
+ return {
121
+ preflight: () => false,
122
+ grade: () => ({ ran: false, coverage: 0, unmet: [] }),
123
+ };
124
+ }
125
+ // ============================================================================
126
+ // Prompt + parsing
127
+ // ============================================================================
128
+ /**
129
+ * Build the grading prompt. Requirements are numbered 1..N and the model is
130
+ * asked for the numbers of the UNMET ones as strict JSON. Reporting unmet (not
131
+ * satisfied) keeps the denominator constant and the contract unambiguous.
132
+ */
133
+ export function buildGradePrompt(artifact, checklist) {
134
+ const numbered = checklist.requirements.map((r, i) => `${i + 1}. ${r}`).join('\n');
135
+ return [
136
+ 'You are a rigorous, frontier-tier quality oracle grading a software artifact',
137
+ 'against a FIXED requirement checklist. Judge only what the artifact actually',
138
+ 'verifies — do not give credit for requirements it merely mentions or leaves',
139
+ 'implicit. A requirement is "met" only if the artifact demonstrably covers it.',
140
+ '',
141
+ `Checklist id: ${checklist.id}`,
142
+ 'Requirements (the denominator is fixed — grade ALL of them):',
143
+ numbered,
144
+ '',
145
+ '--- ARTIFACT UNDER JUDGEMENT ---',
146
+ artifact,
147
+ '--- END ARTIFACT ---',
148
+ '',
149
+ 'Return ONLY a single JSON object, no prose, no markdown fences, of the form:',
150
+ '{"unmet": [<numbers of requirements NOT met>]}',
151
+ 'Use the requirement numbers above. If every requirement is met, return {"unmet": []}.',
152
+ ].join('\n');
153
+ }
154
+ /**
155
+ * Parse the model response into a set of 0-based unmet requirement indices.
156
+ * Returns `null` when the response cannot be parsed into the strict contract
157
+ * (so the caller treats it as a non-real opinion). Out-of-range and duplicate
158
+ * numbers are ignored — a garbled index list never inflates the unmet count.
159
+ */
160
+ export function parseUnmetIndices(raw, total) {
161
+ const obj = extractJsonObject(raw);
162
+ if (obj == null || !Array.isArray(obj.unmet)) {
163
+ return null;
164
+ }
165
+ const out = new Set();
166
+ for (const v of obj.unmet) {
167
+ const n = typeof v === 'number' ? v : typeof v === 'string' ? Number(v.trim()) : NaN;
168
+ if (!Number.isInteger(n))
169
+ continue;
170
+ const idx = n - 1; // 1-based prompt -> 0-based index
171
+ if (idx >= 0 && idx < total)
172
+ out.add(idx);
173
+ }
174
+ return out;
175
+ }
176
+ /** Extract the first balanced top-level JSON object from arbitrary model text. */
177
+ function extractJsonObject(raw) {
178
+ if (typeof raw !== 'string')
179
+ return null;
180
+ const start = raw.indexOf('{');
181
+ if (start === -1)
182
+ return null;
183
+ let depth = 0;
184
+ let inStr = false;
185
+ let esc = false;
186
+ for (let i = start; i < raw.length; i++) {
187
+ const ch = raw[i];
188
+ if (inStr) {
189
+ if (esc)
190
+ esc = false;
191
+ else if (ch === '\\')
192
+ esc = true;
193
+ else if (ch === '"')
194
+ inStr = false;
195
+ continue;
196
+ }
197
+ if (ch === '"')
198
+ inStr = true;
199
+ else if (ch === '{')
200
+ depth++;
201
+ else if (ch === '}') {
202
+ depth--;
203
+ if (depth === 0) {
204
+ try {
205
+ return JSON.parse(raw.slice(start, i + 1));
206
+ }
207
+ catch {
208
+ return null;
209
+ }
210
+ }
211
+ }
212
+ }
213
+ return null;
214
+ }
215
+ // ============================================================================
216
+ // Helpers
217
+ // ============================================================================
218
+ /** Reject with a timeout error if `p` does not settle within `ms`. */
219
+ export function withTimeout(p, ms, label) {
220
+ return new Promise((resolve, reject) => {
221
+ const timer = setTimeout(() => reject(new Error(`${label} timed out after ${ms}ms`)), ms);
222
+ p.then((v) => {
223
+ clearTimeout(timer);
224
+ resolve(v);
225
+ }, (e) => {
226
+ clearTimeout(timer);
227
+ reject(e);
228
+ });
229
+ });
230
+ }
231
+ function errText(err) {
232
+ return err instanceof Error ? err.message : String(err);
233
+ }
234
+ //# sourceMappingURL=frontier-judge.js.map
@@ -0,0 +1,165 @@
1
+ /**
2
+ * gateReExecutes — re-execute a frozen acceptance rule from sealed inputs
3
+ * on every promotion path (ADR-120).
4
+ *
5
+ * The July 2026 remediation exposed the A8-EXT fake-`applied`-counter: a
6
+ * promotion path that logged success without doing the work — a logged verdict
7
+ * that lied. The fix (from MetaHarness `verifyReplayBundle`): trust the re-run,
8
+ * not the log. At verification time, re-execute a VERSIONED FROZEN acceptance
9
+ * rule against the decision's SEALED inputs; a recorded PROMOTE the frozen rule
10
+ * would not grant is a forgery.
11
+ *
12
+ * Two checks, both required (mirrors MetaHarness `replay.ts:66-90`):
13
+ * - gateUnchanged — the recorded rule fingerprint matches the current rule
14
+ * version's fingerprint (a swapped rule is caught).
15
+ * - gateReExecutes — re-running the frozen rule on the sealed inputs
16
+ * reproduces the recorded verdict.
17
+ * Plus sealIntact (ADR-116 composition) — the sealed inputs were not mutated
18
+ * after the decision. Re-execution on tampered inputs is meaningless.
19
+ *
20
+ * The acceptance rule is a PURE function of sealed inputs. `accept/v1` composes
21
+ * the cluster: ADR-121 provenance tier gate + ADR-118 held-out-beats-baseline +
22
+ * ADR-117 anchor no-regression. Changing a rule is a new VERSION, never an
23
+ * in-place edit (which gateUnchanged flags).
24
+ */
25
+ /** The inputs a promotion decision was made on — sealed at decision time. */
26
+ export interface SealedInputs {
27
+ /** Candidate policy's held-out score (ADR-118). */
28
+ candidateHeldOut: number;
29
+ /** Baseline (current champion) held-out score. */
30
+ baselineHeldOut: number;
31
+ /** Candidate anchor mean (ADR-117). */
32
+ candidateAnchorMean: number;
33
+ /** Baseline anchor mean. */
34
+ baselineAnchorMean: number;
35
+ /** Content hash of the ADR-117 anchor used (which frozen anchor this was graded on). */
36
+ anchorHash: string;
37
+ /** No-regression tolerance the anchor was gated at. */
38
+ anchorTol: number;
39
+ /** ADR-121 evidence tier of the candidate. */
40
+ provenanceTier: string;
41
+ /** Whether judge-tier promotion was explicitly budgeted (ADR-121). */
42
+ allowJudgeTier?: boolean;
43
+ }
44
+ export interface RuleResult {
45
+ promote: boolean;
46
+ reason: string;
47
+ }
48
+ /** A versioned, frozen acceptance rule — a pure function of sealed inputs. */
49
+ export type AcceptanceRule = (sealed: SealedInputs) => RuleResult;
50
+ /** Registry of versioned frozen rules. Add a NEW key to change a rule; never edit in place. */
51
+ export declare const ACCEPTANCE_RULES: Readonly<Record<string, AcceptanceRule>>;
52
+ /** SHA-256 content hash of the sealed inputs (ADR-116 canonical form). */
53
+ export declare function sealedHash(sealed: SealedInputs): string;
54
+ /**
55
+ * Fingerprint of a rule VERSION. Because a rule change is a version bump
56
+ * (ADR-120 §5), fingerprinting the version string is the contract — an edited
57
+ * rule ships under a new version and thus a new fingerprint. Throws for an
58
+ * unknown version so a missing rule can never silently pass verification.
59
+ */
60
+ export declare function gateFingerprint(ruleVersion: string): string;
61
+ /** Re-execute a frozen rule on sealed inputs. Throws for an unknown version. */
62
+ export declare function reExecuteGate(ruleVersion: string, sealed: SealedInputs): RuleResult;
63
+ /** A recorded promotion decision. The logged verdict is advisory; the re-run is authoritative. */
64
+ export interface PromotionReceipt {
65
+ ruleVersion: string;
66
+ /** Fingerprint recorded at decision time. */
67
+ ruleFingerprint: string;
68
+ /** Content hash of the sealed inputs recorded at decision time. */
69
+ sealedHash: string;
70
+ sealed: SealedInputs;
71
+ /** What was logged. NOT trusted — re-execution decides. */
72
+ recordedVerdict: 'promote' | 'reject';
73
+ }
74
+ export interface ReplayChecks {
75
+ /** Sealed inputs were not mutated after the decision (ADR-116). */
76
+ sealIntact: boolean;
77
+ /** Recorded rule fingerprint matches the current (and pinned) rule version. */
78
+ gateUnchanged: boolean;
79
+ /** Re-running the frozen rule on the sealed inputs reproduces the recorded verdict. */
80
+ gateReExecutes: boolean;
81
+ }
82
+ export interface ReplayVerdict {
83
+ /** All three checks passed — the promotion is valid. */
84
+ valid: boolean;
85
+ checks: ReplayChecks;
86
+ failures: string[];
87
+ reason: string;
88
+ }
89
+ /**
90
+ * Verify a promotion by re-executing its frozen rule on its sealed inputs.
91
+ * The logged verdict is trusted only insofar as the re-run reproduces it.
92
+ *
93
+ * @param opts.pinnedRuleFingerprint - if supplied, the receipt's fingerprint
94
+ * must also equal this pinned value (an externally-anchored rule identity).
95
+ */
96
+ export declare function verifyPromotion(receipt: PromotionReceipt, opts?: {
97
+ pinnedRuleFingerprint?: string;
98
+ }): ReplayVerdict;
99
+ /**
100
+ * Superset sealed inputs for the retrofit promotion paths. Every field is
101
+ * optional; each frozen path rule reads only the fields it needs and rejects
102
+ * (never throws) when a field it requires is absent — a missing input can
103
+ * never silently promote.
104
+ */
105
+ export interface PathSealedInputs {
106
+ /** ADR-121 evidence tier of the artifact being promoted/applied. */
107
+ provenanceTier: string;
108
+ /** Whether judge-tier evidence was explicitly budgeted (ADR-121 / ADR-119). */
109
+ allowJudgeTier?: boolean;
110
+ /** Pattern average reward (quality score). */
111
+ reward?: number;
112
+ /** Reward promotion threshold the decision was gated at. */
113
+ rewardThreshold?: number;
114
+ /** Pattern usage/occurrence count. */
115
+ occurrences?: number;
116
+ /** Minimum occurrence threshold. */
117
+ occurrenceThreshold?: number;
118
+ /** Pattern success rate. */
119
+ successRate?: number;
120
+ /** Minimum success-rate threshold. */
121
+ successRateThreshold?: number;
122
+ /** Whether the pattern was active within the promotion window (anti-stale). */
123
+ withinActivityWindow?: boolean;
124
+ /** Dream insight confidence score. */
125
+ insightConfidence?: number;
126
+ /** Confidence threshold the apply was gated at. */
127
+ insightConfidenceThreshold?: number;
128
+ /** Whether the insight produced a real (non-`no_action`) reorganization. */
129
+ insightActionable?: boolean;
130
+ }
131
+ /** A versioned, frozen promotion-path rule — a pure function of sealed inputs. */
132
+ export type PathRule = (sealed: PathSealedInputs) => RuleResult;
133
+ /**
134
+ * Registry of versioned frozen promotion-path rules. Add a NEW key to change a
135
+ * rule; never edit in place (a rule change is a version bump — ADR-120 §5).
136
+ * Kept separate from `ACCEPTANCE_RULES` so the flywheel accept gate and its
137
+ * locked test are untouched.
138
+ */
139
+ export declare const PROMOTION_PATH_RULES: Readonly<Record<string, PathRule>>;
140
+ /** SHA-256 content hash of path sealed inputs (ADR-116 canonical form). */
141
+ export declare function pathSealedHash(sealed: PathSealedInputs): string;
142
+ /** Fingerprint of a path-rule VERSION. Throws for an unregistered rule. */
143
+ export declare function pathGateFingerprint(ruleVersion: string): string;
144
+ /** Re-execute a frozen path rule on sealed inputs. Throws for an unknown version. */
145
+ export declare function reExecutePathGate(ruleVersion: string, sealed: PathSealedInputs): RuleResult;
146
+ /** A recorded promotion/apply decision on a retrofit path. */
147
+ export interface PathPromotionReceipt {
148
+ ruleVersion: string;
149
+ /** Fingerprint recorded at decision time. */
150
+ ruleFingerprint: string;
151
+ /** Content hash of the sealed inputs recorded at decision time. */
152
+ sealedHash: string;
153
+ sealed: PathSealedInputs;
154
+ /** What was logged. NOT trusted — re-execution decides. */
155
+ recordedVerdict: 'promote' | 'reject';
156
+ }
157
+ /**
158
+ * Verify a promotion-path decision by re-executing its frozen rule on its
159
+ * sealed inputs. Identical semantics to {@link verifyPromotion}: the logged
160
+ * verdict is trusted only insofar as the re-run reproduces it on intact inputs.
161
+ */
162
+ export declare function verifyPathPromotion(receipt: PathPromotionReceipt, opts?: {
163
+ pinnedRuleFingerprint?: string;
164
+ }): ReplayVerdict;
165
+ //# sourceMappingURL=gate-reexecute.d.ts.map
@@ -0,0 +1,255 @@
1
+ /**
2
+ * gateReExecutes — re-execute a frozen acceptance rule from sealed inputs
3
+ * on every promotion path (ADR-120).
4
+ *
5
+ * The July 2026 remediation exposed the A8-EXT fake-`applied`-counter: a
6
+ * promotion path that logged success without doing the work — a logged verdict
7
+ * that lied. The fix (from MetaHarness `verifyReplayBundle`): trust the re-run,
8
+ * not the log. At verification time, re-execute a VERSIONED FROZEN acceptance
9
+ * rule against the decision's SEALED inputs; a recorded PROMOTE the frozen rule
10
+ * would not grant is a forgery.
11
+ *
12
+ * Two checks, both required (mirrors MetaHarness `replay.ts:66-90`):
13
+ * - gateUnchanged — the recorded rule fingerprint matches the current rule
14
+ * version's fingerprint (a swapped rule is caught).
15
+ * - gateReExecutes — re-running the frozen rule on the sealed inputs
16
+ * reproduces the recorded verdict.
17
+ * Plus sealIntact (ADR-116 composition) — the sealed inputs were not mutated
18
+ * after the decision. Re-execution on tampered inputs is meaningless.
19
+ *
20
+ * The acceptance rule is a PURE function of sealed inputs. `accept/v1` composes
21
+ * the cluster: ADR-121 provenance tier gate + ADR-118 held-out-beats-baseline +
22
+ * ADR-117 anchor no-regression. Changing a rule is a new VERSION, never an
23
+ * in-place edit (which gateUnchanged flags).
24
+ */
25
+ import { createHash } from 'node:crypto';
26
+ import { meetsNoRegression } from './anchor-set.js';
27
+ import { tierAllowsPromotion } from '../learning/provenance-tier.js';
28
+ /** Tag domain-separating the rule fingerprint hash. */
29
+ const RULE_TAG = 'aqe:accept-rule:v1+sig';
30
+ /**
31
+ * accept/v1 — the conjunctive frozen gate. Promotes only when ALL hold:
32
+ * 1. provenance tier is strong enough (ADR-121),
33
+ * 2. held-out strictly beats baseline (ADR-118),
34
+ * 3. the anchor mean does not regress (ADR-117).
35
+ */
36
+ const acceptV1 = (s) => {
37
+ if (!tierAllowsPromotion(s.provenanceTier, { allowJudgeTier: s.allowJudgeTier })) {
38
+ return { promote: false, reason: `provenance tier '${s.provenanceTier}' not allowed to promote` };
39
+ }
40
+ if (!(s.candidateHeldOut > s.baselineHeldOut)) {
41
+ return { promote: false, reason: `held-out ${s.candidateHeldOut} did not beat baseline ${s.baselineHeldOut}` };
42
+ }
43
+ if (!meetsNoRegression(s.candidateAnchorMean, s.baselineAnchorMean, s.anchorTol)) {
44
+ return { promote: false, reason: `anchor regression: ${s.candidateAnchorMean} < ${s.baselineAnchorMean} - ${s.anchorTol}` };
45
+ }
46
+ return { promote: true, reason: 'held-out gain, no anchor regression, oracle-tier evidence' };
47
+ };
48
+ /** Registry of versioned frozen rules. Add a NEW key to change a rule; never edit in place. */
49
+ export const ACCEPTANCE_RULES = Object.freeze({
50
+ 'accept/v1': acceptV1,
51
+ });
52
+ /**
53
+ * Canonical (sorted-key) JSON — same discipline as ADR-116 proof-gate. Keys
54
+ * whose value is `undefined` are OMITTED, matching JSON.stringify, so a sealed
55
+ * input's hash is stable across a JSON serialize/parse roundtrip (e.g. persisting
56
+ * a receipt to the DB and reloading it — an optional field like `allowJudgeTier`
57
+ * that is undefined must not change the hash).
58
+ */
59
+ function canonicalJson(value) {
60
+ if (value === null || typeof value !== 'object')
61
+ return JSON.stringify(value) ?? 'null';
62
+ if (Array.isArray(value))
63
+ return `[${value.map(canonicalJson).join(',')}]`;
64
+ const rec = value;
65
+ const keys = Object.keys(rec).filter((k) => rec[k] !== undefined).sort();
66
+ return `{${keys.map((k) => `${JSON.stringify(k)}:${canonicalJson(rec[k])}`).join(',')}}`;
67
+ }
68
+ /** SHA-256 content hash of the sealed inputs (ADR-116 canonical form). */
69
+ export function sealedHash(sealed) {
70
+ return createHash('sha256').update(canonicalJson(sealed)).digest('hex');
71
+ }
72
+ /**
73
+ * Fingerprint of a rule VERSION. Because a rule change is a version bump
74
+ * (ADR-120 §5), fingerprinting the version string is the contract — an edited
75
+ * rule ships under a new version and thus a new fingerprint. Throws for an
76
+ * unknown version so a missing rule can never silently pass verification.
77
+ */
78
+ export function gateFingerprint(ruleVersion) {
79
+ if (!(ruleVersion in ACCEPTANCE_RULES)) {
80
+ throw new Error(`Unknown acceptance rule version '${ruleVersion}' — cannot fingerprint an unregistered rule.`);
81
+ }
82
+ return createHash('sha256').update(RULE_TAG).update('\0').update(ruleVersion).digest('hex');
83
+ }
84
+ /** Re-execute a frozen rule on sealed inputs. Throws for an unknown version. */
85
+ export function reExecuteGate(ruleVersion, sealed) {
86
+ const rule = ACCEPTANCE_RULES[ruleVersion];
87
+ if (!rule) {
88
+ throw new Error(`Unknown acceptance rule version '${ruleVersion}' — refusing to re-execute an unregistered rule.`);
89
+ }
90
+ return rule(sealed);
91
+ }
92
+ /**
93
+ * Verify a promotion by re-executing its frozen rule on its sealed inputs.
94
+ * The logged verdict is trusted only insofar as the re-run reproduces it.
95
+ *
96
+ * @param opts.pinnedRuleFingerprint - if supplied, the receipt's fingerprint
97
+ * must also equal this pinned value (an externally-anchored rule identity).
98
+ */
99
+ export function verifyPromotion(receipt, opts = {}) {
100
+ const failures = [];
101
+ // sealIntact — recompute the sealed content hash (ADR-116).
102
+ const sealIntact = sealedHash(receipt.sealed) === receipt.sealedHash;
103
+ if (!sealIntact)
104
+ failures.push('sealIntact');
105
+ // gateUnchanged — recorded fingerprint matches the current rule version, and
106
+ // the pinned fingerprint if one was supplied. Unknown version ⇒ not unchanged.
107
+ let gateUnchanged = false;
108
+ try {
109
+ const currentFp = gateFingerprint(receipt.ruleVersion);
110
+ gateUnchanged =
111
+ receipt.ruleFingerprint === currentFp &&
112
+ (opts.pinnedRuleFingerprint === undefined || receipt.ruleFingerprint === opts.pinnedRuleFingerprint);
113
+ }
114
+ catch {
115
+ gateUnchanged = false; // unregistered rule version
116
+ }
117
+ if (!gateUnchanged)
118
+ failures.push('gateUnchanged');
119
+ // gateReExecutes — only meaningful if the inputs are intact and the rule is
120
+ // the same one. Re-run must reproduce the recorded verdict; a logged PROMOTE
121
+ // the frozen rule would reject (the A8-EXT forgery class) fails here.
122
+ let gateReExecutes = false;
123
+ if (sealIntact && gateUnchanged) {
124
+ const rerun = reExecuteGate(receipt.ruleVersion, receipt.sealed);
125
+ const rerunVerdict = rerun.promote ? 'promote' : 'reject';
126
+ gateReExecutes = rerunVerdict === receipt.recordedVerdict;
127
+ }
128
+ if (!gateReExecutes)
129
+ failures.push('gateReExecutes');
130
+ const valid = failures.length === 0;
131
+ return {
132
+ valid,
133
+ checks: { sealIntact, gateUnchanged, gateReExecutes },
134
+ failures,
135
+ reason: valid
136
+ ? 'promotion verified: sealed inputs intact, rule unchanged, frozen rule re-execution reproduces the recorded verdict'
137
+ : `promotion INVALID (failed: ${failures.join(', ')}) — the recorded verdict is not reproducible under the frozen rule`,
138
+ };
139
+ }
140
+ /** Tag domain-separating the path-rule fingerprint (distinct from the accept tag). */
141
+ const PATH_RULE_TAG = 'aqe:promotion-path-rule:v1+sig';
142
+ /**
143
+ * pattern-promote/v1 — the P1 conjunctive gate (short-term → long-term).
144
+ * Promotes only when ALL hold: evidence tier allows promotion (ADR-121),
145
+ * reward / occurrences / success-rate clear their sealed thresholds, and the
146
+ * pattern was active within the promotion window (anti-stale).
147
+ */
148
+ const patternPromoteV1 = (s) => {
149
+ if (!tierAllowsPromotion(s.provenanceTier, { allowJudgeTier: s.allowJudgeTier })) {
150
+ return { promote: false, reason: `provenance tier '${s.provenanceTier}' not allowed to promote` };
151
+ }
152
+ if (s.reward === undefined || s.rewardThreshold === undefined || !(s.reward >= s.rewardThreshold)) {
153
+ return { promote: false, reason: `reward ${s.reward} below threshold ${s.rewardThreshold}` };
154
+ }
155
+ if (s.occurrences === undefined || s.occurrenceThreshold === undefined || !(s.occurrences >= s.occurrenceThreshold)) {
156
+ return { promote: false, reason: `occurrences ${s.occurrences} below threshold ${s.occurrenceThreshold}` };
157
+ }
158
+ if (s.successRate === undefined || s.successRateThreshold === undefined || !(s.successRate >= s.successRateThreshold)) {
159
+ return { promote: false, reason: `success rate ${s.successRate} below threshold ${s.successRateThreshold}` };
160
+ }
161
+ if (s.withinActivityWindow !== true) {
162
+ return { promote: false, reason: 'pattern outside promotion activity window (stale)' };
163
+ }
164
+ return { promote: true, reason: 'tier allowed; reward/occurrence/success-rate thresholds met; within activity window' };
165
+ };
166
+ /**
167
+ * dream-apply/v1 — the P2 gate (the A8-EXT fake-`applied`-counter home).
168
+ * An insight is countable as applied only when: its evidence tier allows a
169
+ * fleet-changing apply (ADR-121), its confidence clears the sealed threshold,
170
+ * and it produced a real reorganization action (not `no_action`).
171
+ */
172
+ const dreamApplyV1 = (s) => {
173
+ if (!tierAllowsPromotion(s.provenanceTier, { allowJudgeTier: s.allowJudgeTier })) {
174
+ return { promote: false, reason: `provenance tier '${s.provenanceTier}' not allowed to apply` };
175
+ }
176
+ if (s.insightConfidence === undefined ||
177
+ s.insightConfidenceThreshold === undefined ||
178
+ !(s.insightConfidence >= s.insightConfidenceThreshold)) {
179
+ return { promote: false, reason: `insight confidence ${s.insightConfidence} below threshold ${s.insightConfidenceThreshold}` };
180
+ }
181
+ if (s.insightActionable !== true) {
182
+ return { promote: false, reason: 'insight produced no actionable reorganization' };
183
+ }
184
+ return { promote: true, reason: 'tier allowed; insight confidence meets threshold; actionable' };
185
+ };
186
+ /**
187
+ * Registry of versioned frozen promotion-path rules. Add a NEW key to change a
188
+ * rule; never edit in place (a rule change is a version bump — ADR-120 §5).
189
+ * Kept separate from `ACCEPTANCE_RULES` so the flywheel accept gate and its
190
+ * locked test are untouched.
191
+ */
192
+ export const PROMOTION_PATH_RULES = Object.freeze({
193
+ 'pattern-promote/v1': patternPromoteV1,
194
+ 'dream-apply/v1': dreamApplyV1,
195
+ });
196
+ /** SHA-256 content hash of path sealed inputs (ADR-116 canonical form). */
197
+ export function pathSealedHash(sealed) {
198
+ return createHash('sha256').update(canonicalJson(sealed)).digest('hex');
199
+ }
200
+ /** Fingerprint of a path-rule VERSION. Throws for an unregistered rule. */
201
+ export function pathGateFingerprint(ruleVersion) {
202
+ if (!(ruleVersion in PROMOTION_PATH_RULES)) {
203
+ throw new Error(`Unknown promotion-path rule version '${ruleVersion}' — cannot fingerprint an unregistered rule.`);
204
+ }
205
+ return createHash('sha256').update(PATH_RULE_TAG).update('\0').update(ruleVersion).digest('hex');
206
+ }
207
+ /** Re-execute a frozen path rule on sealed inputs. Throws for an unknown version. */
208
+ export function reExecutePathGate(ruleVersion, sealed) {
209
+ const rule = PROMOTION_PATH_RULES[ruleVersion];
210
+ if (!rule) {
211
+ throw new Error(`Unknown promotion-path rule version '${ruleVersion}' — refusing to re-execute an unregistered rule.`);
212
+ }
213
+ return rule(sealed);
214
+ }
215
+ /**
216
+ * Verify a promotion-path decision by re-executing its frozen rule on its
217
+ * sealed inputs. Identical semantics to {@link verifyPromotion}: the logged
218
+ * verdict is trusted only insofar as the re-run reproduces it on intact inputs.
219
+ */
220
+ export function verifyPathPromotion(receipt, opts = {}) {
221
+ const failures = [];
222
+ const sealIntact = pathSealedHash(receipt.sealed) === receipt.sealedHash;
223
+ if (!sealIntact)
224
+ failures.push('sealIntact');
225
+ let gateUnchanged = false;
226
+ try {
227
+ const currentFp = pathGateFingerprint(receipt.ruleVersion);
228
+ gateUnchanged =
229
+ receipt.ruleFingerprint === currentFp &&
230
+ (opts.pinnedRuleFingerprint === undefined || receipt.ruleFingerprint === opts.pinnedRuleFingerprint);
231
+ }
232
+ catch {
233
+ gateUnchanged = false; // unregistered rule version
234
+ }
235
+ if (!gateUnchanged)
236
+ failures.push('gateUnchanged');
237
+ let gateReExecutes = false;
238
+ if (sealIntact && gateUnchanged) {
239
+ const rerun = reExecutePathGate(receipt.ruleVersion, receipt.sealed);
240
+ const rerunVerdict = rerun.promote ? 'promote' : 'reject';
241
+ gateReExecutes = rerunVerdict === receipt.recordedVerdict;
242
+ }
243
+ if (!gateReExecutes)
244
+ failures.push('gateReExecutes');
245
+ const valid = failures.length === 0;
246
+ return {
247
+ valid,
248
+ checks: { sealIntact, gateUnchanged, gateReExecutes },
249
+ failures,
250
+ reason: valid
251
+ ? 'promotion verified: sealed inputs intact, rule unchanged, frozen rule re-execution reproduces the recorded verdict'
252
+ : `promotion INVALID (failed: ${failures.join(', ')}) — the recorded verdict is not reproducible under the frozen rule`,
253
+ };
254
+ }
255
+ //# sourceMappingURL=gate-reexecute.js.map