@tangle-network/agent-eval 0.200.1 → 0.201.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 (230) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/adapters/http.d.ts +7 -8
  3. package/dist/adapters/http.d.ts.map +1 -1
  4. package/dist/adapters/http.js +2 -2
  5. package/dist/adapters/http.js.map +1 -1
  6. package/dist/agent-profile-DDfIjdyS.d.ts.map +1 -1
  7. package/dist/analyst/index.d.ts +76 -76
  8. package/dist/analyst/index.d.ts.map +1 -1
  9. package/dist/analyst/index.js +6 -6
  10. package/dist/{analyze-runs-DFbp2gB8.js → analyze-runs-BrIibNd0.js} +47 -42
  11. package/dist/{analyze-runs-DFbp2gB8.js.map → analyze-runs-BrIibNd0.js.map} +1 -1
  12. package/dist/{ast-CP9ae9B0.js → ast-DJ6Bc7ab.js} +5 -4
  13. package/dist/{ast-CP9ae9B0.js.map → ast-DJ6Bc7ab.js.map} +1 -1
  14. package/dist/authenticity/index.d.ts +14 -15
  15. package/dist/authenticity/index.d.ts.map +1 -1
  16. package/dist/{baseline-BC-eBZ7U.js → baseline-CVKsfWTg.js} +2 -2
  17. package/dist/{baseline-BC-eBZ7U.js.map → baseline-CVKsfWTg.js.map} +1 -1
  18. package/dist/{benchmark-BeQJyrRC.js → benchmark-BywPeAUo.js} +4 -3
  19. package/dist/{benchmark-BeQJyrRC.js.map → benchmark-BywPeAUo.js.map} +1 -1
  20. package/dist/{benchmark-command-EBmuMUBo.js → benchmark-command-DFs_i62N.js} +24 -23
  21. package/dist/{benchmark-command-EBmuMUBo.js.map → benchmark-command-DFs_i62N.js.map} +1 -1
  22. package/dist/benchmarks/index.d.ts +12 -12
  23. package/dist/benchmarks/index.d.ts.map +1 -1
  24. package/dist/benchmarks/index.js +3 -3
  25. package/dist/{bounded-process-BBZob7vl.js → bounded-process-Cj9YjXbE.js} +3 -3
  26. package/dist/{bounded-process-BBZob7vl.js.map → bounded-process-Cj9YjXbE.js.map} +1 -1
  27. package/dist/builder-eval/index.d.ts +16 -17
  28. package/dist/builder-eval/index.d.ts.map +1 -1
  29. package/dist/builder-eval/index.js +12 -10
  30. package/dist/builder-eval/index.js.map +1 -1
  31. package/dist/campaign/index.js +11 -11
  32. package/dist/{campaign-L391bmir.js → campaign-PmTWZi72.js} +30 -25
  33. package/dist/{campaign-L391bmir.js.map → campaign-PmTWZi72.js.map} +1 -1
  34. package/dist/{campaign-evidence-jL_U7Ikv.js → campaign-evidence-Dt_rWPk2.js} +4 -4
  35. package/dist/{campaign-evidence-jL_U7Ikv.js.map → campaign-evidence-Dt_rWPk2.js.map} +1 -1
  36. package/dist/{chat-client-CJORSG_J.js → chat-client-DUhWNQQS.js} +5 -4
  37. package/dist/{chat-client-CJORSG_J.js.map → chat-client-DUhWNQQS.js.map} +1 -1
  38. package/dist/{chat-json-call-DnlDjpco.js → chat-json-call-Dx_sHzqm.js} +2 -2
  39. package/dist/{chat-json-call-DnlDjpco.js.map → chat-json-call-Dx_sHzqm.js.map} +1 -1
  40. package/dist/{claim-V9Zqbq0J.js → claim-BXcZw-jo.js} +2 -2
  41. package/dist/{claim-V9Zqbq0J.js.map → claim-BXcZw-jo.js.map} +1 -1
  42. package/dist/cli.js +12 -11
  43. package/dist/cli.js.map +1 -1
  44. package/dist/contract/index.js +22 -19
  45. package/dist/contract/index.js.map +1 -1
  46. package/dist/{default-registry-xMLX160E.js → default-registry-D4qXx2aG.js} +2 -2
  47. package/dist/{default-registry-xMLX160E.js.map → default-registry-D4qXx2aG.js.map} +1 -1
  48. package/dist/define-agent-eval-1YuvJpOs.d.ts.map +1 -1
  49. package/dist/{define-agent-eval-7q_UwsTt.js → define-agent-eval-CJN9dTQw.js} +10 -9
  50. package/dist/{define-agent-eval-7q_UwsTt.js.map → define-agent-eval-CJN9dTQw.js.map} +1 -1
  51. package/dist/{descriptive-1V17A-qa.js → descriptive-D9LUFk1-.js} +2 -2
  52. package/dist/{descriptive-1V17A-qa.js.map → descriptive-D9LUFk1-.js.map} +1 -1
  53. package/dist/diagnosis/index.d.ts +7 -7
  54. package/dist/diagnosis/index.d.ts.map +1 -1
  55. package/dist/diagnosis/index.js +2 -2
  56. package/dist/diagnosis/index.js.map +1 -1
  57. package/dist/{dspy-rlm-engine-B5T43BkZ.js → dspy-rlm-engine-US8YsYGq.js} +5 -5
  58. package/dist/{dspy-rlm-engine-B5T43BkZ.js.map → dspy-rlm-engine-US8YsYGq.js.map} +1 -1
  59. package/dist/{eval-campaign-GapmPHIA.js → eval-campaign-ha_aWtk7.js} +14 -12
  60. package/dist/{eval-campaign-GapmPHIA.js.map → eval-campaign-ha_aWtk7.js.map} +1 -1
  61. package/dist/evaluation.d.ts +9 -10
  62. package/dist/evaluation.d.ts.map +1 -1
  63. package/dist/experiment/index.d.ts +29 -29
  64. package/dist/experiment/index.d.ts.map +1 -1
  65. package/dist/experiment/index.js +13 -12
  66. package/dist/experiment/index.js.map +1 -1
  67. package/dist/{exporters-DEcXbvgO.js → exporters-Coiv-qO2.js} +2 -2
  68. package/dist/{exporters-DEcXbvgO.js.map → exporters-Coiv-qO2.js.map} +1 -1
  69. package/dist/{external-optimizer-process-CEXcCKqd.js → external-optimizer-process-KLcw0Vnc.js} +2 -2
  70. package/dist/{external-optimizer-process-CEXcCKqd.js.map → external-optimizer-process-KLcw0Vnc.js.map} +1 -1
  71. package/dist/{external-optimizer-subprocess-laM1-UDV.js → external-optimizer-subprocess-CkyUUV7h.js} +4 -4
  72. package/dist/{external-optimizer-subprocess-laM1-UDV.js.map → external-optimizer-subprocess-CkyUUV7h.js.map} +1 -1
  73. package/dist/fuzz.d.ts +15 -15
  74. package/dist/fuzz.d.ts.map +1 -1
  75. package/dist/{hf-dataset-CRqtSjnR.js → hf-dataset-kjIfIK_e.js} +3 -3
  76. package/dist/{hf-dataset-CRqtSjnR.js.map → hf-dataset-kjIfIK_e.js.map} +1 -1
  77. package/dist/hosted/index.d.ts +8 -8
  78. package/dist/hosted/index.d.ts.map +1 -1
  79. package/dist/hosted/index.js +1 -1
  80. package/dist/{index-D4pC7Tvd2.d.ts → index-D4pC7Tvd.d.ts} +1 -1
  81. package/dist/index-D4pC7Tvd.d.ts.map +1 -0
  82. package/dist/index-DKmrHA02.d.ts.map +1 -1
  83. package/dist/{index-DNgf5gyG2.d.ts → index-DNgf5gyG.d.ts} +1 -1
  84. package/dist/index-DNgf5gyG.d.ts.map +1 -0
  85. package/dist/index.d.ts +124 -124
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +52 -42
  88. package/dist/index.js.map +1 -1
  89. package/dist/{integrity-BFP4kjGj.js → integrity-BvnVARVl.js} +30 -29
  90. package/dist/{integrity-BFP4kjGj.js.map → integrity-BvnVARVl.js.map} +1 -1
  91. package/dist/{integrity-BvHANvnp.js → integrity-uwK7XC-8.js} +2 -2
  92. package/dist/{integrity-BvHANvnp.js.map → integrity-uwK7XC-8.js.map} +1 -1
  93. package/dist/{internal-BMFSR8Ns.js → internal-BOe3zmjQ.js} +2 -2
  94. package/dist/{internal-BMFSR8Ns.js.map → internal-BOe3zmjQ.js.map} +1 -1
  95. package/dist/{jev-review-Cu9xtIu4.js → jev-review-DZEjDzlF.js} +7 -5
  96. package/dist/{jev-review-Cu9xtIu4.js.map → jev-review-DZEjDzlF.js.map} +1 -1
  97. package/dist/jev.d.ts +10 -10
  98. package/dist/jev.d.ts.map +1 -1
  99. package/dist/jev.js +2 -2
  100. package/dist/{judge-calibration-DYmaBtJr.js → judge-calibration-C5zgtiJT.js} +2 -2
  101. package/dist/{judge-calibration-DYmaBtJr.js.map → judge-calibration-C5zgtiJT.js.map} +1 -1
  102. package/dist/kind-factory-CdPPHtGZ.js.map +1 -1
  103. package/dist/{llm-client-c_bKHTXz.js → llm-client-Bhqoglar.js} +6 -4
  104. package/dist/{llm-client-c_bKHTXz.js.map → llm-client-Bhqoglar.js.map} +1 -1
  105. package/dist/{llm-judge-CL6f3utD.js → llm-judge-C-0P1WiT.js} +26 -21
  106. package/dist/{llm-judge-CL6f3utD.js.map → llm-judge-C-0P1WiT.js.map} +1 -1
  107. package/dist/matrix/index.d.ts +1 -1
  108. package/dist/matrix/index.js +1 -1
  109. package/dist/{matrix-_NLSWsKM.d.ts → matrix--IZKROxD.d.ts} +2 -2
  110. package/dist/{matrix-_NLSWsKM.d.ts.map → matrix--IZKROxD.d.ts.map} +1 -1
  111. package/dist/{matrix-pWinRMPl.js → matrix-DnlHn5x1.js} +8 -6
  112. package/dist/{matrix-pWinRMPl.js.map → matrix-DnlHn5x1.js.map} +1 -1
  113. package/dist/meta-eval/index.d.ts +55 -55
  114. package/dist/meta-eval/index.d.ts.map +1 -1
  115. package/dist/meta-eval/index.js +4 -4
  116. package/dist/{mint-iCD-W43s.js → mint-vlRckJEX.js} +2 -2
  117. package/dist/{mint-iCD-W43s.js.map → mint-vlRckJEX.js.map} +1 -1
  118. package/dist/multishot/golden/index.d.ts +23 -23
  119. package/dist/multishot/golden/index.d.ts.map +1 -1
  120. package/dist/multishot/golden/index.js +1 -1
  121. package/dist/multishot/index.d.ts +9 -9
  122. package/dist/multishot/index.d.ts.map +1 -1
  123. package/dist/multishot/index.js +1 -1
  124. package/dist/openapi.json +1 -1
  125. package/dist/{otel-spans-CQmSxtcS.js → otel-spans-C8YIJWy1.js} +9 -4
  126. package/dist/{otel-spans-CQmSxtcS.js.map → otel-spans-C8YIJWy1.js.map} +1 -1
  127. package/dist/{outcome-store-BXlkwMPR.js → outcome-store-DUcMj-3D.js} +2 -2
  128. package/dist/{outcome-store-BXlkwMPR.js.map → outcome-store-DUcMj-3D.js.map} +1 -1
  129. package/dist/package-version-D7lQHt_-.js.map +1 -1
  130. package/dist/{paired-arms-DKZFVPt8.js → paired-arms-DpS_h8ON.js} +8 -5
  131. package/dist/{paired-arms-DKZFVPt8.js.map → paired-arms-DpS_h8ON.js.map} +1 -1
  132. package/dist/{paired-binary-fzkwENI4.js → paired-binary-OMBVRtc-.js} +2 -2
  133. package/dist/{paired-binary-fzkwENI4.js.map → paired-binary-OMBVRtc-.js.map} +1 -1
  134. package/dist/{paired-promotion-decision-D5B1Cxc2.js → paired-promotion-decision-DhrmjdV8.js} +5 -4
  135. package/dist/{paired-promotion-decision-D5B1Cxc2.js.map → paired-promotion-decision-DhrmjdV8.js.map} +1 -1
  136. package/dist/{paired-tests-C8iCsioC.js → paired-tests-Ccr16gcW.js} +3 -3
  137. package/dist/{paired-tests-C8iCsioC.js.map → paired-tests-Ccr16gcW.js.map} +1 -1
  138. package/dist/pipelines/index.d.ts +19 -19
  139. package/dist/pipelines/index.d.ts.map +1 -1
  140. package/dist/pipelines/index.js +5 -4
  141. package/dist/pipelines/index.js.map +1 -1
  142. package/dist/{power-and-mde-K_CmO3dc.js → power-and-mde-bie6i965.js} +9 -6
  143. package/dist/{power-and-mde-K_CmO3dc.js.map → power-and-mde-bie6i965.js.map} +1 -1
  144. package/dist/{produced-state-DZMW8cuF.js → produced-state-CR2tAPLf.js} +8 -5
  145. package/dist/{produced-state-DZMW8cuF.js.map → produced-state-CR2tAPLf.js.map} +1 -1
  146. package/dist/{promotion-policy-C6FAJvmZ.js → promotion-policy-BI1RxzwD.js} +4 -4
  147. package/dist/{promotion-policy-C6FAJvmZ.js.map → promotion-policy-BI1RxzwD.js.map} +1 -1
  148. package/dist/{raw-provider-sink-CXuOhLvT.js → raw-provider-sink-rB2DYxr6.js} +2 -2
  149. package/dist/{raw-provider-sink-CXuOhLvT.js.map → raw-provider-sink-rB2DYxr6.js.map} +1 -1
  150. package/dist/{release-confidence-XQm_xjhR.js → release-confidence-CiFg1EPq.js} +3 -2
  151. package/dist/{release-confidence-XQm_xjhR.js.map → release-confidence-CiFg1EPq.js.map} +1 -1
  152. package/dist/{report-command-DKJ_yAIj.js → report-command-DzPpFgjB.js} +20 -18
  153. package/dist/{report-command-DKJ_yAIj.js.map → report-command-DzPpFgjB.js.map} +1 -1
  154. package/dist/reporting.js +5 -5
  155. package/dist/{reward-hacking-D0XwhVWE.js → reward-hacking-C-a__ShZ.js} +5 -3
  156. package/dist/{reward-hacking-D0XwhVWE.js.map → reward-hacking-C-a__ShZ.js.map} +1 -1
  157. package/dist/rl.d.ts +186 -186
  158. package/dist/rl.d.ts.map +1 -1
  159. package/dist/rl.js +21 -17
  160. package/dist/rl.js.map +1 -1
  161. package/dist/rollout/index.d.ts +1 -1
  162. package/dist/rollout/index.js +5 -5
  163. package/dist/{rollout-B-XBReTC.js → rollout-BUQixCoc.js} +5 -5
  164. package/dist/{rollout-B-XBReTC.js.map → rollout-BUQixCoc.js.map} +1 -1
  165. package/dist/{rubric-predictive-validity-CCK-1B7w.js → rubric-predictive-validity-B0Pg-3I5.js} +3 -3
  166. package/dist/{rubric-predictive-validity-CCK-1B7w.js.map → rubric-predictive-validity-B0Pg-3I5.js.map} +1 -1
  167. package/dist/{run-record-tNnlQIrD.js → run-record-BB290Y9A.js} +5 -3
  168. package/dist/{run-record-tNnlQIrD.js.map → run-record-BB290Y9A.js.map} +1 -1
  169. package/dist/{schema-C1aaAxTf.js → schema-DAMp77zB.js} +24 -20
  170. package/dist/{schema-C1aaAxTf.js.map → schema-DAMp77zB.js.map} +1 -1
  171. package/dist/search/index.d.ts +34 -34
  172. package/dist/search/index.d.ts.map +1 -1
  173. package/dist/search/index.js +2 -2
  174. package/dist/{search-kernel-AVgIjXaI.js → search-kernel-Dpniloks.js} +33 -26
  175. package/dist/{search-kernel-AVgIjXaI.js.map → search-kernel-Dpniloks.js.map} +1 -1
  176. package/dist/{search-ledger-CL0-mXQ8.js → search-ledger-CXQPwdWz.js} +4 -3
  177. package/dist/{search-ledger-CL0-mXQ8.js.map → search-ledger-CXQPwdWz.js.map} +1 -1
  178. package/dist/{search-shipper-Cs6K4km9.js → search-shipper-DhhofkDX.js} +3 -6
  179. package/dist/{search-shipper-Cs6K4km9.js.map → search-shipper-DhhofkDX.js.map} +1 -1
  180. package/dist/{search-summary-DvWk0hb3.js → search-summary-C1nAHgkB.js} +4 -4
  181. package/dist/{search-summary-DvWk0hb3.js.map → search-summary-C1nAHgkB.js.map} +1 -1
  182. package/dist/{semantic-concept-judge-2SE_kXGF.js → semantic-concept-judge-BcjYg37z.js} +4 -4
  183. package/dist/{semantic-concept-judge-2SE_kXGF.js.map → semantic-concept-judge-BcjYg37z.js.map} +1 -1
  184. package/dist/{sequential-Yz3OSskl.js → sequential-DWn_np6P.js} +2 -3
  185. package/dist/{sequential-Yz3OSskl.js.map → sequential-DWn_np6P.js.map} +1 -1
  186. package/dist/{server-D56r1lhp.js → server-B4jMhqQn.js} +2 -2
  187. package/dist/{server-D56r1lhp.js.map → server-B4jMhqQn.js.map} +1 -1
  188. package/dist/{skillopt-optimization-method-B2syNik0.js → skillopt-optimization-method-Bls9t-G_.js} +9 -9
  189. package/dist/{skillopt-optimization-method-B2syNik0.js.map → skillopt-optimization-method-Bls9t-G_.js.map} +1 -1
  190. package/dist/{statistical-heldout-BAFDCo07.js → statistical-heldout-CNLOvRq_.js} +3 -3
  191. package/dist/{statistical-heldout-BAFDCo07.js.map → statistical-heldout-CNLOvRq_.js.map} +1 -1
  192. package/dist/statistical-heldout-HswMvzbP.d.ts.map +1 -1
  193. package/dist/{store-DNe_Uv1Q.js → store-BhNuLdJw.js} +3 -5
  194. package/dist/{store-DNe_Uv1Q.js.map → store-BhNuLdJw.js.map} +1 -1
  195. package/dist/store-C4avFjIi.d.ts.map +1 -1
  196. package/dist/{store-otlp-BPowgPm6.js → store-otlp-yd9lDziN.js} +2 -2
  197. package/dist/{store-otlp-BPowgPm6.js.map → store-otlp-yd9lDziN.js.map} +1 -1
  198. package/dist/{store-tool-spans-BaGakFc2.js → store-tool-spans-Biio4_Nw.js} +4 -4
  199. package/dist/{store-tool-spans-BaGakFc2.js.map → store-tool-spans-Biio4_Nw.js.map} +1 -1
  200. package/dist/storyboard/index.d.ts +20 -21
  201. package/dist/storyboard/index.d.ts.map +1 -1
  202. package/dist/{student-t-BA-Uy51p.js → student-t-BBZYka0E.js} +4 -3
  203. package/dist/{student-t-BA-Uy51p.js.map → student-t-BBZYka0E.js.map} +1 -1
  204. package/dist/{summary-report-BeYnvddy.js → summary-report-DLzptLSA.js} +8 -7
  205. package/dist/{summary-report-BeYnvddy.js.map → summary-report-DLzptLSA.js.map} +1 -1
  206. package/dist/supervisor-run/index.d.ts +25 -25
  207. package/dist/supervisor-run/index.d.ts.map +1 -1
  208. package/dist/supervisor-run/index.js +2 -2
  209. package/dist/{tool-waste-CJDfxH45.js → tool-waste-B-u3rzCz.js} +11 -6
  210. package/dist/{tool-waste-CJDfxH45.js.map → tool-waste-B-u3rzCz.js.map} +1 -1
  211. package/dist/trace-repair/index.d.ts +96 -96
  212. package/dist/trace-repair/index.d.ts.map +1 -1
  213. package/dist/trace-repair/index.js +1 -1
  214. package/dist/trace-repair/index.js.map +1 -1
  215. package/dist/traces.d.ts +29 -29
  216. package/dist/traces.d.ts.map +1 -1
  217. package/dist/traces.js +9 -7
  218. package/dist/traces.js.map +1 -1
  219. package/dist/trajectory-replay/index.d.ts +35 -35
  220. package/dist/trajectory-replay/index.d.ts.map +1 -1
  221. package/dist/trajectory-replay/index.js +5 -5
  222. package/dist/trajectory-replay/index.js.map +1 -1
  223. package/dist/{tree-Ki_gW7z8.js → tree-D48IJUK0.js} +39 -31
  224. package/dist/{tree-Ki_gW7z8.js.map → tree-D48IJUK0.js.map} +1 -1
  225. package/dist/wire/index.d.ts +48 -48
  226. package/dist/wire/index.d.ts.map +1 -1
  227. package/dist/wire/index.js +1 -1
  228. package/package.json +18 -36
  229. package/dist/index-D4pC7Tvd2.d.ts.map +0 -1
  230. package/dist/index-DNgf5gyG2.d.ts.map +0 -1
@@ -22,7 +22,7 @@ interface BenchmarkMetricCalibrationResult {
22
22
  gap: number;
23
23
  reasons: string[];
24
24
  }
25
- declare function calibrateBenchmarkMetric<TPayload = unknown, TArtifact = string>(options: BenchmarkMetricCalibrationOptions<TPayload, TArtifact>): Promise<BenchmarkMetricCalibrationResult>;
25
+ export declare function calibrateBenchmarkMetric<TPayload = unknown, TArtifact = string>(options: BenchmarkMetricCalibrationOptions<TPayload, TArtifact>): Promise<BenchmarkMetricCalibrationResult>;
26
26
  //#endregion
27
27
  //#region src/benchmarks/harbor.d.ts
28
28
  /** One Harbor task, as its `task.toml` and `instruction.md` state it. */
@@ -90,9 +90,9 @@ interface HarborBenchmarkAdapter<TArtifact> extends BenchmarkAdapter<HarborTaskI
90
90
  loadAll(): Promise<HarborTaskItem[]>;
91
91
  }
92
92
  /** Read one Harbor task directory. Throws when `task.toml` or `instruction.md` is missing or malformed. */
93
- declare function readHarborTask(taskDir: string): Promise<HarborTaskPayload>;
93
+ export declare function readHarborTask(taskDir: string): Promise<HarborTaskPayload>;
94
94
  /** Import a Harbor dataset checkout as a `BenchmarkAdapter` whose scorer is the dataset's own verifier. */
95
- declare function createHarborBenchmarkAdapter<TArtifact = string>(options: HarborBenchmarkOptions<TArtifact>): HarborBenchmarkAdapter<TArtifact>;
95
+ export declare function createHarborBenchmarkAdapter<TArtifact = string>(options: HarborBenchmarkOptions<TArtifact>): HarborBenchmarkAdapter<TArtifact>;
96
96
  //#endregion
97
97
  //#region src/benchmarks/routing/dataset.d.ts
98
98
  /**
@@ -217,7 +217,7 @@ interface BenchmarkRunResult<TPayload = unknown, TArtifact = string> {
217
217
  reportJsonPath: string;
218
218
  reportMarkdownPath: string;
219
219
  }
220
- declare function runBenchmarkAdapter<TPayload = unknown, TArtifact = string>(options: BenchmarkRunOptions<TPayload, TArtifact>): Promise<BenchmarkRunResult<TPayload, TArtifact>>;
220
+ export declare function runBenchmarkAdapter<TPayload = unknown, TArtifact = string>(options: BenchmarkRunOptions<TPayload, TArtifact>): Promise<BenchmarkRunResult<TPayload, TArtifact>>;
221
221
  //#endregion
222
222
  //#region src/benchmarks/standard-formats.d.ts
223
223
  interface StandardRetrievalDocument {
@@ -280,13 +280,13 @@ interface StandardRetrievalEvaluationOptions {
280
280
  passMetric?: string;
281
281
  passThreshold?: number;
282
282
  }
283
- declare function parseJsonlRows<T = unknown>(text: string): T[];
284
- declare function parseQrels(text: string): StandardRetrievalQrel[];
285
- declare function parseBeirCorpusJsonl(text: string): StandardRetrievalDocument[];
286
- declare function parseBeirQueriesJsonl(text: string): StandardRetrievalQuery[];
287
- declare function buildStandardRetrievalItems(options: BuildStandardRetrievalItemsOptions): Array<BenchmarkDatasetItem<StandardRetrievalPayload>>;
288
- declare function createRetrievalIdBenchmarkAdapter(options: RetrievalIdAdapterOptions): BenchmarkAdapter<BenchmarkDatasetItem<StandardRetrievalPayload>, StandardRetrievalPayload, StandardRetrievalArtifact>;
289
- declare function evaluateStandardRetrieval(payload: StandardRetrievalPayload, artifact: StandardRetrievalArtifact, options?: StandardRetrievalEvaluationOptions): {
283
+ export declare function parseJsonlRows<T = unknown>(text: string): T[];
284
+ export declare function parseQrels(text: string): StandardRetrievalQrel[];
285
+ export declare function parseBeirCorpusJsonl(text: string): StandardRetrievalDocument[];
286
+ export declare function parseBeirQueriesJsonl(text: string): StandardRetrievalQuery[];
287
+ export declare function buildStandardRetrievalItems(options: BuildStandardRetrievalItemsOptions): Array<BenchmarkDatasetItem<StandardRetrievalPayload>>;
288
+ export declare function createRetrievalIdBenchmarkAdapter(options: RetrievalIdAdapterOptions): BenchmarkAdapter<BenchmarkDatasetItem<StandardRetrievalPayload>, StandardRetrievalPayload, StandardRetrievalArtifact>;
289
+ export declare function evaluateStandardRetrieval(payload: StandardRetrievalPayload, artifact: StandardRetrievalArtifact, options?: StandardRetrievalEvaluationOptions): {
290
290
  score: number;
291
291
  passed: boolean;
292
292
  dimensions: Record<string, number>;
@@ -297,5 +297,5 @@ declare function evaluateStandardRetrieval(payload: StandardRetrievalPayload, ar
297
297
  };
298
298
  };
299
299
  //#endregion
300
- export { BENCHMARK_SPLIT_SEED, type BenchmarkAdapter, type BenchmarkDatasetItem, type BenchmarkDistribution, type BenchmarkEvaluation, type BenchmarkFamily, type BenchmarkMetricCalibrationOptions, type BenchmarkMetricCalibrationResult, type BenchmarkReport, type BenchmarkResponder, type BenchmarkRunOptions, type BenchmarkRunResult, type BenchmarkScenario, type BenchmarkSliceSummary, type BenchmarkSource, type BenchmarkTaskKind, type BuildStandardRetrievalItemsOptions, type HarborBenchmarkAdapter, type HarborBenchmarkOptions, type HarborGradeOutcome, type HarborTaskItem, type HarborTaskPayload, type RetrievalIdAdapterOptions, type StandardRetrievalArtifact, type StandardRetrievalDocument, type StandardRetrievalEvaluationOptions, type StandardRetrievalPayload, type StandardRetrievalQrel, type StandardRetrievalQuery, type StandardRetrievalResult, buildStandardRetrievalItems, calibrateBenchmarkMetric, createHarborBenchmarkAdapter, createRetrievalIdBenchmarkAdapter, deterministicSplit, evaluateStandardRetrieval, parseBeirCorpusJsonl, parseBeirQueriesJsonl, parseJsonlRows, parseQrels, readHarborTask, index_d_exports as routing, runBenchmarkAdapter };
300
+ export { BENCHMARK_SPLIT_SEED, type BenchmarkAdapter, type BenchmarkDatasetItem, type BenchmarkDistribution, type BenchmarkEvaluation, type BenchmarkFamily, type BenchmarkMetricCalibrationOptions, type BenchmarkMetricCalibrationResult, type BenchmarkReport, type BenchmarkResponder, type BenchmarkRunOptions, type BenchmarkRunResult, type BenchmarkScenario, type BenchmarkSliceSummary, type BenchmarkSource, type BenchmarkTaskKind, type BuildStandardRetrievalItemsOptions, type HarborBenchmarkAdapter, type HarborBenchmarkOptions, type HarborGradeOutcome, type HarborTaskItem, type HarborTaskPayload, type RetrievalIdAdapterOptions, type StandardRetrievalArtifact, type StandardRetrievalDocument, type StandardRetrievalEvaluationOptions, type StandardRetrievalPayload, type StandardRetrievalQrel, type StandardRetrievalQuery, type StandardRetrievalResult, deterministicSplit, index_d_exports as routing };
301
301
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/benchmarks/calibration.ts","../../src/benchmarks/harbor.ts","../../src/benchmarks/routing/dataset.ts","../../src/benchmarks/routing/index.ts","../../src/benchmarks/runner.ts","../../src/benchm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}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/benchmarks/calibration.ts","../../src/benchmarks/harbor.ts","../../src/benchmarks/routing/dataset.ts","../../src/benchmarks/routing/index.ts","../../src/benchmarks/runner.ts","../../src/benchmarks/standard-formats.ts"],"mappings":";;;;;;UAEiB,kCAAkC,oBAAoB;EACrE,SAAS,iBAAiB,qBAAqB,WAAW,UAAU;EACpE,MAAM,qBAAqB;EAC3B,cAAc;EACd,gBAAgB;EAChB;EACA;EACA;;UAGe;EACf;EACA,MAAM;EACN,QAAQ;EACR;EACA;EACA;EACA;;wBAGoB,yBAAyB,oBAAoB,oBACjE,SAAS,kCAAkC,UAAU,aACpD,QAAQ;;;;UCKM;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;IACE;IACA;IACA;IACA;;;EAGF;;EAEA;;EAEA;;EAEA;;KAGU,iBAAiB,qBAAqB;;KAGtC;EACN;EAAiB;IAAS;IAAgB;;;EAC1C;EAAkB;;UAEP,uBAAuB;;EAEtC;;EAEA;;EAEA,QAAQ;IAAoB;;;EAE5B;;EAEA,QAAQ,MAAM,gBAAgB,UAAU,cAAc,QAAQ;;EAE9D,eAAe,mBAAmB;;;UAInB,uBAAuB,mBAC9B,iBAAiB,gBAAgB,mBAAmB;EAC5D,WAAW,QAAQ;;;wBAaC,eAAe,kBAAkB,QAAQ;;wBA6C/C,6BAA6B,oBAC3C,SAAS,uBAAuB,aAC/B,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;UC5HT;EACf;EACA;EACA;;EAEA;;EAEA;;EAEA;;cAGW,iBAAiB;;;;KChBlB,iBAAiB;KACjB,qBAAqB,qBAAqB;cAEhD,0BAA0B,iBAAiB,oBAAoB;WAC1D;WACA;WACA;WACA;WACA;EAEH,YAAY,OAAO,cAAc,QAAQ;EAMzC,SAAS,MAAM,oBAAoB,mBAAmB,QAAQ;EAqBpE,YAAY,iBAAiB;;;;;;;;iBAef,mBAAmB;cAOtB,c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sBAAsB,eAAe;wBAerC,4BACd,SAAS,qCACR,MAAM,qBAAqB;wBAuCd,kCACd,SAAS,4BACR,iBACD,qBAAqB,2BACrB,0BACA;wBAqBc,0BACd,SAAS,0BACT,UAAU,2BACV,UAAS"}
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "../rolldown-runtime-8H4AJuhK.js";
2
- import { rt as runCampaign } from "../llm-judge-CL6f3utD.js";
3
- import { S as fsCampaignStorage } from "../external-optimizer-subprocess-laM1-UDV.js";
4
- import "../campaign-L391bmir.js";
2
+ import { rt as runCampaign } from "../llm-judge-C-0P1WiT.js";
3
+ import { S as fsCampaignStorage } from "../external-optimizer-subprocess-CkyUUV7h.js";
4
+ import "../campaign-PmTWZi72.js";
5
5
  import { join, resolve } from "node:path";
6
6
  import { readFile, readdir, stat } from "node:fs/promises";
7
7
  import { parse } from "smol-toml";
@@ -28,9 +28,9 @@ import { StringDecoder } from "node:string_decoder";
28
28
  * bytes are discarded and `outputTruncated` is set.
29
29
  */
30
30
  /** Wall-clock bound applied when the caller names none. */
31
- const DEFAULT_BOUNDED_PROCESS_TIMEOUT_MS = 10 * 6e4;
31
+ const DEFAULT_BOUNDED_PROCESS_TIMEOUT_MS = 6e5;
32
32
  /** Cap on captured stdout+stderr applied when the caller names none. */
33
- const DEFAULT_MAX_OUTPUT_BYTES = 16 * 1024 * 1024;
33
+ const DEFAULT_MAX_OUTPUT_BYTES = 16777216;
34
34
  /**
35
35
  * Window `close` is given after the process group is killed. A grandchild
36
36
  * that escaped the group can hold the pipes open indefinitely; the caller
@@ -232,4 +232,4 @@ function exitCodeFor(code, killedByTimeout, killedBySignal) {
232
232
  //#endregion
233
233
  export { runBoundedProcess as n, DEFAULT_BOUNDED_PROCESS_TIMEOUT_MS as t };
234
234
 
235
- //# sourceMappingURL=bounded-process-BBZob7vl.js.map
235
+ //# sourceMappingURL=bounded-process-Cj9YjXbE.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bounded-process-BBZob7vl.js","names":[],"sources":["../src/bounded-process.ts"],"sourcesContent":["/**\n * `runBoundedProcess` — run one command under a wall-clock bound and return\n * what it produced, leaving no descendant behind.\n *\n * The child leads its own process group (`detached` on every non-win32\n * platform), so a deadline or an abort kills the group with\n * `process.kill(-pid, 'SIGKILL')` rather than only the shell that was\n * spawned. That distinction is the whole point of this module: `sh -c\n * 'solver & wait'` puts the real work in a grandchild, and a kill aimed at\n * the shell alone leaves that grandchild running, holding the stdout and\n * stderr pipes open. `close` then never fires, so the deadline produces no\n * result the caller can observe and the descendant outlives the run.\n *\n * Two further guarantees the caller depends on:\n *\n * - A killed run never reports success. A SIGKILLed child can still close\n * with exit code 0, so a run killed by the deadline or by an abort has\n * its exit code forced non-zero.\n * - A run always resolves. If a grandchild escaped the group and still\n * holds the pipes, the result is delivered {@link KILL_DRAIN_MS} after\n * the kill instead of waiting on a `close` that will not come.\n *\n * The captured output is bounded. Once the cap is reached the streams are\n * still drained — the child needs its pipes read to reach `close` — but the\n * bytes are discarded and `outputTruncated` is set.\n */\n\nimport { spawn } from 'node:child_process'\nimport { StringDecoder } from 'node:string_decoder'\n\n/** Wall-clock bound applied when the caller names none. */\nexport const DEFAULT_BOUNDED_PROCESS_TIMEOUT_MS = 10 * 60_000\n\n/** Cap on captured stdout+stderr applied when the caller names none. */\nconst DEFAULT_MAX_OUTPUT_BYTES = 16 * 1024 * 1024\n\n/**\n * Window `close` is given after the process group is killed. A grandchild\n * that escaped the group can hold the pipes open indefinitely; the caller\n * receives its result at the end of this window rather than hanging.\n */\nconst KILL_DRAIN_MS = 2000\n\n/** Exit code reported for a run the wall-clock bound killed (GNU `timeout`). */\nconst TIMEOUT_EXIT_CODE = 124\n\n/** Exit code reported for a run an `AbortSignal` killed (128 + SIGKILL). */\nconst ABORT_EXIT_CODE = 137\n\n/** Exit code reported when the process could not be spawned at all. */\nconst SPAWN_FAILURE_EXIT_CODE = 127\n\n/** Exit code reported when a process closed with no code and was not killed. */\nconst UNKNOWN_EXIT_CODE = 1\n\nexport interface BoundedProcessInput {\n /**\n * The command line, interpreted by a shell unless `shell` is `false`. When\n * {@link BoundedProcessInput.args} is present this is a program path\n * instead, and no shell reads it.\n */\n command: string\n /**\n * Argument vector for `command`, delivered to the program as separate\n * argv entries with no shell between them.\n *\n * This is the form to use whenever an argument carries text the caller did\n * not author — a script body, a path, a pattern. Without it, `interpreter\n * -flag <script>` can only be expressed by quoting the script into a\n * shell string, and a quoting bug there is a command injection rather than\n * a wrong answer. Each entry arrives verbatim, so there is nothing to\n * quote: `{ command: 'bash', args: ['-n', '-c', body] }` parses `body`\n * whatever shell metacharacters it holds.\n *\n * Two limits are the platform's, not this module's. A NUL byte in an entry\n * cannot be passed to a process at all, and is reported as a `runnerError`\n * rather than thrown. A lone surrogate is encoded to UTF-8 as U+FFFD, and a\n * non-string entry from an untypechecked caller is coerced with `String()`,\n * so an entry is verbatim exactly when it is a string a UTF-8 argv can hold.\n *\n * A shell cannot interpret an argument vector, so `args` and a truthy\n * `shell` are contradictory. Passing both spawns nothing and reports\n * `runnerError`.\n */\n args?: string[]\n /**\n * Text written to the child's standard input. The stream is closed after\n * the write, so a command that reads until end-of-file sees exactly this\n * payload and then EOF.\n *\n * The child's stdin is closed whether or not this field is present. A pipe\n * nobody closes is a hang: a command that reads stdin waits for bytes that\n * never arrive until the deadline kills it, which reads downstream as a\n * slow command rather than as a caller that forgot to send input.\n *\n * The payload is written as UTF-8 and is otherwise verbatim: a NUL byte,\n * a newline, a quote and a backslash all arrive as themselves, because\n * nothing parses this text. The one platform limit is the one `args`\n * already states — a lone surrogate is encoded as U+FFFD, since no UTF-8\n * stream can carry it.\n *\n * A child that exits before reading breaks the pipe. That is the child's\n * behaviour, not a runner failure, so the run still settles on the child's\n * own exit code, and the undelivered payload is reported in `runnerError`\n * with the `stdin not delivered:` prefix. Whether a SMALL payload to a\n * command that ignores stdin reports this is a race — the write may land in\n * the pipe buffer before the child exits — so the flag is a statement about\n * delivery, never about the command. It is not a race for the case that\n * matters: a payload larger than the pipe buffer that the child never\n * drains cannot be delivered, and reports every time.\n */\n stdin?: string\n /**\n * Shell that interprets `command`. `true` (the default) uses the platform\n * default — `/bin/sh` on POSIX, `cmd.exe` on Windows. A string names the\n * shell binary, e.g. `'bash'`, which is required for a bash-only construct\n * such as `[[ ]]` or `$BASH_VERSION`. `false` executes `command` directly\n * as a program path with no arguments. Ignored — and refused when truthy —\n * once {@link BoundedProcessInput.args} is present.\n */\n shell?: boolean | string\n /** Working directory. The parent's cwd is inherited when omitted. */\n cwd?: string\n /**\n * Environment for the child. How it combines with the parent environment\n * is decided by {@link BoundedProcessInput.envMode}.\n */\n env?: NodeJS.ProcessEnv\n /**\n * `'merge'` (the default) layers `env` on top of `process.env`, so the\n * child sees every variable this process has plus the named ones.\n * `'replace'` passes exactly `env` and nothing else, which is what a\n * grader needs when the claim under test is about the variables the\n * command could read. `PATH` is not re-added under `'replace'`, and a\n * command that must find a binary on `PATH` names `PATH` itself.\n *\n * With no `PATH` in the child environment the two forms do NOT search the\n * same directories, so a caller under `'replace'` that names no `PATH` gets\n * a resolution that depends on which form it picked. The shell form execs\n * the shell, which applies its own compiled-in default; the argv form\n * reaches `execvp`, which falls back to `confstr(_CS_PATH)`. Measured on\n * Linux/glibc: `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`\n * against `/bin:/usr/bin`, so a binary in `/usr/local/bin` resolves on the\n * shell form and reports ENOENT on the argv form. Name `PATH` and both\n * forms search exactly what was named.\n */\n envMode?: 'merge' | 'replace'\n /** Wall-clock bound in ms. Defaults to 10 minutes. */\n timeoutMs?: number\n /**\n * Cap on captured stdout+stderr. Reaching it truncates the captured text\n * and sets `outputTruncated`; it never kills the process. Defaults to\n * 16 MiB.\n */\n maxOutputBytes?: number\n /**\n * Kills the process group when it aborts, the same way the deadline does.\n * A signal that is already aborted when `runBoundedProcess` is called\n * prevents the spawn entirely — nothing runs.\n */\n signal?: AbortSignal\n}\n\nexport interface BoundedProcessResult {\n /**\n * The process actually started. False when nothing ran at all: an\n * already-aborted signal, `args` with a truthy `shell`, an argument the\n * platform refuses, or a program that does not exist.\n *\n * This is the field to branch on, never the text of `runnerError`. A caller\n * deciding whether a run produced an outcome at all is asking exactly this,\n * and asking it here is type-checked rather than held by a wording\n * convention.\n */\n spawned: boolean\n /**\n * The `stdin` payload reached the child in full. True whenever the caller\n * supplied none, because nothing could fail to arrive.\n *\n * False means the command ran on partial input, which is a fact about the\n * answer it produced: a checksum over a truncated payload is a wrong answer,\n * not a failed run. `spawned` stays true and `exitCode` stays the child's.\n */\n stdinDelivered: boolean\n /**\n * Exit code. Forced non-zero whenever `killedByTimeout` or\n * `killedBySignal` is set, because a SIGKILLed child can close with 0 and\n * a killed run must never read as a pass.\n */\n exitCode: number\n /** Captured stdout, truncated at `maxOutputBytes`. */\n stdout: string\n /**\n * Captured stderr, truncated at `maxOutputBytes`. A runner-side failure is\n * reported in `runnerError`, not appended here; the caller decides whether\n * the command's own stderr and the runner's diagnosis belong together.\n */\n stderr: string\n /** Wall-clock duration in ms, measured across the whole call. */\n wallMs: number\n /** The wall-clock bound was reached and the process group was killed. */\n killedByTimeout: boolean\n /** `signal` aborted and the process group was killed. */\n killedBySignal: boolean\n /** `maxOutputBytes` was reached and later output was discarded. */\n outputTruncated: boolean\n /**\n * Human-readable diagnosis of a runner-side failure, in one of three shapes:\n *\n * - `not spawned:` — the caller's own bug, such as `args` with a truthy\n * `shell`, or an already-aborted signal. No retry helps.\n * - `stdin not delivered:` — the command ran and exited on its own, and\n * the stdin payload did not reach it in full because the child closed\n * the pipe first.\n * - anything else — the process could not be spawned (a missing binary, a\n * NUL byte in an argument).\n *\n * Absent when the command ran and read everything it was sent, however it\n * exited. The prefixes are for a person reading a log; code reads `spawned`\n * and `stdinDelivered`, which say the same things and are type-checked.\n */\n runnerError?: string\n}\n\nexport async function runBoundedProcess(input: BoundedProcessInput): Promise<BoundedProcessResult> {\n const start = Date.now()\n const maxOutputBytes = input.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES\n const timeoutMs = input.timeoutMs ?? DEFAULT_BOUNDED_PROCESS_TIMEOUT_MS\n const envMode = input.envMode ?? 'merge'\n const env =\n input.env === undefined && envMode === 'merge'\n ? undefined\n : envMode === 'replace'\n ? { ...input.env }\n : { ...process.env, ...input.env }\n\n if (input.signal?.aborted) {\n return {\n spawned: false,\n stdinDelivered: true,\n exitCode: ABORT_EXIT_CODE,\n stdout: '',\n stderr: '',\n wallMs: Date.now() - start,\n killedByTimeout: false,\n killedBySignal: true,\n outputTruncated: false,\n runnerError: 'aborted before spawn: the AbortSignal was already aborted',\n }\n }\n\n // Reported rather than thrown, because this module's contract is that a\n // call always resolves. A caller bug still reads as a failure and never as\n // a pass: the exit code is non-zero and `runnerError` names the cause.\n if (input.args !== undefined && input.shell) {\n return {\n spawned: false,\n stdinDelivered: true,\n exitCode: SPAWN_FAILURE_EXIT_CODE,\n stdout: '',\n stderr: '',\n wallMs: Date.now() - start,\n killedByTimeout: false,\n killedBySignal: false,\n outputTruncated: false,\n // Shares `SPAWN_FAILURE_EXIT_CODE` with a program that does not exist,\n // because both mean nothing ran. The `not spawned:` prefix is the stable\n // discriminator: it marks the caller's own bug, which no retry fixes.\n runnerError:\n 'not spawned: `args` passes an argument vector directly to the program, so a shell ' +\n 'cannot interpret it — pass `args` or a truthy `shell`, never both',\n }\n }\n\n return await new Promise<BoundedProcessResult>((resolve) => {\n const spawnOptions = {\n cwd: input.cwd,\n env,\n // Own process group so a kill reaches the whole tree, not just the\n // shell — otherwise a runaway grandchild keeps the pipes open and\n // `close` never fires.\n detached: process.platform !== 'win32',\n }\n // The argv form takes the same bounds, the same group and the same kill\n // path. Two things differ, and both are stated where they are decided:\n // no shell reads the command, and executable lookup falls back to a\n // different default `PATH` when the caller names none (see `envMode`).\n //\n // `spawn` validates its arguments and THROWS synchronously — a NUL byte in\n // `command` or in an `args` entry, or an `args` that is not an array from\n // an untypechecked caller. A throw inside this executor would reject, and\n // this module's contract is that a call always resolves. A caller that\n // grades untrusted text must be able to score that text as failed rather\n // than die on it.\n let child: ReturnType<typeof spawn>\n try {\n child =\n input.args === undefined\n ? spawn(input.command, { ...spawnOptions, shell: input.shell ?? true })\n : spawn(input.command, input.args, { ...spawnOptions, shell: false })\n } catch (err) {\n resolve({\n spawned: false,\n stdinDelivered: true,\n exitCode: SPAWN_FAILURE_EXIT_CODE,\n stdout: '',\n stderr: '',\n wallMs: Date.now() - start,\n killedByTimeout: false,\n killedBySignal: false,\n outputTruncated: false,\n runnerError: String(err),\n })\n return\n }\n // A pipe nobody closes is a hang, so stdin is always ended — after the\n // payload when there is one, immediately when there is not. A write that\n // fails is recorded and never thrown: the child already ran, and this\n // module's contract is that a call always resolves.\n let stdinError: string | undefined\n const childStdin = child.stdin\n if (childStdin) {\n childStdin.on('error', (err) => {\n // Closing an unused pipe races a command that exits at once, and that\n // broken pipe says nothing about a caller who sent nothing. Only a\n // payload the caller supplied can fail to be delivered.\n if (input.stdin !== undefined) stdinError ??= `stdin not delivered: ${String(err)}`\n })\n if (input.stdin === undefined) childStdin.end()\n else childStdin.end(input.stdin, 'utf8')\n } else if (input.stdin !== undefined) {\n stdinError = 'stdin not delivered: the child was spawned with no stdin pipe'\n }\n\n let stdout = ''\n let stderr = ''\n let outputBytes = 0\n let outputTruncated = false\n let killedByTimeout = false\n let killedBySignal = false\n let settled = false\n\n // Bound the in-memory buffer so a runaway process can't OOM the caller.\n // Once the cap is hit the streams are still drained (the child needs them\n // read to reach `close`) but the bytes are discarded.\n function capture(s: string): string {\n if (outputBytes >= maxOutputBytes) {\n outputTruncated = true\n return ''\n }\n const room = maxOutputBytes - outputBytes\n if (s.length > room) {\n outputBytes = maxOutputBytes\n outputTruncated = true\n return s.slice(0, room)\n }\n outputBytes += s.length\n return s\n }\n\n // Decoded across chunk boundaries. A stream arrives as Buffers split at\n // arbitrary byte offsets, so decoding each chunk on its own replaces any\n // multi-byte character that straddles a boundary with U+FFFD — the output\n // is then corrupted at every 64 KiB of non-ASCII text. The decoder holds\n // the partial sequence until its remaining bytes arrive.\n const stdoutDecoder = new StringDecoder('utf8')\n const stderrDecoder = new StringDecoder('utf8')\n const decode = (decoder: StringDecoder, d: unknown): string =>\n Buffer.isBuffer(d) ? decoder.write(d) : String(d)\n\n const onStdout = (d: unknown) => {\n const chunk = capture(decode(stdoutDecoder, d))\n if (chunk) stdout += chunk\n }\n const onStderr = (d: unknown) => {\n const chunk = capture(decode(stderrDecoder, d))\n if (chunk) stderr += chunk\n }\n\n child.stdout?.on('data', onStdout)\n child.stderr?.on('data', onStderr)\n\n let forceResolve: ReturnType<typeof setTimeout> | undefined\n\n const cleanup = () => {\n clearTimeout(timeout)\n if (forceResolve) clearTimeout(forceResolve)\n input.signal?.removeEventListener('abort', onAbort)\n child.stdout?.off('data', onStdout)\n child.stderr?.off('data', onStderr)\n // The stdin `error` listener stays attached on purpose: a stream that\n // emits `error` with no listener throws, and a late EPIPE after the run\n // has settled must not take the process down.\n child.removeAllListeners('close')\n child.removeAllListeners('error')\n }\n\n // Resolve exactly once. `code` comes from `close`; on a kill path the\n // exit code is forced non-zero so a SIGKILLed child that reports 0 can\n // never read as a clean pass downstream.\n const finish = (outcome: { code: number | null; spawned?: boolean; runnerError?: string }) => {\n if (settled) return\n settled = true\n cleanup()\n const spawned = outcome.spawned ?? true\n resolve({\n spawned,\n // A program that never started was sent nothing, whatever the write to\n // its doomed pipe reported.\n stdinDelivered: spawned ? stdinError === undefined : true,\n exitCode: exitCodeFor(outcome.code, killedByTimeout, killedBySignal),\n stdout,\n stderr,\n wallMs: Date.now() - start,\n killedByTimeout,\n killedBySignal,\n outputTruncated,\n runnerError: outcome.runnerError ?? stdinError,\n })\n }\n\n // SIGKILL the whole process group (we spawned detached). On a clean close\n // this never runs.\n const killTree = () => {\n try {\n if (process.platform !== 'win32' && typeof child.pid === 'number') {\n process.kill(-child.pid, 'SIGKILL')\n } else {\n child.kill('SIGKILL')\n }\n } catch (err) {\n // ESRCH means the group exited between the decision to kill and the\n // signal, which `close` reports on its own. Anything else means the\n // group may still be running, which the caller must hear about.\n if ((err as NodeJS.ErrnoException)?.code !== 'ESRCH') {\n console.warn('[bounded-process] SIGKILL of the process group failed:', err)\n }\n }\n }\n\n // Give `close` a brief window to fire (flushing any final output) after\n // the group dies; if an orphaned grandchild keeps the pipes open, resolve\n // anyway so the caller can't hang on a runaway. The deadline and an abort\n // can both fire, so the kill happens at most once and the drain window is\n // not restarted by the second one.\n let killed = false\n const killAndDrain = () => {\n if (killed) return\n killed = true\n killTree()\n forceResolve = setTimeout(() => finish({ code: null }), KILL_DRAIN_MS)\n }\n\n function onAbort() {\n if (settled) return\n killedBySignal = true\n killAndDrain()\n }\n\n const timeout = setTimeout(() => {\n killedByTimeout = true\n killAndDrain()\n }, timeoutMs)\n\n input.signal?.addEventListener('abort', onAbort, { once: true })\n\n child.on('close', (code) => {\n if (forceResolve) clearTimeout(forceResolve)\n finish({ code })\n })\n child.on('error', (err) => {\n if (forceResolve) clearTimeout(forceResolve)\n // `error` on a child means the program never started — a missing binary,\n // a refused argument. Nothing ran, whatever the stdin write did.\n finish({ code: SPAWN_FAILURE_EXIT_CODE, spawned: false, runnerError: String(err) })\n })\n })\n}\n\n/**\n * A killed run reports the code the child closed with only when that code is\n * already non-zero; otherwise it reports the conventional code for the kind\n * of kill. A run that closed on its own with no code at all reports 1.\n */\nfunction exitCodeFor(\n code: number | null,\n killedByTimeout: boolean,\n killedBySignal: boolean,\n): number {\n if (code !== null && code !== 0) return code\n if (killedByTimeout) return TIMEOUT_EXIT_CODE\n if (killedBySignal) return ABORT_EXIT_CODE\n return code ?? UNKNOWN_EXIT_CODE\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,qCAAqC,KAAK;;AAGvD,MAAM,2BAA2B,KAAK,OAAO;;;;;;AAO7C,MAAM,gBAAgB;;AAGtB,MAAM,oBAAoB;;AAG1B,MAAM,kBAAkB;;AAGxB,MAAM,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;GAG3C,OAAO;IAAE,MAAM;IAAyB,SAAS;IAAO,aAAa,OAAO,GAAG;GAAE,CAAC;EACpF,CAAC;CACH,CAAC;AACH;;;;;;AAOA,SAAS,YACP,MACA,iBACA,gBACQ;CACR,IAAI,SAAS,QAAQ,SAAS,GAAG,OAAO;CACxC,IAAI,iBAAiB,OAAO;CAC5B,IAAI,gBAAgB,OAAO;CAC3B,OAAO,QAAQ;AACjB"}
1
+ {"version":3,"file":"bounded-process-Cj9YjXbE.js","names":[],"sources":["../src/bounded-process.ts"],"sourcesContent":["/**\n * `runBoundedProcess` — run one command under a wall-clock bound and return\n * what it produced, leaving no descendant behind.\n *\n * The child leads its own process group (`detached` on every non-win32\n * platform), so a deadline or an abort kills the group with\n * `process.kill(-pid, 'SIGKILL')` rather than only the shell that was\n * spawned. That distinction is the whole point of this module: `sh -c\n * 'solver & wait'` puts the real work in a grandchild, and a kill aimed at\n * the shell alone leaves that grandchild running, holding the stdout and\n * stderr pipes open. `close` then never fires, so the deadline produces no\n * result the caller can observe and the descendant outlives the run.\n *\n * Two further guarantees the caller depends on:\n *\n * - A killed run never reports success. A SIGKILLed child can still close\n * with exit code 0, so a run killed by the deadline or by an abort has\n * its exit code forced non-zero.\n * - A run always resolves. If a grandchild escaped the group and still\n * holds the pipes, the result is delivered {@link KILL_DRAIN_MS} after\n * the kill instead of waiting on a `close` that will not come.\n *\n * The captured output is bounded. Once the cap is reached the streams are\n * still drained — the child needs its pipes read to reach `close` — but the\n * bytes are discarded and `outputTruncated` is set.\n */\n\nimport { spawn } from 'node:child_process'\nimport { StringDecoder } from 'node:string_decoder'\n\n/** Wall-clock bound applied when the caller names none. */\nexport const DEFAULT_BOUNDED_PROCESS_TIMEOUT_MS = 10 * 60_000\n\n/** Cap on captured stdout+stderr applied when the caller names none. */\nconst DEFAULT_MAX_OUTPUT_BYTES = 16 * 1024 * 1024\n\n/**\n * Window `close` is given after the process group is killed. A grandchild\n * that escaped the group can hold the pipes open indefinitely; the caller\n * receives its result at the end of this window rather than hanging.\n */\nconst KILL_DRAIN_MS = 2000\n\n/** Exit code reported for a run the wall-clock bound killed (GNU `timeout`). */\nconst TIMEOUT_EXIT_CODE = 124\n\n/** Exit code reported for a run an `AbortSignal` killed (128 + SIGKILL). */\nconst ABORT_EXIT_CODE = 137\n\n/** Exit code reported when the process could not be spawned at all. */\nconst SPAWN_FAILURE_EXIT_CODE = 127\n\n/** Exit code reported when a process closed with no code and was not killed. */\nconst UNKNOWN_EXIT_CODE = 1\n\nexport interface BoundedProcessInput {\n /**\n * The command line, interpreted by a shell unless `shell` is `false`. When\n * {@link BoundedProcessInput.args} is present this is a program path\n * instead, and no shell reads it.\n */\n command: string\n /**\n * Argument vector for `command`, delivered to the program as separate\n * argv entries with no shell between them.\n *\n * This is the form to use whenever an argument carries text the caller did\n * not author — a script body, a path, a pattern. Without it, `interpreter\n * -flag <script>` can only be expressed by quoting the script into a\n * shell string, and a quoting bug there is a command injection rather than\n * a wrong answer. Each entry arrives verbatim, so there is nothing to\n * quote: `{ command: 'bash', args: ['-n', '-c', body] }` parses `body`\n * whatever shell metacharacters it holds.\n *\n * Two limits are the platform's, not this module's. A NUL byte in an entry\n * cannot be passed to a process at all, and is reported as a `runnerError`\n * rather than thrown. A lone surrogate is encoded to UTF-8 as U+FFFD, and a\n * non-string entry from an untypechecked caller is coerced with `String()`,\n * so an entry is verbatim exactly when it is a string a UTF-8 argv can hold.\n *\n * A shell cannot interpret an argument vector, so `args` and a truthy\n * `shell` are contradictory. Passing both spawns nothing and reports\n * `runnerError`.\n */\n args?: string[]\n /**\n * Text written to the child's standard input. The stream is closed after\n * the write, so a command that reads until end-of-file sees exactly this\n * payload and then EOF.\n *\n * The child's stdin is closed whether or not this field is present. A pipe\n * nobody closes is a hang: a command that reads stdin waits for bytes that\n * never arrive until the deadline kills it, which reads downstream as a\n * slow command rather than as a caller that forgot to send input.\n *\n * The payload is written as UTF-8 and is otherwise verbatim: a NUL byte,\n * a newline, a quote and a backslash all arrive as themselves, because\n * nothing parses this text. The one platform limit is the one `args`\n * already states — a lone surrogate is encoded as U+FFFD, since no UTF-8\n * stream can carry it.\n *\n * A child that exits before reading breaks the pipe. That is the child's\n * behaviour, not a runner failure, so the run still settles on the child's\n * own exit code, and the undelivered payload is reported in `runnerError`\n * with the `stdin not delivered:` prefix. Whether a SMALL payload to a\n * command that ignores stdin reports this is a race — the write may land in\n * the pipe buffer before the child exits — so the flag is a statement about\n * delivery, never about the command. It is not a race for the case that\n * matters: a payload larger than the pipe buffer that the child never\n * drains cannot be delivered, and reports every time.\n */\n stdin?: string\n /**\n * Shell that interprets `command`. `true` (the default) uses the platform\n * default — `/bin/sh` on POSIX, `cmd.exe` on Windows. A string names the\n * shell binary, e.g. `'bash'`, which is required for a bash-only construct\n * such as `[[ ]]` or `$BASH_VERSION`. `false` executes `command` directly\n * as a program path with no arguments. Ignored — and refused when truthy —\n * once {@link BoundedProcessInput.args} is present.\n */\n shell?: boolean | string\n /** Working directory. The parent's cwd is inherited when omitted. */\n cwd?: string\n /**\n * Environment for the child. How it combines with the parent environment\n * is decided by {@link BoundedProcessInput.envMode}.\n */\n env?: NodeJS.ProcessEnv\n /**\n * `'merge'` (the default) layers `env` on top of `process.env`, so the\n * child sees every variable this process has plus the named ones.\n * `'replace'` passes exactly `env` and nothing else, which is what a\n * grader needs when the claim under test is about the variables the\n * command could read. `PATH` is not re-added under `'replace'`, and a\n * command that must find a binary on `PATH` names `PATH` itself.\n *\n * With no `PATH` in the child environment the two forms do NOT search the\n * same directories, so a caller under `'replace'` that names no `PATH` gets\n * a resolution that depends on which form it picked. The shell form execs\n * the shell, which applies its own compiled-in default; the argv form\n * reaches `execvp`, which falls back to `confstr(_CS_PATH)`. Measured on\n * Linux/glibc: `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`\n * against `/bin:/usr/bin`, so a binary in `/usr/local/bin` resolves on the\n * shell form and reports ENOENT on the argv form. Name `PATH` and both\n * forms search exactly what was named.\n */\n envMode?: 'merge' | 'replace'\n /** Wall-clock bound in ms. Defaults to 10 minutes. */\n timeoutMs?: number\n /**\n * Cap on captured stdout+stderr. Reaching it truncates the captured text\n * and sets `outputTruncated`; it never kills the process. Defaults to\n * 16 MiB.\n */\n maxOutputBytes?: number\n /**\n * Kills the process group when it aborts, the same way the deadline does.\n * A signal that is already aborted when `runBoundedProcess` is called\n * prevents the spawn entirely — nothing runs.\n */\n signal?: AbortSignal\n}\n\nexport interface BoundedProcessResult {\n /**\n * The process actually started. False when nothing ran at all: an\n * already-aborted signal, `args` with a truthy `shell`, an argument the\n * platform refuses, or a program that does not exist.\n *\n * This is the field to branch on, never the text of `runnerError`. A caller\n * deciding whether a run produced an outcome at all is asking exactly this,\n * and asking it here is type-checked rather than held by a wording\n * convention.\n */\n spawned: boolean\n /**\n * The `stdin` payload reached the child in full. True whenever the caller\n * supplied none, because nothing could fail to arrive.\n *\n * False means the command ran on partial input, which is a fact about the\n * answer it produced: a checksum over a truncated payload is a wrong answer,\n * not a failed run. `spawned` stays true and `exitCode` stays the child's.\n */\n stdinDelivered: boolean\n /**\n * Exit code. Forced non-zero whenever `killedByTimeout` or\n * `killedBySignal` is set, because a SIGKILLed child can close with 0 and\n * a killed run must never read as a pass.\n */\n exitCode: number\n /** Captured stdout, truncated at `maxOutputBytes`. */\n stdout: string\n /**\n * Captured stderr, truncated at `maxOutputBytes`. A runner-side failure is\n * reported in `runnerError`, not appended here; the caller decides whether\n * the command's own stderr and the runner's diagnosis belong together.\n */\n stderr: string\n /** Wall-clock duration in ms, measured across the whole call. */\n wallMs: number\n /** The wall-clock bound was reached and the process group was killed. */\n killedByTimeout: boolean\n /** `signal` aborted and the process group was killed. */\n killedBySignal: boolean\n /** `maxOutputBytes` was reached and later output was discarded. */\n outputTruncated: boolean\n /**\n * Human-readable diagnosis of a runner-side failure, in one of three shapes:\n *\n * - `not spawned:` — the caller's own bug, such as `args` with a truthy\n * `shell`, or an already-aborted signal. No retry helps.\n * - `stdin not delivered:` — the command ran and exited on its own, and\n * the stdin payload did not reach it in full because the child closed\n * the pipe first.\n * - anything else — the process could not be spawned (a missing binary, a\n * NUL byte in an argument).\n *\n * Absent when the command ran and read everything it was sent, however it\n * exited. The prefixes are for a person reading a log; code reads `spawned`\n * and `stdinDelivered`, which say the same things and are type-checked.\n */\n runnerError?: string\n}\n\nexport async function runBoundedProcess(input: BoundedProcessInput): Promise<BoundedProcessResult> {\n const start = Date.now()\n const maxOutputBytes = input.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES\n const timeoutMs = input.timeoutMs ?? DEFAULT_BOUNDED_PROCESS_TIMEOUT_MS\n const envMode = input.envMode ?? 'merge'\n const env =\n input.env === undefined && envMode === 'merge'\n ? undefined\n : envMode === 'replace'\n ? { ...input.env }\n : { ...process.env, ...input.env }\n\n if (input.signal?.aborted) {\n return {\n spawned: false,\n stdinDelivered: true,\n exitCode: ABORT_EXIT_CODE,\n stdout: '',\n stderr: '',\n wallMs: Date.now() - start,\n killedByTimeout: false,\n killedBySignal: true,\n outputTruncated: false,\n runnerError: 'aborted before spawn: the AbortSignal was already aborted',\n }\n }\n\n // Reported rather than thrown, because this module's contract is that a\n // call always resolves. A caller bug still reads as a failure and never as\n // a pass: the exit code is non-zero and `runnerError` names the cause.\n if (input.args !== undefined && input.shell) {\n return {\n spawned: false,\n stdinDelivered: true,\n exitCode: SPAWN_FAILURE_EXIT_CODE,\n stdout: '',\n stderr: '',\n wallMs: Date.now() - start,\n killedByTimeout: false,\n killedBySignal: false,\n outputTruncated: false,\n // Shares `SPAWN_FAILURE_EXIT_CODE` with a program that does not exist,\n // because both mean nothing ran. The `not spawned:` prefix is the stable\n // discriminator: it marks the caller's own bug, which no retry fixes.\n runnerError:\n 'not spawned: `args` passes an argument vector directly to the program, so a shell ' +\n 'cannot interpret it — pass `args` or a truthy `shell`, never both',\n }\n }\n\n return await new Promise<BoundedProcessResult>((resolve) => {\n const spawnOptions = {\n cwd: input.cwd,\n env,\n // Own process group so a kill reaches the whole tree, not just the\n // shell — otherwise a runaway grandchild keeps the pipes open and\n // `close` never fires.\n detached: process.platform !== 'win32',\n }\n // The argv form takes the same bounds, the same group and the same kill\n // path. Two things differ, and both are stated where they are decided:\n // no shell reads the command, and executable lookup falls back to a\n // different default `PATH` when the caller names none (see `envMode`).\n //\n // `spawn` validates its arguments and THROWS synchronously — a NUL byte in\n // `command` or in an `args` entry, or an `args` that is not an array from\n // an untypechecked caller. A throw inside this executor would reject, and\n // this module's contract is that a call always resolves. A caller that\n // grades untrusted text must be able to score that text as failed rather\n // than die on it.\n let child: ReturnType<typeof spawn>\n try {\n child =\n input.args === undefined\n ? spawn(input.command, { ...spawnOptions, shell: input.shell ?? true })\n : spawn(input.command, input.args, { ...spawnOptions, shell: false })\n } catch (err) {\n resolve({\n spawned: false,\n stdinDelivered: true,\n exitCode: SPAWN_FAILURE_EXIT_CODE,\n stdout: '',\n stderr: '',\n wallMs: Date.now() - start,\n killedByTimeout: false,\n killedBySignal: false,\n outputTruncated: false,\n runnerError: String(err),\n })\n return\n }\n // A pipe nobody closes is a hang, so stdin is always ended — after the\n // payload when there is one, immediately when there is not. A write that\n // fails is recorded and never thrown: the child already ran, and this\n // module's contract is that a call always resolves.\n let stdinError: string | undefined\n const childStdin = child.stdin\n if (childStdin) {\n childStdin.on('error', (err) => {\n // Closing an unused pipe races a command that exits at once, and that\n // broken pipe says nothing about a caller who sent nothing. Only a\n // payload the caller supplied can fail to be delivered.\n if (input.stdin !== undefined) stdinError ??= `stdin not delivered: ${String(err)}`\n })\n if (input.stdin === undefined) childStdin.end()\n else childStdin.end(input.stdin, 'utf8')\n } else if (input.stdin !== undefined) {\n stdinError = 'stdin not delivered: the child was spawned with no stdin pipe'\n }\n\n let stdout = ''\n let stderr = ''\n let outputBytes = 0\n let outputTruncated = false\n let killedByTimeout = false\n let killedBySignal = false\n let settled = false\n\n // Bound the in-memory buffer so a runaway process can't OOM the caller.\n // Once the cap is hit the streams are still drained (the child needs them\n // read to reach `close`) but the bytes are discarded.\n function capture(s: string): string {\n if (outputBytes >= maxOutputBytes) {\n outputTruncated = true\n return ''\n }\n const room = maxOutputBytes - outputBytes\n if (s.length > room) {\n outputBytes = maxOutputBytes\n outputTruncated = true\n return s.slice(0, room)\n }\n outputBytes += s.length\n return s\n }\n\n // Decoded across chunk boundaries. A stream arrives as Buffers split at\n // arbitrary byte offsets, so decoding each chunk on its own replaces any\n // multi-byte character that straddles a boundary with U+FFFD — the output\n // is then corrupted at every 64 KiB of non-ASCII text. The decoder holds\n // the partial sequence until its remaining bytes arrive.\n const stdoutDecoder = new StringDecoder('utf8')\n const stderrDecoder = new StringDecoder('utf8')\n const decode = (decoder: StringDecoder, d: unknown): string =>\n Buffer.isBuffer(d) ? decoder.write(d) : String(d)\n\n const onStdout = (d: unknown) => {\n const chunk = capture(decode(stdoutDecoder, d))\n if (chunk) stdout += chunk\n }\n const onStderr = (d: unknown) => {\n const chunk = capture(decode(stderrDecoder, d))\n if (chunk) stderr += chunk\n }\n\n child.stdout?.on('data', onStdout)\n child.stderr?.on('data', onStderr)\n\n let forceResolve: ReturnType<typeof setTimeout> | undefined\n\n const cleanup = () => {\n clearTimeout(timeout)\n if (forceResolve) clearTimeout(forceResolve)\n input.signal?.removeEventListener('abort', onAbort)\n child.stdout?.off('data', onStdout)\n child.stderr?.off('data', onStderr)\n // The stdin `error` listener stays attached on purpose: a stream that\n // emits `error` with no listener throws, and a late EPIPE after the run\n // has settled must not take the process down.\n child.removeAllListeners('close')\n child.removeAllListeners('error')\n }\n\n // Resolve exactly once. `code` comes from `close`; on a kill path the\n // exit code is forced non-zero so a SIGKILLed child that reports 0 can\n // never read as a clean pass downstream.\n const finish = (outcome: { code: number | null; spawned?: boolean; runnerError?: string }) => {\n if (settled) return\n settled = true\n cleanup()\n const spawned = outcome.spawned ?? true\n resolve({\n spawned,\n // A program that never started was sent nothing, whatever the write to\n // its doomed pipe reported.\n stdinDelivered: spawned ? stdinError === undefined : true,\n exitCode: exitCodeFor(outcome.code, killedByTimeout, killedBySignal),\n stdout,\n stderr,\n wallMs: Date.now() - start,\n killedByTimeout,\n killedBySignal,\n outputTruncated,\n runnerError: outcome.runnerError ?? stdinError,\n })\n }\n\n // SIGKILL the whole process group (we spawned detached). On a clean close\n // this never runs.\n const killTree = () => {\n try {\n if (process.platform !== 'win32' && typeof child.pid === 'number') {\n process.kill(-child.pid, 'SIGKILL')\n } else {\n child.kill('SIGKILL')\n }\n } catch (err) {\n // ESRCH means the group exited between the decision to kill and the\n // signal, which `close` reports on its own. Anything else means the\n // group may still be running, which the caller must hear about.\n if ((err as NodeJS.ErrnoException)?.code !== 'ESRCH') {\n console.warn('[bounded-process] SIGKILL of the process group failed:', err)\n }\n }\n }\n\n // Give `close` a brief window to fire (flushing any final output) after\n // the group dies; if an orphaned grandchild keeps the pipes open, resolve\n // anyway so the caller can't hang on a runaway. The deadline and an abort\n // can both fire, so the kill happens at most once and the drain window is\n // not restarted by the second one.\n let killed = false\n const killAndDrain = () => {\n if (killed) return\n killed = true\n killTree()\n forceResolve = setTimeout(() => finish({ code: null }), KILL_DRAIN_MS)\n }\n\n function onAbort() {\n if (settled) return\n killedBySignal = true\n killAndDrain()\n }\n\n const timeout = setTimeout(() => {\n killedByTimeout = true\n killAndDrain()\n }, timeoutMs)\n\n input.signal?.addEventListener('abort', onAbort, { once: true })\n\n child.on('close', (code) => {\n if (forceResolve) clearTimeout(forceResolve)\n finish({ code })\n })\n child.on('error', (err) => {\n if (forceResolve) clearTimeout(forceResolve)\n // `error` on a child means the program never started — a missing binary,\n // a refused argument. Nothing ran, whatever the stdin write did.\n finish({ code: SPAWN_FAILURE_EXIT_CODE, spawned: false, runnerError: String(err) })\n })\n })\n}\n\n/**\n * A killed run reports the code the child closed with only when that code is\n * already non-zero; otherwise it reports the conventional code for the kind\n * of kill. A run that closed on its own with no code at all reports 1.\n */\nfunction exitCodeFor(\n code: number | null,\n killedByTimeout: boolean,\n killedBySignal: boolean,\n): number {\n if (code !== null && code !== 0) return code\n if (killedByTimeout) return TIMEOUT_EXIT_CODE\n if (killedBySignal) return ABORT_EXIT_CODE\n return code ?? UNKNOWN_EXIT_CODE\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,qCAAqC;;AAGlD,MAAM,2BAA2B;;;;;;AAOjC,MAAM,gBAAgB;;AAGtB,MAAM,oBAAoB;;AAG1B,MAAM,kBAAkB;;AAGxB,MAAM,0BAA0B;;AAGhC,MAAM,oBAAoB;AA2K1B,eAAsB,kBAAkB,OAA2D;CACjG,MAAM,QAAQ,KAAK,IAAI;CACvB,MAAM,iBAAiB,MAAM,kBAAkB;CAC/C,MAAM,YAAY,MAAM,aAAA;CACxB,MAAM,UAAU,MAAM,WAAW;CACjC,MAAM,MACJ,MAAM,QAAQ,KAAA,KAAa,YAAY,UACnC,KAAA,IACA,YAAY,YACV,EAAE,GAAG,MAAM,IAAI,IACf;EAAE,GAAG,QAAQ;EAAK,GAAG,MAAM;CAAI;CAEvC,IAAI,MAAM,QAAQ,SAChB,OAAO;EACL,SAAS;EACT,gBAAgB;EAChB,UAAU;EACV,QAAQ;EACR,QAAQ;EACR,QAAQ,KAAK,IAAI,IAAI;EACrB,iBAAiB;EACjB,gBAAgB;EAChB,iBAAiB;EACjB,aAAa;CACf;CAMF,IAAI,MAAM,SAAS,KAAA,KAAa,MAAM,OACpC,OAAO;EACL,SAAS;EACT,gBAAgB;EAChB,UAAU;EACV,QAAQ;EACR,QAAQ;EACR,QAAQ,KAAK,IAAI,IAAI;EACrB,iBAAiB;EACjB,gBAAgB;EAChB,iBAAiB;EAIjB,aACE;CAEJ;CAGF,OAAO,MAAM,IAAI,SAA+B,YAAY;EAC1D,MAAM,eAAe;GACnB,KAAK,MAAM;GACX;GAIA,UAAU,QAAQ,aAAa;EACjC;EAYA,IAAI;EACJ,IAAI;GACF,QACE,MAAM,SAAS,KAAA,IACX,MAAM,MAAM,SAAS;IAAE,GAAG;IAAc,OAAO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UAAU,iBAAiB;GAC/B,kBAAkB;GAClB,aAAa;EACf,GAAG,SAAS;EAEZ,MAAM,QAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;EAE/D,MAAM,GAAG,UAAU,SAAS;GAC1B,IAAI,cAAc,aAAa,YAAY;GAC3C,OAAO,EAAE,KAAK,CAAC;EACjB,CAAC;EACD,MAAM,GAAG,UAAU,QAAQ;GACzB,IAAI,cAAc,aAAa,YAAY;GAG3C,OAAO;IAAE,MAAM;IAAyB,SAAS;IAAO,aAAa,OAAO,GAAG;GAAE,CAAC;EACpF,CAAC;CACH,CAAC;AACH;;;;;;AAOA,SAAS,YACP,MACA,iBACA,gBACQ;CACR,IAAI,SAAS,QAAQ,SAAS,GAAG,OAAO;CACxC,IAAI,iBAAiB,OAAO;CAC5B,IAAI,gBAAgB,OAAO;CAC3B,OAAO,QAAQ;AACjB"}
@@ -24,24 +24,24 @@ interface TestGradedRunResult {
24
24
  }
25
25
  //#endregion
26
26
  //#region src/builder-eval/builder-session.d.ts
27
- interface BuilderSessionInit {
27
+ export interface BuilderSessionInit {
28
28
  projectId: string;
29
29
  chatId?: string;
30
30
  /** Free-form: user's task description, project name, etc. Stored on the builder Run. */
31
31
  tags?: Record<string, string>;
32
32
  }
33
- interface ShipOptions {
33
+ export interface ShipOptions {
34
34
  harness: HarnessConfig;
35
35
  driver?: SandboxDriver;
36
36
  /** scenarioId of this app-build run. Defaults to `${projectId}/build`. */
37
37
  scenarioId?: string;
38
38
  }
39
- interface RunAppScenarioOptions {
39
+ export interface RunAppScenarioOptions {
40
40
  scenario: TestGradedScenario;
41
41
  /** Harness driver override; defaults to the one the session was created with. */
42
42
  driver?: SandboxDriver;
43
43
  }
44
- declare class BuilderSession {
44
+ export declare class BuilderSession {
45
45
  private store;
46
46
  private builderEmitter;
47
47
  readonly projectId: string;
@@ -105,7 +105,7 @@ declare class BuilderSession {
105
105
  * returns { builderRunId, lastBuildRunId, chatRuns }. For chat-first UIs
106
106
  * this is how a resumed session finds its place in the edit history.
107
107
  */
108
- declare function resumeBuilderSession(store: TraceStore, projectId: string): Promise<{
108
+ export declare function resumeBuilderSession(store: TraceStore, projectId: string): Promise<{
109
109
  projectId: string;
110
110
  chatRuns: Run[];
111
111
  lastBuilderRun?: Run;
@@ -114,8 +114,8 @@ declare function resumeBuilderSession(store: TraceStore, projectId: string): Pro
114
114
  }>;
115
115
  //#endregion
116
116
  //#region src/builder-eval/three-layer-eval.d.ts
117
- type ProjectKind = 'full' | 'scaffold-only';
118
- interface ThreeLayerProjectReport {
117
+ export type ProjectKind = 'full' | 'scaffold-only';
118
+ export interface ThreeLayerProjectReport {
119
119
  projectId: string;
120
120
  /**
121
121
  * `'full'` when the project has at least one `app-runtime` run;
@@ -141,17 +141,17 @@ interface ThreeLayerProjectReport {
141
141
  */
142
142
  complete: boolean;
143
143
  }
144
- declare function scoreProject(store: TraceStore, projectId: string): Promise<ThreeLayerProjectReport>;
144
+ export declare function scoreProject(store: TraceStore, projectId: string): Promise<ThreeLayerProjectReport>;
145
145
  /** Aggregate scoring across every project in a corpus. */
146
- declare function scoreAllProjects(store: TraceStore): Promise<ThreeLayerProjectReport[]>;
146
+ export declare function scoreAllProjects(store: TraceStore): Promise<ThreeLayerProjectReport[]>;
147
147
  //#endregion
148
148
  //#region src/builder-eval/correlation.d.ts
149
- interface LayerCorrelation {
149
+ export interface LayerCorrelation {
150
150
  n: number;
151
151
  pearson: number;
152
152
  spearman: number;
153
153
  }
154
- interface CorrelationReport {
154
+ export interface CorrelationReport {
155
155
  /** Pairs present in the corpus (layers with ≥ 2 matched data points). */
156
156
  metaVsBuild?: LayerCorrelation;
157
157
  metaVsRuntime?: LayerCorrelation;
@@ -159,10 +159,10 @@ interface CorrelationReport {
159
159
  /** Number of complete projects (all 3 scores present). */
160
160
  completeProjects: number;
161
161
  }
162
- declare function correlateLayers(reports: ThreeLayerProjectReport[]): CorrelationReport;
162
+ export declare function correlateLayers(reports: ThreeLayerProjectReport[]): CorrelationReport;
163
163
  //#endregion
164
164
  //#region src/builder-eval/project-registry.d.ts
165
- interface ProjectSummary {
165
+ export interface ProjectSummary {
166
166
  projectId: string;
167
167
  chatCount: number;
168
168
  buildCount: number;
@@ -174,7 +174,7 @@ interface ProjectSummary {
174
174
  score?: number;
175
175
  };
176
176
  }
177
- interface ChatSummary {
177
+ export interface ChatSummary {
178
178
  chatId: string;
179
179
  projectId: string;
180
180
  builderRunId: string;
@@ -188,11 +188,11 @@ interface ChatSummary {
188
188
  buildRunId?: string;
189
189
  appRuntimeRunIds: string[];
190
190
  }
191
- interface ProjectTimelineEntry {
191
+ export interface ProjectTimelineEntry {
192
192
  run: Run;
193
193
  layerBucket: 'chat' | 'build' | 'runtime' | 'other';
194
194
  }
195
- declare class ProjectRegistry {
195
+ export declare class ProjectRegistry {
196
196
  private store;
197
197
  constructor(store: TraceStore);
198
198
  listProjects(): Promise<ProjectSummary[]>;
@@ -200,5 +200,4 @@ declare class ProjectRegistry {
200
200
  projectChats(projectId: string): Promise<ChatSummary[]>;
201
201
  }
202
202
  //#endregion
203
- export { BuilderSession, BuilderSessionInit, ChatSummary, CorrelationReport, LayerCorrelation, ProjectKind, ProjectRegistry, ProjectSummary, ProjectTimelineEntry, RunAppScenarioOptions, ShipOptions, ThreeLayerProjectReport, correlateLayers, resumeBuilderSession, scoreAllProjects, scoreProject };
204
203
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/test-graded-scenario.ts","../../src/builder-eval/builder-session.ts","../../src/builder-eval/three-layer-eval.ts","../../src/builder-eval/correlation.ts","../../src/builder-eval/project-registry.ts"],"mappings":";;;;;UAmBiB;EACf;EACA;EACA,SAAS;;EAET;;EAEA;;EAEA,OAAO;;UAUQ;EACf;EACA,UAAU;EACV,SAAS;EACT;EACA;EACA,eAAe;;;;UCjBA;EACf;EACA;;EAEA,OAAO;;UAGQ;EACf,SAAS;EACT,SAAS;;EAET;;UAGe;EACf,UAAU;;EAEV,SAAS;;cAGE;UACH;UACA;WACC;WACA;UACD;UACA;UACA;EAER,YAAY,OAAO,YAAY,MAAM,oBAAoB,SAAS;;EAS5D,UAAU,sBAAwC;;MAYpD,WAAW;;;;;EAST,KAAK,SAAS,cAAc;IAAU;IAAe,QAAQ;;;;;;;;EA2B7D,eAAe,SAAS,wBAAwB,QAAQ;;;EAqBxD,gBAAgB,eAAe,qBAAqB;;EAcpD,QAAQ;IAAW;IAAe;IAAgB;MAAmB;;;;;;;;EAerE,gBAAgB,qBAAqB,QAAQ;;;;;;EAsB7C,iBAAiB;IACrB;IACA;IACA;IACA;MACE;MAqBA;MAGA;;;;;;;iBAUgB,qBACpB,OAAO,YACP,oBACC;EACD;EACA,UAAU;EACV,iBAAiB;EACjB,eAAe;EACf,oBAAoB;;;;KC5MV;UAEK;EACf;;;;;;;EAOA,MAAM;EACN;;EAEA;EACA;;EAEA;EACA;;EAEA;EACA;;;;;;EAMA;;iBAGoB,aACpB,OAAO,YACP,oBACC,QAAQ;;iBAuCW,iBAAiB,OAAO,aAAa,QAAQ;;;UC/ElD;EACf;EACA;EACA;;UAGe;;EAEf,cAAc;EACd,gBAAgB;EAChB,iBAAiB;;EAEjB;;iBAGc,gBAAgB,SAAS,4BAA4B;;;UCpBpD;EACf;EACA;EACA;EACA;EACA;EACA;EACA;IAAkB;IAAe;;;UAGlB;EACf;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR,UAAU;;EAEV;EACA;EACA;EACA;;UAGe;EACf,KAAK;EACL;;cAGW;UACS;EAApB,YAAoB,OAAO;EAErB,gBAAgB,QAAQ;EAgCxB,gBAAgB,oBAAoB,QAAQ;EAgB5C,aAAa,oBAAoB,QAAQ"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/test-graded-scenario.ts","../../src/builder-eval/builder-session.ts","../../src/builder-eval/three-layer-eval.ts","../../src/builder-eval/correlation.ts","../../src/builder-eval/project-registry.ts"],"mappings":";;;;;UAm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EAgB5C,aAAa,oBAAoB,QAAQ"}
@@ -1,8 +1,8 @@
1
- import { a as spearmanR, r as pearsonR } from "../descriptive-1V17A-qa.js";
1
+ import { a as spearmanR, r as pearsonR } from "../descriptive-D9LUFk1-.js";
2
2
  import { s as judgeSpans } from "../query-DlV0pdx4.js";
3
3
  import { t as newRecordId } from "../record-id-DUgsK5qp.js";
4
4
  import { t as TraceEmitter } from "../emitter-DbMXUIVP.js";
5
- import { n as runBoundedProcess } from "../bounded-process-BBZob7vl.js";
5
+ import { n as runBoundedProcess } from "../bounded-process-Cj9YjXbE.js";
6
6
  //#region src/sandbox-harness.ts
7
7
  /**
8
8
  * SandboxHarness — executes a scenario in an isolated environment and
@@ -27,18 +27,20 @@ var SubprocessSandboxDriver = class {
27
27
  this.defaultEnv = options.env;
28
28
  }
29
29
  async exec(phase, command, config) {
30
+ const effectiveCwd = config.cwd ?? this.defaultCwd;
31
+ const effectiveEnv = {
32
+ ...process.env,
33
+ ...this.defaultEnv ?? {},
34
+ ...config.env ?? {}
35
+ };
30
36
  const result = await runBoundedProcess({
31
37
  command,
32
38
  shell: true,
33
- cwd: config.cwd ?? this.defaultCwd,
34
- env: {
35
- ...process.env,
36
- ...this.defaultEnv ?? {},
37
- ...config.env ?? {}
38
- },
39
+ cwd: effectiveCwd,
40
+ env: effectiveEnv,
39
41
  envMode: "replace",
40
- timeoutMs: config.timeoutMs ?? 10 * 6e4,
41
- maxOutputBytes: config.maxOutputBytes ?? 16 * 1024 * 1024
42
+ timeoutMs: config.timeoutMs ?? 6e5,
43
+ maxOutputBytes: config.maxOutputBytes ?? 16777216
42
44
  });
43
45
  const parsed = !result.killedByTimeout && phase === "test" && config.testParser ? config.testParser.parse(result.stdout, result.stderr, result.exitCode) : void 0;
44
46
  return {