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.
Files changed (86) hide show
  1. package/CITATION.cff +15 -0
  2. package/LICENSE +21 -0
  3. package/README.md +249 -0
  4. package/dist/chunk-4TWPCPRP.cjs +1097 -0
  5. package/dist/chunk-4TWPCPRP.cjs.map +1 -0
  6. package/dist/chunk-7YCJSOK7.cjs +398 -0
  7. package/dist/chunk-7YCJSOK7.cjs.map +1 -0
  8. package/dist/chunk-CIXITJW6.cjs +249 -0
  9. package/dist/chunk-CIXITJW6.cjs.map +1 -0
  10. package/dist/chunk-EQHRUV2I.js +1466 -0
  11. package/dist/chunk-EQHRUV2I.js.map +1 -0
  12. package/dist/chunk-JTVNKSMO.js +1096 -0
  13. package/dist/chunk-JTVNKSMO.js.map +1 -0
  14. package/dist/chunk-LFKEV2YL.js +398 -0
  15. package/dist/chunk-LFKEV2YL.js.map +1 -0
  16. package/dist/chunk-NJTYVNP4.cjs +1467 -0
  17. package/dist/chunk-NJTYVNP4.cjs.map +1 -0
  18. package/dist/chunk-UECBSKTD.js +244 -0
  19. package/dist/chunk-UECBSKTD.js.map +1 -0
  20. package/dist/cli.cjs +409 -0
  21. package/dist/cli.cjs.map +1 -0
  22. package/dist/cli.d.cts +1 -0
  23. package/dist/cli.d.ts +1 -0
  24. package/dist/cli.js +408 -0
  25. package/dist/cli.js.map +1 -0
  26. package/dist/client.cjs +42 -0
  27. package/dist/client.cjs.map +1 -0
  28. package/dist/client.d.cts +93 -0
  29. package/dist/client.d.ts +93 -0
  30. package/dist/client.js +42 -0
  31. package/dist/client.js.map +1 -0
  32. package/dist/contracts/index.cjs +47 -0
  33. package/dist/contracts/index.cjs.map +1 -0
  34. package/dist/contracts/index.d.cts +14 -0
  35. package/dist/contracts/index.d.ts +14 -0
  36. package/dist/contracts/index.js +47 -0
  37. package/dist/contracts/index.js.map +1 -0
  38. package/dist/index.cjs +171 -0
  39. package/dist/index.cjs.map +1 -0
  40. package/dist/index.d.cts +214 -0
  41. package/dist/index.d.ts +214 -0
  42. package/dist/index.js +171 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/logger-CCR9Mg1c.d.cts +319 -0
  45. package/dist/logger-QJU7SBDz.d.ts +319 -0
  46. package/dist/reports-4CejmOHf.d.cts +454 -0
  47. package/dist/reports-s2CTnGN8.d.ts +454 -0
  48. package/dist/tasks-CpaCJ6JE.d.cts +151 -0
  49. package/dist/tasks-CpaCJ6JE.d.ts +151 -0
  50. package/dist/tasks.cjs +22 -0
  51. package/dist/tasks.cjs.map +1 -0
  52. package/dist/tasks.d.cts +39 -0
  53. package/dist/tasks.d.ts +39 -0
  54. package/dist/tasks.js +22 -0
  55. package/dist/tasks.js.map +1 -0
  56. package/docs/README.md +25 -0
  57. package/docs/glossary.md +49 -0
  58. package/docs/methodology.md +58 -0
  59. package/docs/private-packs.md +74 -0
  60. package/docs/replay-elo.md +79 -0
  61. package/docs/task-authoring.md +80 -0
  62. package/package.json +137 -0
  63. package/tasks/hallucination/public/boundary-coverage-audit.yaml +274 -0
  64. package/tasks/hallucination/public/boundary-migration-audit.yaml +284 -0
  65. package/tasks/hallucination/public/conflict-dependency-versions.yaml +324 -0
  66. package/tasks/hallucination/public/conflict-runbook-versions.yaml +229 -0
  67. package/tasks/hallucination/public/fabrication-agent-tools.yaml +224 -0
  68. package/tasks/hallucination/public/fabrication-api-surface.yaml +239 -0
  69. package/tasks/hallucination/public/fidelity-commit-attribution.yaml +304 -0
  70. package/tasks/hallucination/public/fidelity-config-drift.yaml +307 -0
  71. package/tasks/hallucination/public/missing-deploy-window.yaml +204 -0
  72. package/tasks/hallucination/public/missing-latency-baseline.yaml +239 -0
  73. package/tasks/hallucination/public/premise-quota-breach.yaml +202 -0
  74. package/tasks/hallucination/public/premise-rollback-cause.yaml +235 -0
  75. package/tasks/reasoning/public/constraint-capacity-allocation.yaml +196 -0
  76. package/tasks/reasoning/public/constraint-deployment-policy.yaml +203 -0
  77. package/tasks/reasoning/public/counterexample-authorization-rule.yaml +278 -0
  78. package/tasks/reasoning/public/counterexample-scheduler-starvation.yaml +290 -0
  79. package/tasks/reasoning/public/root-cache-tenant-leak.yaml +225 -0
  80. package/tasks/reasoning/public/root-event-ordering.yaml +184 -0
  81. package/tasks/reasoning/public/stateful-lease-handoff.yaml +213 -0
  82. package/tasks/reasoning/public/stateful-retry-budget.yaml +222 -0
  83. package/tasks/reasoning/public/synthesis-api-contract.yaml +214 -0
  84. package/tasks/reasoning/public/synthesis-permission-migration.yaml +190 -0
  85. package/tasks/reasoning/public/uncertainty-conflicting-telemetry.yaml +242 -0
  86. package/tasks/reasoning/public/uncertainty-incomplete-incident.yaml +223 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/matthewmiller/Desktop/bridgemind/bridgebench/dist/chunk-NJTYVNP4.cjs","../src/elo.ts","../src/version.ts","../src/run-manifest.ts","../src/verification.ts","../src/report.ts","../src/scheduler.ts","../src/triage.ts","../src/arena.ts","../src/mock-gateway.ts","../src/store.ts"],"names":["z","readFileSync"],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;AC3BO,IAAM,YAAA,EAAc,GAAA;AACpB,IAAM,MAAA,EAAQ,EAAA;AAEd,SAAS,aAAA,CAAc,OAAA,EAAiB,OAAA,EAAyB;AACtE,EAAA,OAAO,EAAA,EAAA,CAAK,EAAA,EAAI,IAAA,CAAK,GAAA,CAAI,EAAA,EAAA,CAAK,QAAA,EAAU,OAAA,EAAA,EAAW,GAAG,CAAA,CAAA;AACxD;AAEO,SAAS,WAAA,CACd,OAAA,EACA,OAAA,EACA,MAAA,EACsC;AACtC,EAAA,MAAM,UAAA,EAAY,aAAA,CAAc,OAAA,EAAS,OAAO,CAAA;AAChD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IAAA;AACD,IAAA;AACG,MAAA;AAC9B,MAAA;AACnB,IAAA;AACsC,IAAA;AACF,IAAA;AACZ,IAAA;AAC3B,EAAA;AAE6C,EAAA;AACQ,IAAA;AAAgC;AACrF,EAAA;AAEsC,EAAA;AACe,IAAA;AACrD,EAAA;AAE2D,EAAA;AAC9B,IAAA;AACmB,IAAA;AAClB,IAAA;AAC9B,EAAA;AACF;AV+vCuD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/matthewmiller/Desktop/bridgemind/bridgebench/dist/chunk-NJTYVNP4.cjs","sourcesContent":[null,"export const ELO_INITIAL = 1000;\nexport const ELO_K = 32;\n\nexport function expectedScore(ratingA: number, ratingB: number): number {\n return 1 / (1 + Math.pow(10, (ratingB - ratingA) / 400));\n}\n\nexport function applyEloWin(\n ratingA: number,\n ratingB: number,\n winner: 'a' | 'b',\n): { ratingA: number; ratingB: number } {\n const expectedA = expectedScore(ratingA, ratingB);\n const scoreA = winner === 'a' ? 1 : 0;\n return {\n ratingA: ratingA + ELO_K * (scoreA - expectedA),\n ratingB: ratingB + ELO_K * (1 - scoreA - (1 - expectedA)),\n };\n}\n","import { readFileSync } from 'node:fs';\nimport path from 'node:path';\n\nimport { z } from 'zod';\n\nimport { packageRoot } from './paths.js';\n\nconst PackageMetadataSchema = z.object({\n name: z.string().min(1),\n version: z.string().min(1),\n});\n\nconst metadata = PackageMetadataSchema.parse(\n JSON.parse(readFileSync(path.join(packageRoot(import.meta.url), 'package.json'), 'utf8')),\n);\n\nexport const PACKAGE_NAME = metadata.name;\nexport const ENGINE_VERSION = metadata.version;\n","import { createHash } from 'node:crypto';\n\nimport { z } from 'zod';\n\nimport { judgePromptPolicyHash } from './judges.js';\nimport { listModels, resolveCompetitorRoster } from './models.js';\nimport { competitorPromptPolicyHash } from './tasks.js';\nimport {\n BenchmarkCategorySchema,\n METHODOLOGY_VERSION,\n type ArenaRunConfig,\n type CompleteArenaTask,\n type ModelRegistryEntry,\n} from './types.js';\nimport { ENGINE_VERSION } from './version.js';\n\nexport const RUN_MANIFEST_VERSION = '1.0.0';\n\nconst ManifestModelSchema = z.object({\n id: z.string().min(1),\n canonicalSlug: z.string().min(1),\n role: z.enum(['competitor', 'judge']),\n request: z.object({\n maxTokens: z.number().int().positive(),\n temperature: z.number().finite(),\n reasoningEffort: z.enum(['high', 'medium', 'low']),\n excludeReasoning: z.boolean(),\n timeoutMs: z.number().int().positive(),\n }),\n});\n\nconst ManifestCompetitorSchema = ManifestModelSchema.extend({\n role: z.literal('competitor'),\n});\nconst ManifestJudgeSchema = ManifestModelSchema.extend({\n role: z.literal('judge'),\n});\n\nexport const RunManifestSchema = z.object({\n version: z.literal(RUN_MANIFEST_VERSION),\n methodologyVersion: z.string().min(1),\n engineVersion: z.string().min(1),\n category: BenchmarkCategorySchema,\n seed: z.string(),\n matches: z.number().int().positive(),\n competitors: z\n .array(ManifestCompetitorSchema)\n .min(2)\n .superRefine((models, context) => {\n if (new Set(models.map((model) => model.id)).size !== models.length) {\n context.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Competitor manifest entries must be unique',\n });\n }\n }),\n judges: z\n .array(ManifestJudgeSchema)\n .length(3)\n .superRefine((models, context) => {\n if (new Set(models.map((model) => model.id)).size !== models.length) {\n context.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Judge manifest entries must be unique',\n });\n }\n }),\n tasks: z.array(\n z.object({\n id: z.string().min(1),\n version: z.string().min(1),\n publicHash: z.string().min(1),\n privateHash: z.string().min(1),\n }),\n ),\n promptPolicyHashes: z.object({\n competitor: z.string().regex(/^[a-f0-9]{64}$/),\n judge: z.string().regex(/^[a-f0-9]{64}$/),\n }),\n});\n\nexport type RunManifest = z.infer<typeof RunManifestSchema>;\n\nfunction manifestModel(model: ModelRegistryEntry): z.infer<typeof ManifestModelSchema> {\n return {\n id: model.id,\n canonicalSlug: model.canonicalSlug,\n role: model.role,\n request: { ...model.request },\n };\n}\n\nfunction canonicalize(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(canonicalize);\n if (value && typeof value === 'object') {\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>)\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([key, child]) => [key, canonicalize(child)]),\n );\n }\n return value;\n}\n\nexport function canonicalJson(value: unknown): string {\n return JSON.stringify(canonicalize(value));\n}\n\nexport function runManifestHash(manifest: RunManifest): string {\n return createHash('sha256').update(canonicalJson(manifest)).digest('hex');\n}\n\nexport function runIdFromManifest(manifest: RunManifest): string {\n return `run-${runManifestHash(manifest).slice(0, 20)}`;\n}\n\nexport function createRunManifest(\n config: Pick<ArenaRunConfig, 'category' | 'seed' | 'matches' | 'competitorIds'>,\n tasks: CompleteArenaTask[],\n resolvedCompetitors: readonly ModelRegistryEntry[] = resolveCompetitorRoster(\n config.competitorIds,\n ),\n): RunManifest {\n const canonicalCompetitors = resolveCompetitorRoster(\n resolvedCompetitors.map((model) => model.id),\n );\n const competitors = canonicalCompetitors\n .map((model) => ({ ...manifestModel(model), role: 'competitor' as const }))\n .sort((left, right) => left.id.localeCompare(right.id));\n const judges = listModels('judge')\n .map((model) => ({ ...manifestModel(model), role: 'judge' as const }))\n .sort((left, right) => left.id.localeCompare(right.id));\n const manifest: RunManifest = {\n version: RUN_MANIFEST_VERSION,\n methodologyVersion: METHODOLOGY_VERSION,\n engineVersion: ENGINE_VERSION,\n category: config.category,\n seed: config.seed,\n matches: config.matches,\n competitors,\n judges,\n tasks: tasks\n .map((task) => ({\n id: task.public.id,\n version: task.public.version,\n publicHash: task.publicHash,\n privateHash: task.privateHash,\n }))\n .sort((left, right) => left.id.localeCompare(right.id)),\n promptPolicyHashes: {\n competitor: competitorPromptPolicyHash(config.category),\n judge: judgePromptPolicyHash(config.category),\n },\n };\n return RunManifestSchema.parse(manifest);\n}\n","import { applyEloWin, ELO_INITIAL } from './elo.js';\nimport { runIdFromManifest, runManifestHash, type RunManifest } from './run-manifest.js';\nimport {\n METHODOLOGY_VERSION,\n competitorCost,\n type BenchmarkCategory,\n type EloState,\n type MatchResult,\n type PanelDecision,\n} from './types.js';\n\nconst LEGACY_METHODOLOGY_VERSION = 'reasoning-arena-v0.2.0';\nconst SUPPORTED_METHODOLOGY_VERSIONS = new Set([LEGACY_METHODOLOGY_VERSION, METHODOLOGY_VERSION]);\nconst EPSILON = 1e-9;\n\nexport interface VerificationOptions {\n manifestForRun?: (runId: string) => RunManifest | null;\n requireManifests?: boolean;\n}\n\nexport interface VerifiedJournal {\n category: BenchmarkCategory;\n methodologyVersion: string | null;\n matches: MatchResult[];\n ratings: Record<string, number>;\n points: Record<string, number>;\n runs: string[];\n warnings: string[];\n}\n\nfunction fail(message: string): never {\n throw new Error(message);\n}\n\nfunction equalNumber(actual: number | undefined, expected: number, label: string): void {\n if (actual === undefined || Math.abs(actual - expected) > EPSILON) {\n fail(`${label} expected ${expected}, found ${actual ?? '<missing>'}`);\n }\n}\n\nfunction assertRecordKeys(record: Record<string, number>, expected: string[], label: string): void {\n const actual = Object.keys(record).sort();\n const wanted = [...expected].sort();\n if (actual.length !== wanted.length || actual.some((key, index) => key !== wanted[index])) {\n fail(`${label} keys must be exactly ${wanted.join(', ')}`);\n }\n}\n\nfunction expectedPanel(\n panel: PanelDecision,\n modelA: string,\n modelB: string,\n): {\n winnerModelId: string | null;\n validVotes: number;\n votesByModel: Record<string, number>;\n agreement: PanelDecision['agreement'];\n} {\n const votesByModel: Record<string, number> = { [modelA]: 0, [modelB]: 0 };\n let validVotes = 0;\n for (const vote of panel.votes) {\n if (vote.winnerModelId === null) continue;\n if (vote.winnerModelId !== modelA && vote.winnerModelId !== modelB) {\n fail(`judge ${vote.judgeModelId} resolved an unknown competitor`);\n }\n validVotes += 1;\n votesByModel[vote.winnerModelId] = (votesByModel[vote.winnerModelId] ?? 0) + 1;\n }\n const winnerModelId = Object.entries(votesByModel).find(([, count]) => count >= 2)?.[0] ?? null;\n const winnerVotes = winnerModelId ? (votesByModel[winnerModelId] ?? 0) : 0;\n return {\n winnerModelId,\n validVotes,\n votesByModel,\n agreement: winnerVotes === 3 ? 'unanimous' : winnerVotes === 2 ? 'split' : 'insufficient',\n };\n}\n\nfunction verifyPanel(panel: PanelDecision, modelA: string, modelB: string): string | null {\n const expected = expectedPanel(panel, modelA, modelB);\n if (panel.validVotes !== expected.validVotes) {\n fail(`panel validVotes expected ${expected.validVotes}, found ${panel.validVotes}`);\n }\n assertRecordKeys(panel.votesByModel, [modelA, modelB], 'panel votesByModel');\n equalNumber(\n panel.votesByModel[modelA],\n expected.votesByModel[modelA] ?? 0,\n `votes for ${modelA}`,\n );\n equalNumber(\n panel.votesByModel[modelB],\n expected.votesByModel[modelB] ?? 0,\n `votes for ${modelB}`,\n );\n if (panel.winnerModelId !== expected.winnerModelId) {\n fail(\n `panel winner expected ${expected.winnerModelId ?? 'none'}, found ${panel.winnerModelId ?? 'none'}`,\n );\n }\n if (panel.agreement !== expected.agreement) {\n fail(`panel agreement expected ${expected.agreement}, found ${panel.agreement}`);\n }\n return expected.winnerModelId;\n}\n\nfunction verifyOutcome(match: MatchResult): void {\n const { modelA, modelB, responseA, responseB } = match.competitors;\n if (modelA === modelB) fail('a competitor cannot face itself');\n if (responseA.modelId !== modelA || responseB.modelId !== modelB) {\n fail('competitor response identity does not match its scheduled side');\n }\n\n let expectedWinner: string | null = null;\n let expectedOutcome: MatchResult['outcome'];\n if (responseA.success !== responseB.success) {\n expectedOutcome = 'forfeit';\n expectedWinner = responseA.success ? modelA : modelB;\n if (match.panel !== null) fail('forfeit must not contain a judge panel');\n } else if (!responseA.success && !responseB.success) {\n expectedOutcome = 'no-contest';\n if (match.panel !== null) fail('double failure must not contain a judge panel');\n } else {\n if (match.panel === null) fail('two successful responses require a judge panel');\n expectedWinner = verifyPanel(match.panel, modelA, modelB);\n expectedOutcome = expectedWinner ? 'judged' : 'no-contest';\n }\n\n if (match.outcome !== expectedOutcome) {\n fail(`outcome expected ${expectedOutcome}, found ${match.outcome}`);\n }\n if (match.winnerModelId !== expectedWinner) {\n fail(`winner expected ${expectedWinner ?? 'none'}, found ${match.winnerModelId ?? 'none'}`);\n }\n if (match.pointAwarded !== (expectedWinner !== null)) {\n fail(`pointAwarded must be ${expectedWinner !== null}`);\n }\n\n const judgeCost =\n match.panel?.votes.reduce((sum, vote) => sum + (vote.completion?.costUsd ?? 0), 0) ?? 0;\n equalNumber(\n match.matchCostUsd,\n competitorCost(responseA) + competitorCost(responseB) + judgeCost,\n 'matchCostUsd',\n );\n}\n\nfunction verifyManifest(\n match: MatchResult,\n manifest: RunManifest,\n category: BenchmarkCategory,\n): void {\n const hash = runManifestHash(manifest);\n if (match.runManifestHash !== hash) {\n fail(`run manifest hash expected ${hash}, found ${match.runManifestHash ?? '<missing>'}`);\n }\n if (match.runId !== runIdFromManifest(manifest)) {\n fail(`runId does not match the canonical run manifest`);\n }\n if (\n manifest.category !== category ||\n manifest.seed !== match.seed ||\n manifest.methodologyVersion !== match.methodologyVersion\n ) {\n fail('run manifest category, seed, or methodology does not match the journal line');\n }\n if (match.scheduleIndex >= manifest.matches) {\n fail(`scheduleIndex ${match.scheduleIndex} exceeds manifest match count ${manifest.matches}`);\n }\n const competitorIds = new Set(manifest.competitors.map((model) => model.id));\n if (\n !competitorIds.has(match.competitors.modelA) ||\n !competitorIds.has(match.competitors.modelB)\n ) {\n fail('journal competitor is absent from the run manifest');\n }\n const task = manifest.tasks.find((candidate) => candidate.id === match.task.id);\n if (\n !task ||\n task.version !== match.task.version ||\n task.publicHash !== match.task.publicHash ||\n task.privateHash !== match.task.privateHash\n ) {\n fail(`task ${match.task.id} does not match the run manifest`);\n }\n const judgeIds = new Set(manifest.judges.map((model) => model.id));\n for (const vote of match.panel?.votes ?? []) {\n if (!judgeIds.has(vote.judgeModelId)) {\n fail(`judge ${vote.judgeModelId} is absent from the run manifest`);\n }\n }\n}\n\nexport function verifyJournal(\n input: MatchResult[],\n category: BenchmarkCategory,\n options: VerificationOptions = {},\n): VerifiedJournal {\n const ratings: Record<string, number> = {};\n const points: Record<string, number> = {};\n const matches: MatchResult[] = [];\n const matchIds = new Set<string>();\n const runs = new Set<string>();\n const lastScheduleIndex = new Map<string, number>();\n const manifestHashes = new Map<string, string>();\n const warnings = new Set<string>();\n let methodologyVersion: string | null = null;\n\n for (const [offset, original] of input.entries()) {\n const line = offset + 1;\n try {\n if (!SUPPORTED_METHODOLOGY_VERSIONS.has(original.methodologyVersion)) {\n fail(`unsupported methodology version ${original.methodologyVersion}`);\n }\n methodologyVersion ??= original.methodologyVersion;\n if (methodologyVersion !== original.methodologyVersion) {\n fail(`mixed methodology versions ${methodologyVersion} and ${original.methodologyVersion}`);\n }\n const match: MatchResult = {\n ...original,\n task: {\n ...original.task,\n category: original.task.category ?? category,\n },\n };\n if (match.task.category !== category) {\n fail(`task category ${match.task.category} does not match ${category}`);\n }\n if (matchIds.has(match.matchId)) fail(`duplicate matchId ${match.matchId}`);\n matchIds.add(match.matchId);\n\n const previousIndex = lastScheduleIndex.get(match.runId);\n if (previousIndex !== undefined && match.scheduleIndex <= previousIndex) {\n fail(`scheduleIndex ${match.scheduleIndex} is not increasing within run ${match.runId}`);\n }\n lastScheduleIndex.set(match.runId, match.scheduleIndex);\n runs.add(match.runId);\n\n if (match.runManifestHash) {\n const priorHash = manifestHashes.get(match.runId);\n if (priorHash && priorHash !== match.runManifestHash) {\n fail(`run ${match.runId} references multiple manifest hashes`);\n }\n manifestHashes.set(match.runId, match.runManifestHash);\n const manifest = options.manifestForRun?.(match.runId) ?? null;\n if (manifest) {\n verifyManifest(match, manifest, category);\n } else if (options.requireManifests) {\n fail(`run manifest ${match.runId}.json is required but missing`);\n } else {\n warnings.add(`Run ${match.runId} references a manifest that was not supplied.`);\n }\n } else {\n warnings.add(`Run ${match.runId} is a legacy journal without a manifest hash.`);\n }\n\n verifyOutcome(match);\n const { modelA, modelB } = match.competitors;\n const ratingA = ratings[modelA] ?? ELO_INITIAL;\n const ratingB = ratings[modelB] ?? ELO_INITIAL;\n assertRecordKeys(match.eloBefore, [modelA, modelB], 'eloBefore');\n assertRecordKeys(match.eloAfter, [modelA, modelB], 'eloAfter');\n equalNumber(match.eloBefore[modelA], ratingA, `eloBefore.${modelA}`);\n equalNumber(match.eloBefore[modelB], ratingB, `eloBefore.${modelB}`);\n\n let nextA = ratingA;\n let nextB = ratingB;\n if (match.winnerModelId) {\n const update = applyEloWin(ratingA, ratingB, match.winnerModelId === modelA ? 'a' : 'b');\n nextA = update.ratingA;\n nextB = update.ratingB;\n points[match.winnerModelId] = (points[match.winnerModelId] ?? 0) + 1;\n }\n equalNumber(match.eloAfter[modelA], nextA, `eloAfter.${modelA}`);\n equalNumber(match.eloAfter[modelB], nextB, `eloAfter.${modelB}`);\n ratings[modelA] = nextA;\n ratings[modelB] = nextB;\n matches.push(match);\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(`Journal line ${line}: ${reason}`, { cause: error });\n }\n }\n\n return {\n category,\n methodologyVersion,\n matches,\n ratings,\n points,\n runs: [...runs],\n warnings: [...warnings],\n };\n}\n\nexport function verifiedEloState(matches: MatchResult[], category: BenchmarkCategory): EloState {\n const verified = verifyJournal(matches, category);\n return { ratings: verified.ratings, points: verified.points };\n}\n","import { ELO_INITIAL, ELO_K } from './elo.js';\nimport { getModel, listModels } from './models.js';\nimport {\n CATEGORY_META,\n METHODOLOGY_VERSION,\n competitorCost,\n type ArenaSnapshot,\n type BenchmarkCategory,\n type LeaderboardEntry,\n type MatchResult,\n} from './types.js';\nimport { verifyJournal, type VerificationOptions } from './verification.js';\n\nexport interface SnapshotOptions extends VerificationOptions {\n /** Seed empty standings with this run roster; defaults to every enabled competitor. */\n competitorIds?: readonly string[];\n}\n\nfunction round(value: number, digits = 2): number {\n return Number(value.toFixed(digits));\n}\n\nfunction emptyEntry(modelId: string, displayName: string): Omit<LeaderboardEntry, 'rank'> {\n return {\n modelId,\n displayName,\n elo: ELO_INITIAL,\n points: 0,\n wins: 0,\n losses: 0,\n forfeits: 0,\n matches: 0,\n winRate: 0,\n unanimousWins: 0,\n totalCostUsd: 0,\n byCluster: {},\n };\n}\n\nfunction ensureEntry(\n entries: Map<string, Omit<LeaderboardEntry, 'rank'>>,\n modelId: string,\n): Omit<LeaderboardEntry, 'rank'> {\n const existing = entries.get(modelId);\n if (existing) return existing;\n let displayName = modelId;\n try {\n displayName = getModel(modelId).displayName;\n } catch {\n // Historical journals remain readable after a model leaves the live roster.\n }\n const created = emptyEntry(modelId, displayName);\n entries.set(modelId, created);\n return created;\n}\n\nexport function buildSnapshot(\n matches: MatchResult[],\n category: BenchmarkCategory,\n options: SnapshotOptions = {},\n): ArenaSnapshot {\n const verified = verifyJournal(matches, category, options);\n const entries = new Map<string, Omit<LeaderboardEntry, 'rank'>>();\n const competitorIds = options.competitorIds ?? listModels('competitor').map((model) => model.id);\n for (const modelId of competitorIds) {\n ensureEntry(entries, modelId);\n }\n\n for (const match of verified.matches) {\n const modelA = ensureEntry(entries, match.competitors.modelA);\n const modelB = ensureEntry(entries, match.competitors.modelB);\n modelA.elo = match.eloAfter[modelA.modelId] ?? modelA.elo;\n modelB.elo = match.eloAfter[modelB.modelId] ?? modelB.elo;\n modelA.totalCostUsd += competitorCost(match.competitors.responseA);\n modelB.totalCostUsd += competitorCost(match.competitors.responseB);\n if (match.outcome === 'no-contest' || !match.winnerModelId) continue;\n modelA.matches += 1;\n modelB.matches += 1;\n const winner = ensureEntry(entries, match.winnerModelId);\n const loser = match.winnerModelId === modelA.modelId ? modelB : modelA;\n winner.points += 1;\n winner.wins += 1;\n loser.losses += 1;\n if (match.outcome === 'forfeit') loser.forfeits += 1;\n if (match.panel?.agreement === 'unanimous') winner.unanimousWins += 1;\n const cluster = match.task.cluster;\n winner.byCluster[cluster] = incrementCluster(winner.byCluster[cluster], 'wins');\n loser.byCluster[cluster] = incrementCluster(loser.byCluster[cluster], 'losses');\n }\n\n const leaderboard = [...entries.values()]\n .map((entry) => ({\n ...entry,\n elo: round(verified.ratings[entry.modelId] ?? ELO_INITIAL),\n winRate: entry.matches === 0 ? 0 : round((entry.wins / entry.matches) * 100, 1),\n totalCostUsd: round(entry.totalCostUsd, 6),\n }))\n .sort(\n (a, b) => b.elo - a.elo || b.points - a.points || a.displayName.localeCompare(b.displayName),\n )\n .map((entry, index) => ({ rank: index + 1, ...entry }));\n\n return {\n version: '0.2.0',\n methodologyVersion: verified.methodologyVersion ?? METHODOLOGY_VERSION,\n category,\n generatedAt: new Date().toISOString(),\n initialElo: ELO_INITIAL,\n kFactor: ELO_K,\n leaderboard,\n matches: verified.matches,\n };\n}\n\nfunction incrementCluster(\n current: { wins: number; losses: number } | undefined,\n field: 'wins' | 'losses',\n): { wins: number; losses: number } {\n const next = current ?? { wins: 0, losses: 0 };\n return { ...next, [field]: next[field] + 1 };\n}\n\nexport function renderMarkdown(snapshot: ArenaSnapshot): string {\n const meta = CATEGORY_META[snapshot.category];\n const modelNames = new Map(\n snapshot.leaderboard.map((entry) => [entry.modelId, entry.displayName]),\n );\n const rows = snapshot.leaderboard.map(\n (entry) =>\n `| ${entry.rank} | ${entry.displayName} | ${entry.elo.toFixed(2)} | ${entry.points} | ${entry.wins}-${entry.losses} | ${entry.forfeits} | ${entry.winRate.toFixed(1)}% | $${entry.totalCostUsd.toFixed(4)} |`,\n );\n const recent = snapshot.matches\n .slice(-20)\n .reverse()\n .map((match) => {\n const a = modelNames.get(match.competitors.modelA) ?? match.competitors.modelA;\n const b = modelNames.get(match.competitors.modelB) ?? match.competitors.modelB;\n const winner = match.winnerModelId\n ? (modelNames.get(match.winnerModelId) ?? match.winnerModelId)\n : 'No contest';\n return `| ${match.task.id} | ${a} vs ${b} | ${winner} | ${match.outcome} | $${match.matchCostUsd.toFixed(4)} |`;\n });\n return (\n `# BridgeBench V3 ${meta.label} Arena\\n\\n` +\n `${meta.tagline}\\n\\n` +\n `Generated ${snapshot.generatedAt}. Ratings start at ${snapshot.initialElo} with K=${snapshot.kFactor}.\\n\\n` +\n `## Leaderboard\\n\\n| Rank | Model | Elo | Points | W-L | Forfeits | Win rate | Competitor cost |\\n` +\n `|---:|---|---:|---:|---:|---:|---:|---:|\\n${rows.join('\\n')}\\n\\n` +\n `## Recent matches\\n\\n| Task | Matchup | Winner | Outcome | Total cost |\\n|---|---|---|---|---:|\\n` +\n `${recent.join('\\n') || '| — | — | — | — | — |'}\\n`\n );\n}\n\nexport function writeReports(\n store: {\n category: BenchmarkCategory;\n readAll(): MatchResult[];\n readRunManifest?(runId: string): import('./run-manifest.js').RunManifest | null;\n writeSnapshot(s: ArenaSnapshot): void;\n writeMarkdown(s: string): void;\n },\n options: SnapshotOptions = {},\n): ArenaSnapshot {\n const snapshot = buildSnapshot(store.readAll(), store.category, {\n ...options,\n manifestForRun: store.readRunManifest ? (runId) => store.readRunManifest!(runId) : undefined,\n requireManifests: Boolean(store.readRunManifest),\n });\n store.writeSnapshot(snapshot);\n store.writeMarkdown(renderMarkdown(snapshot));\n return snapshot;\n}\n","import { createHash } from 'node:crypto';\n\nimport {\n METHODOLOGY_VERSION,\n type ArenaTask,\n type BenchmarkCategory,\n type ScheduledMatch,\n} from './types.js';\n\nfunction hashSeed(seed: string): number {\n return Number.parseInt(createHash('sha256').update(seed).digest('hex').slice(0, 8), 16);\n}\n\nfunction mulberry32(seed: number): () => number {\n return () => {\n seed |= 0;\n seed = (seed + 0x6d2b79f5) | 0;\n let value = Math.imul(seed ^ (seed >>> 15), 1 | seed);\n value = (value + Math.imul(value ^ (value >>> 7), 61 | value)) ^ value;\n return ((value ^ (value >>> 14)) >>> 0) / 4_294_967_296;\n };\n}\n\nfunction stableId(parts: string[]): string {\n return createHash('sha256').update(parts.join('|')).digest('hex').slice(0, 20);\n}\n\ntype Candidate = { left: string; right: string; taskId: string };\ntype CandidateScore = readonly [\n maxModelExposure: number,\n totalModelExposure: number,\n taskExposure: number,\n pairExposure: number,\n];\n\nfunction pairKey(candidate: Pick<Candidate, 'left' | 'right'>): string {\n return `${candidate.left}|${candidate.right}`;\n}\n\nfunction candidateScore(\n candidate: Candidate,\n modelExposure: Map<string, number>,\n taskExposure: Map<string, number>,\n pairExposure: Map<string, number>,\n): CandidateScore {\n const left = modelExposure.get(candidate.left) ?? 0;\n const right = modelExposure.get(candidate.right) ?? 0;\n return [\n Math.max(left, right),\n left + right,\n taskExposure.get(candidate.taskId) ?? 0,\n pairExposure.get(pairKey(candidate)) ?? 0,\n ];\n}\n\nfunction compareScores(left: CandidateScore, right: CandidateScore): number {\n for (let index = 0; index < left.length; index += 1) {\n const difference = left[index]! - right[index]!;\n if (difference !== 0) return difference;\n }\n return 0;\n}\n\nexport function scheduleMatches(input: {\n category: BenchmarkCategory;\n seed: string;\n count: number;\n modelIds: string[];\n tasks: ArenaTask[];\n /** Production runs derive this from a versioned run manifest. */\n runId?: string;\n}): ScheduledMatch[] {\n if (!Number.isInteger(input.count) || input.count < 1)\n throw new Error('Match count must be a positive integer');\n if (input.modelIds.length < 2) throw new Error('At least two competitor models are required');\n if (new Set(input.modelIds).size !== input.modelIds.length)\n throw new Error('Competitor model IDs must be unique');\n const random = mulberry32(hashSeed(`${input.category}|${input.seed}`));\n const runId =\n input.runId ??\n `run-${stableId([\n METHODOLOGY_VERSION,\n input.category,\n input.seed,\n String(input.count),\n ...[...input.modelIds].sort(),\n ...input.tasks.map((task) => task.publicHash),\n ])}`;\n const modelExposure = new Map(input.modelIds.map((id) => [id, 0]));\n const taskExposure = new Map(input.tasks.map((task) => [task.public.id, 0]));\n const pairExposure = new Map<string, number>();\n const used = new Set<string>();\n const combinations: Candidate[] = [];\n\n for (let i = 0; i < input.modelIds.length; i += 1) {\n for (let j = i + 1; j < input.modelIds.length; j += 1) {\n for (const task of input.tasks) {\n combinations.push({\n left: input.modelIds[i]!,\n right: input.modelIds[j]!,\n taskId: task.public.id,\n });\n }\n }\n }\n\n const schedule: ScheduledMatch[] = [];\n for (let index = 0; index < input.count; index += 1) {\n if (used.size === combinations.length) used.clear();\n const candidates = combinations.filter(\n (candidate) => !used.has(`${candidate.left}|${candidate.right}|${candidate.taskId}`),\n );\n candidates.sort((left, right) =>\n compareScores(\n candidateScore(left, modelExposure, taskExposure, pairExposure),\n candidateScore(right, modelExposure, taskExposure, pairExposure),\n ),\n );\n const best = candidates[0]!;\n const bestScore = candidateScore(best, modelExposure, taskExposure, pairExposure);\n const tied = candidates.filter(\n (candidate) =>\n compareScores(\n candidateScore(candidate, modelExposure, taskExposure, pairExposure),\n bestScore,\n ) === 0,\n );\n const selected = tied[Math.floor(random() * tied.length)]!;\n used.add(`${selected.left}|${selected.right}|${selected.taskId}`);\n modelExposure.set(selected.left, modelExposure.get(selected.left)! + 1);\n modelExposure.set(selected.right, modelExposure.get(selected.right)! + 1);\n taskExposure.set(selected.taskId, taskExposure.get(selected.taskId)! + 1);\n const selectedPairKey = pairKey(selected);\n pairExposure.set(selectedPairKey, (pairExposure.get(selectedPairKey) ?? 0) + 1);\n const swap = random() >= 0.5;\n const modelA = swap ? selected.right : selected.left;\n const modelB = swap ? selected.left : selected.right;\n schedule.push({\n id: `match-${stableId([runId, String(index), selected.taskId, modelA, modelB])}`,\n runId,\n index,\n seed: input.seed,\n category: input.category,\n taskId: selected.taskId,\n modelA,\n modelB,\n });\n }\n return schedule;\n}\n","import type { CompetitorResponse, MatchResult } from './types.js';\n\n/**\n * A judged reasoning match at high effort that returns this fast almost always\n * means the task was too easy, the reasoning parameter was dropped, or the\n * request failed silently. Flag it either way — a human decides.\n */\nexport const FAST_RESPONSE_MS = 5_000;\nexport const LOW_OUTPUT_TOKENS = 150;\n\nexport interface TriageAnomaly {\n matchId: string;\n scheduleIndex: number;\n taskId: string;\n modelId: string | null;\n flag: string;\n detail: string;\n}\n\nexport interface ModelTriage {\n matches: number;\n failures: number;\n wins: number;\n avgLatencyMs: number | null;\n avgOutputTokens: number | null;\n reasoningReported: number;\n}\n\nexport interface RunTriage {\n runId: string;\n seed: string;\n firstTimestamp: string;\n matches: number;\n outcomes: { judged: number; forfeit: number; 'no-contest': number };\n totalCostUsd: number;\n errorClasses: Record<string, number>;\n models: Record<string, ModelTriage>;\n judge: {\n validVotes: number;\n abstentions: number;\n unanimous: number;\n split: number;\n avgConfidence: number | null;\n };\n anomalies: TriageAnomaly[];\n}\n\nexport function classifyError(message: string): string {\n if (/premature close|invalid response body/i.test(message)) return 'premature-close';\n if (/timed out|timeout|ETIMEDOUT/i.test(message)) return 'timeout';\n if (/429|rate.?limit/i.test(message)) return 'rate-limit';\n if (/5\\d\\d|overloaded/i.test(message)) return 'server-error';\n if (/401|403|unauthorized|forbidden/i.test(message)) return 'auth';\n if (/empty completion/i.test(message)) return 'empty-completion';\n return 'other';\n}\n\n/** Flags that make a single competitor response worth a second look. */\nexport function detectResponseAnomalies(response: CompetitorResponse): string[] {\n if (!response.success) return ['failed'];\n const flags: string[] = [];\n if (response.latencyMs < FAST_RESPONSE_MS) flags.push('fast-response');\n if (response.outputTokens < LOW_OUTPUT_TOKENS) flags.push('low-output');\n if (response.finishReason === 'length') flags.push('truncated');\n if (!response.reasoningTokens) flags.push('reasoning-unreported');\n if (response.costUsd === 0) flags.push('zero-cost');\n return flags;\n}\n\nfunction describeFlags(response: CompetitorResponse): string {\n if (!response.success) return response.error;\n return `${response.latencyMs}ms, ${response.outputTokens} output tokens, reasoning ${\n response.reasoningTokens ?? 'unreported'\n }, finish ${response.finishReason}, $${response.costUsd.toFixed(4)}`;\n}\n\nexport function triageJournal(results: MatchResult[]): RunTriage[] {\n const byRun = new Map<string, MatchResult[]>();\n for (const result of results) {\n const bucket = byRun.get(result.runId) ?? [];\n bucket.push(result);\n byRun.set(result.runId, bucket);\n }\n\n const reports: RunTriage[] = [];\n for (const [runId, runResults] of byRun) {\n const report: RunTriage = {\n runId,\n seed: runResults[0]!.seed,\n firstTimestamp: runResults[0]!.timestamp,\n matches: runResults.length,\n outcomes: { judged: 0, forfeit: 0, 'no-contest': 0 },\n totalCostUsd: 0,\n errorClasses: {},\n models: {},\n judge: { validVotes: 0, abstentions: 0, unanimous: 0, split: 0, avgConfidence: null },\n anomalies: [],\n };\n const confidences: number[] = [];\n\n for (const result of runResults) {\n report.outcomes[result.outcome] += 1;\n report.totalCostUsd += result.matchCostUsd;\n for (const response of [result.competitors.responseA, result.competitors.responseB]) {\n const model = (report.models[response.modelId] ??= {\n matches: 0,\n failures: 0,\n wins: 0,\n avgLatencyMs: null,\n avgOutputTokens: null,\n reasoningReported: 0,\n });\n model.matches += 1;\n if (!response.success) {\n model.failures += 1;\n const errorClass = classifyError(response.error ?? '');\n report.errorClasses[errorClass] = (report.errorClasses[errorClass] ?? 0) + 1;\n } else {\n model.avgLatencyMs =\n ((model.avgLatencyMs ?? 0) * (model.matches - model.failures - 1) +\n response.latencyMs) /\n (model.matches - model.failures);\n model.avgOutputTokens =\n ((model.avgOutputTokens ?? 0) * (model.matches - model.failures - 1) +\n response.outputTokens) /\n (model.matches - model.failures);\n if (response.reasoningTokens) model.reasoningReported += 1;\n }\n const flags = detectResponseAnomalies(response);\n for (const flag of flags) {\n report.anomalies.push({\n matchId: result.matchId,\n scheduleIndex: result.scheduleIndex,\n taskId: result.task.id,\n modelId: response.modelId,\n flag,\n detail: describeFlags(response),\n });\n }\n }\n if (result.winnerModelId && report.models[result.winnerModelId]) {\n report.models[result.winnerModelId]!.wins += 1;\n }\n if (result.panel) {\n if (result.panel.agreement === 'unanimous') report.judge.unanimous += 1;\n if (result.panel.agreement === 'split') report.judge.split += 1;\n for (const vote of result.panel.votes) {\n if (vote.verdict) {\n report.judge.validVotes += 1;\n confidences.push(vote.verdict.confidence);\n } else {\n report.judge.abstentions += 1;\n report.anomalies.push({\n matchId: result.matchId,\n scheduleIndex: result.scheduleIndex,\n taskId: result.task.id,\n modelId: vote.judgeModelId,\n flag: 'judge-abstained',\n detail: vote.error ?? 'no valid verdict',\n });\n }\n }\n }\n if (result.outcome === 'judged' && result.matchCostUsd === 0) {\n report.anomalies.push({\n matchId: result.matchId,\n scheduleIndex: result.scheduleIndex,\n taskId: result.task.id,\n modelId: null,\n flag: 'zero-cost-match',\n detail: 'judged match reported $0 total cost',\n });\n }\n }\n\n if (confidences.length > 0) {\n report.judge.avgConfidence =\n confidences.reduce((sum, value) => sum + value, 0) / confidences.length;\n }\n reports.push(report);\n }\n\n return reports.sort((left, right) => left.firstTimestamp.localeCompare(right.firstTimestamp));\n}\n\nconst HEALTH_ADVICE: Record<string, string> = {\n failed:\n 'Request failed — check the run log for the attempt-level error and whether retries were exhausted.',\n 'fast-response': `Response landed under ${FAST_RESPONSE_MS / 1_000}s — the task may be too easy for this model, or reasoning effort was not applied.`,\n 'low-output': `Fewer than ${LOW_OUTPUT_TOKENS} output tokens — likely a shallow answer; consider hardening the task.`,\n truncated: 'finish_reason=length — raise maxTokens or shorten the prompt.',\n 'reasoning-unreported':\n 'Provider reported no reasoning tokens — verify the reasoning parameter reaches the model (arena generation <id>).',\n 'zero-cost': 'Zero cost on a successful response — usage accounting may be broken.',\n 'zero-cost-match': 'A judged match with $0 spend means usage accounting is broken end to end.',\n 'judge-abstained':\n 'A judge returned no valid structured verdict twice — inspect judge.verdict-parse-failed entries in the run log.',\n};\n\nexport function formatTriage(reports: RunTriage[]): string {\n const lines: string[] = [];\n for (const report of reports) {\n lines.push(`run ${report.runId} (seed \"${report.seed}\", ${report.firstTimestamp})`);\n lines.push(\n ` matches ${report.matches} | judged ${report.outcomes.judged}, forfeit ${report.outcomes.forfeit}, no-contest ${report.outcomes['no-contest']} | spend $${report.totalCostUsd.toFixed(4)}`,\n );\n if (Object.keys(report.errorClasses).length > 0) {\n lines.push(\n ` request failures: ${Object.entries(report.errorClasses)\n .map(([errorClass, count]) => `${errorClass}×${count}`)\n .join(', ')}`,\n );\n }\n lines.push(\n ` judges: ${report.judge.validVotes} valid votes, ${report.judge.abstentions} abstentions, ${report.judge.unanimous} unanimous / ${report.judge.split} split panels` +\n (report.judge.avgConfidence === null\n ? ''\n : `, avg confidence ${report.judge.avgConfidence.toFixed(2)}`),\n );\n for (const [modelId, model] of Object.entries(report.models)) {\n const latency = model.avgLatencyMs === null ? '—' : `${Math.round(model.avgLatencyMs)}ms`;\n const tokens =\n model.avgOutputTokens === null ? '—' : `${Math.round(model.avgOutputTokens)} tok`;\n lines.push(\n ` ${modelId.padEnd(30)} matches ${model.matches}, wins ${model.wins}, failures ${model.failures}, avg ${latency} / ${tokens}, reasoning reported ${model.reasoningReported}/${model.matches - model.failures}`,\n );\n }\n if (report.anomalies.length === 0) {\n lines.push(' no anomalies detected');\n } else {\n lines.push(` anomalies (${report.anomalies.length}):`);\n const byFlag = new Map<string, TriageAnomaly[]>();\n for (const anomaly of report.anomalies) {\n const bucket = byFlag.get(anomaly.flag) ?? [];\n bucket.push(anomaly);\n byFlag.set(anomaly.flag, bucket);\n }\n for (const [flag, anomalies] of byFlag) {\n lines.push(` ${flag} ×${anomalies.length} — ${HEALTH_ADVICE[flag] ?? ''}`);\n for (const anomaly of anomalies.slice(0, 4)) {\n lines.push(\n ` [${anomaly.scheduleIndex}] ${anomaly.taskId} ${anomaly.modelId ?? ''}: ${anomaly.detail.slice(0, 140)}`,\n );\n }\n if (anomalies.length > 4) lines.push(` … ${anomalies.length - 4} more`);\n }\n }\n lines.push('');\n }\n return lines.join('\\n');\n}\n","import { applyEloWin, ELO_INITIAL } from './elo.js';\nimport { JudgePanel } from './judges.js';\nimport { noopLogger, type ArenaLogger } from './logger.js';\nimport {\n ArenaCancellationError,\n isArenaCancellationError,\n throwIfCancelled,\n} from './cancellation.js';\nimport { getModel, listModels, resolveCompetitorRoster } from './models.js';\nimport { sanitizeError } from './openrouter.js';\nimport { writeReports } from './report.js';\nimport { createRunManifest, runIdFromManifest, runManifestHash } from './run-manifest.js';\nimport { scheduleMatches } from './scheduler.js';\nimport { ArenaStore } from './store.js';\nimport { buildCompetitorPrompt } from './tasks.js';\nimport { detectResponseAnomalies } from './triage.js';\nimport {\n METHODOLOGY_VERSION,\n competitorCost,\n competitorOutputTokens,\n competitorReasoningTokens,\n type ArenaExecutionOptions,\n type ArenaEventInput,\n type ArenaEventSink,\n type ArenaRunConfig,\n type ArenaRunResult,\n type CompleteArenaTask,\n type CompetitorFailure,\n type CompetitorResponse,\n type MatchResult,\n type ModelRegistryEntry,\n type OpenRouterGateway,\n type ScheduledMatch,\n} from './types.js';\n\n/** Matches with at least one failed response at or past this rate halt the run. */\nconst HEALTH_STOP_MIN_MATCHES = 4;\nconst HEALTH_STOP_FAILURE_RATE = 0.5;\n\ninterface RunProgress {\n costUsd: number;\n completed: number;\n matchesWithFailures: number;\n stoppedForBudget: boolean;\n}\n\ninterface PreparedRun {\n runId: string;\n manifestHash: string;\n competitors: ModelRegistryEntry[];\n schedule: ScheduledMatch[];\n tasksById: Map<string, CompleteArenaTask>;\n completedIds: Set<string>;\n progress: RunProgress;\n}\n\nfunction failedResponse(modelId: string, error: unknown, latencyMs: number): CompetitorFailure {\n return {\n modelId,\n success: false,\n error: sanitizeError(error),\n latencyMs,\n };\n}\n\nexport class ArenaRunner {\n private readonly judges: JudgePanel;\n private readonly logger: ArenaLogger;\n\n constructor(\n private readonly gateway: OpenRouterGateway,\n private readonly store: ArenaStore,\n private readonly onEvent?: ArenaEventSink,\n logger: ArenaLogger = noopLogger,\n ) {\n this.logger = logger;\n this.judges = new JudgePanel(gateway, onEvent, logger);\n }\n\n private emit(event: ArenaEventInput): void {\n this.onEvent?.({ ...event, timestamp: new Date().toISOString() });\n }\n\n private observeCancellation(\n runId: string,\n progress: RunProgress,\n signal?: AbortSignal,\n ): { requested: () => void; dispose: () => void } {\n let emitted = false;\n const requested = (): void => {\n if (emitted) return;\n emitted = true;\n this.logger.info('run.cancellation-requested', {\n runId,\n completed: progress.completed,\n costUsd: progress.costUsd,\n });\n this.emit({\n id: `${runId}-cancellation-requested`,\n type: 'run.cancellation-requested',\n data: {\n runId,\n completed: progress.completed,\n costUsd: progress.costUsd,\n },\n });\n };\n\n if (signal?.aborted) requested();\n else signal?.addEventListener('abort', requested, { once: true });\n\n return {\n requested,\n dispose: () => signal?.removeEventListener('abort', requested),\n };\n }\n\n private cancelRun(runId: string, progress: RunProgress): ArenaRunResult {\n this.logger.info('run.cancelled', {\n runId,\n completed: progress.completed,\n costUsd: progress.costUsd,\n });\n this.emit({\n id: `${runId}-cancelled`,\n type: 'run.cancelled',\n data: {\n runId,\n completed: progress.completed,\n costUsd: progress.costUsd,\n },\n });\n return {\n runId,\n completed: progress.completed,\n costUsd: progress.costUsd,\n stoppedForBudget: progress.stoppedForBudget,\n cancelled: true,\n };\n }\n\n private async prepareRun(\n config: ArenaRunConfig,\n tasks: CompleteArenaTask[],\n signal?: AbortSignal,\n ): Promise<PreparedRun> {\n const competitors = resolveCompetitorRoster(config.competitorIds);\n const competitorIds = competitors.map((model) => model.id);\n const mismatched = tasks.filter((task) => task.public.category !== config.category);\n if (mismatched.length > 0) {\n throw new Error(\n `Run category ${config.category} received tasks from another arena: ${mismatched.map((task) => task.public.id).join(', ')}`,\n );\n }\n\n const journal = this.store.readAll();\n const incompatible = journal.find((match) => match.methodologyVersion !== METHODOLOGY_VERSION);\n if (incompatible) {\n throw new Error(\n `Cannot append ${METHODOLOGY_VERSION} matches to a ${incompatible.methodologyVersion} journal; archive it and start a new journal`,\n );\n }\n // Fail before model validation or paid work if any existing line is invalid.\n this.store.rebuildEloState(competitorIds);\n\n const manifest = createRunManifest(config, tasks, competitors);\n const manifestHash = runManifestHash(manifest);\n const runId = runIdFromManifest(manifest);\n const schedule = scheduleMatches({\n category: config.category,\n seed: config.seed,\n count: config.matches,\n modelIds: competitorIds,\n tasks,\n runId,\n });\n const existing = journal.filter((result) => result.runId === runId);\n const prepared: PreparedRun = {\n runId,\n manifestHash,\n competitors,\n schedule,\n tasksById: new Map(tasks.map((task) => [task.public.id, task])),\n completedIds: new Set(journal.map((result) => result.matchId)),\n progress: {\n costUsd: existing.reduce((sum, result) => sum + result.matchCostUsd, 0),\n completed: 0,\n matchesWithFailures: 0,\n stoppedForBudget: false,\n },\n };\n\n if (signal?.aborted) return prepared;\n try {\n await Promise.all(\n [...competitors, ...listModels('judge')].map((model) =>\n this.gateway.validateModel(model, signal),\n ),\n );\n } catch (error) {\n if (signal?.aborted) return prepared;\n throw error;\n }\n if (signal?.aborted) return prepared;\n this.store.writeRunManifest(runId, manifest);\n return prepared;\n }\n\n async run(\n config: ArenaRunConfig,\n tasks: CompleteArenaTask[],\n execution: ArenaExecutionOptions = {},\n ): Promise<ArenaRunResult> {\n const { signal, onMatchResult } = execution;\n const { runId, manifestHash, competitors, schedule, tasksById, completedIds, progress } =\n await this.prepareRun(config, tasks, signal);\n const competitorIds = competitors.map((model) => model.id);\n const cancellation = this.observeCancellation(runId, progress, signal);\n\n try {\n if (signal?.aborted) return this.cancelRun(runId, progress);\n\n this.logger.info('run.started', {\n runId,\n category: config.category,\n seed: config.seed,\n matches: config.matches,\n maxCostUsd: config.maxCostUsd,\n resume: config.resume,\n healthStop: config.healthStop !== false,\n competitorIds,\n });\n this.emit({\n id: `${runId}-started`,\n type: 'run.started',\n data: {\n runId,\n category: config.category,\n seed: config.seed,\n matches: config.matches,\n maxCostUsd: config.maxCostUsd,\n competitorIds,\n },\n });\n\n for (const match of schedule) {\n if (signal?.aborted) return this.cancelRun(runId, progress);\n if (completedIds.has(match.id)) {\n if (config.resume) continue;\n throw new Error(\n `Match ${match.id} is already journaled; rerun with --resume or choose a new seed`,\n );\n }\n if (progress.costUsd >= config.maxCostUsd) {\n progress.stoppedForBudget = true;\n this.emit({\n id: `${match.runId}-budget-stopped`,\n type: 'run.budget-stopped',\n data: {\n runId: match.runId,\n completed: progress.completed,\n costUsd: progress.costUsd,\n maxCostUsd: config.maxCostUsd,\n },\n });\n break;\n }\n const task = tasksById.get(match.taskId);\n if (!task) throw new Error(`Scheduled task not found: ${match.taskId}`);\n this.emit({\n id: `${match.id}-started`,\n type: 'match.started',\n data: {\n matchId: match.id,\n index: match.index,\n total: schedule.length,\n category: match.category,\n taskId: match.taskId,\n taskTitle: task.public.title,\n modelA: match.modelA,\n modelB: match.modelB,\n },\n });\n let result: MatchResult;\n try {\n result = await this.runMatch(match, task, manifestHash, competitorIds, signal);\n } catch (error) {\n if (signal?.aborted || isArenaCancellationError(error)) {\n cancellation.requested();\n return this.cancelRun(runId, progress);\n }\n throw error;\n }\n if (signal?.aborted) return this.cancelRun(runId, progress);\n this.store.append(result);\n writeReports(this.store, { competitorIds });\n progress.costUsd += result.matchCostUsd;\n progress.completed += 1;\n if (!result.competitors.responseA.success || !result.competitors.responseB.success) {\n progress.matchesWithFailures += 1;\n }\n this.emit({\n id: `${match.id}-completed`,\n type: 'match.completed',\n data: {\n matchId: match.id,\n taskId: match.taskId,\n winnerModelId: result.winnerModelId,\n outcome: result.outcome,\n costUsd: result.matchCostUsd,\n eloAfter: result.eloAfter,\n completed: progress.completed,\n total: schedule.length,\n },\n });\n if (onMatchResult) await onMatchResult(result);\n if (signal?.aborted) return this.cancelRun(runId, progress);\n if (\n config.healthStop !== false &&\n progress.completed >= HEALTH_STOP_MIN_MATCHES &&\n progress.matchesWithFailures / progress.completed >= HEALTH_STOP_FAILURE_RATE\n ) {\n this.logger.error('run.health-stopped', {\n runId,\n completed: progress.completed,\n matchesWithFailures: progress.matchesWithFailures,\n failureRate: progress.matchesWithFailures / progress.completed,\n });\n throw new Error(\n `Run halted after ${progress.completed} matches: ${progress.matchesWithFailures} had failed competitor responses. ` +\n `The provider path is unhealthy, so continuing would journal junk matches. ` +\n `Inspect the run log${this.logger.filePath ? ` at ${this.logger.filePath}` : ''}, fix the cause, ` +\n `then rerun with --resume (or pass --no-health-stop to override).`,\n );\n }\n }\n\n if (signal?.aborted) return this.cancelRun(runId, progress);\n writeReports(this.store, { competitorIds });\n this.logger.info('run.completed', {\n runId,\n completed: progress.completed,\n matchesWithFailures: progress.matchesWithFailures,\n costUsd: progress.costUsd,\n stoppedForBudget: progress.stoppedForBudget,\n cancelled: false,\n });\n this.emit({\n id: `${runId}-completed`,\n type: 'run.completed',\n data: {\n runId,\n completed: progress.completed,\n costUsd: progress.costUsd,\n stoppedForBudget: progress.stoppedForBudget,\n },\n });\n return {\n runId,\n completed: progress.completed,\n costUsd: progress.costUsd,\n stoppedForBudget: progress.stoppedForBudget,\n cancelled: false,\n };\n } finally {\n cancellation.dispose();\n }\n }\n\n private async runMatch(\n match: ScheduledMatch,\n task: CompleteArenaTask,\n manifestHash: string,\n competitorIds: readonly string[],\n signal?: AbortSignal,\n ): Promise<MatchResult> {\n throwIfCancelled(signal);\n const state = this.store.rebuildEloState(competitorIds);\n const prompt = buildCompetitorPrompt(task);\n const [responseA, responseB] = await Promise.all([\n this.runCompetitor(match, 'A', prompt, signal),\n this.runCompetitor(match, 'B', prompt, signal),\n ]);\n throwIfCancelled(signal);\n this.inspectResponse(match, responseA);\n this.inspectResponse(match, responseB);\n this.emit({\n id: `${match.id}-competitors-completed`,\n type: 'competitors.completed',\n data: {\n matchId: match.id,\n modelA: {\n success: responseA.success,\n latencyMs: responseA.latencyMs,\n costUsd: competitorCost(responseA),\n outputTokens: competitorOutputTokens(responseA),\n reasoningTokens: competitorReasoningTokens(responseA) ?? null,\n },\n modelB: {\n success: responseB.success,\n latencyMs: responseB.latencyMs,\n costUsd: competitorCost(responseB),\n outputTokens: competitorOutputTokens(responseB),\n reasoningTokens: competitorReasoningTokens(responseB) ?? null,\n },\n },\n });\n throwIfCancelled(signal);\n const eloBefore = {\n [match.modelA]: state.ratings[match.modelA] ?? ELO_INITIAL,\n [match.modelB]: state.ratings[match.modelB] ?? ELO_INITIAL,\n };\n const eloAfter = { ...eloBefore };\n let outcome: MatchResult['outcome'] = 'no-contest';\n let winnerModelId: string | null = null;\n let panel: MatchResult['panel'] = null;\n\n if (responseA.success !== responseB.success) {\n outcome = 'forfeit';\n winnerModelId = responseA.success ? match.modelA : match.modelB;\n } else if (responseA.success && responseB.success) {\n this.emit({\n id: `${match.id}-judging-started`,\n type: 'judging.started',\n data: { matchId: match.id, judges: listModels('judge').map((model) => model.id) },\n });\n panel = await this.judges.judge({ match, task, responseA, responseB }, signal);\n throwIfCancelled(signal);\n if (panel.winnerModelId) {\n outcome = 'judged';\n winnerModelId = panel.winnerModelId;\n }\n }\n\n if (winnerModelId) {\n const update = applyEloWin(\n eloBefore[match.modelA]!,\n eloBefore[match.modelB]!,\n winnerModelId === match.modelA ? 'a' : 'b',\n );\n eloAfter[match.modelA] = update.ratingA;\n eloAfter[match.modelB] = update.ratingB;\n }\n\n const judgeCost =\n panel?.votes.reduce((sum, vote) => sum + (vote.completion?.costUsd ?? 0), 0) ?? 0;\n return {\n methodologyVersion: METHODOLOGY_VERSION,\n runId: match.runId,\n runManifestHash: manifestHash,\n matchId: match.id,\n scheduleIndex: match.index,\n seed: match.seed,\n timestamp: new Date().toISOString(),\n task: {\n id: task.public.id,\n version: task.public.version,\n category: task.public.category,\n cluster: task.public.cluster,\n publicHash: task.publicHash,\n privateHash: task.privateHash,\n },\n competitors: { modelA: match.modelA, modelB: match.modelB, responseA, responseB },\n outcome,\n winnerModelId,\n panel,\n eloBefore,\n eloAfter,\n pointAwarded: winnerModelId !== null,\n matchCostUsd: competitorCost(responseA) + competitorCost(responseB) + judgeCost,\n };\n }\n\n /** Surface signals that make a journaled response untrustworthy or a task too easy. */\n private inspectResponse(match: ScheduledMatch, response: CompetitorResponse): void {\n if (!response.success) {\n this.logger.warn('competitor.failed', {\n matchId: match.id,\n taskId: match.taskId,\n modelId: response.modelId,\n latencyMs: response.latencyMs,\n error: response.error ?? 'unknown',\n });\n return;\n }\n const flags = detectResponseAnomalies(response);\n if (flags.length > 0) {\n this.logger.warn('competitor.suspicious', {\n matchId: match.id,\n taskId: match.taskId,\n modelId: response.modelId,\n flags,\n latencyMs: response.latencyMs,\n outputTokens: response.outputTokens,\n reasoningTokens: response.reasoningTokens ?? null,\n costUsd: response.costUsd,\n finishReason: response.finishReason,\n });\n }\n }\n\n private async runCompetitor(\n match: ScheduledMatch,\n side: 'A' | 'B',\n prompt: { system: string; user: string },\n signal?: AbortSignal,\n ): Promise<CompetitorResponse> {\n const modelId = side === 'A' ? match.modelA : match.modelB;\n const startedAt = Date.now();\n let sequence = 0;\n const emitDelta = (text: string, done: boolean, success = true): void => {\n sequence += 1;\n this.emit({\n id: `${match.id}-delta-${side}-${sequence}`,\n type: 'competitor.delta',\n data: { matchId: match.id, modelId, side, text, done, success },\n });\n };\n try {\n throwIfCancelled(signal);\n const completion = await this.gateway.complete({\n model: getModel(modelId),\n ...prompt,\n signal,\n onDelta: (text) => emitDelta(text, false),\n });\n throwIfCancelled(signal);\n emitDelta(completion.content, true);\n return { modelId, success: true, ...completion };\n } catch (error) {\n if (signal?.aborted || isArenaCancellationError(error)) {\n throw new ArenaCancellationError();\n }\n const failed = failedResponse(modelId, error, Date.now() - startedAt);\n emitDelta(failed.error, true, false);\n return failed;\n }\n }\n}\n","import { judgeVerdictJsonSchema } from './openrouter-transport.js';\nimport type {\n ChatRequest,\n ModelCompletion,\n ModelRegistryEntry,\n OpenRouterGateway,\n} from './types.js';\n\nexport interface MockOpenRouterOptions {\n competitorText?: string;\n judgeWinner?: 'MODEL_A' | 'MODEL_B';\n chunkDelayMs?: number;\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nfunction baseCompletion(content: string, generationId: string): ModelCompletion {\n return {\n generationId,\n content,\n inputTokens: 120,\n outputTokens: Math.max(1, Math.ceil(content.length / 4)),\n costUsd: 0.02,\n latencyMs: 250,\n finishReason: 'stop',\n attempts: 1,\n };\n}\n\nexport class MockOpenRouterGateway implements OpenRouterGateway {\n constructor(private readonly options: MockOpenRouterOptions = {}) {}\n\n async validateModel(_model: ModelRegistryEntry): Promise<void> {}\n\n async complete(request: ChatRequest): Promise<ModelCompletion> {\n if (request.signal?.aborted) {\n throw new Error('Mock completion aborted');\n }\n\n if (request.structured) {\n const winner = this.options.judgeWinner ?? 'MODEL_A';\n const payload = {\n winner,\n confidence: 0.9,\n rationale: 'The selected mock response is better grounded.',\n criteria: {\n correctness: 'Correct.',\n grounding: 'Grounded.',\n constraintHandling: 'Complete.',\n completeness: 'Complete.',\n },\n violations: [],\n };\n void judgeVerdictJsonSchema();\n return baseCompletion(JSON.stringify(payload), `mock-judge-${request.model.id}`);\n }\n\n const variantA = [\n `The terminal state follows the cancellation edge before retry exhaustion.`,\n `The journal records a cancel-requested transition before the final attempt window closed, which rules out budget-stop and health-stop.`,\n `The discriminating evidence is the cancellation timestamp preceding the last retry.`,\n ];\n const variantB = [\n `Working backwards from the final journal entry, the run ends on the cancellation path rather than retry exhaustion.`,\n `Spend stayed below the budget threshold and no health probes failed in the window, so those edges are excluded.`,\n `The single strongest signal is the cancel-requested event landing before the retry counter reached its limit.`,\n ];\n const checksum = [...request.model.id].reduce((sum, ch) => sum + ch.charCodeAt(0), 0);\n const text =\n this.options.competitorText ?? (checksum % 2 === 0 ? variantA : variantB).join(' ');\n const delayMs =\n Number(process.env.MOCK_CHUNK_DELAY_MS ?? '') || this.options.chunkDelayMs || 40;\n const parts = text.match(/.{1,24}/g) ?? [text];\n let cumulative = '';\n for (const part of parts) {\n if (request.signal?.aborted) {\n throw new Error('Mock completion aborted');\n }\n cumulative += part;\n request.onDelta?.(cumulative);\n if (delayMs > 0) await sleep(delayMs);\n }\n return baseCompletion(cumulative, `mock-competitor-${request.model.id}`);\n }\n}\n","import {\n appendFileSync,\n existsSync,\n mkdirSync,\n readFileSync,\n renameSync,\n writeFileSync,\n} from 'node:fs';\nimport path from 'node:path';\n\nimport { ELO_INITIAL } from './elo.js';\nimport { listModels } from './models.js';\nimport { canonicalJson, RunManifestSchema, type RunManifest } from './run-manifest.js';\nimport {\n MatchResultSchema,\n type ArenaSnapshot,\n type BenchmarkCategory,\n type EloState,\n type MatchResult,\n} from './types.js';\nimport { verifyJournal } from './verification.js';\n\nexport interface ArenaStoreConfig {\n category: BenchmarkCategory;\n journalPath: string;\n snapshotPath: string;\n markdownPath: string;\n runsDir?: string;\n /** Skip directory creation for read-only verification of external journals. */\n readOnly?: boolean;\n}\n\n/** Each category gets its own results directory — its own journal, Elo ladder, and reports. */\nexport function categoryStoreConfig(\n category: BenchmarkCategory,\n resultsRoot = process.env.BRIDGEBENCH_RESULTS_DIR,\n): ArenaStoreConfig {\n // Results are operator output, so they anchor to the working directory —\n // never to the package root, which is node_modules/ when installed.\n const base = resultsRoot\n ? path.resolve(process.cwd(), resultsRoot)\n : path.join(process.cwd(), 'results');\n const root = path.join(base, category);\n return {\n category,\n journalPath: path.join(root, 'journal.jsonl'),\n snapshotPath: path.join(root, 'snapshot.json'),\n markdownPath: path.join(root, 'leaderboard.md'),\n runsDir: path.join(root, 'runs'),\n };\n}\n\nexport class ArenaStore {\n constructor(readonly config: ArenaStoreConfig) {\n if (config.readOnly) return;\n for (const file of [config.journalPath, config.snapshotPath, config.markdownPath]) {\n mkdirSync(path.dirname(file), { recursive: true });\n }\n mkdirSync(this.runsDir, { recursive: true });\n }\n\n get category(): BenchmarkCategory {\n return this.config.category;\n }\n\n get runsDir(): string {\n return this.config.runsDir ?? path.join(path.dirname(this.config.journalPath), 'runs');\n }\n\n append(result: MatchResult): void {\n appendFileSync(this.config.journalPath, `${JSON.stringify(result)}\\n`, {\n encoding: 'utf8',\n mode: 0o600,\n });\n }\n\n readAll(): MatchResult[] {\n if (!existsSync(this.config.journalPath)) return [];\n return readFileSync(this.config.journalPath, 'utf8')\n .split('\\n')\n .filter(Boolean)\n .map((line, index) => {\n let decoded: unknown;\n try {\n decoded = JSON.parse(line);\n } catch {\n throw new Error(`Malformed arena journal line ${index + 1}; refusing to continue`);\n }\n const parsed = MatchResultSchema.safeParse(decoded);\n if (!parsed.success) {\n const issue = parsed.error.issues[0];\n const location = issue?.path.length ? ` at ${issue.path.join('.')}` : '';\n throw new Error(\n `Invalid arena journal line ${index + 1}${location}: ${issue?.message ?? 'schema mismatch'}`,\n );\n }\n return parsed.data;\n });\n }\n\n writeRunManifest(runId: string, manifest: RunManifest): void {\n const validated = RunManifestSchema.parse(manifest);\n const target = path.join(this.runsDir, `${runId}.json`);\n const content = `${canonicalJson(validated)}\\n`;\n if (existsSync(target)) {\n const existing = readFileSync(target, 'utf8');\n if (existing !== content) {\n throw new Error(`Run manifest ${runId} already exists with different inputs`);\n }\n return;\n }\n this.atomicWrite(target, content);\n }\n\n readRunManifest(runId: string): RunManifest | null {\n const target = path.join(this.runsDir, `${runId}.json`);\n if (!existsSync(target)) return null;\n try {\n return RunManifestSchema.parse(JSON.parse(readFileSync(target, 'utf8')));\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(`Invalid run manifest ${runId}: ${reason}`, { cause: error });\n }\n }\n\n completedMatchIds(): Set<string> {\n return new Set(this.readAll().map((result) => result.matchId));\n }\n\n rebuildEloState(\n competitorIds: readonly string[] = listModels('competitor').map((model) => model.id),\n ): EloState {\n const ratings = Object.fromEntries(competitorIds.map((modelId) => [modelId, ELO_INITIAL]));\n const points = Object.fromEntries(competitorIds.map((modelId) => [modelId, 0]));\n const verified = verifyJournal(this.readAll(), this.category, {\n manifestForRun: (runId) => this.readRunManifest(runId),\n requireManifests: true,\n });\n Object.assign(ratings, verified.ratings);\n Object.assign(points, verified.points);\n return { ratings, points };\n }\n\n writeSnapshot(snapshot: ArenaSnapshot): void {\n this.atomicWrite(this.config.snapshotPath, `${JSON.stringify(snapshot, null, 2)}\\n`);\n }\n\n writeMarkdown(markdown: string): void {\n this.atomicWrite(this.config.markdownPath, markdown);\n }\n\n private atomicWrite(target: string, content: string): void {\n const temporary = `${target}.tmp`;\n writeFileSync(temporary, content, { encoding: 'utf8', mode: 0o600 });\n renameSync(temporary, target);\n }\n}\n"]}
@@ -0,0 +1,244 @@
1
+ // src/contracts/categories.ts
2
+ import { z } from "zod";
3
+ var METHODOLOGY_VERSION = "arena-v0.3.0";
4
+ var BenchmarkCategorySchema = z.enum(["reasoning", "hallucination"]);
5
+ var CATEGORIES = BenchmarkCategorySchema.options;
6
+ var CATEGORY_CLUSTERS = {
7
+ reasoning: [
8
+ "stateful-execution",
9
+ "constraint-reconciliation",
10
+ "root-cause-reasoning",
11
+ "multi-artifact-synthesis",
12
+ "formal-counterexample",
13
+ "uncertainty-adversarial"
14
+ ],
15
+ hallucination: [
16
+ "false-premise",
17
+ "missing-evidence",
18
+ "entity-fabrication",
19
+ "knowledge-boundary",
20
+ "conflicting-sources",
21
+ "citation-fidelity"
22
+ ]
23
+ };
24
+ var CATEGORY_META = {
25
+ reasoning: {
26
+ label: "Reasoning",
27
+ tagline: "Every task is fully determinable from its artifacts \u2014 the arena measures who derives the one defensible resolution."
28
+ },
29
+ hallucination: {
30
+ label: "Hallucination",
31
+ tagline: "Tasks are seeded with false premises, missing evidence, and fabrication bait \u2014 the arena measures who stays grounded instead of inventing."
32
+ }
33
+ };
34
+
35
+ // src/contracts/journal.ts
36
+ import { z as z3 } from "zod";
37
+
38
+ // src/contracts/models.ts
39
+ import { z as z2 } from "zod";
40
+ var ModelRoleSchema = z2.enum(["competitor", "judge"]);
41
+ var ModelCompletionSchema = z2.object({
42
+ generationId: z2.string(),
43
+ content: z2.string(),
44
+ inputTokens: z2.number().finite().nonnegative(),
45
+ outputTokens: z2.number().finite().nonnegative(),
46
+ reasoningTokens: z2.number().finite().nonnegative().optional(),
47
+ costUsd: z2.number().finite().nonnegative(),
48
+ latencyMs: z2.number().finite().nonnegative(),
49
+ finishReason: z2.string(),
50
+ attempts: z2.number().int().positive().optional()
51
+ });
52
+
53
+ // src/contracts/journal.ts
54
+ var CompetitorSuccessSchema = ModelCompletionSchema.extend({
55
+ modelId: z3.string().min(1),
56
+ success: z3.literal(true)
57
+ });
58
+ var CompetitorFailureSchema = z3.object({
59
+ modelId: z3.string().min(1),
60
+ success: z3.literal(false),
61
+ error: z3.string().min(1),
62
+ latencyMs: z3.number().finite().nonnegative(),
63
+ attempts: z3.number().int().positive().optional()
64
+ });
65
+ var LegacyCompetitorFailureSchema = z3.object({
66
+ modelId: z3.string().min(1),
67
+ success: z3.literal(false),
68
+ error: z3.string().min(1),
69
+ generationId: z3.string(),
70
+ content: z3.string(),
71
+ inputTokens: z3.number().finite().nonnegative(),
72
+ outputTokens: z3.number().finite().nonnegative(),
73
+ reasoningTokens: z3.number().finite().nonnegative().optional(),
74
+ costUsd: z3.number().finite().nonnegative(),
75
+ latencyMs: z3.number().finite().nonnegative(),
76
+ finishReason: z3.string(),
77
+ attempts: z3.number().int().positive().optional()
78
+ }).transform(({ modelId, error, latencyMs, attempts }) => ({
79
+ modelId,
80
+ success: false,
81
+ error,
82
+ latencyMs,
83
+ ...attempts === void 0 ? {} : { attempts }
84
+ }));
85
+ var CompetitorResponseSchema = z3.union([
86
+ CompetitorSuccessSchema,
87
+ CompetitorFailureSchema,
88
+ LegacyCompetitorFailureSchema
89
+ ]);
90
+ var JudgeVerdictSchema = z3.object({
91
+ winner: z3.enum(["MODEL_A", "MODEL_B"]),
92
+ confidence: z3.number().min(0).max(1),
93
+ rationale: z3.string().min(1).max(4e3),
94
+ criteria: z3.object({
95
+ correctness: z3.string().min(1).max(1e3),
96
+ grounding: z3.string().min(1).max(1e3),
97
+ constraintHandling: z3.string().min(1).max(1e3),
98
+ completeness: z3.string().min(1).max(1e3)
99
+ }),
100
+ violations: z3.array(z3.string().max(500)).max(20)
101
+ });
102
+ var JUDGE_VERDICT_TRANSPORT_SCHEMA = {
103
+ type: "object",
104
+ additionalProperties: false,
105
+ required: ["winner", "confidence", "rationale", "criteria", "violations"],
106
+ properties: {
107
+ winner: { type: "string", enum: ["MODEL_A", "MODEL_B"] },
108
+ confidence: { type: "number", minimum: 0, maximum: 1 },
109
+ rationale: { type: "string" },
110
+ criteria: {
111
+ type: "object",
112
+ additionalProperties: false,
113
+ required: ["correctness", "grounding", "constraintHandling", "completeness"],
114
+ properties: {
115
+ correctness: { type: "string" },
116
+ grounding: { type: "string" },
117
+ constraintHandling: { type: "string" },
118
+ completeness: { type: "string" }
119
+ }
120
+ },
121
+ violations: { type: "array", items: { type: "string" } }
122
+ }
123
+ };
124
+ var NumericRecordSchema = z3.record(z3.number().finite());
125
+ var JudgeVoteSchema = z3.object({
126
+ judgeModelId: z3.string().min(1),
127
+ modelAIdentity: z3.string().min(1),
128
+ modelBIdentity: z3.string().min(1),
129
+ verdict: JudgeVerdictSchema.nullable(),
130
+ winnerModelId: z3.string().min(1).nullable(),
131
+ completion: ModelCompletionSchema.nullable(),
132
+ error: z3.string().optional()
133
+ });
134
+ var PanelDecisionSchema = z3.object({
135
+ winnerModelId: z3.string().min(1).nullable(),
136
+ validVotes: z3.number().int().nonnegative(),
137
+ votesByModel: NumericRecordSchema,
138
+ agreement: z3.enum(["unanimous", "split", "insufficient"]),
139
+ votes: z3.array(JudgeVoteSchema)
140
+ });
141
+ var MatchResultSchema = z3.object({
142
+ methodologyVersion: z3.string().min(1),
143
+ runId: z3.string().min(1),
144
+ runManifestHash: z3.string().regex(/^[a-f0-9]{64}$/).optional(),
145
+ matchId: z3.string().min(1),
146
+ scheduleIndex: z3.number().int().nonnegative(),
147
+ seed: z3.string(),
148
+ timestamp: z3.string().datetime(),
149
+ task: z3.object({
150
+ id: z3.string().min(1),
151
+ version: z3.string().min(1),
152
+ category: BenchmarkCategorySchema.optional(),
153
+ cluster: z3.string().min(1),
154
+ publicHash: z3.string().min(1),
155
+ privateHash: z3.string().min(1)
156
+ }),
157
+ competitors: z3.object({
158
+ modelA: z3.string().min(1),
159
+ modelB: z3.string().min(1),
160
+ responseA: CompetitorResponseSchema,
161
+ responseB: CompetitorResponseSchema
162
+ }),
163
+ outcome: z3.enum(["judged", "forfeit", "no-contest"]),
164
+ winnerModelId: z3.string().min(1).nullable(),
165
+ panel: PanelDecisionSchema.nullable(),
166
+ eloBefore: NumericRecordSchema,
167
+ eloAfter: NumericRecordSchema,
168
+ pointAwarded: z3.boolean(),
169
+ matchCostUsd: z3.number().finite().nonnegative()
170
+ });
171
+ function competitorCost(response) {
172
+ return response.success ? response.costUsd : 0;
173
+ }
174
+ function competitorOutputTokens(response) {
175
+ return response.success ? response.outputTokens : 0;
176
+ }
177
+ function competitorReasoningTokens(response) {
178
+ return response.success ? response.reasoningTokens : void 0;
179
+ }
180
+ function competitorContent(response) {
181
+ return response.success ? response.content : "";
182
+ }
183
+
184
+ // src/contracts/tasks.ts
185
+ import { z as z4 } from "zod";
186
+ var TaskArtifactSchema = z4.object({
187
+ id: z4.string().min(1).max(80),
188
+ type: z4.enum(["code", "log", "config", "spec", "diff", "table", "note"]),
189
+ label: z4.string().min(1).max(160),
190
+ content: z4.string().min(1).max(4e4)
191
+ }).strict();
192
+ var TaskPublicSchema = z4.object({
193
+ id: z4.string().regex(/^[a-z0-9][a-z0-9-]{2,79}$/),
194
+ version: z4.string().regex(/^\d+\.\d+\.\d+$/),
195
+ category: BenchmarkCategorySchema,
196
+ cluster: z4.string().min(1).max(60),
197
+ difficulty: z4.enum(["hard", "expert"]),
198
+ title: z4.string().min(1).max(180),
199
+ summary: z4.string().min(1).max(500),
200
+ prompt: z4.string().min(1).max(1e4),
201
+ artifacts: z4.array(TaskArtifactSchema).min(1).max(20),
202
+ tags: z4.array(z4.string().min(1).max(60)).default([])
203
+ }).strict();
204
+ var TaskPrivateSchema = z4.object({
205
+ id: z4.string().min(1),
206
+ version: z4.string().min(1),
207
+ expectedResolution: z4.string().min(1).max(1e4),
208
+ requiredEvidence: z4.array(z4.string().min(1)).min(1),
209
+ disqualifyingErrors: z4.array(z4.string().min(1)).default([]),
210
+ rubric: z4.object({
211
+ correctness: z4.string().min(1),
212
+ evidenceGrounding: z4.string().min(1),
213
+ constraintHandling: z4.string().min(1),
214
+ completeness: z4.string().min(1)
215
+ }).strict()
216
+ }).strict();
217
+
218
+ // src/contracts/index.ts
219
+ var CONTRACTS_VERSION = "1.0.0";
220
+
221
+ export {
222
+ METHODOLOGY_VERSION,
223
+ BenchmarkCategorySchema,
224
+ CATEGORIES,
225
+ CATEGORY_CLUSTERS,
226
+ CATEGORY_META,
227
+ ModelRoleSchema,
228
+ ModelCompletionSchema,
229
+ CompetitorResponseSchema,
230
+ JudgeVerdictSchema,
231
+ JUDGE_VERDICT_TRANSPORT_SCHEMA,
232
+ JudgeVoteSchema,
233
+ PanelDecisionSchema,
234
+ MatchResultSchema,
235
+ competitorCost,
236
+ competitorOutputTokens,
237
+ competitorReasoningTokens,
238
+ competitorContent,
239
+ TaskArtifactSchema,
240
+ TaskPublicSchema,
241
+ TaskPrivateSchema,
242
+ CONTRACTS_VERSION
243
+ };
244
+ //# sourceMappingURL=chunk-UECBSKTD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/contracts/categories.ts","../src/contracts/journal.ts","../src/contracts/models.ts","../src/contracts/tasks.ts","../src/contracts/index.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const METHODOLOGY_VERSION = 'arena-v0.3.0';\n\nexport const BenchmarkCategorySchema = z.enum(['reasoning', 'hallucination']);\nexport type BenchmarkCategory = z.infer<typeof BenchmarkCategorySchema>;\nexport const CATEGORIES = BenchmarkCategorySchema.options;\n\nexport const CATEGORY_CLUSTERS: Record<BenchmarkCategory, readonly string[]> = {\n reasoning: [\n 'stateful-execution',\n 'constraint-reconciliation',\n 'root-cause-reasoning',\n 'multi-artifact-synthesis',\n 'formal-counterexample',\n 'uncertainty-adversarial',\n ],\n hallucination: [\n 'false-premise',\n 'missing-evidence',\n 'entity-fabrication',\n 'knowledge-boundary',\n 'conflicting-sources',\n 'citation-fidelity',\n ],\n};\n\nexport const CATEGORY_META: Record<BenchmarkCategory, { label: string; tagline: string }> = {\n reasoning: {\n label: 'Reasoning',\n tagline:\n 'Every task is fully determinable from its artifacts — the arena measures who derives the one defensible resolution.',\n },\n hallucination: {\n label: 'Hallucination',\n tagline:\n 'Tasks are seeded with false premises, missing evidence, and fabrication bait — the arena measures who stays grounded instead of inventing.',\n },\n};\n","import { z } from 'zod';\n\nimport { BenchmarkCategorySchema, type BenchmarkCategory } from './categories.js';\nimport { ModelCompletionSchema, type ModelCompletion } from './models.js';\n\nexport interface ArenaRunConfig {\n category: BenchmarkCategory;\n seed: string;\n matches: number;\n maxCostUsd: number;\n resume: boolean;\n /** Omit to use every enabled competitor in the registry. */\n competitorIds?: readonly string[];\n /** Abort early when most matches contain a failed response. */\n healthStop?: boolean;\n}\n\nexport interface ArenaExecutionOptions {\n /** Execution-only cancellation; deliberately excluded from the canonical manifest. */\n signal?: AbortSignal;\n /**\n * Invoked after each match result is journaled, before the next match\n * starts. Used to publish results incrementally instead of only at run end.\n * Must not throw; handle and log failures internally.\n */\n onMatchResult?: (result: MatchResult) => Promise<void> | void;\n}\n\nexport interface ArenaRunResult {\n runId: string;\n completed: number;\n costUsd: number;\n stoppedForBudget: boolean;\n cancelled: boolean;\n}\n\nexport interface ScheduledMatch {\n id: string;\n runId: string;\n index: number;\n seed: string;\n category: BenchmarkCategory;\n taskId: string;\n modelA: string;\n modelB: string;\n}\n\nconst CompetitorSuccessSchema = ModelCompletionSchema.extend({\n modelId: z.string().min(1),\n success: z.literal(true),\n});\nexport type CompetitorSuccess = z.infer<typeof CompetitorSuccessSchema>;\n\nconst CompetitorFailureSchema = z.object({\n modelId: z.string().min(1),\n success: z.literal(false),\n error: z.string().min(1),\n latencyMs: z.number().finite().nonnegative(),\n attempts: z.number().int().positive().optional(),\n});\nexport type CompetitorFailure = z.infer<typeof CompetitorFailureSchema>;\n\nconst LegacyCompetitorFailureSchema = z\n .object({\n modelId: z.string().min(1),\n success: z.literal(false),\n error: z.string().min(1),\n generationId: z.string(),\n content: z.string(),\n inputTokens: z.number().finite().nonnegative(),\n outputTokens: z.number().finite().nonnegative(),\n reasoningTokens: z.number().finite().nonnegative().optional(),\n costUsd: z.number().finite().nonnegative(),\n latencyMs: z.number().finite().nonnegative(),\n finishReason: z.string(),\n attempts: z.number().int().positive().optional(),\n })\n .transform(({ modelId, error, latencyMs, attempts }) => ({\n modelId,\n success: false as const,\n error,\n latencyMs,\n ...(attempts === undefined ? {} : { attempts }),\n }));\n\nexport type CompetitorResponse = CompetitorSuccess | CompetitorFailure;\nexport const CompetitorResponseSchema: z.ZodType<CompetitorResponse> = z.union([\n CompetitorSuccessSchema,\n CompetitorFailureSchema,\n LegacyCompetitorFailureSchema,\n]);\n\nexport const JudgeVerdictSchema = z.object({\n winner: z.enum(['MODEL_A', 'MODEL_B']),\n confidence: z.number().min(0).max(1),\n rationale: z.string().min(1).max(4_000),\n criteria: z.object({\n correctness: z.string().min(1).max(1_000),\n grounding: z.string().min(1).max(1_000),\n constraintHandling: z.string().min(1).max(1_000),\n completeness: z.string().min(1).max(1_000),\n }),\n violations: z.array(z.string().max(500)).max(20),\n});\nexport type JudgeVerdict = z.infer<typeof JudgeVerdictSchema>;\n\n/**\n * Provider-safe JSON Schema subset generated from the same verdict shape.\n * Runtime Zod parsing above enforces the local string and array limits.\n */\nexport const JUDGE_VERDICT_TRANSPORT_SCHEMA = {\n type: 'object',\n additionalProperties: false,\n required: ['winner', 'confidence', 'rationale', 'criteria', 'violations'],\n properties: {\n winner: { type: 'string', enum: ['MODEL_A', 'MODEL_B'] },\n confidence: { type: 'number', minimum: 0, maximum: 1 },\n rationale: { type: 'string' },\n criteria: {\n type: 'object',\n additionalProperties: false,\n required: ['correctness', 'grounding', 'constraintHandling', 'completeness'],\n properties: {\n correctness: { type: 'string' },\n grounding: { type: 'string' },\n constraintHandling: { type: 'string' },\n completeness: { type: 'string' },\n },\n },\n violations: { type: 'array', items: { type: 'string' } },\n },\n} as const;\n\nexport interface JudgeVote {\n judgeModelId: string;\n modelAIdentity: string;\n modelBIdentity: string;\n verdict: JudgeVerdict | null;\n winnerModelId: string | null;\n completion: ModelCompletion | null;\n error?: string;\n}\n\nexport interface PanelDecision {\n winnerModelId: string | null;\n validVotes: number;\n votesByModel: Record<string, number>;\n agreement: 'unanimous' | 'split' | 'insufficient';\n votes: JudgeVote[];\n}\n\nexport interface EloState {\n ratings: Record<string, number>;\n points: Record<string, number>;\n}\n\nexport interface MatchResult {\n methodologyVersion: string;\n runId: string;\n /** Absent on legacy journal lines written before run manifests. */\n runManifestHash?: string;\n matchId: string;\n scheduleIndex: number;\n seed: string;\n timestamp: string;\n task: {\n id: string;\n version: string;\n /** Absent on reasoning-only legacy lines. */\n category?: BenchmarkCategory;\n cluster: string;\n publicHash: string;\n privateHash: string;\n };\n competitors: {\n modelA: string;\n modelB: string;\n responseA: CompetitorResponse;\n responseB: CompetitorResponse;\n };\n outcome: 'judged' | 'forfeit' | 'no-contest';\n winnerModelId: string | null;\n panel: PanelDecision | null;\n eloBefore: Record<string, number>;\n eloAfter: Record<string, number>;\n pointAwarded: boolean;\n matchCostUsd: number;\n}\n\nconst NumericRecordSchema = z.record(z.number().finite());\n\nexport const JudgeVoteSchema: z.ZodType<JudgeVote> = z.object({\n judgeModelId: z.string().min(1),\n modelAIdentity: z.string().min(1),\n modelBIdentity: z.string().min(1),\n verdict: JudgeVerdictSchema.nullable(),\n winnerModelId: z.string().min(1).nullable(),\n completion: ModelCompletionSchema.nullable(),\n error: z.string().optional(),\n});\n\nexport const PanelDecisionSchema: z.ZodType<PanelDecision> = z.object({\n winnerModelId: z.string().min(1).nullable(),\n validVotes: z.number().int().nonnegative(),\n votesByModel: NumericRecordSchema,\n agreement: z.enum(['unanimous', 'split', 'insufficient']),\n votes: z.array(JudgeVoteSchema),\n});\n\nexport const MatchResultSchema: z.ZodType<MatchResult> = z.object({\n methodologyVersion: z.string().min(1),\n runId: z.string().min(1),\n runManifestHash: z\n .string()\n .regex(/^[a-f0-9]{64}$/)\n .optional(),\n matchId: z.string().min(1),\n scheduleIndex: z.number().int().nonnegative(),\n seed: z.string(),\n timestamp: z.string().datetime(),\n task: z.object({\n id: z.string().min(1),\n version: z.string().min(1),\n category: BenchmarkCategorySchema.optional(),\n cluster: z.string().min(1),\n publicHash: z.string().min(1),\n privateHash: z.string().min(1),\n }),\n competitors: z.object({\n modelA: z.string().min(1),\n modelB: z.string().min(1),\n responseA: CompetitorResponseSchema,\n responseB: CompetitorResponseSchema,\n }),\n outcome: z.enum(['judged', 'forfeit', 'no-contest']),\n winnerModelId: z.string().min(1).nullable(),\n panel: PanelDecisionSchema.nullable(),\n eloBefore: NumericRecordSchema,\n eloAfter: NumericRecordSchema,\n pointAwarded: z.boolean(),\n matchCostUsd: z.number().finite().nonnegative(),\n});\n\nexport function competitorCost(response: CompetitorResponse): number {\n return response.success ? response.costUsd : 0;\n}\n\nexport function competitorOutputTokens(response: CompetitorResponse): number {\n return response.success ? response.outputTokens : 0;\n}\n\nexport function competitorReasoningTokens(response: CompetitorResponse): number | undefined {\n return response.success ? response.reasoningTokens : undefined;\n}\n\nexport function competitorContent(response: CompetitorResponse): string {\n return response.success ? response.content : '';\n}\n","import { z } from 'zod';\n\nexport const ModelRoleSchema = z.enum(['competitor', 'judge']);\nexport type ModelRole = z.infer<typeof ModelRoleSchema>;\n\nexport interface ModelRequestPolicy {\n maxTokens: number;\n temperature: number;\n reasoningEffort: 'high' | 'medium' | 'low';\n excludeReasoning: boolean;\n timeoutMs: number;\n}\n\nexport interface ModelRegistryEntry {\n id: string;\n canonicalSlug: string;\n displayName: string;\n vendor: string;\n role: ModelRole;\n enabled: boolean;\n request: ModelRequestPolicy;\n}\n\nexport const ModelCompletionSchema = z.object({\n generationId: z.string(),\n content: z.string(),\n inputTokens: z.number().finite().nonnegative(),\n outputTokens: z.number().finite().nonnegative(),\n reasoningTokens: z.number().finite().nonnegative().optional(),\n costUsd: z.number().finite().nonnegative(),\n latencyMs: z.number().finite().nonnegative(),\n finishReason: z.string(),\n attempts: z.number().int().positive().optional(),\n});\nexport type ModelCompletion = z.infer<typeof ModelCompletionSchema>;\n\nexport interface ChatRequest {\n model: ModelRegistryEntry;\n system: string;\n user: string;\n structured?: boolean;\n /** Execution-only cancellation; never serialized into a run manifest or provider payload. */\n signal?: AbortSignal;\n /** Called with the accumulated visible text as it streams in (throttled). */\n onDelta?: (text: string) => void;\n}\n\nexport interface OpenRouterGateway {\n complete(request: ChatRequest): Promise<ModelCompletion>;\n validateModel(model: ModelRegistryEntry, signal?: AbortSignal): Promise<void>;\n}\n","import { z } from 'zod';\n\nimport { BenchmarkCategorySchema } from './categories.js';\n\nexport const TaskArtifactSchema = z\n .object({\n id: z.string().min(1).max(80),\n type: z.enum(['code', 'log', 'config', 'spec', 'diff', 'table', 'note']),\n label: z.string().min(1).max(160),\n content: z.string().min(1).max(40_000),\n })\n .strict();\nexport type TaskArtifact = z.infer<typeof TaskArtifactSchema>;\n\nexport const TaskPublicSchema = z\n .object({\n id: z.string().regex(/^[a-z0-9][a-z0-9-]{2,79}$/),\n version: z.string().regex(/^\\d+\\.\\d+\\.\\d+$/),\n category: BenchmarkCategorySchema,\n cluster: z.string().min(1).max(60),\n difficulty: z.enum(['hard', 'expert']),\n title: z.string().min(1).max(180),\n summary: z.string().min(1).max(500),\n prompt: z.string().min(1).max(10_000),\n artifacts: z.array(TaskArtifactSchema).min(1).max(20),\n tags: z.array(z.string().min(1).max(60)).default([]),\n })\n .strict();\nexport type TaskPublic = z.infer<typeof TaskPublicSchema>;\n\nexport const TaskPrivateSchema = z\n .object({\n id: z.string().min(1),\n version: z.string().min(1),\n expectedResolution: z.string().min(1).max(10_000),\n requiredEvidence: z.array(z.string().min(1)).min(1),\n disqualifyingErrors: z.array(z.string().min(1)).default([]),\n rubric: z\n .object({\n correctness: z.string().min(1),\n evidenceGrounding: z.string().min(1),\n constraintHandling: z.string().min(1),\n completeness: z.string().min(1),\n })\n .strict(),\n })\n .strict();\nexport type TaskPrivate = z.infer<typeof TaskPrivateSchema>;\n\nexport interface ArenaTask {\n public: TaskPublic;\n /** Null when loaded without a private overlay. */\n private: TaskPrivate | null;\n publicHash: string;\n privateHash: string | null;\n}\n\n/** A task whose hidden reference is present — required for judged matches. */\nexport type CompleteArenaTask = ArenaTask & {\n private: TaskPrivate;\n privateHash: string;\n};\n","/**\n * Public BridgeBench arena contract version.\n *\n * Increment this when an exported contract changes incompatibly. The entry\n * point intentionally exports contracts only; it has no arena-runner or\n * provider implementation dependency.\n */\nexport const CONTRACTS_VERSION = '1.0.0' as const;\n\nexport * from './categories.js';\nexport * from './events.js';\nexport * from './journal.js';\nexport * from './models.js';\nexport * from './reports.js';\nexport * from './tasks.js';\n"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,sBAAsB;AAE5B,IAAM,0BAA0B,EAAE,KAAK,CAAC,aAAa,eAAe,CAAC;AAErE,IAAM,aAAa,wBAAwB;AAE3C,IAAM,oBAAkE;AAAA,EAC7E,WAAW;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,IAAM,gBAA+E;AAAA,EAC1F,WAAW;AAAA,IACT,OAAO;AAAA,IACP,SACE;AAAA,EACJ;AAAA,EACA,eAAe;AAAA,IACb,OAAO;AAAA,IACP,SACE;AAAA,EACJ;AACF;;;ACtCA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,KAAAC,UAAS;AAEX,IAAM,kBAAkBA,GAAE,KAAK,CAAC,cAAc,OAAO,CAAC;AAqBtD,IAAM,wBAAwBA,GAAE,OAAO;AAAA,EAC5C,cAAcA,GAAE,OAAO;AAAA,EACvB,SAASA,GAAE,OAAO;AAAA,EAClB,aAAaA,GAAE,OAAO,EAAE,OAAO,EAAE,YAAY;AAAA,EAC7C,cAAcA,GAAE,OAAO,EAAE,OAAO,EAAE,YAAY;AAAA,EAC9C,iBAAiBA,GAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS;AAAA,EAC5D,SAASA,GAAE,OAAO,EAAE,OAAO,EAAE,YAAY;AAAA,EACzC,WAAWA,GAAE,OAAO,EAAE,OAAO,EAAE,YAAY;AAAA,EAC3C,cAAcA,GAAE,OAAO;AAAA,EACvB,UAAUA,GAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AACjD,CAAC;;;ADcD,IAAM,0BAA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