@hawkeyexl/manni 4.20.1 → 4.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/README.md +1 -1
  2. package/dist/{batch-J626LZ22.js → batch-C3NN2YXB.js} +20 -21
  3. package/dist/build-CEVEAHN7.js +36 -0
  4. package/dist/calibrate-CSKPY5AK.js +42 -0
  5. package/dist/capture-3HDBIHH6.js +37 -0
  6. package/dist/check-555TCJGF.js +45 -0
  7. package/dist/check-KGJBV42O.js +30 -0
  8. package/dist/{check-RCSQARQE.js → check-KXWHSCCR.js} +13 -16
  9. package/dist/check-MZSXCS2M.js +33 -0
  10. package/dist/{check-PQ7S5I3I.js → check-QNHLTYPN.js} +23 -23
  11. package/dist/{chunk-YIHIRMXN.js → chunk-2VLZDU4E.js} +5 -5
  12. package/dist/{chunk-D54BQM5P.js → chunk-37Q7WEJJ.js} +9 -9
  13. package/dist/{chunk-QSPH4F56.js → chunk-3ZVRGBK6.js} +5 -5
  14. package/dist/chunk-3ZVRGBK6.js.map +1 -0
  15. package/dist/{chunk-P5DWBG6T.js → chunk-46MMIJWR.js} +3 -3
  16. package/dist/{chunk-P6XZ44C2.js → chunk-4LYVTR2T.js} +4 -4
  17. package/dist/{chunk-ODSIHEIW.js → chunk-562QZKAB.js} +6599 -3508
  18. package/dist/chunk-562QZKAB.js.map +1 -0
  19. package/dist/{chunk-ACJUZFRT.js → chunk-57LZPG4V.js} +29 -4
  20. package/dist/chunk-57LZPG4V.js.map +1 -0
  21. package/dist/chunk-5LQX57BW.js +100 -0
  22. package/dist/chunk-5LQX57BW.js.map +1 -0
  23. package/dist/{chunk-MPXMQGJI.js → chunk-63EQKVNT.js} +45 -910
  24. package/dist/chunk-63EQKVNT.js.map +1 -0
  25. package/dist/{chunk-6FY573GB.js → chunk-64DULZIG.js} +4 -4
  26. package/dist/{chunk-TAJYMXMM.js → chunk-6SVHI2U6.js} +2 -2
  27. package/dist/{chunk-OVUQNM7Y.js → chunk-6UHEMPEY.js} +3 -157
  28. package/dist/chunk-6UHEMPEY.js.map +1 -0
  29. package/dist/{chunk-A633WB3N.js → chunk-A5YUK3SG.js} +37 -26
  30. package/dist/chunk-A5YUK3SG.js.map +1 -0
  31. package/dist/{chunk-C5BXSQDO.js → chunk-A67EJ3J6.js} +6 -6
  32. package/dist/{chunk-2GTR24SA.js → chunk-BLDL23RY.js} +8 -8
  33. package/dist/{chunk-JPXC62SD.js → chunk-BY3635RR.js} +82 -16
  34. package/dist/chunk-BY3635RR.js.map +1 -0
  35. package/dist/{chunk-CFMI74TP.js → chunk-BZ74YUYE.js} +2 -2
  36. package/dist/{chunk-NDPQ2GQ4.js → chunk-CHTSA3YR.js} +6 -6
  37. package/dist/{chunk-5CJ3P5O3.js → chunk-CPYQ4BJK.js} +19 -100
  38. package/dist/chunk-CPYQ4BJK.js.map +1 -0
  39. package/dist/{chunk-Z2T5U7HN.js → chunk-CQTESLC5.js} +2 -2
  40. package/dist/{chunk-245W2Q7C.js → chunk-D4BGNAN5.js} +2 -2
  41. package/dist/{chunk-XPO655IX.js → chunk-E3HYSNS6.js} +4 -4
  42. package/dist/{chunk-LPJ3IB26.js → chunk-EL2KNRC3.js} +17 -3
  43. package/dist/chunk-EL2KNRC3.js.map +1 -0
  44. package/dist/{chunk-ISDFYXLA.js → chunk-FTSNG6DZ.js} +48 -28
  45. package/dist/chunk-FTSNG6DZ.js.map +1 -0
  46. package/dist/{chunk-MJZK7G4B.js → chunk-FXE5K56B.js} +3 -3
  47. package/dist/{chunk-YM2W43DI.js → chunk-HYEKQ22B.js} +13 -9
  48. package/dist/chunk-HYEKQ22B.js.map +1 -0
  49. package/dist/{chunk-QGBNWEWS.js → chunk-IC3FJWIF.js} +2 -2
  50. package/dist/{chunk-OQR3VVAX.js → chunk-IDDRHB7E.js} +3 -3
  51. package/dist/chunk-INOVEO32.js +28 -0
  52. package/dist/chunk-INOVEO32.js.map +1 -0
  53. package/dist/chunk-IXFFVI5S.js +409 -0
  54. package/dist/chunk-IXFFVI5S.js.map +1 -0
  55. package/dist/{chunk-OXCWCEVV.js → chunk-JA7DWOVV.js} +5 -5
  56. package/dist/{chunk-B2242FYO.js → chunk-JF4BC7ZD.js} +38 -3
  57. package/dist/chunk-JF4BC7ZD.js.map +1 -0
  58. package/dist/{chunk-RN7IA742.js → chunk-JL5FHNQK.js} +9 -11
  59. package/dist/{chunk-RN7IA742.js.map → chunk-JL5FHNQK.js.map} +1 -1
  60. package/dist/{chunk-HGUCJ3K3.js → chunk-JVE5YQN4.js} +4 -4
  61. package/dist/chunk-K5LBIAOM.js +700 -0
  62. package/dist/chunk-K5LBIAOM.js.map +1 -0
  63. package/dist/{chunk-5E3ABFOQ.js → chunk-KIUFBUUZ.js} +13 -11
  64. package/dist/{chunk-5E3ABFOQ.js.map → chunk-KIUFBUUZ.js.map} +1 -1
  65. package/dist/{chunk-SUTY4VCZ.js → chunk-LCMBG4LY.js} +3635 -3409
  66. package/dist/chunk-LCMBG4LY.js.map +1 -0
  67. package/dist/{chunk-H3C3UXTA.js → chunk-LMS2RWDS.js} +15 -13
  68. package/dist/{chunk-H3C3UXTA.js.map → chunk-LMS2RWDS.js.map} +1 -1
  69. package/dist/{chunk-RA2BER5P.js → chunk-MR5JWMC2.js} +2 -2
  70. package/dist/{chunk-JCTHXG33.js → chunk-NHOGTAPK.js} +2 -2
  71. package/dist/{chunk-VM7VAFJW.js → chunk-NVYDWVXN.js} +2 -1
  72. package/dist/{chunk-N2VB6UUE.js → chunk-O6IDYZVW.js} +7 -5
  73. package/dist/{chunk-N2VB6UUE.js.map → chunk-O6IDYZVW.js.map} +1 -1
  74. package/dist/{chunk-MTMR65NM.js → chunk-OHMLEITS.js} +2 -2
  75. package/dist/{chunk-NUQF5F5J.js → chunk-PNDEKFF3.js} +2 -2
  76. package/dist/{chunk-S2HW3CBF.js → chunk-PX7OTUNU.js} +6 -6
  77. package/dist/{chunk-4F5WGZRP.js → chunk-Q7FFJMFO.js} +19 -15
  78. package/dist/chunk-Q7FFJMFO.js.map +1 -0
  79. package/dist/{chunk-D4XQX4W7.js → chunk-QJJPTS6L.js} +5 -3
  80. package/dist/{chunk-D4XQX4W7.js.map → chunk-QJJPTS6L.js.map} +1 -1
  81. package/dist/chunk-RAN3CF33.js +1875 -0
  82. package/dist/chunk-RAN3CF33.js.map +1 -0
  83. package/dist/{chunk-YYWZ2MSL.js → chunk-S7V4F7HC.js} +16 -11
  84. package/dist/chunk-S7V4F7HC.js.map +1 -0
  85. package/dist/{chunk-CXL6ES7O.js → chunk-SCKVDD4E.js} +4 -4
  86. package/dist/{chunk-ZB3OFSRB.js → chunk-TJYJ4BNK.js} +4 -4
  87. package/dist/{chunk-MJZ5HYYL.js → chunk-TR5TNPWT.js} +2 -2
  88. package/dist/{chunk-MJZ5HYYL.js.map → chunk-TR5TNPWT.js.map} +1 -1
  89. package/dist/chunk-TT5UDTDM.js +888 -0
  90. package/dist/chunk-TT5UDTDM.js.map +1 -0
  91. package/dist/{chunk-N3DYE6LJ.js → chunk-TWYJ2TVS.js} +7 -7
  92. package/dist/{chunk-BM43RJIS.js → chunk-UQI463L3.js} +9 -9
  93. package/dist/{chunk-FIR2MAGS.js → chunk-V27DOGAO.js} +2 -2
  94. package/dist/{chunk-O4O6JOGD.js → chunk-VSDXZAQU.js} +14 -20
  95. package/dist/chunk-VSDXZAQU.js.map +1 -0
  96. package/dist/{chunk-4DFBBU4A.js → chunk-VSHMXMBZ.js} +2 -2
  97. package/dist/{chunk-ROZDHPKA.js → chunk-VZSATUI7.js} +4 -4
  98. package/dist/{chunk-EOJEPEYY.js → chunk-W5OZMYMX.js} +2 -2
  99. package/dist/{chunk-KERICP5Y.js → chunk-WW4JATBJ.js} +6 -6
  100. package/dist/{chunk-SSQZB5SQ.js → chunk-XG6PVB5S.js} +11 -1
  101. package/dist/chunk-XG6PVB5S.js.map +1 -0
  102. package/dist/{chunk-TDG2S5UE.js → chunk-XQKRD5A3.js} +4 -4
  103. package/dist/{chunk-GGTCSMNX.js → chunk-XSP3TUFN.js} +5 -5
  104. package/dist/{chunk-UVC3BUKU.js → chunk-XTMONCQE.js} +6 -405
  105. package/dist/chunk-XTMONCQE.js.map +1 -0
  106. package/dist/{chunk-WRWW6SGG.js → chunk-YB3KD5RI.js} +3 -3
  107. package/dist/chunk-ZAOJYN2D.js +159 -0
  108. package/dist/chunk-ZAOJYN2D.js.map +1 -0
  109. package/dist/{chunk-FKELQCGN.js → chunk-ZKIXGFID.js} +2 -2
  110. package/dist/{chunk-BY4THWAQ.js → chunk-ZT3ERG4B.js} +3 -3
  111. package/dist/chunk-ZTRC37NH.js +38 -0
  112. package/dist/chunk-ZTRC37NH.js.map +1 -0
  113. package/dist/{chunk-LXJ4FZ7Y.js → chunk-ZW4YASUB.js} +4 -4
  114. package/dist/{chunk-E6JYRVR5.js → chunk-ZX4TOTZS.js} +27 -8
  115. package/dist/chunk-ZX4TOTZS.js.map +1 -0
  116. package/dist/{cli-4RTNEVVX.js → cli-4QAH3DBX.js} +9 -11
  117. package/dist/{cli-IIFCE6GY.js → cli-6476FRBK.js} +16 -19
  118. package/dist/{cli-IIFCE6GY.js.map → cli-6476FRBK.js.map} +1 -1
  119. package/dist/{cli-DQRFSU7U.js → cli-7XT7O5YM.js} +16 -18
  120. package/dist/{cli-DQRFSU7U.js.map → cli-7XT7O5YM.js.map} +1 -1
  121. package/dist/{cli-PCZ7XNCO.js → cli-FGCHGJYZ.js} +70 -53
  122. package/dist/cli-FGCHGJYZ.js.map +1 -0
  123. package/dist/{cli-6J4P5MLU.js → cli-JE4LG35H.js} +4 -4
  124. package/dist/{cli-K5635N25.js → cli-U3622DIB.js} +14 -17
  125. package/dist/{cli-K5635N25.js.map → cli-U3622DIB.js.map} +1 -1
  126. package/dist/{cli-K5QWXB7H.js → cli-ULHJTJHH.js} +74 -41
  127. package/dist/cli-ULHJTJHH.js.map +1 -0
  128. package/dist/{cli-ISKXSN3P.js → cli-W7B2PNZO.js} +18 -21
  129. package/dist/{cli-ISKXSN3P.js.map → cli-W7B2PNZO.js.map} +1 -1
  130. package/dist/{cli-FTSJQSB4.js → cli-YGMXZ46V.js} +17 -20
  131. package/dist/{cli-FTSJQSB4.js.map → cli-YGMXZ46V.js.map} +1 -1
  132. package/dist/{cli-TCHSYJLB.js → cli-YINQL2NI.js} +28 -29
  133. package/dist/{cli-TCHSYJLB.js.map → cli-YINQL2NI.js.map} +1 -1
  134. package/dist/cli-Z3ART5DN.js +152 -0
  135. package/dist/cli-Z3ART5DN.js.map +1 -0
  136. package/dist/cli.js +15 -15
  137. package/dist/cli.js.map +1 -1
  138. package/dist/{config-7I5CHHRZ.js → config-2YJPJ36T.js} +5 -5
  139. package/dist/docmeta.js +8 -10
  140. package/dist/docmeta.js.map +1 -1
  141. package/dist/github-64ZVAUIT.js +28 -0
  142. package/dist/github-ARGPMQD2.js +32 -0
  143. package/dist/github-YHJABBUI.js +33 -0
  144. package/dist/graph/runtime.js.map +1 -1
  145. package/dist/{host-YSTYO5DX.js → host-JT27OWTC.js} +3 -3
  146. package/dist/index.d.ts +334 -24
  147. package/dist/index.js +218 -203
  148. package/dist/index.js.map +1 -1
  149. package/dist/{json-7Z2IFGB3.js → json-CVOVXB7O.js} +12 -15
  150. package/dist/json-QNGJFUY2.js +40 -0
  151. package/dist/{labels-SE2WL7WD.js → labels-5WOKC3VR.js} +11 -14
  152. package/dist/{labels-SE2WL7WD.js.map → labels-5WOKC3VR.js.map} +1 -1
  153. package/dist/lint-OQGB4DWJ.js +32 -0
  154. package/dist/list-EDAB7X5Y.js +30 -0
  155. package/dist/list-OQ3IYV2W.js +37 -0
  156. package/dist/list-PN6JKYNX.js +33 -0
  157. package/dist/{page-A2Y4ZMV4.js → page-TPNMHL27.js} +11 -14
  158. package/dist/{prepare-M2COBP5O.js → prepare-3V2QYBKL.js} +20 -22
  159. package/dist/{prepare-M2COBP5O.js.map → prepare-3V2QYBKL.js.map} +1 -1
  160. package/dist/{pretty-SFFOMSG5.js → pretty-EZ2NFU3C.js} +13 -16
  161. package/dist/pretty-HO2LYG5N.js +41 -0
  162. package/dist/{pretty-D3DZFC5U.js → pretty-K3M4AW2D.js} +12 -15
  163. package/dist/{provider-JY2I3VLF.js → provider-YWNTTQPA.js} +3 -3
  164. package/dist/{release-VHHASAG7.js → release-EFLQT3FW.js} +3 -3
  165. package/dist/{reporters-TO7Q6JYF.js → reporters-4R2E7PRJ.js} +6 -6
  166. package/dist/{reporters-UTLJVSWX.js → reporters-YVLLFBO5.js} +11 -14
  167. package/dist/run-H4BOR2FR.js +36 -0
  168. package/dist/{sarif-IAGMXA6C.js → sarif-GWHWJJFP.js} +10 -13
  169. package/dist/sarif-SJFVSOBV.js +33 -0
  170. package/dist/sarif-YBFD5OUL.js +28 -0
  171. package/dist/{strategy-UKRA6WO4.js → strategy-T56PH2VK.js} +29 -46
  172. package/dist/strategy-T56PH2VK.js.map +1 -0
  173. package/dist/{term-AMORBEO7.js → term-33YSMISR.js} +18 -22
  174. package/dist/{term-AMORBEO7.js.map → term-33YSMISR.js.map} +1 -1
  175. package/dist/{validate-CDTKFZUV.js → validate-6R5UBDGU.js} +6 -7
  176. package/package.json +1 -1
  177. package/plugin/manni/.claude-plugin/plugin.json +11 -3
  178. package/plugin/manni/hooks/graph-server.mjs +3 -3
  179. package/plugin/manni/hooks/hooks.json +4 -4
  180. package/plugin/manni/hooks/manni.mjs +18 -5
  181. package/plugin/manni/hooks/page-metadata.mjs +81 -7
  182. package/plugin/manni/hooks/tracevals.mjs +7 -0
  183. package/plugin/manni/skills/fix/SKILL.md +8 -4
  184. package/shapes/graph/shapes-1.3.0.ttl +1250 -0
  185. package/dist/build-AYLD6V6Y.js +0 -38
  186. package/dist/calibrate-2HZFACIX.js +0 -43
  187. package/dist/capture-NMDIPC6S.js +0 -39
  188. package/dist/check-KNQV7GLU.js +0 -33
  189. package/dist/check-OH4KKXP3.js +0 -33
  190. package/dist/check-PRAMKQCI.js +0 -47
  191. package/dist/chunk-4F5WGZRP.js.map +0 -1
  192. package/dist/chunk-4H3IOF52.js +0 -3200
  193. package/dist/chunk-4H3IOF52.js.map +0 -1
  194. package/dist/chunk-5CJ3P5O3.js.map +0 -1
  195. package/dist/chunk-A633WB3N.js.map +0 -1
  196. package/dist/chunk-ACJUZFRT.js.map +0 -1
  197. package/dist/chunk-B2242FYO.js.map +0 -1
  198. package/dist/chunk-CT5WSUUZ.js +0 -441
  199. package/dist/chunk-CT5WSUUZ.js.map +0 -1
  200. package/dist/chunk-DNF42MK7.js +0 -326
  201. package/dist/chunk-DNF42MK7.js.map +0 -1
  202. package/dist/chunk-E6JYRVR5.js.map +0 -1
  203. package/dist/chunk-ISDFYXLA.js.map +0 -1
  204. package/dist/chunk-JPXC62SD.js.map +0 -1
  205. package/dist/chunk-LPJ3IB26.js.map +0 -1
  206. package/dist/chunk-MPXMQGJI.js.map +0 -1
  207. package/dist/chunk-O4O6JOGD.js.map +0 -1
  208. package/dist/chunk-ODSIHEIW.js.map +0 -1
  209. package/dist/chunk-OVUQNM7Y.js.map +0 -1
  210. package/dist/chunk-QSPH4F56.js.map +0 -1
  211. package/dist/chunk-SIREOHLW.js +0 -233
  212. package/dist/chunk-SIREOHLW.js.map +0 -1
  213. package/dist/chunk-SSQZB5SQ.js.map +0 -1
  214. package/dist/chunk-SUTY4VCZ.js.map +0 -1
  215. package/dist/chunk-UP6NBQ62.js +0 -2
  216. package/dist/chunk-UVC3BUKU.js.map +0 -1
  217. package/dist/chunk-WI3PPQQX.js +0 -164
  218. package/dist/chunk-WI3PPQQX.js.map +0 -1
  219. package/dist/chunk-YM2W43DI.js.map +0 -1
  220. package/dist/chunk-YYWZ2MSL.js.map +0 -1
  221. package/dist/chunk-ZPLVANY2.js +0 -15
  222. package/dist/chunk-ZPLVANY2.js.map +0 -1
  223. package/dist/cli-K5QWXB7H.js.map +0 -1
  224. package/dist/cli-PCZ7XNCO.js.map +0 -1
  225. package/dist/cli-TM2JCTQT.js +0 -84
  226. package/dist/cli-TM2JCTQT.js.map +0 -1
  227. package/dist/github-BUK5CVQW.js +0 -27
  228. package/dist/github-CMAZWS76.js +0 -31
  229. package/dist/github-NXR4QMMM.js +0 -35
  230. package/dist/json-NZSGRYOE.js +0 -34
  231. package/dist/lint-VUYM5PPM.js +0 -35
  232. package/dist/list-4JGOXLOZ.js +0 -33
  233. package/dist/list-LTF25DQE.js +0 -33
  234. package/dist/list-WD3TZS5R.js +0 -36
  235. package/dist/pretty-R67YU6TU.js +0 -35
  236. package/dist/run-BDGYRUXJ.js +0 -39
  237. package/dist/sarif-EHAMGCVR.js +0 -36
  238. package/dist/sarif-GJYLRXLS.js +0 -30
  239. package/dist/strategy-UKRA6WO4.js.map +0 -1
  240. package/dist/validate-CDTKFZUV.js.map +0 -1
  241. /package/dist/{batch-J626LZ22.js.map → batch-C3NN2YXB.js.map} +0 -0
  242. /package/dist/{build-AYLD6V6Y.js.map → build-CEVEAHN7.js.map} +0 -0
  243. /package/dist/{calibrate-2HZFACIX.js.map → calibrate-CSKPY5AK.js.map} +0 -0
  244. /package/dist/{capture-NMDIPC6S.js.map → capture-3HDBIHH6.js.map} +0 -0
  245. /package/dist/{check-KNQV7GLU.js.map → check-555TCJGF.js.map} +0 -0
  246. /package/dist/{check-OH4KKXP3.js.map → check-KGJBV42O.js.map} +0 -0
  247. /package/dist/{check-PRAMKQCI.js.map → check-KXWHSCCR.js.map} +0 -0
  248. /package/dist/{check-RCSQARQE.js.map → check-MZSXCS2M.js.map} +0 -0
  249. /package/dist/{check-PQ7S5I3I.js.map → check-QNHLTYPN.js.map} +0 -0
  250. /package/dist/{chunk-YIHIRMXN.js.map → chunk-2VLZDU4E.js.map} +0 -0
  251. /package/dist/{chunk-D54BQM5P.js.map → chunk-37Q7WEJJ.js.map} +0 -0
  252. /package/dist/{chunk-P5DWBG6T.js.map → chunk-46MMIJWR.js.map} +0 -0
  253. /package/dist/{chunk-P6XZ44C2.js.map → chunk-4LYVTR2T.js.map} +0 -0
  254. /package/dist/{chunk-6FY573GB.js.map → chunk-64DULZIG.js.map} +0 -0
  255. /package/dist/{chunk-TAJYMXMM.js.map → chunk-6SVHI2U6.js.map} +0 -0
  256. /package/dist/{chunk-C5BXSQDO.js.map → chunk-A67EJ3J6.js.map} +0 -0
  257. /package/dist/{chunk-2GTR24SA.js.map → chunk-BLDL23RY.js.map} +0 -0
  258. /package/dist/{chunk-CFMI74TP.js.map → chunk-BZ74YUYE.js.map} +0 -0
  259. /package/dist/{chunk-NDPQ2GQ4.js.map → chunk-CHTSA3YR.js.map} +0 -0
  260. /package/dist/{chunk-Z2T5U7HN.js.map → chunk-CQTESLC5.js.map} +0 -0
  261. /package/dist/{chunk-245W2Q7C.js.map → chunk-D4BGNAN5.js.map} +0 -0
  262. /package/dist/{chunk-XPO655IX.js.map → chunk-E3HYSNS6.js.map} +0 -0
  263. /package/dist/{chunk-MJZK7G4B.js.map → chunk-FXE5K56B.js.map} +0 -0
  264. /package/dist/{chunk-QGBNWEWS.js.map → chunk-IC3FJWIF.js.map} +0 -0
  265. /package/dist/{chunk-OQR3VVAX.js.map → chunk-IDDRHB7E.js.map} +0 -0
  266. /package/dist/{chunk-OXCWCEVV.js.map → chunk-JA7DWOVV.js.map} +0 -0
  267. /package/dist/{chunk-HGUCJ3K3.js.map → chunk-JVE5YQN4.js.map} +0 -0
  268. /package/dist/{chunk-RA2BER5P.js.map → chunk-MR5JWMC2.js.map} +0 -0
  269. /package/dist/{chunk-JCTHXG33.js.map → chunk-NHOGTAPK.js.map} +0 -0
  270. /package/dist/{chunk-VM7VAFJW.js.map → chunk-NVYDWVXN.js.map} +0 -0
  271. /package/dist/{chunk-MTMR65NM.js.map → chunk-OHMLEITS.js.map} +0 -0
  272. /package/dist/{chunk-NUQF5F5J.js.map → chunk-PNDEKFF3.js.map} +0 -0
  273. /package/dist/{chunk-S2HW3CBF.js.map → chunk-PX7OTUNU.js.map} +0 -0
  274. /package/dist/{chunk-CXL6ES7O.js.map → chunk-SCKVDD4E.js.map} +0 -0
  275. /package/dist/{chunk-ZB3OFSRB.js.map → chunk-TJYJ4BNK.js.map} +0 -0
  276. /package/dist/{chunk-N3DYE6LJ.js.map → chunk-TWYJ2TVS.js.map} +0 -0
  277. /package/dist/{chunk-BM43RJIS.js.map → chunk-UQI463L3.js.map} +0 -0
  278. /package/dist/{chunk-FIR2MAGS.js.map → chunk-V27DOGAO.js.map} +0 -0
  279. /package/dist/{chunk-4DFBBU4A.js.map → chunk-VSHMXMBZ.js.map} +0 -0
  280. /package/dist/{chunk-ROZDHPKA.js.map → chunk-VZSATUI7.js.map} +0 -0
  281. /package/dist/{chunk-EOJEPEYY.js.map → chunk-W5OZMYMX.js.map} +0 -0
  282. /package/dist/{chunk-KERICP5Y.js.map → chunk-WW4JATBJ.js.map} +0 -0
  283. /package/dist/{chunk-TDG2S5UE.js.map → chunk-XQKRD5A3.js.map} +0 -0
  284. /package/dist/{chunk-GGTCSMNX.js.map → chunk-XSP3TUFN.js.map} +0 -0
  285. /package/dist/{chunk-WRWW6SGG.js.map → chunk-YB3KD5RI.js.map} +0 -0
  286. /package/dist/{chunk-FKELQCGN.js.map → chunk-ZKIXGFID.js.map} +0 -0
  287. /package/dist/{chunk-BY4THWAQ.js.map → chunk-ZT3ERG4B.js.map} +0 -0
  288. /package/dist/{chunk-LXJ4FZ7Y.js.map → chunk-ZW4YASUB.js.map} +0 -0
  289. /package/dist/{chunk-UP6NBQ62.js.map → cli-4QAH3DBX.js.map} +0 -0
  290. /package/dist/{cli-6J4P5MLU.js.map → cli-JE4LG35H.js.map} +0 -0
  291. /package/dist/{cli-4RTNEVVX.js.map → config-2YJPJ36T.js.map} +0 -0
  292. /package/dist/{config-7I5CHHRZ.js.map → github-64ZVAUIT.js.map} +0 -0
  293. /package/dist/{github-BUK5CVQW.js.map → github-ARGPMQD2.js.map} +0 -0
  294. /package/dist/{github-CMAZWS76.js.map → github-YHJABBUI.js.map} +0 -0
  295. /package/dist/{github-NXR4QMMM.js.map → host-JT27OWTC.js.map} +0 -0
  296. /package/dist/{host-YSTYO5DX.js.map → json-CVOVXB7O.js.map} +0 -0
  297. /package/dist/{json-7Z2IFGB3.js.map → json-QNGJFUY2.js.map} +0 -0
  298. /package/dist/{json-NZSGRYOE.js.map → lint-OQGB4DWJ.js.map} +0 -0
  299. /package/dist/{lint-VUYM5PPM.js.map → list-EDAB7X5Y.js.map} +0 -0
  300. /package/dist/{list-4JGOXLOZ.js.map → list-OQ3IYV2W.js.map} +0 -0
  301. /package/dist/{list-LTF25DQE.js.map → list-PN6JKYNX.js.map} +0 -0
  302. /package/dist/{list-WD3TZS5R.js.map → page-TPNMHL27.js.map} +0 -0
  303. /package/dist/{page-A2Y4ZMV4.js.map → pretty-EZ2NFU3C.js.map} +0 -0
  304. /package/dist/{pretty-D3DZFC5U.js.map → pretty-HO2LYG5N.js.map} +0 -0
  305. /package/dist/{pretty-R67YU6TU.js.map → pretty-K3M4AW2D.js.map} +0 -0
  306. /package/dist/{pretty-SFFOMSG5.js.map → provider-YWNTTQPA.js.map} +0 -0
  307. /package/dist/{release-VHHASAG7.js.map → release-EFLQT3FW.js.map} +0 -0
  308. /package/dist/{provider-JY2I3VLF.js.map → reporters-4R2E7PRJ.js.map} +0 -0
  309. /package/dist/{reporters-TO7Q6JYF.js.map → reporters-YVLLFBO5.js.map} +0 -0
  310. /package/dist/{reporters-UTLJVSWX.js.map → run-H4BOR2FR.js.map} +0 -0
  311. /package/dist/{run-BDGYRUXJ.js.map → sarif-GWHWJJFP.js.map} +0 -0
  312. /package/dist/{sarif-EHAMGCVR.js.map → sarif-SJFVSOBV.js.map} +0 -0
  313. /package/dist/{sarif-GJYLRXLS.js.map → sarif-YBFD5OUL.js.map} +0 -0
  314. /package/dist/{sarif-IAGMXA6C.js.map → validate-6R5UBDGU.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/tracevals/trace/claude.ts","../src/tracevals/trace/detect.ts","../src/tracevals/judge/render.ts"],"sourcesContent":["/**\n * Claude Code trace adapter. Parses both dialects behind one entry point:\n * session files (~/.claude/projects/<slug>/*.jsonl) and legacy `claude -p`\n * stream-json transcripts. Produces the normalized Trace model.\n */\nimport { readdir, readFile } from \"node:fs/promises\";\nimport { basename, dirname, join, resolve } from \"node:path\";\nimport { detectContentFormat } from \"./detect.js\";\nimport {\n applyAvailabilityRecord,\n foldBranchAvailability,\n newAvailability,\n newReplay,\n remapAvailability,\n} from \"./availability.js\";\nimport type {\n AgentSpawn,\n FileAccess,\n SkillInvocation,\n SubagentBranch,\n ToolCall,\n Trace,\n TraceEvent,\n} from \"./types.js\";\n\ntype Rec = Record<string, unknown>;\n\nexport async function parseTraceFile(filePath: string): Promise<Trace> {\n const absolute = resolve(filePath);\n const content = await readFile(absolute, \"utf-8\");\n const trace = parseTraceContent(content, absolute);\n await mergeSidecarBranches(trace, absolute);\n return trace;\n}\n\nexport function parseTraceContent(content: string, filePath: string): Trace {\n const format = detectContentFormat(content);\n const { records, unparseable } = parseLines(content);\n const trace =\n format === \"claude-session\"\n ? parseSession(records, filePath)\n : parseStream(records, filePath);\n if (unparseable > 0) {\n trace.warnings.push(\n `${unparseable} unparseable JSONL line(s) were skipped`,\n );\n }\n return trace;\n}\n\nfunction parseLines(content: string): { records: Rec[]; unparseable: number } {\n const records: Rec[] = [];\n let unparseable = 0;\n for (const line of content.split(\"\\n\")) {\n const trimmed = line.trim();\n if (!trimmed) continue;\n try {\n const rec = JSON.parse(trimmed) as unknown;\n if (typeof rec === \"object\" && rec !== null) records.push(rec as Rec);\n else unparseable += 1;\n } catch {\n unparseable += 1;\n }\n }\n return { records, unparseable };\n}\n\n/** Record types that carry no conversation content. */\nconst SESSION_META_TYPES = new Set([\n \"queue-operation\",\n \"attachment\",\n \"last-prompt\",\n \"custom-title\",\n \"summary\",\n \"mode\",\n \"pr-link\",\n]);\n\nconst COMMAND_NAME_RE = /<command-name>([^<]+)<\\/command-name>/;\nconst COMMAND_ARGS_RE = /<command-args>([^<]*)<\\/command-args>/;\n\n/**\n * An `Agent` tool_use waiting for the sidechain records it spawned. `claimed`\n * disambiguates the case where one assistant turn spawns several subagents at\n * once and their records interleave.\n */\ninterface PendingBranch {\n toolUseId: string;\n prompt?: string;\n claimed: boolean;\n}\n\n/**\n * Subagent branch attribution. A sidechain record chains by `parentUuid` back\n * to the assistant record that carried the spawning `Agent` tool_use, so that\n * tool_use id is the branch identity. Records are written parent-first, which\n * is what lets one forward pass resolve the whole tree.\n */\ninterface BranchIndex {\n /** Agent spawns keyed by the uuid of the assistant record carrying them. */\n spawns: Map<string, PendingBranch[]>;\n /** Branch already resolved for a record, so its children inherit it. */\n resolved: Map<string, string>;\n}\n\n/** What a single on-disk record contributes to every event it produces. */\ninterface RecordContext {\n sidechain: boolean;\n timestamp?: string;\n branchId?: string;\n /** Session records only: lets `Agent` spawns be indexed by record uuid. */\n uuid?: string;\n branches?: BranchIndex;\n}\n\nfunction newTrace(filePath: string): Trace {\n return {\n source: \"claude-code\",\n file: filePath,\n cwd: \"\",\n events: [],\n toolCalls: [],\n skillInvocations: [],\n agentSpawns: [],\n subagentBranches: [],\n availability: newAvailability(),\n fileAccesses: [],\n userMessages: [],\n assistantTexts: [],\n turnCount: 0,\n warnings: [],\n };\n}\n\n/** Append an event, stamping its own ordinal, and hand that ordinal back. */\nfunction pushEvent(trace: Trace, event: Omit<TraceEvent, \"index\">): number {\n const index = trace.events.length;\n trace.events.push({ ...event, index });\n return index;\n}\n\n/** A sidechain root's message is the Agent prompt verbatim — the tiebreak. */\nfunction plainMessageText(rec: Rec): string | undefined {\n const content = (rec.message as Rec | undefined)?.content;\n return typeof content === \"string\" ? content : undefined;\n}\n\nfunction resolveBranch(\n branches: BranchIndex,\n parentUuid: unknown,\n rootText: string | undefined,\n): string | undefined {\n if (typeof parentUuid !== \"string\") return undefined;\n const inherited = branches.resolved.get(parentUuid);\n if (inherited !== undefined) return inherited;\n const pending = branches.spawns.get(parentUuid);\n if (pending === undefined || pending.length === 0) return undefined;\n const byPrompt =\n rootText !== undefined\n ? pending.find((b) => !b.claimed && b.prompt === rootText)\n : undefined;\n const branch = byPrompt ?? pending.find((b) => !b.claimed) ?? pending[0];\n if (branch === undefined) return undefined;\n branch.claimed = true;\n return branch.toolUseId;\n}\n\nfunction parseSession(records: Rec[], filePath: string): Trace {\n const trace = newTrace(filePath);\n const branches: BranchIndex = { spawns: new Map(), resolved: new Map() };\n // Availability is replayed in record order: `isInitial` replaces the set,\n // a delta adds or removes, and each entry keeps the ordinal it changed at\n // (ADR 01016).\n const availability = newReplay();\n // Resolving a continuation pointer needs the whole file's uuids up front.\n const uuids = new Set<string>();\n for (const rec of records) {\n if (typeof rec.uuid === \"string\") uuids.add(rec.uuid);\n }\n // A leading `summary` record describes the *previous* session and its\n // `leafUuid` names a record there; a pointer that resolves in this file is\n // this session's own summary, not a continuation.\n const continuations: string[] = [];\n let sawMessage = false;\n let compactions = 0;\n let inputTokens = 0;\n let outputTokens = 0;\n let sawUsage = false;\n\n for (const rec of records) {\n const type = rec.type as string | undefined;\n const timestamp = rec.timestamp as string | undefined;\n if (timestamp) {\n trace.startedAt ??= timestamp;\n trace.endedAt = timestamp;\n }\n if (rec.sessionId) trace.sessionId ??= rec.sessionId as string;\n if (rec.subtype === \"compact_boundary\") compactions += 1;\n\n if (type !== undefined && SESSION_META_TYPES.has(type)) {\n if (\n type === \"summary\" &&\n !sawMessage &&\n typeof rec.leafUuid === \"string\" &&\n !uuids.has(rec.leafUuid)\n ) {\n continuations.push(rec.leafUuid);\n }\n const index = pushEvent(trace, { kind: \"meta\", timestamp, raw: rec });\n // An `attachment` record is bookkeeping to every other consumer, but the\n // listing ones are the only record of what the session was *offered*.\n if (\n type === \"attachment\" &&\n applyAvailabilityRecord(availability, rec.attachment, index)\n ) {\n availability.roster.recorded = true;\n }\n continue;\n }\n\n const sidechain = rec.isSidechain === true;\n // cwd/gitBranch follow the latest non-sidechain message record.\n if (!sidechain && typeof rec.cwd === \"string\") trace.cwd = rec.cwd;\n if (!sidechain && typeof rec.gitBranch === \"string\") {\n trace.gitBranch = rec.gitBranch;\n }\n\n const context: RecordContext = { sidechain, timestamp, branches };\n if (typeof rec.uuid === \"string\") context.uuid = rec.uuid;\n if (sidechain) {\n const branchId = resolveBranch(\n branches,\n rec.parentUuid,\n plainMessageText(rec),\n );\n if (branchId !== undefined) {\n context.branchId = branchId;\n if (context.uuid) branches.resolved.set(context.uuid, branchId);\n }\n }\n\n const message = rec.message as Rec | undefined;\n if (type === \"user\" && message) {\n sawMessage = true;\n handleUserMessage(trace, message, context, rec);\n } else if (type === \"assistant\" && message) {\n sawMessage = true;\n const usage = handleAssistantMessage(trace, message, context, rec);\n if (usage && !sidechain) {\n inputTokens += usage.input;\n outputTokens += usage.output;\n sawUsage = true;\n }\n } else {\n pushEvent(trace, { kind: \"system\", timestamp, raw: rec });\n }\n }\n\n if (sawUsage) trace.usage = { inputTokens, outputTokens };\n // Grading a fragment as if it were the whole session is a false verdict, so\n // both ways of losing earlier turns are reported rather than assumed away.\n for (const leaf of continuations) {\n trace.warnings.push(\n `this trace is a fragment of a longer session: it resumes an earlier ` +\n `one recorded elsewhere (summary leafUuid ${leaf} is not in this ` +\n `file), so evals see only the turns recorded here`,\n );\n }\n if (compactions > 0) {\n trace.warnings.push(\n `the conversation was compacted ${compactions} time(s): the agent ` +\n `stopped seeing the turns before each boundary, so early transcript ` +\n `content is not what it was working from`,\n );\n }\n trace.availability = availability.roster;\n trace.subagentBranches = buildBranches(trace);\n return trace;\n}\n\n/**\n * Derive the branch list from whatever branch identity the events already\n * carry. Runs for inline sidechains at parse time and again after sidecar\n * transcripts are spliced in, so both shapes produce the same descriptions.\n */\nfunction buildBranches(\n trace: Trace,\n sidecars: Map<string, Partial<SubagentBranch>> = new Map(),\n): SubagentBranch[] {\n const ranges = new Map<string, { min: number; max: number }>();\n for (const event of trace.events) {\n const id = event.branchId;\n if (id === undefined) continue;\n const range = ranges.get(id);\n if (range === undefined) ranges.set(id, { min: event.index, max: event.index });\n else range.max = Math.max(range.max, event.index);\n }\n if (ranges.size === 0) return [];\n\n const spawnFor = new Map<string, AgentSpawn>();\n for (const spawn of trace.agentSpawns) {\n if (spawn.toolUseId) spawnFor.set(spawn.toolUseId, spawn);\n }\n\n // A branch's parent is whichever branch owns its spawning `Agent` call.\n const parentOf = new Map<string, string | undefined>();\n for (const id of ranges.keys()) {\n const spawn = spawnFor.get(id);\n parentOf.set(\n id,\n spawn ? trace.events[spawn.index]?.branchId : undefined,\n );\n }\n const depthOf = (id: string): number => {\n let depth = 1;\n let cursor = parentOf.get(id);\n const seen = new Set<string>([id]);\n while (cursor !== undefined && !seen.has(cursor)) {\n seen.add(cursor);\n depth += 1;\n cursor = parentOf.get(cursor);\n }\n return depth;\n };\n\n const branches: SubagentBranch[] = [];\n for (const [id, range] of ranges) {\n const spawn = spawnFor.get(id);\n const sidecar = sidecars.get(id);\n const branch: SubagentBranch = {\n branchId: id,\n agentType: sidecar?.agentType ?? spawn?.subagentType ?? id,\n origin: sidecar ? \"sidecar\" : \"inline\",\n spawnDepth: sidecar?.spawnDepth ?? depthOf(id),\n spawnIndex: spawn?.index ?? range.min,\n startIndex: range.min,\n endIndex: range.max + 1,\n };\n const description = sidecar?.description ?? spawn?.description;\n if (description !== undefined) branch.description = description;\n if (sidecar?.agentId) branch.agentId = sidecar.agentId;\n if (sidecar?.parentAgentId) branch.parentAgentId = sidecar.parentAgentId;\n if (sidecar?.file) branch.file = sidecar.file;\n branches.push(branch);\n }\n\n // A branch's span covers the branches nested under it, so widen deepest\n // first and every ancestor inherits the reach of its whole subtree.\n branches.sort((a, b) => b.spawnDepth - a.spawnDepth);\n const byId = new Map(branches.map((b) => [b.branchId, b]));\n for (const branch of branches) {\n const parentId = parentOf.get(branch.branchId);\n const parent = parentId === undefined ? undefined : byId.get(parentId);\n if (parent === undefined) continue;\n parent.startIndex = Math.min(parent.startIndex, branch.startIndex);\n parent.endIndex = Math.max(parent.endIndex, branch.endIndex);\n }\n branches.sort((a, b) => a.startIndex - b.startIndex);\n return branches;\n}\n\nfunction handleUserMessage(\n trace: Trace,\n message: Rec,\n context: RecordContext,\n raw: Rec,\n): void {\n const { sidechain, timestamp, branchId } = context;\n const content = message.content;\n if (typeof content === \"string\") {\n const index = pushEvent(trace, {\n kind: \"user\",\n timestamp,\n text: content,\n sidechain,\n branchId,\n raw,\n });\n if (sidechain) return;\n const command = COMMAND_NAME_RE.exec(content);\n if (command?.[1]) {\n const invocation: SkillInvocation = {\n name: command[1].replace(/^\\//, \"\"),\n via: \"command-injection\",\n index,\n };\n const args = COMMAND_ARGS_RE.exec(content)?.[1]?.trim();\n if (args) invocation.args = args;\n trace.skillInvocations.push(invocation);\n }\n trace.userMessages.push(content);\n trace.turnCount += 1;\n return;\n }\n if (Array.isArray(content)) {\n // Tool results (and mixed blocks). Text blocks alongside tool results are\n // rare; only pure text turns count as prompts.\n let hasToolResult = false;\n const texts: string[] = [];\n // `Rec | null`, because a JSON array really can hold a null and the\n // guards below are what handle it.\n for (const block of content as (Rec | null)[]) {\n if (block?.type === \"tool_result\") hasToolResult = true;\n if (block?.type === \"text\" && typeof block.text === \"string\") {\n texts.push(block.text);\n }\n }\n if (hasToolResult) {\n pushEvent(trace, {\n kind: \"tool_result\",\n timestamp,\n sidechain,\n branchId,\n raw,\n });\n return;\n }\n const text = texts.join(\"\\n\");\n pushEvent(trace, {\n kind: \"user\",\n timestamp,\n text,\n sidechain,\n branchId,\n raw,\n });\n if (!sidechain && text) {\n trace.userMessages.push(text);\n trace.turnCount += 1;\n }\n }\n}\n\nfunction handleAssistantMessage(\n trace: Trace,\n message: Rec,\n context: RecordContext,\n raw: Rec,\n): { input: number; output: number } | undefined {\n const { sidechain, timestamp, branchId } = context;\n if (!sidechain && typeof message.model === \"string\") {\n trace.model ??= message.model;\n }\n const content = message.content;\n if (Array.isArray(content)) {\n for (const block of content as (Rec | null)[]) {\n if (block?.type === \"text\" && typeof block.text === \"string\") {\n pushEvent(trace, {\n kind: \"assistant\",\n timestamp,\n text: block.text,\n sidechain,\n branchId,\n raw,\n });\n if (!sidechain) trace.assistantTexts.push(block.text);\n } else if (block?.type === \"tool_use\") {\n extractToolUse(trace, block, context);\n }\n }\n }\n const usage = message.usage as Rec | undefined;\n if (usage) {\n return {\n input: typeof usage.input_tokens === \"number\" ? usage.input_tokens : 0,\n output: typeof usage.output_tokens === \"number\" ? usage.output_tokens : 0,\n };\n }\n return undefined;\n}\n\nfunction extractToolUse(\n trace: Trace,\n block: Rec,\n context: RecordContext,\n): void {\n const { sidechain, timestamp, branchId } = context;\n const name = block.name as string;\n const input = (block.input as Rec | undefined) ?? {};\n const toolUseId = typeof block.id === \"string\" ? block.id : undefined;\n const index = pushEvent(trace, {\n kind: \"tool_call\",\n timestamp,\n toolName: name,\n sidechain,\n branchId,\n raw: block,\n });\n const call: ToolCall = { name, input, index, sidechain };\n if (timestamp) call.timestamp = timestamp;\n if (branchId) call.branchId = branchId;\n trace.toolCalls.push(call);\n\n switch (name) {\n case \"Skill\": {\n if (typeof input.skill === \"string\") {\n const invocation: SkillInvocation = {\n name: input.skill,\n via: \"skill-tool\",\n index,\n };\n if (toolUseId) invocation.toolUseId = toolUseId;\n if (typeof input.args === \"string\" && input.args) {\n invocation.args = input.args;\n }\n trace.skillInvocations.push(invocation);\n }\n break;\n }\n case \"Agent\": {\n if (typeof input.subagent_type === \"string\") {\n const spawn: AgentSpawn = {\n subagentType: input.subagent_type,\n index,\n };\n if (typeof input.description === \"string\") {\n spawn.description = input.description;\n }\n if (toolUseId) spawn.toolUseId = toolUseId;\n trace.agentSpawns.push(spawn);\n }\n // The spawn opens a branch its sidechain records chain back to.\n if (context.branches && context.uuid && toolUseId) {\n const pending = context.branches.spawns.get(context.uuid) ?? [];\n pending.push({\n toolUseId,\n prompt: typeof input.prompt === \"string\" ? input.prompt : undefined,\n claimed: false,\n });\n context.branches.spawns.set(context.uuid, pending);\n }\n break;\n }\n case \"Read\":\n case \"Write\":\n case \"Edit\": {\n if (typeof input.file_path === \"string\") {\n const op: FileAccess[\"op\"] =\n name === \"Read\" ? \"read\" : name === \"Write\" ? \"write\" : \"edit\";\n trace.fileAccesses.push({ path: input.file_path, op, index });\n }\n break;\n }\n }\n}\n\nfunction parseStream(records: Rec[], filePath: string): Trace {\n const trace = newTrace(filePath);\n // stream-json has no sidechains, so every record shares one flat context.\n const context: RecordContext = { sidechain: false };\n let inputTokens = 0;\n let outputTokens = 0;\n let sawMessageUsage = false;\n\n for (const rec of records) {\n const type = rec.type as string | undefined;\n\n if (type === \"system\" && (rec.subtype === \"init\" || !rec.subtype)) {\n if (typeof rec.cwd === \"string\") trace.cwd = rec.cwd;\n if (typeof rec.model === \"string\") trace.model = rec.model;\n if (typeof rec.session_id === \"string\") trace.sessionId = rec.session_id;\n pushEvent(trace, { kind: \"system\", raw: rec });\n continue;\n }\n\n if (type === \"assistant\" || type === \"user\") {\n const message = (rec.message as Rec | undefined) ?? rec;\n if (type === \"assistant\") {\n const usage = handleAssistantMessage(trace, message, context, rec);\n if (usage) {\n inputTokens += usage.input;\n outputTokens += usage.output;\n sawMessageUsage = true;\n }\n } else {\n handleUserMessage(trace, message, context, rec);\n }\n continue;\n }\n\n if (type === \"result\") {\n trace.isError = rec.is_error === true;\n if (typeof rec.num_turns === \"number\") trace.turnCount = rec.num_turns;\n const usage = rec.usage as Rec | undefined;\n const totalCost =\n typeof rec.total_cost_usd === \"number\" ? rec.total_cost_usd : undefined;\n if (usage) {\n trace.usage = {\n inputTokens:\n typeof usage.input_tokens === \"number\" ? usage.input_tokens : 0,\n outputTokens:\n typeof usage.output_tokens === \"number\" ? usage.output_tokens : 0,\n };\n if (totalCost !== undefined) trace.usage.totalCostUsd = totalCost;\n } else if (sawMessageUsage) {\n trace.usage = { inputTokens, outputTokens };\n if (totalCost !== undefined) trace.usage.totalCostUsd = totalCost;\n }\n pushEvent(trace, { kind: \"meta\", raw: rec });\n continue;\n }\n\n pushEvent(trace, { kind: \"meta\", raw: rec });\n }\n\n if (!trace.usage && sawMessageUsage) {\n trace.usage = { inputTokens, outputTokens };\n }\n return trace;\n}\n\n/* ------------------------------------------------------------------------ *\n * Sidecar subagent transcripts (ADR 01014)\n *\n * Current Claude Code no longer writes subagent turns into the session file.\n * It writes each branch to `<session>/subagents/agent-<id>.jsonl` beside an\n * `agent-<id>.meta.json` naming the `Agent` tool_use that spawned it, so the\n * join is exact rather than heuristic. Every branch is spliced into\n * `trace.events` immediately after that spawning call, which keeps a branch\n * (and any branch nested inside it) contiguous and keeps `index` a gap-free\n * ordinal over the merged list.\n * ------------------------------------------------------------------------ */\n\n/** `agent-<id>.meta.json`. Every member is optional in real stores. */\ninterface SidecarMeta {\n agentType?: string;\n description?: string;\n toolUseId?: string;\n parentAgentId?: string;\n spawnDepth?: number;\n}\n\n/** One transcript to splice: the base session file, or a loaded sidecar. */\ninterface MergeSource {\n id: string;\n events: TraceEvent[];\n toolCalls: ToolCall[];\n fileAccesses: FileAccess[];\n skillInvocations: SkillInvocation[];\n agentSpawns: AgentSpawn[];\n}\n\ninterface LoadedSidecar {\n agentId: string;\n file: string;\n meta: SidecarMeta;\n sub: Trace;\n source: MergeSource;\n}\n\nconst AGENT_META_RE = /^agent-(.+)\\.meta\\.json$/;\nconst AGENT_JSONL_RE = /^agent-(.+)\\.jsonl$/;\n\n/** `<dir>/<session>.jsonl` -> `<dir>/<session>/subagents`. */\nfunction sidecarDirFor(traceFile: string): string {\n const stem = basename(traceFile).replace(/\\.jsonl$/i, \"\");\n return join(dirname(traceFile), stem, \"subagents\");\n}\n\nfunction asSource(id: string, trace: Trace): MergeSource {\n return {\n id,\n events: trace.events,\n toolCalls: trace.toolCalls,\n fileAccesses: trace.fileAccesses,\n skillInvocations: trace.skillInvocations,\n agentSpawns: trace.agentSpawns,\n };\n}\n\n/**\n * Every record in one sidecar carries the same `agentId`, so the whole file is\n * one branch and that file-level fact overrides anything inferred inside it.\n * It has to: `isSidechain` is uniformly true within a sidecar, so the inline\n * `parentUuid` heuristic would hand this agent's own later turns to a nested\n * `Agent` call whose records actually live in a different file.\n */\nfunction stampBranch(sub: Trace, branchId: string): void {\n for (const event of sub.events) {\n event.sidechain = true;\n event.branchId = branchId;\n }\n for (const call of sub.toolCalls) {\n call.sidechain = true;\n call.branchId = branchId;\n }\n}\n\n/**\n * Read every `agent-*.meta.json` beside a session file and parse its\n * transcript. A directory that is not there is the ordinary case and says\n * nothing; anything else that goes wrong becomes a warning (ADR 01003).\n */\nasync function loadSidecars(\n dir: string,\n trace: Trace,\n): Promise<LoadedSidecar[]> {\n let names: string[];\n try {\n names = await readdir(dir);\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code;\n if (code !== \"ENOENT\" && code !== \"ENOTDIR\") {\n trace.warnings.push(\n `could not read the subagent transcript directory ${dir} ` +\n `(${code ?? \"unknown error\"}), so subagent turns are missing here`,\n );\n }\n return [];\n }\n\n const metas = new Set<string>();\n const transcripts = new Set<string>();\n for (const name of names) {\n const meta = AGENT_META_RE.exec(name);\n if (meta?.[1] !== undefined) {\n metas.add(meta[1]);\n continue;\n }\n const jsonl = AGENT_JSONL_RE.exec(name);\n if (jsonl?.[1] !== undefined) transcripts.add(jsonl[1]);\n }\n for (const orphan of [...transcripts].sort()) {\n if (!metas.has(orphan)) {\n trace.warnings.push(\n `subagent transcript agent-${orphan}.jsonl has no ` +\n `agent-${orphan}.meta.json, so it names no Agent spawn and was ` +\n `not merged`,\n );\n }\n }\n\n const loaded: LoadedSidecar[] = [];\n for (const agentId of [...metas].sort()) {\n let meta: SidecarMeta;\n try {\n const raw = await readFile(\n join(dir, `agent-${agentId}.meta.json`),\n \"utf-8\",\n );\n const parsed: unknown = JSON.parse(raw);\n // An array is `typeof \"object\"` too, and would merge with every member\n // undefined while the warning below never fired.\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n throw new Error(\"shape\");\n }\n meta = parsed;\n } catch {\n trace.warnings.push(\n `subagent metadata agent-${agentId}.meta.json is unreadable or not ` +\n `an object, so that branch was not merged`,\n );\n continue;\n }\n const file = join(dir, `agent-${agentId}.jsonl`);\n let sub: Trace;\n try {\n sub = parseTraceContent(await readFile(file, \"utf-8\"), file);\n } catch {\n trace.warnings.push(\n `subagent transcript agent-${agentId}.jsonl is missing or ` +\n `unreadable, so that branch was not merged`,\n );\n continue;\n }\n for (const warning of sub.warnings) {\n trace.warnings.push(`subagent ${meta.agentType ?? agentId}: ${warning}`);\n }\n loaded.push({ agentId, file, meta, sub, source: asSource(agentId, sub) });\n }\n return loaded;\n}\n\nasync function mergeSidecarBranches(\n trace: Trace,\n traceFile: string,\n): Promise<void> {\n const loaded = await loadSidecars(sidecarDirFor(traceFile), trace);\n if (loaded.length === 0) return;\n\n const base = asSource(\"\", trace);\n const sources = new Map<string, MergeSource>([[\"\", base]]);\n // Which transcript holds the `Agent` call a branch hangs off, and where in\n // that transcript. A depth-2 branch's spawn lives inside a depth-1 sidecar,\n // never in the session file, so ascending depth is what makes the join work.\n const spawnOwner = new Map<string, { sourceId: string; local: number }>();\n const registerSpawns = (source: MergeSource): void => {\n for (const spawn of source.agentSpawns) {\n if (spawn.toolUseId !== undefined) {\n spawnOwner.set(spawn.toolUseId, {\n sourceId: source.id,\n local: spawn.index,\n });\n }\n }\n };\n registerSpawns(base);\n\n // Ownership is resolved **iteratively**, not in one depth-sorted pass.\n //\n // The pass assumed `meta.spawnDepth` was always there, but `SidecarMeta`\n // documents every member as optional — and with the depths equal the order\n // fell to the agent-id tiebreak, so a depth-2 branch whose id happened to\n // sort first was visited before its parent had registered the `Agent` call\n // it hangs off, and was discarded with a warning. Renaming the same file\n // made it merge. Repeating until nothing new attaches reaches every branch\n // whose owner is reachable at all, whatever the metadata says.\n const children = new Map<string, LoadedSidecar[]>();\n const attached: Array<{ sidecar: LoadedSidecar; branchId: string }> = [];\n // Byte comparison, not `localeCompare`: sibling modules already sort this\n // way so the ubuntu and windows CI legs order reports identically.\n const pending = [...loaded].sort(\n (a, b) =>\n (a.meta.spawnDepth ?? 1) - (b.meta.spawnDepth ?? 1) ||\n (a.agentId < b.agentId ? -1 : a.agentId > b.agentId ? 1 : 0),\n );\n let progress = true;\n while (progress) {\n progress = false;\n for (let i = 0; i < pending.length; i += 1) {\n const sidecar = pending[i] as LoadedSidecar;\n const branchId = sidecar.meta.toolUseId;\n const owner = branchId === undefined ? undefined : spawnOwner.get(branchId);\n if (branchId === undefined || owner === undefined) continue;\n pending.splice(i, 1);\n i -= 1;\n progress = true;\n stampBranch(sidecar.sub, branchId);\n sources.set(sidecar.agentId, sidecar.source);\n const key = `${owner.sourceId}\\u0000${owner.local}`;\n children.set(key, [...(children.get(key) ?? []), sidecar]);\n registerSpawns(sidecar.source);\n attached.push({ sidecar, branchId });\n }\n }\n // Whatever is left names an `Agent` call no reachable transcript makes.\n for (const sidecar of pending) {\n trace.warnings.push(\n `subagent transcript agent-${sidecar.agentId}.jsonl names Agent call ` +\n `${sidecar.meta.toolUseId ?? \"(none recorded)\"}, which is not in this ` +\n `trace, so that branch was not merged`,\n );\n }\n if (attached.length === 0) return;\n\n // Depth-first assembly: a transcript's own events in order, and after each\n // one the whole subtree of any branch that event spawned.\n const slots: Array<{ sourceId: string; local: number }> = [];\n const emit = (sourceId: string): void => {\n const source = sources.get(sourceId);\n if (source === undefined) return;\n for (let local = 0; local < source.events.length; local += 1) {\n slots.push({ sourceId, local });\n for (const kid of children.get(`${sourceId}\\u0000${local}`) ?? []) {\n emit(kid.agentId);\n }\n }\n };\n emit(\"\");\n\n const remap = new Map<string, number[]>();\n slots.forEach((slot, final) => {\n const row = remap.get(slot.sourceId) ?? [];\n row[slot.local] = final;\n remap.set(slot.sourceId, row);\n });\n const finalIndex = (sourceId: string, local: number): number =>\n remap.get(sourceId)?.[local] ?? local;\n\n trace.events = slots.map((slot, final) => {\n const event = sources.get(slot.sourceId)?.events[slot.local];\n return { ...(event as TraceEvent), index: final };\n });\n\n const gather = <T extends { index: number }>(\n pick: (source: MergeSource) => T[],\n ): T[] =>\n [...sources.values()]\n .flatMap((source) =>\n pick(source).map((item) => ({\n ...item,\n index: finalIndex(source.id, item.index),\n })),\n )\n .sort((a, b) => a.index - b.index);\n\n trace.toolCalls = gather((s) => s.toolCalls);\n trace.fileAccesses = gather((s) => s.fileAccesses);\n trace.skillInvocations = gather((s) => s.skillInvocations);\n trace.agentSpawns = gather((s) => s.agentSpawns);\n\n // The roster's ordinals are positions in `trace.events`, which the splice\n // just renumbered. Then each branch's own roster contributes whatever the\n // session never saw elsewhere, anchored at the spawn (ADR 01016).\n trace.availability = remapAvailability(trace.availability, (index) =>\n finalIndex(\"\", index),\n );\n for (const { sidecar, branchId } of attached) {\n const owner = spawnOwner.get(branchId);\n foldBranchAvailability(\n trace.availability,\n sidecar.sub.availability,\n branchId,\n owner === undefined ? 0 : finalIndex(owner.sourceId, owner.local),\n );\n }\n\n const described = new Map<string, Partial<SubagentBranch>>();\n for (const { sidecar, branchId } of attached) {\n const info: Partial<SubagentBranch> = {\n agentId: sidecar.agentId,\n file: sidecar.file,\n };\n if (sidecar.meta.agentType) info.agentType = sidecar.meta.agentType;\n if (sidecar.meta.description) info.description = sidecar.meta.description;\n if (sidecar.meta.parentAgentId) {\n info.parentAgentId = sidecar.meta.parentAgentId;\n }\n if (typeof sidecar.meta.spawnDepth === \"number\") {\n info.spawnDepth = sidecar.meta.spawnDepth;\n }\n described.set(branchId, info);\n }\n trace.subagentBranches = buildBranches(trace, described);\n}\n","/**\n * Trace format sniffing. Session files and stream-json are both JSONL, but\n * session records carry camelCase `sessionId` (and `parentUuid` on message\n * records) while stream-json uses snake_case `session_id`.\n */\nimport { TracevalsError } from \"../types.js\";\nimport type { TraceFormat } from \"./types.js\";\n\nconst SUPPORTED =\n \"supported formats: Claude Code session files (~/.claude/projects/**.jsonl) and claude -p stream-json\";\n\n/** Detect the dialect from one JSONL line (typically the first parseable). */\nexport function detectFormat(line: string): TraceFormat {\n // Parsed as `unknown`, not asserted to an object: `JSON.parse(\"5\")` and\n // `JSON.parse(\"null\")` both succeed, and a cast here would make the guard\n // below look dead while leaving the bug.\n let rec: unknown;\n try {\n rec = JSON.parse(line);\n } catch {\n throw new TracevalsError(`trace is not JSONL (${SUPPORTED})`);\n }\n if (typeof rec !== \"object\" || rec === null) {\n throw new TracevalsError(`unrecognized trace format (${SUPPORTED})`);\n }\n if (\"parentUuid\" in rec || \"sessionId\" in rec) return \"claude-session\";\n if (\"session_id\" in rec) return \"claude-stream\";\n throw new TracevalsError(`unrecognized trace format (${SUPPORTED})`);\n}\n\n/**\n * Detect the dialect of a whole file's content: the first line that *identifies*\n * a format decides. Malformed lines and parseable-but-unidentifiable records\n * (e.g. a leading `{\"type\":\"summary\",…}`, which real session files carry) are\n * skipped, so a metadata record at the top never masks the format below it.\n */\nexport function detectContentFormat(content: string): TraceFormat {\n let sawParseable = false;\n for (const line of content.split(\"\\n\")) {\n const trimmed = line.trim();\n if (!trimmed) continue;\n let rec: unknown;\n try {\n rec = JSON.parse(trimmed);\n } catch {\n continue; // Malformed line — keep scanning.\n }\n if (typeof rec !== \"object\" || rec === null) continue;\n sawParseable = true;\n const r = rec as Record<string, unknown>;\n if (\"parentUuid\" in r || \"sessionId\" in r) return \"claude-session\";\n if (\"session_id\" in r) return \"claude-stream\";\n // Parseable but unidentifiable (summary, and other metadata records) —\n // keep scanning for a line that names the format.\n }\n throw new TracevalsError(\n sawParseable\n ? `unrecognized trace format (${SUPPORTED})`\n : `empty or unparseable trace file (${SUPPORTED})`,\n );\n}\n","/**\n * Render a trace into judge-readable text. Session files can be tens of MB,\n * so every block is capped and the whole digest is bounded by a head/tail\n * window — the opening (instructions, intent) and the ending (outcome) matter\n * most for adherence judging.\n *\n * Given an eval plan, only the turns that plan's artifact was governing are\n * rendered (ADR 01015). That is both the correct evidence to judge against and\n * a large cut in tokens: a skill's window is usually a fraction of a session.\n *\n * This is also the only place trace content is turned into text bound for a\n * third-party API, so it is where redaction happens (ADR 01020). Every block is\n * scrubbed *before* it is clipped, so truncation can never bisect a secret and\n * leave a usable prefix behind.\n */\nimport type { Trace, TraceEvent } from \"../trace/types.js\";\nimport type { EvalPlan } from \"../core/plan.js\";\nimport { windowFor, type TraceWindow } from \"../graders/util.js\";\nimport { makeRedactor } from \"./redact.js\";\n\nexport interface RenderOptions {\n /** Per-block character cap (messages, tool inputs). */\n maxBlockChars?: number;\n /** Whole-digest character cap; overflow keeps head and tail. */\n maxTotalChars?: number;\n /**\n * Extra redaction patterns, applied on top of the built-in shapes rather\n * than instead of them. Sources are compiled with the `g` flag.\n */\n redact?: string[];\n /**\n * A window cut elsewhere, such as the turn a Stop judges (proposal 0079).\n * It takes the place of the plan's window when both are given.\n */\n window?: TraceWindow;\n /**\n * The ordinal the judged turn starts at (proposal 0079). The whole session\n * is rendered, a heading marks where that turn starts, and over the cap the\n * lines before it go first, oldest first, before the turn itself is cut.\n * When the session is that one turn, nothing comes before it, so there is\n * no heading and nothing to cut first. When no event reaches it, the whole\n * session renders with no heading.\n */\n turnFrom?: number;\n /**\n * Called when `maxTotalChars` cut the digest: the header, the timeline, or\n * both. The cut is already visible as a marker in the text; this lets a\n * caller say so in a warning as well. It can be called more than once for\n * one digest, once per cut.\n */\n onTruncated?: () => void;\n}\n\nconst DEFAULTS: Required<Omit<RenderOptions, \"window\" | \"onTruncated\" | \"turnFrom\">> = {\n maxBlockChars: 2_000,\n maxTotalChars: 150_000,\n redact: [],\n};\n\n/**\n * The smallest timeline the head/tail window will ever leave.\n *\n * The cap used to be skipped outright when the header grew past it — the guard\n * was `budget > 0`, so a non-positive budget *disabled* truncation and shipped\n * the entire unclipped transcript to a third-party provider, precisely when the\n * user had asked for the tightest cap. A floor keeps truncation running; the\n * header is bounded separately so the whole digest still honours the cap.\n */\nconst MIN_TIMELINE_CHARS = 200;\n\nconst HEADER_TRUNCATED = \"\\n[... header truncated ...]\";\nconst TURN_HEADING = \"## The last turn\";\nconst TIMELINE_SHELL = \"\\n\\n## Timeline\\n\";\n\nexport function renderTrace(\n trace: Trace,\n options: RenderOptions = {},\n plan?: EvalPlan,\n): string {\n const { maxBlockChars, maxTotalChars, redact } = { ...DEFAULTS, ...options };\n const scrub = makeRedactor(redact);\n // Redact, then truncate. The other order would let a cap land mid-secret and\n // ship the surviving prefix.\n const clip = (text: string, max: number): string => {\n const safe = scrub(text);\n if (safe.length <= max) return safe;\n return `${safe.slice(0, max)} [... truncated ${safe.length - max} chars ...]`;\n };\n const window =\n options.window ?? (plan === undefined ? undefined : windowFor(trace, plan));\n // Project rules govern the whole session, so their digest is the session's —\n // byte-identical to an unscoped render, and cached as such.\n const scoped =\n window !== undefined && window.scope !== \"session\" ? window : undefined;\n const events: TraceEvent[] = scoped?.events ?? trace.events;\n\n // Scrubbed too: `cwd` and a branch name are author-supplied strings, and the\n // header is as much a thing that leaves the machine as the timeline is.\n const fullHeader = scrub(\n [\n \"# Session\",\n `source: ${trace.source}`,\n trace.model ? `model: ${trace.model}` : undefined,\n `cwd: ${trace.cwd}`,\n trace.gitBranch ? `branch: ${trace.gitBranch}` : undefined,\n scoped\n ? `scope: ${scoped.label} — ${events.length} of ${trace.events.length} session events`\n : undefined,\n // Everything below describes what the judge can actually see. On a\n // scoped render the timeline is the window, so a session-wide count here\n // reads as evidence that the rest was truncated away — the judge would\n // discount a digest that is complete for what it was asked about. The\n // session totals stay, in parentheses, because \"3 of 87\" is context the\n // window count alone does not carry.\n scoped\n ? `turns: ${scoped.turnCount} (of ${trace.turnCount} in the session)`\n : `turns: ${trace.turnCount}`,\n ((): string => {\n const used = (scoped ?? trace).skillInvocations.map((s) => s.name);\n return used.length > 0\n ? `skills used: ${used.join(\", \")}`\n : \"skills used: none\";\n })(),\n ((): string | undefined => {\n // Spawns and branches inside the window only: an agent the parent\n // session started after this skill handed over is not this artifact's\n // to answer for.\n const inWindow = new Set(events.map((e) => e.index));\n const spawns = trace.agentSpawns.filter(\n (a) => !scoped || inWindow.has(a.index),\n );\n return spawns.length > 0\n ? `agents spawned: ${spawns.map((a) => a.subagentType).join(\", \")}`\n : undefined;\n })(),\n ((): string | undefined => {\n const inWindow = new Set(events.map((e) => e.index));\n const branches = trace.subagentBranches.filter(\n (b) => !scoped || inWindow.has(b.spawnIndex),\n );\n return branches.length > 0\n ? `subagent transcripts: ${branches\n .map((b) => `${b.agentType} (depth ${b.spawnDepth})`)\n .join(\", \")}`\n : undefined;\n })(),\n ]\n .filter((line): line is string => line !== undefined)\n .join(\"\\n\"),\n );\n\n // The header lists every skill name, agent type and branch, so on a busy\n // session it can outgrow a tight cap on its own. Bound it first, leaving the\n // timeline its floor, so `maxTotalChars` stays a cap on the whole digest\n // rather than on one half of it.\n const headerRoom = Math.max(\n maxTotalChars - TIMELINE_SHELL.length - MIN_TIMELINE_CHARS,\n 0,\n );\n if (fullHeader.length > headerRoom) options.onTruncated?.();\n const header =\n fullHeader.length <= headerRoom\n ? fullHeader\n : fullHeader.slice(\n 0,\n Math.max(headerRoom - HEADER_TRUNCATED.length, 0),\n ) + HEADER_TRUNCATED;\n\n // Two concurrent subagents are indistinguishable under a flat `:sidechain`\n // tag, so each branch becomes a labelled block named for the subagent that\n // ran it. The header can fall outside the head/tail window below, so every\n // line keeps a short tag of its own as well. Inline and sidecar branches\n // render through this one path; a sidecar branch is named by its meta file's\n // `agentType`, which is the recorder's own statement of what ran.\n const branchTypes = new Map<string, string>();\n for (const spawn of trace.agentSpawns) {\n if (spawn.toolUseId) branchTypes.set(spawn.toolUseId, spawn.subagentType);\n }\n for (const branch of trace.subagentBranches) {\n branchTypes.set(branch.branchId, branch.agentType);\n }\n const label = (branchId: string): string =>\n branchTypes.get(branchId) ?? branchId;\n const callAt = new Map(trace.toolCalls.map((call) => [call.index, call]));\n\n if (scoped?.empty === true) {\n return `${header}${TIMELINE_SHELL}[no turns: ${scrub(scoped.reason ?? \"\")}]`;\n }\n\n const lines: string[] = [];\n let branch: string | undefined;\n let turnAt: number | undefined;\n for (const event of events) {\n if (turnAt === undefined && options.turnFrom !== undefined && event.index >= options.turnFrom) {\n turnAt = lines.length;\n if (turnAt > 0) lines.push(TURN_HEADING);\n }\n const tag = event.branchId\n ? `:${label(event.branchId)}`\n : event.sidechain\n ? \":sidechain\"\n : \"\";\n let line: string | undefined;\n switch (event.kind) {\n case \"user\":\n if (event.text) line = `[user${tag}] ${clip(event.text, maxBlockChars)}`;\n break;\n case \"assistant\":\n if (event.text) {\n line = `[assistant${tag}] ${clip(event.text, maxBlockChars)}`;\n }\n break;\n case \"tool_call\": {\n const call = callAt.get(event.index);\n const input = call ? JSON.stringify(call.input) : \"\";\n line = `[tool${tag}] ${event.toolName ?? call?.name ?? \"?\"} ${clip(input, Math.min(maxBlockChars, 500))}`;\n break;\n }\n default:\n break;\n }\n if (line === undefined) continue;\n if (event.branchId !== branch) {\n if (branch !== undefined) lines.push(`[/subagent ${label(branch)}]`);\n branch = event.branchId;\n if (branch !== undefined) {\n lines.push(`[subagent ${label(branch)} (${branch})]`);\n }\n }\n lines.push(line);\n }\n if (branch !== undefined) lines.push(`[/subagent ${label(branch)}]`);\n\n // Earlier turns give way first, oldest line first, so the cap reaches the\n // judged turn only once nothing before it is left.\n const budget = Math.max(\n maxTotalChars - header.length - TIMELINE_SHELL.length,\n MIN_TIMELINE_CHARS,\n );\n if (turnAt !== undefined && turnAt > 0) {\n // Measured before the scrub below, which can change a length only where a\n // label matches a secret pattern. Close enough to pick how many go. The\n // heading is kept and counted, and a turn still over budget alone is cut\n // by the head-and-tail pass below.\n let size = lines.reduce((n, l) => n + l.length + 1, -1);\n let cut = 0;\n while (cut < turnAt && size > budget) {\n size -= (lines[cut]?.length ?? 0) + 1;\n cut += 1;\n }\n if (cut > 0) {\n options.onTruncated?.();\n lines.splice(0, cut, `[... ${String(cut)} earlier lines left out ...]`);\n }\n }\n\n // One more pass over the assembled timeline. Every message and tool input\n // already went through `clip`, so this pass is the belt to that pair of\n // braces: it covers what is assembled here rather than clipped — tool names,\n // branch labels — and anything a later change adds to this loop without\n // remembering to scrub it. Redaction is idempotent, so it costs nothing.\n let timeline = scrub(lines.join(\"\\n\"));\n // The budget is a floor, never a switch: `budget > 0` used to turn\n // truncation *off* for a non-positive budget, the case where it matters most.\n if (timeline.length > budget) {\n options.onTruncated?.();\n // The marker counts against the budget, so the digest never exceeds what\n // the caller asked for. `omitted` is at most `timeline.length`, so the\n // width reserved for it is always enough.\n const marker = (omitted: number): string =>\n `\\n[... truncated ${omitted} chars of transcript ...]\\n`;\n const room = Math.max(budget - marker(timeline.length).length, 0);\n const headLen = Math.floor(room * 0.6);\n const tailLen = room - headLen;\n const omitted = timeline.length - headLen - tailLen;\n timeline = `${timeline.slice(0, headLen)}${marker(omitted)}${\n tailLen > 0 ? timeline.slice(-tailLen) : \"\"\n }`;\n }\n\n return `${header}${TIMELINE_SHELL}${timeline}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAKA,SAAS,SAAS,gBAAgB;AAClC,SAAS,UAAU,SAAS,MAAM,eAAe;;;ACEjD,IAAM,YACJ;AAGK,SAAS,aAAa,MAA2B;AAItD,MAAI;AACJ,MAAI;AACF,UAAM,KAAK,MAAM,IAAI;AAAA,EACvB,QAAQ;AACN,UAAM,IAAI,eAAe,uBAAuB,SAAS,GAAG;AAAA,EAC9D;AACA,MAAI,OAAO,QAAQ,YAAY,QAAQ,MAAM;AAC3C,UAAM,IAAI,eAAe,8BAA8B,SAAS,GAAG;AAAA,EACrE;AACA,MAAI,gBAAgB,OAAO,eAAe,IAAK,QAAO;AACtD,MAAI,gBAAgB,IAAK,QAAO;AAChC,QAAM,IAAI,eAAe,8BAA8B,SAAS,GAAG;AACrE;AAQO,SAAS,oBAAoB,SAA8B;AAChE,MAAI,eAAe;AACnB,aAAW,QAAQ,QAAQ,MAAM,IAAI,GAAG;AACtC,UAAM,UAAU,KAAK,KAAK;AAC1B,QAAI,CAAC,QAAS;AACd,QAAI;AACJ,QAAI;AACF,YAAM,KAAK,MAAM,OAAO;AAAA,IAC1B,QAAQ;AACN;AAAA,IACF;AACA,QAAI,OAAO,QAAQ,YAAY,QAAQ,KAAM;AAC7C,mBAAe;AACf,UAAM,IAAI;A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,MAAM,UAAU,OAAO,QAAQ;AACpC,eAAS,MAAM,GAAG,GAAG,UAAU,KAAK;AACpC,aAAO;AAAA,IACT;AACA,QAAI,MAAM,GAAG;AACX,cAAQ,cAAc;AACtB,YAAM,OAAO,GAAG,KAAK,QAAQ,OAAO,GAAG,CAAC,8BAA8B;AAAA,IACxE;AAAA,EACF;AAOA,MAAI,WAAW,MAAM,MAAM,KAAK,IAAI,CAAC;AAGrC,MAAI,SAAS,SAAS,QAAQ;AAC5B,YAAQ,cAAc;AAItB,UAAM,SAAS,CAACC,aACd;AAAA,iBAAoBA,QAAO;AAAA;AAC7B,UAAM,OAAO,KAAK,IAAI,SAAS,OAAO,SAAS,MAAM,EAAE,QAAQ,CAAC;AAChE,UAAM,UAAU,KAAK,MAAM,OAAO,GAAG;AACrC,UAAM,UAAU,OAAO;AACvB,UAAM,UAAU,SAAS,SAAS,UAAU;AAC5C,eAAW,GAAG,SAAS,MAAM,GAAG,OAAO,CAAC,GAAG,OAAO,OAAO,CAAC,GACxD,UAAU,IAAI,SAAS,MAAM,CAAC,OAAO,IAAI,EAC3C;AAAA,EACF;AAEA,SAAO,GAAG,MAAM,GAAG,cAAc,GAAG,QAAQ;AAC9C;","names":["branch","omitted"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/tracevals/core/config.ts","../src/tracevals/core/config-schema.json","../src/tracevals/calibrate/labels.ts","../src/tracevals/calibrate/labels-schema.json"],"sourcesContent":["/**\n * Config loading. Every knob flows config → Ajv validate → defaults → CLI\n * override (`??` at the read site) → runtime; parseConfig() fills every\n * default so downstream code never re-applies one.\n *\n * Settings live under a `tracevals:` key in `manni.config.yaml`, one file\n * shared by the whole manni family. Sibling keys belong to other tools and are\n * ignored here, so parseConfig() validates the section — never the file root.\n * Finding the file is the shared loader's job (`src/shared/config-file.ts`).\n */\nimport { Ajv2020 } from \"ajv/dist/2020.js\";\nimport configSchemaJson from \"./config-schema.json\" with { type: \"json\" };\nimport {\n FAMILY_CONFIG_NAMES,\n findConfigFileSync,\n readConfigFileSync,\n type ConfigFileOptions,\n} from \"../../shared/config-file.js\";\nimport type { CollectionConfig } from \"../../shared/collections.js\";\nimport {\n assertKnownProvider,\n type ProvidersConfig,\n} from \"../../shared/providers.js\";\nimport { compileRedactPatterns } from \"../judge/redact.js\";\nimport { JEV, JEV_OUT_OF_LOOP } from \"../judge/provider.js\";\nimport { DEFAULT_CAPTURE_DIR } from \"../capture/types.js\";\nimport { DEFAULT_LABELS_FILE } from \"../calibrate/labels.js\";\nimport { TracevalsError } from \"../types.js\";\nimport {\n configuredGrants,\n EXECUTION_GRANTS,\n isExecutionGrant,\n unknownGrantsMessage,\n type ExecutionGrant,\n} from \"../../shared/execution.js\";\n\nconst configSchema = configSchemaJson as Record<string, unknown>;\n\nexport const DEFAULT_CONFIG_FILENAME =\n FAMILY_CONFIG_NAMES[0] ?? \"manni.config.yaml\";\n\n/**\n * Top-level key holding this tool's settings inside the shared family config.\n * Sibling tools (meta, docevals) own their own keys in the same file.\n */\nexport const CONFIG_SECTION_KEY = \"tracevals\";\n\n/**\n * The section key as an error's instance path spells it. The schema describes\n * the section rather than the file, so Ajv's own paths start below it; a\n * message that said `/provider` would name a key nobody writes at the root.\n */\nconst CONFIG_SECTION_KEY_PATH = `/${CONFIG_SECTION_KEY}`;\n\n/**\n * No legacy filename. The family file is the only one read, so a file named\n * for the tool is not config however it is spelled, and nothing warns about\n * one because nothing looks for it.\n */\nconst CONFIG_FILE: ConfigFileOptions = {\n section: CONFIG_SECTION_KEY,\n legacyNames: [],\n toError: (message) => new TracevalsError(message),\n};\n\nexport interface TracevalsConfig {\n /**\n * Which provider judges, as `tracevals.provider` names it. `null` when the\n * key is absent, which defers to the family's `providers.provider`. The\n * connection settings are never here: they are `providers` below.\n */\n provider: string | null;\n /** The model within `provider`; `null` when unset. manni pins none. */\n model: string | null;\n /** The family's top-level `providers:` map, parsed by the shared loader. */\n providers: ProvidersConfig;\n /** The file as the user would name it, for messages. */\n configSource: string;\n judge: {\n ensembleRuns: number;\n temperature: number;\n zones: { autoPass: number; autoFail: number };\n cacheDir: string;\n /**\n * Ensemble runs this invocation may spend, or `null` for unbounded. A\n * cached ensemble spends none, and an eval the budget cannot cover is\n * `skipped` with the `turn budget` reason rather than dropped.\n */\n maxTurns: number | null;\n /**\n * Extra patterns scrubbed from the session digest before it reaches a\n * provider, applied *on top of* the built-in secret shapes (ADR 01020).\n * Always a list; validated for compilability at load time.\n */\n redact: string[];\n };\n render: {\n maxBlockChars: number;\n maxTotalChars: number;\n };\n /**\n * What content-authored code a run may execute: the grants it holds, every\n * one unless the operator narrows it (proposal 0075). A `command` eval runs\n * only under `frontmatter-commands`; `[]` runs none and reports them\n * `skipped`.\n */\n execution: { allow: ExecutionGrant[] };\n history: {\n file: string;\n };\n /**\n * Session manifests (ADR 01024). `capture` writes one here; `run` looks here\n * for the trace's own, and reports a `skipped` hash check when there is none.\n */\n capture: {\n /** Resolved against the project root, not the working directory. */\n dir: string;\n };\n fill: {\n /** Minimum self-reported confidence a proposal needs to be written. */\n confidenceThreshold: number;\n maxEvalsPerArtifact: number;\n temperature: number;\n cacheDir: string;\n /** Inference calls this invocation may spend, or `null` for unbounded. */\n maxTurns: number | null;\n };\n /**\n * `calibrate` — measuring the judge against a human's answers (ADR 01022).\n * The sweep grid lives here rather than behind flags because the useful\n * range is a property of a corpus, and a corpus outlives an invocation.\n */\n calibrate: {\n /** Labels sidecar, resolved against the config file's directory. */\n labels: string;\n /** Thresholds. Unset means the run measures without gating. */\n maxFalsePass?: number;\n maxFalseFail?: number;\n maxReview?: number;\n sweep: {\n ensembleRuns: number[];\n autoPass: number[];\n autoFail: number[];\n };\n };\n failOnReview: boolean;\n /**\n * Module specifiers imported before evals are planned, so a `registerGrader`\n * call from outside this package lands in time (ADR 01017). Resolved against\n * the config file's directory, in order — a later entry wins a colliding\n * kind. `--require` appends to this list rather than replacing it.\n */\n plugins: string[];\n /** List offered-but-unused artifacts in coverage, not just count them. */\n reportUnusedArtifacts: boolean;\n /**\n * Runtime evals, each turn checked against its rule sources (proposals 0079\n * and 0083). `null` when the section is absent, which keeps tracevals out of\n * every hook; `{}` puts it in play with these defaults.\n */\n runtime: RuntimeConfig | null;\n}\n\nexport interface RuntimeConfig {\n /** The in-loop judge. `null` falls back to `tracevals.provider` / `model`. */\n hook: { provider: string | null; model: string | null; runs: number };\n /** Globs of designated rule sources, in scope once read. */\n include: string[];\n /** Globs never treated as rule sources. */\n exclude: string[];\n /** Globs of files that say what to build, in scope once touched (proposal 0080). */\n plans: string[];\n}\n\n// `verbose` puts the parent schema on each error, so an unknown key can be\n// checked against the keys its section does have.\nconst ajv = new Ajv2020({ allErrors: true, verbose: true });\nconst validate = ajv.compile(configSchema);\n\n/**\n * `; did you mean \"ensembleRuns\"?` when `key` is the kebab spelling of a key\n * its section has. Only the exact counterpart: a guess at a near miss is\n * advice that can be wrong, and the kebab spelling is the one mistake a\n * reader of the frontmatter vocabulary is likely to make here.\n */\nfunction camelCaseHint(key: string, parentSchema: unknown): string {\n const camel = key.replace(/-([a-z0-9])/g, (_, c: string) => c.toUpperCase());\n if (camel === key || parentSchema === null || typeof parentSchema !== \"object\") {\n return \"\";\n }\n const properties = (parentSchema as { properties?: unknown }).properties;\n return properties !== null &&\n typeof properties === \"object\" &&\n Object.hasOwn(properties, camel)\n ? `; did you mean \"${camel}\"?`\n : \"\";\n}\n\n/**\n * The hint on the old `conformance:` section, renamed `runtime:` (proposal\n * 0083). Nothing reads the old key, so it stays an unknown key; the hint says\n * where its settings went. Only at the section root: a `conformance` key\n * nested anywhere else, as under `runtime:`, was never the old section.\n */\nfunction renamedRuntimeHint(instancePath: string, key: string): string {\n return instancePath === \"\" && key === \"conformance\" ? `; it is now \"runtime\"` : \"\";\n}\n\n/**\n * The hint on an old `provider:` object. The key used to hold a `default` and\n * a section per provider; it is now the provider's name, as `docevals.provider`\n * and `fill.provider` are, and the connection settings moved to the family's\n * top-level `providers:` map, which every tool reads. Ajv's own message says\n * it must be a string, which is true and leaves the reader to find out where\n * the settings went.\n */\nfunction movedProviderHint(instancePath: string, keyword: string): string {\n return instancePath === \"/provider\" && keyword === \"type\"\n ? `; \"provider\" is now a provider name; per-provider settings moved to the top-level providers: map`\n : \"\";\n}\n\n/**\n * The section as the schema admits it: every key optional, because\n * `parseConfig` supplies the defaults. Ajv has checked the document against\n * `config-schema.json` before it is read as this, so the one cast below is\n * where the validated document becomes a typed one.\n */\ninterface RawConfig {\n provider?: string;\n model?: string;\n judge?: {\n ensembleRuns?: number;\n temperature?: number;\n zones?: { autoPass?: number; autoFail?: number };\n cacheDir?: string;\n maxTurns?: number;\n redact?: string[];\n };\n render?: { maxBlockChars?: number; maxTotalChars?: number };\n execution?: { allow?: ExecutionGrant[] };\n history?: { file?: string };\n capture?: { dir?: string };\n fill?: {\n confidenceThreshold?: number;\n maxEvalsPerArtifact?: number;\n temperature?: number;\n cacheDir?: string;\n maxTurns?: number;\n };\n calibrate?: {\n labels?: string;\n maxFalsePass?: number;\n maxFalseFail?: number;\n maxReview?: number;\n sweep?: { ensembleRuns?: number[]; autoPass?: number[]; autoFail?: number[] };\n };\n failOnReview?: boolean;\n plugins?: string[];\n reportUnusedArtifacts?: boolean;\n runtime?: {\n hook?: { provider?: string; model?: string; runs?: number };\n include?: string[];\n exclude?: string[];\n plans?: string[];\n };\n}\n\n/** What the file the section came from carries beside it. */\nexport interface ConfigFileContext {\n /** The file as the user would name it, for messages. */\n source?: string;\n /** The file's top-level `providers:`; `{}` when it declares none. */\n providers?: ProvidersConfig;\n}\n\nexport function parseConfig(\n raw: unknown,\n file: ConfigFileContext = {},\n): TracevalsConfig {\n const source = file.source ?? DEFAULT_CONFIG_FILENAME;\n // Before the schema: Ajv's enum error names neither the value nor the\n // grants that exist, and a grant is the key where a misreading costs most.\n const unknownGrants = configuredGrants(raw).filter((g) => !isExecutionGrant(g));\n if (unknownGrants.length > 0) {\n throw new TracevalsError(`${source}: ${unknownGrantsMessage(unknownGrants)}`);\n }\n if (!validate(raw)) {\n const detail = (validate.errors ?? [])\n .map((e) => {\n // Ajv reports an unknown key against the *parent* object, so the bare\n // message (\"must NOT have additional properties\") leaves the reader to\n // diff their file against the schema to find which key it meant. Name\n // it: the common case is a removed key in an unmigrated config —\n // `judge.maxCostUsd` after the turn budget landed, say — and a\n // migration error that makes you guess is one people work around.\n const extra =\n e.keyword === \"additionalProperties\"\n ? (e.params as { additionalProperty?: string }).additionalProperty\n : undefined;\n return extra !== undefined\n ? `unknown key \"${extra}\"${camelCaseHint(extra, e.parentSchema)}${renamedRuntimeHint(e.instancePath, extra)}`\n : `${CONFIG_SECTION_KEY_PATH}${e.instancePath} ${e.message ?? \"is invalid\"}` +\n movedProviderHint(e.instancePath, e.keyword);\n })\n .join(\"; \");\n throw new TracevalsError(`${source}: ${detail}`);\n }\n const r = raw as RawConfig;\n // Checked here, with the message every other tool in the family gives, so a\n // typo is caught by every verb and not only the ones that reach a model.\n // Whether a model has a provider to own it waits for the flags: a\n // `--provider`, or the family's `providers.provider`, can supply the\n // provider a configured model needs.\n const provider = r.provider ?? null;\n if (provider !== null) {\n // jev only decides. Out of the loop a provider extracts rules and writes\n // verdicts, which are generations.\n if (provider === JEV) throw new TracevalsError(JEV_OUT_OF_LOOP);\n assertKnownProvider(provider, (message) => new TracevalsError(message));\n }\n const hookProvider = r.runtime?.hook?.provider ?? null;\n if (hookProvider !== null) {\n assertKnownProvider(hookProvider, (message) => new TracevalsError(message), { decisions: true });\n }\n const config: TracevalsConfig = {\n provider,\n model: r.model ?? null,\n providers: file.providers ?? {},\n configSource: source,\n judge: {\n ensembleRuns: r.judge?.ensembleRuns ?? 3,\n temperature: r.judge?.temperature ?? 0,\n zones: {\n autoPass: r.judge?.zones?.autoPass ?? 0.8,\n autoFail: r.judge?.zones?.autoFail ?? 0.8,\n },\n cacheDir: r.judge?.cacheDir ?? \".manni/tracevals/cache\",\n // `null`, not a number: unbounded is a state, and any number here would\n // be a ceiling nobody asked for.\n maxTurns: r.judge?.maxTurns ?? null,\n // Always a list: the render site concatenates nothing onto it, but a\n // hole here would be a special case in every consumer.\n redact: [...(r.judge?.redact ?? [])],\n },\n render: {\n maxBlockChars: r.render?.maxBlockChars ?? 2000,\n maxTotalChars: r.render?.maxTotalChars ?? 150000,\n },\n execution: { allow: [...(r.execution?.allow ?? EXECUTION_GRANTS)] },\n history: {\n file: r.history?.file ?? \".manni/tracevals/history.jsonl\",\n },\n capture: {\n // Beside the judge cache, under the state directory that already travels\n // with the project — which is what puts a manifest next to its trace in\n // the CI patterns the docs describe.\n dir: r.capture?.dir ?? DEFAULT_CAPTURE_DIR,\n },\n fill: {\n // 0.7 matches the manuscript's calibration bar for judged agreement.\n confidenceThreshold: r.fill?.confidenceThreshold ?? 0.7,\n maxEvalsPerArtifact: r.fill?.maxEvalsPerArtifact ?? 8,\n temperature: r.fill?.temperature ?? 0,\n // Separate from the judge cache: different key scheme and value shape.\n cacheDir: r.fill?.cacheDir ?? \".manni/tracevals/cache/fill\",\n maxTurns: r.fill?.maxTurns ?? null,\n },\n calibrate: {\n labels: r.calibrate?.labels ?? DEFAULT_LABELS_FILE,\n sweep: {\n // Spans the range rather than filling it: the first sweep judges the\n // corpus at the largest value here, so a wide grid is the one part of\n // calibration that does cost money.\n ensembleRuns: [...(r.calibrate?.sweep?.ensembleRuns ?? [1, 3, 5])],\n autoPass: [\n ...(r.calibrate?.sweep?.autoPass ?? [0.5, 0.6, 0.7, 0.8, 0.9, 0.95]),\n ],\n autoFail: [\n ...(r.calibrate?.sweep?.autoFail ?? [0.5, 0.6, 0.7, 0.8, 0.9, 0.95]),\n ],\n },\n },\n failOnReview: r.failOnReview ?? true,\n // Always a list, never undefined: the read site concatenates `--require`\n // onto it, and a hole there would be a special case in every caller.\n plugins: [...(r.plugins ?? [])],\n // An observation, not a gate: listing it is opt-in because a real roster\n // runs to hundreds of skills (ADR 01016).\n reportUnusedArtifacts: r.reportUnusedArtifacts ?? false,\n runtime:\n r.runtime === undefined\n ? null\n : {\n hook: {\n provider: hookProvider,\n model: r.runtime.hook?.model ?? null,\n runs: r.runtime.hook?.runs ?? 1,\n },\n include: [...(r.runtime.include ?? [])],\n exclude: [...(r.runtime.exclude ?? [])],\n plans: [...(r.runtime.plans ?? [])],\n },\n };\n // Compilability is not expressible in JSON Schema, and a pattern that cannot\n // compile must fail here rather than at the moment a digest is about to be\n // sent — a dropped redaction pattern is a silent leak.\n compileRedactPatterns(config.judge.redact);\n // Left absent rather than defaulted to a number: `0` is a meaningful limit\n // (\"no false pass at all\"), so it cannot double as \"unset\".\n for (const key of [\"maxFalsePass\", \"maxFalseFail\", \"maxReview\"] as const) {\n if (typeof r.calibrate?.[key] === \"number\") {\n config.calibrate[key] = r.calibrate[key];\n }\n }\n return config;\n}\n\n/** This tool's config, and the directory its relative paths resolve from. */\nexport interface LoadedConfig {\n config: TracevalsConfig;\n /**\n * The directory holding the config file, or `dir` when none was found.\n * Plugin specifiers and the labels default resolve against it, so a\n * committed config means the same thing from any working directory.\n */\n dir: string;\n /**\n * The file's top-level `collections:` (proposal 0041); `[]` with no config.\n *\n * Collections never choose tracevals' inputs — `run` and `calibrate` take\n * traces, `fill` detects artifacts under `--project` — and there is no\n * `--collection`. What they say is *where a relocated `metadata` block\n * lives*, so a declared manifest is read for the evals an artifact no longer\n * carries inline (proposals 0047 and 0049 §1).\n */\n collections: CollectionConfig[];\n /**\n * The config file's absolute path; absent when there is none. A keyless\n * manifest owns what an artifact's schemas mark external (proposal 0068),\n * and those schemas are read from meta's section of this same file.\n */\n path?: string;\n}\n\n/** How a command was told to find its config: `-c` and `--no-config`. */\nexport interface ConfigLookup {\n /** `-c/--config`: read this file instead of discovering one. */\n configPath?: string;\n /** `--no-config`: skip discovery and run on the built-in defaults. */\n noConfig?: boolean;\n}\n\n/**\n * Discover the family config from `dir` (cwd by default) upward to the\n * repository root and return this tool's section (`src/shared/config-file.ts`:\n * `manni.config.yaml` read at its `tracevals:` key, with the family's\n * top-level `providers:` beside it). An absent file — or one that carries only\n * other tools' sections — yields defaults.\n *\n * `-c` names a file and skips the walk; `--no-config` skips the file\n * altogether and runs on the built-in defaults, with `dir` still anchoring\n * whatever the config would otherwise have anchored.\n */\nexport async function discoverConfig(\n dir = process.cwd(),\n lookup: ConfigLookup = {},\n): Promise<LoadedConfig> {\n if (lookup.noConfig === true) {\n // No config means no collections, so no manifest owns anything and every\n // artifact's evals are its own front matter's — the same rule cite states.\n return { config: parseConfig({}), dir, collections: [] };\n }\n const file = await Promise.resolve().then(() =>\n lookup.configPath === undefined\n ? findConfigFileSync(dir, CONFIG_FILE)\n : readConfigFileSync(lookup.configPath, dir, CONFIG_FILE),\n );\n if (file === null) return { config: parseConfig({}), dir, collections: [] };\n return {\n config: parseConfig(file.value ?? {}, {\n source: file.source,\n ...(file.providers !== undefined ? { providers: file.providers } : {}),\n }),\n dir: file.dir,\n collections: file.collections,\n path: file.path,\n };\n}\n\n/** `discoverConfig`, for callers that only want the settings. */\nexport async function loadConfig(\n dir = process.cwd(),\n lookup: ConfigLookup = {},\n): Promise<TracevalsConfig> {\n return (await discoverConfig(dir, lookup)).config;\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:tracevals:config\",\n \"title\": \"tracevals section of manni.config.yaml\",\n \"description\": \"Settings for manni tracevals, held under the `tracevals` key of the config file shared by the manni family of tools. Sibling keys belong to other tools and are not validated here.\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"provider\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Which provider judges out of the loop, and extracts rules: auto, anthropic, openai, claude-cli, or llama-cpp. jev only decides, so it is refused here; name it as runtime.hook.provider. Overrides the family's top-level `providers.provider` for tracevals only. Connection settings — an endpoint, an API key's environment variable, the Claude CLI command — live in that top-level `providers:` map, never here.\"\n },\n \"model\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The model within `provider`, which must be named at this level. Unset, the inference library's default for the winning provider is used; manni pins no model id of its own.\"\n },\n \"judge\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"ensembleRuns\": { \"type\": \"integer\", \"minimum\": 1 },\n \"temperature\": { \"type\": \"number\", \"minimum\": 0, \"maximum\": 2 },\n \"zones\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"autoPass\": { \"type\": \"number\", \"minimum\": 0, \"maximum\": 1 },\n \"autoFail\": { \"type\": \"number\", \"minimum\": 0, \"maximum\": 1 }\n }\n },\n \"cacheDir\": { \"type\": \"string\" },\n \"maxTurns\": { \"type\": \"integer\", \"minimum\": 1, \"description\": \"Stop after this many ensemble runs. A cached ensemble spends none. Unset means unbounded; the remaining evals report `skipped` with the reason `turn budget` rather than aborting the run.\" },\n \"redact\": {\n \"type\": \"array\",\n \"description\": \"Extra regular expressions scrubbed from the session digest before it is sent to a judge provider. Applied on top of the built-in secret shapes, never instead of them; each source is compiled with the `g` flag, and a match is replaced with `[redacted]`. Pattern matching is best-effort — --deterministic-only is the only setting that guarantees nothing leaves the machine.\",\n \"items\": { \"type\": \"string\", \"minLength\": 1 }\n }\n }\n },\n \"execution\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"description\": \"Operator grant for executing content-authored code.\",\n \"properties\": {\n \"allow\": {\n \"type\": \"array\",\n \"items\": { \"enum\": [\"frontmatter-commands\"] },\n \"default\": [\"frontmatter-commands\"],\n \"description\": \"Which content-authored code a run may execute. Absent, every grant holds; list fewer to narrow it, or write [] to run none. frontmatter-commands lets `command` evals declared in an artifact's front matter run; without it they report `skipped` with a reason, never `pass`.\"\n }\n }\n },\n \"render\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"maxBlockChars\": { \"type\": \"integer\", \"minimum\": 100 },\n \"maxTotalChars\": {\n \"type\": \"integer\",\n \"minimum\": 1000,\n \"description\": \"Upper bound on the rendered digest, in characters. The timeline always keeps at least 200 characters, so a very long header can push the digest past this bound by up to 200.\"\n }\n }\n },\n \"history\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"file\": { \"type\": \"string\" }\n }\n },\n \"capture\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"description\": \"Session manifests — sha256 of every instruction artifact plus the git SHA, recorded at session start by `manni tracevals capture` and read back by `run` to make staleness exact instead of an mtime guess. See ADR 01024.\",\n \"properties\": {\n \"dir\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Directory manifests are written to and looked for, resolved against the project root. `run` also accepts one placed beside the trace as `<trace>.manifest.json`, and --manifest names one outright.\"\n }\n }\n },\n \"fill\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"confidenceThreshold\": { \"type\": \"number\", \"minimum\": 0, \"maximum\": 1 },\n \"maxEvalsPerArtifact\": { \"type\": \"integer\", \"minimum\": 1 },\n \"temperature\": { \"type\": \"number\", \"minimum\": 0, \"maximum\": 2 },\n \"cacheDir\": { \"type\": \"string\" },\n \"maxTurns\": { \"type\": \"integer\", \"minimum\": 1, \"description\": \"Stop after this many inference calls, one per artifact filled. A cached artifact spends none. Unset means unbounded.\" }\n }\n },\n \"calibrate\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"description\": \"Settings for `manni tracevals calibrate` — measuring the tool's verdicts against a human's answers. See ADR 01022.\",\n \"properties\": {\n \"labels\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Default labels sidecar, resolved against this config file's directory. Overridden by --labels.\"\n },\n \"maxFalsePass\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"description\": \"Fail the calibration run (exit 1) above this many false passes — labelled fail, judged pass. Unset by default: a calibration run is a measurement, not a gate.\"\n },\n \"maxFalseFail\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"description\": \"Fail the calibration run above this many false fails — labelled pass, judged fail.\"\n },\n \"maxReview\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"description\": \"Fail the calibration run above this many needs-review outcomes across the whole corpus.\"\n },\n \"sweep\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"description\": \"Values --sweep tries on each axis, one axis at a time with the others held at their configured value. The corpus is judged once at the largest ensembleRuns here and every cell is re-scored from those cached runs, so the grid costs nothing beyond that one run.\",\n \"properties\": {\n \"ensembleRuns\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": { \"type\": \"integer\", \"minimum\": 1 }\n },\n \"autoPass\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": { \"type\": \"number\", \"minimum\": 0, \"maximum\": 1 }\n },\n \"autoFail\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"items\": { \"type\": \"number\", \"minimum\": 0, \"maximum\": 1 }\n }\n }\n }\n }\n },\n \"runtime\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"description\": \"Runtime evals: each turn checked against the rules the files that govern the agent declare. Present, even as {}, it puts tracevals in play under Claude Code hooks; absent, tracevals stays out of them.\",\n \"properties\": {\n \"hook\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"description\": \"The judge inside a Stop or SubagentStop hook. Each key falls back to the top-level one of the same name.\",\n \"properties\": {\n \"provider\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The provider that judges inside a hook. Default: tracevals.provider. jev is accepted here, and only here.\"\n },\n \"model\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The model that judges inside a hook. Default: tracevals.model.\"\n },\n \"runs\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"description\": \"Judge calls per rule inside a hook. A rule blocks only when every run scores it not followed at the bar. jev makes one call and ignores it. Default 1.\"\n }\n }\n },\n \"include\": {\n \"type\": \"array\",\n \"description\": \"Globs, relative to the project root, naming files that govern agents beyond the known formats. Each applies to every turn.\",\n \"items\": { \"type\": \"string\", \"minLength\": 1 }\n },\n \"exclude\": {\n \"type\": \"array\",\n \"description\": \"Globs, relative to the project root, naming files never treated as rule sources, in any format. It removes plan, spec and output style files too. It also matches the sources `prompt`, `plan` and `system-prompt` by name.\",\n \"items\": { \"type\": \"string\", \"minLength\": 1 }\n },\n \"plans\": {\n \"type\": \"array\",\n \"default\": [],\n \"description\": \"Globs, relative to the project root, naming files that say what to build, beyond the known spec formats. Each is a rule source once the session touches it.\",\n \"items\": { \"type\": \"string\", \"minLength\": 1 }\n }\n }\n },\n \"failOnReview\": { \"type\": \"boolean\" },\n \"plugins\": {\n \"type\": \"array\",\n \"description\": \"Modules imported before evals are planned, so one calling registerGrader() can add a grader kind the built-ins do not cover. A relative or absolute path resolves against this file's directory, not the working directory; a bare package name resolves the way an import from this file's directory would. Load order is significant: a later entry wins a colliding kind.\",\n \"items\": { \"type\": \"string\", \"minLength\": 1 }\n },\n \"reportUnusedArtifacts\": {\n \"type\": \"boolean\",\n \"description\": \"List every skill and agent the session was offered and never used, rather than only counting them. Off by default: a real roster runs to hundreds of skills.\"\n }\n }\n}\n","/**\n * The calibration labels sidecar (ADR 01022).\n *\n * A label is a human's answer for one `(trace, artifact, eval)`. It lives in\n * its own file rather than in the eval entry for two reasons: the vendored\n * `artifact-evals` vocabulary is docmeta's and `inlineEval` is closed to\n * additions (ADR 01010), and — more importantly — a label is a property of a\n * *corpus and a reviewer*, not of the artifact. Two teams calibrating the same\n * skill against different sessions hold different ground truth, and neither\n * belongs in the SKILL.md.\n */\nimport { readFile } from \"node:fs/promises\";\nimport { dirname, resolve } from \"node:path\";\nimport { Ajv2020 } from \"ajv/dist/2020.js\";\nimport { parse as parseYaml } from \"yaml\";\nimport labelsSchemaJson from \"./labels-schema.json\" with { type: \"json\" };\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { TracevalsError } from \"../types.js\";\nimport type { ArtifactType } from \"../artifacts/types.js\";\n\nconst labelsSchema = labelsSchemaJson as Record<string, unknown>;\n\n/** Conventional location inside a project; overridable with `--labels`. */\nexport const DEFAULT_LABELS_FILE = \"tracevals/labels.yaml\";\n\n/**\n * What a human decided. `needs-review` is a legitimate label, not a cop-out:\n * an eval you found genuinely ambiguous is the one that tells you whether the\n * review band is set sensibly, and the docs have always asked for a couple.\n */\nexport type LabelOutcome = \"pass\" | \"fail\" | \"needs-review\";\n\nexport interface EvalLabel {\n /** Path exactly as written in the file, for error messages. */\n trace: string;\n /** Resolved absolute path — the join key against the batch corpus. */\n traceFile: string;\n artifact: string;\n /** Only when the file disambiguates a name shared by two artifact kinds. */\n type?: ArtifactType;\n eval: string;\n expected: LabelOutcome;\n note?: string;\n}\n\nconst ajv = new Ajv2020({ allErrors: true });\nconst validate = ajv.compile(labelsSchema);\n\n/**\n * Stable identity for one label, and the duplicate-detection key.\n *\n * The separator is written as a backslash-u escape, never as a literal NUL:\n * the runtime value is identical, but a literal one makes git call the file\n * binary — its diff renders as `Bin 0 -> N bytes` and cannot be reviewed or\n * three-way merged, and `grep` answers `Binary file … matches` and stops.\n * `test/unit/source-text-safety.test.ts` holds the whole tree to this.\n */\nexport const labelKey = (\n traceFile: string,\n artifact: string,\n evalName: string,\n type?: ArtifactType,\n): string => `${traceFile}\\u0000${type ?? \"\"}\\u0000${artifact}\\u0000${evalName}`;\n\n/**\n * Validate a labels document and resolve its trace paths.\n *\n * `file` is the path the text came from; trace paths resolve against **its**\n * directory rather than the working directory, matching how `plugins` resolves\n * against the config file that names them. A labels file travels with its\n * corpus, so it must mean the same thing from any cwd.\n */\nexport function parseLabels(text: string, file: string): EvalLabel[] {\n let raw: unknown;\n try {\n raw = parseYaml(text);\n } catch (err) {\n throw new TracevalsError(\n `could not parse ${file}: ${errorMessage(err)}`,\n );\n }\n if (raw === null || raw === undefined) {\n throw new TracevalsError(`invalid labels file ${file}: it is empty`);\n }\n if (!validate(raw)) {\n const detail = (validate.errors ?? [])\n .map((e) => `${e.instancePath || \"/\"} ${e.message ?? \"invalid\"}`)\n .join(\"; \");\n // The empty-list case gets its own wording: \"must NOT have fewer than 1\n // items\" describes the schema, not the mistake.\n const empty = (validate.errors ?? []).some(\n (e) => e.instancePath === \"/labels\" && e.keyword === \"minItems\",\n );\n throw new TracevalsError(\n empty\n ? `invalid labels file ${file}: it must carry at least one label — an empty one measures nothing`\n : `invalid labels file ${file}: ${detail}`,\n );\n }\n\n const base = dirname(resolve(file));\n const labels: EvalLabel[] = [];\n const seen = new Set<string>();\n for (const entry of (raw as { labels: Record<string, string>[] }).labels) {\n const traceFile = resolve(base, entry.trace as string);\n const type = entry.type as ArtifactType | undefined;\n const key = labelKey(\n traceFile,\n entry.artifact as string,\n entry.eval as string,\n type,\n );\n if (seen.has(key)) {\n // Two answers for one question is not a merge problem to resolve at run\n // time — whichever won would silently decide the measurement.\n throw new TracevalsError(\n `invalid labels file ${file}: duplicate label for ${entry.artifact ?? \"?\"} › ${entry.eval ?? \"?\"} on ${entry.trace ?? \"?\"}`,\n );\n }\n seen.add(key);\n labels.push({\n trace: entry.trace as string,\n traceFile,\n artifact: entry.artifact as string,\n ...(type !== undefined ? { type } : {}),\n eval: entry.eval as string,\n expected: entry.expected as LabelOutcome,\n ...(entry.note !== undefined ? { note: entry.note } : {}),\n });\n }\n return labels;\n}\n\nexport async function loadLabels(file: string): Promise<EvalLabel[]> {\n let text: string;\n try {\n text = await readFile(file, \"utf-8\");\n } catch (err) {\n throw new TracevalsError(\n `could not read labels file ${file}: ${errorMessage(err)}`,\n );\n }\n return parseLabels(text, file);\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:tracevals:calibration-labels\",\n \"title\": \"manni tracevals calibration labels\",\n \"description\": \"Ground truth for `manni tracevals calibrate`: what a human decided a given eval should have produced on a given trace. A sidecar rather than an eval field, because a label belongs to a corpus and a reviewer, not to the artifact — and because the eval vocabulary is docmeta's, vendored byte-identical, with `inlineEval` closed to additions (ADR 01010).\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"version\", \"labels\"],\n \"properties\": {\n \"version\": {\n \"const\": 1,\n \"description\": \"Format version. Pinned so a future shape change is an explicit migration rather than a silently-reinterpreted file.\"\n },\n \"labels\": {\n \"type\": \"array\",\n \"minItems\": 1,\n \"description\": \"One entry per (trace, artifact, eval) you have judged by hand.\",\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"trace\", \"artifact\", \"eval\", \"expected\"],\n \"properties\": {\n \"trace\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Path to the trace file, resolved against this file's own directory — not the working directory.\"\n },\n \"artifact\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Artifact name as the report shows it: a skill name, a subagent_type, or a project-rules filename such as CLAUDE.md.\"\n },\n \"type\": {\n \"enum\": [\"skill\", \"agent\", \"project-rules\", \"slash-command\"],\n \"description\": \"Optional disambiguator, needed when one name resolves to two kinds of artifact — a skill and an agent, or a skill and the slash command that types it. Every `ArtifactType` the resolver can produce belongs here: a label whose type this rejects has no way to name the artifact it means.\"\n },\n \"eval\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The eval's id. Shorthand entries with no declared id get a positional one (eval-1, eval-2, ...), so labelling those is only as stable as the order they are written in.\"\n },\n \"expected\": {\n \"enum\": [\"pass\", \"fail\", \"needs-review\"],\n \"description\": \"What you decided. `needs-review` means you found it genuinely ambiguous and want the tool to defer too.\"\n },\n \"note\": {\n \"type\": \"string\",\n \"description\": \"Why you decided that. Carried into the disagreement report, where it is the whole reason a disagreement is actionable.\"\n }\n }\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAS,WAAAA,gBAAe;;;ACVxB;AAAA,EACE,SAAW;AAAA,EACX,KAAO;AAAA,EACP,OAAS;AAAA,EACT,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,sBAAwB;AAAA,EACxB,YAAc;AAAA,IACZ,UAAY;AAAA,MACV,MAAQ;AAAA,MACR,WAAa;AAAA,MACb,aAAe;AAAA,IACjB;AAAA,IACA,OAAS;AAAA,MACP,MAAQ;AAAA,MACR,WAAa;AAAA,MACb,aAAe;AAA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AG5B,WAAO,EAAE,QAAQ,YAAY,CAAC,CAAC,GAAG,KAAK,aAAa,CAAC,EAAE;AAAA,EACzD;AACA,QAAM,OAAO,MAAM,QAAQ,QAAQ,EAAE;AAAA,IAAK,MACxC,OAAO,eAAe,SAClB,mBAAmB,KAAK,WAAW,IACnC,mBAAmB,OAAO,YAAY,KAAK,WAAW;AAAA,EAC5D;AACA,MAAI,SAAS,KAAM,QAAO,EAAE,QAAQ,YAAY,CAAC,CAAC,GAAG,KAAK,aAAa,CAAC,EAAE;AAC1E,SAAO;AAAA,IACL,QAAQ,YAAY,KAAK,SAAS,CAAC,GAAG;AAAA,MACpC,QAAQ,KAAK;AAAA,MACb,GAAI,KAAK,cAAc,SAAY,EAAE,WAAW,KAAK,UAAU,IAAI,CAAC;AAAA,IACtE,CAAC;AAAA,IACD,KAAK,KAAK;AAAA,IACV,aAAa,KAAK;AAAA,IAClB,MAAM,KAAK;AAAA,EACb;AACF;AAGA,eAAsB,WACpB,MAAM,QAAQ,IAAI,GAClB,SAAuB,CAAC,GACE;AAC1B,UAAQ,MAAM,eAAe,KAAK,MAAM,GAAG;AAC7C;","names":["Ajv2020","ajv","Ajv2020","validate"]}
@@ -1,233 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- PAGE_FIELDS,
4
- PARENTS,
5
- guidanceFor,
6
- resolveSeverity,
7
- ruleId
8
- } from "./chunk-O4O6JOGD.js";
9
- import {
10
- closestName
11
- } from "./chunk-XTKJNRJ6.js";
12
-
13
- // src/strategy/core/check.ts
14
- var fold = (value) => value.toLowerCase();
15
- var FIELD_TYPES = {
16
- audiences: "audience",
17
- personas: "persona",
18
- journeys: "journey",
19
- audience: "audience"
20
- };
21
- var parentTypeOf = (type) => FIELD_TYPES[PARENTS[type]];
22
- function indexSet(set) {
23
- const byType = /* @__PURE__ */ new Map();
24
- const byId = /* @__PURE__ */ new Map();
25
- for (const record of set.records) {
26
- const ids = byType.get(record.type) ?? /* @__PURE__ */ new Map();
27
- if (!ids.has(fold(record.id))) ids.set(fold(record.id), record);
28
- byType.set(record.type, ids);
29
- if (!byId.has(fold(record.id))) byId.set(fold(record.id), record);
30
- }
31
- const resolveIn = (type, value) => byType.get(type)?.get(fold(value));
32
- const parentsOf = (record) => {
33
- if (record.type === "audience") return [];
34
- const type = parentTypeOf(record.type);
35
- const found = record.parents.map((p) => resolveIn(type, p.value)).filter((r) => r !== void 0);
36
- return [...new Set(found)];
37
- };
38
- const children = /* @__PURE__ */ new Map();
39
- for (const record of set.records) {
40
- for (const parent of parentsOf(record)) children.set(parent, [...children.get(parent) ?? [], record]);
41
- }
42
- const pages = /* @__PURE__ */ new Map();
43
- for (const reference of set.references) {
44
- if (reference.record) continue;
45
- const target = resolveIn(FIELD_TYPES[reference.field], reference.value);
46
- if (target === void 0) continue;
47
- const named = pages.get(target) ?? /* @__PURE__ */ new Set();
48
- named.add(reference.page);
49
- pages.set(target, named);
50
- }
51
- return {
52
- has: (type) => (byType.get(type)?.size ?? 0) > 0,
53
- resolve: resolveIn,
54
- anyWithId: (value) => byId.get(fold(value)),
55
- parentsOf,
56
- childrenOf: (record) => children.get(record) ?? [],
57
- pagesNaming: (record) => [...pages.get(record) ?? []].sort()
58
- };
59
- }
60
- function article(type) {
61
- return `${type === "audience" ? "an" : "a"} ${type}`;
62
- }
63
- function onRecord(record) {
64
- return record.idAt ?? { file: record.file, line: record.line };
65
- }
66
- function located(at) {
67
- return { file: at.file, ...at.line === void 0 ? {} : { line: at.line } };
68
- }
69
- function ancestorOf(index, record, type) {
70
- let current = index.parentsOf(record)[0];
71
- while (current !== void 0 && current.type !== type) current = index.parentsOf(current)[0];
72
- return current;
73
- }
74
- function checkStrategySet(set, opts = {}) {
75
- const levels = resolveSeverity(opts.severity);
76
- const index = indexSet(set);
77
- const drafts = [];
78
- const unresolved = (field, value, onRecordField) => {
79
- const type = FIELD_TYPES[field];
80
- const other = index.anyWithId(value);
81
- if (other !== void 0) {
82
- const ancestor = ancestorOf(index, other, type);
83
- const fix2 = ancestor !== void 0 ? `Did you mean its ${type}, "${ancestor.id}"?` : onRecordField ? "Correct the value." : `Move it to ${PAGE_FIELDS[other.type]}:.`;
84
- return { message: `${field}: "${value}" is ${article(other.type)}, not ${article(type)}.`, fix: fix2 };
85
- }
86
- const ids = set.records.filter((r) => r.type === type).map((r) => r.id);
87
- const nearest = closestName(fold(value), ids.map(fold));
88
- const suggestion = nearest === void 0 ? void 0 : ids.find((id) => fold(id) === nearest);
89
- const add = `Correct the value, or add a record with type: ${type} and id: ${value}.`;
90
- const fix = suggestion === void 0 ? add : onRecordField ? `Did you mean "${suggestion}"?` : `Did you mean "${suggestion}"? ${add}`;
91
- return { message: `${field}: "${value}" names no ${type}.`, fix };
92
- };
93
- for (const reference of set.references) {
94
- const type = FIELD_TYPES[reference.field];
95
- if (!index.has(type) || index.resolve(type, reference.value) !== void 0) continue;
96
- drafts.push({
97
- rule: "undefined-reference",
98
- ...unresolved(reference.field, reference.value, false),
99
- ...located(reference),
100
- field: reference.field
101
- });
102
- }
103
- for (const record of set.records) {
104
- if (record.type === "audience") continue;
105
- const field = PARENTS[record.type];
106
- const type = parentTypeOf(record.type);
107
- if (!index.has(type)) continue;
108
- for (const parent of record.parents) {
109
- if (index.resolve(type, parent.value) !== void 0) continue;
110
- drafts.push({
111
- rule: "undefined-reference",
112
- ...unresolved(field, parent.value, true),
113
- ...located(parent),
114
- id: record.id,
115
- field
116
- });
117
- }
118
- }
119
- const sharing = /* @__PURE__ */ new Map();
120
- for (const record of set.records) sharing.set(fold(record.id), [...sharing.get(fold(record.id)) ?? [], record]);
121
- for (const group of sharing.values()) {
122
- if (group.length < 2) continue;
123
- for (const record of group) {
124
- const others = group.filter((other) => other !== record).map((other) => {
125
- const at = onRecord(other);
126
- return at.line === void 0 ? at.file : `${at.file}:${String(at.line)}`;
127
- });
128
- drafts.push({
129
- rule: "duplicate-id",
130
- message: `id: "${record.id}" is also the id of ${others.join(", ")}.`,
131
- fix: "Give each record its own id.",
132
- ...located(onRecord(record)),
133
- id: record.id
134
- });
135
- }
136
- }
137
- const byPage = /* @__PURE__ */ new Map();
138
- for (const reference of set.references) {
139
- if (reference.record) continue;
140
- byPage.set(reference.page, [...byPage.get(reference.page) ?? [], reference]);
141
- }
142
- for (const references of byPage.values()) {
143
- const named = (field) => new Set(references.filter((r) => r.field === field).map((r) => fold(r.value)));
144
- const reported = /* @__PURE__ */ new Set();
145
- for (const childType of ["journey", "persona"]) {
146
- const parentType = parentTypeOf(childType);
147
- const parentField = PAGE_FIELDS[parentType];
148
- const has = named(parentField);
149
- for (const reference of references) {
150
- if (reference.field !== PAGE_FIELDS[childType]) continue;
151
- const child = index.resolve(childType, reference.value);
152
- if (child === void 0) continue;
153
- const parents = index.parentsOf(child);
154
- const ids = parents.map((p) => `"${p.id}"`).join(", ");
155
- const key = `${parentType} ${ids}`;
156
- if (parents.length === 0 || parents.some((p) => has.has(fold(p.id))) || reported.has(key)) continue;
157
- reported.add(key);
158
- const one = parents.length === 1;
159
- drafts.push({
160
- rule: "missing-parent",
161
- message: one ? `${parentField}: does not name ${ids}, the ${parentType} of ${childType} "${child.id}".` : `${parentField}: names none of ${ids}, the ${parentField} of ${childType} "${child.id}".`,
162
- fix: `Add ${one ? "it" : "one"}, or drop "${child.id}" from ${PAGE_FIELDS[childType]}:.`,
163
- ...located(reference),
164
- field: parentField
165
- });
166
- }
167
- }
168
- }
169
- for (const record of set.records) {
170
- const at = located(onRecord(record));
171
- if (record.type !== "audience" && record.parents.length === 0 && index.has(parentTypeOf(record.type))) {
172
- const field = PARENTS[record.type];
173
- drafts.push({
174
- rule: "orphan-record",
175
- message: `${field}: missing, so this ${record.type} belongs to no ${parentTypeOf(record.type)}.`,
176
- fix: `Name one with ${field}:.`,
177
- ...at,
178
- id: record.id,
179
- field
180
- });
181
- }
182
- if (index.resolve(record.type, record.id) !== record) continue;
183
- const pages = index.pagesNaming(record);
184
- const live = record.lifecycle !== "draft" && record.lifecycle !== "archived";
185
- if (record.type === "journey" && live && pages.length === 0) {
186
- drafts.push({
187
- rule: "unserved-journey",
188
- message: "no page names this journey in journeys:.",
189
- fix: "Name it on the pages that serve it.",
190
- ...at,
191
- id: record.id
192
- });
193
- }
194
- if (record.type !== "journey" && pages.length === 0 && index.childrenOf(record).length === 0) {
195
- drafts.push({
196
- rule: "unused-record",
197
- message: `no page and no record names this ${record.type}.`,
198
- ...at,
199
- id: record.id
200
- });
201
- }
202
- }
203
- const findings = [];
204
- for (const draft of drafts) {
205
- const level = levels[draft.rule];
206
- if (level === "off") continue;
207
- findings.push({
208
- rule: draft.rule,
209
- ruleId: ruleId(draft.rule),
210
- severity: level,
211
- message: draft.fix === void 0 ? draft.message : `${draft.message} ${draft.fix}`,
212
- ...draft.fix === void 0 ? {} : { key: draft.message },
213
- guidance: guidanceFor(draft.rule),
214
- file: draft.file,
215
- ...draft.line === void 0 ? {} : { line: draft.line },
216
- ...draft.id === void 0 ? {} : { id: draft.id },
217
- ...draft.field === void 0 ? {} : { field: draft.field }
218
- });
219
- }
220
- return findings.sort(compareFindings);
221
- }
222
- function compareText(a, b) {
223
- return a < b ? -1 : a > b ? 1 : 0;
224
- }
225
- function compareFindings(a, b) {
226
- return compareText(a.file, b.file) || (a.line ?? 0) - (b.line ?? 0) || compareText(a.ruleId, b.ruleId) || compareText(a.message, b.message);
227
- }
228
-
229
- export {
230
- indexSet,
231
- checkStrategySet
232
- };
233
- //# sourceMappingURL=chunk-SIREOHLW.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/strategy/core/check.ts"],"sourcesContent":["/**\n * `strategy check`'s rules (proposal 0102). Pure: it reads records and\n * references and returns findings, so the command core owns every file and\n * the rules are tested on sets built inline.\n *\n * Ids compare case-folded. A reference field is checked only when the set\n * holds a record of that field's type, so a repo that keeps no audience\n * records keeps free-form `audiences:`. `missing-parent` and the use counts\n * read pages that are not records: a record's own `journeys:` serves nobody.\n */\nimport { closestName } from \"../../shared/closest-name.js\";\nimport {\n PAGE_FIELDS,\n PARENTS,\n type At,\n type ChildType,\n type RecordType,\n type ReferenceField,\n type StrategyFinding,\n type StrategyRecord,\n type StrategyRule,\n type StrategySet,\n type StrategySeverity,\n} from \"../types.js\";\nimport { guidanceFor, resolveSeverity, ruleId } from \"./severity.js\";\n\nconst fold = (value: string): string => value.toLowerCase();\n\n/** The type each page field names. */\nconst FIELD_TYPES: Readonly<Record<ReferenceField, RecordType>> = {\n audiences: \"audience\",\n personas: \"persona\",\n journeys: \"journey\",\n audience: \"audience\",\n};\n\n/** The type of a child's parents: an audience for a persona, a persona for a journey. */\nconst parentTypeOf = (type: ChildType): RecordType => FIELD_TYPES[PARENTS[type]];\n\n/** What a set's records and pages say about each other, resolved once for `check`, `list` and `get`. */\nexport interface StrategyIndex {\n /** Whether the set holds a record of this type. */\n has(type: RecordType): boolean;\n /** The record of `type` a value names, case-folded. The first one read wins. */\n resolve(type: RecordType, value: string): StrategyRecord | undefined;\n /** The first record of any type with this id, case-folded. */\n anyWithId(value: string): StrategyRecord | undefined;\n /** The records of the parent type the record's parent field names, each once, in the field's order. */\n parentsOf(record: StrategyRecord): StrategyRecord[];\n /** The records whose parent field names this record, in set order. */\n childrenOf(record: StrategyRecord): StrategyRecord[];\n /** The pages that name this record directly, sorted. Records do not count. */\n pagesNaming(record: StrategyRecord): string[];\n}\n\nexport function indexSet(set: StrategySet): StrategyIndex {\n const byType = new Map<RecordType, Map<string, StrategyRecord>>();\n const byId = new Map<string, StrategyRecord>();\n for (const record of set.records) {\n const ids = byType.get(record.type) ?? new Map<string, StrategyRecord>();\n if (!ids.has(fold(record.id))) ids.set(fold(record.id), record);\n byType.set(record.type, ids);\n if (!byId.has(fold(record.id))) byId.set(fold(record.id), record);\n }\n const resolveIn = (type: RecordType, value: string): StrategyRecord | undefined => byType.get(type)?.get(fold(value));\n const parentsOf = (record: StrategyRecord): StrategyRecord[] => {\n if (record.type === \"audience\") return [];\n const type = parentTypeOf(record.type);\n const found = record.parents.map((p) => resolveIn(type, p.value)).filter((r) => r !== undefined);\n return [...new Set(found)];\n };\n\n const children = new Map<StrategyRecord, StrategyRecord[]>();\n for (const record of set.records) {\n for (const parent of parentsOf(record)) children.set(parent, [...(children.get(parent) ?? []), record]);\n }\n const pages = new Map<StrategyRecord, Set<string>>();\n for (const reference of set.references) {\n if (reference.record) continue;\n const target = resolveIn(FIELD_TYPES[reference.field], reference.value);\n if (target === undefined) continue;\n const named = pages.get(target) ?? new Set<string>();\n named.add(reference.page);\n pages.set(target, named);\n }\n\n return {\n has: (type) => (byType.get(type)?.size ?? 0) > 0,\n resolve: resolveIn,\n anyWithId: (value) => byId.get(fold(value)),\n parentsOf,\n childrenOf: (record) => children.get(record) ?? [],\n pagesNaming: (record) => [...(pages.get(record) ?? [])].sort(),\n };\n}\n\n/** A finding before its level is known: `message` is its identity, `fix` the advice after it. */\ninterface Draft {\n rule: StrategyRule;\n message: string;\n fix?: string;\n file: string;\n line?: number;\n id?: string;\n field?: ReferenceField;\n}\n\n/** `a journey`, `an audience`. */\nfunction article(type: RecordType): string {\n return `${type === \"audience\" ? \"an\" : \"a\"} ${type}`;\n}\n\n/** Where a finding about a whole record sits: its `id:` line, else its first line. */\nfunction onRecord(record: StrategyRecord): At {\n return record.idAt ?? { file: record.file, line: record.line };\n}\n\nfunction located(at: At): At {\n return { file: at.file, ...(at.line === undefined ? {} : { line: at.line }) };\n}\n\n/** The ancestor of `record` of type `type`, walking up each record's first parent. */\nfunction ancestorOf(index: StrategyIndex, record: StrategyRecord, type: RecordType): StrategyRecord | undefined {\n let current = index.parentsOf(record)[0];\n while (current !== undefined && current.type !== type) current = index.parentsOf(current)[0];\n return current;\n}\n\nexport interface CheckStrategySetOptions {\n severity?: Partial<Record<StrategyRule, StrategySeverity>>;\n}\n\nexport function checkStrategySet(set: StrategySet, opts: CheckStrategySetOptions = {}): StrategyFinding[] {\n const levels = resolveSeverity(opts.severity);\n const index = indexSet(set);\n const drafts: Draft[] = [];\n\n /** The finding for a value that names no record of `type`, or the wrong type of record. */\n const unresolved = (field: ReferenceField, value: string, onRecordField: boolean): Pick<Draft, \"message\" | \"fix\"> => {\n const type = FIELD_TYPES[field];\n const other = index.anyWithId(value);\n if (other !== undefined) {\n const ancestor = ancestorOf(index, other, type);\n const fix =\n ancestor !== undefined\n ? `Did you mean its ${type}, \"${ancestor.id}\"?`\n : onRecordField\n ? \"Correct the value.\"\n : `Move it to ${PAGE_FIELDS[other.type]}:.`;\n return { message: `${field}: \"${value}\" is ${article(other.type)}, not ${article(type)}.`, fix };\n }\n const ids = set.records.filter((r) => r.type === type).map((r) => r.id);\n const nearest = closestName(fold(value), ids.map(fold));\n const suggestion = nearest === undefined ? undefined : ids.find((id) => fold(id) === nearest);\n const add = `Correct the value, or add a record with type: ${type} and id: ${value}.`;\n const fix =\n suggestion === undefined ? add : onRecordField ? `Did you mean \"${suggestion}\"?` : `Did you mean \"${suggestion}\"? ${add}`;\n return { message: `${field}: \"${value}\" names no ${type}.`, fix };\n };\n\n // undefined-reference, on every page's fields, records included.\n for (const reference of set.references) {\n const type = FIELD_TYPES[reference.field];\n if (!index.has(type) || index.resolve(type, reference.value) !== undefined) continue;\n drafts.push({\n rule: \"undefined-reference\",\n ...unresolved(reference.field, reference.value, false),\n ...located(reference),\n field: reference.field,\n });\n }\n // ...and on each value of a record's parent field.\n for (const record of set.records) {\n if (record.type === \"audience\") continue;\n const field = PARENTS[record.type];\n const type = parentTypeOf(record.type);\n if (!index.has(type)) continue;\n for (const parent of record.parents) {\n if (index.resolve(type, parent.value) !== undefined) continue;\n drafts.push({\n rule: \"undefined-reference\",\n ...unresolved(field, parent.value, true),\n ...located(parent),\n id: record.id,\n field,\n });\n }\n }\n\n // duplicate-id: on every record sharing the id, each naming the others.\n const sharing = new Map<string, StrategyRecord[]>();\n for (const record of set.records) sharing.set(fold(record.id), [...(sharing.get(fold(record.id)) ?? []), record]);\n for (const group of sharing.values()) {\n if (group.length < 2) continue;\n for (const record of group) {\n const others = group\n .filter((other) => other !== record)\n .map((other) => {\n const at = onRecord(other);\n return at.line === undefined ? at.file : `${at.file}:${String(at.line)}`;\n });\n drafts.push({\n rule: \"duplicate-id\",\n message: `id: \"${record.id}\" is also the id of ${others.join(\", \")}.`,\n fix: \"Give each record its own id.\",\n ...located(onRecord(record)),\n id: record.id,\n });\n }\n }\n\n // missing-parent: per page, one finding per set of parents the page names none of.\n const byPage = new Map<string, typeof set.references>();\n for (const reference of set.references) {\n if (reference.record) continue;\n byPage.set(reference.page, [...(byPage.get(reference.page) ?? []), reference]);\n }\n for (const references of byPage.values()) {\n const named = (field: ReferenceField): Set<string> =>\n new Set(references.filter((r) => r.field === field).map((r) => fold(r.value)));\n const reported = new Set<string>();\n for (const childType of [\"journey\", \"persona\"] as const satisfies readonly ChildType[]) {\n const parentType = parentTypeOf(childType);\n const parentField = PAGE_FIELDS[parentType];\n const has = named(parentField);\n for (const reference of references) {\n if (reference.field !== PAGE_FIELDS[childType]) continue;\n const child = index.resolve(childType, reference.value);\n if (child === undefined) continue;\n const parents = index.parentsOf(child);\n const ids = parents.map((p) => `\"${p.id}\"`).join(\", \");\n const key = `${parentType} ${ids}`;\n if (parents.length === 0 || parents.some((p) => has.has(fold(p.id))) || reported.has(key)) continue;\n reported.add(key);\n const one = parents.length === 1;\n drafts.push({\n rule: \"missing-parent\",\n message: one\n ? `${parentField}: does not name ${ids}, the ${parentType} of ${childType} \"${child.id}\".`\n : `${parentField}: names none of ${ids}, the ${parentField} of ${childType} \"${child.id}\".`,\n fix: `Add ${one ? \"it\" : \"one\"}, or drop \"${child.id}\" from ${PAGE_FIELDS[childType]}:.`,\n ...located(reference),\n field: parentField,\n });\n }\n }\n }\n\n // orphan-record, unserved-journey and unused-record: about whole records.\n for (const record of set.records) {\n const at = located(onRecord(record));\n if (record.type !== \"audience\" && record.parents.length === 0 && index.has(parentTypeOf(record.type))) {\n const field = PARENTS[record.type];\n drafts.push({\n rule: \"orphan-record\",\n message: `${field}: missing, so this ${record.type} belongs to no ${parentTypeOf(record.type)}.`,\n fix: `Name one with ${field}:.`,\n ...at,\n id: record.id,\n field,\n });\n }\n // Only the first record with an id is the one references resolve to.\n if (index.resolve(record.type, record.id) !== record) continue;\n const pages = index.pagesNaming(record);\n // A draft journey is not live yet, and an archived one no longer is, so neither owes a page.\n const live = record.lifecycle !== \"draft\" && record.lifecycle !== \"archived\";\n if (record.type === \"journey\" && live && pages.length === 0) {\n drafts.push({\n rule: \"unserved-journey\",\n message: \"no page names this journey in journeys:.\",\n fix: \"Name it on the pages that serve it.\",\n ...at,\n id: record.id,\n });\n }\n if (record.type !== \"journey\" && pages.length === 0 && index.childrenOf(record).length === 0) {\n drafts.push({\n rule: \"unused-record\",\n message: `no page and no record names this ${record.type}.`,\n ...at,\n id: record.id,\n });\n }\n }\n\n const findings: StrategyFinding[] = [];\n for (const draft of drafts) {\n const level = levels[draft.rule];\n if (level === \"off\") continue;\n findings.push({\n rule: draft.rule,\n ruleId: ruleId(draft.rule),\n severity: level,\n message: draft.fix === undefined ? draft.message : `${draft.message} ${draft.fix}`,\n ...(draft.fix === undefined ? {} : { key: draft.message }),\n guidance: guidanceFor(draft.rule),\n file: draft.file,\n ...(draft.line === undefined ? {} : { line: draft.line }),\n ...(draft.id === undefined ? {} : { id: draft.id }),\n ...(draft.field === undefined ? {} : { field: draft.field }),\n });\n }\n return findings.sort(compareFindings);\n}\n\nfunction compareText(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\nexport function compareFindings(a: StrategyFinding, b: StrategyFinding): number {\n return (\n compareText(a.file, b.file) ||\n (a.line ?? 0) - (b.line ?? 0) ||\n compareText(a.ruleId, b.ruleId) ||\n compareText(a.message, b.message)\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA0BA,IAAM,OAAO,CAAC,UAA0B,MAAM,YAAY;AAG1D,IAAM,cAA4D;AAAA,EAChE,WAAW;AAAA,EACX,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AACZ;AAGA,IAAM,eAAe,CAAC,SAAgC,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AAQ,SAAY,MAAM,UAAU,GAAG,MAAM,OAAO,IAAI,MAAM,GAAG;AAAA,MAChF,GAAI,MAAM,QAAQ,SAAY,CAAC,IAAI,EAAE,KAAK,MAAM,QAAQ;AAAA,MACxD,UAAU,YAAY,MAAM,IAAI;AAAA,MAChC,MAAM,MAAM;AAAA,MACZ,GAAI,MAAM,SAAS,SAAY,CAAC,IAAI,EAAE,MAAM,MAAM,KAAK;AAAA,MACvD,GAAI,MAAM,OAAO,SAAY,CAAC,IAAI,EAAE,IAAI,MAAM,GAAG;AAAA,MACjD,GAAI,MAAM,UAAU,SAAY,CAAC,IAAI,EAAE,OAAO,MAAM,MAAM;AAAA,IAC5D,CAAC;AAAA,EACH;AACA,SAAO,SAAS,KAAK,eAAe;AACtC;AAEA,SAAS,YAAY,GAAW,GAAmB;AACjD,SAAO,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI;AAClC;AAEO,SAAS,gBAAgB,GAAoB,GAA4B;AAC9E,SACE,YAAY,EAAE,MAAM,EAAE,IAAI,MACzB,EAAE,QAAQ,MAAM,EAAE,QAAQ,MAC3B,YAAY,EAAE,QAAQ,EAAE,MAAM,KAC9B,YAAY,EAAE,SAAS,EAAE,OAAO;AAEpC;","names":["fix"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/docevals/judge/budget.ts"],"sourcesContent":["/**\n * The turn-budget skip marker (ADR 01019), in one place.\n *\n * `judge.ts` produces the skip reason; `core/engine.ts` and `commands/\n * calibrate.ts` both have to tell a budget truncation apart from every other\n * reason an eval went unjudged, because that distinction is what stops a\n * partial run from reporting as a complete one. They did it by matching the\n * bare substring `\"turn budget\"` against a message written in a third file,\n * so a reword in the producer would have left both detectors matching nothing\n * — silently, since the tests that exercise truncation supply the skip reason\n * themselves rather than getting it from the judge.\n *\n * Kept in its own module rather than exported from `judge.ts`: the detectors\n * need the marker, not the judge, and `engine.ts` deliberately takes the judge\n * by injection.\n */\n\n/** The substring every budget-truncation skip reason carries. */\nexport const TURN_BUDGET_SKIP = \"turn budget\";\n\n/** The skip reason recorded for an eval the budget stopped before dispatch. */\nexport function turnBudgetSkipReason(maxTurns: number): string {\n return `judge ${TURN_BUDGET_SKIP} exhausted (${maxTurns})`;\n}\n\n/**\n * Whether a skip reason is the budget's doing rather than the judge's.\n *\n * A type predicate, not a plain boolean: a budget skip always carries a\n * reason, and callers interpolate it into the message they report.\n */\nexport function isTurnBudgetSkip(reason: string | undefined): reason is string {\n return reason !== undefined && reason.includes(TURN_BUDGET_SKIP);\n}\n"],"mappings":";;;AAkBO,IAAM,mBAAmB;AAGzB,SAAS,qBAAqB,UAA0B;AAC7D,SAAO,SAAS,gBAAgB,eAAe,QAAQ;AACzD;AAQO,SAAS,iBAAiB,QAA8C;AAC7E,SAAO,WAAW,UAAa,OAAO,SAAS,gBAAgB;AACjE;","names":[]}