@namzu/sdk 62.12.0 → 62.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/connector/index.d.ts +1 -1
- package/dist/connector/index.d.ts.map +1 -1
- package/dist/connector/index.js +1 -1
- package/dist/connector/index.js.map +1 -1
- package/dist/connector/mcp/client.d.ts +96 -0
- package/dist/connector/mcp/client.d.ts.map +1 -1
- package/dist/connector/mcp/client.js +488 -13
- package/dist/connector/mcp/client.js.map +1 -1
- package/dist/connector/mcp/index.d.ts +1 -0
- package/dist/connector/mcp/index.d.ts.map +1 -1
- package/dist/connector/mcp/index.js +1 -0
- package/dist/connector/mcp/index.js.map +1 -1
- package/dist/connector/mcp/tasks.d.ts +40 -0
- package/dist/connector/mcp/tasks.d.ts.map +1 -0
- package/dist/connector/mcp/tasks.js +55 -0
- package/dist/connector/mcp/tasks.js.map +1 -0
- package/dist/constants/mcp/index.d.ts +1 -1
- package/dist/constants/mcp/index.d.ts.map +1 -1
- package/dist/constants/mcp/index.js +5 -0
- package/dist/constants/mcp/index.js.map +1 -1
- package/dist/eval/bootstrap.d.ts +122 -0
- package/dist/eval/bootstrap.d.ts.map +1 -0
- package/dist/eval/bootstrap.js +227 -0
- package/dist/eval/bootstrap.js.map +1 -0
- package/dist/eval/compare.d.ts +109 -0
- package/dist/eval/compare.d.ts.map +1 -0
- package/dist/eval/compare.js +324 -0
- package/dist/eval/compare.js.map +1 -0
- package/dist/eval/disclosure.d.ts +70 -0
- package/dist/eval/disclosure.d.ts.map +1 -0
- package/dist/eval/disclosure.js +64 -0
- package/dist/eval/disclosure.js.map +1 -0
- package/dist/eval/experiment.d.ts +23 -0
- package/dist/eval/experiment.d.ts.map +1 -1
- package/dist/eval/experiment.js +87 -15
- package/dist/eval/experiment.js.map +1 -1
- package/dist/eval/from-turn.d.ts.map +1 -1
- package/dist/eval/from-turn.js +5 -0
- package/dist/eval/from-turn.js.map +1 -1
- package/dist/eval/index.d.ts +13 -2
- package/dist/eval/index.d.ts.map +1 -1
- package/dist/eval/index.js +6 -1
- package/dist/eval/index.js.map +1 -1
- package/dist/eval/report-stats.d.ts +77 -0
- package/dist/eval/report-stats.d.ts.map +1 -0
- package/dist/eval/report-stats.js +184 -0
- package/dist/eval/report-stats.js.map +1 -0
- package/dist/eval/run-options.d.ts +30 -0
- package/dist/eval/run-options.d.ts.map +1 -0
- package/dist/eval/run-options.js +20 -0
- package/dist/eval/run-options.js.map +1 -0
- package/dist/eval/run-summary.d.ts +36 -0
- package/dist/eval/run-summary.d.ts.map +1 -0
- package/dist/eval/run-summary.js +57 -0
- package/dist/eval/run-summary.js.map +1 -0
- package/dist/eval/scorers.d.ts +32 -0
- package/dist/eval/scorers.d.ts.map +1 -1
- package/dist/eval/scorers.js +77 -0
- package/dist/eval/scorers.js.map +1 -1
- package/dist/eval/types.d.ts +74 -0
- package/dist/eval/types.d.ts.map +1 -1
- package/dist/manager/session/turn-recorder.d.ts +3 -0
- package/dist/manager/session/turn-recorder.d.ts.map +1 -1
- package/dist/manager/session/turn-recorder.js +18 -2
- package/dist/manager/session/turn-recorder.js.map +1 -1
- package/dist/public-runtime.d.ts +5 -2
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +7 -2
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-types.d.ts +2 -0
- package/dist/public-types.d.ts.map +1 -1
- package/dist/registry/command/kernel-commands.d.ts +3 -0
- package/dist/registry/command/kernel-commands.d.ts.map +1 -1
- package/dist/registry/command/kernel-commands.js +76 -5
- package/dist/registry/command/kernel-commands.js.map +1 -1
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +15 -0
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +18 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +80 -1
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +18 -1
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/turn/answer-claims.d.ts +52 -0
- package/dist/runtime/query/turn/answer-claims.d.ts.map +1 -0
- package/dist/runtime/query/turn/answer-claims.js +348 -0
- package/dist/runtime/query/turn/answer-claims.js.map +1 -0
- package/dist/runtime/query/turn/outcome-ledger.d.ts +7 -0
- package/dist/runtime/query/turn/outcome-ledger.d.ts.map +1 -1
- package/dist/runtime/query/turn/outcome-ledger.js +13 -0
- package/dist/runtime/query/turn/outcome-ledger.js.map +1 -1
- package/dist/store/goal/index.d.ts +3 -1
- package/dist/store/goal/index.d.ts.map +1 -1
- package/dist/store/goal/index.js +6 -0
- package/dist/store/goal/index.js.map +1 -1
- package/dist/telemetry/runtime-accessors.d.ts +14 -0
- package/dist/telemetry/runtime-accessors.d.ts.map +1 -1
- package/dist/telemetry/runtime-accessors.js +32 -0
- package/dist/telemetry/runtime-accessors.js.map +1 -1
- package/dist/tools/goal/confirmation.d.ts +154 -0
- package/dist/tools/goal/confirmation.d.ts.map +1 -0
- package/dist/tools/goal/confirmation.js +290 -0
- package/dist/tools/goal/confirmation.js.map +1 -0
- package/dist/tools/goal/index.d.ts +4 -1
- package/dist/tools/goal/index.d.ts.map +1 -1
- package/dist/tools/goal/index.js +27 -2
- package/dist/tools/goal/index.js.map +1 -1
- package/dist/tools/hand-back/index.d.ts +48 -0
- package/dist/tools/hand-back/index.d.ts.map +1 -0
- package/dist/tools/hand-back/index.js +129 -0
- package/dist/tools/hand-back/index.js.map +1 -0
- package/dist/tools/schedules/schedule-tool.d.ts.map +1 -1
- package/dist/tools/schedules/schedule-tool.js +15 -1
- package/dist/tools/schedules/schedule-tool.js.map +1 -1
- package/dist/tools/schedules/types.d.ts +10 -0
- package/dist/tools/schedules/types.d.ts.map +1 -1
- package/dist/types/connector/mcp.d.ts +18 -0
- package/dist/types/connector/mcp.d.ts.map +1 -1
- package/dist/types/goal/index.d.ts +12 -0
- package/dist/types/goal/index.d.ts.map +1 -1
- package/dist/types/session/config.d.ts +8 -0
- package/dist/types/session/config.d.ts.map +1 -1
- package/dist/types/session/hand-back.d.ts +29 -0
- package/dist/types/session/hand-back.d.ts.map +1 -0
- package/dist/types/session/hand-back.js +11 -0
- package/dist/types/session/hand-back.js.map +1 -0
- package/dist/types/session/outcome.d.ts +37 -0
- package/dist/types/session/outcome.d.ts.map +1 -1
- package/dist/types/session/outcome.js.map +1 -1
- package/dist/types/session/turn.d.ts +19 -1
- package/dist/types/session/turn.d.ts.map +1 -1
- package/dist/types/session/turn.js.map +1 -1
- package/package.json +1 -1
- package/src/connector/index.ts +1 -0
- package/src/connector/mcp/client.ts +531 -14
- package/src/connector/mcp/index.ts +1 -0
- package/src/connector/mcp/tasks.ts +81 -0
- package/src/constants/mcp/index.ts +6 -1
- package/src/eval/bootstrap.ts +314 -0
- package/src/eval/compare.ts +473 -0
- package/src/eval/disclosure.ts +136 -0
- package/src/eval/experiment.ts +127 -15
- package/src/eval/from-turn.ts +5 -0
- package/src/eval/index.ts +51 -0
- package/src/eval/report-stats.ts +257 -0
- package/src/eval/run-options.ts +49 -0
- package/src/eval/run-summary.ts +104 -0
- package/src/eval/scorers.ts +83 -0
- package/src/eval/types.ts +76 -0
- package/src/manager/session/turn-recorder.ts +23 -2
- package/src/public-runtime.ts +53 -0
- package/src/public-types.ts +9 -0
- package/src/registry/command/kernel-commands.ts +94 -6
- package/src/runtime/query/index.ts +18 -0
- package/src/runtime/query/iteration/index.ts +85 -1
- package/src/runtime/query/iteration/phases/tool-review.ts +24 -1
- package/src/runtime/query/turn/answer-claims.ts +413 -0
- package/src/runtime/query/turn/outcome-ledger.ts +12 -0
- package/src/store/goal/index.ts +11 -0
- package/src/telemetry/runtime-accessors.ts +29 -0
- package/src/tools/goal/confirmation.ts +375 -0
- package/src/tools/goal/index.ts +37 -1
- package/src/tools/hand-back/index.ts +150 -0
- package/src/tools/schedules/schedule-tool.ts +19 -1
- package/src/tools/schedules/types.ts +10 -0
- package/src/types/connector/mcp.ts +18 -0
- package/src/types/goal/index.ts +13 -0
- package/src/types/session/config.ts +8 -0
- package/src/types/session/hand-back.ts +31 -0
- package/src/types/session/outcome.ts +42 -0
- package/src/types/session/turn.ts +19 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-stats.d.ts","sourceRoot":"","sources":["../../src/eval/report-stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAkB,MAAM,gBAAgB,CAAA;AACnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE1E;;;;;;;GAOG;AAEH,MAAM,WAAW,iBAAiB;IACjC,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,uCAAuC;IACvC,iBAAiB,EAAE,MAAM,CAAA;IACzB,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB;AAED,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,SAAS,EAAE,aAAa,CAAA;CACxB;AAED,qFAAqF;AACrF,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,CAAA;CACpC;AAED,MAAM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,cAAc,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,GAAG,OAAO,CAEnE;AAmCD,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAmC5E;AAKD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACvC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,SAAS,EAAE,aAAa,CAAA;CACxB,GAAG,MAAM,EAAE,CAsBX;AAED,8FAA8F;AAC9F,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,MAAM,EAAE,CAmBnE"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { bootstrapCases } from './bootstrap.js';
|
|
2
|
+
export const SPLIT_ORDER = ['development', 'held-out', 'unassigned'];
|
|
3
|
+
/** Group a flat list of runs by case name, in the order the cases first appear. */
|
|
4
|
+
export function groupRuns(results, keyOf = (name) => name) {
|
|
5
|
+
const groups = new Map();
|
|
6
|
+
for (const run of results) {
|
|
7
|
+
const key = keyOf(run.case);
|
|
8
|
+
let group = groups.get(key);
|
|
9
|
+
if (!group) {
|
|
10
|
+
group = { name: run.case, ...(run.split ? { split: run.split } : {}), runs: [] };
|
|
11
|
+
groups.set(key, group);
|
|
12
|
+
}
|
|
13
|
+
group.runs.push(run);
|
|
14
|
+
}
|
|
15
|
+
return [...groups].map(([key, g]) => ({ key, ...g }));
|
|
16
|
+
}
|
|
17
|
+
/** The first name that appears more than once, or undefined. */
|
|
18
|
+
export function duplicateName(names) {
|
|
19
|
+
const seen = new Set();
|
|
20
|
+
for (const name of names) {
|
|
21
|
+
if (seen.has(name))
|
|
22
|
+
return name;
|
|
23
|
+
seen.add(name);
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
export function duplicateMessage(suite, name) {
|
|
28
|
+
return `suite "${suite}" has the case "${name}" more than once; a case is named by its id, and two cases sharing one would be merged into one in every count and interval. Give each case its own name.`;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The first case in a list of runs that appears twice for the same repeat: a
|
|
32
|
+
* second run of a case is a repeat only when it says it is a later one.
|
|
33
|
+
*/
|
|
34
|
+
export function duplicateRun(runs) {
|
|
35
|
+
const seen = new Set();
|
|
36
|
+
for (const run of runs) {
|
|
37
|
+
const key = `${run.case}\u0000${run.repeat ?? 1}`;
|
|
38
|
+
if (seen.has(key))
|
|
39
|
+
return run.case;
|
|
40
|
+
seen.add(key);
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
/** Status of a run, tolerating a report old enough to carry only `passed`. */
|
|
45
|
+
export function statusOf(run) {
|
|
46
|
+
if (run.status === 'passed' || run.status === 'failed' || run.status === 'inconclusive') {
|
|
47
|
+
return run.status;
|
|
48
|
+
}
|
|
49
|
+
return run.passed === true ? 'passed' : 'failed';
|
|
50
|
+
}
|
|
51
|
+
export function tallyOf(runs) {
|
|
52
|
+
let scoreSum = 0;
|
|
53
|
+
let passes = 0;
|
|
54
|
+
let judged = 0;
|
|
55
|
+
for (const run of runs) {
|
|
56
|
+
const status = statusOf(run);
|
|
57
|
+
if (status === 'inconclusive')
|
|
58
|
+
continue;
|
|
59
|
+
judged++;
|
|
60
|
+
scoreSum += run.mean;
|
|
61
|
+
if (status === 'passed')
|
|
62
|
+
passes++;
|
|
63
|
+
}
|
|
64
|
+
return judged === 0 ? null : { scoreSum, passes, judged };
|
|
65
|
+
}
|
|
66
|
+
/** True when the case has at least one judged run and every run passed. */
|
|
67
|
+
export function passedEveryRun(runs) {
|
|
68
|
+
return runs.length > 0 && runs.every((run) => statusOf(run) === 'passed');
|
|
69
|
+
}
|
|
70
|
+
function summaryOf(runs) {
|
|
71
|
+
let passed = 0;
|
|
72
|
+
let failed = 0;
|
|
73
|
+
let inconclusive = 0;
|
|
74
|
+
for (const run of runs) {
|
|
75
|
+
const status = statusOf(run);
|
|
76
|
+
if (status === 'passed')
|
|
77
|
+
passed++;
|
|
78
|
+
else if (status === 'failed')
|
|
79
|
+
failed++;
|
|
80
|
+
else
|
|
81
|
+
inconclusive++;
|
|
82
|
+
}
|
|
83
|
+
return { passed, failed, inconclusive };
|
|
84
|
+
}
|
|
85
|
+
function numbersOver(cases, seed) {
|
|
86
|
+
const tallies = [];
|
|
87
|
+
let runs = 0;
|
|
88
|
+
for (const c of cases) {
|
|
89
|
+
runs += c.runs.length;
|
|
90
|
+
const tally = tallyOf(c.runs);
|
|
91
|
+
if (tally)
|
|
92
|
+
tallies.push(tally);
|
|
93
|
+
}
|
|
94
|
+
const counts = summaryOf(cases.flatMap((c) => c.runs));
|
|
95
|
+
const judged = counts.passed + counts.failed;
|
|
96
|
+
const scoreSum = tallies.reduce((sum, t) => sum + t.scoreSum, 0);
|
|
97
|
+
return {
|
|
98
|
+
runs,
|
|
99
|
+
...counts,
|
|
100
|
+
passRate: judged === 0 ? null : counts.passed / judged,
|
|
101
|
+
mean: judged === 0 ? null : scoreSum / judged,
|
|
102
|
+
intervals: bootstrapCases(tallies, seed),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export function statsOver(cases, seed) {
|
|
106
|
+
const whole = numbersOver(cases, seed);
|
|
107
|
+
const caseSummaries = cases.map((c) => {
|
|
108
|
+
const counts = summaryOf(c.runs);
|
|
109
|
+
const tally = tallyOf(c.runs);
|
|
110
|
+
return {
|
|
111
|
+
case: c.name,
|
|
112
|
+
...(c.split ? { split: c.split } : {}),
|
|
113
|
+
repeats: c.runs.length,
|
|
114
|
+
...counts,
|
|
115
|
+
mean: tally ? tally.scoreSum / tally.judged : null,
|
|
116
|
+
passedEveryRepeat: passedEveryRun(c.runs),
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
const everyRepeat = caseSummaries.filter((c) => c.passedEveryRepeat).length;
|
|
120
|
+
const splits = {};
|
|
121
|
+
for (const name of SPLIT_ORDER) {
|
|
122
|
+
const members = cases.filter((c) => (c.split ?? 'unassigned') === name);
|
|
123
|
+
if (members.length === 0)
|
|
124
|
+
continue;
|
|
125
|
+
const part = numbersOver(members, seed);
|
|
126
|
+
splits[name] = { cases: members.length, ...part };
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
cases: cases.length,
|
|
130
|
+
...whole,
|
|
131
|
+
caseSummaries,
|
|
132
|
+
reliability: {
|
|
133
|
+
cases: cases.length,
|
|
134
|
+
passedEveryRepeat: everyRepeat,
|
|
135
|
+
fraction: cases.length === 0 ? null : everyRepeat / cases.length,
|
|
136
|
+
},
|
|
137
|
+
splits,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
const percent = (value) => `${(value * 100).toFixed(1)}%`;
|
|
141
|
+
const score = (value) => value.toFixed(3);
|
|
142
|
+
/**
|
|
143
|
+
* The intervals, as lines a person reads next to the numbers. A number whose
|
|
144
|
+
* interval is not computed is printed with the reason, never alone.
|
|
145
|
+
*/
|
|
146
|
+
export function describeIntervals(args) {
|
|
147
|
+
const { intervals } = args;
|
|
148
|
+
const line = (label, estimate, interval, show) => {
|
|
149
|
+
if (estimate === null)
|
|
150
|
+
return `${label}: none, no run was judged`;
|
|
151
|
+
if (!interval.computed)
|
|
152
|
+
return `${label} ${show(estimate)}, no interval: ${interval.reason}`;
|
|
153
|
+
return `${label} ${show(estimate)}, 95% interval ${show(interval.low)} to ${show(interval.high)}`;
|
|
154
|
+
};
|
|
155
|
+
const lines = [
|
|
156
|
+
line('mean score', args.mean, intervals.mean, score),
|
|
157
|
+
line('pass rate', args.passRate, intervals.passRate, percent),
|
|
158
|
+
];
|
|
159
|
+
if (intervals.mean.computed || intervals.passRate.computed) {
|
|
160
|
+
lines.push(`intervals: ${intervals.method.kind} (${intervals.method.cases} cases, ${intervals.method.resamples} resamples), seed ${intervals.method.seed}`);
|
|
161
|
+
}
|
|
162
|
+
return lines;
|
|
163
|
+
}
|
|
164
|
+
/** The line that says which splits a suite has, and says so plainly when none is held out. */
|
|
165
|
+
export function describeSplits(splits) {
|
|
166
|
+
const lines = [];
|
|
167
|
+
// A suite that declares no split has one bucket and nothing to break down.
|
|
168
|
+
const declared = SPLIT_ORDER.some((name) => name !== 'unassigned' && splits[name]);
|
|
169
|
+
for (const name of SPLIT_ORDER) {
|
|
170
|
+
const part = splits[name];
|
|
171
|
+
if (!part || !declared)
|
|
172
|
+
continue;
|
|
173
|
+
const rate = part.passRate === null ? 'no judged run' : `pass rate ${percent(part.passRate)}`;
|
|
174
|
+
const interval = part.intervals.passRate.computed
|
|
175
|
+
? `, 95% interval ${percent(part.intervals.passRate.low)} to ${percent(part.intervals.passRate.high)}`
|
|
176
|
+
: '';
|
|
177
|
+
lines.push(`${name}: ${part.cases} case${part.cases === 1 ? '' : 's'}, ${rate}${interval}`);
|
|
178
|
+
}
|
|
179
|
+
if (!splits['held-out']) {
|
|
180
|
+
lines.push('no held-out cases: every number here is measured on cases the suite was developed against');
|
|
181
|
+
}
|
|
182
|
+
return lines;
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=report-stats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-stats.js","sourceRoot":"","sources":["../../src/eval/report-stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAsDnF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,aAAa,EAAE,UAAU,EAAE,YAAY,CAAU,CAAA;AAE7E,mFAAmF;AACnF,MAAM,UAAU,SAAS,CACxB,OAA8B,EAC9B,QAAkC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI;IAEhD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAmE,CAAA;IACzF,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;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,IAAI,WAAW,EAAE,CAAC;QAChC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;QACzB,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ;YAAE,SAAQ;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAA;QAC7F,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ;YAChD,CAAC,CAAC,kBAAkB,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACtG,CAAC,CAAC,EAAE,CAAA;QACL,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,GAAG,QAAQ,EAAE,CAAC,CAAA;IAC5F,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QACzB,KAAK,CAAC,IAAI,CACT,2FAA2F,CAC3F,CAAA;IACF,CAAC;IACD,OAAO,KAAK,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings an operator gives a whole eval run, handed to every
|
|
3
|
+
* `runExperiment` that executes inside it.
|
|
4
|
+
*
|
|
5
|
+
* A suite file calls `runExperiment` itself and returns the report, so
|
|
6
|
+
* `namzu eval --repeat 5` has no argument to pass the five through. Rather
|
|
7
|
+
* than ask every suite to forward it, the runner opens a scope with
|
|
8
|
+
* {@link withEvalRunOptions} and `runExperiment` reads the scope. A suite
|
|
9
|
+
* that was written before the option existed repeats like any other.
|
|
10
|
+
*
|
|
11
|
+
* An option given here wins over the same option in the suite's own config:
|
|
12
|
+
* the person running the command asked for it.
|
|
13
|
+
*/
|
|
14
|
+
export interface EvalRunOptions {
|
|
15
|
+
/** Times every case runs. */
|
|
16
|
+
readonly repeats?: number;
|
|
17
|
+
/** Seed for the bootstrap. */
|
|
18
|
+
readonly seed?: number;
|
|
19
|
+
/** Version of the program that is running the suites, for the disclosure. */
|
|
20
|
+
readonly harnessVersion?: string;
|
|
21
|
+
/** Source revision the suites came from, when known. */
|
|
22
|
+
readonly commit?: string;
|
|
23
|
+
/** Version of the suite being run, when known. */
|
|
24
|
+
readonly suiteVersion?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Run `work` with `options` in force for every experiment it starts. */
|
|
27
|
+
export declare function withEvalRunOptions<T>(options: EvalRunOptions, work: () => T): T;
|
|
28
|
+
/** The options in force here, or an empty set outside any scope. */
|
|
29
|
+
export declare function currentEvalRunOptions(): EvalRunOptions;
|
|
30
|
+
//# sourceMappingURL=run-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-options.d.ts","sourceRoot":"","sources":["../../src/eval/run-options.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,cAAc;IAC9B,6BAA6B;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,6EAA6E;IAC7E,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;IAChC,wDAAwD;IACxD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,kDAAkD;IAClD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAC9B;AAcD,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAE/E;AAED,oEAAoE;AACpE,wBAAgB,qBAAqB,IAAI,cAAc,CAEtD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
const STORE_KEY = Symbol.for('namzu.eval.runOptions');
|
|
3
|
+
/**
|
|
4
|
+
* One store per process, found through a global symbol, so a suite that
|
|
5
|
+
* resolves its own copy of the SDK still sees the scope the runner opened.
|
|
6
|
+
*/
|
|
7
|
+
function store() {
|
|
8
|
+
const holder = globalThis;
|
|
9
|
+
holder[STORE_KEY] ??= new AsyncLocalStorage();
|
|
10
|
+
return holder[STORE_KEY];
|
|
11
|
+
}
|
|
12
|
+
/** Run `work` with `options` in force for every experiment it starts. */
|
|
13
|
+
export function withEvalRunOptions(options, work) {
|
|
14
|
+
return store().run(options, work);
|
|
15
|
+
}
|
|
16
|
+
/** The options in force here, or an empty set outside any scope. */
|
|
17
|
+
export function currentEvalRunOptions() {
|
|
18
|
+
return store().getStore() ?? {};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=run-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-options.js","sourceRoot":"","sources":["../../src/eval/run-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AA4BpD,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;AAErD;;;GAGG;AACH,SAAS,KAAK;IACb,MAAM,MAAM,GAAG,UAAiE,CAAA;IAChF,MAAM,CAAC,SAAS,CAAC,KAAK,IAAI,iBAAiB,EAAkB,CAAA;IAC7D,OAAO,MAAM,CAAC,SAAS,CAAC,CAAA;AACzB,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,kBAAkB,CAAI,OAAuB,EAAE,IAAa;IAC3E,OAAO,KAAK,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AAClC,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,qBAAqB;IACpC,OAAO,KAAK,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAA;AAChC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { RunMode } from './disclosure.js';
|
|
2
|
+
import { type RunStats } from './report-stats.js';
|
|
3
|
+
import type { ExperimentReport } from './types.js';
|
|
4
|
+
/** What produced a whole run, across every suite in it. */
|
|
5
|
+
export interface RunDisclosure {
|
|
6
|
+
readonly harnessVersion: string;
|
|
7
|
+
readonly sdkVersion: string;
|
|
8
|
+
readonly generatedAt: string;
|
|
9
|
+
readonly commit: string;
|
|
10
|
+
readonly seed: number;
|
|
11
|
+
/** Repeats per case; the largest across suites when they differ. */
|
|
12
|
+
readonly repeats: number;
|
|
13
|
+
readonly suites: number;
|
|
14
|
+
readonly cases: number;
|
|
15
|
+
readonly runs: number;
|
|
16
|
+
/** `mixed` when suites that used a model differ in kind; a suite with no model at all does not count. */
|
|
17
|
+
readonly mode: RunMode | 'mixed';
|
|
18
|
+
}
|
|
19
|
+
/** The numbers for every case of every suite taken together. */
|
|
20
|
+
export interface RunSummary extends Omit<RunStats, 'caseSummaries' | 'reliability'> {
|
|
21
|
+
readonly disclosure: RunDisclosure;
|
|
22
|
+
/** Present only when cases were repeated. */
|
|
23
|
+
readonly reliability?: RunStats['reliability'];
|
|
24
|
+
}
|
|
25
|
+
export declare function summarizeRun(entries: ReadonlyArray<{
|
|
26
|
+
suite: string;
|
|
27
|
+
report: ExperimentReport;
|
|
28
|
+
}>, context: {
|
|
29
|
+
seed: number;
|
|
30
|
+
harnessVersion: string;
|
|
31
|
+
commit: string;
|
|
32
|
+
generatedAt: string;
|
|
33
|
+
sdkVersion: string;
|
|
34
|
+
}): RunSummary;
|
|
35
|
+
export declare function formatRunSummary(summary: RunSummary): string;
|
|
36
|
+
//# sourceMappingURL=run-summary.d.ts.map
|
|
@@ -0,0 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EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;CAClB,GACC,UAAU,CAmCZ;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAuB5D"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { UNKNOWN } from './disclosure.js';
|
|
2
|
+
import { describeIntervals, describeSplits, groupRuns, statsOver, } from './report-stats.js';
|
|
3
|
+
export function summarizeRun(entries, context) {
|
|
4
|
+
// A case is named by its suite and its id: two suites may reuse a name.
|
|
5
|
+
const cases = entries.flatMap(({ suite, report }) => groupRuns(report.cases ?? [], (name) => `${suite}\u0000${name}`));
|
|
6
|
+
const { caseSummaries: _perCase, reliability, ...stats } = statsOver(cases, context.seed);
|
|
7
|
+
const repeats = Math.max(1, ...entries.map((e) => e.report.repeats ?? 1));
|
|
8
|
+
// A suite that used no model at all says nothing about whether a model
|
|
9
|
+
// ran, so it does not make a run "mixed" with the suites that did.
|
|
10
|
+
const all = entries.map((e) => e.report.disclosure?.mode ?? UNKNOWN);
|
|
11
|
+
const modes = new Set(all.filter((m) => m !== 'no-model'));
|
|
12
|
+
const mode = modes.size === 0
|
|
13
|
+
? all.length === 0
|
|
14
|
+
? UNKNOWN
|
|
15
|
+
: 'no-model'
|
|
16
|
+
: modes.size === 1
|
|
17
|
+
? [...modes][0]
|
|
18
|
+
: 'mixed';
|
|
19
|
+
return {
|
|
20
|
+
...stats,
|
|
21
|
+
...(repeats > 1 ? { reliability } : {}),
|
|
22
|
+
disclosure: {
|
|
23
|
+
harnessVersion: context.harnessVersion,
|
|
24
|
+
sdkVersion: context.sdkVersion,
|
|
25
|
+
generatedAt: context.generatedAt,
|
|
26
|
+
commit: context.commit,
|
|
27
|
+
seed: context.seed,
|
|
28
|
+
repeats,
|
|
29
|
+
suites: entries.length,
|
|
30
|
+
cases: stats.cases,
|
|
31
|
+
runs: stats.runs,
|
|
32
|
+
mode,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export function formatRunSummary(summary) {
|
|
37
|
+
const d = summary.disclosure;
|
|
38
|
+
const lines = [
|
|
39
|
+
`Whole run: ${summary.passed}/${summary.runs} runs passed across ${d.suites} suite${d.suites === 1 ? '' : 's'}, ${summary.cases} case${summary.cases === 1 ? '' : 's'}${d.repeats > 1 ? ` x ${d.repeats} repeats` : ''}`,
|
|
40
|
+
];
|
|
41
|
+
for (const line of describeIntervals({
|
|
42
|
+
mean: summary.mean,
|
|
43
|
+
passRate: summary.passRate,
|
|
44
|
+
intervals: summary.intervals,
|
|
45
|
+
})) {
|
|
46
|
+
lines.push(` ${line}`);
|
|
47
|
+
}
|
|
48
|
+
if (summary.reliability) {
|
|
49
|
+
const r = summary.reliability;
|
|
50
|
+
lines.push(` reliability across repeats: ${r.passedEveryRepeat} of ${r.cases} cases passed in every one of ${d.repeats} repeats${r.fraction === null ? '' : ` (${(r.fraction * 100).toFixed(1)}%)`}`);
|
|
51
|
+
}
|
|
52
|
+
for (const line of describeSplits(summary.splits))
|
|
53
|
+
lines.push(` ${line}`);
|
|
54
|
+
lines.push(` produced by: namzu eval ${d.harnessVersion}, sdk ${d.sdkVersion}, commit ${d.commit}, ${d.generatedAt}, ${d.mode}`);
|
|
55
|
+
return lines.join('\n');
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=run-summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-summary.js","sourceRoot":"","sources":["../../src/eval/run-summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC,OAAO,EAEN,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,SAAS,GACT,MAAM,mBAAmB,CAAA;AA0B1B,MAAM,UAAU,YAAY,CAC3B,OAAmE,EACnE,OAMC;IAED,wEAAwE;IACxE,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,C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AAC,CAAC,iBAAiB,OAAO,CAAC,CAAC,KAAK,iCAAiC,CAAC,CAAC,OAAO,WAAW,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAC1L,CAAA;IACF,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAA;IAC1E,KAAK,CAAC,IAAI,CACT,6BAA6B,CAAC,CAAC,cAAc,SAAS,CAAC,CAAC,UAAU,YAAY,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,WAAW,KAAK,CAAC,CAAC,IAAI,EAAE,CACrH,CAAA;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACxB,CAAC"}
|
package/dist/eval/scorers.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { HandBackKind } from '../types/session/hand-back.js';
|
|
2
|
+
import type { TurnOutcomeVerdict } from '../types/session/outcome.js';
|
|
1
3
|
import type { EvalCase, EvalTurn, Score, Scorer } from './types.js';
|
|
2
4
|
/**
|
|
3
5
|
* How closely the turn's tool sequence matched the expected one, as F1 over
|
|
@@ -27,6 +29,36 @@ export declare function completionScorer(acceptable?: readonly string[]): Scorer
|
|
|
27
29
|
export declare function stepBudgetScorer(maxSteps: number): Scorer;
|
|
28
30
|
/** The final text contains every required substring. */
|
|
29
31
|
export declare function containsScorer(...required: string[]): Scorer;
|
|
32
|
+
/**
|
|
33
|
+
* The turn's outcome record has one of the given verdicts.
|
|
34
|
+
*
|
|
35
|
+
* Reads the record the kernel settled from what actually ran, not the answer's
|
|
36
|
+
* words. A turn with no record scores unavailable: there is nothing to read,
|
|
37
|
+
* which is not the same as a wrong verdict.
|
|
38
|
+
*/
|
|
39
|
+
export declare function outcomeScorer(verdicts: readonly TurnOutcomeVerdict[]): Scorer;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the answer's plain check claims agree with the turn's outcome
|
|
42
|
+
* record: 1 when `compareAnswerToOutcome` found no mismatch, 0 when it found
|
|
43
|
+
* one, with the claim and what the record holds in the detail.
|
|
44
|
+
*
|
|
45
|
+
* Pass `{ expectMismatch: true }` for a case that is built to contradict
|
|
46
|
+
* itself, so the suite proves the comparison fires as well as that it stays
|
|
47
|
+
* silent.
|
|
48
|
+
*/
|
|
49
|
+
export declare function claimMismatchScorer(opts?: {
|
|
50
|
+
expectMismatch?: boolean;
|
|
51
|
+
}): Scorer;
|
|
52
|
+
/**
|
|
53
|
+
* Score whether the turn was handed back to a person.
|
|
54
|
+
*
|
|
55
|
+
* Pass `{ expectKind }` for a case built so the model hands the task back, and
|
|
56
|
+
* the scorer checks it did, and for that kind; with nothing it checks the turn
|
|
57
|
+
* was not handed back. A gate: a scripted suite pins the kernel's side of it.
|
|
58
|
+
*/
|
|
59
|
+
export declare function handedBackScorer(opts?: {
|
|
60
|
+
expectKind?: HandBackKind;
|
|
61
|
+
}): Scorer;
|
|
30
62
|
/**
|
|
31
63
|
* Judge the turn with a caller-supplied predicate.
|
|
32
64
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scorers.d.ts","sourceRoot":"","sources":["../../src/eval/scorers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAyBnE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAwCzC;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAC/B,UAAU,GAAE,SAAS,MAAM,EAAmC,GAC5D,MAAM,CAqBR;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE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C,EAAE,YAAY,CAAA;CAAO,GAAG,MAAM,CAejF;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC3B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,KAAK,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAChE,MAAM,CAER"}
|
package/dist/eval/scorers.js
CHANGED
|
@@ -136,6 +136,83 @@ export function containsScorer(...required) {
|
|
|
136
136
|
},
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* The turn's outcome record has one of the given verdicts.
|
|
141
|
+
*
|
|
142
|
+
* Reads the record the kernel settled from what actually ran, not the answer's
|
|
143
|
+
* words. A turn with no record scores unavailable: there is nothing to read,
|
|
144
|
+
* which is not the same as a wrong verdict.
|
|
145
|
+
*/
|
|
146
|
+
export function outcomeScorer(verdicts) {
|
|
147
|
+
return {
|
|
148
|
+
name: 'outcome',
|
|
149
|
+
// The record either says one of the verdicts or it does not.
|
|
150
|
+
severity: 'gate',
|
|
151
|
+
score(turn) {
|
|
152
|
+
const outcome = turn.outcome;
|
|
153
|
+
if (!outcome) {
|
|
154
|
+
return { score: 0, unavailable: true, reason: 'the turn has no outcome record' };
|
|
155
|
+
}
|
|
156
|
+
const ok = verdicts.includes(outcome.verdict);
|
|
157
|
+
return {
|
|
158
|
+
score: ok ? 1 : 0,
|
|
159
|
+
reason: ok
|
|
160
|
+
? `verdict ${outcome.verdict}`
|
|
161
|
+
: `verdict ${outcome.verdict}, expected one of ${verdicts.join(', ')}`,
|
|
162
|
+
details: { verdict: outcome.verdict, expected: verdicts },
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Whether the answer's plain check claims agree with the turn's outcome
|
|
169
|
+
* record: 1 when `compareAnswerToOutcome` found no mismatch, 0 when it found
|
|
170
|
+
* one, with the claim and what the record holds in the detail.
|
|
171
|
+
*
|
|
172
|
+
* Pass `{ expectMismatch: true }` for a case that is built to contradict
|
|
173
|
+
* itself, so the suite proves the comparison fires as well as that it stays
|
|
174
|
+
* silent.
|
|
175
|
+
*/
|
|
176
|
+
export function claimMismatchScorer(opts = {}) {
|
|
177
|
+
const expectMismatch = opts.expectMismatch === true;
|
|
178
|
+
return {
|
|
179
|
+
name: 'claim-mismatch',
|
|
180
|
+
severity: 'gate',
|
|
181
|
+
score(turn) {
|
|
182
|
+
const found = turn.claimMismatch;
|
|
183
|
+
const ok = expectMismatch ? found !== undefined : found === undefined;
|
|
184
|
+
return {
|
|
185
|
+
score: ok ? 1 : 0,
|
|
186
|
+
reason: found
|
|
187
|
+
? `${found.said}, but the record: ${found.recordSays}`
|
|
188
|
+
: 'no claim in the answer contradicts the record',
|
|
189
|
+
details: { claimMismatch: found ?? null, expectMismatch },
|
|
190
|
+
};
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Score whether the turn was handed back to a person.
|
|
196
|
+
*
|
|
197
|
+
* Pass `{ expectKind }` for a case built so the model hands the task back, and
|
|
198
|
+
* the scorer checks it did, and for that kind; with nothing it checks the turn
|
|
199
|
+
* was not handed back. A gate: a scripted suite pins the kernel's side of it.
|
|
200
|
+
*/
|
|
201
|
+
export function handedBackScorer(opts = {}) {
|
|
202
|
+
return {
|
|
203
|
+
name: 'handed-back',
|
|
204
|
+
severity: 'gate',
|
|
205
|
+
score(turn) {
|
|
206
|
+
const found = turn.handedBack;
|
|
207
|
+
const ok = opts.expectKind === undefined ? found === undefined : found?.kind === opts.expectKind;
|
|
208
|
+
return {
|
|
209
|
+
score: ok ? 1 : 0,
|
|
210
|
+
reason: found ? `handed back (${found.kind}): ${found.blocker}` : 'not handed back',
|
|
211
|
+
details: { handedBack: found ?? null, expectKind: opts.expectKind ?? null },
|
|
212
|
+
};
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
}
|
|
139
216
|
/**
|
|
140
217
|
* Judge the turn with a caller-supplied predicate.
|
|
141
218
|
*
|
package/dist/eval/scorers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scorers.js","sourceRoot":"","sources":["../../src/eval/scorers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scorers.js","sourceRoot":"","sources":["../../src/eval/scorers.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,SAAS,SAAS,CAAC,CAAoB,EAAE,CAAoB;IAC5D,MAAM,KAAK,GAAe,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,CACnE,IAAI,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC/B,CAAA;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;YACpB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;YACzB,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI;gBAAE,SAAQ;YAC3B,GAAG,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,G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C,CAAC,iBAAiB;gBACnF,OAAO,EAAE,EAAE,UAAU,EAAE,KAAK,IAAI,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE;aAC3E,CAAA;QACF,CAAC;KACD,CAAA;AACF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAC3B,IAAY,EACZ,EAAkE;IAElE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;AAC3B,CAAC"}
|
package/dist/eval/types.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
import type { AnswerClaimMismatch, TurnOutcome } from '../types/session/outcome.js';
|
|
1
2
|
import type { StepResult } from '../types/session/step.js';
|
|
3
|
+
import type { CaseIntervals } from './bootstrap.js';
|
|
4
|
+
import type { ReportDisclosure } from './disclosure.js';
|
|
5
|
+
import type { RepeatReliability, SplitSummary } from './report-stats.js';
|
|
2
6
|
import type { ScoreUncertainty } from './uncertainty.js';
|
|
7
|
+
/**
|
|
8
|
+
* Which part of a suite a case belongs to.
|
|
9
|
+
*
|
|
10
|
+
* `development` cases are the ones the harness was shaped against; a number
|
|
11
|
+
* measured on them says how well it fits them. `held-out` cases were not
|
|
12
|
+
* looked at while it was shaped, and only they say how it does on cases it
|
|
13
|
+
* has not seen.
|
|
14
|
+
*/
|
|
15
|
+
export type EvalSplit = 'development' | 'held-out';
|
|
3
16
|
/**
|
|
4
17
|
* One case in a dataset: an input, and what a good run looks like.
|
|
5
18
|
*
|
|
@@ -18,6 +31,11 @@ export interface EvalCase<TInput = unknown> {
|
|
|
18
31
|
expectedTools?: readonly string[];
|
|
19
32
|
/** Per-case scorer overrides; falls back to the dataset's scorers. */
|
|
20
33
|
scorers?: readonly Scorer[];
|
|
34
|
+
/**
|
|
35
|
+
* `development` or `held-out`. Left out, the case is reported as
|
|
36
|
+
* unassigned. See {@link EvalSplit}.
|
|
37
|
+
*/
|
|
38
|
+
split?: EvalSplit;
|
|
21
39
|
}
|
|
22
40
|
/** What actually happened, handed to every scorer. */
|
|
23
41
|
export interface EvalTurn {
|
|
@@ -34,6 +52,18 @@ export interface EvalTurn {
|
|
|
34
52
|
durationMs: number;
|
|
35
53
|
/** Set when the turn threw rather than settling. */
|
|
36
54
|
error?: string;
|
|
55
|
+
/**
|
|
56
|
+
* What the turn changed and what checked it, from the kernel's own record of
|
|
57
|
+
* its tool calls. Absent for a turn that never ran the loop.
|
|
58
|
+
*/
|
|
59
|
+
outcome?: TurnOutcome;
|
|
60
|
+
/**
|
|
61
|
+
* A plain claim in the answer that the outcome record contradicts, found by
|
|
62
|
+
* `compareAnswerToOutcome`. Absent when there is none.
|
|
63
|
+
*/
|
|
64
|
+
claimMismatch?: AnswerClaimMismatch;
|
|
65
|
+
/** The model handed the task back to a person and the turn ended there. Absent otherwise. */
|
|
66
|
+
handedBack?: import('../types/session/hand-back.js').HandBack;
|
|
37
67
|
}
|
|
38
68
|
/**
|
|
39
69
|
* A judgement about one turn.
|
|
@@ -136,6 +166,10 @@ export interface CaseResult {
|
|
|
136
166
|
* mattered. Absent when no gate missed.
|
|
137
167
|
*/
|
|
138
168
|
failedGates?: readonly string[];
|
|
169
|
+
/** Which run of this case this is, from 1. Set on every run of a report that has `repeats`. */
|
|
170
|
+
repeat?: number;
|
|
171
|
+
/** The case's declared split, copied here so a report can be cut by it. */
|
|
172
|
+
split?: EvalSplit;
|
|
139
173
|
}
|
|
140
174
|
export interface ExperimentReport {
|
|
141
175
|
name: string;
|
|
@@ -169,5 +203,45 @@ export interface ExperimentReport {
|
|
|
169
203
|
*/
|
|
170
204
|
byScorer: Record<string, number>;
|
|
171
205
|
durationMs: number;
|
|
206
|
+
/**
|
|
207
|
+
* Times each case ran. When it is above 1, `cases` holds every run of
|
|
208
|
+
* every case, in case order, each marked with its `repeat`, and `passed`,
|
|
209
|
+
* `failed` and `inconclusive` count runs. Absent in a report written before
|
|
210
|
+
* repeats existed, which is read as 1.
|
|
211
|
+
*/
|
|
212
|
+
repeats?: number;
|
|
213
|
+
/** Seed of the bootstrap behind {@link intervals}. */
|
|
214
|
+
seed?: number;
|
|
215
|
+
/**
|
|
216
|
+
* Passed runs over judged runs. An inconclusive run is in neither number,
|
|
217
|
+
* so it cannot pull the rate either way.
|
|
218
|
+
*/
|
|
219
|
+
passRate?: number;
|
|
220
|
+
/**
|
|
221
|
+
* 95% intervals for {@link mean} and {@link passRate}, by a bootstrap over
|
|
222
|
+
* cases. Absent from a report that predates it.
|
|
223
|
+
*/
|
|
224
|
+
intervals?: CaseIntervals;
|
|
225
|
+
/** Per case: how many of its repeats passed. Present when `repeats` is above 1. */
|
|
226
|
+
caseSummaries?: readonly CaseRepeatSummary[];
|
|
227
|
+
/** Reliability across repeats. Present when `repeats` is above 1. */
|
|
228
|
+
reliability?: RepeatReliability;
|
|
229
|
+
/** Numbers per split. Keys appear only for splits that have cases. */
|
|
230
|
+
splits?: Partial<Record<EvalSplit | 'unassigned', SplitSummary>>;
|
|
231
|
+
/** What produced this report. */
|
|
232
|
+
disclosure?: ReportDisclosure;
|
|
233
|
+
}
|
|
234
|
+
/** How the repeats of one case went. */
|
|
235
|
+
export interface CaseRepeatSummary {
|
|
236
|
+
case: string;
|
|
237
|
+
split?: EvalSplit;
|
|
238
|
+
repeats: number;
|
|
239
|
+
passed: number;
|
|
240
|
+
failed: number;
|
|
241
|
+
inconclusive: number;
|
|
242
|
+
/** Mean score over the judged repeats; null when none was judged. */
|
|
243
|
+
mean: number | null;
|
|
244
|
+
/** Every repeat passed. An inconclusive repeat means this is false. */
|
|
245
|
+
passedEveryRepeat: boolean;
|
|
172
246
|
}
|
|
173
247
|
//# sourceMappingURL=types.d.ts.map
|