@tangle-network/agent-eval 1.0.25 → 1.0.27

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,99 @@ All notable changes to `@tangle-network/agent-eval` and its sibling `agent-eval-
4
4
 
5
5
  ---
6
6
 
7
+ ## [1.0.27] — 2026-11-08
8
+
9
+ - fix(models): default to the newest served model in each tier
10
+ - chore(release): 1.0.26
11
+ - fix(benchmarks): detailTail ends for a bound of 0 or 1, and keepImage says what it does
12
+ - feat(benchmarks): grade a code patch with a Harbor task's own verifier
13
+ - chore(release): 1.0.25
14
+ - fix(judges): default to zai/glm-5.3, which every restricted Router key may call
15
+ - chore(release): 1.0.24
16
+ - test(multishot): judge default model and its price in runJudge
17
+ - test(multishot): price judge calls at the new default judge model
18
+ - fix(judges): one judge default, gpt-6-luna, which the Router serves
19
+ - chore(release): 1.0.23
20
+ - fix(run-record): a Claude id from 4.6 on is a pinned snapshot
21
+ - feat(adopt): expose scoped consumer in managed adoption
22
+ - fix(adopt): stage selected peer cohort before install
23
+ - feat(search): an objective key names the judge revision
24
+ - feat(adopt): scope programmatic adoption to one consumer
25
+ - feat: size a sequential pair cap under a registered law (#1223)
26
+ - fix(test): bound shared release verification workers (#1225)
27
+ - fix(test): qualify refreshed harness contracts with maintained pnpm (#1224)
28
+ - chore(release): 1.0.22 (#1222)
29
+ - chore(deps): refresh first-party library dependencies (#1221)
30
+ - docs(release): describe independent interval API and drop duplicate bumps
31
+ - chore(release): 1.0.21
32
+ - docs(test): cite printed Newcombe table pages
33
+ - feat(statistics): add independent risk differences from Wilson limits
34
+ - fix(test): mark disposable identities for host Git hooks
35
+ - fix(test): declare identity in disposable integration repositories
36
+ - fix(release): authenticate public evidence reads in verification
37
+ - fix(statistics): exclude steps through every selected cluster extent
38
+ - test(statistics): retain overlapping-cluster sealed-step regression
39
+ - docs(release): remove redundant release commit entries
40
+ - chore(release): 1.0.20
41
+ - docs(statistics): trim whitespace in interval guidance
42
+ - fix(verification): retain valid replay baselines and current release evidence
43
+ - chore(analyst): refresh manifest for shared statistics owner
44
+ - fix(statistics): preserve degenerate bootstrap results and mean seed
45
+ - feat(statistics): share stratified cluster resampling and calibrated placebo bands
46
+ - fix(adoption): retain unselected pnpm resolutions
47
+ - fix(exports): ship ./statistics subpath, gpt-5-mini pricing, sequentialCrossingHorizon
48
+ - fix(adopt-stack): qualify the committed caller tree
49
+ - fix(adopt-stack): read large tracked path inventories
50
+ - fix(adoption): read a Runtime release's evidence from its Publish run, and raise pins below a dependency floor (#1211)
51
+ - fix(adoption): hold a Runtime release whose tag evidence failed or never ran
52
+ - fix(adoption): gate stable-major candidates against installed versions
53
+ - feat(app-grade): probes take a method and JSON body (#1208)
54
+
55
+ ## [1.0.26] — 2026-11-08
56
+
57
+ - feat(benchmarks): grade a code patch with a Harbor task's own verifier
58
+ - chore(release): 1.0.25
59
+ - fix(judges): default to zai/glm-5.3, which every restricted Router key may call
60
+ - chore(release): 1.0.24
61
+ - test(multishot): judge default model and its price in runJudge
62
+ - test(multishot): price judge calls at the new default judge model
63
+ - fix(judges): one judge default, gpt-6-luna, which the Router serves
64
+ - chore(release): 1.0.23
65
+ - fix(run-record): a Claude id from 4.6 on is a pinned snapshot
66
+ - feat(adopt): expose scoped consumer in managed adoption
67
+ - fix(adopt): stage selected peer cohort before install
68
+ - feat(search): an objective key names the judge revision
69
+ - feat(adopt): scope programmatic adoption to one consumer
70
+ - feat: size a sequential pair cap under a registered law (#1223)
71
+ - fix(test): bound shared release verification workers (#1225)
72
+ - fix(test): qualify refreshed harness contracts with maintained pnpm (#1224)
73
+ - chore(release): 1.0.22 (#1222)
74
+ - chore(deps): refresh first-party library dependencies (#1221)
75
+ - docs(release): describe independent interval API and drop duplicate bumps
76
+ - chore(release): 1.0.21
77
+ - docs(test): cite printed Newcombe table pages
78
+ - feat(statistics): add independent risk differences from Wilson limits
79
+ - fix(test): mark disposable identities for host Git hooks
80
+ - fix(test): declare identity in disposable integration repositories
81
+ - fix(release): authenticate public evidence reads in verification
82
+ - fix(statistics): exclude steps through every selected cluster extent
83
+ - test(statistics): retain overlapping-cluster sealed-step regression
84
+ - docs(release): remove redundant release commit entries
85
+ - chore(release): 1.0.20
86
+ - docs(statistics): trim whitespace in interval guidance
87
+ - fix(verification): retain valid replay baselines and current release evidence
88
+ - chore(analyst): refresh manifest for shared statistics owner
89
+ - fix(statistics): preserve degenerate bootstrap results and mean seed
90
+ - feat(statistics): share stratified cluster resampling and calibrated placebo bands
91
+ - fix(adoption): retain unselected pnpm resolutions
92
+ - fix(exports): ship ./statistics subpath, gpt-5-mini pricing, sequentialCrossingHorizon
93
+ - fix(adopt-stack): qualify the committed caller tree
94
+ - fix(adopt-stack): read large tracked path inventories
95
+ - fix(adoption): read a Runtime release's evidence from its Publish run, and raise pins below a dependency floor (#1211)
96
+ - fix(adoption): hold a Runtime release whose tag evidence failed or never ran
97
+ - fix(adoption): gate stable-major candidates against installed versions
98
+ - feat(app-grade): probes take a method and JSON body (#1208)
99
+
7
100
  ## [1.0.25] — 2026-11-08
8
101
 
9
102
  - fix(judges): default to zai/glm-5.3, which every restricted Router key may call
@@ -1,5 +1,5 @@
1
1
  import { m as CustomTokenPricing, t as CostLedger } from "../cost-ledger-Czro9wmo.js";
2
- import "../index-JPI2spOx.js";
2
+ import "../index-C8a9Dyan.js";
3
3
  import { O as ChatClient, j as ChatTransport } from "../cluster-CSd0LE_M.js";
4
4
  import { d as SystemOneRequest, g as SystemOneState, s as SystemOneQuestions } from "../systemone-protocol-C4t7JH4Y.js";
5
5
  import "../systemone-CSwi1hp-.js";
@@ -1,8 +1,8 @@
1
1
  import { c as RunSplitTag } from "../run-record-pBlhZizT.js";
2
2
  import "../index-BI9ecONy.js";
3
- import { a as CampaignResult } from "../types-ByrbgALT.js";
3
+ import { S as JudgeConfig, a as CampaignResult } from "../types-ByrbgALT.js";
4
4
  import { Wt as CampaignStorage } from "../search-kernel-C4XnLKIW.js";
5
- import { a as BenchmarkFamily, c as BenchmarkSource, i as BenchmarkEvaluation, l as BenchmarkTaskKind, n as BenchmarkAdapter, o as BenchmarkResponder, r as BenchmarkDatasetItem, s as BenchmarkScenario, t as BENCHMARK_SPLIT_SEED, u as deterministicSplit } from "../types-D7g2XFTc.js";
5
+ import { a as BenchmarkFamily, c as BenchmarkSource, i as BenchmarkEvaluation, l as BenchmarkTaskKind, n as BenchmarkAdapter, o as BenchmarkResponder, r as BenchmarkDatasetItem, s as BenchmarkScenario, t as BENCHMARK_SPLIT_SEED, u as deterministicSplit } from "../types-CEgIBy0W.js";
6
6
  interface BenchmarkMetricCalibrationOptions<TPayload = unknown, TArtifact = string> {
7
7
  adapter: BenchmarkAdapter<BenchmarkDatasetItem<TPayload>, TPayload, TArtifact>;
8
8
  item: BenchmarkDatasetItem<TPayload>;
@@ -88,6 +88,29 @@ interface HarborBenchmarkAdapter<TArtifact> extends BenchmarkAdapter<HarborTaskI
88
88
  }
89
89
  /** Import a Harbor dataset checkout as a `BenchmarkAdapter` whose scorer is the dataset's own verifier. */
90
90
  export declare function createHarborBenchmarkAdapter<TArtifact = string>(options: HarborBenchmarkOptions<TArtifact>): HarborBenchmarkAdapter<TArtifact>;
91
+ /**
92
+ * Defaults: `retries` 2 (extra runs after one with no reward), `maxDetailChars` 2000 (bounds
93
+ * `JSON.stringify(detail).length`), `keepImage` true: `--no-delete` keeps the image after a run,
94
+ * yet a later run builds it again unless `task.toml` names a prebuilt `docker_image`.
95
+ */
96
+ interface HarborPatchGradeOptions {
97
+ harborBin?: string;
98
+ jobsDir?: string;
99
+ retries?: number;
100
+ maxDetailChars?: number;
101
+ timeoutMs?: number;
102
+ env?: Record<string, string>;
103
+ keepImage?: boolean;
104
+ }
105
+ /**
106
+ * A `grade` callback that scores `{ patch }` with the task's own verifier: Harbor's oracle agent
107
+ * runs a `solution/solve.sh` that applies the patch (`git apply --binary`) in the environment's
108
+ * working directory, on a copy of the task. An empty patch changes nothing. A run with no reward
109
+ * is retried, then reported as `succeeded: false`, never as a reward of 0.
110
+ */
111
+ export declare function gradeHarborPatch(options?: HarborPatchGradeOptions): (item: HarborTaskItem, artifact: {
112
+ patch: string;
113
+ }) => Promise<HarborGradeOutcome>;
91
114
  /**
92
115
  * Synthetic routing dataset. 16 tasks across 4 categories. Used as a
93
116
  * deterministic, dependency-free benchmark for any router that maps a
@@ -209,6 +232,8 @@ interface BenchmarkRunResult<TPayload = unknown, TArtifact = string> {
209
232
  reportMarkdownPath: string;
210
233
  }
211
234
  export declare function runBenchmarkAdapter<TPayload = unknown, TArtifact = string>(options: BenchmarkRunOptions<TPayload, TArtifact>): Promise<BenchmarkRunResult<TPayload, TArtifact>>;
235
+ export declare function benchmarkScenarios<TPayload>(adapter: BenchmarkAdapter<BenchmarkDatasetItem<TPayload>, TPayload, unknown>, splits?: readonly RunSplitTag[]): Promise<Array<BenchmarkScenario<TPayload>>>;
236
+ export declare function benchmarkJudge<TPayload, TArtifact>(adapter: BenchmarkAdapter<BenchmarkDatasetItem<TPayload>, TPayload, TArtifact>): JudgeConfig<TArtifact, BenchmarkScenario<TPayload>>;
212
237
  interface StandardRetrievalDocument {
213
238
  id: string;
214
239
  title?: string;
@@ -284,5 +309,5 @@ export declare function evaluateStandardRetrieval(payload: StandardRetrievalPayl
284
309
  expectedScores: Record<string, number>;
285
310
  };
286
311
  };
287
- 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 };
312
+ 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 HarborPatchGradeOptions, 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 };
288
313
  //# 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/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;;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oBAAoB;EACtD,WAAW,MAAM,kBAAkB;EACnC,UAAU,eAAe,WAAW,kBAAkB;EACtD,QAAQ;EACR;EACA;;wBAGoB,oBAAoB,oBAAoB,oBAC5D,SAAS,oBAAoB,UAAU,aACtC,QAAQ,mBAAmB,UAAU;UClFvB;EACf;EACA;EACA;EACA,WAAW;;UAGI;EACf;EACA;EACA,WAAW;;UAGI;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA,gBAAgB;EAChB,SAAS,eAAe;EACxB,WAAW;;UAGI;EACf;EACA,QAAQ;EACR,kBAAkB;EAClB,gBAAgB;EAChB,kBAAkB;EAClB;EACA,SAAS;EACT;EACA,WAAW,oBAAoB;;UAGhB,kCAAkC;EACjD,oBAAoB;EACpB;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;KAGU,kEAGC;EAEP;EACA;EACA,mBAAmB;;UAGR;EACf,oBAAoB;EACpB;EACA;EACA;EACA;;wBA0Bc,WAAW,eAAe;wBAgB1B,qBAAqB,eAAe;wBAgBpC,sBAAsB,eAAe;wBAerC,4BACd,SAAS,qCACR,MAAM,qBAAqB;wBAuCd,kCACd,SAAS,4BACR,iBACD,qBAAqB,2BACrB,0BACA;wBAqBc,0BACd,SAAS,0BACT,UAAU,2BACV,UAAS"}
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;;UCWM;;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ct as mean } from "../statistics-CvvC-MPv.
3
3
  import { Z as runCampaign } from "../llm-judge-DzAT7Wka.js";
4
4
  import { M as fsCampaignStorage } from "../external-optimizer-subprocess-GO6s84Ov.js";
5
5
  import "../campaign-Cqz2vk2p.js";
6
+ import { randomUUID } from "node:crypto";
6
7
  import { join, resolve } from "node:path";
7
- import { readFile, readdir, stat } from "node:fs/promises";
8
+ import { tmpdir } from "node:os";
9
+ import { execFile } from "node:child_process";
10
+ import { cp, mkdir, mkdtemp, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
11
+ import { promisify, stripVTControlCharacters } from "node:util";
8
12
  import { parse } from "smol-toml";
9
13
  // src/benchmarks/calibration.ts
10
14
  async function calibrateBenchmarkMetric(options) {
@@ -56,16 +60,19 @@ function fnv1a32(input) {
56
60
  const BENCHMARK_SPLIT_SEED = "agent-eval-v1";
57
61
  /**
58
62
  * Assign an item id to one of `'search' | 'dev' | 'holdout'` using a
59
- * stable 32-bit hash of `${seed}::${id}`. Default proportions:
63
+ * stable 32-bit hash of `${seed}::${id}`. `cuts` [a, b] with 0 < a < b < 1 put
64
+ * positions below a in search, below b in dev, the rest in holdout. Default [0.6, 0.8]:
60
65
  *
61
66
  * search: 60% (optimization-readable)
62
67
  * dev: 20% (held-out for tuning, leak-on-purpose during dev)
63
68
  * holdout:20% (paper-grade held-out, gated reads)
64
69
  */
65
- function deterministicSplit(itemId, seed = BENCHMARK_SPLIT_SEED) {
70
+ function deterministicSplit(itemId, seed = BENCHMARK_SPLIT_SEED, cuts = [.6, .8]) {
71
+ const [a, b] = cuts;
72
+ if (!(a > 0 && a < b && b < 1)) throw new RangeError(`split cuts need 0 < a < b < 1, got [${a}, ${b}]`);
66
73
  const pos = fnv1a32(`${seed}::${itemId}`) / 4294967296;
67
- if (pos < .6) return "search";
68
- if (pos < .8) return "dev";
74
+ if (pos < a) return "search";
75
+ if (pos < b) return "dev";
69
76
  return "holdout";
70
77
  }
71
78
  // src/benchmarks/harbor.ts
@@ -78,10 +85,11 @@ function deterministicSplit(itemId, seed = BENCHMARK_SPLIT_SEED) {
78
85
  * revision the caller pins in `source`, into `BenchmarkDatasetItem`s.
79
86
  *
80
87
  * Scoring stays Harbor's. `evaluate` hands the task and the agent's artifact to the caller's
81
- * `grade` callback, which runs the task's own verifier (for example `harbor run -p <taskDir>`
82
- * with an agent that installs the collected artifacts) and reports its reward. This package does
83
- * not start containers. A verifier that did not run is an error, never a score of zero.
88
+ * `grade` callback, which runs the task's own verifier and reports its reward. `gradeHarborPatch`
89
+ * is that callback for a code patch: it spawns the Harbor CLI, which starts the containers; this
90
+ * package starts none itself. A verifier that did not run is an error, never a score of zero.
84
91
  */
92
+ const execute = promisify(execFile);
85
93
  const table = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
86
94
  const numberOrNull = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
87
95
  const textOrNull = (value) => typeof value === "string" && value.length > 0 ? value : null;
@@ -163,12 +171,92 @@ function createHarborBenchmarkAdapter(options) {
163
171
  raw: {
164
172
  reward,
165
173
  ...detail === void 0 ? {} : { detail }
166
- }
174
+ },
175
+ ...detail === void 0 ? {} : { notes: detail }
167
176
  };
168
177
  },
169
178
  assignSplit: split
170
179
  };
171
180
  }
181
+ const SOLVE_SH = "#!/bin/bash\nset -euo pipefail\npatch=\"$(dirname \"$0\")/patch.diff\"\nif [ -s \"$patch\" ]; then git apply --binary \"$patch\"; fi\n";
182
+ /** The last characters of `text` without ANSI codes, so that its JSON string fits in `max`. */
183
+ function detailTail(text, max) {
184
+ let tail = stripVTControlCharacters(text).slice(-max);
185
+ while (tail && JSON.stringify(tail).length > max) tail = tail.slice(1);
186
+ return tail;
187
+ }
188
+ /**
189
+ * A `grade` callback that scores `{ patch }` with the task's own verifier: Harbor's oracle agent
190
+ * runs a `solution/solve.sh` that applies the patch (`git apply --binary`) in the environment's
191
+ * working directory, on a copy of the task. An empty patch changes nothing. A run with no reward
192
+ * is retried, then reported as `succeeded: false`, never as a reward of 0.
193
+ */
194
+ function gradeHarborPatch(options = {}) {
195
+ const { harborBin = "harbor", retries = 2, maxDetailChars = 2e3, keepImage = true } = options;
196
+ const { timeoutMs: timeout, env: extra } = options;
197
+ const run = {
198
+ env: {
199
+ ...process.env,
200
+ ...extra
201
+ },
202
+ timeout,
203
+ maxBuffer: 1 << 26
204
+ };
205
+ return async (item, artifact) => {
206
+ const work = await mkdtemp(join(tmpdir(), "harbor-grade-"));
207
+ try {
208
+ const task = join(work, item.payload.dir);
209
+ await cp(item.payload.taskDir, task, { recursive: true });
210
+ await rm(join(task, "solution"), {
211
+ recursive: true,
212
+ force: true
213
+ });
214
+ await mkdir(join(task, "solution"));
215
+ await writeFile(join(task, "solution/patch.diff"), artifact.patch);
216
+ await writeFile(join(task, "solution/solve.sh"), SOLVE_SH, { mode: 493 });
217
+ const jobsDir = resolve(options.jobsDir ?? join(work, "jobs"));
218
+ const errors = [];
219
+ const args = [
220
+ "run",
221
+ "-p",
222
+ task,
223
+ "-a",
224
+ "oracle",
225
+ "-o",
226
+ jobsDir,
227
+ "-q",
228
+ keepImage ? "--no-delete" : "--delete",
229
+ "--job-name"
230
+ ];
231
+ for (let attempt = 1; attempt <= retries + 1; attempt += 1) {
232
+ const job = `${item.payload.dir}-${randomUUID()}`;
233
+ const failure = await execute(harborBin, [...args, job], run).then(() => null, (error) => detailTail(error.message, 500));
234
+ const trial = (await readdir(join(jobsDir, job), { withFileTypes: true }).catch(() => [])).filter((entry) => entry.isDirectory()).map((entry) => join(jobsDir, job, entry.name, "/"))[0];
235
+ const read = (path) => readFile(`${trial}${path}`, "utf8").catch(() => "");
236
+ const result = table(trial === void 0 ? {} : JSON.parse(await read("result.json") || "{}"));
237
+ const reward = numberOrNull(table(table(result.verifier_result).rewards).reward);
238
+ if (reward !== null) return {
239
+ succeeded: true,
240
+ value: {
241
+ reward,
242
+ detail: detailTail(await read("verifier/test-stdout.txt"), maxDetailChars)
243
+ }
244
+ };
245
+ const exception = textOrNull(table(result.exception_info).exception_message);
246
+ errors.push(`attempt ${attempt}: ${failure ?? exception ?? "harbor recorded no reward"}`);
247
+ }
248
+ return {
249
+ succeeded: false,
250
+ error: errors.join("; ")
251
+ };
252
+ } finally {
253
+ await rm(work, {
254
+ recursive: true,
255
+ force: true
256
+ });
257
+ }
258
+ };
259
+ }
172
260
  // src/benchmarks/routing/dataset.ts
173
261
  const ROUTING_DATASET = [
174
262
  {
@@ -362,8 +450,8 @@ const assignSplit = adapter.assignSplit.bind(adapter);
362
450
  async function runBenchmarkAdapter(options) {
363
451
  const storage = options.storage ?? fsCampaignStorage();
364
452
  const benchmarkId = benchmarkIdFor(options.adapter);
365
- const scenarios = await loadBenchmarkScenarios(options.adapter, options.splits);
366
- const judge = benchmarkAdapterJudge(options.adapter);
453
+ const scenarios = await benchmarkScenarios(options.adapter, options.splits);
454
+ const judge = benchmarkJudge(options.adapter);
367
455
  const dispatch = async (scenario, context) => {
368
456
  return options.respond({
369
457
  scenario,
@@ -406,7 +494,7 @@ async function runBenchmarkAdapter(options) {
406
494
  reportMarkdownPath
407
495
  };
408
496
  }
409
- async function loadBenchmarkScenarios(adapter, splits = [
497
+ async function benchmarkScenarios(adapter, splits = [
410
498
  "search",
411
499
  "dev",
412
500
  "holdout"
@@ -438,7 +526,7 @@ async function loadBenchmarkScenarios(adapter, splits = [
438
526
  }
439
527
  return out;
440
528
  }
441
- function benchmarkAdapterJudge(adapter) {
529
+ function benchmarkJudge(adapter) {
442
530
  const benchmarkId = benchmarkIdFor(adapter);
443
531
  return {
444
532
  name: `${benchmarkId}:score`,
@@ -821,6 +909,6 @@ function discountedGain(relevance, zeroBasedRank) {
821
909
  if (relevance <= 0) return 0;
822
910
  return (2 ** relevance - 1) / Math.log2(zeroBasedRank + 2);
823
911
  }
824
- export { BENCHMARK_SPLIT_SEED, buildStandardRetrievalItems, calibrateBenchmarkMetric, createHarborBenchmarkAdapter, createRetrievalIdBenchmarkAdapter, deterministicSplit, evaluateStandardRetrieval, parseBeirCorpusJsonl, parseBeirQueriesJsonl, parseQrels, routing_exports as routing, runBenchmarkAdapter };
912
+ export { BENCHMARK_SPLIT_SEED, benchmarkJudge, benchmarkScenarios, buildStandardRetrievalItems, calibrateBenchmarkMetric, createHarborBenchmarkAdapter, createRetrievalIdBenchmarkAdapter, deterministicSplit, evaluateStandardRetrieval, gradeHarborPatch, parseBeirCorpusJsonl, parseBeirQueriesJsonl, parseQrels, routing_exports as routing, runBenchmarkAdapter };
825
913
 
826
914
  //# sourceMappingURL=index.js.map