reeval 0.11.0 → 0.13.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 (312) hide show
  1. package/README.md +115 -257
  2. package/assets/package.json +1 -1
  3. package/assets/pnpm-lock.yaml +41 -30
  4. package/bin/mcp-timer.cjs +224 -0
  5. package/dist/{adapter-Bwy3QxAK.js → adapter-IKKo4sZj.js} +4 -4
  6. package/dist/{adapter-Bwy3QxAK.js.map → adapter-IKKo4sZj.js.map} +1 -1
  7. package/dist/{agent-DpE80WPz.js → agent-ClE-g9VL.js} +22 -7
  8. package/dist/{agent-DpE80WPz.js.map → agent-ClE-g9VL.js.map} +1 -1
  9. package/dist/{analysis-Bxub9LMT.js → analysis-B0nOfAzA.js} +3 -3
  10. package/dist/{analysis-Bxub9LMT.js.map → analysis-B0nOfAzA.js.map} +1 -1
  11. package/dist/{assemble-D9GWr-HS.js → assemble-BO93VAk1.js} +22 -20
  12. package/dist/assemble-BO93VAk1.js.map +1 -0
  13. package/dist/assemble-VQxyoDxK.js +1 -0
  14. package/dist/{attempt-CGPV3BZY.js → attempt-jI0OWxlz.js} +2 -2
  15. package/dist/{attempt-CGPV3BZY.js.map → attempt-jI0OWxlz.js.map} +1 -1
  16. package/dist/bridge/index.mjs +2 -1
  17. package/dist/{capture-BQlGHiMC.js → capture-dn2hjSLj.js} +29 -21
  18. package/dist/{capture-BQlGHiMC.js.map → capture-dn2hjSLj.js.map} +1 -1
  19. package/dist/capture-nIJ-7kUE.js +1 -0
  20. package/dist/{cli-ClpPT8kn.js → cli-BCE1xlm4.js} +176 -120
  21. package/dist/cli-BCE1xlm4.js.map +1 -0
  22. package/dist/{cli-spec-qmEnQ25_.js → cli-spec-BXIBUlaK.js} +34 -15
  23. package/dist/cli-spec-BXIBUlaK.js.map +1 -0
  24. package/dist/cli.js +2 -2
  25. package/dist/{command-BlM0y8jN.js → command-Bh3yhN_b.js} +8 -8
  26. package/dist/{command-BlM0y8jN.js.map → command-Bh3yhN_b.js.map} +1 -1
  27. package/dist/command-C6vwmjS7.js +91 -0
  28. package/dist/command-C6vwmjS7.js.map +1 -0
  29. package/dist/{command-DbAe1Rzb.js → command-CANun0m0.js} +16 -19
  30. package/dist/command-CANun0m0.js.map +1 -0
  31. package/dist/command-CBaHukyl.js +335 -0
  32. package/dist/command-CBaHukyl.js.map +1 -0
  33. package/dist/{command-TgbzPizb.js → command-D_kEnYcX.js} +17 -16
  34. package/dist/command-D_kEnYcX.js.map +1 -0
  35. package/dist/commands-7tH3EsVu.js +666 -0
  36. package/dist/commands-7tH3EsVu.js.map +1 -0
  37. package/dist/{commands-CthqwkAn.js → commands-BKGzBMgb.js} +1 -1
  38. package/dist/{config-DrVSEVN0.js → config-D7TFvUpL.js} +40 -55
  39. package/dist/config-D7TFvUpL.js.map +1 -0
  40. package/dist/{context-C1mxXh80.js → context-Dgn48BqT.js} +13 -2
  41. package/dist/context-Dgn48BqT.js.map +1 -0
  42. package/dist/{contrasts-5zsj32gk.js → contrasts-B4nOhn0Z.js} +3 -3
  43. package/dist/{contrasts-5zsj32gk.js.map → contrasts-B4nOhn0Z.js.map} +1 -1
  44. package/dist/db-DJUuFoWQ.js +602 -0
  45. package/dist/db-DJUuFoWQ.js.map +1 -0
  46. package/dist/db-W9EFlXnn.js +2 -0
  47. package/dist/{dist-CuY4ehEk.js → dist-Dp_AJgYN.js} +3 -3
  48. package/dist/{dist-CuY4ehEk.js.map → dist-Dp_AJgYN.js.map} +1 -1
  49. package/dist/{docker-D1HZDS6q.js → docker-CQxucRPe.js} +16 -15
  50. package/dist/docker-CQxucRPe.js.map +1 -0
  51. package/dist/{docker-DNmMPOBb.js → docker-Dac6Zalz.js} +1 -1
  52. package/dist/{docker-DOvjji9I.js → docker-DuHcQidD.js} +3 -3
  53. package/dist/{docker-DOvjji9I.js.map → docker-DuHcQidD.js.map} +1 -1
  54. package/dist/{doctor-D2MbNO8L.js → doctor-De_QlOTM.js} +72 -38
  55. package/dist/doctor-De_QlOTM.js.map +1 -0
  56. package/dist/{egress-2-qzPvGi.js → egress-DEAvq8Fl.js} +453 -31
  57. package/dist/egress-DEAvq8Fl.js.map +1 -0
  58. package/dist/env-BQqj93gu.js +21 -0
  59. package/dist/env-BQqj93gu.js.map +1 -0
  60. package/dist/{environment-Cca6a4wB.js → environment-B4IuURK1.js} +247 -14
  61. package/dist/environment-B4IuURK1.js.map +1 -0
  62. package/dist/{evaluate-DMyaGQEj.d.ts → evaluate-C9-ritA5.d.ts} +2 -2
  63. package/dist/{evaluate-DKIl54Hb.js → evaluate-Djk1YPFL.js} +540 -560
  64. package/dist/evaluate-Djk1YPFL.js.map +1 -0
  65. package/dist/facts-Cfx1H70y.js +898 -0
  66. package/dist/facts-Cfx1H70y.js.map +1 -0
  67. package/dist/files-Bs6H3HiG.js +65 -0
  68. package/dist/files-Bs6H3HiG.js.map +1 -0
  69. package/dist/{files-BpUYBwGu.js → files-CN1QfenC.js} +31 -8
  70. package/dist/files-CN1QfenC.js.map +1 -0
  71. package/dist/files-CtjEXWXm.js +1 -0
  72. package/dist/{files-BXHZFWmx.js → files-D27nUk0K.js} +6 -17
  73. package/dist/files-D27nUk0K.js.map +1 -0
  74. package/dist/files-D3gJa91B.js +1 -0
  75. package/dist/generate-BnrvBAzF.js +1646 -0
  76. package/dist/generate-BnrvBAzF.js.map +1 -0
  77. package/dist/{git-Crl3b87o.js → git-rPfl7AD1.js} +3 -3
  78. package/dist/{git-Crl3b87o.js.map → git-rPfl7AD1.js.map} +1 -1
  79. package/dist/{harness-CEuntrla.js → harness-1OkumOAm.js} +3 -3
  80. package/dist/{harness-CEuntrla.js.map → harness-1OkumOAm.js.map} +1 -1
  81. package/dist/harness.d.ts +1 -1
  82. package/dist/harness.js +1 -1
  83. package/dist/{header-DHQv_ZrF.js → header-BVzbRnNv.js} +10 -3
  84. package/dist/{header-DHQv_ZrF.js.map → header-BVzbRnNv.js.map} +1 -1
  85. package/dist/{images-Bi3aGxb9.js → images-m784ueGK.js} +61 -13
  86. package/dist/images-m784ueGK.js.map +1 -0
  87. package/dist/index.d.ts +3 -3
  88. package/dist/index.js +4 -4
  89. package/dist/init-hiTkiM4L.js +543 -0
  90. package/dist/init-hiTkiM4L.js.map +1 -0
  91. package/dist/init-kMkTgTZc.js +1 -0
  92. package/dist/insights-B2Xmhz9o.js +64 -0
  93. package/dist/insights-B2Xmhz9o.js.map +1 -0
  94. package/dist/{invocations-BYDPe3fV.js → invocations-D_ePcwyL.js} +4 -4
  95. package/dist/{invocations-BYDPe3fV.js.map → invocations-D_ePcwyL.js.map} +1 -1
  96. package/dist/{judge-DW_GDOmB.js → judge-CEDIfRiU.js} +50 -15
  97. package/dist/judge-CEDIfRiU.js.map +1 -0
  98. package/dist/judge.d.ts +7 -6
  99. package/dist/judge.js +8 -7
  100. package/dist/judge.js.map +1 -1
  101. package/dist/{live-jlfszAbb.js → live-DYd2QEyR.js} +2 -2
  102. package/dist/{live-jlfszAbb.js.map → live-DYd2QEyR.js.map} +1 -1
  103. package/dist/model-B8H3gL69.js +1 -0
  104. package/dist/{model-DaVCY3rb.js → model-CTiuzkWw.js} +9 -7
  105. package/dist/model-CTiuzkWw.js.map +1 -0
  106. package/dist/model-DcIbmggK.js +1 -0
  107. package/dist/{model-D0IcOQao.js → model-DpkclE4r.js} +60 -25
  108. package/dist/model-DpkclE4r.js.map +1 -0
  109. package/dist/{model-DaX4bNLZ.js → model-UgHDMhI1.js} +144 -46
  110. package/dist/model-UgHDMhI1.js.map +1 -0
  111. package/dist/{node-B3ydHo6t.js → node-CGZYh4Fj.js} +4 -4
  112. package/dist/{node-B3ydHo6t.js.map → node-CGZYh4Fj.js.map} +1 -1
  113. package/dist/{opencode-providers-J9colP0-.js → opencode-providers-snfeWd6Z.js} +86 -47
  114. package/dist/opencode-providers-snfeWd6Z.js.map +1 -0
  115. package/dist/{options-C0d0AzeR.js → options-CyAyLjgJ.js} +22 -11
  116. package/dist/options-CyAyLjgJ.js.map +1 -0
  117. package/dist/{pairs-CnInRu-G.js → pairs-DP6XOJby.js} +2 -2
  118. package/dist/{pairs-CnInRu-G.js.map → pairs-DP6XOJby.js.map} +1 -1
  119. package/dist/{patch-B1bnfhN-.js → patch-uMq9rCl_.js} +2 -2
  120. package/dist/{patch-B1bnfhN-.js.map → patch-uMq9rCl_.js.map} +1 -1
  121. package/dist/{plan-DgQxp9yy.js → plan-CZYgXnZh.js} +21 -8
  122. package/dist/plan-CZYgXnZh.js.map +1 -0
  123. package/dist/plugins-P-uh54VF.js +654 -0
  124. package/dist/plugins-P-uh54VF.js.map +1 -0
  125. package/dist/{preflight-DlQvbySb.js → preflight-BQlPTHVu.js} +1 -1
  126. package/dist/{preflight-BRzD30L5.js → preflight-D3HvKeAx.js} +14 -10
  127. package/dist/preflight-D3HvKeAx.js.map +1 -0
  128. package/dist/prepare-DCwM2KKD.js +2 -0
  129. package/dist/{prepare-B_y-AFMv.js → prepare-Dx7dOnJB.js} +70 -23
  130. package/dist/prepare-Dx7dOnJB.js.map +1 -0
  131. package/dist/{provenance-DQ0AXn6c.js → provenance-C_-8y-x3.js} +4 -4
  132. package/dist/{provenance-DQ0AXn6c.js.map → provenance-C_-8y-x3.js.map} +1 -1
  133. package/dist/{providers-DoTq1jHW.js → providers-CF5UEaP8.js} +24 -10
  134. package/dist/providers-CF5UEaP8.js.map +1 -0
  135. package/dist/providers-CTBYvMxu.js +1 -0
  136. package/dist/{query-BO-ux7RB.js → query-DXthKmq0.js} +3 -3
  137. package/dist/{query-BO-ux7RB.js.map → query-DXthKmq0.js.map} +1 -1
  138. package/dist/query-D_1ARx5q.js +1 -0
  139. package/dist/{questions-C2dym2ce.js → questions-KENpWnfV.js} +8 -9
  140. package/dist/questions-KENpWnfV.js.map +1 -0
  141. package/dist/{record-BKmMvZ6O.js → record-kk9M1hj-.js} +8 -4
  142. package/dist/record-kk9M1hj-.js.map +1 -0
  143. package/dist/{redact-DJ9JCShu.js → redact-CRGdfV2s.js} +4 -2
  144. package/dist/redact-CRGdfV2s.js.map +1 -0
  145. package/dist/remarks-1521zwfW.js +38 -0
  146. package/dist/remarks-1521zwfW.js.map +1 -0
  147. package/dist/remarks-BhAV1H4V.js +1 -0
  148. package/dist/remarks-Ml6bcSdV.js +278 -0
  149. package/dist/remarks-Ml6bcSdV.js.map +1 -0
  150. package/dist/{remote-CPPW86Q9.js → remote-Dkeghk8k.js} +3 -3
  151. package/dist/{remote-CPPW86Q9.js.map → remote-Dkeghk8k.js.map} +1 -1
  152. package/dist/resolve-CMmhACr6.js +1 -0
  153. package/dist/resolve-DzdWcIL6.js +724 -0
  154. package/dist/resolve-DzdWcIL6.js.map +1 -0
  155. package/dist/{results-BE2f-1XS.js → results-D-naai_Q.js} +33 -8
  156. package/dist/results-D-naai_Q.js.map +1 -0
  157. package/dist/{resume-Ca1c8vix.js → resume-8-nnW8iO.js} +4 -4
  158. package/dist/{resume-Ca1c8vix.js.map → resume-8-nnW8iO.js.map} +1 -1
  159. package/dist/{root-DICDHCtp.js → root-DNuLhaA5.js} +2 -2
  160. package/dist/root-DNuLhaA5.js.map +1 -0
  161. package/dist/rules-CcV3zLDR.js +318 -0
  162. package/dist/rules-CcV3zLDR.js.map +1 -0
  163. package/dist/run-Bel7Vde4.js +88 -0
  164. package/dist/run-Bel7Vde4.js.map +1 -0
  165. package/dist/{sandbox-DLrsvu7U.js → sandbox-YLbk9mO7.js} +2 -2
  166. package/dist/{sandbox-DLrsvu7U.js.map → sandbox-YLbk9mO7.js.map} +1 -1
  167. package/dist/sandbox.d.ts +1 -1
  168. package/dist/sandbox.js +1 -1
  169. package/dist/server-C-ysqkLv.js +1 -0
  170. package/dist/{server-TUY5xA_A.js → server-De8oH3bt.js} +10 -10
  171. package/dist/{server-TUY5xA_A.js.map → server-De8oH3bt.js.map} +1 -1
  172. package/dist/{source-DJGS0a0u.js → source-C686eZpY.js} +2 -2
  173. package/dist/{source-DJGS0a0u.js.map → source-C686eZpY.js.map} +1 -1
  174. package/dist/source-DjgypUHW.js +1 -0
  175. package/dist/src-3mP821Pt.js +2 -0
  176. package/dist/src-B3KCLZVk.js +3 -0
  177. package/dist/src-BAyg6CtQ.js +2 -0
  178. package/dist/{src-CF17Ug08.js → src-BYLM3hEz.js} +22 -6
  179. package/dist/src-BYLM3hEz.js.map +1 -0
  180. package/dist/src-BezgGX4X.js +2 -0
  181. package/dist/{src-DvCg0NBs.js → src-C7W6kg81.js} +40 -10
  182. package/dist/{src-DvCg0NBs.js.map → src-C7W6kg81.js.map} +1 -1
  183. package/dist/{src-ftu5wPSt.js → src-CIpKL45U.js} +782 -169
  184. package/dist/src-CIpKL45U.js.map +1 -0
  185. package/dist/src-ChBhk06Q.js +2 -0
  186. package/dist/{src-BxfCKA3_.js → src-CoqZYspK.js} +1 -1
  187. package/dist/{src-CFp86GtV.js → src-CzQrAcF8.js} +49 -49
  188. package/dist/src-CzQrAcF8.js.map +1 -0
  189. package/dist/src-D9fSTxlc.js +1 -0
  190. package/dist/{src-FGXhkEkH.js → src-DeY52Gyf.js} +182 -23
  191. package/dist/src-DeY52Gyf.js.map +1 -0
  192. package/dist/src-DrJSnoMR.js +2 -0
  193. package/dist/{src-DvK0EIZx.js → src-Xj_BZKbq.js} +112 -13
  194. package/dist/src-Xj_BZKbq.js.map +1 -0
  195. package/dist/{src-u8_ixn_F.js → src-cbCb-MPy.js} +20 -4
  196. package/dist/src-cbCb-MPy.js.map +1 -0
  197. package/dist/src-dhSTRN50.js +2 -0
  198. package/dist/{src-C7_1SqDP.js → src-djNNYIdP.js} +2 -2
  199. package/dist/{src-C7_1SqDP.js.map → src-djNNYIdP.js.map} +1 -1
  200. package/dist/state-BGWGAwdo.js +1 -0
  201. package/dist/{state-DfpHox6b.js → state-C0i_ujQZ.js} +19 -17
  202. package/dist/{state-DfpHox6b.js.map → state-C0i_ujQZ.js.map} +1 -1
  203. package/dist/studio-app/assets/{index-CBkhNAv8.js → index-Bb_cid9k.js} +9 -9
  204. package/dist/studio-app/index.html +1 -1
  205. package/dist/{suite-Cw_7G2RM.js → suite-DmuF_ApO.js} +80 -30
  206. package/dist/suite-DmuF_ApO.js.map +1 -0
  207. package/dist/suite-mn9g4veR.js +2 -0
  208. package/dist/{summary-BUKfU-9l.js → summary-BFMHMTz2.js} +273 -47
  209. package/dist/summary-BFMHMTz2.js.map +1 -0
  210. package/dist/testing.d.ts +2 -2
  211. package/dist/testing.js +2 -2
  212. package/dist/{text-gEcKjAyp.js → text-CrVy5ioL.js} +18 -2
  213. package/dist/text-CrVy5ioL.js.map +1 -0
  214. package/dist/{transcript-BNNANU8A.js → transcript-BTxJpW4R.js} +2 -2
  215. package/dist/{transcript-BNNANU8A.js.map → transcript-BTxJpW4R.js.map} +1 -1
  216. package/dist/{types-BYdlwMwo.d.ts → types-B-9b1MDV.d.ts} +850 -34
  217. package/dist/types-C5vI3g1C.js.map +1 -1
  218. package/dist/usage-BDo2q_yu.js +1 -0
  219. package/dist/{command-Bj39y-Wm.js → validate-DWjkshl1.js} +20 -377
  220. package/dist/validate-DWjkshl1.js.map +1 -0
  221. package/dist/view/index.d.ts +31 -263
  222. package/dist/view/index.js +8 -7
  223. package/dist/views-DE2A1jEX.js +2 -0
  224. package/dist/{views-B8w2J-gD.js → views-Dk8MCQKr.js} +8 -98
  225. package/dist/views-Dk8MCQKr.js.map +1 -0
  226. package/dist/{worker-entry-DNnveLqx.js → worker-entry-CqrzGPF4.js} +2 -2
  227. package/dist/{worker-entry-DNnveLqx.js.map → worker-entry-CqrzGPF4.js.map} +1 -1
  228. package/dist/workspace-B1eGO46M.js +1 -0
  229. package/dist/{workspace-C4RA3srV.js → workspace-CLeOybkr.js} +45 -11
  230. package/dist/workspace-CLeOybkr.js.map +1 -0
  231. package/package.json +5 -1
  232. package/skills/eval-rubric/SKILL.md +130 -0
  233. package/dist/agent-D483ru7D.js +0 -334
  234. package/dist/agent-D483ru7D.js.map +0 -1
  235. package/dist/assemble-D5KGrwnJ.js +0 -1
  236. package/dist/assemble-D9GWr-HS.js.map +0 -1
  237. package/dist/capture-CYGLpWxR.js +0 -1
  238. package/dist/cli-ClpPT8kn.js.map +0 -1
  239. package/dist/cli-spec-qmEnQ25_.js.map +0 -1
  240. package/dist/command-Bj39y-Wm.js.map +0 -1
  241. package/dist/command-C-cVjlny.js +0 -1
  242. package/dist/command-DbAe1Rzb.js.map +0 -1
  243. package/dist/command-TgbzPizb.js.map +0 -1
  244. package/dist/commands-YUwlyTbr.js +0 -228
  245. package/dist/commands-YUwlyTbr.js.map +0 -1
  246. package/dist/config-DrVSEVN0.js.map +0 -1
  247. package/dist/context-C1mxXh80.js.map +0 -1
  248. package/dist/db-CKg5NtiW.js +0 -2
  249. package/dist/db-DfhipHEF.js +0 -1416
  250. package/dist/db-DfhipHEF.js.map +0 -1
  251. package/dist/docker-D1HZDS6q.js.map +0 -1
  252. package/dist/doctor-D2MbNO8L.js.map +0 -1
  253. package/dist/egress-2-qzPvGi.js.map +0 -1
  254. package/dist/environment-Cca6a4wB.js.map +0 -1
  255. package/dist/evaluate-DKIl54Hb.js.map +0 -1
  256. package/dist/files-BXHZFWmx.js.map +0 -1
  257. package/dist/files-BpUYBwGu.js.map +0 -1
  258. package/dist/files-Bw8lWEjg.js +0 -1
  259. package/dist/files-D6J0iSdx.js +0 -1
  260. package/dist/images-Bi3aGxb9.js.map +0 -1
  261. package/dist/init-Cl3f3NBT.js +0 -360
  262. package/dist/init-Cl3f3NBT.js.map +0 -1
  263. package/dist/init-fhOXED8F.js +0 -1
  264. package/dist/judge-DW_GDOmB.js.map +0 -1
  265. package/dist/model-CXhrziBe.js +0 -1
  266. package/dist/model-D0IcOQao.js.map +0 -1
  267. package/dist/model-DaVCY3rb.js.map +0 -1
  268. package/dist/model-DaX4bNLZ.js.map +0 -1
  269. package/dist/model-_bxNrk2h.js +0 -1
  270. package/dist/opencode-providers-J9colP0-.js.map +0 -1
  271. package/dist/options-C0d0AzeR.js.map +0 -1
  272. package/dist/plan-DgQxp9yy.js.map +0 -1
  273. package/dist/preflight-BRzD30L5.js.map +0 -1
  274. package/dist/prepare-B_y-AFMv.js.map +0 -1
  275. package/dist/prepare-DCKTLHN3.js +0 -2
  276. package/dist/providers-B9yTdIqF.js +0 -1
  277. package/dist/providers-DoTq1jHW.js.map +0 -1
  278. package/dist/query-CRQfsw0e.js +0 -1
  279. package/dist/questions-C2dym2ce.js.map +0 -1
  280. package/dist/record-BKmMvZ6O.js.map +0 -1
  281. package/dist/redact-DJ9JCShu.js.map +0 -1
  282. package/dist/results-BE2f-1XS.js.map +0 -1
  283. package/dist/root-DICDHCtp.js.map +0 -1
  284. package/dist/server-Dp8eOeK5.js +0 -1
  285. package/dist/source-DdbLGR1M.js +0 -1
  286. package/dist/src-CF17Ug08.js.map +0 -1
  287. package/dist/src-CFp86GtV.js.map +0 -1
  288. package/dist/src-CLoOMVWI.js +0 -3
  289. package/dist/src-CcrQbpG8.js +0 -2
  290. package/dist/src-DCFtJRp0.js +0 -2
  291. package/dist/src-DSYYPEOj.js +0 -2
  292. package/dist/src-DYO3DdnQ.js +0 -1
  293. package/dist/src-DvK0EIZx.js.map +0 -1
  294. package/dist/src-FGXhkEkH.js.map +0 -1
  295. package/dist/src-WD-zgQYZ.js +0 -2
  296. package/dist/src-_oI9AePb.js +0 -2
  297. package/dist/src-ftu5wPSt.js.map +0 -1
  298. package/dist/src-qsKCqv7a.js +0 -2
  299. package/dist/src-u8_ixn_F.js.map +0 -1
  300. package/dist/state-DpAxYyED.js +0 -1
  301. package/dist/suite-Cw_7G2RM.js.map +0 -1
  302. package/dist/suite-DamAEnNF.js +0 -1
  303. package/dist/summary-BUKfU-9l.js.map +0 -1
  304. package/dist/summary-Baa4rTHS.js +0 -192
  305. package/dist/summary-Baa4rTHS.js.map +0 -1
  306. package/dist/text-gEcKjAyp.js.map +0 -1
  307. package/dist/tools-DLHgetpx.js +0 -249
  308. package/dist/tools-DLHgetpx.js.map +0 -1
  309. package/dist/views-B8w2J-gD.js.map +0 -1
  310. package/dist/views-DblnI3kA.js +0 -2
  311. package/dist/workspace-C4RA3srV.js.map +0 -1
  312. package/dist/workspace-C_X0tdv6.js +0 -1
@@ -0,0 +1,724 @@
1
+ import { p as parseDuration } from "./shared-CA61BuPJ.js";
2
+ import { C as parseGitRepo, M as workspaceLabel, S as mcpHosts, b as isSecret, k as stepCommand, n as DEFAULT_SKILL_EXCLUDE, v as isHostFile, x as isSecretTemplate } from "./environment-B4IuURK1.js";
3
+ import { l as sha256 } from "./ids-Bp6ut7ZD.js";
4
+ import { c as registerSecret, r as badCharacterAt } from "./redact-CRGdfV2s.js";
5
+ import "./config-D7TFvUpL.js";
6
+ import { A as placeholder, R as hostAllowed, ut as run } from "./src-CIpKL45U.js";
7
+ import { A as readPlugin, D as pluginServerName, E as pluginParts, M as skillCall, O as pluginSourceLabel, T as pluginFiles, _ as localMarketplace, c as PluginProblem, g as leavesSource, j as samePluginTwice, k as readMarketplace, m as fetchesAtStart, w as pluginCall, x as marketplaceLabel } from "./plugins-P-uh54VF.js";
8
+ import { t as InfraError } from "./types-C5vI3g1C.js";
9
+ import { S as refusedPlugins, b as layoutOf } from "./egress-DEAvq8Fl.js";
10
+ import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
11
+ import { basename, isAbsolute, join, relative, sep } from "node:path";
12
+ import { parse } from "yaml";
13
+ import { mkdir, rm } from "node:fs/promises";
14
+ //#region src/environment/resolve.ts
15
+ const SKILL_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
16
+ const DEFAULT_SETUP_TIMEOUT = "5m";
17
+ function broker(secrets, name, value, hosts, where = ["header"], phase = "agent") {
18
+ const at = badCharacterAt(value);
19
+ if (at && where.includes("header")) throw new InfraError(`${name} has whitespace or a line break in it (character ${at}), so it can't go in a request header. A key copied from a wrapped terminal line picks these up; set it again as one line.`);
20
+ const sub = {
21
+ name,
22
+ placeholder: placeholder(),
23
+ value,
24
+ hosts: [...hosts],
25
+ in: [...where],
26
+ phase
27
+ };
28
+ secrets.brokered.push(sub);
29
+ return sub.placeholder;
30
+ }
31
+ /** The host value, or its placeholder when it's brokered to `secret.hosts` (else `hosts`). */
32
+ function hostValue(name, secret, where, secrets, hosts = secret.hosts) {
33
+ const from = secret.from ?? name;
34
+ const value = process.env[from];
35
+ if (!value) {
36
+ if (secret.optional) {
37
+ secrets.unset.push(name);
38
+ return;
39
+ }
40
+ const source = from === name ? name : `${name} (from ${from})`;
41
+ throw new InfraError(`Secret ${source} for ${where} isn't set. Set it in the environment or .env.local.`);
42
+ }
43
+ registerSecret(value);
44
+ if (secret.to === "checks") secrets.checks.push(name);
45
+ else secrets.names.push(name);
46
+ if (!hosts) return value;
47
+ return broker(secrets, name, value, hosts, secret.in, secret.to === "checks" ? "checks" : "agent");
48
+ }
49
+ /** Each host variable in the template, or with `hosts` one placeholder per variable. */
50
+ function template(value, where, secrets, hosts) {
51
+ const placeholders = /* @__PURE__ */ new Map();
52
+ return value.template.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_, name) => {
53
+ const v = process.env[name];
54
+ if (!v) throw new InfraError(`secret.template for ${where} needs ${name}, which isn't set. Set it in the environment or .env.local.`);
55
+ registerSecret(v);
56
+ if (!hosts) return v;
57
+ const p = placeholders.get(name) ?? broker(secrets, name, v, hosts);
58
+ placeholders.set(name, p);
59
+ return p;
60
+ });
61
+ }
62
+ /** A `SKILL.md` split into its YAML frontmatter's `name` and `description` and its body. */
63
+ function parseSkillMd(text, where) {
64
+ const match = /^---\r?\n(?:([\s\S]*?)\r?\n)?---[ \t]*(?:\r?\n|$)([\s\S]*)$/.exec(text);
65
+ if (!match) return { body: text };
66
+ let front;
67
+ try {
68
+ front = parse(match[1] ?? "");
69
+ } catch (error) {
70
+ const reason = error.message.split("\n")[0];
71
+ throw new InfraError(`${where}: the SKILL.md frontmatter isn't valid YAML (${reason}). Quote values that contain ": ".`);
72
+ }
73
+ if (front != null && (typeof front !== "object" || Array.isArray(front))) throw new InfraError(`${where}: the SKILL.md frontmatter must be a YAML mapping, e.g. name: my-skill and description: … on their own lines`);
74
+ const field = (key) => {
75
+ const value = front?.[key];
76
+ if (value == null) return void 0;
77
+ if (typeof value !== "string") throw new InfraError(`${where}: the SKILL.md ${key} must be a string (got ${typeof value})`);
78
+ return value.trim() || void 0;
79
+ };
80
+ return {
81
+ name: field("name"),
82
+ description: field("description"),
83
+ body: match[2] ?? ""
84
+ };
85
+ }
86
+ /** A gitignore-style test for `DEFAULT_SKILL_EXCLUDE`-shaped patterns against a skill-relative path. */
87
+ function excludeMatcher(patterns) {
88
+ const rules = patterns.map((pattern) => {
89
+ const dirOnly = pattern.endsWith("/");
90
+ const body = pattern.replace(/\/+$/, "");
91
+ const anchored = body.includes("/");
92
+ const glob = body.replace(/^\/+/, "").split("*").map((part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&")).join("[^/]*");
93
+ return {
94
+ dirOnly,
95
+ re: new RegExp(`${anchored ? "^" : "(?:^|/)"}${glob}$`)
96
+ };
97
+ });
98
+ return (path, isDir) => rules.some((r) => (isDir || !r.dirOnly) && r.re.test(path));
99
+ }
100
+ function parseSkill(dir, source, exclude) {
101
+ const front = parseSkillMd(readFileSync(join(dir, "SKILL.md"), "utf8"), `Skill ${basename(dir)} in ${source}`);
102
+ const name = front.name || basename(dir);
103
+ checkSkill(name, front.description, source);
104
+ const skip = excludeMatcher(exclude);
105
+ const paths = [];
106
+ const excluded = [];
107
+ const walk = (rel) => {
108
+ for (const entry of readdirSync(join(dir, rel), { withFileTypes: true })) {
109
+ const path = rel ? `${rel}/${entry.name}` : entry.name;
110
+ const isDir = entry.isDirectory();
111
+ if (entry.name === ".git") continue;
112
+ if (skip(path, isDir)) excluded.push(isDir ? `${path}/` : path);
113
+ else if (isDir) walk(path);
114
+ else if (entry.isFile() && path !== "SKILL.md") paths.push(path);
115
+ }
116
+ };
117
+ walk("");
118
+ const files = paths.sort().map((path) => ({
119
+ path,
120
+ content: readFileSync(join(dir, path), "utf8")
121
+ }));
122
+ return {
123
+ skill: {
124
+ name,
125
+ description: front.description ?? "",
126
+ content: front.body,
127
+ files
128
+ },
129
+ excluded: excluded.sort()
130
+ };
131
+ }
132
+ function checkSkill(name, description, source) {
133
+ if (!SKILL_NAME.test(name)) throw new InfraError(`Skill "${name}" in ${source}: the name must be kebab-case, e.g. my-skill (lower-case letters, digits and -)`);
134
+ if (!description) throw new InfraError(`Skill "${name}" in ${source} has no description in its SKILL.md frontmatter. Add a description: line saying when to use it.`);
135
+ }
136
+ function loadSkills(dir, source, only, exclude = DEFAULT_SKILL_EXCLUDE) {
137
+ if (!existsSync(dir) || !statSync(dir).isDirectory()) throw new InfraError(`Skill source ${source} isn't a directory. Point it at a skill's directory, or at a directory of skills.`);
138
+ const dirs = existsSync(join(dir, "SKILL.md")) ? [dir] : readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && existsSync(join(dir, e.name, "SKILL.md"))).map((e) => join(dir, e.name)).sort();
139
+ if (dirs.length === 0) throw new InfraError(`Skill source ${source} has no SKILL.md (and no subdirectories with one)`);
140
+ const skills = dirs.map((d) => parseSkill(d, source, exclude));
141
+ if (!only) return skills;
142
+ const missing = only.filter((n) => !skills.some((s) => s.skill.name === n));
143
+ if (missing.length) throw new InfraError(`only: ${JSON.stringify(missing)} not found in ${source} (found: ${skills.map((s) => s.skill.name).join(", ")})`);
144
+ return skills.filter((s) => only.includes(s.skill.name));
145
+ }
146
+ async function git(args, cwd, what) {
147
+ const r = await run("git", args, { cwd });
148
+ if (r.exitCode !== 0) throw new InfraError(`${what} failed: ${r.stderr.trim()}`);
149
+ return r.stdout.trim();
150
+ }
151
+ /** One clone per source and ref per worker process; the commit is recorded. */
152
+ const clones = /* @__PURE__ */ new Map();
153
+ /** A clone checks out the committed bytes, whatever the host's line-ending settings. */
154
+ const AS_COMMITTED = [
155
+ "-c",
156
+ "core.autocrlf=false",
157
+ "-c",
158
+ "core.eol=lf"
159
+ ];
160
+ function cloneSkills(root, url, ref) {
161
+ const key = `${url}#${ref ?? ""}`;
162
+ let clone = clones.get(key);
163
+ if (!clone) {
164
+ clone = (async () => {
165
+ const dir = join(root, ".reeval", "cache", "skills", `${sha256(key).slice(0, 16)}-${process.pid}`);
166
+ await rm(dir, {
167
+ recursive: true,
168
+ force: true
169
+ });
170
+ await mkdir(dir, { recursive: true });
171
+ const what = `Cloning ${url}${ref ? ` at ${ref}` : ""}`;
172
+ await git(["init", "-q"], dir, what);
173
+ await git([
174
+ ...AS_COMMITTED,
175
+ "fetch",
176
+ "-q",
177
+ "--depth",
178
+ "1",
179
+ "--end-of-options",
180
+ url,
181
+ ref ?? "HEAD"
182
+ ], dir, what);
183
+ await git([
184
+ ...AS_COMMITTED,
185
+ "-c",
186
+ "advice.detachedHead=false",
187
+ "checkout",
188
+ "-q",
189
+ "FETCH_HEAD"
190
+ ], dir, what);
191
+ return {
192
+ dir,
193
+ commit: await git(["rev-parse", "HEAD"], dir, what)
194
+ };
195
+ })();
196
+ clones.set(key, clone);
197
+ clone.catch(() => clones.delete(key));
198
+ }
199
+ return clone;
200
+ }
201
+ const packs = /* @__PURE__ */ new Map();
202
+ /** `npm pack` into the cache, unpacked; returns the package directory. */
203
+ function unpackNpm(root, spec) {
204
+ let pack = packs.get(spec);
205
+ if (!pack) {
206
+ pack = (async () => {
207
+ const dir = join(root, ".reeval", "cache", "skills", `npm-${sha256(spec).slice(0, 16)}-${process.pid}`);
208
+ await rm(dir, {
209
+ recursive: true,
210
+ force: true
211
+ });
212
+ await mkdir(dir, { recursive: true });
213
+ const packed = await run("npm", [
214
+ "pack",
215
+ spec,
216
+ "--silent",
217
+ "--pack-destination",
218
+ dir
219
+ ], { cwd: dir });
220
+ const tarball = packed.stdout.trim().split("\n").at(-1);
221
+ if (packed.exitCode !== 0 || !tarball) throw new InfraError(`npm pack ${spec} failed: ${packed.stderr.trim()}`);
222
+ const untar = await run("tar", ["-xzf", tarball], { cwd: dir });
223
+ if (untar.exitCode !== 0) throw new InfraError(`Unpacking ${spec} failed: ${untar.stderr.trim()}`);
224
+ return join(dir, "package");
225
+ })();
226
+ packs.set(spec, pack);
227
+ pack.catch(() => packs.delete(spec));
228
+ }
229
+ return pack;
230
+ }
231
+ async function resolveSkills(root, s) {
232
+ switch (s.source) {
233
+ case "local": {
234
+ const label = `local:${relative(root, s.path).split(sep).join("/") || "."}`;
235
+ return {
236
+ skills: loadSkills(s.path, label, s.only, s.exclude),
237
+ source: label,
238
+ commit: null
239
+ };
240
+ }
241
+ case "git": {
242
+ const { url } = parseGitRepo(s.repo);
243
+ const { dir, commit } = await cloneSkills(root, url, s.ref);
244
+ const path = s.path ?? (!existsSync(join(dir, "SKILL.md")) && existsSync(join(dir, "skills")) ? "skills" : "");
245
+ const label = `${s.repo}${s.ref ? `#${s.ref}` : ""}${path ? `:${path}` : ""}`;
246
+ return {
247
+ skills: loadSkills(join(dir, path), label, s.only, s.exclude),
248
+ source: label,
249
+ commit
250
+ };
251
+ }
252
+ case "registry": {
253
+ const [repo = "", name = ""] = s.id.split("@");
254
+ const { dir, commit } = await cloneSkills(root, `https://github.com/${repo}.git`, s.version);
255
+ const label = `registry:${s.id}${s.version ? `#${s.version}` : ""}`;
256
+ return {
257
+ skills: loadSkills(existsSync(join(dir, "skills")) ? join(dir, "skills") : dir, label, [name]),
258
+ source: label,
259
+ commit
260
+ };
261
+ }
262
+ case "npm": {
263
+ const dir = await unpackNpm(root, s.spec);
264
+ const label = `npm:${isAbsolute(s.spec) ? relative(root, s.spec).split(sep).join("/") : s.spec}:${s.path}`;
265
+ return {
266
+ skills: loadSkills(join(dir, s.path), label, s.only, s.exclude),
267
+ source: label,
268
+ commit: null
269
+ };
270
+ }
271
+ case "inline": {
272
+ checkSkill(s.name, s.description, "skill.inline");
273
+ const files = Object.entries(s.files).sort(([a], [b]) => a < b ? -1 : 1).map(([path, content]) => ({
274
+ path,
275
+ content
276
+ }));
277
+ return {
278
+ skills: [{
279
+ skill: {
280
+ name: s.name,
281
+ description: s.description,
282
+ content: s.content,
283
+ files
284
+ },
285
+ excluded: []
286
+ }],
287
+ source: "inline",
288
+ commit: null
289
+ };
290
+ }
291
+ }
292
+ }
293
+ /** A marketplace entry's source: the marketplace itself for a `./` entry, else the entry's own. */
294
+ async function entrySourceDir(root, p) {
295
+ const m = p.marketplace;
296
+ const label = marketplaceLabel(m, root);
297
+ const fetched = m.source === "git" ? await cloneSkills(root, parseGitRepo(m.repo).url, m.ref) : {
298
+ dir: await unpackNpm(root, m.spec),
299
+ commit: null
300
+ };
301
+ const { marketplace: name, entry } = readMarketplace(fetched.dir, pluginCall(p, root), label, p.name, localMarketplace(m));
302
+ const marketplace = {
303
+ name,
304
+ source: label,
305
+ commit: fetched.commit
306
+ };
307
+ switch (entry.source) {
308
+ case "path": return {
309
+ context: fetched.dir,
310
+ path: entry.path || ".",
311
+ commit: fetched.commit,
312
+ source: entry.path ? `${label}:${entry.path}` : label,
313
+ marketplace
314
+ };
315
+ case "git": {
316
+ const clone = await cloneSkills(root, entry.url, entry.ref);
317
+ if (entry.path && leavesSource(clone.dir, entry.path)) throw new PluginProblem(`the ${name} marketplace's entry "${p.name}" has path ${entry.path}, which leaves ${entry.repo} through a symlink`);
318
+ return {
319
+ context: clone.dir,
320
+ path: entry.path ?? ".",
321
+ commit: clone.commit,
322
+ source: `${entry.repo}${entry.ref ? `#${entry.ref}` : ""}${entry.path ? `:${entry.path}` : ""}`,
323
+ marketplace
324
+ };
325
+ }
326
+ case "npm": return {
327
+ context: await unpackNpm(root, entry.spec),
328
+ path: ".",
329
+ commit: null,
330
+ source: `npm:${entry.spec}`,
331
+ marketplace
332
+ };
333
+ }
334
+ }
335
+ /**
336
+ * A plugin's whole source on the host, fetched once per process: the repository at its commit,
337
+ * the unpacked package, or the local directory, with the plugin's `path` in it (`.` for the root).
338
+ * A marketplace entry's is its marketplace's for a `./` entry, else the entry's own source.
339
+ */
340
+ async function pluginSourceDir(root, p) {
341
+ const labelled = {
342
+ source: pluginSourceLabel(p, root),
343
+ marketplace: null
344
+ };
345
+ switch (p.source) {
346
+ case "local": return {
347
+ context: p.path,
348
+ path: ".",
349
+ commit: null,
350
+ ...labelled
351
+ };
352
+ case "git": {
353
+ const clone = await cloneSkills(root, parseGitRepo(p.repo).url, p.ref);
354
+ return {
355
+ context: clone.dir,
356
+ path: p.path ?? ".",
357
+ commit: clone.commit,
358
+ ...labelled
359
+ };
360
+ }
361
+ case "npm": return {
362
+ context: await unpackNpm(root, p.spec),
363
+ path: p.path ?? ".",
364
+ commit: null,
365
+ ...labelled
366
+ };
367
+ case "marketplace": return entrySourceDir(root, p);
368
+ }
369
+ }
370
+ async function resolvePlugin(root, p, where) {
371
+ try {
372
+ const { context, path, commit, source, marketplace } = await pluginSourceDir(root, p);
373
+ return {
374
+ contents: readPlugin(join(context, path), pluginCall(p, root), p.only),
375
+ declared: p,
376
+ source,
377
+ commit,
378
+ marketplace
379
+ };
380
+ } catch (error) {
381
+ if (error instanceof PluginProblem) throw new InfraError(`${where}: ${error.message}`);
382
+ throw error;
383
+ }
384
+ }
385
+ const skillHash = (s) => sha256(JSON.stringify(s));
386
+ const readHostFile = (f, where) => {
387
+ if (!existsSync(f.path)) throw new InfraError(`${f.path} for ${where} doesn't exist. file() paths resolve against the file that calls it, or reeval.yaml's directory.`);
388
+ return readFileSync(f.path);
389
+ };
390
+ /**
391
+ * Layers the environment (root first; a later layer wins on shared keys, and each such key is
392
+ * an override), over the options `env` merged down the cascade. `where` names the attempt, and
393
+ * `rulesFile` is the workspace file the harness's agent reads `rules` from.
394
+ */
395
+ async function resolveEnvironment(environment, optionsEnv, root, where, rulesFile, egress = "allow-all", prepared = () => void 0, options = {}) {
396
+ const envWhere = `environment ${environment.name} (${where})`;
397
+ const overrides = /* @__PURE__ */ new Set();
398
+ const env = { ...optionsEnv };
399
+ const files = /* @__PURE__ */ new Map();
400
+ const mcp = /* @__PURE__ */ new Map();
401
+ const skills = /* @__PURE__ */ new Map();
402
+ const plugins = /* @__PURE__ */ new Map();
403
+ let rules;
404
+ const setup = [];
405
+ const seen = {
406
+ env: /* @__PURE__ */ new Set(),
407
+ files: /* @__PURE__ */ new Set(),
408
+ mcp: /* @__PURE__ */ new Set()
409
+ };
410
+ let egressSet = false;
411
+ let workspace;
412
+ let sandboxSet = false;
413
+ for (const layer of environment.layers) {
414
+ const { spec } = layer;
415
+ if (spec.sandbox !== void 0) {
416
+ if (sandboxSet) overrides.add("sandbox");
417
+ sandboxSet = true;
418
+ }
419
+ if (spec.workspace !== void 0) {
420
+ if (workspace) overrides.add("workspace");
421
+ workspace = spec.workspace;
422
+ }
423
+ if (spec.egress !== void 0) {
424
+ if (egressSet) overrides.add("egress");
425
+ egressSet = true;
426
+ }
427
+ for (const [k, v] of Object.entries(spec.env ?? {})) {
428
+ if (seen.env.has(k)) overrides.add(`env.${k}`);
429
+ seen.env.add(k);
430
+ env[k] = v;
431
+ }
432
+ for (const [path, v] of Object.entries(spec.files ?? {})) {
433
+ if (seen.files.has(path)) overrides.add(`files.${path}`);
434
+ seen.files.add(path);
435
+ files.set(path, v);
436
+ }
437
+ if (spec.rules !== void 0) {
438
+ if (rules !== void 0) overrides.add("rules");
439
+ rules = spec.rules;
440
+ }
441
+ for (const [name, server] of Object.entries(spec.mcp ?? {})) {
442
+ if (seen.mcp.has(name)) overrides.add(`mcp.${name}`);
443
+ seen.mcp.add(name);
444
+ mcp.set(name, server);
445
+ }
446
+ for (const step of spec.setup ?? []) {
447
+ const s = typeof step === "string" ? { run: step } : step;
448
+ setup.push({
449
+ run: s.run,
450
+ timeoutMs: parseDuration(s.timeout ?? DEFAULT_SETUP_TIMEOUT),
451
+ ...s.cwd ? { cwd: s.cwd } : {}
452
+ });
453
+ }
454
+ const layerSkills = /* @__PURE__ */ new Set();
455
+ for (const source of spec.skills ?? []) {
456
+ const found = await resolveSkills(root, source);
457
+ for (const loaded of found.skills) {
458
+ const name = loaded.skill.name;
459
+ if (skills.has(name) && !layerSkills.has(name)) overrides.add(`skills.${name}`);
460
+ layerSkills.add(name);
461
+ skills.delete(name);
462
+ skills.set(name, {
463
+ ...loaded,
464
+ placement: source.placement,
465
+ source: found.source,
466
+ commit: found.commit,
467
+ call: skillCall(source, root)
468
+ });
469
+ }
470
+ }
471
+ const layerPlugins = /* @__PURE__ */ new Map();
472
+ for (const source of spec.plugins ?? []) {
473
+ const found = await resolvePlugin(root, source, envWhere);
474
+ const { name, call } = found.contents;
475
+ const first = layerPlugins.get(name);
476
+ if (first) throw new InfraError(`${envWhere}: ${samePluginTwice(layer.name, name, first, call)}`);
477
+ if (plugins.has(name)) overrides.add(`plugins.${name}`);
478
+ layerPlugins.set(name, call);
479
+ plugins.delete(name);
480
+ plugins.set(name, found);
481
+ }
482
+ }
483
+ const pluginList = [...plugins.values()];
484
+ const harness = options.harness ?? { kind: "fake" };
485
+ const refused = refusedPlugins(harness, pluginList.map((p) => p.contents), {
486
+ skills: [...skills.values()].filter((s) => s.placement === "harness").map((s) => ({
487
+ name: s.skill.name,
488
+ call: s.call
489
+ })),
490
+ mcp: [...mcp.keys()]
491
+ });
492
+ if (refused) throw new InfraError(`${envWhere}: ${refused}`);
493
+ const allowed = options.allowed ?? null;
494
+ const fetches = fetchesAtStart(pluginList.map((p) => p.contents), allowed);
495
+ if (fetches.refusal) throw new InfraError(`${envWhere}: ${fetches.refusal}`);
496
+ const pluginSkills = [];
497
+ const resolvedPlugins = [];
498
+ const pluginRecords = [];
499
+ for (const { contents: p, declared, source, commit, marketplace } of pluginList) {
500
+ const loaded = p.skills.length ? loadSkills(join(p.dir, "skills"), source, p.skills.map((s) => s.name)) : [];
501
+ for (const l of loaded) pluginSkills.push({
502
+ ...l,
503
+ plugin: p.name,
504
+ source,
505
+ commit
506
+ });
507
+ const servers = [];
508
+ for (const [name, server] of Object.entries(p.mcp)) {
509
+ if (allowed && server.transport !== "stdio") {
510
+ const host = new URL(server.url).hostname;
511
+ if (!hostAllowed(allowed, host)) throw new InfraError(`${envWhere}: the ${p.name} plugin's MCP server "${name}" is at ${host}, which egress doesn't allow: add it to egress.allow`);
512
+ }
513
+ const key = pluginServerName(p.name, name);
514
+ mcp.set(key, server);
515
+ servers.push(key);
516
+ }
517
+ const files = pluginFiles(p);
518
+ resolvedPlugins.push({
519
+ name: p.name,
520
+ files,
521
+ parts: p.kept,
522
+ servers,
523
+ declared,
524
+ commit
525
+ });
526
+ pluginRecords.push({
527
+ name: p.name,
528
+ source,
529
+ marketplace,
530
+ commit,
531
+ sha256: sha256(JSON.stringify(files.map((f) => [f.path, sha256(f.content)]))),
532
+ build: null,
533
+ parts: pluginParts(p, loaded.map((l) => l.skill.name))
534
+ });
535
+ }
536
+ const secrets = {
537
+ names: [],
538
+ checks: [],
539
+ unset: [],
540
+ brokered: []
541
+ };
542
+ const vars = {};
543
+ const checkVars = {};
544
+ for (const [name, value] of Object.entries(env)) {
545
+ if (!isSecret(value)) {
546
+ vars[name] = value;
547
+ continue;
548
+ }
549
+ const resolved = hostValue(name, value, envWhere, secrets);
550
+ if (resolved === void 0) continue;
551
+ if (value.to === "checks") checkVars[name] = resolved;
552
+ else vars[name] = resolved;
553
+ }
554
+ const secretOf = (value, key, hosts) => {
555
+ if (typeof value === "string") return value;
556
+ if (isSecretTemplate(value)) return template(value, envWhere, secrets, hosts);
557
+ return hostValue(key, value, envWhere, secrets, value.hosts ?? hosts);
558
+ };
559
+ const resolvedMcp = {};
560
+ for (const [name, s] of mcp) if (s.transport === "stdio") {
561
+ const e = {};
562
+ for (const [k, v] of Object.entries(s.env)) {
563
+ const r = secretOf(v, k);
564
+ if (r !== void 0) e[k] = r;
565
+ }
566
+ resolvedMcp[name] = {
567
+ transport: "stdio",
568
+ command: s.command,
569
+ args: s.args,
570
+ env: e
571
+ };
572
+ } else {
573
+ const h = {};
574
+ const hosts = mcpHosts(s.url);
575
+ for (const [k, v] of Object.entries(s.headers)) {
576
+ const r = secretOf(v, k, hosts);
577
+ if (r !== void 0) h[k] = r;
578
+ }
579
+ resolvedMcp[name] = {
580
+ transport: s.transport,
581
+ url: s.url,
582
+ headers: h
583
+ };
584
+ }
585
+ const fileList = [...files].map(([path, v]) => ({
586
+ path,
587
+ content: isHostFile(v) ? readHostFile(v, envWhere) : v,
588
+ ...isHostFile(v) && statSync(v.path).mode & 64 ? { executable: true } : {}
589
+ }));
590
+ const rulesContent = rules === void 0 ? void 0 : isHostFile(rules) ? Buffer.from(readHostFile(rules, envWhere)).toString("utf8") : rules;
591
+ const skillList = [...skills.values()];
592
+ const skillRecords = [...skillList.map(({ skill, placement, source, commit, excluded }) => ({
593
+ name: skill.name,
594
+ source,
595
+ commit,
596
+ sha256: skillHash(skill),
597
+ placement,
598
+ excluded
599
+ })), ...pluginSkills.map(({ skill, source, commit, excluded, plugin }) => ({
600
+ name: skill.name,
601
+ source,
602
+ commit,
603
+ sha256: skillHash(skill),
604
+ placement: "harness",
605
+ excluded,
606
+ plugin
607
+ }))];
608
+ const fileRecords = fileList.map((f) => ({
609
+ path: f.path,
610
+ sha256: sha256(f.content)
611
+ }));
612
+ const executable = fileList.flatMap((f) => f.executable ? [f.path] : []);
613
+ const rulesRecord = rulesContent === void 0 ? void 0 : {
614
+ path: rulesFile,
615
+ sha256: sha256(rulesContent)
616
+ };
617
+ if (rulesContent !== void 0) fileList.push({
618
+ path: rulesFile,
619
+ content: rulesContent
620
+ });
621
+ const secretNames = [.../* @__PURE__ */ new Set([...secrets.names, ...secrets.checks])].sort();
622
+ const brokered = secrets.brokered.map((b) => JSON.stringify([
623
+ b.name,
624
+ b.hosts,
625
+ b.in,
626
+ b.phase
627
+ ])).sort();
628
+ const brokeredNames = [...new Set(secrets.brokered.map((b) => b.name))].sort();
629
+ const varNames = Object.keys(vars).filter((n) => !secrets.names.includes(n)).sort();
630
+ const literalVars = Object.fromEntries(varNames.map((n) => [n, vars[n]]));
631
+ const mcpShape = Object.fromEntries(Object.entries(resolvedMcp).map(([name, s]) => s.transport === "stdio" ? [name, {
632
+ command: s.command,
633
+ args: s.args,
634
+ env: Object.keys(s.env).sort()
635
+ }] : [name, {
636
+ transport: s.transport,
637
+ url: s.url,
638
+ headers: Object.keys(s.headers).sort()
639
+ }]));
640
+ const tree = workspace && prepared(workspace);
641
+ if (workspace && !tree) throw new InfraError(`The workspace git(${JSON.stringify(workspaceLabel(workspace))}) for ${envWhere} wasn't prepared before the run started`);
642
+ const workspaceRecord = workspace && tree ? {
643
+ source: isAbsolute(workspace.url) ? relative(root, workspace.url).split(sep).join("/") || "." : workspace.repo,
644
+ ref: workspace.ref ?? null,
645
+ path: workspace.path ?? null,
646
+ commit: tree.commit,
647
+ tree: tree.tree,
648
+ ...workspace.init ? { init: true } : {}
649
+ } : void 0;
650
+ const digest = `sha256:${sha256(JSON.stringify({
651
+ setup,
652
+ skills: skillRecords.map((s) => [
653
+ s.name,
654
+ s.sha256,
655
+ s.placement
656
+ ]),
657
+ mcp: mcpShape,
658
+ files: fileRecords,
659
+ ...executable.length ? { executable } : {},
660
+ rules: rulesRecord?.sha256,
661
+ vars: literalVars,
662
+ secrets: secretNames,
663
+ checks: [...secrets.checks].sort(),
664
+ unset: [...secrets.unset].sort(),
665
+ brokered,
666
+ ...egress === "allow-all" ? {} : { egress: typeof egress === "string" ? egress : [...egress.allow].sort() },
667
+ ...pluginRecords.length ? { plugins: pluginRecords.map((p, i) => {
668
+ const r = resolvedPlugins[i];
669
+ const build = r?.declared.build;
670
+ return [
671
+ p.name,
672
+ p.sha256,
673
+ r?.parts,
674
+ ...build === void 0 ? [] : [build]
675
+ ];
676
+ }) } : {},
677
+ ...workspaceRecord ? { workspace: workspaceRecord.init ? [workspaceRecord.tree, "init"] : workspaceRecord.tree } : {}
678
+ }))}`;
679
+ return {
680
+ record: {
681
+ name: environment.name,
682
+ parent: environment.parent,
683
+ overrides: [...overrides],
684
+ digest,
685
+ setup: setup.map(stepCommand),
686
+ skills: skillRecords,
687
+ mcp: Object.keys(resolvedMcp).sort(),
688
+ ...pluginRecords.length ? { plugins: pluginRecords } : {},
689
+ files: rulesRecord ? [...fileRecords, rulesRecord] : fileRecords,
690
+ vars: varNames,
691
+ secrets: secretNames,
692
+ brokered: brokeredNames,
693
+ unset: [...secrets.unset].sort(),
694
+ egress,
695
+ ...workspaceRecord ? { workspace: workspaceRecord } : {}
696
+ },
697
+ setup,
698
+ skills: [...skillList.filter((s) => s.placement === "harness").map((s) => s.skill), ...layoutOf(harness).pluginPlacement === "flat" ? pluginSkills.map((s) => s.skill) : []],
699
+ workspaceSkills: skillList.filter((s) => s.placement === "workspace").map((s) => s.skill),
700
+ mcp: resolvedMcp,
701
+ files: fileList,
702
+ vars,
703
+ checkVars,
704
+ substitutions: secrets.brokered,
705
+ plugins: resolvedPlugins,
706
+ ...workspace && tree ? { workspace: {
707
+ tar: tree.tar,
708
+ label: workspaceLabel(workspace),
709
+ commit: tree.commit,
710
+ ...workspace.init ? { init: true } : {}
711
+ } } : {}
712
+ };
713
+ }
714
+ /** A skill as a `SKILL.md` file plus its other files, for writing into a directory. */
715
+ function skillFiles(skill) {
716
+ return [{
717
+ path: "SKILL.md",
718
+ content: `${`---\nname: ${skill.name}\ndescription: ${JSON.stringify(skill.description)}\n---\n`}${skill.content}`
719
+ }, ...skill.files];
720
+ }
721
+ //#endregion
722
+ export { skillFiles as a, resolveEnvironment as i, parseSkillMd as n, pluginSourceDir as r, excludeMatcher as t };
723
+
724
+ //# sourceMappingURL=resolve-DzdWcIL6.js.map