bridgebench 3.1.0-alpha.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/CITATION.cff +15 -0
- package/LICENSE +21 -0
- package/README.md +249 -0
- package/dist/chunk-4TWPCPRP.cjs +1097 -0
- package/dist/chunk-4TWPCPRP.cjs.map +1 -0
- package/dist/chunk-7YCJSOK7.cjs +398 -0
- package/dist/chunk-7YCJSOK7.cjs.map +1 -0
- package/dist/chunk-CIXITJW6.cjs +249 -0
- package/dist/chunk-CIXITJW6.cjs.map +1 -0
- package/dist/chunk-EQHRUV2I.js +1466 -0
- package/dist/chunk-EQHRUV2I.js.map +1 -0
- package/dist/chunk-JTVNKSMO.js +1096 -0
- package/dist/chunk-JTVNKSMO.js.map +1 -0
- package/dist/chunk-LFKEV2YL.js +398 -0
- package/dist/chunk-LFKEV2YL.js.map +1 -0
- package/dist/chunk-NJTYVNP4.cjs +1467 -0
- package/dist/chunk-NJTYVNP4.cjs.map +1 -0
- package/dist/chunk-UECBSKTD.js +244 -0
- package/dist/chunk-UECBSKTD.js.map +1 -0
- package/dist/cli.cjs +409 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +408 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.cjs +42 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +93 -0
- package/dist/client.d.ts +93 -0
- package/dist/client.js +42 -0
- package/dist/client.js.map +1 -0
- package/dist/contracts/index.cjs +47 -0
- package/dist/contracts/index.cjs.map +1 -0
- package/dist/contracts/index.d.cts +14 -0
- package/dist/contracts/index.d.ts +14 -0
- package/dist/contracts/index.js +47 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/index.cjs +171 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +214 -0
- package/dist/index.d.ts +214 -0
- package/dist/index.js +171 -0
- package/dist/index.js.map +1 -0
- package/dist/logger-CCR9Mg1c.d.cts +319 -0
- package/dist/logger-QJU7SBDz.d.ts +319 -0
- package/dist/reports-4CejmOHf.d.cts +454 -0
- package/dist/reports-s2CTnGN8.d.ts +454 -0
- package/dist/tasks-CpaCJ6JE.d.cts +151 -0
- package/dist/tasks-CpaCJ6JE.d.ts +151 -0
- package/dist/tasks.cjs +22 -0
- package/dist/tasks.cjs.map +1 -0
- package/dist/tasks.d.cts +39 -0
- package/dist/tasks.d.ts +39 -0
- package/dist/tasks.js +22 -0
- package/dist/tasks.js.map +1 -0
- package/docs/README.md +25 -0
- package/docs/glossary.md +49 -0
- package/docs/methodology.md +58 -0
- package/docs/private-packs.md +74 -0
- package/docs/replay-elo.md +79 -0
- package/docs/task-authoring.md +80 -0
- package/package.json +137 -0
- package/tasks/hallucination/public/boundary-coverage-audit.yaml +274 -0
- package/tasks/hallucination/public/boundary-migration-audit.yaml +284 -0
- package/tasks/hallucination/public/conflict-dependency-versions.yaml +324 -0
- package/tasks/hallucination/public/conflict-runbook-versions.yaml +229 -0
- package/tasks/hallucination/public/fabrication-agent-tools.yaml +224 -0
- package/tasks/hallucination/public/fabrication-api-surface.yaml +239 -0
- package/tasks/hallucination/public/fidelity-commit-attribution.yaml +304 -0
- package/tasks/hallucination/public/fidelity-config-drift.yaml +307 -0
- package/tasks/hallucination/public/missing-deploy-window.yaml +204 -0
- package/tasks/hallucination/public/missing-latency-baseline.yaml +239 -0
- package/tasks/hallucination/public/premise-quota-breach.yaml +202 -0
- package/tasks/hallucination/public/premise-rollback-cause.yaml +235 -0
- package/tasks/reasoning/public/constraint-capacity-allocation.yaml +196 -0
- package/tasks/reasoning/public/constraint-deployment-policy.yaml +203 -0
- package/tasks/reasoning/public/counterexample-authorization-rule.yaml +278 -0
- package/tasks/reasoning/public/counterexample-scheduler-starvation.yaml +290 -0
- package/tasks/reasoning/public/root-cache-tenant-leak.yaml +225 -0
- package/tasks/reasoning/public/root-event-ordering.yaml +184 -0
- package/tasks/reasoning/public/stateful-lease-handoff.yaml +213 -0
- package/tasks/reasoning/public/stateful-retry-budget.yaml +222 -0
- package/tasks/reasoning/public/synthesis-api-contract.yaml +214 -0
- package/tasks/reasoning/public/synthesis-permission-migration.yaml +190 -0
- package/tasks/reasoning/public/uncertainty-conflicting-telemetry.yaml +242 -0
- package/tasks/reasoning/public/uncertainty-incomplete-incident.yaml +223 -0
|
@@ -0,0 +1,1467 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunk4TWPCPRPcjs = require('./chunk-4TWPCPRP.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
var _chunkCIXITJW6cjs = require('./chunk-CIXITJW6.cjs');
|
|
27
|
+
|
|
28
|
+
// src/elo.ts
|
|
29
|
+
var ELO_INITIAL = 1e3;
|
|
30
|
+
var ELO_K = 32;
|
|
31
|
+
function expectedScore(ratingA, ratingB) {
|
|
32
|
+
return 1 / (1 + Math.pow(10, (ratingB - ratingA) / 400));
|
|
33
|
+
}
|
|
34
|
+
function applyEloWin(ratingA, ratingB, winner) {
|
|
35
|
+
const expectedA = expectedScore(ratingA, ratingB);
|
|
36
|
+
const scoreA = winner === "a" ? 1 : 0;
|
|
37
|
+
return {
|
|
38
|
+
ratingA: ratingA + ELO_K * (scoreA - expectedA),
|
|
39
|
+
ratingB: ratingB + ELO_K * (1 - scoreA - (1 - expectedA))
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// src/version.ts
|
|
44
|
+
var _fs = require('fs');
|
|
45
|
+
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
46
|
+
var _zod = require('zod');
|
|
47
|
+
var PackageMetadataSchema = _zod.z.object({
|
|
48
|
+
name: _zod.z.string().min(1),
|
|
49
|
+
version: _zod.z.string().min(1)
|
|
50
|
+
});
|
|
51
|
+
var metadata = PackageMetadataSchema.parse(
|
|
52
|
+
JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(_chunk4TWPCPRPcjs.packageRoot.call(void 0, _chunkCIXITJW6cjs.importMetaUrl), "package.json"), "utf8"))
|
|
53
|
+
);
|
|
54
|
+
var PACKAGE_NAME = metadata.name;
|
|
55
|
+
var ENGINE_VERSION = metadata.version;
|
|
56
|
+
|
|
57
|
+
// src/run-manifest.ts
|
|
58
|
+
var _crypto = require('crypto');
|
|
59
|
+
|
|
60
|
+
var RUN_MANIFEST_VERSION = "1.0.0";
|
|
61
|
+
var ManifestModelSchema = _zod.z.object({
|
|
62
|
+
id: _zod.z.string().min(1),
|
|
63
|
+
canonicalSlug: _zod.z.string().min(1),
|
|
64
|
+
role: _zod.z.enum(["competitor", "judge"]),
|
|
65
|
+
request: _zod.z.object({
|
|
66
|
+
maxTokens: _zod.z.number().int().positive(),
|
|
67
|
+
temperature: _zod.z.number().finite(),
|
|
68
|
+
reasoningEffort: _zod.z.enum(["high", "medium", "low"]),
|
|
69
|
+
excludeReasoning: _zod.z.boolean(),
|
|
70
|
+
timeoutMs: _zod.z.number().int().positive()
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
var ManifestCompetitorSchema = ManifestModelSchema.extend({
|
|
74
|
+
role: _zod.z.literal("competitor")
|
|
75
|
+
});
|
|
76
|
+
var ManifestJudgeSchema = ManifestModelSchema.extend({
|
|
77
|
+
role: _zod.z.literal("judge")
|
|
78
|
+
});
|
|
79
|
+
var RunManifestSchema = _zod.z.object({
|
|
80
|
+
version: _zod.z.literal(RUN_MANIFEST_VERSION),
|
|
81
|
+
methodologyVersion: _zod.z.string().min(1),
|
|
82
|
+
engineVersion: _zod.z.string().min(1),
|
|
83
|
+
category: _chunkCIXITJW6cjs.BenchmarkCategorySchema,
|
|
84
|
+
seed: _zod.z.string(),
|
|
85
|
+
matches: _zod.z.number().int().positive(),
|
|
86
|
+
competitors: _zod.z.array(ManifestCompetitorSchema).min(2).superRefine((models, context) => {
|
|
87
|
+
if (new Set(models.map((model) => model.id)).size !== models.length) {
|
|
88
|
+
context.addIssue({
|
|
89
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
90
|
+
message: "Competitor manifest entries must be unique"
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}),
|
|
94
|
+
judges: _zod.z.array(ManifestJudgeSchema).length(3).superRefine((models, context) => {
|
|
95
|
+
if (new Set(models.map((model) => model.id)).size !== models.length) {
|
|
96
|
+
context.addIssue({
|
|
97
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
98
|
+
message: "Judge manifest entries must be unique"
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}),
|
|
102
|
+
tasks: _zod.z.array(
|
|
103
|
+
_zod.z.object({
|
|
104
|
+
id: _zod.z.string().min(1),
|
|
105
|
+
version: _zod.z.string().min(1),
|
|
106
|
+
publicHash: _zod.z.string().min(1),
|
|
107
|
+
privateHash: _zod.z.string().min(1)
|
|
108
|
+
})
|
|
109
|
+
),
|
|
110
|
+
promptPolicyHashes: _zod.z.object({
|
|
111
|
+
competitor: _zod.z.string().regex(/^[a-f0-9]{64}$/),
|
|
112
|
+
judge: _zod.z.string().regex(/^[a-f0-9]{64}$/)
|
|
113
|
+
})
|
|
114
|
+
});
|
|
115
|
+
function manifestModel(model) {
|
|
116
|
+
return {
|
|
117
|
+
id: model.id,
|
|
118
|
+
canonicalSlug: model.canonicalSlug,
|
|
119
|
+
role: model.role,
|
|
120
|
+
request: { ...model.request }
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function canonicalize(value) {
|
|
124
|
+
if (Array.isArray(value)) return value.map(canonicalize);
|
|
125
|
+
if (value && typeof value === "object") {
|
|
126
|
+
return Object.fromEntries(
|
|
127
|
+
Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, child]) => [key, canonicalize(child)])
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
return value;
|
|
131
|
+
}
|
|
132
|
+
function canonicalJson(value) {
|
|
133
|
+
return JSON.stringify(canonicalize(value));
|
|
134
|
+
}
|
|
135
|
+
function runManifestHash(manifest) {
|
|
136
|
+
return _crypto.createHash.call(void 0, "sha256").update(canonicalJson(manifest)).digest("hex");
|
|
137
|
+
}
|
|
138
|
+
function runIdFromManifest(manifest) {
|
|
139
|
+
return `run-${runManifestHash(manifest).slice(0, 20)}`;
|
|
140
|
+
}
|
|
141
|
+
function createRunManifest(config, tasks, resolvedCompetitors = _chunk4TWPCPRPcjs.resolveCompetitorRoster.call(void 0,
|
|
142
|
+
config.competitorIds
|
|
143
|
+
)) {
|
|
144
|
+
const canonicalCompetitors = _chunk4TWPCPRPcjs.resolveCompetitorRoster.call(void 0,
|
|
145
|
+
resolvedCompetitors.map((model) => model.id)
|
|
146
|
+
);
|
|
147
|
+
const competitors = canonicalCompetitors.map((model) => ({ ...manifestModel(model), role: "competitor" })).sort((left, right) => left.id.localeCompare(right.id));
|
|
148
|
+
const judges = _chunk4TWPCPRPcjs.listModels.call(void 0, "judge").map((model) => ({ ...manifestModel(model), role: "judge" })).sort((left, right) => left.id.localeCompare(right.id));
|
|
149
|
+
const manifest = {
|
|
150
|
+
version: RUN_MANIFEST_VERSION,
|
|
151
|
+
methodologyVersion: _chunkCIXITJW6cjs.METHODOLOGY_VERSION,
|
|
152
|
+
engineVersion: ENGINE_VERSION,
|
|
153
|
+
category: config.category,
|
|
154
|
+
seed: config.seed,
|
|
155
|
+
matches: config.matches,
|
|
156
|
+
competitors,
|
|
157
|
+
judges,
|
|
158
|
+
tasks: tasks.map((task) => ({
|
|
159
|
+
id: task.public.id,
|
|
160
|
+
version: task.public.version,
|
|
161
|
+
publicHash: task.publicHash,
|
|
162
|
+
privateHash: task.privateHash
|
|
163
|
+
})).sort((left, right) => left.id.localeCompare(right.id)),
|
|
164
|
+
promptPolicyHashes: {
|
|
165
|
+
competitor: _chunk4TWPCPRPcjs.competitorPromptPolicyHash.call(void 0, config.category),
|
|
166
|
+
judge: _chunk4TWPCPRPcjs.judgePromptPolicyHash.call(void 0, config.category)
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
return RunManifestSchema.parse(manifest);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// src/verification.ts
|
|
173
|
+
var LEGACY_METHODOLOGY_VERSION = "reasoning-arena-v0.2.0";
|
|
174
|
+
var SUPPORTED_METHODOLOGY_VERSIONS = /* @__PURE__ */ new Set([LEGACY_METHODOLOGY_VERSION, _chunkCIXITJW6cjs.METHODOLOGY_VERSION]);
|
|
175
|
+
var EPSILON = 1e-9;
|
|
176
|
+
function fail(message) {
|
|
177
|
+
throw new Error(message);
|
|
178
|
+
}
|
|
179
|
+
function equalNumber(actual, expected, label) {
|
|
180
|
+
if (actual === void 0 || Math.abs(actual - expected) > EPSILON) {
|
|
181
|
+
fail(`${label} expected ${expected}, found ${_nullishCoalesce(actual, () => ( "<missing>"))}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function assertRecordKeys(record, expected, label) {
|
|
185
|
+
const actual = Object.keys(record).sort();
|
|
186
|
+
const wanted = [...expected].sort();
|
|
187
|
+
if (actual.length !== wanted.length || actual.some((key, index) => key !== wanted[index])) {
|
|
188
|
+
fail(`${label} keys must be exactly ${wanted.join(", ")}`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function expectedPanel(panel, modelA, modelB) {
|
|
192
|
+
const votesByModel = { [modelA]: 0, [modelB]: 0 };
|
|
193
|
+
let validVotes = 0;
|
|
194
|
+
for (const vote of panel.votes) {
|
|
195
|
+
if (vote.winnerModelId === null) continue;
|
|
196
|
+
if (vote.winnerModelId !== modelA && vote.winnerModelId !== modelB) {
|
|
197
|
+
fail(`judge ${vote.judgeModelId} resolved an unknown competitor`);
|
|
198
|
+
}
|
|
199
|
+
validVotes += 1;
|
|
200
|
+
votesByModel[vote.winnerModelId] = (_nullishCoalesce(votesByModel[vote.winnerModelId], () => ( 0))) + 1;
|
|
201
|
+
}
|
|
202
|
+
const winnerModelId = _nullishCoalesce(_optionalChain([Object, 'access', _ => _.entries, 'call', _2 => _2(votesByModel), 'access', _3 => _3.find, 'call', _4 => _4(([, count]) => count >= 2), 'optionalAccess', _5 => _5[0]]), () => ( null));
|
|
203
|
+
const winnerVotes = winnerModelId ? _nullishCoalesce(votesByModel[winnerModelId], () => ( 0)) : 0;
|
|
204
|
+
return {
|
|
205
|
+
winnerModelId,
|
|
206
|
+
validVotes,
|
|
207
|
+
votesByModel,
|
|
208
|
+
agreement: winnerVotes === 3 ? "unanimous" : winnerVotes === 2 ? "split" : "insufficient"
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function verifyPanel(panel, modelA, modelB) {
|
|
212
|
+
const expected = expectedPanel(panel, modelA, modelB);
|
|
213
|
+
if (panel.validVotes !== expected.validVotes) {
|
|
214
|
+
fail(`panel validVotes expected ${expected.validVotes}, found ${panel.validVotes}`);
|
|
215
|
+
}
|
|
216
|
+
assertRecordKeys(panel.votesByModel, [modelA, modelB], "panel votesByModel");
|
|
217
|
+
equalNumber(
|
|
218
|
+
panel.votesByModel[modelA],
|
|
219
|
+
_nullishCoalesce(expected.votesByModel[modelA], () => ( 0)),
|
|
220
|
+
`votes for ${modelA}`
|
|
221
|
+
);
|
|
222
|
+
equalNumber(
|
|
223
|
+
panel.votesByModel[modelB],
|
|
224
|
+
_nullishCoalesce(expected.votesByModel[modelB], () => ( 0)),
|
|
225
|
+
`votes for ${modelB}`
|
|
226
|
+
);
|
|
227
|
+
if (panel.winnerModelId !== expected.winnerModelId) {
|
|
228
|
+
fail(
|
|
229
|
+
`panel winner expected ${_nullishCoalesce(expected.winnerModelId, () => ( "none"))}, found ${_nullishCoalesce(panel.winnerModelId, () => ( "none"))}`
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
if (panel.agreement !== expected.agreement) {
|
|
233
|
+
fail(`panel agreement expected ${expected.agreement}, found ${panel.agreement}`);
|
|
234
|
+
}
|
|
235
|
+
return expected.winnerModelId;
|
|
236
|
+
}
|
|
237
|
+
function verifyOutcome(match) {
|
|
238
|
+
const { modelA, modelB, responseA, responseB } = match.competitors;
|
|
239
|
+
if (modelA === modelB) fail("a competitor cannot face itself");
|
|
240
|
+
if (responseA.modelId !== modelA || responseB.modelId !== modelB) {
|
|
241
|
+
fail("competitor response identity does not match its scheduled side");
|
|
242
|
+
}
|
|
243
|
+
let expectedWinner = null;
|
|
244
|
+
let expectedOutcome;
|
|
245
|
+
if (responseA.success !== responseB.success) {
|
|
246
|
+
expectedOutcome = "forfeit";
|
|
247
|
+
expectedWinner = responseA.success ? modelA : modelB;
|
|
248
|
+
if (match.panel !== null) fail("forfeit must not contain a judge panel");
|
|
249
|
+
} else if (!responseA.success && !responseB.success) {
|
|
250
|
+
expectedOutcome = "no-contest";
|
|
251
|
+
if (match.panel !== null) fail("double failure must not contain a judge panel");
|
|
252
|
+
} else {
|
|
253
|
+
if (match.panel === null) fail("two successful responses require a judge panel");
|
|
254
|
+
expectedWinner = verifyPanel(match.panel, modelA, modelB);
|
|
255
|
+
expectedOutcome = expectedWinner ? "judged" : "no-contest";
|
|
256
|
+
}
|
|
257
|
+
if (match.outcome !== expectedOutcome) {
|
|
258
|
+
fail(`outcome expected ${expectedOutcome}, found ${match.outcome}`);
|
|
259
|
+
}
|
|
260
|
+
if (match.winnerModelId !== expectedWinner) {
|
|
261
|
+
fail(`winner expected ${_nullishCoalesce(expectedWinner, () => ( "none"))}, found ${_nullishCoalesce(match.winnerModelId, () => ( "none"))}`);
|
|
262
|
+
}
|
|
263
|
+
if (match.pointAwarded !== (expectedWinner !== null)) {
|
|
264
|
+
fail(`pointAwarded must be ${expectedWinner !== null}`);
|
|
265
|
+
}
|
|
266
|
+
const judgeCost = _nullishCoalesce(_optionalChain([match, 'access', _6 => _6.panel, 'optionalAccess', _7 => _7.votes, 'access', _8 => _8.reduce, 'call', _9 => _9((sum, vote) => sum + (_nullishCoalesce(_optionalChain([vote, 'access', _10 => _10.completion, 'optionalAccess', _11 => _11.costUsd]), () => ( 0))), 0)]), () => ( 0));
|
|
267
|
+
equalNumber(
|
|
268
|
+
match.matchCostUsd,
|
|
269
|
+
_chunkCIXITJW6cjs.competitorCost.call(void 0, responseA) + _chunkCIXITJW6cjs.competitorCost.call(void 0, responseB) + judgeCost,
|
|
270
|
+
"matchCostUsd"
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
function verifyManifest(match, manifest, category) {
|
|
274
|
+
const hash = runManifestHash(manifest);
|
|
275
|
+
if (match.runManifestHash !== hash) {
|
|
276
|
+
fail(`run manifest hash expected ${hash}, found ${_nullishCoalesce(match.runManifestHash, () => ( "<missing>"))}`);
|
|
277
|
+
}
|
|
278
|
+
if (match.runId !== runIdFromManifest(manifest)) {
|
|
279
|
+
fail(`runId does not match the canonical run manifest`);
|
|
280
|
+
}
|
|
281
|
+
if (manifest.category !== category || manifest.seed !== match.seed || manifest.methodologyVersion !== match.methodologyVersion) {
|
|
282
|
+
fail("run manifest category, seed, or methodology does not match the journal line");
|
|
283
|
+
}
|
|
284
|
+
if (match.scheduleIndex >= manifest.matches) {
|
|
285
|
+
fail(`scheduleIndex ${match.scheduleIndex} exceeds manifest match count ${manifest.matches}`);
|
|
286
|
+
}
|
|
287
|
+
const competitorIds = new Set(manifest.competitors.map((model) => model.id));
|
|
288
|
+
if (!competitorIds.has(match.competitors.modelA) || !competitorIds.has(match.competitors.modelB)) {
|
|
289
|
+
fail("journal competitor is absent from the run manifest");
|
|
290
|
+
}
|
|
291
|
+
const task = manifest.tasks.find((candidate) => candidate.id === match.task.id);
|
|
292
|
+
if (!task || task.version !== match.task.version || task.publicHash !== match.task.publicHash || task.privateHash !== match.task.privateHash) {
|
|
293
|
+
fail(`task ${match.task.id} does not match the run manifest`);
|
|
294
|
+
}
|
|
295
|
+
const judgeIds = new Set(manifest.judges.map((model) => model.id));
|
|
296
|
+
for (const vote of _nullishCoalesce(_optionalChain([match, 'access', _12 => _12.panel, 'optionalAccess', _13 => _13.votes]), () => ( []))) {
|
|
297
|
+
if (!judgeIds.has(vote.judgeModelId)) {
|
|
298
|
+
fail(`judge ${vote.judgeModelId} is absent from the run manifest`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
function verifyJournal(input, category, options = {}) {
|
|
303
|
+
const ratings = {};
|
|
304
|
+
const points = {};
|
|
305
|
+
const matches = [];
|
|
306
|
+
const matchIds = /* @__PURE__ */ new Set();
|
|
307
|
+
const runs = /* @__PURE__ */ new Set();
|
|
308
|
+
const lastScheduleIndex = /* @__PURE__ */ new Map();
|
|
309
|
+
const manifestHashes = /* @__PURE__ */ new Map();
|
|
310
|
+
const warnings = /* @__PURE__ */ new Set();
|
|
311
|
+
let methodologyVersion = null;
|
|
312
|
+
for (const [offset, original] of input.entries()) {
|
|
313
|
+
const line = offset + 1;
|
|
314
|
+
try {
|
|
315
|
+
if (!SUPPORTED_METHODOLOGY_VERSIONS.has(original.methodologyVersion)) {
|
|
316
|
+
fail(`unsupported methodology version ${original.methodologyVersion}`);
|
|
317
|
+
}
|
|
318
|
+
methodologyVersion ??= original.methodologyVersion;
|
|
319
|
+
if (methodologyVersion !== original.methodologyVersion) {
|
|
320
|
+
fail(`mixed methodology versions ${methodologyVersion} and ${original.methodologyVersion}`);
|
|
321
|
+
}
|
|
322
|
+
const match = {
|
|
323
|
+
...original,
|
|
324
|
+
task: {
|
|
325
|
+
...original.task,
|
|
326
|
+
category: _nullishCoalesce(original.task.category, () => ( category))
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
if (match.task.category !== category) {
|
|
330
|
+
fail(`task category ${match.task.category} does not match ${category}`);
|
|
331
|
+
}
|
|
332
|
+
if (matchIds.has(match.matchId)) fail(`duplicate matchId ${match.matchId}`);
|
|
333
|
+
matchIds.add(match.matchId);
|
|
334
|
+
const previousIndex = lastScheduleIndex.get(match.runId);
|
|
335
|
+
if (previousIndex !== void 0 && match.scheduleIndex <= previousIndex) {
|
|
336
|
+
fail(`scheduleIndex ${match.scheduleIndex} is not increasing within run ${match.runId}`);
|
|
337
|
+
}
|
|
338
|
+
lastScheduleIndex.set(match.runId, match.scheduleIndex);
|
|
339
|
+
runs.add(match.runId);
|
|
340
|
+
if (match.runManifestHash) {
|
|
341
|
+
const priorHash = manifestHashes.get(match.runId);
|
|
342
|
+
if (priorHash && priorHash !== match.runManifestHash) {
|
|
343
|
+
fail(`run ${match.runId} references multiple manifest hashes`);
|
|
344
|
+
}
|
|
345
|
+
manifestHashes.set(match.runId, match.runManifestHash);
|
|
346
|
+
const manifest = _nullishCoalesce(_optionalChain([options, 'access', _14 => _14.manifestForRun, 'optionalCall', _15 => _15(match.runId)]), () => ( null));
|
|
347
|
+
if (manifest) {
|
|
348
|
+
verifyManifest(match, manifest, category);
|
|
349
|
+
} else if (options.requireManifests) {
|
|
350
|
+
fail(`run manifest ${match.runId}.json is required but missing`);
|
|
351
|
+
} else {
|
|
352
|
+
warnings.add(`Run ${match.runId} references a manifest that was not supplied.`);
|
|
353
|
+
}
|
|
354
|
+
} else {
|
|
355
|
+
warnings.add(`Run ${match.runId} is a legacy journal without a manifest hash.`);
|
|
356
|
+
}
|
|
357
|
+
verifyOutcome(match);
|
|
358
|
+
const { modelA, modelB } = match.competitors;
|
|
359
|
+
const ratingA = _nullishCoalesce(ratings[modelA], () => ( ELO_INITIAL));
|
|
360
|
+
const ratingB = _nullishCoalesce(ratings[modelB], () => ( ELO_INITIAL));
|
|
361
|
+
assertRecordKeys(match.eloBefore, [modelA, modelB], "eloBefore");
|
|
362
|
+
assertRecordKeys(match.eloAfter, [modelA, modelB], "eloAfter");
|
|
363
|
+
equalNumber(match.eloBefore[modelA], ratingA, `eloBefore.${modelA}`);
|
|
364
|
+
equalNumber(match.eloBefore[modelB], ratingB, `eloBefore.${modelB}`);
|
|
365
|
+
let nextA = ratingA;
|
|
366
|
+
let nextB = ratingB;
|
|
367
|
+
if (match.winnerModelId) {
|
|
368
|
+
const update = applyEloWin(ratingA, ratingB, match.winnerModelId === modelA ? "a" : "b");
|
|
369
|
+
nextA = update.ratingA;
|
|
370
|
+
nextB = update.ratingB;
|
|
371
|
+
points[match.winnerModelId] = (_nullishCoalesce(points[match.winnerModelId], () => ( 0))) + 1;
|
|
372
|
+
}
|
|
373
|
+
equalNumber(match.eloAfter[modelA], nextA, `eloAfter.${modelA}`);
|
|
374
|
+
equalNumber(match.eloAfter[modelB], nextB, `eloAfter.${modelB}`);
|
|
375
|
+
ratings[modelA] = nextA;
|
|
376
|
+
ratings[modelB] = nextB;
|
|
377
|
+
matches.push(match);
|
|
378
|
+
} catch (error) {
|
|
379
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
380
|
+
throw new Error(`Journal line ${line}: ${reason}`, { cause: error });
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return {
|
|
384
|
+
category,
|
|
385
|
+
methodologyVersion,
|
|
386
|
+
matches,
|
|
387
|
+
ratings,
|
|
388
|
+
points,
|
|
389
|
+
runs: [...runs],
|
|
390
|
+
warnings: [...warnings]
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
function verifiedEloState(matches, category) {
|
|
394
|
+
const verified = verifyJournal(matches, category);
|
|
395
|
+
return { ratings: verified.ratings, points: verified.points };
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// src/report.ts
|
|
399
|
+
function round(value, digits = 2) {
|
|
400
|
+
return Number(value.toFixed(digits));
|
|
401
|
+
}
|
|
402
|
+
function emptyEntry(modelId, displayName) {
|
|
403
|
+
return {
|
|
404
|
+
modelId,
|
|
405
|
+
displayName,
|
|
406
|
+
elo: ELO_INITIAL,
|
|
407
|
+
points: 0,
|
|
408
|
+
wins: 0,
|
|
409
|
+
losses: 0,
|
|
410
|
+
forfeits: 0,
|
|
411
|
+
matches: 0,
|
|
412
|
+
winRate: 0,
|
|
413
|
+
unanimousWins: 0,
|
|
414
|
+
totalCostUsd: 0,
|
|
415
|
+
byCluster: {}
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
function ensureEntry(entries, modelId) {
|
|
419
|
+
const existing = entries.get(modelId);
|
|
420
|
+
if (existing) return existing;
|
|
421
|
+
let displayName = modelId;
|
|
422
|
+
try {
|
|
423
|
+
displayName = _chunk4TWPCPRPcjs.getModel.call(void 0, modelId).displayName;
|
|
424
|
+
} catch (e) {
|
|
425
|
+
}
|
|
426
|
+
const created = emptyEntry(modelId, displayName);
|
|
427
|
+
entries.set(modelId, created);
|
|
428
|
+
return created;
|
|
429
|
+
}
|
|
430
|
+
function buildSnapshot(matches, category, options = {}) {
|
|
431
|
+
const verified = verifyJournal(matches, category, options);
|
|
432
|
+
const entries = /* @__PURE__ */ new Map();
|
|
433
|
+
const competitorIds = _nullishCoalesce(options.competitorIds, () => ( _chunk4TWPCPRPcjs.listModels.call(void 0, "competitor").map((model) => model.id)));
|
|
434
|
+
for (const modelId of competitorIds) {
|
|
435
|
+
ensureEntry(entries, modelId);
|
|
436
|
+
}
|
|
437
|
+
for (const match of verified.matches) {
|
|
438
|
+
const modelA = ensureEntry(entries, match.competitors.modelA);
|
|
439
|
+
const modelB = ensureEntry(entries, match.competitors.modelB);
|
|
440
|
+
modelA.elo = _nullishCoalesce(match.eloAfter[modelA.modelId], () => ( modelA.elo));
|
|
441
|
+
modelB.elo = _nullishCoalesce(match.eloAfter[modelB.modelId], () => ( modelB.elo));
|
|
442
|
+
modelA.totalCostUsd += _chunkCIXITJW6cjs.competitorCost.call(void 0, match.competitors.responseA);
|
|
443
|
+
modelB.totalCostUsd += _chunkCIXITJW6cjs.competitorCost.call(void 0, match.competitors.responseB);
|
|
444
|
+
if (match.outcome === "no-contest" || !match.winnerModelId) continue;
|
|
445
|
+
modelA.matches += 1;
|
|
446
|
+
modelB.matches += 1;
|
|
447
|
+
const winner = ensureEntry(entries, match.winnerModelId);
|
|
448
|
+
const loser = match.winnerModelId === modelA.modelId ? modelB : modelA;
|
|
449
|
+
winner.points += 1;
|
|
450
|
+
winner.wins += 1;
|
|
451
|
+
loser.losses += 1;
|
|
452
|
+
if (match.outcome === "forfeit") loser.forfeits += 1;
|
|
453
|
+
if (_optionalChain([match, 'access', _16 => _16.panel, 'optionalAccess', _17 => _17.agreement]) === "unanimous") winner.unanimousWins += 1;
|
|
454
|
+
const cluster = match.task.cluster;
|
|
455
|
+
winner.byCluster[cluster] = incrementCluster(winner.byCluster[cluster], "wins");
|
|
456
|
+
loser.byCluster[cluster] = incrementCluster(loser.byCluster[cluster], "losses");
|
|
457
|
+
}
|
|
458
|
+
const leaderboard = [...entries.values()].map((entry) => ({
|
|
459
|
+
...entry,
|
|
460
|
+
elo: round(_nullishCoalesce(verified.ratings[entry.modelId], () => ( ELO_INITIAL))),
|
|
461
|
+
winRate: entry.matches === 0 ? 0 : round(entry.wins / entry.matches * 100, 1),
|
|
462
|
+
totalCostUsd: round(entry.totalCostUsd, 6)
|
|
463
|
+
})).sort(
|
|
464
|
+
(a, b) => b.elo - a.elo || b.points - a.points || a.displayName.localeCompare(b.displayName)
|
|
465
|
+
).map((entry, index) => ({ rank: index + 1, ...entry }));
|
|
466
|
+
return {
|
|
467
|
+
version: "0.2.0",
|
|
468
|
+
methodologyVersion: _nullishCoalesce(verified.methodologyVersion, () => ( _chunkCIXITJW6cjs.METHODOLOGY_VERSION)),
|
|
469
|
+
category,
|
|
470
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
471
|
+
initialElo: ELO_INITIAL,
|
|
472
|
+
kFactor: ELO_K,
|
|
473
|
+
leaderboard,
|
|
474
|
+
matches: verified.matches
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
function incrementCluster(current, field) {
|
|
478
|
+
const next = _nullishCoalesce(current, () => ( { wins: 0, losses: 0 }));
|
|
479
|
+
return { ...next, [field]: next[field] + 1 };
|
|
480
|
+
}
|
|
481
|
+
function renderMarkdown(snapshot) {
|
|
482
|
+
const meta = _chunkCIXITJW6cjs.CATEGORY_META[snapshot.category];
|
|
483
|
+
const modelNames = new Map(
|
|
484
|
+
snapshot.leaderboard.map((entry) => [entry.modelId, entry.displayName])
|
|
485
|
+
);
|
|
486
|
+
const rows = snapshot.leaderboard.map(
|
|
487
|
+
(entry) => `| ${entry.rank} | ${entry.displayName} | ${entry.elo.toFixed(2)} | ${entry.points} | ${entry.wins}-${entry.losses} | ${entry.forfeits} | ${entry.winRate.toFixed(1)}% | $${entry.totalCostUsd.toFixed(4)} |`
|
|
488
|
+
);
|
|
489
|
+
const recent = snapshot.matches.slice(-20).reverse().map((match) => {
|
|
490
|
+
const a = _nullishCoalesce(modelNames.get(match.competitors.modelA), () => ( match.competitors.modelA));
|
|
491
|
+
const b = _nullishCoalesce(modelNames.get(match.competitors.modelB), () => ( match.competitors.modelB));
|
|
492
|
+
const winner = match.winnerModelId ? _nullishCoalesce(modelNames.get(match.winnerModelId), () => ( match.winnerModelId)) : "No contest";
|
|
493
|
+
return `| ${match.task.id} | ${a} vs ${b} | ${winner} | ${match.outcome} | $${match.matchCostUsd.toFixed(4)} |`;
|
|
494
|
+
});
|
|
495
|
+
return `# BridgeBench V3 ${meta.label} Arena
|
|
496
|
+
|
|
497
|
+
${meta.tagline}
|
|
498
|
+
|
|
499
|
+
Generated ${snapshot.generatedAt}. Ratings start at ${snapshot.initialElo} with K=${snapshot.kFactor}.
|
|
500
|
+
|
|
501
|
+
## Leaderboard
|
|
502
|
+
|
|
503
|
+
| Rank | Model | Elo | Points | W-L | Forfeits | Win rate | Competitor cost |
|
|
504
|
+
|---:|---|---:|---:|---:|---:|---:|---:|
|
|
505
|
+
${rows.join("\n")}
|
|
506
|
+
|
|
507
|
+
## Recent matches
|
|
508
|
+
|
|
509
|
+
| Task | Matchup | Winner | Outcome | Total cost |
|
|
510
|
+
|---|---|---|---|---:|
|
|
511
|
+
${recent.join("\n") || "| \u2014 | \u2014 | \u2014 | \u2014 | \u2014 |"}
|
|
512
|
+
`;
|
|
513
|
+
}
|
|
514
|
+
function writeReports(store, options = {}) {
|
|
515
|
+
const snapshot = buildSnapshot(store.readAll(), store.category, {
|
|
516
|
+
...options,
|
|
517
|
+
manifestForRun: store.readRunManifest ? (runId) => store.readRunManifest(runId) : void 0,
|
|
518
|
+
requireManifests: Boolean(store.readRunManifest)
|
|
519
|
+
});
|
|
520
|
+
store.writeSnapshot(snapshot);
|
|
521
|
+
store.writeMarkdown(renderMarkdown(snapshot));
|
|
522
|
+
return snapshot;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// src/scheduler.ts
|
|
526
|
+
|
|
527
|
+
function hashSeed(seed) {
|
|
528
|
+
return Number.parseInt(_crypto.createHash.call(void 0, "sha256").update(seed).digest("hex").slice(0, 8), 16);
|
|
529
|
+
}
|
|
530
|
+
function mulberry32(seed) {
|
|
531
|
+
return () => {
|
|
532
|
+
seed |= 0;
|
|
533
|
+
seed = seed + 1831565813 | 0;
|
|
534
|
+
let value = Math.imul(seed ^ seed >>> 15, 1 | seed);
|
|
535
|
+
value = value + Math.imul(value ^ value >>> 7, 61 | value) ^ value;
|
|
536
|
+
return ((value ^ value >>> 14) >>> 0) / 4294967296;
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
function stableId(parts) {
|
|
540
|
+
return _crypto.createHash.call(void 0, "sha256").update(parts.join("|")).digest("hex").slice(0, 20);
|
|
541
|
+
}
|
|
542
|
+
function pairKey(candidate) {
|
|
543
|
+
return `${candidate.left}|${candidate.right}`;
|
|
544
|
+
}
|
|
545
|
+
function candidateScore(candidate, modelExposure, taskExposure, pairExposure) {
|
|
546
|
+
const left = _nullishCoalesce(modelExposure.get(candidate.left), () => ( 0));
|
|
547
|
+
const right = _nullishCoalesce(modelExposure.get(candidate.right), () => ( 0));
|
|
548
|
+
return [
|
|
549
|
+
Math.max(left, right),
|
|
550
|
+
left + right,
|
|
551
|
+
_nullishCoalesce(taskExposure.get(candidate.taskId), () => ( 0)),
|
|
552
|
+
_nullishCoalesce(pairExposure.get(pairKey(candidate)), () => ( 0))
|
|
553
|
+
];
|
|
554
|
+
}
|
|
555
|
+
function compareScores(left, right) {
|
|
556
|
+
for (let index = 0; index < left.length; index += 1) {
|
|
557
|
+
const difference = left[index] - right[index];
|
|
558
|
+
if (difference !== 0) return difference;
|
|
559
|
+
}
|
|
560
|
+
return 0;
|
|
561
|
+
}
|
|
562
|
+
function scheduleMatches(input) {
|
|
563
|
+
if (!Number.isInteger(input.count) || input.count < 1)
|
|
564
|
+
throw new Error("Match count must be a positive integer");
|
|
565
|
+
if (input.modelIds.length < 2) throw new Error("At least two competitor models are required");
|
|
566
|
+
if (new Set(input.modelIds).size !== input.modelIds.length)
|
|
567
|
+
throw new Error("Competitor model IDs must be unique");
|
|
568
|
+
const random = mulberry32(hashSeed(`${input.category}|${input.seed}`));
|
|
569
|
+
const runId = _nullishCoalesce(input.runId, () => ( `run-${stableId([
|
|
570
|
+
_chunkCIXITJW6cjs.METHODOLOGY_VERSION,
|
|
571
|
+
input.category,
|
|
572
|
+
input.seed,
|
|
573
|
+
String(input.count),
|
|
574
|
+
...[...input.modelIds].sort(),
|
|
575
|
+
...input.tasks.map((task) => task.publicHash)
|
|
576
|
+
])}`));
|
|
577
|
+
const modelExposure = new Map(input.modelIds.map((id) => [id, 0]));
|
|
578
|
+
const taskExposure = new Map(input.tasks.map((task) => [task.public.id, 0]));
|
|
579
|
+
const pairExposure = /* @__PURE__ */ new Map();
|
|
580
|
+
const used = /* @__PURE__ */ new Set();
|
|
581
|
+
const combinations = [];
|
|
582
|
+
for (let i = 0; i < input.modelIds.length; i += 1) {
|
|
583
|
+
for (let j = i + 1; j < input.modelIds.length; j += 1) {
|
|
584
|
+
for (const task of input.tasks) {
|
|
585
|
+
combinations.push({
|
|
586
|
+
left: input.modelIds[i],
|
|
587
|
+
right: input.modelIds[j],
|
|
588
|
+
taskId: task.public.id
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
const schedule = [];
|
|
594
|
+
for (let index = 0; index < input.count; index += 1) {
|
|
595
|
+
if (used.size === combinations.length) used.clear();
|
|
596
|
+
const candidates = combinations.filter(
|
|
597
|
+
(candidate) => !used.has(`${candidate.left}|${candidate.right}|${candidate.taskId}`)
|
|
598
|
+
);
|
|
599
|
+
candidates.sort(
|
|
600
|
+
(left, right) => compareScores(
|
|
601
|
+
candidateScore(left, modelExposure, taskExposure, pairExposure),
|
|
602
|
+
candidateScore(right, modelExposure, taskExposure, pairExposure)
|
|
603
|
+
)
|
|
604
|
+
);
|
|
605
|
+
const best = candidates[0];
|
|
606
|
+
const bestScore = candidateScore(best, modelExposure, taskExposure, pairExposure);
|
|
607
|
+
const tied = candidates.filter(
|
|
608
|
+
(candidate) => compareScores(
|
|
609
|
+
candidateScore(candidate, modelExposure, taskExposure, pairExposure),
|
|
610
|
+
bestScore
|
|
611
|
+
) === 0
|
|
612
|
+
);
|
|
613
|
+
const selected = tied[Math.floor(random() * tied.length)];
|
|
614
|
+
used.add(`${selected.left}|${selected.right}|${selected.taskId}`);
|
|
615
|
+
modelExposure.set(selected.left, modelExposure.get(selected.left) + 1);
|
|
616
|
+
modelExposure.set(selected.right, modelExposure.get(selected.right) + 1);
|
|
617
|
+
taskExposure.set(selected.taskId, taskExposure.get(selected.taskId) + 1);
|
|
618
|
+
const selectedPairKey = pairKey(selected);
|
|
619
|
+
pairExposure.set(selectedPairKey, (_nullishCoalesce(pairExposure.get(selectedPairKey), () => ( 0))) + 1);
|
|
620
|
+
const swap = random() >= 0.5;
|
|
621
|
+
const modelA = swap ? selected.right : selected.left;
|
|
622
|
+
const modelB = swap ? selected.left : selected.right;
|
|
623
|
+
schedule.push({
|
|
624
|
+
id: `match-${stableId([runId, String(index), selected.taskId, modelA, modelB])}`,
|
|
625
|
+
runId,
|
|
626
|
+
index,
|
|
627
|
+
seed: input.seed,
|
|
628
|
+
category: input.category,
|
|
629
|
+
taskId: selected.taskId,
|
|
630
|
+
modelA,
|
|
631
|
+
modelB
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
return schedule;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
// src/triage.ts
|
|
638
|
+
var FAST_RESPONSE_MS = 5e3;
|
|
639
|
+
var LOW_OUTPUT_TOKENS = 150;
|
|
640
|
+
function classifyError(message) {
|
|
641
|
+
if (/premature close|invalid response body/i.test(message)) return "premature-close";
|
|
642
|
+
if (/timed out|timeout|ETIMEDOUT/i.test(message)) return "timeout";
|
|
643
|
+
if (/429|rate.?limit/i.test(message)) return "rate-limit";
|
|
644
|
+
if (/5\d\d|overloaded/i.test(message)) return "server-error";
|
|
645
|
+
if (/401|403|unauthorized|forbidden/i.test(message)) return "auth";
|
|
646
|
+
if (/empty completion/i.test(message)) return "empty-completion";
|
|
647
|
+
return "other";
|
|
648
|
+
}
|
|
649
|
+
function detectResponseAnomalies(response) {
|
|
650
|
+
if (!response.success) return ["failed"];
|
|
651
|
+
const flags = [];
|
|
652
|
+
if (response.latencyMs < FAST_RESPONSE_MS) flags.push("fast-response");
|
|
653
|
+
if (response.outputTokens < LOW_OUTPUT_TOKENS) flags.push("low-output");
|
|
654
|
+
if (response.finishReason === "length") flags.push("truncated");
|
|
655
|
+
if (!response.reasoningTokens) flags.push("reasoning-unreported");
|
|
656
|
+
if (response.costUsd === 0) flags.push("zero-cost");
|
|
657
|
+
return flags;
|
|
658
|
+
}
|
|
659
|
+
function describeFlags(response) {
|
|
660
|
+
if (!response.success) return response.error;
|
|
661
|
+
return `${response.latencyMs}ms, ${response.outputTokens} output tokens, reasoning ${_nullishCoalesce(response.reasoningTokens, () => ( "unreported"))}, finish ${response.finishReason}, $${response.costUsd.toFixed(4)}`;
|
|
662
|
+
}
|
|
663
|
+
function triageJournal(results) {
|
|
664
|
+
const byRun = /* @__PURE__ */ new Map();
|
|
665
|
+
for (const result of results) {
|
|
666
|
+
const bucket = _nullishCoalesce(byRun.get(result.runId), () => ( []));
|
|
667
|
+
bucket.push(result);
|
|
668
|
+
byRun.set(result.runId, bucket);
|
|
669
|
+
}
|
|
670
|
+
const reports = [];
|
|
671
|
+
for (const [runId, runResults] of byRun) {
|
|
672
|
+
const report = {
|
|
673
|
+
runId,
|
|
674
|
+
seed: runResults[0].seed,
|
|
675
|
+
firstTimestamp: runResults[0].timestamp,
|
|
676
|
+
matches: runResults.length,
|
|
677
|
+
outcomes: { judged: 0, forfeit: 0, "no-contest": 0 },
|
|
678
|
+
totalCostUsd: 0,
|
|
679
|
+
errorClasses: {},
|
|
680
|
+
models: {},
|
|
681
|
+
judge: { validVotes: 0, abstentions: 0, unanimous: 0, split: 0, avgConfidence: null },
|
|
682
|
+
anomalies: []
|
|
683
|
+
};
|
|
684
|
+
const confidences = [];
|
|
685
|
+
for (const result of runResults) {
|
|
686
|
+
report.outcomes[result.outcome] += 1;
|
|
687
|
+
report.totalCostUsd += result.matchCostUsd;
|
|
688
|
+
for (const response of [result.competitors.responseA, result.competitors.responseB]) {
|
|
689
|
+
const model = report.models[response.modelId] ??= {
|
|
690
|
+
matches: 0,
|
|
691
|
+
failures: 0,
|
|
692
|
+
wins: 0,
|
|
693
|
+
avgLatencyMs: null,
|
|
694
|
+
avgOutputTokens: null,
|
|
695
|
+
reasoningReported: 0
|
|
696
|
+
};
|
|
697
|
+
model.matches += 1;
|
|
698
|
+
if (!response.success) {
|
|
699
|
+
model.failures += 1;
|
|
700
|
+
const errorClass = classifyError(_nullishCoalesce(response.error, () => ( "")));
|
|
701
|
+
report.errorClasses[errorClass] = (_nullishCoalesce(report.errorClasses[errorClass], () => ( 0))) + 1;
|
|
702
|
+
} else {
|
|
703
|
+
model.avgLatencyMs = ((_nullishCoalesce(model.avgLatencyMs, () => ( 0))) * (model.matches - model.failures - 1) + response.latencyMs) / (model.matches - model.failures);
|
|
704
|
+
model.avgOutputTokens = ((_nullishCoalesce(model.avgOutputTokens, () => ( 0))) * (model.matches - model.failures - 1) + response.outputTokens) / (model.matches - model.failures);
|
|
705
|
+
if (response.reasoningTokens) model.reasoningReported += 1;
|
|
706
|
+
}
|
|
707
|
+
const flags = detectResponseAnomalies(response);
|
|
708
|
+
for (const flag of flags) {
|
|
709
|
+
report.anomalies.push({
|
|
710
|
+
matchId: result.matchId,
|
|
711
|
+
scheduleIndex: result.scheduleIndex,
|
|
712
|
+
taskId: result.task.id,
|
|
713
|
+
modelId: response.modelId,
|
|
714
|
+
flag,
|
|
715
|
+
detail: describeFlags(response)
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
if (result.winnerModelId && report.models[result.winnerModelId]) {
|
|
720
|
+
report.models[result.winnerModelId].wins += 1;
|
|
721
|
+
}
|
|
722
|
+
if (result.panel) {
|
|
723
|
+
if (result.panel.agreement === "unanimous") report.judge.unanimous += 1;
|
|
724
|
+
if (result.panel.agreement === "split") report.judge.split += 1;
|
|
725
|
+
for (const vote of result.panel.votes) {
|
|
726
|
+
if (vote.verdict) {
|
|
727
|
+
report.judge.validVotes += 1;
|
|
728
|
+
confidences.push(vote.verdict.confidence);
|
|
729
|
+
} else {
|
|
730
|
+
report.judge.abstentions += 1;
|
|
731
|
+
report.anomalies.push({
|
|
732
|
+
matchId: result.matchId,
|
|
733
|
+
scheduleIndex: result.scheduleIndex,
|
|
734
|
+
taskId: result.task.id,
|
|
735
|
+
modelId: vote.judgeModelId,
|
|
736
|
+
flag: "judge-abstained",
|
|
737
|
+
detail: _nullishCoalesce(vote.error, () => ( "no valid verdict"))
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
if (result.outcome === "judged" && result.matchCostUsd === 0) {
|
|
743
|
+
report.anomalies.push({
|
|
744
|
+
matchId: result.matchId,
|
|
745
|
+
scheduleIndex: result.scheduleIndex,
|
|
746
|
+
taskId: result.task.id,
|
|
747
|
+
modelId: null,
|
|
748
|
+
flag: "zero-cost-match",
|
|
749
|
+
detail: "judged match reported $0 total cost"
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
if (confidences.length > 0) {
|
|
754
|
+
report.judge.avgConfidence = confidences.reduce((sum, value) => sum + value, 0) / confidences.length;
|
|
755
|
+
}
|
|
756
|
+
reports.push(report);
|
|
757
|
+
}
|
|
758
|
+
return reports.sort((left, right) => left.firstTimestamp.localeCompare(right.firstTimestamp));
|
|
759
|
+
}
|
|
760
|
+
var HEALTH_ADVICE = {
|
|
761
|
+
failed: "Request failed \u2014 check the run log for the attempt-level error and whether retries were exhausted.",
|
|
762
|
+
"fast-response": `Response landed under ${FAST_RESPONSE_MS / 1e3}s \u2014 the task may be too easy for this model, or reasoning effort was not applied.`,
|
|
763
|
+
"low-output": `Fewer than ${LOW_OUTPUT_TOKENS} output tokens \u2014 likely a shallow answer; consider hardening the task.`,
|
|
764
|
+
truncated: "finish_reason=length \u2014 raise maxTokens or shorten the prompt.",
|
|
765
|
+
"reasoning-unreported": "Provider reported no reasoning tokens \u2014 verify the reasoning parameter reaches the model (arena generation <id>).",
|
|
766
|
+
"zero-cost": "Zero cost on a successful response \u2014 usage accounting may be broken.",
|
|
767
|
+
"zero-cost-match": "A judged match with $0 spend means usage accounting is broken end to end.",
|
|
768
|
+
"judge-abstained": "A judge returned no valid structured verdict twice \u2014 inspect judge.verdict-parse-failed entries in the run log."
|
|
769
|
+
};
|
|
770
|
+
function formatTriage(reports) {
|
|
771
|
+
const lines = [];
|
|
772
|
+
for (const report of reports) {
|
|
773
|
+
lines.push(`run ${report.runId} (seed "${report.seed}", ${report.firstTimestamp})`);
|
|
774
|
+
lines.push(
|
|
775
|
+
` matches ${report.matches} | judged ${report.outcomes.judged}, forfeit ${report.outcomes.forfeit}, no-contest ${report.outcomes["no-contest"]} | spend $${report.totalCostUsd.toFixed(4)}`
|
|
776
|
+
);
|
|
777
|
+
if (Object.keys(report.errorClasses).length > 0) {
|
|
778
|
+
lines.push(
|
|
779
|
+
` request failures: ${Object.entries(report.errorClasses).map(([errorClass, count]) => `${errorClass}\xD7${count}`).join(", ")}`
|
|
780
|
+
);
|
|
781
|
+
}
|
|
782
|
+
lines.push(
|
|
783
|
+
` judges: ${report.judge.validVotes} valid votes, ${report.judge.abstentions} abstentions, ${report.judge.unanimous} unanimous / ${report.judge.split} split panels` + (report.judge.avgConfidence === null ? "" : `, avg confidence ${report.judge.avgConfidence.toFixed(2)}`)
|
|
784
|
+
);
|
|
785
|
+
for (const [modelId, model] of Object.entries(report.models)) {
|
|
786
|
+
const latency = model.avgLatencyMs === null ? "\u2014" : `${Math.round(model.avgLatencyMs)}ms`;
|
|
787
|
+
const tokens = model.avgOutputTokens === null ? "\u2014" : `${Math.round(model.avgOutputTokens)} tok`;
|
|
788
|
+
lines.push(
|
|
789
|
+
` ${modelId.padEnd(30)} matches ${model.matches}, wins ${model.wins}, failures ${model.failures}, avg ${latency} / ${tokens}, reasoning reported ${model.reasoningReported}/${model.matches - model.failures}`
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
if (report.anomalies.length === 0) {
|
|
793
|
+
lines.push(" no anomalies detected");
|
|
794
|
+
} else {
|
|
795
|
+
lines.push(` anomalies (${report.anomalies.length}):`);
|
|
796
|
+
const byFlag = /* @__PURE__ */ new Map();
|
|
797
|
+
for (const anomaly of report.anomalies) {
|
|
798
|
+
const bucket = _nullishCoalesce(byFlag.get(anomaly.flag), () => ( []));
|
|
799
|
+
bucket.push(anomaly);
|
|
800
|
+
byFlag.set(anomaly.flag, bucket);
|
|
801
|
+
}
|
|
802
|
+
for (const [flag, anomalies] of byFlag) {
|
|
803
|
+
lines.push(` ${flag} \xD7${anomalies.length} \u2014 ${_nullishCoalesce(HEALTH_ADVICE[flag], () => ( ""))}`);
|
|
804
|
+
for (const anomaly of anomalies.slice(0, 4)) {
|
|
805
|
+
lines.push(
|
|
806
|
+
` [${anomaly.scheduleIndex}] ${anomaly.taskId} ${_nullishCoalesce(anomaly.modelId, () => ( ""))}: ${anomaly.detail.slice(0, 140)}`
|
|
807
|
+
);
|
|
808
|
+
}
|
|
809
|
+
if (anomalies.length > 4) lines.push(` \u2026 ${anomalies.length - 4} more`);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
lines.push("");
|
|
813
|
+
}
|
|
814
|
+
return lines.join("\n");
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
// src/arena.ts
|
|
818
|
+
var HEALTH_STOP_MIN_MATCHES = 4;
|
|
819
|
+
var HEALTH_STOP_FAILURE_RATE = 0.5;
|
|
820
|
+
function failedResponse(modelId, error, latencyMs) {
|
|
821
|
+
return {
|
|
822
|
+
modelId,
|
|
823
|
+
success: false,
|
|
824
|
+
error: _chunk4TWPCPRPcjs.sanitizeError.call(void 0, error),
|
|
825
|
+
latencyMs
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
var ArenaRunner = class {
|
|
829
|
+
constructor(gateway, store, onEvent, logger = _chunk4TWPCPRPcjs.noopLogger) {
|
|
830
|
+
this.gateway = gateway;
|
|
831
|
+
this.store = store;
|
|
832
|
+
this.onEvent = onEvent;
|
|
833
|
+
this.logger = logger;
|
|
834
|
+
this.judges = new (0, _chunk4TWPCPRPcjs.JudgePanel)(gateway, onEvent, logger);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
emit(event) {
|
|
842
|
+
_optionalChain([this, 'access', _18 => _18.onEvent, 'optionalCall', _19 => _19({ ...event, timestamp: (/* @__PURE__ */ new Date()).toISOString() })]);
|
|
843
|
+
}
|
|
844
|
+
observeCancellation(runId, progress, signal) {
|
|
845
|
+
let emitted = false;
|
|
846
|
+
const requested = () => {
|
|
847
|
+
if (emitted) return;
|
|
848
|
+
emitted = true;
|
|
849
|
+
this.logger.info("run.cancellation-requested", {
|
|
850
|
+
runId,
|
|
851
|
+
completed: progress.completed,
|
|
852
|
+
costUsd: progress.costUsd
|
|
853
|
+
});
|
|
854
|
+
this.emit({
|
|
855
|
+
id: `${runId}-cancellation-requested`,
|
|
856
|
+
type: "run.cancellation-requested",
|
|
857
|
+
data: {
|
|
858
|
+
runId,
|
|
859
|
+
completed: progress.completed,
|
|
860
|
+
costUsd: progress.costUsd
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
};
|
|
864
|
+
if (_optionalChain([signal, 'optionalAccess', _20 => _20.aborted])) requested();
|
|
865
|
+
else _optionalChain([signal, 'optionalAccess', _21 => _21.addEventListener, 'call', _22 => _22("abort", requested, { once: true })]);
|
|
866
|
+
return {
|
|
867
|
+
requested,
|
|
868
|
+
dispose: () => _optionalChain([signal, 'optionalAccess', _23 => _23.removeEventListener, 'call', _24 => _24("abort", requested)])
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
cancelRun(runId, progress) {
|
|
872
|
+
this.logger.info("run.cancelled", {
|
|
873
|
+
runId,
|
|
874
|
+
completed: progress.completed,
|
|
875
|
+
costUsd: progress.costUsd
|
|
876
|
+
});
|
|
877
|
+
this.emit({
|
|
878
|
+
id: `${runId}-cancelled`,
|
|
879
|
+
type: "run.cancelled",
|
|
880
|
+
data: {
|
|
881
|
+
runId,
|
|
882
|
+
completed: progress.completed,
|
|
883
|
+
costUsd: progress.costUsd
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
return {
|
|
887
|
+
runId,
|
|
888
|
+
completed: progress.completed,
|
|
889
|
+
costUsd: progress.costUsd,
|
|
890
|
+
stoppedForBudget: progress.stoppedForBudget,
|
|
891
|
+
cancelled: true
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
async prepareRun(config, tasks, signal) {
|
|
895
|
+
const competitors = _chunk4TWPCPRPcjs.resolveCompetitorRoster.call(void 0, config.competitorIds);
|
|
896
|
+
const competitorIds = competitors.map((model) => model.id);
|
|
897
|
+
const mismatched = tasks.filter((task) => task.public.category !== config.category);
|
|
898
|
+
if (mismatched.length > 0) {
|
|
899
|
+
throw new Error(
|
|
900
|
+
`Run category ${config.category} received tasks from another arena: ${mismatched.map((task) => task.public.id).join(", ")}`
|
|
901
|
+
);
|
|
902
|
+
}
|
|
903
|
+
const journal = this.store.readAll();
|
|
904
|
+
const incompatible = journal.find((match) => match.methodologyVersion !== _chunkCIXITJW6cjs.METHODOLOGY_VERSION);
|
|
905
|
+
if (incompatible) {
|
|
906
|
+
throw new Error(
|
|
907
|
+
`Cannot append ${_chunkCIXITJW6cjs.METHODOLOGY_VERSION} matches to a ${incompatible.methodologyVersion} journal; archive it and start a new journal`
|
|
908
|
+
);
|
|
909
|
+
}
|
|
910
|
+
this.store.rebuildEloState(competitorIds);
|
|
911
|
+
const manifest = createRunManifest(config, tasks, competitors);
|
|
912
|
+
const manifestHash = runManifestHash(manifest);
|
|
913
|
+
const runId = runIdFromManifest(manifest);
|
|
914
|
+
const schedule = scheduleMatches({
|
|
915
|
+
category: config.category,
|
|
916
|
+
seed: config.seed,
|
|
917
|
+
count: config.matches,
|
|
918
|
+
modelIds: competitorIds,
|
|
919
|
+
tasks,
|
|
920
|
+
runId
|
|
921
|
+
});
|
|
922
|
+
const existing = journal.filter((result) => result.runId === runId);
|
|
923
|
+
const prepared = {
|
|
924
|
+
runId,
|
|
925
|
+
manifestHash,
|
|
926
|
+
competitors,
|
|
927
|
+
schedule,
|
|
928
|
+
tasksById: new Map(tasks.map((task) => [task.public.id, task])),
|
|
929
|
+
completedIds: new Set(journal.map((result) => result.matchId)),
|
|
930
|
+
progress: {
|
|
931
|
+
costUsd: existing.reduce((sum, result) => sum + result.matchCostUsd, 0),
|
|
932
|
+
completed: 0,
|
|
933
|
+
matchesWithFailures: 0,
|
|
934
|
+
stoppedForBudget: false
|
|
935
|
+
}
|
|
936
|
+
};
|
|
937
|
+
if (_optionalChain([signal, 'optionalAccess', _25 => _25.aborted])) return prepared;
|
|
938
|
+
try {
|
|
939
|
+
await Promise.all(
|
|
940
|
+
[...competitors, ..._chunk4TWPCPRPcjs.listModels.call(void 0, "judge")].map(
|
|
941
|
+
(model) => this.gateway.validateModel(model, signal)
|
|
942
|
+
)
|
|
943
|
+
);
|
|
944
|
+
} catch (error) {
|
|
945
|
+
if (_optionalChain([signal, 'optionalAccess', _26 => _26.aborted])) return prepared;
|
|
946
|
+
throw error;
|
|
947
|
+
}
|
|
948
|
+
if (_optionalChain([signal, 'optionalAccess', _27 => _27.aborted])) return prepared;
|
|
949
|
+
this.store.writeRunManifest(runId, manifest);
|
|
950
|
+
return prepared;
|
|
951
|
+
}
|
|
952
|
+
async run(config, tasks, execution = {}) {
|
|
953
|
+
const { signal, onMatchResult } = execution;
|
|
954
|
+
const { runId, manifestHash, competitors, schedule, tasksById, completedIds, progress } = await this.prepareRun(config, tasks, signal);
|
|
955
|
+
const competitorIds = competitors.map((model) => model.id);
|
|
956
|
+
const cancellation = this.observeCancellation(runId, progress, signal);
|
|
957
|
+
try {
|
|
958
|
+
if (_optionalChain([signal, 'optionalAccess', _28 => _28.aborted])) return this.cancelRun(runId, progress);
|
|
959
|
+
this.logger.info("run.started", {
|
|
960
|
+
runId,
|
|
961
|
+
category: config.category,
|
|
962
|
+
seed: config.seed,
|
|
963
|
+
matches: config.matches,
|
|
964
|
+
maxCostUsd: config.maxCostUsd,
|
|
965
|
+
resume: config.resume,
|
|
966
|
+
healthStop: config.healthStop !== false,
|
|
967
|
+
competitorIds
|
|
968
|
+
});
|
|
969
|
+
this.emit({
|
|
970
|
+
id: `${runId}-started`,
|
|
971
|
+
type: "run.started",
|
|
972
|
+
data: {
|
|
973
|
+
runId,
|
|
974
|
+
category: config.category,
|
|
975
|
+
seed: config.seed,
|
|
976
|
+
matches: config.matches,
|
|
977
|
+
maxCostUsd: config.maxCostUsd,
|
|
978
|
+
competitorIds
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
for (const match of schedule) {
|
|
982
|
+
if (_optionalChain([signal, 'optionalAccess', _29 => _29.aborted])) return this.cancelRun(runId, progress);
|
|
983
|
+
if (completedIds.has(match.id)) {
|
|
984
|
+
if (config.resume) continue;
|
|
985
|
+
throw new Error(
|
|
986
|
+
`Match ${match.id} is already journaled; rerun with --resume or choose a new seed`
|
|
987
|
+
);
|
|
988
|
+
}
|
|
989
|
+
if (progress.costUsd >= config.maxCostUsd) {
|
|
990
|
+
progress.stoppedForBudget = true;
|
|
991
|
+
this.emit({
|
|
992
|
+
id: `${match.runId}-budget-stopped`,
|
|
993
|
+
type: "run.budget-stopped",
|
|
994
|
+
data: {
|
|
995
|
+
runId: match.runId,
|
|
996
|
+
completed: progress.completed,
|
|
997
|
+
costUsd: progress.costUsd,
|
|
998
|
+
maxCostUsd: config.maxCostUsd
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
break;
|
|
1002
|
+
}
|
|
1003
|
+
const task = tasksById.get(match.taskId);
|
|
1004
|
+
if (!task) throw new Error(`Scheduled task not found: ${match.taskId}`);
|
|
1005
|
+
this.emit({
|
|
1006
|
+
id: `${match.id}-started`,
|
|
1007
|
+
type: "match.started",
|
|
1008
|
+
data: {
|
|
1009
|
+
matchId: match.id,
|
|
1010
|
+
index: match.index,
|
|
1011
|
+
total: schedule.length,
|
|
1012
|
+
category: match.category,
|
|
1013
|
+
taskId: match.taskId,
|
|
1014
|
+
taskTitle: task.public.title,
|
|
1015
|
+
modelA: match.modelA,
|
|
1016
|
+
modelB: match.modelB
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
let result;
|
|
1020
|
+
try {
|
|
1021
|
+
result = await this.runMatch(match, task, manifestHash, competitorIds, signal);
|
|
1022
|
+
} catch (error) {
|
|
1023
|
+
if (_optionalChain([signal, 'optionalAccess', _30 => _30.aborted]) || _chunk4TWPCPRPcjs.isArenaCancellationError.call(void 0, error)) {
|
|
1024
|
+
cancellation.requested();
|
|
1025
|
+
return this.cancelRun(runId, progress);
|
|
1026
|
+
}
|
|
1027
|
+
throw error;
|
|
1028
|
+
}
|
|
1029
|
+
if (_optionalChain([signal, 'optionalAccess', _31 => _31.aborted])) return this.cancelRun(runId, progress);
|
|
1030
|
+
this.store.append(result);
|
|
1031
|
+
writeReports(this.store, { competitorIds });
|
|
1032
|
+
progress.costUsd += result.matchCostUsd;
|
|
1033
|
+
progress.completed += 1;
|
|
1034
|
+
if (!result.competitors.responseA.success || !result.competitors.responseB.success) {
|
|
1035
|
+
progress.matchesWithFailures += 1;
|
|
1036
|
+
}
|
|
1037
|
+
this.emit({
|
|
1038
|
+
id: `${match.id}-completed`,
|
|
1039
|
+
type: "match.completed",
|
|
1040
|
+
data: {
|
|
1041
|
+
matchId: match.id,
|
|
1042
|
+
taskId: match.taskId,
|
|
1043
|
+
winnerModelId: result.winnerModelId,
|
|
1044
|
+
outcome: result.outcome,
|
|
1045
|
+
costUsd: result.matchCostUsd,
|
|
1046
|
+
eloAfter: result.eloAfter,
|
|
1047
|
+
completed: progress.completed,
|
|
1048
|
+
total: schedule.length
|
|
1049
|
+
}
|
|
1050
|
+
});
|
|
1051
|
+
if (onMatchResult) await onMatchResult(result);
|
|
1052
|
+
if (_optionalChain([signal, 'optionalAccess', _32 => _32.aborted])) return this.cancelRun(runId, progress);
|
|
1053
|
+
if (config.healthStop !== false && progress.completed >= HEALTH_STOP_MIN_MATCHES && progress.matchesWithFailures / progress.completed >= HEALTH_STOP_FAILURE_RATE) {
|
|
1054
|
+
this.logger.error("run.health-stopped", {
|
|
1055
|
+
runId,
|
|
1056
|
+
completed: progress.completed,
|
|
1057
|
+
matchesWithFailures: progress.matchesWithFailures,
|
|
1058
|
+
failureRate: progress.matchesWithFailures / progress.completed
|
|
1059
|
+
});
|
|
1060
|
+
throw new Error(
|
|
1061
|
+
`Run halted after ${progress.completed} matches: ${progress.matchesWithFailures} had failed competitor responses. The provider path is unhealthy, so continuing would journal junk matches. Inspect the run log${this.logger.filePath ? ` at ${this.logger.filePath}` : ""}, fix the cause, then rerun with --resume (or pass --no-health-stop to override).`
|
|
1062
|
+
);
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
if (_optionalChain([signal, 'optionalAccess', _33 => _33.aborted])) return this.cancelRun(runId, progress);
|
|
1066
|
+
writeReports(this.store, { competitorIds });
|
|
1067
|
+
this.logger.info("run.completed", {
|
|
1068
|
+
runId,
|
|
1069
|
+
completed: progress.completed,
|
|
1070
|
+
matchesWithFailures: progress.matchesWithFailures,
|
|
1071
|
+
costUsd: progress.costUsd,
|
|
1072
|
+
stoppedForBudget: progress.stoppedForBudget,
|
|
1073
|
+
cancelled: false
|
|
1074
|
+
});
|
|
1075
|
+
this.emit({
|
|
1076
|
+
id: `${runId}-completed`,
|
|
1077
|
+
type: "run.completed",
|
|
1078
|
+
data: {
|
|
1079
|
+
runId,
|
|
1080
|
+
completed: progress.completed,
|
|
1081
|
+
costUsd: progress.costUsd,
|
|
1082
|
+
stoppedForBudget: progress.stoppedForBudget
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
return {
|
|
1086
|
+
runId,
|
|
1087
|
+
completed: progress.completed,
|
|
1088
|
+
costUsd: progress.costUsd,
|
|
1089
|
+
stoppedForBudget: progress.stoppedForBudget,
|
|
1090
|
+
cancelled: false
|
|
1091
|
+
};
|
|
1092
|
+
} finally {
|
|
1093
|
+
cancellation.dispose();
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
async runMatch(match, task, manifestHash, competitorIds, signal) {
|
|
1097
|
+
_chunk4TWPCPRPcjs.throwIfCancelled.call(void 0, signal);
|
|
1098
|
+
const state = this.store.rebuildEloState(competitorIds);
|
|
1099
|
+
const prompt = _chunk4TWPCPRPcjs.buildCompetitorPrompt.call(void 0, task);
|
|
1100
|
+
const [responseA, responseB] = await Promise.all([
|
|
1101
|
+
this.runCompetitor(match, "A", prompt, signal),
|
|
1102
|
+
this.runCompetitor(match, "B", prompt, signal)
|
|
1103
|
+
]);
|
|
1104
|
+
_chunk4TWPCPRPcjs.throwIfCancelled.call(void 0, signal);
|
|
1105
|
+
this.inspectResponse(match, responseA);
|
|
1106
|
+
this.inspectResponse(match, responseB);
|
|
1107
|
+
this.emit({
|
|
1108
|
+
id: `${match.id}-competitors-completed`,
|
|
1109
|
+
type: "competitors.completed",
|
|
1110
|
+
data: {
|
|
1111
|
+
matchId: match.id,
|
|
1112
|
+
modelA: {
|
|
1113
|
+
success: responseA.success,
|
|
1114
|
+
latencyMs: responseA.latencyMs,
|
|
1115
|
+
costUsd: _chunkCIXITJW6cjs.competitorCost.call(void 0, responseA),
|
|
1116
|
+
outputTokens: _chunkCIXITJW6cjs.competitorOutputTokens.call(void 0, responseA),
|
|
1117
|
+
reasoningTokens: _nullishCoalesce(_chunkCIXITJW6cjs.competitorReasoningTokens.call(void 0, responseA), () => ( null))
|
|
1118
|
+
},
|
|
1119
|
+
modelB: {
|
|
1120
|
+
success: responseB.success,
|
|
1121
|
+
latencyMs: responseB.latencyMs,
|
|
1122
|
+
costUsd: _chunkCIXITJW6cjs.competitorCost.call(void 0, responseB),
|
|
1123
|
+
outputTokens: _chunkCIXITJW6cjs.competitorOutputTokens.call(void 0, responseB),
|
|
1124
|
+
reasoningTokens: _nullishCoalesce(_chunkCIXITJW6cjs.competitorReasoningTokens.call(void 0, responseB), () => ( null))
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
});
|
|
1128
|
+
_chunk4TWPCPRPcjs.throwIfCancelled.call(void 0, signal);
|
|
1129
|
+
const eloBefore = {
|
|
1130
|
+
[match.modelA]: _nullishCoalesce(state.ratings[match.modelA], () => ( ELO_INITIAL)),
|
|
1131
|
+
[match.modelB]: _nullishCoalesce(state.ratings[match.modelB], () => ( ELO_INITIAL))
|
|
1132
|
+
};
|
|
1133
|
+
const eloAfter = { ...eloBefore };
|
|
1134
|
+
let outcome = "no-contest";
|
|
1135
|
+
let winnerModelId = null;
|
|
1136
|
+
let panel = null;
|
|
1137
|
+
if (responseA.success !== responseB.success) {
|
|
1138
|
+
outcome = "forfeit";
|
|
1139
|
+
winnerModelId = responseA.success ? match.modelA : match.modelB;
|
|
1140
|
+
} else if (responseA.success && responseB.success) {
|
|
1141
|
+
this.emit({
|
|
1142
|
+
id: `${match.id}-judging-started`,
|
|
1143
|
+
type: "judging.started",
|
|
1144
|
+
data: { matchId: match.id, judges: _chunk4TWPCPRPcjs.listModels.call(void 0, "judge").map((model) => model.id) }
|
|
1145
|
+
});
|
|
1146
|
+
panel = await this.judges.judge({ match, task, responseA, responseB }, signal);
|
|
1147
|
+
_chunk4TWPCPRPcjs.throwIfCancelled.call(void 0, signal);
|
|
1148
|
+
if (panel.winnerModelId) {
|
|
1149
|
+
outcome = "judged";
|
|
1150
|
+
winnerModelId = panel.winnerModelId;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
if (winnerModelId) {
|
|
1154
|
+
const update = applyEloWin(
|
|
1155
|
+
eloBefore[match.modelA],
|
|
1156
|
+
eloBefore[match.modelB],
|
|
1157
|
+
winnerModelId === match.modelA ? "a" : "b"
|
|
1158
|
+
);
|
|
1159
|
+
eloAfter[match.modelA] = update.ratingA;
|
|
1160
|
+
eloAfter[match.modelB] = update.ratingB;
|
|
1161
|
+
}
|
|
1162
|
+
const judgeCost = _nullishCoalesce(_optionalChain([panel, 'optionalAccess', _34 => _34.votes, 'access', _35 => _35.reduce, 'call', _36 => _36((sum, vote) => sum + (_nullishCoalesce(_optionalChain([vote, 'access', _37 => _37.completion, 'optionalAccess', _38 => _38.costUsd]), () => ( 0))), 0)]), () => ( 0));
|
|
1163
|
+
return {
|
|
1164
|
+
methodologyVersion: _chunkCIXITJW6cjs.METHODOLOGY_VERSION,
|
|
1165
|
+
runId: match.runId,
|
|
1166
|
+
runManifestHash: manifestHash,
|
|
1167
|
+
matchId: match.id,
|
|
1168
|
+
scheduleIndex: match.index,
|
|
1169
|
+
seed: match.seed,
|
|
1170
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1171
|
+
task: {
|
|
1172
|
+
id: task.public.id,
|
|
1173
|
+
version: task.public.version,
|
|
1174
|
+
category: task.public.category,
|
|
1175
|
+
cluster: task.public.cluster,
|
|
1176
|
+
publicHash: task.publicHash,
|
|
1177
|
+
privateHash: task.privateHash
|
|
1178
|
+
},
|
|
1179
|
+
competitors: { modelA: match.modelA, modelB: match.modelB, responseA, responseB },
|
|
1180
|
+
outcome,
|
|
1181
|
+
winnerModelId,
|
|
1182
|
+
panel,
|
|
1183
|
+
eloBefore,
|
|
1184
|
+
eloAfter,
|
|
1185
|
+
pointAwarded: winnerModelId !== null,
|
|
1186
|
+
matchCostUsd: _chunkCIXITJW6cjs.competitorCost.call(void 0, responseA) + _chunkCIXITJW6cjs.competitorCost.call(void 0, responseB) + judgeCost
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
/** Surface signals that make a journaled response untrustworthy or a task too easy. */
|
|
1190
|
+
inspectResponse(match, response) {
|
|
1191
|
+
if (!response.success) {
|
|
1192
|
+
this.logger.warn("competitor.failed", {
|
|
1193
|
+
matchId: match.id,
|
|
1194
|
+
taskId: match.taskId,
|
|
1195
|
+
modelId: response.modelId,
|
|
1196
|
+
latencyMs: response.latencyMs,
|
|
1197
|
+
error: _nullishCoalesce(response.error, () => ( "unknown"))
|
|
1198
|
+
});
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
const flags = detectResponseAnomalies(response);
|
|
1202
|
+
if (flags.length > 0) {
|
|
1203
|
+
this.logger.warn("competitor.suspicious", {
|
|
1204
|
+
matchId: match.id,
|
|
1205
|
+
taskId: match.taskId,
|
|
1206
|
+
modelId: response.modelId,
|
|
1207
|
+
flags,
|
|
1208
|
+
latencyMs: response.latencyMs,
|
|
1209
|
+
outputTokens: response.outputTokens,
|
|
1210
|
+
reasoningTokens: _nullishCoalesce(response.reasoningTokens, () => ( null)),
|
|
1211
|
+
costUsd: response.costUsd,
|
|
1212
|
+
finishReason: response.finishReason
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
async runCompetitor(match, side, prompt, signal) {
|
|
1217
|
+
const modelId = side === "A" ? match.modelA : match.modelB;
|
|
1218
|
+
const startedAt = Date.now();
|
|
1219
|
+
let sequence = 0;
|
|
1220
|
+
const emitDelta = (text, done, success = true) => {
|
|
1221
|
+
sequence += 1;
|
|
1222
|
+
this.emit({
|
|
1223
|
+
id: `${match.id}-delta-${side}-${sequence}`,
|
|
1224
|
+
type: "competitor.delta",
|
|
1225
|
+
data: { matchId: match.id, modelId, side, text, done, success }
|
|
1226
|
+
});
|
|
1227
|
+
};
|
|
1228
|
+
try {
|
|
1229
|
+
_chunk4TWPCPRPcjs.throwIfCancelled.call(void 0, signal);
|
|
1230
|
+
const completion = await this.gateway.complete({
|
|
1231
|
+
model: _chunk4TWPCPRPcjs.getModel.call(void 0, modelId),
|
|
1232
|
+
...prompt,
|
|
1233
|
+
signal,
|
|
1234
|
+
onDelta: (text) => emitDelta(text, false)
|
|
1235
|
+
});
|
|
1236
|
+
_chunk4TWPCPRPcjs.throwIfCancelled.call(void 0, signal);
|
|
1237
|
+
emitDelta(completion.content, true);
|
|
1238
|
+
return { modelId, success: true, ...completion };
|
|
1239
|
+
} catch (error) {
|
|
1240
|
+
if (_optionalChain([signal, 'optionalAccess', _39 => _39.aborted]) || _chunk4TWPCPRPcjs.isArenaCancellationError.call(void 0, error)) {
|
|
1241
|
+
throw new (0, _chunk4TWPCPRPcjs.ArenaCancellationError)();
|
|
1242
|
+
}
|
|
1243
|
+
const failed = failedResponse(modelId, error, Date.now() - startedAt);
|
|
1244
|
+
emitDelta(failed.error, true, false);
|
|
1245
|
+
return failed;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
1249
|
+
|
|
1250
|
+
// src/mock-gateway.ts
|
|
1251
|
+
function sleep(ms) {
|
|
1252
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1253
|
+
}
|
|
1254
|
+
function baseCompletion(content, generationId) {
|
|
1255
|
+
return {
|
|
1256
|
+
generationId,
|
|
1257
|
+
content,
|
|
1258
|
+
inputTokens: 120,
|
|
1259
|
+
outputTokens: Math.max(1, Math.ceil(content.length / 4)),
|
|
1260
|
+
costUsd: 0.02,
|
|
1261
|
+
latencyMs: 250,
|
|
1262
|
+
finishReason: "stop",
|
|
1263
|
+
attempts: 1
|
|
1264
|
+
};
|
|
1265
|
+
}
|
|
1266
|
+
var MockOpenRouterGateway = class {
|
|
1267
|
+
constructor(options = {}) {
|
|
1268
|
+
this.options = options;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
async validateModel(_model) {
|
|
1272
|
+
}
|
|
1273
|
+
async complete(request) {
|
|
1274
|
+
if (_optionalChain([request, 'access', _40 => _40.signal, 'optionalAccess', _41 => _41.aborted])) {
|
|
1275
|
+
throw new Error("Mock completion aborted");
|
|
1276
|
+
}
|
|
1277
|
+
if (request.structured) {
|
|
1278
|
+
const winner = _nullishCoalesce(this.options.judgeWinner, () => ( "MODEL_A"));
|
|
1279
|
+
const payload = {
|
|
1280
|
+
winner,
|
|
1281
|
+
confidence: 0.9,
|
|
1282
|
+
rationale: "The selected mock response is better grounded.",
|
|
1283
|
+
criteria: {
|
|
1284
|
+
correctness: "Correct.",
|
|
1285
|
+
grounding: "Grounded.",
|
|
1286
|
+
constraintHandling: "Complete.",
|
|
1287
|
+
completeness: "Complete."
|
|
1288
|
+
},
|
|
1289
|
+
violations: []
|
|
1290
|
+
};
|
|
1291
|
+
void _chunk4TWPCPRPcjs.judgeVerdictJsonSchema.call(void 0, );
|
|
1292
|
+
return baseCompletion(JSON.stringify(payload), `mock-judge-${request.model.id}`);
|
|
1293
|
+
}
|
|
1294
|
+
const variantA = [
|
|
1295
|
+
`The terminal state follows the cancellation edge before retry exhaustion.`,
|
|
1296
|
+
`The journal records a cancel-requested transition before the final attempt window closed, which rules out budget-stop and health-stop.`,
|
|
1297
|
+
`The discriminating evidence is the cancellation timestamp preceding the last retry.`
|
|
1298
|
+
];
|
|
1299
|
+
const variantB = [
|
|
1300
|
+
`Working backwards from the final journal entry, the run ends on the cancellation path rather than retry exhaustion.`,
|
|
1301
|
+
`Spend stayed below the budget threshold and no health probes failed in the window, so those edges are excluded.`,
|
|
1302
|
+
`The single strongest signal is the cancel-requested event landing before the retry counter reached its limit.`
|
|
1303
|
+
];
|
|
1304
|
+
const checksum = [...request.model.id].reduce((sum, ch) => sum + ch.charCodeAt(0), 0);
|
|
1305
|
+
const text = _nullishCoalesce(this.options.competitorText, () => ( (checksum % 2 === 0 ? variantA : variantB).join(" ")));
|
|
1306
|
+
const delayMs = Number(_nullishCoalesce(process.env.MOCK_CHUNK_DELAY_MS, () => ( ""))) || this.options.chunkDelayMs || 40;
|
|
1307
|
+
const parts = _nullishCoalesce(text.match(/.{1,24}/g), () => ( [text]));
|
|
1308
|
+
let cumulative = "";
|
|
1309
|
+
for (const part of parts) {
|
|
1310
|
+
if (_optionalChain([request, 'access', _42 => _42.signal, 'optionalAccess', _43 => _43.aborted])) {
|
|
1311
|
+
throw new Error("Mock completion aborted");
|
|
1312
|
+
}
|
|
1313
|
+
cumulative += part;
|
|
1314
|
+
_optionalChain([request, 'access', _44 => _44.onDelta, 'optionalCall', _45 => _45(cumulative)]);
|
|
1315
|
+
if (delayMs > 0) await sleep(delayMs);
|
|
1316
|
+
}
|
|
1317
|
+
return baseCompletion(cumulative, `mock-competitor-${request.model.id}`);
|
|
1318
|
+
}
|
|
1319
|
+
};
|
|
1320
|
+
|
|
1321
|
+
// src/store.ts
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
|
|
1329
|
+
|
|
1330
|
+
|
|
1331
|
+
function categoryStoreConfig(category, resultsRoot = process.env.BRIDGEBENCH_RESULTS_DIR) {
|
|
1332
|
+
const base = resultsRoot ? _path2.default.resolve(process.cwd(), resultsRoot) : _path2.default.join(process.cwd(), "results");
|
|
1333
|
+
const root = _path2.default.join(base, category);
|
|
1334
|
+
return {
|
|
1335
|
+
category,
|
|
1336
|
+
journalPath: _path2.default.join(root, "journal.jsonl"),
|
|
1337
|
+
snapshotPath: _path2.default.join(root, "snapshot.json"),
|
|
1338
|
+
markdownPath: _path2.default.join(root, "leaderboard.md"),
|
|
1339
|
+
runsDir: _path2.default.join(root, "runs")
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1342
|
+
var ArenaStore = class {
|
|
1343
|
+
constructor(config) {
|
|
1344
|
+
this.config = config;
|
|
1345
|
+
if (config.readOnly) return;
|
|
1346
|
+
for (const file of [config.journalPath, config.snapshotPath, config.markdownPath]) {
|
|
1347
|
+
_fs.mkdirSync.call(void 0, _path2.default.dirname(file), { recursive: true });
|
|
1348
|
+
}
|
|
1349
|
+
_fs.mkdirSync.call(void 0, this.runsDir, { recursive: true });
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
get category() {
|
|
1353
|
+
return this.config.category;
|
|
1354
|
+
}
|
|
1355
|
+
get runsDir() {
|
|
1356
|
+
return _nullishCoalesce(this.config.runsDir, () => ( _path2.default.join(_path2.default.dirname(this.config.journalPath), "runs")));
|
|
1357
|
+
}
|
|
1358
|
+
append(result) {
|
|
1359
|
+
_fs.appendFileSync.call(void 0, this.config.journalPath, `${JSON.stringify(result)}
|
|
1360
|
+
`, {
|
|
1361
|
+
encoding: "utf8",
|
|
1362
|
+
mode: 384
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
readAll() {
|
|
1366
|
+
if (!_fs.existsSync.call(void 0, this.config.journalPath)) return [];
|
|
1367
|
+
return _fs.readFileSync.call(void 0, this.config.journalPath, "utf8").split("\n").filter(Boolean).map((line, index) => {
|
|
1368
|
+
let decoded;
|
|
1369
|
+
try {
|
|
1370
|
+
decoded = JSON.parse(line);
|
|
1371
|
+
} catch (e2) {
|
|
1372
|
+
throw new Error(`Malformed arena journal line ${index + 1}; refusing to continue`);
|
|
1373
|
+
}
|
|
1374
|
+
const parsed = _chunkCIXITJW6cjs.MatchResultSchema.safeParse(decoded);
|
|
1375
|
+
if (!parsed.success) {
|
|
1376
|
+
const issue = parsed.error.issues[0];
|
|
1377
|
+
const location = _optionalChain([issue, 'optionalAccess', _46 => _46.path, 'access', _47 => _47.length]) ? ` at ${issue.path.join(".")}` : "";
|
|
1378
|
+
throw new Error(
|
|
1379
|
+
`Invalid arena journal line ${index + 1}${location}: ${_nullishCoalesce(_optionalChain([issue, 'optionalAccess', _48 => _48.message]), () => ( "schema mismatch"))}`
|
|
1380
|
+
);
|
|
1381
|
+
}
|
|
1382
|
+
return parsed.data;
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1385
|
+
writeRunManifest(runId, manifest) {
|
|
1386
|
+
const validated = RunManifestSchema.parse(manifest);
|
|
1387
|
+
const target = _path2.default.join(this.runsDir, `${runId}.json`);
|
|
1388
|
+
const content = `${canonicalJson(validated)}
|
|
1389
|
+
`;
|
|
1390
|
+
if (_fs.existsSync.call(void 0, target)) {
|
|
1391
|
+
const existing = _fs.readFileSync.call(void 0, target, "utf8");
|
|
1392
|
+
if (existing !== content) {
|
|
1393
|
+
throw new Error(`Run manifest ${runId} already exists with different inputs`);
|
|
1394
|
+
}
|
|
1395
|
+
return;
|
|
1396
|
+
}
|
|
1397
|
+
this.atomicWrite(target, content);
|
|
1398
|
+
}
|
|
1399
|
+
readRunManifest(runId) {
|
|
1400
|
+
const target = _path2.default.join(this.runsDir, `${runId}.json`);
|
|
1401
|
+
if (!_fs.existsSync.call(void 0, target)) return null;
|
|
1402
|
+
try {
|
|
1403
|
+
return RunManifestSchema.parse(JSON.parse(_fs.readFileSync.call(void 0, target, "utf8")));
|
|
1404
|
+
} catch (error) {
|
|
1405
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
1406
|
+
throw new Error(`Invalid run manifest ${runId}: ${reason}`, { cause: error });
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
completedMatchIds() {
|
|
1410
|
+
return new Set(this.readAll().map((result) => result.matchId));
|
|
1411
|
+
}
|
|
1412
|
+
rebuildEloState(competitorIds = _chunk4TWPCPRPcjs.listModels.call(void 0, "competitor").map((model) => model.id)) {
|
|
1413
|
+
const ratings = Object.fromEntries(competitorIds.map((modelId) => [modelId, ELO_INITIAL]));
|
|
1414
|
+
const points = Object.fromEntries(competitorIds.map((modelId) => [modelId, 0]));
|
|
1415
|
+
const verified = verifyJournal(this.readAll(), this.category, {
|
|
1416
|
+
manifestForRun: (runId) => this.readRunManifest(runId),
|
|
1417
|
+
requireManifests: true
|
|
1418
|
+
});
|
|
1419
|
+
Object.assign(ratings, verified.ratings);
|
|
1420
|
+
Object.assign(points, verified.points);
|
|
1421
|
+
return { ratings, points };
|
|
1422
|
+
}
|
|
1423
|
+
writeSnapshot(snapshot) {
|
|
1424
|
+
this.atomicWrite(this.config.snapshotPath, `${JSON.stringify(snapshot, null, 2)}
|
|
1425
|
+
`);
|
|
1426
|
+
}
|
|
1427
|
+
writeMarkdown(markdown) {
|
|
1428
|
+
this.atomicWrite(this.config.markdownPath, markdown);
|
|
1429
|
+
}
|
|
1430
|
+
atomicWrite(target, content) {
|
|
1431
|
+
const temporary = `${target}.tmp`;
|
|
1432
|
+
_fs.writeFileSync.call(void 0, temporary, content, { encoding: "utf8", mode: 384 });
|
|
1433
|
+
_fs.renameSync.call(void 0, temporary, target);
|
|
1434
|
+
}
|
|
1435
|
+
};
|
|
1436
|
+
|
|
1437
|
+
|
|
1438
|
+
|
|
1439
|
+
|
|
1440
|
+
|
|
1441
|
+
|
|
1442
|
+
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
|
+
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+
|
|
1455
|
+
|
|
1456
|
+
|
|
1457
|
+
|
|
1458
|
+
|
|
1459
|
+
|
|
1460
|
+
|
|
1461
|
+
|
|
1462
|
+
|
|
1463
|
+
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
exports.ELO_INITIAL = ELO_INITIAL; exports.ELO_K = ELO_K; exports.expectedScore = expectedScore; exports.applyEloWin = applyEloWin; exports.PACKAGE_NAME = PACKAGE_NAME; exports.ENGINE_VERSION = ENGINE_VERSION; exports.RUN_MANIFEST_VERSION = RUN_MANIFEST_VERSION; exports.RunManifestSchema = RunManifestSchema; exports.canonicalJson = canonicalJson; exports.runManifestHash = runManifestHash; exports.runIdFromManifest = runIdFromManifest; exports.createRunManifest = createRunManifest; exports.verifyJournal = verifyJournal; exports.verifiedEloState = verifiedEloState; exports.buildSnapshot = buildSnapshot; exports.renderMarkdown = renderMarkdown; exports.writeReports = writeReports; exports.scheduleMatches = scheduleMatches; exports.FAST_RESPONSE_MS = FAST_RESPONSE_MS; exports.LOW_OUTPUT_TOKENS = LOW_OUTPUT_TOKENS; exports.classifyError = classifyError; exports.detectResponseAnomalies = detectResponseAnomalies; exports.triageJournal = triageJournal; exports.formatTriage = formatTriage; exports.ArenaRunner = ArenaRunner; exports.MockOpenRouterGateway = MockOpenRouterGateway; exports.categoryStoreConfig = categoryStoreConfig; exports.ArenaStore = ArenaStore;
|
|
1467
|
+
//# sourceMappingURL=chunk-NJTYVNP4.cjs.map
|