dsh-eval 0.4.0 → 0.5.1
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/README.md +214 -13
- package/README.zh.md +99 -10
- package/lib/agreement.js +46 -0
- package/lib/argv.js +66 -0
- package/lib/atomic-write.js +38 -0
- package/lib/benchmark.js +116 -19
- package/lib/calibration.js +90 -0
- package/lib/command.js +202 -10
- package/lib/compare.js +310 -31
- package/lib/dashboard.js +260 -0
- package/lib/digest.js +118 -0
- package/lib/export.js +50 -0
- package/lib/gate.js +293 -0
- package/lib/import.js +17 -6
- package/lib/index.js +174 -12
- package/lib/judge.js +30 -7
- package/lib/leaderboard.js +222 -0
- package/lib/precision.js +50 -0
- package/lib/rejudge.js +107 -0
- package/lib/reliability.js +107 -0
- package/lib/report.js +285 -11
- package/lib/runner.js +189 -33
- package/lib/safe-regex.js +74 -0
- package/lib/segments.js +15 -0
- package/lib/stats.js +63 -0
- package/lib/trace.js +19 -2
- package/lib/types/agreement.d.ts +33 -0
- package/lib/types/argv.d.ts +19 -0
- package/lib/types/atomic-write.d.ts +15 -0
- package/lib/types/benchmark.d.ts +9 -2
- package/lib/types/calibration.d.ts +45 -0
- package/lib/types/command.d.ts +58 -0
- package/lib/types/compare.d.ts +82 -2
- package/lib/types/dashboard.d.ts +24 -0
- package/lib/types/digest.d.ts +38 -0
- package/lib/types/export.d.ts +17 -0
- package/lib/types/gate.d.ts +87 -0
- package/lib/types/index.d.ts +8 -4
- package/lib/types/judge.d.ts +4 -1
- package/lib/types/leaderboard.d.ts +70 -0
- package/lib/types/precision.d.ts +44 -0
- package/lib/types/rejudge.d.ts +22 -0
- package/lib/types/reliability.d.ts +85 -0
- package/lib/types/report.d.ts +18 -5
- package/lib/types/runner.d.ts +8 -1
- package/lib/types/safe-regex.d.ts +24 -0
- package/lib/types/segments.d.ts +12 -0
- package/lib/types/stats.d.ts +56 -0
- package/lib/types/trace.d.ts +7 -0
- package/lib/types/types.d.ts +55 -6
- package/lib/types/validate.d.ts +57 -0
- package/lib/validate.js +155 -0
- package/package.json +2 -2
- package/src/agreement.ts +60 -0
- package/src/argv.ts +63 -0
- package/src/atomic-write.ts +38 -0
- package/src/benchmark.ts +139 -13
- package/src/calibration.ts +113 -0
- package/src/command.ts +297 -10
- package/src/compare.ts +392 -37
- package/src/dashboard.ts +287 -0
- package/src/digest.ts +144 -0
- package/src/export.ts +57 -0
- package/src/gate.ts +383 -0
- package/src/import.ts +18 -6
- package/src/index.ts +192 -12
- package/src/judge.ts +30 -6
- package/src/leaderboard.ts +272 -0
- package/src/precision.ts +85 -0
- package/src/rejudge.ts +112 -0
- package/src/reliability.ts +166 -0
- package/src/report.ts +303 -11
- package/src/runner.ts +182 -35
- package/src/safe-regex.ts +79 -0
- package/src/segments.ts +16 -0
- package/src/stats.ts +104 -0
- package/src/trace.ts +19 -2
- package/src/types.ts +56 -6
- package/src/validate.ts +177 -0
package/src/command.ts
CHANGED
|
@@ -7,10 +7,13 @@
|
|
|
7
7
|
* @module dsh-eval/command
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { resolve } from 'node:path'
|
|
11
|
+
import { splitArgv } from './argv.ts'
|
|
10
12
|
import { Command } from 'commander'
|
|
11
13
|
import type { Context } from '@deepseek-ai/cordis'
|
|
12
14
|
import { parseCmdline } from '@deepseek-ai/dsh-cmdline'
|
|
13
15
|
import type { ImportFormat } from './import.ts'
|
|
16
|
+
import type { BenchmarkJudge } from './types.ts'
|
|
14
17
|
|
|
15
18
|
/** What the eval app resolved from its command line. */
|
|
16
19
|
export type EvalStartupValues =
|
|
@@ -20,17 +23,81 @@ export type EvalStartupValues =
|
|
|
20
23
|
outPath: string
|
|
21
24
|
trials?: number
|
|
22
25
|
concurrency?: number
|
|
26
|
+
seed?: number
|
|
23
27
|
dshCommand?: readonly string[]
|
|
24
28
|
profile?: string
|
|
29
|
+
quiet?: boolean
|
|
30
|
+
allowExternalPaths?: boolean
|
|
25
31
|
}
|
|
26
32
|
| {
|
|
27
33
|
kind: 'report'
|
|
28
34
|
runPath: string
|
|
35
|
+
/** Print a compact terminal summary instead of the full markdown report. */
|
|
36
|
+
brief?: boolean
|
|
37
|
+
/** Emit machine-readable JSON instead of markdown. */
|
|
38
|
+
json?: boolean
|
|
39
|
+
/** Optional output path; the report goes to stdout when omitted. */
|
|
40
|
+
outPath?: string
|
|
29
41
|
}
|
|
30
42
|
| {
|
|
31
43
|
kind: 'compare'
|
|
32
44
|
runPathA: string
|
|
33
45
|
runPathB: string
|
|
46
|
+
json?: boolean
|
|
47
|
+
outPath?: string
|
|
48
|
+
}
|
|
49
|
+
| {
|
|
50
|
+
kind: 'export'
|
|
51
|
+
runPath: string
|
|
52
|
+
/** Optional output path; CSV goes to stdout when omitted. */
|
|
53
|
+
outPath?: string
|
|
54
|
+
}
|
|
55
|
+
| {
|
|
56
|
+
kind: 'validate'
|
|
57
|
+
benchmarkPath: string
|
|
58
|
+
json?: boolean
|
|
59
|
+
outPath?: string
|
|
60
|
+
allowExternalPaths?: boolean
|
|
61
|
+
}
|
|
62
|
+
| {
|
|
63
|
+
kind: 'provenance'
|
|
64
|
+
runPath: string
|
|
65
|
+
benchmarkPath: string
|
|
66
|
+
json?: boolean
|
|
67
|
+
outPath?: string
|
|
68
|
+
allowExternalPaths?: boolean
|
|
69
|
+
}
|
|
70
|
+
| {
|
|
71
|
+
kind: 'leaderboard'
|
|
72
|
+
runPaths: readonly string[]
|
|
73
|
+
json?: boolean
|
|
74
|
+
outPath?: string
|
|
75
|
+
metric?: 'taskSuccess' | 'strictPassAt1'
|
|
76
|
+
}
|
|
77
|
+
| {
|
|
78
|
+
kind: 'gate'
|
|
79
|
+
candidatePath: string
|
|
80
|
+
baselinePath: string
|
|
81
|
+
maxDrop: number
|
|
82
|
+
maxCostIncrease?: number
|
|
83
|
+
maxLatencyIncrease?: number
|
|
84
|
+
allowIncomplete: boolean
|
|
85
|
+
requireSignificance?: boolean
|
|
86
|
+
json?: boolean
|
|
87
|
+
outPath?: string
|
|
88
|
+
}
|
|
89
|
+
| {
|
|
90
|
+
kind: 'dashboard'
|
|
91
|
+
runPaths: readonly string[]
|
|
92
|
+
outPath: string
|
|
93
|
+
metric?: 'taskSuccess' | 'strictPassAt1'
|
|
94
|
+
}
|
|
95
|
+
| {
|
|
96
|
+
kind: 'rejudge'
|
|
97
|
+
runPath: string
|
|
98
|
+
outPath: string
|
|
99
|
+
/** Optional judge configuration overriding the one stored in the run. */
|
|
100
|
+
judge?: BenchmarkJudge
|
|
34
101
|
}
|
|
35
102
|
| {
|
|
36
103
|
kind: 'import'
|
|
@@ -45,8 +112,27 @@ interface RunCommandOptions {
|
|
|
45
112
|
out: string
|
|
46
113
|
trials?: number
|
|
47
114
|
concurrency?: number
|
|
115
|
+
seed?: number
|
|
48
116
|
dsh?: string
|
|
49
117
|
profile?: string
|
|
118
|
+
quiet?: boolean
|
|
119
|
+
allowExternalPaths?: boolean
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Options accepted by `eval report`. */
|
|
123
|
+
interface ReportCommandOptions {
|
|
124
|
+
brief?: boolean
|
|
125
|
+
json?: boolean
|
|
126
|
+
out?: string
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Options accepted by `eval rejudge`. */
|
|
130
|
+
interface RejudgeCommandOptions {
|
|
131
|
+
out: string
|
|
132
|
+
judgeModel?: string
|
|
133
|
+
judgeProvider?: string
|
|
134
|
+
judgeRubric?: string
|
|
135
|
+
judgeMaxScore?: number
|
|
50
136
|
}
|
|
51
137
|
|
|
52
138
|
/** Options accepted by `eval import`. */
|
|
@@ -55,10 +141,15 @@ interface ImportCommandOptions {
|
|
|
55
141
|
caseId: string
|
|
56
142
|
}
|
|
57
143
|
|
|
58
|
-
/**
|
|
144
|
+
/** Turn an optional `--out` flag into a strictly optional startup value. */
|
|
145
|
+
function optionalOut(options: { out?: string }): { outPath?: string } {
|
|
146
|
+
return options.out === undefined ? {} : { outPath: options.out }
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Split a single `--dsh` value into argv, honoring quotes and escapes. */
|
|
59
150
|
function splitCommand(value: string | undefined): readonly string[] | undefined {
|
|
60
151
|
if (value === undefined) return undefined
|
|
61
|
-
const command = value
|
|
152
|
+
const command = splitArgv(value)
|
|
62
153
|
return command.length === 0 ? undefined : command
|
|
63
154
|
}
|
|
64
155
|
|
|
@@ -77,6 +168,37 @@ function positiveInteger(program: Command, flag: string): (value: string) => num
|
|
|
77
168
|
}
|
|
78
169
|
}
|
|
79
170
|
|
|
171
|
+
/** Build a parser for an integer flag such as a reproducibility seed. */
|
|
172
|
+
function integer(program: Command, flag: string): (value: string) => number {
|
|
173
|
+
return (value) => {
|
|
174
|
+
if (!/^[+-]?\d+$/u.test(value)) program.error(`error: ${flag} must be an integer`)
|
|
175
|
+
const parsed = Number(value)
|
|
176
|
+
if (!Number.isSafeInteger(parsed)) program.error(`error: ${flag} must be an integer`)
|
|
177
|
+
return parsed
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Build a parser for the leaderboard primary metric flag. */
|
|
182
|
+
function leaderboardMetric(program: Command, flag: string): (value: string) => 'taskSuccess' | 'strictPassAt1' {
|
|
183
|
+
return (value) => {
|
|
184
|
+
if (value !== 'taskSuccess' && value !== 'strictPassAt1') {
|
|
185
|
+
program.error(`error: ${flag} must be taskSuccess or strictPassAt1`)
|
|
186
|
+
}
|
|
187
|
+
return value
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** Build a parser for a 0..1 tolerance flag. */
|
|
192
|
+
function unitRatio(program: Command, flag: string): (value: string) => number {
|
|
193
|
+
return (value) => {
|
|
194
|
+
const parsed = Number(value)
|
|
195
|
+
if (!Number.isFinite(parsed) || parsed < 0 || parsed > 1) {
|
|
196
|
+
program.error(`error: ${flag} must be between 0 and 1`)
|
|
197
|
+
}
|
|
198
|
+
return parsed
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
80
202
|
/**
|
|
81
203
|
* Build a fresh eval commander program. The root action rejects a bare
|
|
82
204
|
* invocation; the `run` and `report` actions hand the resolved values to the
|
|
@@ -91,8 +213,20 @@ export function evalCommand(publish: (values: EvalStartupValues) => void): Comma
|
|
|
91
213
|
.name('dsh --profile eval')
|
|
92
214
|
.description('Run agent evaluations over headless dsh profiles and report trace-based metrics.')
|
|
93
215
|
.helpOption('-h, --help', 'show this help')
|
|
216
|
+
.addHelpText('after', `
|
|
217
|
+
Examples:
|
|
218
|
+
dsh --profile eval validate benchmark.yaml
|
|
219
|
+
dsh --profile eval run benchmark.yaml --out run.json
|
|
220
|
+
dsh --profile eval provenance run.json benchmark.yaml
|
|
221
|
+
dsh --profile eval report run.json --brief
|
|
222
|
+
dsh --profile eval export run.json --out trials.csv
|
|
223
|
+
dsh --profile eval compare base.json candidate.json
|
|
224
|
+
dsh --profile eval dashboard base.json candidate.json --out eval.html
|
|
225
|
+
dsh --profile eval gate candidate.json --baseline base.json --max-drop 0.05
|
|
226
|
+
dsh --profile eval gate candidate.json --baseline base.json --require-significance --json
|
|
227
|
+
`)
|
|
94
228
|
.action(() => {
|
|
95
|
-
program.error('error: eval needs a subcommand: run <benchmark.yaml>
|
|
229
|
+
program.error('error: eval needs a subcommand: run <benchmark.yaml>, validate <benchmark.yaml>, provenance <run.json> <benchmark.yaml>, report <run.json>, compare <a.json> <b.json>, export <run.json>, rejudge <run.json>, dashboard <run.json>, leaderboard <run.json>..., gate <candidate.json>, or import <format> <log.jsonl>')
|
|
96
230
|
})
|
|
97
231
|
const run = program.command('run').description('run a benchmark and write its JSON report')
|
|
98
232
|
run
|
|
@@ -100,32 +234,185 @@ export function evalCommand(publish: (values: EvalStartupValues) => void): Comma
|
|
|
100
234
|
.option('--out <path>', 'output run JSON path', 'eval-run.json')
|
|
101
235
|
.option('--trials <n>', 'override the benchmark trials count', positiveInteger(program, '--trials'))
|
|
102
236
|
.option('--concurrency <n>', 'override the in-flight trial limit', positiveInteger(program, '--concurrency'))
|
|
237
|
+
.option('--seed <n>', 'override the benchmark base seed', integer(program, '--seed'))
|
|
103
238
|
.option('--dsh <cmd>', 'override the dsh launcher command, space-separated')
|
|
104
239
|
.option('--profile <name>', 'override the spawned dsh profile')
|
|
240
|
+
.option('--quiet', 'suppress per-trial progress lines')
|
|
241
|
+
.option('--allow-external-paths', 'allow benchmark-referenced files outside the benchmark directory (trusted benchmarks only)')
|
|
105
242
|
.action((benchmarkPath: string, options: RunCommandOptions) => {
|
|
106
|
-
|
|
243
|
+
let dshCommand: readonly string[] | undefined
|
|
244
|
+
try {
|
|
245
|
+
dshCommand = splitCommand(options.dsh)
|
|
246
|
+
} catch (error) {
|
|
247
|
+
/* v8 ignore next -- splitArgv only throws Error instances. */
|
|
248
|
+
const detail = error instanceof Error ? error.message : String(error)
|
|
249
|
+
program.error(`error: --dsh: ${detail}`)
|
|
250
|
+
}
|
|
251
|
+
// An explicitly supplied but empty launcher is a typo, not "use the
|
|
252
|
+
// default": silently falling back hides the mistake behind a run whose
|
|
253
|
+
// only symptom is an empty stderr and failed trials.
|
|
254
|
+
if (options.dsh !== undefined && dshCommand === undefined) {
|
|
255
|
+
program.error('error: --dsh must contain a command')
|
|
256
|
+
}
|
|
107
257
|
publish({
|
|
108
258
|
kind: 'run',
|
|
109
259
|
benchmarkPath,
|
|
110
260
|
outPath: options.out,
|
|
111
261
|
...(options.trials !== undefined ? { trials: options.trials } : {}),
|
|
112
262
|
...(options.concurrency !== undefined ? { concurrency: options.concurrency } : {}),
|
|
263
|
+
...(options.seed !== undefined ? { seed: options.seed } : {}),
|
|
113
264
|
...(dshCommand !== undefined ? { dshCommand } : {}),
|
|
114
265
|
...(options.profile !== undefined ? { profile: options.profile } : {}),
|
|
266
|
+
quiet: options.quiet === true,
|
|
267
|
+
allowExternalPaths: options.allowExternalPaths === true,
|
|
115
268
|
})
|
|
116
269
|
})
|
|
117
|
-
const report = program.command('report').description('render a persisted run JSON as markdown')
|
|
270
|
+
const report = program.command('report').description('render a persisted run JSON as markdown or JSON')
|
|
118
271
|
report
|
|
119
272
|
.argument('<run.json>', 'path to a run report')
|
|
120
|
-
.
|
|
121
|
-
|
|
273
|
+
.option('--brief', 'print a compact terminal summary instead of the full report')
|
|
274
|
+
.option('--json', 'emit machine-readable JSON instead of markdown')
|
|
275
|
+
.option('--out <path>', 'write the report to a file instead of stdout')
|
|
276
|
+
.action((runPath: string, options: ReportCommandOptions) => {
|
|
277
|
+
publish({
|
|
278
|
+
kind: 'report',
|
|
279
|
+
runPath,
|
|
280
|
+
...(options.brief ? { brief: true } : {}),
|
|
281
|
+
json: options.json === true,
|
|
282
|
+
...(options.out === undefined ? {} : { outPath: options.out }),
|
|
283
|
+
})
|
|
122
284
|
})
|
|
123
|
-
const compare = program.command('compare').description('compare two persisted run reports as
|
|
285
|
+
const compare = program.command('compare').description('compare two persisted run reports as markdown or JSON')
|
|
124
286
|
compare
|
|
125
287
|
.argument('<run-a.json>', 'baseline run report')
|
|
126
288
|
.argument('<run-b.json>', 'candidate run report')
|
|
127
|
-
.
|
|
128
|
-
|
|
289
|
+
.option('--json', 'emit a machine-readable JSON comparison')
|
|
290
|
+
.option('--out <path>', 'write the comparison to a file instead of stdout')
|
|
291
|
+
.action((runPathA: string, runPathB: string, options: { json?: boolean; out?: string }) => {
|
|
292
|
+
publish({ kind: 'compare', runPathA, runPathB, json: options.json === true, ...optionalOut(options) })
|
|
293
|
+
})
|
|
294
|
+
const exporter = program.command('export').description('export a run report as trial-level CSV')
|
|
295
|
+
exporter
|
|
296
|
+
.argument('<run.json>', 'path to a run report')
|
|
297
|
+
.option('--out <path>', 'write CSV to a file instead of stdout')
|
|
298
|
+
.action((runPath: string, options: { out?: string }) => {
|
|
299
|
+
publish({ kind: 'export', runPath, ...(options.out === undefined ? {} : { outPath: options.out }) })
|
|
300
|
+
})
|
|
301
|
+
const validate = program.command('validate').description('validate a benchmark file and print a preflight summary')
|
|
302
|
+
validate
|
|
303
|
+
.argument('<benchmark.yaml>', 'path to a benchmark document')
|
|
304
|
+
.option('--json', 'emit a machine-readable preflight summary')
|
|
305
|
+
.option('--out <path>', 'write the preflight summary to a file instead of stdout')
|
|
306
|
+
.option('--allow-external-paths', 'allow benchmark-referenced files outside the benchmark directory (trusted benchmarks only)')
|
|
307
|
+
.action((benchmarkPath: string, options: { json?: boolean; out?: string; allowExternalPaths?: boolean }) => {
|
|
308
|
+
publish({
|
|
309
|
+
kind: 'validate', benchmarkPath, json: options.json === true,
|
|
310
|
+
allowExternalPaths: options.allowExternalPaths === true,
|
|
311
|
+
...optionalOut(options),
|
|
312
|
+
})
|
|
313
|
+
})
|
|
314
|
+
const provenance = program.command('provenance').description('verify a run report against its benchmark inputs')
|
|
315
|
+
provenance
|
|
316
|
+
.argument('<run.json>', 'path to a persisted run report')
|
|
317
|
+
.argument('<benchmark.yaml>', 'path to the benchmark document')
|
|
318
|
+
.option('--json', 'emit a machine-readable verification result')
|
|
319
|
+
.option('--out <path>', 'write the verification result to a file instead of stdout')
|
|
320
|
+
.option('--allow-external-paths', 'allow referenced files outside the benchmark directory (trusted benchmarks only)')
|
|
321
|
+
.action((runPath: string, benchmarkPath: string,
|
|
322
|
+
options: { json?: boolean; out?: string; allowExternalPaths?: boolean }) => {
|
|
323
|
+
publish({
|
|
324
|
+
kind: 'provenance', runPath, benchmarkPath,
|
|
325
|
+
json: options.json === true,
|
|
326
|
+
allowExternalPaths: options.allowExternalPaths === true,
|
|
327
|
+
...optionalOut(options),
|
|
328
|
+
})
|
|
329
|
+
})
|
|
330
|
+
const leaderboard = program.command('leaderboard').description('rank persisted runs by pooled task success or strict pass@1')
|
|
331
|
+
leaderboard
|
|
332
|
+
.argument('<run.json...>', 'paths to run reports')
|
|
333
|
+
.option('--json', 'emit a machine-readable JSON leaderboard')
|
|
334
|
+
.option('--out <path>', 'write the leaderboard to a file instead of stdout')
|
|
335
|
+
.option('--metric <name>', 'primary ranking metric: taskSuccess (default) or strictPassAt1',
|
|
336
|
+
leaderboardMetric(program, '--metric'))
|
|
337
|
+
.action((runPaths: string[], options: { json?: boolean; out?: string; metric?: 'taskSuccess' | 'strictPassAt1' }) => {
|
|
338
|
+
publish({
|
|
339
|
+
kind: 'leaderboard', runPaths, json: options.json === true,
|
|
340
|
+
...(options.metric === undefined ? {} : { metric: options.metric }),
|
|
341
|
+
...optionalOut(options),
|
|
342
|
+
})
|
|
343
|
+
})
|
|
344
|
+
const gate = program.command('gate').description('fail a CI build when a candidate run regresses against a baseline')
|
|
345
|
+
gate
|
|
346
|
+
.argument('<candidate.json>', 'path to the candidate run report')
|
|
347
|
+
.option('--baseline <path>', 'path to the trusted baseline run report')
|
|
348
|
+
.option('--max-drop <ratio>', 'largest tolerated quality regression, 0..1', unitRatio(program, '--max-drop'), 0)
|
|
349
|
+
.option('--max-cost-increase <ratio>', 'largest tolerated cost/trial increase over baseline, 0..1', unitRatio(program, '--max-cost-increase'))
|
|
350
|
+
.option('--max-latency-increase <ratio>', 'largest tolerated latency/trial increase over baseline, 0..1', unitRatio(program, '--max-latency-increase'))
|
|
351
|
+
.option('--allow-incomplete', 'do not fail on extra unscored trials')
|
|
352
|
+
.option('--require-significance', 'only fail quality drops confirmed by a paired sign test')
|
|
353
|
+
.option('--json', 'emit a machine-readable JSON verdict instead of markdown')
|
|
354
|
+
.option('--out <path>', 'write the verdict to a file instead of stdout')
|
|
355
|
+
.action((candidatePath: string, options: {
|
|
356
|
+
baseline?: string
|
|
357
|
+
maxDrop: number
|
|
358
|
+
maxCostIncrease?: number
|
|
359
|
+
maxLatencyIncrease?: number
|
|
360
|
+
allowIncomplete?: boolean
|
|
361
|
+
requireSignificance?: boolean
|
|
362
|
+
json?: boolean
|
|
363
|
+
out?: string
|
|
364
|
+
}) => {
|
|
365
|
+
if (options.baseline === undefined) program.error('error: gate needs --baseline <path>')
|
|
366
|
+
publish({
|
|
367
|
+
kind: 'gate',
|
|
368
|
+
candidatePath,
|
|
369
|
+
baselinePath: options.baseline!,
|
|
370
|
+
maxDrop: options.maxDrop,
|
|
371
|
+
...(options.maxCostIncrease === undefined ? {} : { maxCostIncrease: options.maxCostIncrease }),
|
|
372
|
+
...(options.maxLatencyIncrease === undefined ? {} : { maxLatencyIncrease: options.maxLatencyIncrease }),
|
|
373
|
+
allowIncomplete: options.allowIncomplete === true,
|
|
374
|
+
requireSignificance: options.requireSignificance === true,
|
|
375
|
+
json: options.json === true,
|
|
376
|
+
...optionalOut(options),
|
|
377
|
+
})
|
|
378
|
+
})
|
|
379
|
+
const dashboard = program.command('dashboard').description('render persisted runs as a standalone HTML dashboard or leaderboard')
|
|
380
|
+
dashboard
|
|
381
|
+
.argument('<run.json...>', 'one run, two to compare, or three+ for a leaderboard')
|
|
382
|
+
.option('--out <path>', 'output HTML path', 'eval-dashboard.html')
|
|
383
|
+
.option('--metric <name>', 'leaderboard metric (3+ runs): taskSuccess or strictPassAt1', leaderboardMetric(program, '--metric'))
|
|
384
|
+
.action((runPaths: string[], options: { out: string; metric?: 'taskSuccess' | 'strictPassAt1' }) => {
|
|
385
|
+
publish({
|
|
386
|
+
kind: 'dashboard', runPaths, outPath: options.out,
|
|
387
|
+
...(options.metric === undefined ? {} : { metric: options.metric }),
|
|
388
|
+
})
|
|
389
|
+
})
|
|
390
|
+
const rejudge = program.command('rejudge').description('re-judge a stored run from its traces without re-running the agent')
|
|
391
|
+
rejudge
|
|
392
|
+
.argument('<run.json>', 'path to a run report with judge config and case inputs')
|
|
393
|
+
.option('--out <path>', 'output run JSON path; must differ from the input', 'rejudged-run.json')
|
|
394
|
+
.option('--judge-model <id>', 'judge model id; also enables overriding the stored judge config')
|
|
395
|
+
.option('--judge-provider <name>', 'judge provider route, default deepseek')
|
|
396
|
+
.option('--judge-rubric <text>', 'rubric appended to the judge prompt')
|
|
397
|
+
.option('--judge-max-score <n>', 'maximum judge score', positiveInteger(program, '--judge-max-score'))
|
|
398
|
+
.action((runPath: string, options: RejudgeCommandOptions) => {
|
|
399
|
+
const samePath = resolve(runPath).toLowerCase() === resolve(options.out).toLowerCase()
|
|
400
|
+
if (samePath) {
|
|
401
|
+
program.error('error: --out must differ from the input run report')
|
|
402
|
+
}
|
|
403
|
+
publish({
|
|
404
|
+
kind: 'rejudge',
|
|
405
|
+
runPath,
|
|
406
|
+
outPath: options.out,
|
|
407
|
+
...(options.judgeModel === undefined ? {} : {
|
|
408
|
+
judge: {
|
|
409
|
+
provider: options.judgeProvider ?? 'deepseek',
|
|
410
|
+
model: options.judgeModel,
|
|
411
|
+
maxScore: options.judgeMaxScore ?? 10,
|
|
412
|
+
...(options.judgeRubric === undefined ? {} : { rubric: options.judgeRubric }),
|
|
413
|
+
},
|
|
414
|
+
}),
|
|
415
|
+
})
|
|
129
416
|
})
|
|
130
417
|
const importer = program.command('import').description('import an external harness session log as a run report')
|
|
131
418
|
importer
|