agentic-qe 3.15.17 → 3.15.18

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 (495) hide show
  1. package/.claude/helpers/brain-checkpoint.cjs +107 -10
  2. package/.claude/skills/agentic-quality-engineering/SKILL.md +67 -44
  3. package/.claude/skills/brutal-honesty-review/SKILL.md +12 -7
  4. package/.claude/skills/brutal-honesty-review/evals/brutal-honesty-review.yaml +120 -0
  5. package/.claude/skills/brutal-honesty-review/schemas/output.json +9 -3
  6. package/.claude/skills/code-review-quality/SKILL.md +2 -2
  7. package/.claude/skills/holistic-testing-pact/SKILL.md +11 -11
  8. package/.claude/skills/sherlock-review/SKILL.md +4 -2
  9. package/.claude/skills/sherlock-review/evals/sherlock-review.yaml +124 -0
  10. package/.claude/skills/skills-manifest.json +1 -1
  11. package/.claude/skills/technical-writing/SKILL.md +12 -6
  12. package/.claude/skills/technical-writing/evals/technical-writing.yaml +96 -0
  13. package/.opencode/skills/qe-agentic-quality-engineering.yaml +2 -2
  14. package/.opencode/skills/qe-holistic-testing-pact.yaml +2 -2
  15. package/CHANGELOG.md +123 -0
  16. package/assets/skills/agentic-quality-engineering/SKILL.md +67 -44
  17. package/assets/skills/brutal-honesty-review/SKILL.md +12 -8
  18. package/assets/skills/brutal-honesty-review/evals/brutal-honesty-review.yaml +120 -0
  19. package/assets/skills/brutal-honesty-review/schemas/output.json +9 -3
  20. package/assets/skills/code-review-quality/SKILL.md +2 -2
  21. package/assets/skills/holistic-testing-pact/SKILL.md +11 -11
  22. package/assets/skills/sherlock-review/SKILL.md +4 -3
  23. package/assets/skills/sherlock-review/evals/sherlock-review.yaml +124 -0
  24. package/assets/skills/skills-manifest.json +1 -1
  25. package/assets/skills/technical-writing/SKILL.md +12 -6
  26. package/assets/skills/technical-writing/evals/technical-writing.yaml +96 -0
  27. package/dist/cli/brain-commands.d.ts +5 -0
  28. package/dist/cli/brain-commands.js +4 -0
  29. package/dist/cli/bundle.js +6 -6
  30. package/dist/cli/chunks/adapter-WRSDXLOT.js +2 -0
  31. package/dist/cli/chunks/{agent-booster-wasm-6BUOFQZA.js → agent-booster-wasm-UFNJNF3M.js} +2 -2
  32. package/dist/cli/chunks/{agent-handler-HPDK3JI3.js → agent-handler-EAYVRJXN.js} +2 -2
  33. package/dist/cli/chunks/{agent-memory-branch-5QKUTWK5.js → agent-memory-branch-M65C6WAQ.js} +2 -2
  34. package/dist/cli/chunks/aqe-learning-engine-O6NJBCCM.js +2 -0
  35. package/dist/cli/chunks/{arena-HZ35LESR.js → arena-2GDICP6R.js} +4 -4
  36. package/dist/cli/chunks/{arena-7OKPMNHD.js → arena-CG3X67OE.js} +2 -2
  37. package/dist/cli/chunks/{audit-XI575SVK.js → audit-F4FSPJPL.js} +3 -3
  38. package/dist/cli/chunks/base-J2FXOE77.js +2 -0
  39. package/dist/cli/chunks/{better-sqlite3-YO5X7ZJS.js → better-sqlite3-2MCFXW4J.js} +2 -2
  40. package/dist/cli/chunks/brain-handler-WGTJNYNB.js +95 -0
  41. package/dist/cli/chunks/{branch-enumerator-N6G44UU2.js → branch-enumerator-KL7C535H.js} +2 -2
  42. package/dist/cli/chunks/{browser-EVKPTLOI.js → browser-SJEXDVHS.js} +2 -2
  43. package/dist/cli/chunks/browser-workflow-LXGER6ZD.js +2 -0
  44. package/dist/cli/chunks/{chunk-VLTDW7XJ.js → chunk-244RKAEP.js} +2 -2
  45. package/dist/cli/chunks/{chunk-CVPXHDQU.js → chunk-27TUMXPD.js} +1 -1
  46. package/dist/cli/chunks/{chunk-FBBPRVNF.js → chunk-2MBYDPCP.js} +2 -2
  47. package/dist/cli/chunks/{chunk-P3D7SEHW.js → chunk-2Q6DTBMT.js} +1 -1
  48. package/dist/cli/chunks/{chunk-NE3LRUNC.js → chunk-355MI7RV.js} +13 -13
  49. package/dist/cli/chunks/{chunk-YCVLKU6H.js → chunk-3LX5OKBD.js} +2 -2
  50. package/dist/cli/chunks/{chunk-74MDUIAZ.js → chunk-3RPDKJGV.js} +1 -1
  51. package/dist/cli/chunks/{chunk-OWIQR6N2.js → chunk-3YMIT73A.js} +2 -2
  52. package/dist/cli/chunks/{chunk-VKREKVFI.js → chunk-43KUVBSU.js} +2 -2
  53. package/dist/cli/chunks/chunk-477FKXSS.js +2 -0
  54. package/dist/cli/chunks/{chunk-XPTCQKVE.js → chunk-4BIMTRRX.js} +1 -1
  55. package/dist/cli/chunks/{chunk-HD6W6PHV.js → chunk-4CVNVBX5.js} +2 -2
  56. package/dist/cli/chunks/{chunk-CQER6IJ5.js → chunk-4HL3SD4A.js} +1 -1
  57. package/dist/cli/chunks/{chunk-ZNXM6WVL.js → chunk-4PEG4DU2.js} +2 -2
  58. package/dist/cli/chunks/{chunk-BSIWI4ES.js → chunk-4QSQKFED.js} +2 -2
  59. package/dist/cli/chunks/chunk-53ZBETYR.js +16 -0
  60. package/dist/cli/chunks/{chunk-BHQ2DLJU.js → chunk-544KDWL4.js} +1 -1
  61. package/dist/cli/chunks/chunk-54RCGMLB.js +8 -0
  62. package/dist/cli/chunks/{chunk-TDZ6N43D.js → chunk-5AGXIZQ5.js} +2 -2
  63. package/dist/cli/chunks/{chunk-RKCN4B26.js → chunk-5M24X6W7.js} +2 -2
  64. package/dist/cli/chunks/{chunk-GG7PMTHD.js → chunk-5O5T4LEU.js} +1 -1
  65. package/dist/cli/chunks/{chunk-OWIZBZLN.js → chunk-5RFXX4IF.js} +2 -2
  66. package/dist/cli/chunks/{chunk-VQFV2IPV.js → chunk-62MLAQRJ.js} +1 -1
  67. package/dist/cli/chunks/{chunk-PCL5JRKN.js → chunk-6D6TGL2E.js} +2 -2
  68. package/dist/cli/chunks/{chunk-WBDWHHKP.js → chunk-6IHZDSDL.js} +2 -2
  69. package/dist/cli/chunks/{chunk-UOVCTK5L.js → chunk-6P3Y45QL.js} +2 -2
  70. package/dist/cli/chunks/{chunk-45223KK6.js → chunk-6TEVM3X3.js} +10 -10
  71. package/dist/cli/chunks/{chunk-K7WAI662.js → chunk-7XTUKKRA.js} +1 -1
  72. package/dist/cli/chunks/chunk-A3GDX6UF.js +2 -0
  73. package/dist/cli/chunks/{chunk-GN6OE3JT.js → chunk-A5YTKKNA.js} +1 -1
  74. package/dist/cli/chunks/{chunk-KR2TAAF6.js → chunk-ADNGZAT2.js} +1 -1
  75. package/dist/cli/chunks/{chunk-J7Q5TXFZ.js → chunk-AWQAE3SW.js} +2 -2
  76. package/dist/cli/chunks/{chunk-ZN35XSKF.js → chunk-AXDBQFR4.js} +2 -2
  77. package/dist/cli/chunks/{chunk-ND72UDVH.js → chunk-AXVD7O3F.js} +2 -2
  78. package/dist/cli/chunks/{chunk-SAEECT23.js → chunk-B52ULNYO.js} +2 -2
  79. package/dist/cli/chunks/chunk-B6S4FC7M.js +3 -0
  80. package/dist/cli/chunks/{chunk-Z7SKUC6P.js → chunk-BDVFSMOQ.js} +1 -1
  81. package/dist/cli/chunks/{chunk-CXCMATZ6.js → chunk-BGXXMX3Y.js} +2 -2
  82. package/dist/cli/chunks/{chunk-R3KBOQ3O.js → chunk-BKMQQY5T.js} +2 -2
  83. package/dist/cli/chunks/{chunk-SAZ4PJBR.js → chunk-BN2FROBQ.js} +2 -2
  84. package/dist/cli/chunks/{chunk-G2X3OLMN.js → chunk-BO6EQNOC.js} +2 -2
  85. package/dist/cli/chunks/{chunk-776K4ZLE.js → chunk-BOVAKCDC.js} +2 -2
  86. package/dist/cli/chunks/{chunk-QSQNXBD2.js → chunk-BSXKZDKO.js} +2 -2
  87. package/dist/cli/chunks/{chunk-MGZ6XZHU.js → chunk-C5QVJ5XQ.js} +1 -1
  88. package/dist/cli/chunks/{chunk-LOLSZG5J.js → chunk-CFQLLF3D.js} +2 -2
  89. package/dist/cli/chunks/{chunk-J6QRNQJF.js → chunk-DUCVLT3F.js} +7 -7
  90. package/dist/cli/chunks/{chunk-QTQDX4TZ.js → chunk-E4RMJCGA.js} +3 -3
  91. package/dist/cli/chunks/{chunk-MLMD3I75.js → chunk-EONDCWY4.js} +1 -1
  92. package/dist/cli/chunks/{chunk-7BSOO3CY.js → chunk-F4AGNKL2.js} +2 -2
  93. package/dist/cli/chunks/{chunk-IKB3M7OF.js → chunk-F6YD3BOW.js} +1 -1
  94. package/dist/cli/chunks/{chunk-LIF6UWHV.js → chunk-FQRS7WVA.js} +2 -2
  95. package/dist/cli/chunks/{chunk-QJSSUBO3.js → chunk-FT24SSDG.js} +2 -2
  96. package/dist/cli/chunks/chunk-FV4YNSAJ.js +5 -0
  97. package/dist/cli/chunks/{chunk-VITV7AEC.js → chunk-FVDM3X42.js} +2 -2
  98. package/dist/cli/chunks/{chunk-LN7NKE3N.js → chunk-FVH7TXWU.js} +2 -2
  99. package/dist/cli/chunks/{chunk-FBSBXCZS.js → chunk-FWR5QY37.js} +2 -2
  100. package/dist/cli/chunks/{chunk-X2DWHGCC.js → chunk-FYINK2B7.js} +2 -2
  101. package/dist/cli/chunks/{chunk-ECKHDHR2.js → chunk-GGISVPOZ.js} +2 -2
  102. package/dist/cli/chunks/{chunk-SRBCBVSI.js → chunk-GPIJIZJQ.js} +2 -2
  103. package/dist/cli/chunks/{chunk-YR5QBUHZ.js → chunk-GXEVOT5F.js} +2 -2
  104. package/dist/cli/chunks/{chunk-ZTP3DQ5M.js → chunk-GZ4VB5RI.js} +1 -1
  105. package/dist/cli/chunks/{chunk-HWQPMUSN.js → chunk-HBDSCYSK.js} +2 -2
  106. package/dist/cli/chunks/{chunk-XBTGEYED.js → chunk-HGG4HR7C.js} +2 -2
  107. package/dist/cli/chunks/{chunk-YD2C6EPN.js → chunk-HSCKWWO2.js} +2 -2
  108. package/dist/cli/chunks/{chunk-LOMT4UC2.js → chunk-HSQ3GUYJ.js} +2 -2
  109. package/dist/cli/chunks/{chunk-ZC3KDNJW.js → chunk-HZQBW5EM.js} +3 -3
  110. package/dist/cli/chunks/{chunk-SUAZ5Z47.js → chunk-IGIYANVT.js} +2 -2
  111. package/dist/cli/chunks/{chunk-IHQGNDMX.js → chunk-IPWMSXBF.js} +2 -2
  112. package/dist/cli/chunks/{chunk-6V6BD6PH.js → chunk-IWVNC7VY.js} +1 -1
  113. package/dist/cli/chunks/{chunk-M2YI5YUR.js → chunk-IZODXKZD.js} +2 -2
  114. package/dist/cli/chunks/{chunk-LG5PPJT7.js → chunk-J2MT2OJV.js} +1 -1
  115. package/dist/cli/chunks/{chunk-6LSZCEW2.js → chunk-JKIJVVSP.js} +1 -1
  116. package/dist/cli/chunks/{chunk-REY52O7J.js → chunk-JMRDT2XK.js} +1 -1
  117. package/dist/cli/chunks/{chunk-XEYFZLIT.js → chunk-JR2UMTKG.js} +1 -1
  118. package/dist/cli/chunks/{chunk-DJDVD6RM.js → chunk-K6CH4CFF.js} +2 -2
  119. package/dist/cli/chunks/{chunk-2PCEMDIX.js → chunk-K7KW5QB5.js} +78 -87
  120. package/dist/cli/chunks/{chunk-EPVPXHL7.js → chunk-KFCQP434.js} +2 -2
  121. package/dist/cli/chunks/{chunk-TWBZONKT.js → chunk-KH4T6STG.js} +2 -2
  122. package/dist/cli/chunks/{chunk-JI33PMPZ.js → chunk-KJBYZO57.js} +1 -1
  123. package/dist/cli/chunks/{chunk-PK34KJH7.js → chunk-KP4OKOKV.js} +2 -2
  124. package/dist/cli/chunks/chunk-L2MBKVSE.js +2 -0
  125. package/dist/cli/chunks/{chunk-JVWZAE2H.js → chunk-L3IPUIT3.js} +2 -2
  126. package/dist/cli/chunks/{chunk-KT2QCXO6.js → chunk-L7PSU2YN.js} +2 -2
  127. package/dist/cli/chunks/{chunk-HAQJFUAQ.js → chunk-LA3JPGQA.js} +2 -2
  128. package/dist/cli/chunks/{chunk-LV7UIK4Q.js → chunk-LC2QRN7V.js} +14 -13
  129. package/dist/cli/chunks/{chunk-KTORRIX3.js → chunk-LHY7TMTM.js} +2 -2
  130. package/dist/cli/chunks/{chunk-IJSROBM6.js → chunk-LLQ2UMF6.js} +3 -3
  131. package/dist/cli/chunks/{chunk-NKUHMA4T.js → chunk-LOJ7OO6W.js} +2 -2
  132. package/dist/cli/chunks/{chunk-OJIUIEI4.js → chunk-LPUSH3VF.js} +1 -1
  133. package/dist/cli/chunks/{chunk-WAOEQA3W.js → chunk-LSEC2BU7.js} +2 -2
  134. package/dist/cli/chunks/{chunk-YMUY3TES.js → chunk-LTGB7OIU.js} +2 -2
  135. package/dist/cli/chunks/{chunk-CVYPMGUM.js → chunk-LUG7YNVZ.js} +2 -2
  136. package/dist/cli/chunks/{chunk-YAJOBZE5.js → chunk-LWAFRYKE.js} +2 -2
  137. package/dist/cli/chunks/{chunk-ZP5AWQRO.js → chunk-M24ZAZ4U.js} +2 -2
  138. package/dist/cli/chunks/{chunk-HFZD5KLR.js → chunk-MKRKRXTX.js} +1 -1
  139. package/dist/cli/chunks/{chunk-4YM45Z5B.js → chunk-MNNLONAD.js} +1 -1
  140. package/dist/cli/chunks/{chunk-CMN7PU2H.js → chunk-MQM37KAR.js} +2 -2
  141. package/dist/cli/chunks/{chunk-COTQ44YO.js → chunk-MSX2OHYT.js} +2 -2
  142. package/dist/cli/chunks/{chunk-4UKTIQDT.js → chunk-MVYQRVLP.js} +2 -2
  143. package/dist/cli/chunks/{chunk-HRUHHHVR.js → chunk-MZC5WM2P.js} +2 -2
  144. package/dist/cli/chunks/{chunk-YKRLUTK7.js → chunk-MZRBNBB3.js} +2 -2
  145. package/dist/cli/chunks/{chunk-XEMCHGAJ.js → chunk-N3KQU4UC.js} +2 -2
  146. package/dist/cli/chunks/{chunk-DS5IFRY6.js → chunk-NKU3FFM4.js} +2 -2
  147. package/dist/cli/chunks/chunk-O5EWFR76.js +2 -0
  148. package/dist/cli/chunks/{chunk-J3QFJI2Y.js → chunk-O5RDHD5T.js} +2 -2
  149. package/dist/cli/chunks/chunk-O6UWIXME.js +3 -0
  150. package/dist/cli/chunks/{chunk-Q6F3DYZN.js → chunk-OA4EQDC4.js} +2 -2
  151. package/dist/cli/chunks/{chunk-NQFDJ6BT.js → chunk-OBCXCRXK.js} +1 -1
  152. package/dist/cli/chunks/{chunk-S3TBOKAZ.js → chunk-OHU5P25N.js} +4 -4
  153. package/dist/cli/chunks/{chunk-DNVRTJKB.js → chunk-OOSV2RIA.js} +2 -2
  154. package/dist/cli/chunks/{chunk-NZJVDOUN.js → chunk-OW23N2Y5.js} +2 -2
  155. package/dist/cli/chunks/{chunk-ZWUF27P4.js → chunk-OXOO3YDL.js} +2 -2
  156. package/dist/cli/chunks/{chunk-4L6WX5KC.js → chunk-OYGKSSSI.js} +1 -1
  157. package/dist/cli/chunks/{chunk-DCDSN67A.js → chunk-PGO46IIW.js} +1 -1
  158. package/dist/cli/chunks/{chunk-C7QLLMYI.js → chunk-PZOYQHWS.js} +1 -1
  159. package/dist/cli/chunks/{chunk-BKHEQIRZ.js → chunk-Q2BZSG7Z.js} +2 -2
  160. package/dist/cli/chunks/{chunk-5FSPELOG.js → chunk-Q7V722K5.js} +2 -2
  161. package/dist/cli/chunks/{chunk-2EQK7B5L.js → chunk-QZU6M5IO.js} +2 -2
  162. package/dist/cli/chunks/{chunk-HVT7RMGV.js → chunk-R55Y76SJ.js} +1 -1
  163. package/dist/cli/chunks/{chunk-POPSZDI2.js → chunk-RMEQYJPU.js} +4 -4
  164. package/dist/cli/chunks/{chunk-H2LHWZRE.js → chunk-RTYXFXTI.js} +2 -2
  165. package/dist/cli/chunks/{chunk-QN7HP2UW.js → chunk-SJF3O4FX.js} +236 -236
  166. package/dist/cli/chunks/{chunk-2YWYW7NU.js → chunk-SOUS7Z2H.js} +2 -2
  167. package/dist/cli/chunks/{chunk-U5SMBJ6F.js → chunk-SRVNR3R3.js} +2 -2
  168. package/dist/cli/chunks/{chunk-ZAQMRFBB.js → chunk-SU3SXMVG.js} +2 -2
  169. package/dist/cli/chunks/chunk-SWGPLXWW.js +32 -0
  170. package/dist/cli/chunks/{chunk-S3DT5TPR.js → chunk-TRB3EVH3.js} +2 -2
  171. package/dist/cli/chunks/{chunk-IJZFJPHS.js → chunk-TVBDUMKT.js} +2 -2
  172. package/dist/cli/chunks/{chunk-7SNSI4VY.js → chunk-TWTXPSFU.js} +1 -1
  173. package/dist/cli/chunks/{chunk-ORQ2YBRR.js → chunk-ULYUVUL2.js} +2 -2
  174. package/dist/cli/chunks/{chunk-MVVVGQJ6.js → chunk-UNTBVJ5X.js} +2 -2
  175. package/dist/cli/chunks/{chunk-5WATBVU6.js → chunk-UQAA4PHU.js} +2 -2
  176. package/dist/cli/chunks/{chunk-5WYZVSL2.js → chunk-UWSJVKTE.js} +1 -1
  177. package/dist/cli/chunks/{chunk-JHKKIJT2.js → chunk-V2LJ54KP.js} +2 -2
  178. package/dist/cli/chunks/{chunk-2UUZCQSD.js → chunk-VCCTTKP3.js} +2 -2
  179. package/dist/cli/chunks/{chunk-P4OB6WDJ.js → chunk-VEGUYUVS.js} +1 -1
  180. package/dist/cli/chunks/{chunk-WX4PO65Q.js → chunk-VUQPVWNK.js} +2 -2
  181. package/dist/cli/chunks/{chunk-IQL6XRF5.js → chunk-VVGUE2T2.js} +2 -2
  182. package/dist/cli/chunks/{chunk-HZ5O7G2P.js → chunk-W5ASDHJQ.js} +1 -1
  183. package/dist/cli/chunks/{chunk-U4S74IIZ.js → chunk-WGXT5NWQ.js} +1 -1
  184. package/dist/cli/chunks/chunk-WJN3V7QB.js +7 -0
  185. package/dist/cli/chunks/chunk-WPCRQIIF.js +29 -0
  186. package/dist/cli/chunks/{chunk-AGCS5GSO.js → chunk-WQNLXUWA.js} +6 -6
  187. package/dist/cli/chunks/{chunk-LRY6UIRI.js → chunk-WZVRMKG2.js} +2 -2
  188. package/dist/cli/chunks/{chunk-KPIPVSIP.js → chunk-X27IUWTD.js} +2 -2
  189. package/dist/cli/chunks/{chunk-VDEKVIP5.js → chunk-X4B345B6.js} +2 -2
  190. package/dist/cli/chunks/{chunk-ERYADKMZ.js → chunk-X5I2Y4VO.js} +2 -2
  191. package/dist/cli/chunks/{chunk-EUWG2JG4.js → chunk-X7IQIFTS.js} +2 -2
  192. package/dist/cli/chunks/chunk-XJN3RKUD.js +3 -0
  193. package/dist/cli/chunks/{chunk-JRIJM4LE.js → chunk-XQMGXTHJ.js} +3 -3
  194. package/dist/cli/chunks/{chunk-VYPVU3JF.js → chunk-XTSAMB2Q.js} +2 -2
  195. package/dist/cli/chunks/{chunk-4NKZU2JZ.js → chunk-XZLIF4O2.js} +2 -2
  196. package/dist/cli/chunks/{chunk-XFTX3KLE.js → chunk-Y4LSEOZ3.js} +1 -1
  197. package/dist/cli/chunks/{chunk-ZVMSSCTH.js → chunk-Y4YN2RXR.js} +2 -2
  198. package/dist/cli/chunks/{chunk-X5QD76IU.js → chunk-YDI56L35.js} +2 -2
  199. package/dist/cli/chunks/{chunk-LRKLATSH.js → chunk-YFILS5D5.js} +2 -2
  200. package/dist/cli/chunks/{chunk-AVHYJ3XP.js → chunk-YISDX6WB.js} +2 -2
  201. package/dist/cli/chunks/{chunk-GPPTRKEM.js → chunk-YP2GHQSV.js} +2 -2
  202. package/dist/cli/chunks/{chunk-OO2M2QUV.js → chunk-YSX756AM.js} +4 -4
  203. package/dist/cli/chunks/{chunk-E7XIMOKW.js → chunk-YWANOASW.js} +2 -2
  204. package/dist/cli/chunks/{chunk-UHJVZEQA.js → chunk-YYIJLG7S.js} +2 -2
  205. package/dist/cli/chunks/{chunk-LCWEQRZI.js → chunk-Z7SD7LXM.js} +2 -2
  206. package/dist/cli/chunks/{chunk-TM75GAXG.js → chunk-ZDWD73UF.js} +2 -2
  207. package/dist/cli/chunks/{chunk-IRHXGCQR.js → chunk-ZFT3RLA4.js} +2 -2
  208. package/dist/cli/chunks/{chunk-ZGV7L4MW.js → chunk-ZNTHX5G3.js} +1 -1
  209. package/dist/cli/chunks/{chunk-D75GLKEL.js → chunk-ZS27R7VL.js} +2 -2
  210. package/dist/cli/chunks/{chunk-INI3Q4CN.js → chunk-ZXHHHR7K.js} +1 -1
  211. package/dist/cli/chunks/{ci-3RTTTS2D.js → ci-N5MOMNXH.js} +2 -2
  212. package/dist/cli/chunks/{ci-config-XRUR3I4K.js → ci-config-6L2ROQCW.js} +2 -2
  213. package/dist/cli/chunks/{ci-output-E5IAMU2U.js → ci-output-DSRBYEIK.js} +2 -2
  214. package/dist/cli/chunks/{circuit-breaker-SHR2P44P.js → circuit-breaker-VRPTNBL7.js} +2 -2
  215. package/dist/cli/chunks/{claude-flow-setup-ZDDILFMF.js → claude-flow-setup-4YFG3FU5.js} +2 -2
  216. package/dist/cli/chunks/client-I3L6BKRQ.js +2 -0
  217. package/dist/cli/chunks/{cline-installer-BGYVUM6G.js → cline-installer-7RGYJWGN.js} +2 -2
  218. package/dist/cli/chunks/{code-PJ4MC3MC.js → code-ISC6NW2K.js} +3 -3
  219. package/dist/cli/chunks/{code-index-extractor-IW2P22YG.js → code-index-extractor-2FID75YV.js} +2 -2
  220. package/dist/cli/chunks/{codex-installer-A7WZ6OGL.js → codex-installer-DZ7OG6KM.js} +2 -2
  221. package/dist/cli/chunks/{completions-KS23WD5J.js → completions-SM3LICWK.js} +2 -2
  222. package/dist/cli/chunks/{complexity-analyzer-Q7GLSR2E.js → complexity-analyzer-ZWD2CTAD.js} +2 -2
  223. package/dist/cli/chunks/{continuedev-installer-SK55BFW2.js → continuedev-installer-AGASOA26.js} +2 -2
  224. package/dist/cli/chunks/{copilot-installer-3N5J3WTM.js → copilot-installer-CLPZYTQC.js} +2 -2
  225. package/dist/cli/chunks/core-handlers-5EFOJ37H.js +2 -0
  226. package/dist/cli/chunks/{cost-tracker-NENVSO4A.js → cost-tracker-7PIGQYDV.js} +2 -2
  227. package/dist/cli/chunks/{coverage-5L7UQWDH.js → coverage-T2GEBTYS.js} +9 -9
  228. package/dist/cli/chunks/cross-domain-router-65WJAKVD.js +2 -0
  229. package/dist/cli/chunks/{cursor-installer-XXBO2ZE6.js → cursor-installer-KXBID4MB.js} +2 -2
  230. package/dist/cli/chunks/daemon-43MXIVH3.js +18 -0
  231. package/dist/cli/chunks/{daemon-CDCQU3LR.js → daemon-VAMJLQJ5.js} +3 -3
  232. package/dist/cli/chunks/{dag-attention-scheduler-HOMMF7FA.js → dag-attention-scheduler-UBP4VHTA.js} +2 -2
  233. package/dist/cli/chunks/{detect-FXCOUG6X.js → detect-QWFIQRKI.js} +2 -2
  234. package/dist/cli/chunks/{dist-node-GXQ7FMTY.js → dist-node-I2GICS3W.js} +2 -2
  235. package/dist/cli/chunks/{domain-handler-TI3JBAPC.js → domain-handler-Z66ISB2A.js} +2 -2
  236. package/dist/cli/chunks/{domain-plugins-R7LTUM32.js → domain-plugins-KHMD3FKT.js} +2 -2
  237. package/dist/cli/chunks/{domain-transfer-LBIAFHIQ.js → domain-transfer-JWGNNA6K.js} +2 -2
  238. package/dist/cli/chunks/dream-VQ2PZCVR.js +2 -0
  239. package/dist/cli/chunks/embed-and-insert-pattern-F5P5B6JX.js +3 -0
  240. package/dist/cli/chunks/{embedding-space-HHLWTBF5.js → embedding-space-KHG6TITM.js} +2 -2
  241. package/dist/cli/chunks/{eval-KDOZMAXJ.js → eval-43OHU7EI.js} +2 -2
  242. package/dist/cli/chunks/{experience-capture-middleware-X45PECQN.js → experience-capture-middleware-KXD47H6P.js} +3 -3
  243. package/dist/cli/chunks/{fast-paths-462V6UUB.js → fast-paths-6D75D5KD.js} +2 -2
  244. package/dist/cli/chunks/{feature-flags-NIRQ4YDM.js → feature-flags-IE35Y55N.js} +2 -2
  245. package/dist/cli/chunks/{feature-flags-G66OT3AS.js → feature-flags-OYYHY7LS.js} +2 -2
  246. package/dist/cli/chunks/file-discovery-LGBTY3ID.js +2 -0
  247. package/dist/cli/chunks/{fleet-PXWGB7CU.js → fleet-AGVJMFGD.js} +16 -16
  248. package/dist/cli/chunks/{gnn-wrapper-7MUW3M5M.js → gnn-wrapper-5L66A7LW.js} +2 -2
  249. package/dist/cli/chunks/{heartbeat-handler-5237PB35.js → heartbeat-handler-2BY6YYOT.js} +5 -5
  250. package/dist/cli/chunks/heartbeat-scheduler-3DU3M5AT.js +2 -0
  251. package/dist/cli/chunks/hnsw-adapter-N2IMSRPV.js +2 -0
  252. package/dist/cli/chunks/hnsw-index-DVU7TTJE.js +2 -0
  253. package/dist/cli/chunks/{hnsw-legacy-bridge-OSQPW7JP.js → hnsw-legacy-bridge-RYMWFNAH.js} +2 -2
  254. package/dist/cli/chunks/{hnswlib-node-GX6WG2GB.js → hnswlib-node-GG47HP2P.js} +2 -2
  255. package/dist/cli/chunks/{hooks-GUWHL7VC.js → hooks-FQNACS24.js} +10 -10
  256. package/dist/cli/chunks/hybrid-backend-AS2PNHOD.js +2 -0
  257. package/dist/cli/chunks/{hypergraph-engine-SRWLLCU3.js → hypergraph-engine-6BYNJQEP.js} +2 -2
  258. package/dist/cli/chunks/{hypergraph-handler-AVOPRHHO.js → hypergraph-handler-CYTAXZKJ.js} +3 -3
  259. package/dist/cli/chunks/impact-analyzer-Y4OONLFP.js +2 -0
  260. package/dist/cli/chunks/{init-guard-P4N6EVZS.js → init-guard-METTAV5O.js} +2 -2
  261. package/dist/cli/chunks/{init-handler-LRGWOJMD.js → init-handler-GFT74U5Y.js} +6 -6
  262. package/dist/cli/chunks/init-wizard-HLNUBJQN.js +2 -0
  263. package/dist/cli/chunks/kernel-XKFWCL7Y.js +2 -0
  264. package/dist/cli/chunks/{kilocode-installer-7R2EPOQ6.js → kilocode-installer-GZV2D3FF.js} +2 -2
  265. package/dist/cli/chunks/{kiro-installer-QNM7DPOB.js → kiro-installer-Q4ZXUFC7.js} +2 -2
  266. package/dist/cli/chunks/knowledge-graph-CNL77CSZ.js +2 -0
  267. package/dist/cli/chunks/{learning-7OIZBPXZ.js → learning-WA2QEYL7.js} +35 -34
  268. package/dist/cli/chunks/{llm-router-SIDXES23.js → llm-router-GRTCHWH7.js} +4 -4
  269. package/dist/cli/chunks/llm-router-service-UIYTYKP6.js +2 -0
  270. package/dist/cli/chunks/{load-EI2E2C3S.js → load-WXN3Q7Y5.js} +2 -2
  271. package/dist/cli/chunks/load-test-PXLW4A5B.js +2 -0
  272. package/dist/cli/chunks/{mcp-IOE5WOCS.js → mcp-LIQCPSJN.js} +2 -2
  273. package/dist/cli/chunks/{memory-DLYGJAP7.js → memory-OP6CHRFH.js} +5 -5
  274. package/dist/cli/chunks/memory-backend-XYOSO73Q.js +2 -0
  275. package/dist/cli/chunks/memory-handlers-PQFYVNVG.js +2 -0
  276. package/dist/cli/chunks/{multi-model-executor-WHH4YCHM.js → multi-model-executor-H54DEVRZ.js} +2 -2
  277. package/dist/cli/chunks/{opencode-installer-63FDZAMS.js → opencode-installer-BSQV6UAT.js} +2 -2
  278. package/dist/cli/chunks/{orchestrator-3LA776KK.js → orchestrator-TJDPQ4VL.js} +122 -35
  279. package/dist/cli/chunks/pattern-null-store-BKGTQFNF.js +2 -0
  280. package/dist/cli/chunks/{pattern-usage-recorder-NW54QUGI.js → pattern-usage-recorder-FOVS4M5L.js} +2 -2
  281. package/dist/cli/chunks/{pipeline-P3TYX6J6.js → pipeline-4AY2ZIC6.js} +2 -2
  282. package/dist/cli/chunks/{platform-FNA2WLI6.js → platform-FCSITYMR.js} +2 -2
  283. package/dist/cli/chunks/{plugin-NJS7BC2S.js → plugin-E56TV5S2.js} +2 -2
  284. package/dist/cli/chunks/{prime-radiant-advanced-wasm-NIAVL2OT.js → prime-radiant-advanced-wasm-ACOPC533.js} +2 -2
  285. package/dist/cli/chunks/project-root-MPX7CN2C.js +2 -0
  286. package/dist/cli/chunks/protocol-executor-CRQOCC4A.js +2 -0
  287. package/dist/cli/chunks/{protocol-handler-JU5C4JHY.js → protocol-handler-KRVXF4LS.js} +2 -2
  288. package/dist/cli/chunks/{prove-35VOSLYP.js → prove-KMFPSKGD.js} +2 -2
  289. package/dist/cli/chunks/qe-reasoning-bank-UEGQ3O7F.js +2 -0
  290. package/dist/cli/chunks/{quality-ET74X7HN.js → quality-6DBI3HLB.js} +2 -2
  291. package/dist/cli/chunks/{quality-gate-FEDQISNB.js → quality-gate-3ROZMEIL.js} +3 -3
  292. package/dist/cli/chunks/queen-coordinator-32574XSG.js +2 -0
  293. package/dist/cli/chunks/real-embeddings-MIGZNKK3.js +2 -0
  294. package/dist/cli/chunks/{ref-validation-DTBPYCEB.js → ref-validation-EYIP7DHW.js} +2 -2
  295. package/dist/cli/chunks/{roocode-installer-LYQEMR4J.js → roocode-installer-IGGZHR2Y.js} +2 -2
  296. package/dist/cli/chunks/router-CZJY5WX6.js +2 -0
  297. package/dist/cli/chunks/routing-feedback-RC3UBNFX.js +2 -0
  298. package/dist/cli/chunks/{routing-handler-DJOJFPII.js → routing-handler-BWNHBYDC.js} +2 -2
  299. package/dist/cli/chunks/{ruvector-commands-VXYGJDPW.js → ruvector-commands-PXIHF432.js} +2 -2
  300. package/dist/cli/chunks/rvf-dual-writer-OG7OV2AK.js +2 -0
  301. package/dist/cli/chunks/rvf-migration-adapter-THYMW7ZO.js +2 -0
  302. package/dist/cli/chunks/rvf-migration-coordinator-3H6CLFU7.js +2 -0
  303. package/dist/cli/chunks/rvf-native-adapter-6JQJIKKW.js +2 -0
  304. package/dist/cli/chunks/{rvf-store-integrity-GA2ZYOEG.js → rvf-store-integrity-CVB3NMSL.js} +2 -2
  305. package/dist/cli/chunks/safe-db-QFKCVTIJ.js +2 -0
  306. package/dist/cli/chunks/schedule-6JLVMMYB.js +2 -0
  307. package/dist/cli/chunks/scheduler-3MPZRMJD.js +2 -0
  308. package/dist/cli/chunks/{security-MM6YOECX.js → security-DCRGOTWU.js} +3 -3
  309. package/dist/cli/chunks/{shared-rvf-adapter-6AHPA3V5.js → shared-rvf-adapter-GKD74QUB.js} +2 -2
  310. package/dist/cli/chunks/{shared-rvf-dual-writer-EYAVY2GZ.js → shared-rvf-dual-writer-HVAAVEOH.js} +2 -2
  311. package/dist/cli/chunks/sqlite-persistence-LGTIKAEX.js +2 -0
  312. package/dist/cli/chunks/{standalone-memory-A3PLB4CZ.js → standalone-memory-O7O2U5N4.js} +2 -2
  313. package/dist/cli/chunks/{status-handler-OSSFAP4Z.js → status-handler-BQTPJJTL.js} +2 -2
  314. package/dist/cli/chunks/{structural-health-PGY5XUNO.js → structural-health-4H6J4OHK.js} +2 -2
  315. package/dist/cli/chunks/sync-DJ4TF6QX.js +2 -0
  316. package/dist/cli/chunks/{sync-CWEHYGNN.js → sync-WW5TAVYW.js} +2 -2
  317. package/dist/cli/chunks/{task-handler-LHMQ75W4.js → task-handler-HEM4IEOW.js} +2 -2
  318. package/dist/cli/chunks/{task-handlers-S2TX5FTR.js → task-handlers-JRA3NXIR.js} +3 -3
  319. package/dist/cli/chunks/{test-4EGZZ6NJ.js → test-772ZXVG2.js} +4 -4
  320. package/dist/cli/chunks/test-runner-process-XGF2U3NG.js +2 -0
  321. package/dist/cli/chunks/{test-scheduling-YJQHH3XE.js → test-scheduling-4TRB7LZ7.js} +3 -3
  322. package/dist/cli/chunks/token-bootstrap-CICBIJ7T.js +2 -0
  323. package/dist/cli/chunks/{token-usage-WPNOJR6H.js → token-usage-B7PEKE2G.js} +2 -2
  324. package/dist/cli/chunks/{transformers-4MRPXCPU.js → transformers-V7X7BDZX.js} +2 -2
  325. package/dist/cli/chunks/tree-sitter-wasm-parser-OXPFKFZS.js +2 -0
  326. package/dist/cli/chunks/{types-6P5FB4EB.js → types-AHHTUY3I.js} +2 -2
  327. package/dist/cli/chunks/unified-memory-GUR3IUI6.js +2 -0
  328. package/dist/cli/chunks/unified-memory-hnsw-NJP2F2RY.js +2 -0
  329. package/dist/cli/chunks/unified-persistence-NILBWXDP.js +2 -0
  330. package/dist/cli/chunks/{upgrade-4ICTN63Y.js → upgrade-DZ4DLUQ5.js} +2 -2
  331. package/dist/cli/chunks/{validate-HQF5GZ7L.js → validate-4DTLIDJE.js} +2 -2
  332. package/dist/cli/chunks/{validate-swarm-45JYG7VW.js → validate-swarm-A26UFVIS.js} +2 -2
  333. package/dist/cli/chunks/visual-security-YECYZ27X.js +2 -0
  334. package/dist/cli/chunks/{web-tree-sitter-UOTWZLNH.js → web-tree-sitter-F2C7QRYT.js} +2 -2
  335. package/dist/cli/chunks/{windsurf-installer-WDWSBXGN.js → windsurf-installer-OOBTDA6W.js} +2 -2
  336. package/dist/cli/chunks/{witness-chain-DOYMNPC7.js → witness-chain-KGFZJP32.js} +2 -2
  337. package/dist/cli/chunks/witness-chain-LYBXFLJB.js +2 -0
  338. package/dist/cli/chunks/witness-chain-repair-CNTXOGPN.js +2 -0
  339. package/dist/cli/chunks/{witness-chain-verifier-JB42X62J.js → witness-chain-verifier-OB7ZZOI3.js} +2 -2
  340. package/dist/cli/chunks/{witness-key-manager-LXXO6L2G.js → witness-key-manager-YCKGKGQI.js} +2 -2
  341. package/dist/cli/chunks/{workflow-6ARK47NF.js → workflow-PRERHWKY.js} +4 -4
  342. package/dist/cli/chunks/workflow-orchestrator-UIBGWCU3.js +2 -0
  343. package/dist/cli/chunks/wrappers-L4UY4V63.js +2 -0
  344. package/dist/cli/commands/coverage.js +4 -1
  345. package/dist/cli/commands/learning-prune.js +9 -1
  346. package/dist/cli/handlers/brain-handler.js +32 -2
  347. package/dist/cli/handlers/heartbeat-handler.js +3 -1
  348. package/dist/cli/utils/coverage-data.js +5 -1
  349. package/dist/cli/utils/coverage-verdict.d.ts +10 -2
  350. package/dist/cli/utils/coverage-verdict.js +23 -8
  351. package/dist/cli/utils/fleet-operation.js +9 -3
  352. package/dist/coordination/handlers/code-intelligence-handlers.js +17 -3
  353. package/dist/coordination/handlers/coverage-handlers.js +22 -9
  354. package/dist/coordination/handlers/coverage-target.d.ts +22 -2
  355. package/dist/coordination/handlers/coverage-target.js +45 -9
  356. package/dist/coordination/handlers/handler-utils.d.ts +19 -0
  357. package/dist/coordination/handlers/handler-utils.js +22 -8
  358. package/dist/coordination/protocols/code-intelligence-index.js +6 -3
  359. package/dist/coordination/protocols/learning-consolidation-archive.d.ts +6 -3
  360. package/dist/coordination/protocols/learning-consolidation-archive.js +4 -3
  361. package/dist/coordination/workflow-builtin.js +1 -0
  362. package/dist/domains/defect-intelligence/interfaces.d.ts +2 -0
  363. package/dist/domains/defect-intelligence/prediction-history.d.ts +15 -1
  364. package/dist/domains/defect-intelligence/prediction-history.js +63 -7
  365. package/dist/domains/defect-intelligence/services/defect-predictor.d.ts +1 -0
  366. package/dist/domains/defect-intelligence/services/defect-predictor.js +33 -13
  367. package/dist/domains/learning-optimization/coordinator.js +17 -10
  368. package/dist/domains/learning-optimization/domain-ranking.d.ts +26 -0
  369. package/dist/domains/learning-optimization/domain-ranking.js +28 -0
  370. package/dist/domains/learning-optimization/interfaces.d.ts +5 -0
  371. package/dist/domains/learning-optimization/pattern-archive.d.ts +55 -8
  372. package/dist/domains/learning-optimization/pattern-archive.js +90 -17
  373. package/dist/domains/learning-optimization/pattern-consolidation.js +18 -2
  374. package/dist/domains/learning-optimization/pattern-merge.d.ts +26 -0
  375. package/dist/domains/learning-optimization/pattern-merge.js +127 -0
  376. package/dist/domains/learning-optimization/services/learning-coordinator.js +21 -35
  377. package/dist/domains/test-execution/services/test-executor.js +6 -2
  378. package/dist/init/init-wizard-steps.js +3 -1
  379. package/dist/init/phases/07-hooks.js +97 -10
  380. package/dist/integrations/embeddings/cache/EmbeddingCache.js +1 -1
  381. package/dist/integrations/ruvector/brain-rvf-exporter.d.ts +16 -1
  382. package/dist/integrations/ruvector/brain-rvf-exporter.js +18 -32
  383. package/dist/integrations/ruvector/brain-rvf-richness.d.ts +75 -0
  384. package/dist/integrations/ruvector/brain-rvf-richness.js +127 -0
  385. package/dist/kernel/unified-memory-migration.js +1 -1
  386. package/dist/learning/checkpoint-shrink-ack.d.ts +25 -0
  387. package/dist/learning/checkpoint-shrink-ack.js +57 -0
  388. package/dist/learning/dream/dream-engine.d.ts +44 -3
  389. package/dist/learning/dream/dream-engine.js +6 -2
  390. package/dist/learning/embedder-identity-store.js +3 -1
  391. package/dist/learning/embedding-space-legacy-adoption.d.ts +53 -0
  392. package/dist/learning/embedding-space-legacy-adoption.js +115 -0
  393. package/dist/learning/embedding-space-registry.d.ts +15 -0
  394. package/dist/learning/embedding-space-registry.js +50 -11
  395. package/dist/learning/experience-capture.d.ts +3 -1
  396. package/dist/learning/experience-capture.js +15 -5
  397. package/dist/learning/experience-space-verification.d.ts +2 -0
  398. package/dist/learning/experience-space-verification.js +3 -2
  399. package/dist/learning/learning-retention.js +4 -0
  400. package/dist/learning/pattern-promotion.d.ts +7 -0
  401. package/dist/learning/pattern-promotion.js +64 -12
  402. package/dist/learning/real-embeddings.js +31 -7
  403. package/dist/learning/rvf-pattern-store.js +6 -1
  404. package/dist/mcp/bundle.js +570 -558
  405. package/dist/mcp/handlers/domain-handler-configs.d.ts +3 -0
  406. package/dist/mcp/handlers/domain-handler-configs.js +1 -0
  407. package/dist/mcp/handlers/heartbeat-handlers.d.ts +4 -2
  408. package/dist/mcp/tools/learning-optimization/optimize.d.ts +6 -1
  409. package/dist/mcp/tools/learning-optimization/optimize.js +20 -11
  410. package/dist/planning/goap-planner.js +4 -0
  411. package/dist/planning/plan-executor.js +6 -2
  412. package/dist/shared/git/git-analyzer.d.ts +30 -11
  413. package/dist/shared/git/git-analyzer.js +95 -48
  414. package/dist/shared/io/confined-read.d.ts +32 -7
  415. package/dist/shared/io/confined-read.js +58 -25
  416. package/dist/shared/io/file-reader.js +4 -1
  417. package/dist/shared/safe-db.d.ts +1 -1
  418. package/dist/shared/safe-db.js +20 -5
  419. package/dist/shared/sqlite-journal-mode.d.ts +39 -0
  420. package/dist/shared/sqlite-journal-mode.js +53 -0
  421. package/dist/sync/claude-flow-bridge.js +1 -1
  422. package/dist/sync/readers/sqlite-reader.js +3 -4
  423. package/dist/sync/writers/sqlite-writer.js +1 -1
  424. package/dist/workers/interfaces.d.ts +2 -2
  425. package/dist/workers/quality-daemon/git-watcher.d.ts +8 -0
  426. package/dist/workers/quality-daemon/git-watcher.js +54 -12
  427. package/dist/workers/quality-daemon/index.js +1 -1
  428. package/dist/workers/quality-daemon/priority-queue.d.ts +2 -1
  429. package/dist/workers/workers/defect-predictor.d.ts +9 -4
  430. package/dist/workers/workers/defect-predictor.js +98 -37
  431. package/package.json +1 -1
  432. package/dist/cli/chunks/adapter-OMILP6KH.js +0 -2
  433. package/dist/cli/chunks/aqe-learning-engine-OXH5CCOS.js +0 -2
  434. package/dist/cli/chunks/base-MAK2BLTG.js +0 -2
  435. package/dist/cli/chunks/brain-handler-GCQZFZGQ.js +0 -95
  436. package/dist/cli/chunks/browser-workflow-IR3VF2TL.js +0 -2
  437. package/dist/cli/chunks/chunk-4EJLHNER.js +0 -12
  438. package/dist/cli/chunks/chunk-A4BVDYIL.js +0 -2
  439. package/dist/cli/chunks/chunk-BE7ZHM34.js +0 -3
  440. package/dist/cli/chunks/chunk-DHKSPOUQ.js +0 -16
  441. package/dist/cli/chunks/chunk-FAQ24UHB.js +0 -29
  442. package/dist/cli/chunks/chunk-IOWEBPXJ.js +0 -5
  443. package/dist/cli/chunks/chunk-KB34MTFZ.js +0 -3
  444. package/dist/cli/chunks/chunk-MCXW3DKE.js +0 -8
  445. package/dist/cli/chunks/chunk-O7VJ3VKD.js +0 -2
  446. package/dist/cli/chunks/chunk-PIWGKGWP.js +0 -3
  447. package/dist/cli/chunks/chunk-SFITYZLV.js +0 -7
  448. package/dist/cli/chunks/chunk-TIVKDIF7.js +0 -2
  449. package/dist/cli/chunks/client-NO5FOWT4.js +0 -2
  450. package/dist/cli/chunks/core-handlers-JNAZPXE2.js +0 -2
  451. package/dist/cli/chunks/cross-domain-router-HEBM767Z.js +0 -2
  452. package/dist/cli/chunks/daemon-JEBJGEUK.js +0 -18
  453. package/dist/cli/chunks/dream-GQDCEJMS.js +0 -2
  454. package/dist/cli/chunks/embed-and-insert-pattern-33KLHDD5.js +0 -3
  455. package/dist/cli/chunks/file-discovery-33USPLB5.js +0 -2
  456. package/dist/cli/chunks/heartbeat-scheduler-LIXLC5IH.js +0 -2
  457. package/dist/cli/chunks/hnsw-adapter-62D5UH27.js +0 -2
  458. package/dist/cli/chunks/hnsw-index-GSGUMQQC.js +0 -2
  459. package/dist/cli/chunks/hybrid-backend-FRWP4BOY.js +0 -2
  460. package/dist/cli/chunks/impact-analyzer-7KF3AQXV.js +0 -2
  461. package/dist/cli/chunks/init-wizard-XWWAXY25.js +0 -2
  462. package/dist/cli/chunks/kernel-ZEJPNDBW.js +0 -2
  463. package/dist/cli/chunks/knowledge-graph-RRZQS7KY.js +0 -2
  464. package/dist/cli/chunks/llm-router-service-3OSW67LC.js +0 -2
  465. package/dist/cli/chunks/load-test-7TRIH2WJ.js +0 -2
  466. package/dist/cli/chunks/memory-backend-G7ZW6Q2B.js +0 -2
  467. package/dist/cli/chunks/memory-handlers-TPF3KCO5.js +0 -2
  468. package/dist/cli/chunks/pattern-null-store-OU3ZC3NR.js +0 -2
  469. package/dist/cli/chunks/project-root-GMOFJEKD.js +0 -2
  470. package/dist/cli/chunks/protocol-executor-AD345XRO.js +0 -2
  471. package/dist/cli/chunks/qe-reasoning-bank-NLTP26RC.js +0 -2
  472. package/dist/cli/chunks/queen-coordinator-2TB4FWS6.js +0 -2
  473. package/dist/cli/chunks/real-embeddings-II6CXTCI.js +0 -2
  474. package/dist/cli/chunks/router-PLM3MWME.js +0 -2
  475. package/dist/cli/chunks/routing-feedback-I7VOX2HU.js +0 -2
  476. package/dist/cli/chunks/rvf-dual-writer-GQZHFWO2.js +0 -2
  477. package/dist/cli/chunks/rvf-migration-adapter-3TVKBCAM.js +0 -2
  478. package/dist/cli/chunks/rvf-migration-coordinator-XUHKLMT6.js +0 -2
  479. package/dist/cli/chunks/rvf-native-adapter-5GUTYOWS.js +0 -2
  480. package/dist/cli/chunks/safe-db-RZPQGLGQ.js +0 -2
  481. package/dist/cli/chunks/schedule-G7JMQDUX.js +0 -2
  482. package/dist/cli/chunks/scheduler-4SEGPCKD.js +0 -2
  483. package/dist/cli/chunks/sqlite-persistence-IVE4SQXR.js +0 -2
  484. package/dist/cli/chunks/sync-PM6D7EQF.js +0 -2
  485. package/dist/cli/chunks/test-runner-process-72YACW6M.js +0 -2
  486. package/dist/cli/chunks/token-bootstrap-DJNETMVW.js +0 -2
  487. package/dist/cli/chunks/tree-sitter-wasm-parser-UVWSDXFR.js +0 -2
  488. package/dist/cli/chunks/unified-memory-2VMGSGQL.js +0 -2
  489. package/dist/cli/chunks/unified-memory-hnsw-3KULVD3N.js +0 -2
  490. package/dist/cli/chunks/unified-persistence-QCSLU2SV.js +0 -2
  491. package/dist/cli/chunks/visual-security-ZYP2KPH7.js +0 -2
  492. package/dist/cli/chunks/witness-chain-5QRT7EMX.js +0 -2
  493. package/dist/cli/chunks/witness-chain-repair-CUF2AFQB.js +0 -2
  494. package/dist/cli/chunks/workflow-orchestrator-RYDDWIXN.js +0 -2
  495. package/dist/cli/chunks/wrappers-CYQBOMPL.js +0 -2
@@ -18,6 +18,10 @@
18
18
  * A `defect:predictions` record without
19
19
  * the measured stamp (the invented one written by <= 3.15.6) is ignored and
20
20
  * replaced by the next measured run.
21
+ *
22
+ * #1137: the latest run of every target is reported, so predicting `src/b`
23
+ * after `src/a` keeps `src/a`'s files; a file named by several targets takes
24
+ * its prediction from the newest run that names it.
21
25
  */
22
26
  import * as fs from 'fs';
23
27
  import * as path from 'path';
@@ -85,7 +89,7 @@ export class DefectPredictorWorker extends BaseWorker {
85
89
  context.logger.info('Starting defect prediction analysis');
86
90
  const findings = [];
87
91
  const recommendations = [];
88
- const { measured: latest, unusable } = await this.readLatestPrediction(context);
92
+ const { measured: latest, unusable, estimatedFiles } = await this.readLatestPrediction(context);
89
93
  if (!latest) {
90
94
  findings.push({
91
95
  type: 'defect-prediction-unmeasured',
@@ -106,9 +110,11 @@ export class DefectPredictorWorker extends BaseWorker {
106
110
  return this.createResult(Date.now() - startTime, {
107
111
  itemsAnalyzed: 0,
108
112
  issuesFound: 0,
109
- healthScore: 100,
113
+ // #1137: nothing was measured, so there is no health to report.
114
+ healthScore: null,
110
115
  trend: 'stable',
111
116
  domainMetrics: {
117
+ health: 'unmeasured',
112
118
  filesAnalyzed: 0,
113
119
  highRiskFiles: 0,
114
120
  hotspots: 'unmeasured',
@@ -117,6 +123,13 @@ export class DefectPredictorWorker extends BaseWorker {
117
123
  }, findings, recommendations);
118
124
  }
119
125
  const { predictions } = latest;
126
+ if (latest.ambiguousTargetsSkipped) {
127
+ findings.push({
128
+ type: 'defect-prediction-ambiguous', severity: 'info', domain: 'defect-intelligence',
129
+ title: 'Ambiguous Defect Prediction',
130
+ description: `${latest.ambiguousTargetsSkipped} predicted targets have several latest runs with the same timestamp, so their files are not reported. Run defect_predict on them again to assess.`,
131
+ });
132
+ }
120
133
  if (latest.filesSkipped) {
121
134
  findings.push({
122
135
  type: 'defect-prediction-partial', severity: 'info', domain: 'defect-intelligence',
@@ -124,7 +137,7 @@ export class DefectPredictorWorker extends BaseWorker {
124
137
  description: `${latest.filesSkipped} source files could not be read; risk estimates cover only ${predictions.length} successfully analyzed files.`,
125
138
  });
126
139
  }
127
- this.analyzeHighRiskPredictions(predictions, findings, recommendations, latest.estimated === true);
140
+ this.analyzeHighRiskPredictions(predictions, findings, recommendations, estimatedFiles);
128
141
  await context.memory.set(PREDICTIONS_KEY, latest);
129
142
  await context.memory.set('defect:lastAnalysis', latest.evaluatedAt);
130
143
  const healthScore = this.calculateHealthScore(predictions);
@@ -147,6 +160,7 @@ export class DefectPredictorWorker extends BaseWorker {
147
160
  highRiskFiles: highRisk,
148
161
  missingFilesSkipped: latest.missingFilesSkipped,
149
162
  outsideProjectSkipped: latest.outsideProjectSkipped,
163
+ targetsReported: latest.runs.length,
150
164
  hotspots: 'unmeasured',
151
165
  avgDefectProbability: (predictions.reduce((sum, p) => sum + p.probability, 0) / predictions.length).toFixed(2),
152
166
  },
@@ -168,69 +182,116 @@ export class DefectPredictorWorker extends BaseWorker {
168
182
  });
169
183
  }
170
184
  /**
171
- * #1043: the most recent prediction run the defect-intelligence predictor
185
+ * #1043: the most recent prediction runs the defect-intelligence predictor
172
186
  * recorded, restricted to regular files whose real path is inside the
173
- * project root. `measured` is `null` when there is no such prediction;
174
- * `unusable` describes an ambiguous newest timestamp or a newest prediction
175
- * none of whose files qualify.
187
+ * project root. #1137: the latest run of each target contributes, and a
188
+ * file takes its prediction from the newest run naming it. `measured` is
189
+ * `null` when no file qualifies; `unusable` then describes the newest run
190
+ * (or its ambiguous timestamp).
176
191
  */
177
192
  async readLatestPrediction(context) {
178
193
  const keys = await context.memory.search(PREDICTION_KEY_PATTERN, Number.MAX_SAFE_INTEGER, { namespace: DEFECT_NAMESPACE });
179
194
  const now = Date.now();
180
- let latest = null;
181
- let ambiguous = false;
195
+ const byTarget = new Map();
182
196
  for (const found of keys) {
183
197
  // #1049: the in-memory backend returns `<namespace>:<key>` from a namespaced search.
184
198
  const key = bareSearchKey(found, DEFECT_NAMESPACE, PREDICTION_KEY_PATTERN);
185
199
  const parsed = parsePredictionRecord(await context.memory.get(key, { namespace: DEFECT_NAMESPACE }), now);
186
200
  if (!parsed)
187
201
  continue;
188
- if (!latest || Date.parse(parsed.timestamp) > Date.parse(latest.timestamp)) {
189
- latest = parsed;
190
- ambiguous = false;
202
+ const current = byTarget.get(parsed.target);
203
+ if (!current || Date.parse(parsed.timestamp) > Date.parse(current.run.timestamp)) {
204
+ byTarget.set(parsed.target, { run: parsed, ambiguous: false });
205
+ }
206
+ else if (Date.parse(parsed.timestamp) === Date.parse(current.run.timestamp) && parsed.id !== current.run.id) {
207
+ // Timestamp precision cannot establish ordering between concurrent runs.
208
+ // Never let backend key ordering decide whether the current scan is clean.
209
+ current.ambiguous = true;
210
+ }
211
+ }
212
+ const estimatedFiles = new Set();
213
+ const latestRuns = [...byTarget.values()]
214
+ .sort((a, b) => Date.parse(b.run.timestamp) - Date.parse(a.run.timestamp));
215
+ if (latestRuns.length === 0)
216
+ return { measured: null, unusable: null, estimatedFiles };
217
+ const realRoot = realProjectRoot();
218
+ const claimed = new Set();
219
+ const contributing = [];
220
+ let outside = 0;
221
+ let missing = 0;
222
+ let ambiguousTargets = 0;
223
+ let newestCounts = { outside: 0, missing: 0 };
224
+ for (const [index, { run, ambiguous }] of latestRuns.entries()) {
225
+ if (ambiguous) {
226
+ ambiguousTargets++;
227
+ continue;
191
228
  }
192
- else if (Date.parse(parsed.timestamp) === Date.parse(latest.timestamp) && parsed.id !== latest.id) {
193
- ambiguous = true;
229
+ const disposition = run.predictions.map((p) => classifyPredictedFile(p.file, realRoot));
230
+ const runOutside = disposition.filter((d) => d === 'outside').length;
231
+ const runMissing = disposition.filter((d) => d === 'missing').length;
232
+ outside += runOutside;
233
+ missing += runMissing;
234
+ if (index === 0)
235
+ newestCounts = { outside: runOutside, missing: runMissing };
236
+ if (runOutside > 0) {
237
+ context.logger.warn('Ignoring defect predictions for paths outside the project root', { predictionId: run.id, outside: runOutside });
194
238
  }
239
+ const files = run.predictions.filter((p, i) => {
240
+ if (disposition[i] !== 'inside')
241
+ return false;
242
+ const identity = path.resolve(realRoot, p.file);
243
+ if (claimed.has(identity))
244
+ return false;
245
+ claimed.add(identity);
246
+ return true;
247
+ });
248
+ if (files.length > 0)
249
+ contributing.push({ run, files });
195
250
  }
196
- if (!latest)
197
- return { measured: null, unusable: null };
198
- // Timestamp precision cannot establish ordering between concurrent runs.
199
- // Never let backend key ordering decide whether the current scan is clean.
200
- if (ambiguous)
251
+ if (contributing.length === 0) {
252
+ const newest = latestRuns[0];
253
+ context.logger.info('Latest defect predictions name no file inside the project', { predictionId: newest.run.id });
201
254
  return {
202
255
  measured: null,
203
- unusable: { id: `ambiguous:${latest.timestamp}`, outside: 0, missing: 0, ambiguous: true },
256
+ unusable: newest.ambiguous
257
+ ? { id: `ambiguous:${newest.run.timestamp}`, outside: 0, missing: 0, ambiguous: true }
258
+ : { id: newest.run.id, ...newestCounts },
259
+ estimatedFiles,
204
260
  };
205
- const realRoot = realProjectRoot();
206
- const disposition = latest.predictions.map((p) => classifyPredictedFile(p.file, realRoot));
207
- const existing = latest.predictions.filter((_, i) => disposition[i] === 'inside');
208
- const outside = disposition.filter((d) => d === 'outside').length;
209
- const missing = disposition.filter((d) => d === 'missing').length;
210
- if (outside > 0) {
211
- context.logger.warn('Ignoring defect predictions for paths outside the project root', { predictionId: latest.id, outside });
212
- }
213
- if (existing.length === 0) {
214
- context.logger.info('Latest defect prediction names no file inside the project', { predictionId: latest.id });
215
- return { measured: null, unusable: { id: latest.id, outside, missing } };
216
261
  }
217
- return { unusable: null, measured: {
262
+ const estimatedRuns = contributing.filter(({ run }) => run.estimated);
263
+ for (const { files } of estimatedRuns)
264
+ files.forEach((p) => estimatedFiles.add(p));
265
+ const newest = contributing[0].run;
266
+ return { unusable: null, estimatedFiles, measured: {
218
267
  measured: true,
219
268
  schemaVersion: SCHEMA_VERSION,
220
269
  source: 'defect-intelligence',
221
- predictionId: latest.id,
222
- ...(latest.estimated ? { estimated: true, predictionMethod: latest.predictionMethod, filesSkipped: latest.filesSkipped } : {}),
223
- predictedAt: latest.timestamp,
270
+ predictionId: newest.id,
271
+ ...(estimatedRuns.length > 0 ? {
272
+ estimated: true, predictionMethod: 'static-code-indicators',
273
+ filesSkipped: estimatedRuns.reduce((sum, { run }) => sum + (run.filesSkipped ?? 0), 0),
274
+ } : {}),
275
+ predictedAt: newest.timestamp,
224
276
  evaluatedAt: new Date().toISOString(),
225
- predictions: existing,
277
+ predictions: contributing.flatMap(({ files }) => files),
278
+ runs: contributing.map(({ run, files }) => ({
279
+ predictionId: run.id,
280
+ ...(run.target ? { target: run.target } : {}),
281
+ predictedAt: run.timestamp,
282
+ files: files.length,
283
+ ...(run.estimated ? { estimated: true } : {}),
284
+ })),
226
285
  missingFilesSkipped: missing,
227
286
  outsideProjectSkipped: outside,
287
+ ...(ambiguousTargets > 0 ? { ambiguousTargetsSkipped: ambiguousTargets } : {}),
228
288
  } };
229
289
  }
230
- analyzeHighRiskPredictions(predictions, findings, recommendations, estimated = false) {
290
+ analyzeHighRiskPredictions(predictions, findings, recommendations, estimatedFiles) {
231
291
  const critical = predictions.filter(p => p.riskLevel === 'critical');
232
292
  const high = predictions.filter(p => p.riskLevel === 'high');
233
293
  for (const prediction of [...critical, ...high]) {
294
+ const estimated = estimatedFiles.has(prediction);
234
295
  const name = prediction.file.split(/[\\/]/).pop();
235
296
  findings.push({
236
297
  type: `${prediction.riskLevel}-defect-risk`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-qe",
3
- "version": "3.15.17",
3
+ "version": "3.15.18",
4
4
  "description": "Agentic Quality Engineering V3 - Domain-Driven Design Architecture with 13 Bounded Contexts, O(log n) coverage analysis, ReasoningBank learning, 60 specialized QE agents, mathematical Coherence verification, deep Claude Flow integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,2 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.17");process.exit(0)}
2
- import{a,b,c}from"./chunk-JRIJM4LE.js";import"./chunk-SAZ4PJBR.js";import"./chunk-VQFV2IPV.js";import"./chunk-CMN7PU2H.js";import"./chunk-J7Q5TXFZ.js";import"./chunk-Z7SKUC6P.js";export{a as AgentBoosterAdapter,b as createAgentBoosterAdapter,c as createAgentBoosterAdapterSync};
@@ -1,2 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.17");process.exit(0)}
2
- import{a,b,c,d,e,f}from"./chunk-OO2M2QUV.js";import"./chunk-M2YI5YUR.js";import"./chunk-45223KK6.js";import"./chunk-TDZ6N43D.js";import"./chunk-POPSZDI2.js";import"./chunk-MVVVGQJ6.js";import"./chunk-XFTX3KLE.js";import"./chunk-IKB3M7OF.js";import"./chunk-6LSZCEW2.js";import"./chunk-ERYADKMZ.js";import"./chunk-J3QFJI2Y.js";import"./chunk-SRBCBVSI.js";import"./chunk-7SNSI4VY.js";import"./chunk-4NKZU2JZ.js";import"./chunk-YMUY3TES.js";import"./chunk-XPTCQKVE.js";import"./chunk-ZGV7L4MW.js";import"./chunk-NZJVDOUN.js";import"./chunk-X5QD76IU.js";import"./chunk-IRHXGCQR.js";import"./chunk-CMN7PU2H.js";import"./chunk-YKRLUTK7.js";import"./chunk-COTQ44YO.js";import"./chunk-U5SMBJ6F.js";import"./chunk-LCWEQRZI.js";import"./chunk-2EQK7B5L.js";import"./chunk-YAJOBZE5.js";import"./chunk-4EJLHNER.js";import"./chunk-LRKLATSH.js";import"./chunk-CXCMATZ6.js";import"./chunk-ZP5AWQRO.js";import"./chunk-REY52O7J.js";import"./chunk-BSIWI4ES.js";import"./chunk-TIVKDIF7.js";import"./chunk-DS5IFRY6.js";import"./chunk-5FSPELOG.js";import"./chunk-TWBZONKT.js";import"./chunk-JHKKIJT2.js";import"./chunk-R3KBOQ3O.js";import"./chunk-GPPTRKEM.js";import"./chunk-TM75GAXG.js";import"./chunk-U4S74IIZ.js";import"./chunk-QSQNXBD2.js";import"./chunk-SFITYZLV.js";import"./chunk-J7Q5TXFZ.js";import"./chunk-VLTDW7XJ.js";import"./chunk-Z7SKUC6P.js";export{b as AQELearningEngine,a as DEFAULT_ENGINE_CONFIG,c as DEFAULT_META_LEARNING_CONFIG,d as MetaLearningEngine,e as createAQELearningEngine,f as createDefaultLearningEngine};
@@ -1,2 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.17");process.exit(0)}
2
- import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-AVHYJ3XP.js";import"./chunk-EUWG2JG4.js";import"./chunk-UHJVZEQA.js";import"./chunk-XPTCQKVE.js";import"./chunk-NZJVDOUN.js";import"./chunk-X5QD76IU.js";import"./chunk-IRHXGCQR.js";import"./chunk-CMN7PU2H.js";import"./chunk-YKRLUTK7.js";import"./chunk-COTQ44YO.js";import"./chunk-U5SMBJ6F.js";import"./chunk-LCWEQRZI.js";import"./chunk-2EQK7B5L.js";import"./chunk-YAJOBZE5.js";import"./chunk-LRKLATSH.js";import"./chunk-ZP5AWQRO.js";import"./chunk-BSIWI4ES.js";import"./chunk-TIVKDIF7.js";import"./chunk-DS5IFRY6.js";import"./chunk-5FSPELOG.js";import"./chunk-TWBZONKT.js";import"./chunk-JHKKIJT2.js";import"./chunk-GPPTRKEM.js";import"./chunk-TM75GAXG.js";import"./chunk-SFITYZLV.js";import"./chunk-J7Q5TXFZ.js";import"./chunk-VLTDW7XJ.js";import"./chunk-Z7SKUC6P.js";export{l as MCPToolBase,k as defaultToolLogger,j as getKernel,i as getLLMRouter,e as getMemoryBackend,g as getSharedLLMRouter,c as getSharedMemoryBackend,a as isMemoryOnlyMode,b as registerRvfResetFn,h as resetSharedLLMRouter,d as resetSharedMemoryBackend,f as setSharedLLMRouter};
@@ -1,95 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.17");process.exit(0)}
2
- import{a as P,b as z,c as G,d as C,e as fe,f as U,g as X,h as N,i as me,j as ue,k as Q,l as De,m as K,n as pe,o as Te,p as j,q as Y,r as Z,s as ee,t as ne}from"./chunk-AGCS5GSO.js";import{c as $e}from"./chunk-J3QFJI2Y.js";import{b as Ne}from"./chunk-SRBCBVSI.js";import{a as ke,d as de,e as Ae}from"./chunk-7SNSI4VY.js";import"./chunk-NZJVDOUN.js";import"./chunk-X5QD76IU.js";import"./chunk-IRHXGCQR.js";import{b as $,d as ce}from"./chunk-CMN7PU2H.js";import"./chunk-YKRLUTK7.js";import"./chunk-COTQ44YO.js";import"./chunk-U5SMBJ6F.js";import"./chunk-LCWEQRZI.js";import"./chunk-2EQK7B5L.js";import"./chunk-YAJOBZE5.js";import"./chunk-LRKLATSH.js";import"./chunk-ZP5AWQRO.js";import"./chunk-BSIWI4ES.js";import"./chunk-TIVKDIF7.js";import"./chunk-DS5IFRY6.js";import"./chunk-5FSPELOG.js";import"./chunk-TWBZONKT.js";import"./chunk-JHKKIJT2.js";import"./chunk-GPPTRKEM.js";import"./chunk-TM75GAXG.js";import{a as Ie,b as Oe,c as H,d as W,f as pn}from"./chunk-QSQNXBD2.js";import{d as q,e as gn}from"./chunk-SFITYZLV.js";import"./chunk-J7Q5TXFZ.js";import"./chunk-VLTDW7XJ.js";import"./chunk-Z7SKUC6P.js";import M from"path";import o from"chalk";gn();ce();import{existsSync as re,mkdirSync as yn,writeFileSync as bn,readFileSync as ge}from"fs";import{join as T,resolve as ye}from"path";function te(e,n){let r="shake256",t=JSON.stringify(n),a=e.prepare("SELECT * FROM witness_chain ORDER BY id DESC LIMIT 1").get(),i=a?de(r,Ae(a)):ke;e.prepare(`
3
- INSERT INTO witness_chain
4
- (prev_hash, action_hash, action_type, action_data, timestamp, actor, hash_algo)
5
- VALUES (?, ?, 'BRAIN_IMPORT', ?, ?, 'brain-import', ?)
6
- `).run(i,de(r,t),t,new Date().toISOString(),r)}var hn={rl_q_values:"includeQValues",dream_insights:"includeDreamInsights",dream_cycles:"includeDreamInsights",witness_chain:"includeWitnessChain",vectors:"includeVectors"};function Rn(e,n){let r=hn[e.tableName];return!(r&&n[r]===!1)}var wn=1e4;function vn(e,n,r,t){if(!Rn(n,r))return pe(T(t,n.fileName),[]),{count:0,rows:[]};let[a,i]=n.domainColumn?K(r.domains,n.domainColumn):[void 0,[]];if(r.domains&&r.domains.length>0&&!n.domainColumn){let d=r.domains.map(()=>"?").join(","),c=`manifest_id IN (SELECT id FROM learning_evidence_manifests WHERE task_family IN (${d}))`;["learning_evidence_segments","learning_segment_edges","learning_evidence_admissions"].includes(n.tableName)?(a=c,i=[...r.domains]):["pattern_manifest_lineage","pattern_segment_lineage"].includes(n.tableName)&&(a=`${c} AND pattern_id IN (SELECT id FROM qe_patterns WHERE qe_domain IN (${d}))`,i=[...r.domains,...r.domains])}if(ue(e,n.tableName,a,i)>=wn){let d=n.blobColumns,c=d&&d.length>0?p=>U(p,d):void 0;return{count:Te(T(t,n.fileName),De(e,n.tableName,a,i),c)}}let s=Q(e,n.tableName,a,i);return n.blobColumns&&n.blobColumns.length>0&&(s=s.map(d=>U(d,n.blobColumns))),pe(T(t,n.fileName),s),{count:s.length,rows:s}}function Me(e){let n=[];for(let r of C){let t=T(e,r.fileName);re(t)?n.push(N(ge(t,"utf-8"))):n.push(N(""))}return N(n.join(":"))}function Fe(e,n,r="memory.db"){let t=ye(n.outputPath);re(t)||yn(t,{recursive:!0});let a=0,i={},l=new Set;for(let m of C){let p=vn(e,m,n,t);if(i[m.tableName]=p.count,a+=p.count,m.tableName==="qe_patterns"){if(p.rows)for(let h of p.rows)h.qe_domain&&l.add(h.qe_domain);else if(p.count>0){let[h,B]=m.domainColumn?K(n.domains,m.domainColumn):[void 0,[]],f=`SELECT DISTINCT qe_domain FROM qe_patterns ${h?`WHERE ${h} AND qe_domain IS NOT NULL`:"WHERE qe_domain IS NOT NULL"}`;try{let R=e.prepare(f).all(...B||[]);for(let y of R)l.add(y.qe_domain)}catch{}}}}let s=n.includeVectors!==!1?ue(e,"vectors"):0,d=Me(t),c={version:"3.0",exportedAt:new Date().toISOString(),sourceDb:r,stats:{patternCount:i.qe_patterns||0,vectorCount:s,qValueCount:i.rl_q_values||0,dreamInsightCount:i.dream_insights||0,witnessChainLength:i.witness_chain||0,totalRecords:a},domains:[...l].sort(),checksum:d,tableRecordCounts:i};return bn(T(t,"manifest.json"),JSON.stringify(c,null,2),"utf-8"),c}var Sn=new Set(["qe_patterns","rl_q_values","dream_insights","witness_chain"]);function _n(e){return e==="1.0"?C.filter(n=>Sn.has(n.tableName)):e==="3.0"?C:(console.warn(`[brain-import] Unknown manifest version '${e}'. Attempting full import \u2014 some files may be missing.`),C)}function Le(e,n,r){let t=ye(n),a=T(t,"manifest.json");if(!re(a))throw new Error(`Manifest not found at ${a}`);let i=$(ge(a,"utf-8")),l=Me(t);if(l!==i.checksum)throw new Error(`Checksum mismatch: expected ${i.checksum}, got ${l}. The export may have been tampered with or corrupted.`);let s=_n(i.version),d=0,c=0,m=0,p=()=>{let h=new Map,B=new Map,g=0;for(let f of s){let R=T(t,f.fileName),y=j(R,$);if(f.tableName==="witness_chain"){g+=y.length,c+=y.length;continue}f.blobColumns&&f.blobColumns.length>0&&(y=y.map(b=>X(b,f.blobColumns)));for(let b of y){let k=Y(b,h),w;if(f.dedupColumns&&f.dedupColumns.length>0)w=ee(e,f.tableName,k,f.dedupColumns,f.preserveId);else{let D=P[f.tableName]||"id",u=G[f.tableName],I=z[f.tableName];w=Z(e,f.tableName,k,D,r.mergeStrategy,u,I,h,B,b.pattern_id)}d+=w.imported,c+=w.skipped,m+=w.conflicts}}te(e,{sourceChecksum:i.checksum,sourceWitnessRows:g,importedRecords:d,skippedRecords:c,conflicts:m}),d+=1};return ne(e,r.dryRun??!1,p),{imported:d,skipped:c,conflicts:m}}function qe(e){let n=ye(e),r=T(n,"manifest.json");if(!re(r))throw new Error(`Manifest not found at ${r}`);return $(ge(r,"utf-8"))}pn();import{existsSync as V,readdirSync as En,renameSync as Cn,statSync as xn,unlinkSync as he,writeFileSync as Bn}from"fs";import{basename as In,dirname as On,join as Nn,resolve as ie}from"path";var kn=128*1024*1024,oe="code-intelligence:",Pe=`substr(id, 1, ${oe.length}) = ?`;function An(e,n){if(e!=="vectors")return!1;let r=n.id;return typeof r=="string"&&r.startsWith(oe)}var ae=class extends Error{constructor(r,t,a,i){let l=Object.entries(a).filter(([,s])=>s>=1048576).sort((s,d)=>d[1]-s[1]).slice(0,3).map(([s,d])=>`${s} ${be(d)}`).join(", ");super(`RVF_KERNEL_TOO_LARGE: the brain kernel needs ${i?"":"at least "}${be(r)}, over the ${be(t)} limit of the native RVF writer.`+(l?` Largest tables: ${l}.`:"")+" Nothing was written. Use --format jsonl (no size limit), or reduce the largest learning tables first.");this.kernelBytes=r;this.limitBytes=t;this.tableBytes=a;this.complete=i;this.name="RvfKernelTooLargeError"}kernelBytes;limitBytes;tableBytes;complete;code="RVF_KERNEL_TOO_LARGE"};function be(e){return`${(e/(1024*1024)).toFixed(1)} MB`}var Ve=["",".idmap.json",".manifest.json"],$n=[...Ve,".lock"];function je(e){for(let n of $n)try{let r=`${e}${n}`;V(r)&&he(r)}catch{}}function Dn(e){let n=On(e),r=`${In(e)}.tmp.`,t;try{t=En(n)}catch{return}for(let a of t){if(!a.startsWith(r))continue;let i=Number.parseInt(a.slice(r.length).split(".")[0],10);if(!(!Number.isInteger(i)||i<=0)&&!(i!==process.pid&&Tn(i)))try{he(Nn(n,a))}catch{}}}function Tn(e){try{return process.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function Je(e,n,r="memory.db"){if(!W())throw new Error("@ruvector/rvf-node is not available. Install it or use --format jsonl instead.");let t=ie(n.outputPath),a=n.dimension??384,i=`${t}.tmp.${process.pid}`;Dn(t),je(i);let l=n.maxKernelBytes??kn,s={},d=[],c={},m={},p={},h=new Set,B=0,g=0;for(let u of C){let[I,A]=u.domainColumn?K(n.domains,u.domainColumn):[void 0,[]];if(u.tableName==="vectors"&&me(e,"vectors")){let{n:x}=e.prepare(`SELECT COUNT(*) AS n FROM vectors WHERE ${Pe}`).get(oe);x>0&&(p.vectors=x),I=`(id IS NULL OR NOT ${Pe})`,A=[oe]}let _=Q(e,u.tableName,I,A);if(n.domains&&n.domains.length>0){let x=new Set((s.learning_evidence_manifests??[]).map(v=>v.id)),L=new Set((s.qe_patterns??[]).map(v=>v.id));["learning_evidence_segments","learning_segment_edges","learning_evidence_admissions"].includes(u.tableName)?_=_.filter(v=>x.has(v.manifest_id)):u.tableName==="pattern_manifest_lineage"?_=_.filter(v=>{let S=v;return x.has(S.manifest_id)&&L.has(S.pattern_id)}):u.tableName==="pattern_segment_lineage"&&(_=_.filter(v=>{let S=v;return x.has(S.manifest_id)&&L.has(S.pattern_id)}))}if(u.tableName==="qe_patterns")for(let x of _)x.qe_domain&&h.add(x.qe_domain);let F=fe[u.tableName];F&&F.length>0&&(_=_.map(x=>U(x,F))),(u.tableName==="qe_patterns"||u.tableName==="learning_evidence_manifests")&&(s[u.tableName]=_),m[u.tableName]=_.length,B+=_.length;let J=JSON.stringify(_);if(d.push([u.tableName,J]),c[u.tableName]=Buffer.byteLength(J),g+=c[u.tableName],g>l)throw new ae(g,l,c,!1)}let f=new Date().toISOString(),R=[...h].sort(),y=`{"version":"3.0","format":"rvf","exportedAt":${JSON.stringify(f)},"sourceDb":${JSON.stringify(r)},"domains":${JSON.stringify(R)},"tables":{`+d.map(([u,I])=>`${JSON.stringify(u)}:${I}`).join(",")+"}}";d.length=0;let b=Buffer.from(y);if(b.length>l)throw new ae(b.length,l,c,!0);let k=N(y),w=Ie(i,a),D=!1;try{let u=0,I=[];if(me(e,"qe_pattern_embeddings")){let v=e.prepare("PRAGMA table_info('qe_pattern_embeddings')").all().some(E=>E.name==="space_id"),S=e.prepare(`SELECT pattern_id, embedding, dimension, ${v?"space_id":"NULL"} AS space_id
7
- FROM qe_pattern_embeddings`).all();for(let E of S)E.embedding&&E.dimension===a&&E.space_id&&I.push({id:`pe:${E.pattern_id}`,vector:new Float32Array(E.embedding.buffer,E.embedding.byteOffset,a),metadata:{tableName:"qe_pattern_embeddings",spaceId:E.space_id}})}I.length>0&&(u=w.ingest(I).accepted),w.embedKernel(b);let A=n.sign?w.sign(b)??void 0:void 0,_=A?n.signerKeyId??"default":void 0,F=w.fileId(),J=F?{fileId:F,parentId:w.parentId(),lineageDepth:w.lineageDepth()}:void 0,x=w.status(),L={version:"3.0",format:"rvf",exportedAt:f,sourceDb:r,stats:{patternCount:m.qe_patterns??0,embeddingCount:u,qValueCount:m.rl_q_values??0,dreamInsightCount:m.dream_insights??0,witnessChainLength:m.witness_chain??0,totalRecords:B,tableCounts:m,...Object.keys(p).length>0?{skippedCacheRows:p}:{}},domains:R,checksum:k,rvfStatus:{totalVectors:x.totalVectors,totalSegments:x.totalSegments,fileSizeBytes:x.fileSizeBytes},...A?{signature:A,signerKeyId:_}:{},...J?{lineage:J}:{}};if(A)try{w.freeze()}catch{}if(Bn(`${i}.manifest.json`,JSON.stringify(L,null,2),"utf-8"),w.close(),D=!0,V(t)&&!n.allowOverwriteRicher){let v;try{v=Ue(t,!0)}catch(S){if(Mn(t)||!Fn(S)){let E=S instanceof Error?S.message:String(S);throw new Error(`RVF_MIRROR_INSPECTION_AMBIGUOUS: the existing mirror is readable but its richness could not be established (${E}). Preserve/import it before retrying, or repeat with --force-overwrite-richer after preserving a backup.`)}}if(v){let S=v.stats.tableCounts,E=L.stats.tableCounts,xe=C.map(({tableName:O})=>O).filter(O=>!S||!Number.isSafeInteger(S[O]));if(xe.length>0)throw new Error(`RVF_MIRROR_INSPECTION_AMBIGUOUS: existing mirror lacks trustworthy counts for ${xe.join(", ")}. Preserve/import it before retrying, or repeat with --force-overwrite-richer after preserving a backup.`);let Be=C.map(({tableName:O})=>({tableName:O,existing:S[O],candidate:E[O]})).filter(({existing:O,candidate:le})=>O>le);if(Be.length>0){let O=Be.map(({tableName:le,existing:mn,candidate:un})=>`${le} ${mn} -> ${un}`).join(", ");throw new Error(`RVF_MIRROR_RICHER: refusing to replace richer mirrored tables: ${O}. Restore/import the mirror first, or repeat with --force-overwrite-richer after preserving a backup.`)}}}for(let v of[...Ve].reverse()){let S=`${i}${v}`,E=`${t}${v}`;V(S)?Cn(S,E):V(E)&&he(E)}return L}catch(u){if(!D)try{w.close()}catch{}throw je(i),u}}function Mn(e){let n;try{return n=H(ie(e)),!!n.extractKernel()?.image}catch{return!1}finally{try{n?.close()}catch{}}}function Fn(e){let n=e instanceof Error?e.message:String(e);return/ManifestNotFound|InvalidMagic|ChecksumMismatch|CorruptStore/i.test(n)}var Ln={patterns:"qe_patterns",qValues:"rl_q_values",dreamInsights:"dream_insights",witnessChain:"witness_chain"};function We(e,n,r){if(!W())throw new Error("@ruvector/rvf-node is not available. Install it or use JSONL format.");let t=ie(n);if(!V(t))throw new Error(`RVF file not found: ${t}`);let a=r.dryRun?H(t):Oe(t);try{let i=a.verifyWitness();if(!i.valid&&(i.totalEntries>0||i.errors.length>0)){let g=i.errors.length>0?i.errors.join("; "):"unknown integrity error";throw new Error(`RVF witness verification failed: ${g}`)}let l=a.extractKernel();if(!l||!l.image)throw new Error("No brain data found in RVF file (missing kernel segment)");let s;try{s=JSON.parse(l.image.toString("utf-8"))}catch(g){throw new Error(`Failed to parse brain kernel data as JSON: ${g instanceof Error?g.message:g}`)}let d=0,c=0,m=0,p=0,h={};if(s.tables)Object.assign(h,s.tables);else for(let[g,f]of Object.entries(Ln)){let R=s[g];Array.isArray(R)&&(h[f]=R)}let B=()=>{let g=new Map,f=new Map,R=0;for(let y of C){let b=h[y.tableName];if(!b||!Array.isArray(b))continue;if(y.tableName==="witness_chain"){R+=b.length,c+=b.length;continue}let k=fe[y.tableName];k&&k.length>0&&(b=b.map(w=>X(w,k)));for(let w of b){let D=Y(w,g),u;if(y.dedupColumns&&y.dedupColumns.length>0)u=ee(e,y.tableName,D,y.dedupColumns,y.preserveId);else{let I=P[y.tableName]||"id",A=G[y.tableName],_=z[y.tableName];u=Z(e,y.tableName,D,I,r.mergeStrategy,A,_,g,f,w.pattern_id)}if(u.imported)for(let I of k??[])D[I]instanceof Buffer&&p++;d+=u.imported,c+=u.skipped,m+=u.conflicts}}te(e,{sourceChecksum:N(l.image.toString("utf-8")),sourceWitnessRows:R,importedRecords:d,skippedRecords:c,conflicts:m}),d+=1};if(ne(e,r.dryRun??!1,B),!r.dryRun&&m>0)try{a.compact()}catch{}return{imported:d,skipped:c,conflicts:m,embeddingsRestored:p}}finally{a.close()}}function se(e){return Ue(e,!1)}function Ue(e,n){if(!W())throw new Error("@ruvector/rvf-node is not available.");let r=ie(e);if(!V(r))throw new Error(`RVF file not found: ${r}`);let t=H(r);try{let a=t.extractKernel();if(!a||!a.image)throw new Error("No brain data found in RVF file");let i=a.image.toString("utf-8"),l;try{l=JSON.parse(i)}catch(f){throw new Error(`Failed to parse brain kernel data as JSON: ${f instanceof Error?f.message:f}`)}let s=t.status(),d=xn(r).size,c=l.tables,m=c?c.qe_patterns?.length??0:l.patterns?.length??0,p=c?c.rl_q_values?.length??0:l.qValues?.length??0,h=c?c.dream_insights?.length??0:l.dreamInsights?.length??0,B=c?c.witness_chain?.length??0:l.witnessChain?.length??0,g=c&&typeof c=="object"&&!Array.isArray(c)?Object.fromEntries(Object.entries(c).filter(f=>Array.isArray(f[1])).map(([f,R])=>[f,n?R.filter(y=>!An(f,y)).length:R.length])):void 0;return{version:"3.0",format:"rvf",exportedAt:l.exportedAt??"unknown",sourceDb:l.sourceDb??"unknown",stats:{patternCount:m,embeddingCount:s.totalVectors,qValueCount:p,dreamInsightCount:h,witnessChainLength:B,...g?{tableCounts:g}:{}},domains:l.domains??[],checksum:N(i),rvfStatus:{totalVectors:s.totalVectors,totalSegments:s.totalSegments,fileSizeBytes:d}}}finally{t.close()}}function Re(){return W()}ce();import{existsSync as ve,readFileSync as qn,statSync as Pn}from"fs";import{join as we,resolve as Ke}from"path";function Xe(e,n,r={}){let t=Ke(e),a=Ke(n),i=He(t),l=He(a),s=ze(t,i),d=ze(a,l),c=i==="jsonl"&&l==="jsonl",m=Jn({pathA:t,pathB:a,manifestA:s,manifestB:d,recordLevel:c,tableFilter:r.tableFilter,maxIdsPerBucket:r.maxIdsPerBucket??500}),p=new Set(s.domains),h=new Set(d.domains),B=s.domains.filter(b=>!h.has(b)),g=d.domains.filter(b=>!p.has(b)),f=s.checksum===d.checksum,R=s.version===d.version,y=f&&R&&m.every(b=>b.delta===0&&(b.added?.length??0)===0&&(b.removed?.length??0)===0&&(b.changed?.length??0)===0);return{pathA:t,pathB:a,formatA:i,formatB:l,manifestA:s,manifestB:d,checksumMatch:f,versionMatch:R,identical:y,recordLevel:c,tableDiffs:m,domainsOnlyInA:B,domainsOnlyInB:g}}function He(e){if(!ve(e))throw new Error(`Path not found: ${e}`);if(e.endsWith(".rvf"))return"rvf";if(Pn(e).isFile())throw new Error(`Unsupported brain export: ${e} (expected a .rvf file or a JSONL directory)`);return"jsonl"}function ze(e,n){return n==="rvf"?Vn(e):jn(e)}function jn(e){let n=we(e,"manifest.json");if(!ve(n))throw new Error(`Manifest not found at ${n}`);let r=$(qn(n,"utf-8"));return Qe(r,"jsonl")}function Vn(e){let n=se(e);return Qe(n,"rvf")}function Qe(e,n){return{format:n,version:e.version??"unknown",exportedAt:e.exportedAt??"unknown",sourceDb:e.sourceDb??"unknown",checksum:e.checksum??"",totalRecords:e.stats?.totalRecords??0,domains:e.domains??[],tableRecordCounts:e.tableRecordCounts??{}}}function Jn(e){let n=e.tableFilter?C.filter(t=>t.tableName===e.tableFilter):C;if(e.tableFilter&&n.length===0)throw new Error(`Unknown table: ${e.tableFilter}`);let r=[];for(let t of n){let a=e.manifestA.tableRecordCounts[t.tableName]??0,i=e.manifestB.tableRecordCounts[t.tableName]??0,l=i-a,s,d,c;if(e.recordLevel&&Wn(t)){let m=Un(we(e.pathA,t.fileName),we(e.pathB,t.fileName),t,e.maxIdsPerBucket);s=m.added,d=m.removed,c=m.changed}r.push({tableName:t.tableName,countA:a,countB:i,delta:l,...s!==void 0?{added:s}:{},...d!==void 0?{removed:d}:{},...c!==void 0?{changed:c}:{}})}return r}function Wn(e){return!0}function Un(e,n,r,t){let a=Ge(e,r),i=Ge(n,r),l=[],s=[],d=[];for(let[c,m]of a){let p=i.get(c);if(p===void 0)s.length<t&&s.push(c);else if(p!==m){if(r.dedupColumns&&r.dedupColumns.length>0)continue;d.length<t&&d.push(c)}}for(let c of i.keys())a.has(c)||l.length<t&&l.push(c);return l.sort(),s.sort(),d.sort(),{added:l,removed:s,changed:d}}function Ge(e,n){let r=new Map;if(!ve(e))return r;let t=j(e,$);for(let a of t){let i=Kn(a,n);if(i===void 0)continue;let l=Hn(a);r.set(i,zn(l))}return r}function Kn(e,n){if(n.dedupColumns&&n.dedupColumns.length>0){let a=[];for(let i of n.dedupColumns){let l=e[i];if(l==null)return;a.push(String(l))}return a.join("")}let r=P[n.tableName]??"id",t=e[r];if(t!=null)return String(t)}function Hn(e){let n=Object.keys(e).sort(),r={};for(let t of n)r[t]=e[t];return JSON.stringify(r)}function zn(e){return N(e)}ce();import{existsSync as Se,statSync as Gn}from"fs";import{join as Ye,resolve as Xn}from"path";var Qn=20,Yn="qe_patterns";function Ze(e,n={}){let r=Xn(e);nt(r);let t=n.table??Yn,a=C.find(R=>R.tableName===t);if(!a)throw new Error(`Unknown table: ${t}`);let i=Ye(r,a.fileName);if(!Se(i))throw new Error(`Table file not found: ${a.fileName} (expected in ${r}). Was this export generated with --format jsonl?`);let l=j(i,$),s=a.domainColumn,d=Math.max(1,n.limit??Qn),c=n.query?n.query.toLowerCase():void 0,m=n.domains&&n.domains.length>0?new Set(n.domains):void 0,p=n.since,h=n.until,B=n.patternType,g=0,f=[];for(let R of l)Zn(R,{domainColumn:s,domains:m,patternType:B,since:p,until:h,queryLower:c})&&(g++,f.length<d&&f.push(et(R,a.tableName,s)));return{table:t,inputPath:r,totalScanned:l.length,totalMatched:g,limit:d,hits:f,truncated:g>d}}function Zn(e,n){if(n.domains){if(!n.domainColumn)return!1;let r=e[n.domainColumn];if(typeof r!="string"||!n.domains.has(r))return!1}if(n.patternType!==void 0&&e.pattern_type!==n.patternType)return!1;if(n.since!==void 0||n.until!==void 0){let r=en(e);if(r===void 0||n.since!==void 0&&r<n.since||n.until!==void 0&&r>n.until)return!1}if(n.queryLower!==void 0){let r=typeof e.name=="string"?e.name.toLowerCase():"",t=typeof e.description=="string"?e.description.toLowerCase():"";if(!r.includes(n.queryLower)&&!t.includes(n.queryLower))return!1}return!0}function en(e){for(let n of["updated_at","created_at","timestamp"]){let r=e[n];if(typeof r=="string"&&r.length>0)return r}}function et(e,n,r){let t=(typeof e.id=="string"||typeof e.id=="number"?String(e.id):void 0)??`${n}:?`,a={name:typeof e.name=="string"?e.name:void 0,description:typeof e.description=="string"?e.description:void 0,domain:r&&typeof e[r]=="string"?e[r]:void 0,patternType:typeof e.pattern_type=="string"?e.pattern_type:void 0,confidence:typeof e.confidence=="number"?e.confidence:void 0,updatedAt:en(e)};return{id:t,display:a,row:e}}function nt(e){if(!Se(e))throw new Error(`Path not found: ${e}`);if(Gn(e).isFile())throw e.endsWith(".rvf")?new Error("Brain search does not support RVF exports. Re-export with --format jsonl, or use `aqe brain info` for RVF summaries."):new Error(`Unsupported brain export: ${e} (expected a JSONL directory)`);let r=Ye(e,"manifest.json");if(!Se(r))throw new Error(`Manifest not found at ${r}. Is this a brain export directory?`)}function nn(e,n){if(!e.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_patterns'").get())return{created:0,skipped:0};e.exec(`
8
- CREATE TEMP TABLE IF NOT EXISTS _covered_patterns (
9
- pattern_id TEXT PRIMARY KEY
10
- )
11
- `),e.exec("DELETE FROM _covered_patterns"),e.exec(`
12
- INSERT INTO _covered_patterns (pattern_id)
13
- SELECT DISTINCT json_extract(action_data, '$.patternId')
14
- FROM witness_chain
15
- WHERE action_type = 'PATTERN_CREATE'
16
- AND json_extract(action_data, '$.patternId') IS NOT NULL
17
- `),e.exec(`
18
- INSERT OR IGNORE INTO _covered_patterns (pattern_id)
19
- SELECT DISTINCT json_extract(action_data, '$.pattern_id')
20
- FROM witness_chain
21
- WHERE action_type = 'PATTERN_CREATE'
22
- AND json_extract(action_data, '$.pattern_id') IS NOT NULL
23
- `);let t=e.prepare(`SELECT p.id, p.pattern_type, p.qe_domain, p.name, p.created_at
24
- FROM qe_patterns p
25
- LEFT JOIN _covered_patterns c ON p.id = c.pattern_id
26
- WHERE c.pattern_id IS NULL
27
- ORDER BY p.created_at ASC`).all(),i=e.prepare("SELECT COUNT(*) as count FROM qe_patterns").get().count-t.length,l=0;for(let s of t)n.append("PATTERN_CREATE",{patternId:s.id,patternType:s.pattern_type,qeDomain:s.qe_domain,name:s.name,originalCreatedAt:s.created_at,backfilled:!0},"system:backfill"),l++;return e.exec("DROP TABLE IF EXISTS _covered_patterns"),{created:l,skipped:i}}async function tn(e,n){if(tt(n.format)==="rvf"){let a=q(e,{readonly:!0});try{return Je(a,{outputPath:n.outputPath,domains:n.domains,allowOverwriteRicher:n.allowOverwriteRicher},e)}finally{a.close()}}let t=q(e,{readonly:!0});try{return Fe(t,n,e)}finally{t.close()}}async function rn(e,n,r){if(cn(n,r.format)==="rvf"){let i=q(e);try{return We(i,n,{mergeStrategy:r.mergeStrategy,dryRun:r.dryRun})}finally{i.close()}}let a=q(e);try{return Le(a,n,r)}finally{a.close()}}async function on(e,n){return cn(e,n)==="rvf"?se(e):qe(e)}async function an(e,n,r={}){return Xe(e,n,r)}async function sn(e,n={}){return Ze(e,n)}async function ln(e){let n=q(e);try{let r=$e(n,Ne());return await r.initialize(),nn(n,r)}finally{n.close()}}function tt(e){if(e==="jsonl")return"jsonl";if(e==="rvf"){if(!Re())throw new Error("RVF format requested but @ruvector/rvf-node is not available on this platform. Use --format jsonl instead.");return"rvf"}return Re()?"rvf":"jsonl"}function cn(e,n){return n==="rvf"?"rvf":n==="jsonl"?"jsonl":e.endsWith(".rvf")?"rvf":"jsonl"}var Ce=class{name="brain";description="Export, import, and inspect QE brain state";cleanupAndExit;ensureInitialized;constructor(n,r){this.cleanupAndExit=n,this.ensureInitialized=r}register(n,r){let t=n.command("brain").description(this.description);t.command("export").description("Export brain state to a portable directory").requiredOption("-o, --output <path>","Output directory path").option("--format <format>","Export format: rvf (default) or jsonl","rvf").option("--db <path>","Source database path").option("--force-overwrite-richer","Allow replacing an existing RVF with fewer patterns",!1).action(async a=>{await this.executeExport(a)}),t.command("import").description("Import brain state from an export directory").requiredOption("-i, --input <path>","Path to brain export directory").option("--strategy <strategy>","Merge strategy","skip-conflicts").option("--dry-run","Preview import without writing",!1).option("--db <path>","Target database path").action(async a=>{await this.executeImport(a)}),t.command("info").description("Show manifest info for a brain export").requiredOption("-i, --input <path>","Path to brain export directory").action(async a=>{await this.executeInfo(a)}),t.command("witness-backfill").description("Create witness chain entries for patterns that predate the witness chain").option("--db <path>","Database path").action(async a=>{await this.executeWitnessBackfill(a)}),t.command("diff").description("Compare two brain exports (JSONL directory or .rvf file)").argument("<a>","Path to first brain export").argument("<b>","Path to second brain export").option("--table <name>","Restrict comparison to a single table").option("--verbose","Show the IDs of added/removed/changed records",!1).option("--json","Emit the diff as JSON to stdout",!1).action(async(a,i,l)=>{await this.executeDiff(a,i,l)}),t.command("search").description("Search a JSONL brain export with filters").requiredOption("-i, --input <path>","Path to brain export directory (JSONL)").option("--table <name>","Table to search (default: qe_patterns)").option("--domain <name...>","Restrict to one or more domains").option("--pattern-type <type>","Restrict to a specific pattern_type (qe_patterns only)").option("--since <iso>","Include rows with timestamp \u2265 <iso>").option("--until <iso>","Include rows with timestamp \u2264 <iso>").option("-q, --query <text>","Substring match across name + description (case-insensitive)").option("-l, --limit <n>","Maximum results to return","20").option("--json","Emit results as JSON to stdout",!1).action(async a=>{await this.executeSearch(a)})}async executeExport(n){try{console.log(o.blue(`
28
- Exporting brain state (format: ${n.format})...
29
- `));let r=await _e(n.db),t=await tn(r,{outputPath:M.resolve(n.output),format:n.format,allowOverwriteRicher:n.forceOverwriteRicher});if(console.log(o.green(" Export complete.")),console.log(` Format: ${o.cyan("format"in t?t.format??"jsonl":"jsonl")}`),console.log(` Patterns: ${o.cyan(t.stats.patternCount)}`),"embeddingCount"in t.stats?console.log(` Vectors: ${o.cyan(t.stats.embeddingCount)}`):"vectorCount"in t.stats&&console.log(` Vectors: ${o.cyan(t.stats.vectorCount)}`),"rvfStatus"in t){let i=t.rvfStatus;console.log(` RVF Size: ${o.cyan(dn(i.fileSizeBytes))}`),console.log(` Segments: ${o.cyan(i.totalSegments)}`)}let a=t.stats.skippedCacheRows?.vectors;a&&console.log(` Skipped: ${o.gray(`${a} code-index vectors (regenerable: aqe code index <path>)`)}`),console.log(` Checksum: ${o.gray(t.checksum)}`),console.log(` Output: ${o.cyan(M.resolve(n.output))}`),console.log(""),await this.cleanupAndExit(0)}catch(r){r?.code==="RVF_KERNEL_TOO_LARGE"?console.error(o.red(`
30
- Brain export failed:`),r.message):console.error(o.red(`
31
- Brain export failed:`),r),await this.cleanupAndExit(1)}}async executeImport(n){try{n.dryRun?console.log(o.yellow(`
32
- Dry-run mode \u2014 no data will be written.
33
- `)):console.log(o.blue(`
34
- Importing brain state...
35
- `));let r=await _e(n.db),t=await rn(r,M.resolve(n.input),{mergeStrategy:n.strategy,dryRun:n.dryRun});console.log(o.green(" Import complete.")),console.log(` Imported: ${o.cyan(t.imported)}`),console.log(` Skipped: ${o.yellow(t.skipped)}`),console.log(` Conflicts: ${o.red(t.conflicts)}`),"embeddingsRestored"in t&&console.log(` Embeddings: ${o.cyan(t.embeddingsRestored)}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
36
- Brain import failed:`),r),await this.cleanupAndExit(1)}}async executeInfo(n){try{console.log(o.blue(`
37
- Brain Export Info
38
- `));let r=M.resolve(n.input),t=await on(r),a="format"in t?t.format??"jsonl":"jsonl";if(console.log(` Version: ${o.cyan(t.version)}`),console.log(` Format: ${o.cyan(a)}`),console.log(` Exported: ${o.cyan(t.exportedAt)}`),console.log(` Source DB: ${o.cyan(t.sourceDb)}`),console.log(o.blue(`
39
- Learning Data:`)),console.log(` Patterns: ${o.cyan(t.stats.patternCount)}`),"qValueCount"in t.stats&&console.log(` Q-Values: ${o.cyan(t.stats.qValueCount)}`),"dreamInsightCount"in t.stats){let s=t.stats.dreamInsightCount,c=("tableRecordCounts"in t?t.tableRecordCounts:void 0)?.dream_cycles,m=c!==void 0?` (${c} cycles)`:"";console.log(` Dream Insights: ${o.cyan(s)}${o.gray(m)}`)}"witnessChainLength"in t.stats&&console.log(` Witness Chain: ${o.cyan(t.stats.witnessChainLength)} entries`),"embeddingCount"in t.stats?console.log(` Embeddings: ${o.cyan(t.stats.embeddingCount)}`):"vectorCount"in t.stats&&console.log(` Vectors: ${o.cyan(t.stats.vectorCount)}`);let i="tableRecordCounts"in t?t.tableRecordCounts:void 0;if(i){let s=Object.entries(i).filter(([d,c])=>c>0&&!["qe_patterns","rl_q_values","dream_insights","dream_cycles","witness_chain","vectors","qe_pattern_embeddings"].includes(d));if(s.length>0)for(let[d,c]of s){let p=`${d.replace(/_/g," ").replace(/\b\w/g,h=>h.toUpperCase())}:`.padEnd(15);console.log(` ${p}${o.cyan(c)}`)}}let l="totalRecords"in t.stats?t.stats.totalRecords:void 0;if(l!==void 0&&(console.log(o.blue(`
40
- Summary:`)),console.log(` Total Records: ${o.cyan(l)}`)),"domains"in t&&Array.isArray(t.domains)&&t.domains.length>0&&(l||console.log(o.blue(`
41
- Summary:`)),console.log(` Domains: ${o.cyan(t.domains.join(", "))}`)),"rvfStatus"in t){let s=t.rvfStatus;console.log(o.blue(`
42
- RVF Details:`)),console.log(` File Size: ${o.cyan(dn(s.fileSizeBytes))}`),console.log(` Vectors: ${o.cyan(s.totalVectors)}`),console.log(` Segments: ${o.cyan(s.totalSegments)}`)}if("lineage"in t){let s=t.lineage;s&&(console.log(o.blue(`
43
- Lineage:`)),console.log(` File ID: ${o.cyan(s.fileId)}`),console.log(` Parent ID: ${o.cyan(s.parentId??"none (root)")}`),console.log(` Depth: ${o.cyan(s.lineageDepth)}`))}if("signature"in t){let s=t.signature,d=t.signerKeyId;console.log(o.blue(`
44
- Signature:`)),s?(console.log(` Status: ${o.green("Signed")}`),console.log(` Key ID: ${o.cyan(d??"unknown")}`),console.log(` Signature: ${o.gray(s.slice(0,32)+"...")}`)):console.log(` Status: ${o.yellow("Unsigned")}`)}console.log(`
45
- Checksum: ${o.gray(t.checksum)}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
46
- Failed to read brain info:`),r),await this.cleanupAndExit(1)}}async executeDiff(n,r,t){try{let a=await an(M.resolve(n),M.resolve(r),{tableFilter:t.table});if(t.json){process.stdout.write(JSON.stringify(a,null,2)+`
47
- `),await this.cleanupAndExit(a.identical?0:1);return}at(a,t.verbose),await this.cleanupAndExit(a.identical?0:1)}catch(a){console.error(o.red(`
48
- Brain diff failed:`),a),await this.cleanupAndExit(2)}}async executeSearch(n){try{let r=rt(n.limit),t=ot(n.domain),a=await sn(M.resolve(n.input),{table:n.table,domains:t,patternType:n.patternType,since:n.since,until:n.until,query:n.query,limit:r});if(n.json){process.stdout.write(JSON.stringify(a,null,2)+`
49
- `),await this.cleanupAndExit(a.totalMatched>0?0:3);return}lt(a),await this.cleanupAndExit(a.totalMatched>0?0:3)}catch(r){console.error(o.red(`
50
- Brain search failed:`),r),await this.cleanupAndExit(2)}}async executeWitnessBackfill(n){try{console.log(o.blue(`
51
- Running witness chain backfill...
52
- `));let r=await _e(n.db),t=await ln(r);console.log(o.green(" Backfill complete.")),console.log(` Created: ${o.cyan(t.created)} new witness entries`),console.log(` Skipped: ${o.cyan(t.skipped)} (already witnessed)`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
53
- Witness backfill failed:`),r),await this.cleanupAndExit(1)}}getHelp(){return`
54
- Export, import, and inspect QE brain state.
55
-
56
- Formats:
57
- rvf \u2014 Single portable .rvf file (default, requires @ruvector/rvf-node)
58
- jsonl \u2014 JSONL directory format (fallback when native not available)
59
-
60
- Usage:
61
- aqe brain export -o brain.rvf [--format rvf] [--db <path>]
62
- aqe brain export -o ./brain-dir --format jsonl [--db <path>]
63
- aqe brain import -i brain.rvf [--strategy skip-conflicts] [--dry-run] [--db <path>]
64
- aqe brain info -i brain.rvf
65
-
66
- Subcommands:
67
- export Export brain state to a portable .rvf file or JSONL directory
68
- import Import a brain export into the local database
69
- info Show manifest metadata for an existing brain export
70
- diff Compare two brain exports (manifest always; record-level for JSONL)
71
- search Filtered search over a JSONL brain export
72
-
73
- Examples:
74
- aqe brain export -o .agentic-qe/brain.rvf
75
- aqe brain export -o .agentic-qe/brain.rvf --format rvf
76
- aqe brain export -o ./brain-export --format jsonl
77
- aqe brain import -i .agentic-qe/brain.rvf --strategy latest-wins
78
- aqe brain import -i .agentic-qe/brain.rvf --dry-run
79
- aqe brain info -i .agentic-qe/brain.rvf
80
- aqe brain diff ./brain-a ./brain-b --verbose
81
- aqe brain search -i ./brain-export --query oauth --domain test-generation
82
- aqe brain search -i ./brain-export --since 2026-03-01 --limit 50 --json
83
- `}};async function _e(e){if(e)return e;let{findProjectRoot:n}=await import("./unified-memory-2VMGSGQL.js");return M.join(n(),".agentic-qe","memory.db")}function dn(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function rt(e){let n=Number.parseInt(e,10);return!Number.isFinite(n)||n<1?20:n}function ot(e){if(e===void 0)return;let n=Array.isArray(e)?e:[e],r=[];for(let t of n)for(let a of t.split(",")){let i=a.trim();i&&r.push(i)}return r.length>0?r:void 0}function at(e,n){console.log(o.blue(`
84
- Brain Diff
85
- `)),console.log(` A: ${o.cyan(e.pathA)} (${e.formatA})`),console.log(` B: ${o.cyan(e.pathB)} (${e.formatB})`),console.log(` Versions: ${o.cyan(e.manifestA.version)} \u2192 ${o.cyan(e.manifestB.version)}`+(e.versionMatch?o.gray(" (match)"):o.yellow(" (differ)"))),console.log(` Checksums: ${o.gray(e.manifestA.checksum.slice(0,12))}\u2026 \u2192 ${o.gray(e.manifestB.checksum.slice(0,12))}\u2026`+(e.checksumMatch?o.gray(" (match)"):o.yellow(" (differ)"))),console.log(` Exported: ${o.gray(e.manifestA.exportedAt)} \u2192 ${o.gray(e.manifestB.exportedAt)}`),console.log(` Records: ${o.cyan(e.manifestA.totalRecords)} \u2192 ${o.cyan(e.manifestB.totalRecords)} `+fn(e.manifestB.totalRecords-e.manifestA.totalRecords)),(e.domainsOnlyInA.length>0||e.domainsOnlyInB.length>0)&&(console.log(o.blue(`
86
- Domains:`)),e.domainsOnlyInA.length>0&&console.log(` Only in A: ${o.yellow(e.domainsOnlyInA.join(", "))}`),e.domainsOnlyInB.length>0&&console.log(` Only in B: ${o.yellow(e.domainsOnlyInB.join(", "))}`)),e.recordLevel||console.log(o.gray(`
87
- Note: record-level diff is only available when both sides are JSONL exports.
88
- Per-table counts shown below; re-export with --format jsonl for added/removed/changed IDs.`)),console.log(o.blue(`
89
- Tables:`));let r=e.tableDiffs.filter(it);if(r.length===0)console.log(o.gray(" (no differences)"));else for(let t of r)console.log(` ${t.tableName.padEnd(28)} ${o.cyan(String(t.countA).padStart(7))} \u2192 ${o.cyan(String(t.countB).padStart(7))} ${fn(t.delta)}`+st(t,n)),n&&(t.added&&t.added.length>0&&Ee("added",t.added),t.removed&&t.removed.length>0&&Ee("removed",t.removed),t.changed&&t.changed.length>0&&Ee("changed",t.changed));console.log(""),e.identical?console.log(o.green(` Result: identical
90
- `)):console.log(o.yellow(` Result: differences found
91
- `))}function it(e){return!!(e.delta!==0||e.added&&e.added.length>0||e.removed&&e.removed.length>0||e.changed&&e.changed.length>0)}function fn(e){return e===0?o.gray("(\xB10)"):e>0?o.green(`(+${e})`):o.red(`(${e})`)}function st(e,n){let r=[];return e.added&&e.added.length>0&&r.push(o.green(`+${e.added.length}`)),e.removed&&e.removed.length>0&&r.push(o.red(`-${e.removed.length}`)),e.changed&&e.changed.length>0&&r.push(o.yellow(`~${e.changed.length}`)),r.length===0?"":n?" "+r.join(" "):" "+o.gray("[")+r.join(" ")+o.gray("]")}function Ee(e,n){let r=n.slice(0,10).join(", "),t=n.length>10?o.gray(` \u2026(+${n.length-10} more)`):"";console.log(` ${o.gray(e+":")} ${r}${t}`)}function lt(e){if(console.log(o.blue(`
92
- Brain Search
93
- `)),console.log(` Input: ${o.cyan(e.inputPath)}`),console.log(` Table: ${o.cyan(e.table)}`),console.log(` Scanned: ${o.cyan(e.totalScanned)} Matched: ${o.cyan(e.totalMatched)} Shown: ${o.cyan(e.hits.length)}`+(e.truncated?o.yellow(` (truncated to limit ${e.limit})`):"")),e.hits.length===0){console.log(o.yellow(`
94
- No matching rows.
95
- `));return}console.log("");for(let n of e.hits){let r=o.cyan(n.id)+(n.display.patternType?o.gray(` ${n.display.patternType}`):"")+(n.display.domain?o.gray(` [${n.display.domain}]`):"")+(n.display.confidence!==void 0?o.gray(` conf=${n.display.confidence.toFixed(2)}`):"");if(console.log(` ${r}`),n.display.name&&console.log(` ${o.bold(n.display.name)}`),n.display.description){let t=n.display.description.length>200?n.display.description.slice(0,200)+"\u2026":n.display.description;console.log(` ${o.gray(t)}`)}n.display.updatedAt&&console.log(` ${o.gray(n.display.updatedAt)}`),console.log("")}}function Ht(e,n){return new Ce(e,n)}export{Ce as BrainHandler,Ht as createBrainHandler};
@@ -1,2 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.17");process.exit(0)}
2
- import{a}from"./chunk-ZAQMRFBB.js";import"./chunk-AVHYJ3XP.js";import"./chunk-EUWG2JG4.js";import"./chunk-UHJVZEQA.js";import"./chunk-XPTCQKVE.js";import"./chunk-NZJVDOUN.js";import"./chunk-X5QD76IU.js";import"./chunk-IRHXGCQR.js";import"./chunk-CMN7PU2H.js";import"./chunk-YKRLUTK7.js";import"./chunk-COTQ44YO.js";import"./chunk-U5SMBJ6F.js";import"./chunk-LCWEQRZI.js";import"./chunk-2EQK7B5L.js";import"./chunk-YAJOBZE5.js";import"./chunk-LRKLATSH.js";import"./chunk-ZP5AWQRO.js";import"./chunk-BSIWI4ES.js";import"./chunk-TIVKDIF7.js";import"./chunk-DS5IFRY6.js";import"./chunk-5FSPELOG.js";import"./chunk-TWBZONKT.js";import"./chunk-JHKKIJT2.js";import"./chunk-GPPTRKEM.js";import"./chunk-TM75GAXG.js";import"./chunk-SFITYZLV.js";import"./chunk-J7Q5TXFZ.js";import"./chunk-VLTDW7XJ.js";import"./chunk-Z7SKUC6P.js";export{a as BrowserWorkflowTool};
@@ -1,12 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.17");process.exit(0)}
2
- import{c as ne,d as Se}from"./chunk-LRKLATSH.js";import{a as H,b as F,d as re,e as G}from"./chunk-CXCMATZ6.js";import{a as O,b as ie,d as W}from"./chunk-ZP5AWQRO.js";import{c as L,d as Ie}from"./chunk-GPPTRKEM.js";import{a as x,e as te}from"./chunk-J7Q5TXFZ.js";W();te();W();import*as _ from"node:http";import*as q from"node:https";import{createHash as Te}from"node:crypto";import{URL as oe}from"node:url";var D={model:"Xenova/all-MiniLM-L6-v2",expectedDim:384,connectTimeoutMs:5e3,requestTimeoutMs:3e4,failureThreshold:3,failureWindowMs:6e4},X="AQE embedder endpoint identity canary v1",Re=X,xe="/v1/embeddings";function se(n){if(n.startsWith("unix:"))return n;try{let e=new oe(n);return e.username||e.password?(e.username="",e.password="",e.toString().replace(/\/$/,"")):n}catch{return n}}function Ae(n){if(n.startsWith("unix:")){let i=n.slice(5);if(!i.startsWith("/"))throw new Error(`unix endpoint must be an absolute path: ${n}`);return{transport:"unix",socketPath:i,safeUrl:n}}let e=new oe(n);if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`unsupported embedder endpoint protocol: ${e.protocol}`);return(e.username||e.password)&&(console.warn("[EmbedderEndpointClient] endpoint URL contained userinfo; stripping. Use AQE_EMBEDDER_TOKEN env var for credentials."),e.username="",e.password=""),{transport:e.protocol==="https:"?"https":"http",host:e.hostname,port:e.port?Number(e.port):e.protocol==="https:"?443:80,protocol:e.protocol,safeUrl:e.toString().replace(/\/$/,"")}}var M=class extends Error{constructor(t,i){super(`[EmbedderEndpointClient] ${t} timeout after ${i}ms`);this.phase=t;this.limitMs=i;this.name="EmbedderEndpointTimeoutError"}phase;limitMs},j=class extends Error{constructor(t,i){super(`[EmbedderEndpointClient] endpoint identity changed since this process bound to it (fingerprint ${t.fingerprint} -> ${i.fingerprint}, dim ${t.dim} -> ${i.dim}) at ${i.endpoint}; restart to use the new embedding space`);this.bound=t;this.current=i;this.name="EmbedderEndpointIdentityChangedError"}bound;current},K=class{constructor(e,t,i=()=>{},o=()=>{}){this.threshold=e;this.windowMs=t;this.onRecover=i;this.onTrip=o}threshold;windowMs;onRecover;onTrip;failures=[];trippedAt=null;recordSuccess(){this.failures=[],this.trippedAt=null}recordFailure(e=!1){if(this.trippedAt!==null)return;let t=Date.now();this.failures=this.failures.filter(i=>t-i<this.windowMs),this.failures.push(t),(e||this.failures.length>=this.threshold)&&this.trip()}isOpen(){return this.trippedAt===null?!1:Date.now()-this.trippedAt>=this.windowMs?(this.failures=[],this.trippedAt=null,this.onRecover(),!1):!0}trip(){this.trippedAt=Date.now(),this.onTrip()}getState(){return{open:this.isOpen(),failures:this.failures.length,trippedAt:this.trippedAt}}};function Ce(n,e){return n.fingerprint===e.fingerprint&&n.dim===e.dim}var z=class{parsed;agent;breaker;opts;cachedIdentity=null;boundIdentity=null;boundCanary=null;identityChange=null;probeInFlight=null;trialPending=!1;inFlight=new Set;constructor(e){if(this.opts={endpoint:e.endpoint,token:e.token,model:e.model??D.model,expectedDim:e.expectedDim??D.expectedDim,connectTimeoutMs:e.connectTimeoutMs??D.connectTimeoutMs,requestTimeoutMs:e.requestTimeoutMs??D.requestTimeoutMs,failureThreshold:e.failureThreshold??D.failureThreshold,failureWindowMs:e.failureWindowMs??D.failureWindowMs,tlsOptions:e.tlsOptions},this.parsed=Ae(e.endpoint),this.parsed.transport==="https"){let t=e.tlsOptions??{};this.agent=new q.Agent({keepAlive:!0,ca:t.ca,cert:t.cert,key:t.key,rejectUnauthorized:t.rejectUnauthorized!==!1,servername:t.servername})}else this.agent=new _.Agent({keepAlive:!0});this.breaker=new K(this.opts.failureThreshold,this.opts.failureWindowMs,()=>{this.cachedIdentity=null,this.trialPending=!0},()=>this.abandonInFlight())}abandonInFlight(){if(this.inFlight.size===0)return;let e=new Error(`[EmbedderEndpointClient] circuit breaker opened for ${this.parsed.safeUrl} \u2014 request abandoned`);for(let t of[...this.inFlight])t(e)}needsTrial(){return this.breaker.isOpen()||this.trialPending}startTrialProbe(){this.probeInFlight||this.probe().catch(()=>{this.breaker.trip()})}getSafeEndpoint(){return this.parsed.safeUrl}async embed(e){if(e.length===0)return[];if(this.breaker.isOpen())throw this.identityChange?this.identityChange:new Error(`[EmbedderEndpointClient] circuit breaker open for ${this.parsed.safeUrl} \u2014 fast-failing`);if(this.cachedIdentity===null){if(this.trialPending)throw this.startTrialProbe(),new Error(`[EmbedderEndpointClient] circuit breaker half-open for ${this.parsed.safeUrl} \u2014 trial probe running, fast-failing`);await this.ensureProbed()}try{let t=await this.postEmbeddings(e),i=this.decodeAndNormalize(t,e.length);return this.breaker.recordSuccess(),i}catch(t){throw this.breaker.recordFailure(t instanceof M),t}}async probe(){return this.probeInFlight?this.probeInFlight:(this.probeInFlight=this.doProbe().finally(()=>{this.probeInFlight=null}),this.probeInFlight)}async ensureProbed(){return this.cachedIdentity?this.cachedIdentity:this.probe()}async doProbe(){let e;try{let r=await this.postEmbeddings([Re]);e=this.decodeAndNormalize(r,1)[0],this.breaker.recordSuccess()}catch(r){throw this.breaker.recordFailure(r instanceof M),r}if(!e||e.length!==this.opts.expectedDim)throw new Error(`[EmbedderEndpointClient] dim mismatch: expected ${this.opts.expectedDim}, got ${e?.length??0} from ${this.parsed.safeUrl}`);let t=Buffer.alloc(e.length*2);for(let r=0;r<e.length;r++){let s=Math.max(-32768,Math.min(32767,Math.round(e[r]*32767)));t.writeInt16LE(s,r*2)}let i=Te("sha256").update(t).digest("hex").slice(0,16),o={dim:e.length,fingerprint:i,endpoint:this.parsed.safeUrl};return this.boundIdentity&&this.boundCanary?this.isBoundModel(o,e)||this.refuseIdentityChange(o):(this.boundIdentity=o,this.boundCanary=e),this.identityChange=null,this.cachedIdentity=this.boundIdentity,this.trialPending=!1,this.cachedIdentity}isBoundModel(e,t){let i=this.boundIdentity;return e.dim!==i.dim?!1:e.fingerprint===i.fingerprint?!0:O(this.boundCanary,t)>=F}refuseIdentityChange(e){let t=this.boundIdentity,i=this.identityChange,o=new j(t,e);throw this.identityChange=o,this.cachedIdentity=null,this.trialPending=!0,this.breaker.trip(),(!i||!Ce(i.current,e))&&console.warn(`${o.message}. Embedding requests are refused.`),o}getCachedIdentity(){return this.cachedIdentity}getBoundIdentity(){return this.boundIdentity}getBoundCanary(){return this.boundCanary}getBreakerState(){return this.breaker.getState()}async probeThroughOpenBreaker(){try{return await this.probe()}catch(e){throw this.breaker.trip(),e}}close(){this.agent.destroy()}decodeAndNormalize(e,t){if(!e||typeof e!="object"||!Array.isArray(e.data))throw new Error("[EmbedderEndpointClient] response missing data array");let i=e.data;if(i.length!==t)throw new Error(`[EmbedderEndpointClient] response count mismatch: expected ${t}, got ${i.length}`);let o=i.map((r,s)=>({idx:typeof r.index=="number"?r.index:s,embedding:r.embedding}));return o.sort((r,s)=>r.idx-s.idx),o.map(({embedding:r},s)=>{if(typeof r=="string")throw new Error(`[EmbedderEndpointClient] received base64 embedding at position ${s} \u2014 server ignored encoding_format=float. Configure the server to return float arrays.`);if(!Array.isArray(r))throw new Error(`[EmbedderEndpointClient] missing embedding at position ${s}`);if(r.length!==this.opts.expectedDim)throw new Error(`[EmbedderEndpointClient] dim mismatch at position ${s}: expected ${this.opts.expectedDim}, got ${r.length}`);return ie(r)})}postEmbeddings(e){let t=JSON.stringify({model:this.opts.model,input:e,encoding_format:"float"});return this.request(xe,t)}request(e,t){let i={"content-type":"application/json","content-length":Buffer.byteLength(t),accept:"application/json"};this.opts.token&&(i.authorization=`Bearer ${this.opts.token}`);let o={method:"POST",path:e,headers:i,agent:this.agent},r,s;this.parsed.transport==="unix"?(r={...o,socketPath:this.parsed.socketPath},s=_.request):(r={...o,host:this.parsed.host,port:this.parsed.port,protocol:this.parsed.protocol},s=this.parsed.transport==="https"?q.request:_.request);let a=this.parsed.safeUrl,l=this.opts.connectTimeoutMs,u=this.opts.requestTimeoutMs;return new Promise((v,N)=>{let f=!1,g=()=>{},b=d=>{f||(f=!0,g(),this.inFlight.delete(T),v(d))},w=d=>{f||(f=!0,g(),this.inFlight.delete(T),N(d))},T=d=>{w(d),E.destroy(d)},E=s(r,d=>{let I=[];d.on("data",h=>I.push(Buffer.from(h))),d.on("end",()=>{let h=Buffer.concat(I).toString("utf-8");if(!d.statusCode||d.statusCode<200||d.statusCode>=300){w(new Error(`[EmbedderEndpointClient] HTTP ${d.statusCode} from ${a}: ${h.slice(0,200)}`));return}try{let R=JSON.parse(h);b(R)}catch(R){w(new Error(`[EmbedderEndpointClient] invalid JSON from ${a}: ${R.message}`))}}),d.on("error",h=>w(h))});E.on("socket",d=>{d.setTimeout(l);let I=()=>{d.setTimeout(u)};d.connecting?d.once("connect",I):I();let h=()=>{let R=d.connecting?"connect":"request",$=d.connecting?l:u,ee=new M(R,$);w(ee),E.destroy(ee)};d.on("timeout",h),g=()=>{d.removeListener("timeout",h),d.removeListener("connect",I)},f&&g()}),E.on("error",d=>w(d)),this.inFlight.add(T),E.write(t),E.end()})}};Ie();import{join as ae,resolve as Pe}from"node:path";import{existsSync as Ne,mkdirSync as De}from"node:fs";import{createRequire as ke}from"node:module";var Oe=ke(import.meta.url);function Me(){let n=process.env.AQE_MEMORY_PATH;return n&&n.length>0?n===":memory:"?n:Pe(L(),n):ae(L(),".agentic-qe","memory.db")}var de="_system",le="embedder_identity:",k=null,Y=!1;function ce(){if(k)return k;if(Y)return null;try{let n=Oe("better-sqlite3"),e=Me(),t=ae(e,"..");Ne(t)||De(t,{recursive:!0});let i=new n(e);return i.pragma("journal_mode = WAL"),i.pragma("busy_timeout = 5000"),i.exec(`
3
- CREATE TABLE IF NOT EXISTS kv_store (
4
- key TEXT NOT NULL,
5
- namespace TEXT NOT NULL,
6
- value TEXT NOT NULL,
7
- expires_at INTEGER,
8
- created_at INTEGER DEFAULT (strftime('%s', 'now') * 1000),
9
- PRIMARY KEY (namespace, key)
10
- );
11
- CREATE INDEX IF NOT EXISTS idx_kv_namespace ON kv_store(namespace);
12
- `),k=i,i}catch{return Y=!0,null}}function pe(n){let e=ce();if(!e)return null;try{let t=e.prepare("SELECT value FROM kv_store WHERE namespace = ? AND key = ?").get(de,le+n);if(!t)return null;let i=JSON.parse(t.value);return!i.fingerprint||typeof i.dim!="number"?null:{fingerprint:i.fingerprint,dim:i.dim,endpoint:i.endpoint}}catch{return null}}function ue(n){let e=ce();if(!e)return;let t={fingerprint:n.fingerprint,dim:n.dim,endpoint:n.endpoint,updatedAt:Date.now()};e.prepare("INSERT OR REPLACE INTO kv_store (key, namespace, value) VALUES (?, ?, ?)").run(le+n.endpoint,de,JSON.stringify(t))}function me(){if(k)try{k.close()}catch{}k=null,Y=!1}W();Se();te();var ge="_system",he="embedding_space:";function fe(n,e){return n.provider===e.provider&&n.model===e.model&&n.dimensions===e.dimensions&&(n.pooling??null)===(e.pooling??null)&&n.normalized===e.normalized&&(n.preprocessingVersion??null)===(e.preprocessingVersion??null)&&(n.implementation??null)===(e.implementation??null)}function _e(n,e,t,i){let o=i.filter(a=>a.canaryText===e&&a.canary.length===t.length&&fe(a.identity,n)),r=o.find(a=>a.identity.runtimeFingerprint===n.runtimeFingerprint);if(r)return{entry:r,exact:!0};let s=null;for(let a of o){let l=O(a.canary,t);l>=F&&(!s||l>s.cosine)&&(s={entry:a,cosine:l})}return s?{entry:s.entry,exact:!1}:null}function $e(n){let e=n.prepare("SELECT value FROM kv_store WHERE namespace = ? AND key LIKE ?").all(ge,`${he}%`),t=[];for(let i of e){let o=Fe(i.value);o&&t.push(o)}return t}function Fe(n){let e;try{e=JSON.parse(n)}catch{return null}let{identity:t,canaryText:i,canary:o}=e;return e.version!==1||!t||typeof t.spaceId!="string"||typeof t.runtimeFingerprint!="string"||typeof t.dimensions!="number"||typeof i!="string"||!Array.isArray(o)||o.length!==t.dimensions||!o.every(r=>typeof r=="number"&&Number.isFinite(r))?null:{identity:t,canaryText:i,canary:o}}function ze(n,e){let t={version:1,createdAt:Date.now(),...e};return ne(n,()=>{n.prepare("INSERT OR IGNORE INTO kv_store (key, namespace, value) VALUES (?, ?, ?)").run(he+e.identity.spaceId,ge,JSON.stringify(t))})}function be(n,e,t,i){let o=()=>({identity:e,resolution:"unavailable",otherSpaces:0,registration:Promise.resolve()});if(!n)return o();let r;try{r=$e(n)}catch(u){return console.warn(`[EmbeddingSpaceRegistry] could not read registered embedding spaces (${x(u)}); using the derived space id`),o()}let s=_e(e,t,i,r);if(s)return{identity:s.entry.identity,resolution:s.exact?"matched-exact":"matched-cosine",otherSpaces:0,registration:Promise.resolve()};let a=r.filter(u=>u.canaryText===t&&fe(u.identity,e)).length,l=Promise.resolve().then(()=>ze(n,{identity:e,canaryText:t,canary:[...i]})).catch(u=>{console.warn(`[EmbeddingSpaceRegistry] could not register embedding space ${e.spaceId.slice(0,12)} (${x(u)}); it is registered at a later start`)});return{identity:e,resolution:"registered",otherSpaces:a,registration:l}}var V=null,y=null,C=null,S=!1,A="",Q=null,p=null,c=null,P=null,Z={modelName:"Xenova/all-MiniLM-L6-v2",quantized:!0,enableCache:!0,maxCacheSize:1e4,endpoint:process.env.AQE_EMBEDDER_ENDPOINT,endpointToken:process.env.AQE_EMBEDDER_TOKEN},m=new Map,ye=36e5;function J(n){return c?`endpoint:${c.fingerprint}:${n}`:`inproc:${n}`}function we(n){let e=n.trim();return!!(e.startsWith("{")&&/["']metrics["']/.test(e)||e.startsWith("[")&&e.endsWith("]")&&e.length>50||(e.match(/[a-zA-Z]/g)||[]).length/Math.max(e.length,1)<.3&&e.length>20)}async function B(n={},e=!1){if(S&&!e)throw new Error(`Transformer initialization previously failed: ${A}`);if(C)return C;let t={...Z,...n};return C=(async()=>{try{if(t.endpoint){let v=se(t.endpoint);console.log(`[RealEmbeddings] Using external embedder endpoint: ${v}`),p=new z({endpoint:t.endpoint,token:t.endpointToken,model:t.modelName,expectedDim:U()}),c=await p.probe();let N=G({provider:"openai-compatible-endpoint",model:t.modelName,dimensions:c.dim,pooling:"mean",normalized:!0,preprocessingVersion:"aqe-text-v1",implementation:c.endpoint,runtimeFingerprint:c.fingerprint}),f=p.getBoundCanary(),g=f?await Ee(N,X,[...f]):null;P=g?.identity??N,console.log(`[RealEmbeddings] Endpoint identity: dim=${c.dim} fingerprint=${c.fingerprint}`);try{let b=pe(c.endpoint),w=g?.resolution==="matched-exact"||g?.resolution==="matched-cosine",T=b!==null&&b.fingerprint!==c.fingerprint||(g?.otherSpaces??0)>0;!w&&T&&console.warn(`[RealEmbeddings] WARNING: endpoint identity changed since last run. Previous fingerprint=${b?.fingerprint??"unknown"} dim=${b?.dim??"unknown"}, current fingerprint=${c.fingerprint} dim=${c.dim}. Vectors written before this change may no longer be comparable.`),ue(c)}catch(b){console.warn(`[RealEmbeddings] Could not persist endpoint identity: ${x(b)}`)}y=qe(p),S=!1,A="";return}let i;try{i=await import("./transformers-4MRPXCPU.js")}catch{throw new Error('In-process embeddings require the optional package "@huggingface/transformers", which is not installed. Configure an embedding endpoint (EmbeddingConfig.endpoint / AQE_EMBEDDER_ENDPOINT) so no local model is loaded. Installing @huggingface/transformers@4.2.0 is an explicit security opt-in: its compatible dependency chain currently has unresolved HIGH advisories GHSA-xcpc-8h2w-3j85 and GHSA-f88m-g3jw-g9cj.')}V=i.pipeline,console.log(`[RealEmbeddings] Loading model: ${t.modelName}`);let o=performance.now();y=await V("feature-extraction",t.modelName,{quantized:t.quantized});let r=y;if(!r)throw new Error("Transformer pipeline returned no embedding model");let s=await r(H,{pooling:"mean",normalize:!0}),a=Array.from(s.data),l=G({provider:"huggingface-transformers",model:t.modelName,dimensions:a.length,pooling:"mean",normalized:!0,preprocessingVersion:"aqe-text-v1",implementation:`transformers:${t.quantized?"quantized":"full"}`,runtimeFingerprint:re(a)});P=(await Ee(l,H,a)).identity,S=!1,A="";let u=performance.now()-o;console.log(`[RealEmbeddings] Model loaded in ${u.toFixed(0)}ms`)}catch(i){throw S=!0,A=x(i),new Error(`Failed to initialize transformer model: ${A}`)}})(),C}var ve=Promise.resolve();function at(){return ve}async function Ee(n,e,t){let i=null;try{let{getOpenUnifiedMemoryDatabase:r}=await import("./unified-memory-2VMGSGQL.js");i=r()}catch(r){console.warn(`[RealEmbeddings] embedding-space registry unavailable: ${x(r)}`)}let o=be(i,n,e,t);return ve=o.registration,o.resolution==="matched-cosine"&&console.log(`[RealEmbeddings] Embedding space ${o.identity.spaceId.slice(0,12)} kept: runtime fingerprint ${n.runtimeFingerprint} is within the round-trip cosine of its reference`),o}function qe(n){return async e=>{let t=Array.isArray(e)?e:[e],i=await n.embed(t),o=i[0]?.length??U(),r=new Float32Array(t.length*o);for(let s=0;s<i.length;s++)r.set(i[s],s*o);return{data:r,dims:[t.length,o]}}}async function dt(n,e={}){let t={...Z,...e};if(we(n))return new Array(U()).fill(0);if(y||await B(e),!y)throw new Error("Embedding model failed to initialize");let i=J(n);if(t.enableCache){let l=m.get(i);if(l&&Date.now()-l.timestamp<ye)return l.embedding}let o=performance.now(),r=await y(n,{pooling:"mean",normalize:!0}),s=Array.from(r.data),a=performance.now()-o;if(a>500&&console.warn(`[RealEmbeddings] Slow embedding computation: ${a.toFixed(1)}ms for "${n.slice(0,50)}..."`),t.enableCache){if(m.size>=t.maxCacheSize){let l=m.keys().next().value;l&&m.delete(l)}m.set(i,{embedding:s,timestamp:Date.now()})}return s}async function lt(n,e={}){let t={...Z,...e},i=[],o=[],r=new Array(n.length).fill(null),s=[];for(let a=0;a<n.length;a++)we(n[a])?r[a]=new Array(U()).fill(0):s.push(a);if(s.length===0)return r;if(y||await B(e),!y)throw new Error("Embedding model failed to initialize");if(t.enableCache)for(let a of s){let l=m.get(J(n[a]));l&&Date.now()-l.timestamp<ye?r[a]=l.embedding:(i.push(n[a]),o.push(a))}else for(let a of s)i.push(n[a]),o.push(a);if(i.length>0){let a=performance.now(),l=32;for(let v=0;v<i.length;v+=l){let N=Math.min(v+l,i.length),f=i.slice(v,N),g=await y(f,{pooling:"mean",normalize:!0}),b=g.dims||[f.length,384],w=b[0],T=b[1];for(let E=0;E<w;E++){let d=E*T,I=Array.from(g.data.slice(d,d+T)),h=v+E,R=o[h];if(r[R]=I,t.enableCache){if(m.size>=t.maxCacheSize){let $=m.keys().next().value;$&&m.delete($)}m.set(J(i[h]),{embedding:I,timestamp:Date.now()})}}}let u=performance.now()-a;console.log(`[RealEmbeddings] Batch computed ${i.length} embeddings in ${u.toFixed(0)}ms`)}return r.filter(a=>a!==null)}function ct(){m.clear(),console.log("[RealEmbeddings] Cache cleared")}function pt(){return{size:m.size,hitRate:0}}function ut(){return!S&&y!==null}function U(){return 384}function mt(){V=null,y=null,C=null,S=!1,A="",m.clear(),p&&p.close(),p=null,c=null,P=null,me()}function gt(){S&&(S=!1,A="",C=null,p&&p.close(),p=null,c=null)}async function ht(n={}){if(S)return Q??=Be(n).finally(()=>{Q=null}),Q;let e=p;!e||!e.needsTrial()||await e.probeThroughOpenBreaker()}async function Be(n){p&&p.close(),p=null,c=null,C=null,await B(n,!0)}function ft(){return p!==null}function bt(){return c}function Et(){return P}async function yt(){if(P)return P;let n=process.env.AQE_EMBEDDER_ENDPOINT;return n?(await B({endpoint:n,endpointToken:process.env.AQE_EMBEDDER_TOKEN}),P):null}export{se as a,Z as b,at as c,dt as d,lt as e,ct as f,pt as g,ut as h,U as i,mt as j,gt as k,ht as l,ft as m,bt as n,Et as o,yt as p};
@@ -1,2 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.17");process.exit(0)}
2
- var l="defect-intelligence",d=["critical","high","medium","low","info"],m=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function u(e){if(!m(e))return null;let{file:i,probability:t,riskLevel:r}=e;if(typeof i!="string"||i.length===0||typeof t!="number"||!Number.isFinite(t)||t<0||t>1||!d.includes(r))return null;let c=Array.isArray(e.factors)?e.factors.filter(o=>m(o)&&typeof o.name=="string"&&typeof o.contribution=="number"&&Number.isFinite(o.contribution)):[],a=Array.isArray(e.recommendations)?e.recommendations.filter(o=>typeof o=="string"):[];return{file:i,probability:t,riskLevel:r,factors:c,recommendations:a}}function f(e,i){if(!m(e)||typeof e.id!="string"||typeof e.timestamp!="string")return null;let t=Date.parse(e.timestamp);if(!Number.isFinite(t)||t>i+6e4||i-t>6048e5||!Array.isArray(e.predictions)||e.predictions.length===0)return null;let r=e.predictions.map(u);return r.some(c=>c===null)?null:{id:e.id,timestamp:e.timestamp,predictions:r,...e.predictionMethod==="static-code-indicators"?{predictionMethod:"static-code-indicators",estimated:!0,filesSkipped:typeof e.filesSkipped=="number"&&Number.isSafeInteger(e.filesSkipped)&&e.filesSkipped>=0?e.filesSkipped:0}:{}}}async function A(e,i="defect-intelligence:predictor"){let t=`${i}:prediction:`,r=await e.search(`${t}*`,Number.MAX_SAFE_INTEGER,{namespace:l}),c=Date.now(),a=[],o=[];for(let n of r){let s=n.startsWith(`${l}:${t}`)?n.slice(l.length+1):n;if(!s.startsWith(t))continue;let p=f(await e.get(s,{namespace:l}),c);p?a.push({key:s,timestamp:Date.parse(p.timestamp),id:p.id}):o.push(s)}a.sort((n,s)=>s.timestamp-n.timestamp||(n.id===s.id?n.key===s.key?0:n.key>s.key?-1:1:n.id>s.id?-1:1));for(let n of[...o,...a.slice(32).map(s=>s.key)])await e.delete(n,{namespace:l})}function g(e){let i=e.replace(/[.+^${}()|[\]\\]/g,"\\$&");return new RegExp(`^${i.replace(/\*/g,".*").replace(/\?/g,".")}$`,"s")}function y(e,i,t){return g(t).test(e)?e:e.startsWith(`${i}:`)?e.slice(i.length+1):e}var k=1e4,h=32;async function b(e,i,t={}){let r=Math.max(1,Math.floor(t.pageSize??k)),c=await e.search(i,r,t.retrieve);for(let n=1;c.length>=r;n++){if(n>=h)throw new Error(`searchAllKeys('${i}'): the backend never returned a short page after ${n} requests (last limit ${r}); refusing to return a possibly incomplete key list`);r*=2,c=await e.search(i,r,t.retrieve)}let a=t.retrieve?.namespace,o=a?c.map(n=>y(n,a,i)):c;return[...new Set(o)].sort()}export{f as a,A as b,y as c,b as d};
@@ -1,3 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.17");process.exit(0)}
2
- import{a as y,b as C}from"./chunk-KB34MTFZ.js";import{b as h}from"./chunk-XBTGEYED.js";import{f as g,g as v,l as f,m as b,n as p,p as d}from"./chunk-MCXW3DKE.js";import D from"chalk";var E=3,R="instrumented-report",T="static-estimation";async function x(e,r=n=>console.log(n)){let n=await f(e);if(n.status==="target-missing")return{kind:"no-data",reason:"target-missing",message:d("target-missing",e,null)};if(n.status==="evaluated"){let{evaluation:a,projectRoot:t}=n;if(a.status==="measured"){let{files:u,evidence:i}=a;return{kind:"data",data:{files:u,summary:y(u),instrumented:!0,...i.unmeasuredFiles.length>0?{unmeasuredFiles:i.unmeasuredFiles}:{}},projectRoot:t,evidence:i}}return{kind:"no-data",reason:a.reason,message:d(a.reason,e,t)}}let s=h(n.target,{includeTests:!1});return s.length===0?{kind:"no-sources"}:(r(D.gray(` Analyzing ${s.length} files...
3
- `)),{kind:"data",data:C(s,n.projectRoot),projectRoot:n.projectRoot})}function w(e){return{branch:e.files.some(r=>r.branches.total>0),function:e.files.some(r=>r.functions.total>0),statement:e.files.some(r=>r.statements.total>0)}}var F=e=>e==="target-missing"||e==="unreadable-report";function N(){return"UNMEASURED: no coverage report exists for this project, so these figures are a STATIC ESTIMATE derived from source shape \u2014 not measured coverage. No threshold verdict is given and nothing is stored as evidence. Run your tests with coverage first (e.g. `npm test -- --coverage`) and re-run."}async function O(e,r,n,s){let a=await x(r,s);if(a.kind==="no-sources")return a;if(a.kind==="no-data")return F(a.reason)?{kind:"error",reason:a.reason,message:a.message}:{kind:"unmeasured",reason:a.reason,message:a.message};let t=a.data,u=t.instrumented,i=await e.analyze({coverageData:t,threshold:n,includeFileDetails:!0,measured:u,...a.projectRoot?{projectRoot:a.projectRoot}:{}});if(!i.success||!i.value)return{kind:"analysis-failed",message:i.error?.message||"Coverage analysis failed"};let o=i.value;if(!u)return{kind:"estimate",data:t,summary:{...o.summary},message:N()};let l=w(t),c=b(o.summary,n,l),m=g(a.evidence,a.projectRoot??r),k={...c,meetsThreshold:c.meetsThreshold&&m.length===0};return{kind:"measured",data:t,collected:l,verdict:k,insufficientEvidence:m,...a.evidence?{evidence:a.evidence}:{},summary:{...o.summary,branch:l.branch?o.summary.branch:null,function:l.function?o.summary.function:null,statement:l.statement?o.summary.statement:null},recommendations:p(o.recommendations??[],c,n,l)}}function U(e,r){switch(e.kind){case"measured":{if(e.insufficientEvidence.length>0)return E;let{overall:n,meetsThreshold:s}=e.verdict;return s?n<r+5?2:0:1}case"estimate":case"unmeasured":return E;case"no-sources":return 0;default:return 1}}function j(e,r){if(e.length===0&&r.length===0)return{};let n=e.length>0?`INSUFFICIENT EVIDENCE: ${e.join("; ")}`:"";return r.length===0?{warning:n}:{warning:[n&&n.replace(/\.?$/,"."),...r].filter(Boolean).join(" ")}}function _(e,r,n){let s={line:null,branch:null,function:null,statement:null};switch(e.kind){case"measured":return{summary:e.summary,meetsThreshold:e.verdict.meetsThreshold,threshold:r,recommendations:e.recommendations,measured:!0,estimated:!1,coverageMethod:R,branchDataCollected:e.collected.branch,functionDataCollected:e.collected.function,statementDataCollected:e.collected.statement,...e.data.unmeasuredFiles?.length?{unmeasuredFiles:e.data.unmeasuredFiles}:{},...e.evidence?{evidenceStatus:e.evidence.status}:{},...e.evidence?.stale?{staleReport:e.evidence.stale}:{},...e.evidence?.conflictingFiles?{conflictingFiles:e.evidence.conflictingFiles}:{},...e.evidence?.excludedEntries?{excludedReportEntries:e.evidence.excludedEntries}:{},...j(e.insufficientEvidence,v(e.evidence))};case"estimate":return{summary:e.summary,meetsThreshold:null,threshold:r,measured:!1,estimated:!0,unmeasured:!0,coverageMethod:T,reason:"no-coverage-report",target:n,warning:e.message};case"unmeasured":case"error":return{summary:s,meetsThreshold:null,threshold:r,measured:!1,unmeasured:e.kind==="unmeasured",reason:e.reason,target:n,warning:e.message};case"analysis-failed":return{summary:s,meetsThreshold:null,threshold:r,measured:!1,target:n,error:e.message};case"no-sources":return{summary:s,meetsThreshold:null,threshold:r,measured:!1,target:n,warning:"No source files found"}}}export{E as a,x as b,O as c,U as d,_ as e};