@tangle-network/agent-eval 0.217.1 → 0.218.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/dist/adapters/http.d.ts +2 -2
  3. package/dist/analyst/index.d.ts +1 -1
  4. package/dist/analyst/index.d.ts.map +1 -1
  5. package/dist/analyst/index.js +9 -9
  6. package/dist/analyst/index.js.map +1 -1
  7. package/dist/{analyze-runs-DyeNcenW.d.ts → analyze-runs-DjlZOVXx.d.ts} +2 -2
  8. package/dist/{analyze-runs-DyeNcenW.d.ts.map → analyze-runs-DjlZOVXx.d.ts.map} +1 -1
  9. package/dist/{benchmark-command-xQK8nOI6.js → benchmark-command-BupdHRyf.js} +661 -562
  10. package/dist/benchmark-command-BupdHRyf.js.map +1 -0
  11. package/dist/benchmarks/index.d.ts +4 -4
  12. package/dist/benchmarks/index.js +3 -3
  13. package/dist/campaign/index.d.ts +4 -4
  14. package/dist/campaign/index.js +10 -10
  15. package/dist/{campaign-CJGkxAQ6.js → campaign-CGvUTnmc.js} +312 -281
  16. package/dist/{campaign-CJGkxAQ6.js.map → campaign-CGvUTnmc.js.map} +1 -1
  17. package/dist/{campaign-evidence-CQYw8_0H.js → campaign-evidence-DunzcJGv.js} +2 -2
  18. package/dist/{campaign-evidence-CQYw8_0H.js.map → campaign-evidence-DunzcJGv.js.map} +1 -1
  19. package/dist/{chat-client-ldqxYYTN.js → chat-client-B2pXlPdx.js} +2 -2
  20. package/dist/{chat-client-ldqxYYTN.js.map → chat-client-B2pXlPdx.js.map} +1 -1
  21. package/dist/{chat-json-call-DavzexSp.js → chat-json-call-Dm9c-b41.js} +2 -2
  22. package/dist/{chat-json-call-DavzexSp.js.map → chat-json-call-Dm9c-b41.js.map} +1 -1
  23. package/dist/cli.js +10 -10
  24. package/dist/{completion-verifier-B_jw6C9p.js → completion-verifier-DbLVf3i8.js} +4 -4
  25. package/dist/{completion-verifier-B_jw6C9p.js.map → completion-verifier-DbLVf3i8.js.map} +1 -1
  26. package/dist/contract/index.d.ts +7 -7
  27. package/dist/contract/index.js +90 -10
  28. package/dist/contract/index.js.map +1 -1
  29. package/dist/{default-registry-ClYjq3QE.js → default-registry-BJ-Pq6yL.js} +309 -277
  30. package/dist/{default-registry-ClYjq3QE.js.map → default-registry-BJ-Pq6yL.js.map} +1 -1
  31. package/dist/{define-agent-eval-BDxNlP3D.js → define-agent-eval-BGdFKlrc.js} +165 -105
  32. package/dist/define-agent-eval-BGdFKlrc.js.map +1 -0
  33. package/dist/{define-agent-eval-BIkH_gAR.d.ts → define-agent-eval-BlH10zEw.d.ts} +6 -6
  34. package/dist/{define-agent-eval-BIkH_gAR.d.ts.map → define-agent-eval-BlH10zEw.d.ts.map} +1 -1
  35. package/dist/diagnosis/index.d.ts +1 -1
  36. package/dist/{dspy-rlm-engine-DhdCr1Dc.js → dspy-rlm-engine-CSMwudLO.js} +2 -2
  37. package/dist/{dspy-rlm-engine-DhdCr1Dc.js.map → dspy-rlm-engine-CSMwudLO.js.map} +1 -1
  38. package/dist/eval-campaign-BUMIxKTE.js +393 -0
  39. package/dist/eval-campaign-BUMIxKTE.js.map +1 -0
  40. package/dist/{evaluation-jTjC_QQD.d.ts → evaluation-BOZ38vOH.d.ts} +2 -2
  41. package/dist/{evaluation-jTjC_QQD.d.ts.map → evaluation-BOZ38vOH.d.ts.map} +1 -1
  42. package/dist/evaluation.d.ts +1 -1
  43. package/dist/experiment/index.d.ts +1 -1
  44. package/dist/experiment/index.d.ts.map +1 -1
  45. package/dist/experiment/index.js +110 -71
  46. package/dist/experiment/index.js.map +1 -1
  47. package/dist/{exporters-Cl6IeNAu.js → exporters-DWvM16LE.js} +2 -2
  48. package/dist/{exporters-Cl6IeNAu.js.map → exporters-DWvM16LE.js.map} +1 -1
  49. package/dist/{external-optimizer-process-KVFGvYX1.js → external-optimizer-process-C3Wm7Vhn.js} +2 -2
  50. package/dist/{external-optimizer-process-KVFGvYX1.js.map → external-optimizer-process-C3Wm7Vhn.js.map} +1 -1
  51. package/dist/{external-optimizer-subprocess-XIHBOSKt.js → external-optimizer-subprocess-B5gdLRZv.js} +3 -3
  52. package/dist/{external-optimizer-subprocess-XIHBOSKt.js.map → external-optimizer-subprocess-B5gdLRZv.js.map} +1 -1
  53. package/dist/{findings-store-BMVQtEsm.js → findings-store-BtTzPL0d.js} +5 -5
  54. package/dist/{findings-store-BMVQtEsm.js.map → findings-store-BtTzPL0d.js.map} +1 -1
  55. package/dist/{hf-dataset-D9f7-oX7.js → hf-dataset-CKxIJQba.js} +3 -3
  56. package/dist/{hf-dataset-D9f7-oX7.js.map → hf-dataset-CKxIJQba.js.map} +1 -1
  57. package/dist/hosted/index.js +1 -1
  58. package/dist/{index-ZuWx52WG.d.ts → index-B16FNdW5.d.ts} +34 -17
  59. package/dist/index-B16FNdW5.d.ts.map +1 -0
  60. package/dist/{index-9jJ2fKSX.d.ts → index-CalAsXMR.d.ts} +7 -5
  61. package/dist/index-CalAsXMR.d.ts.map +1 -0
  62. package/dist/{index-BiT6RtNH.d.ts → index-DbMOXYnP.d.ts} +6 -6
  63. package/dist/{index-BiT6RtNH.d.ts.map → index-DbMOXYnP.d.ts.map} +1 -1
  64. package/dist/index.d.ts +9 -9
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +611 -688
  67. package/dist/index.js.map +1 -1
  68. package/dist/{integrity-DOd9Q86O.js → integrity-C8oUeB0g.js} +322 -197
  69. package/dist/integrity-C8oUeB0g.js.map +1 -0
  70. package/dist/{journal-CR4QikYp.js → journal-C7om8Gum.js} +48 -38
  71. package/dist/journal-C7om8Gum.js.map +1 -0
  72. package/dist/ledger-core/index.d.ts +1 -1
  73. package/dist/ledger-core/index.js +2 -2
  74. package/dist/ledger-core/lock-holder.d.ts +2 -0
  75. package/dist/ledger-core/lock-holder.js +181 -0
  76. package/dist/ledger-core/lock-holder.js.map +1 -0
  77. package/dist/{ledger-core-DrJhbms9.js → ledger-core-CAxUdDk0.js} +2 -2
  78. package/dist/{ledger-core-DrJhbms9.js.map → ledger-core-CAxUdDk0.js.map} +1 -1
  79. package/dist/{llm-client-BshCREn6.js → llm-client-_Y6ic-tf.js} +238 -248
  80. package/dist/llm-client-_Y6ic-tf.js.map +1 -0
  81. package/dist/{llm-judge-C8jMTNNG.js → llm-judge-Djxh-Uhs.js} +646 -458
  82. package/dist/llm-judge-Djxh-Uhs.js.map +1 -0
  83. package/dist/lock-holder-DaJbfpci.d.ts +86 -0
  84. package/dist/lock-holder-DaJbfpci.d.ts.map +1 -0
  85. package/dist/{matrix-DHe-dwVJ.d.ts → matrix-CCSBna4q.d.ts} +2 -2
  86. package/dist/{matrix-DHe-dwVJ.d.ts.map → matrix-CCSBna4q.d.ts.map} +1 -1
  87. package/dist/{mint-zszyYlpA.js → mint-CbdwjTPW.js} +2 -2
  88. package/dist/{mint-zszyYlpA.js.map → mint-CbdwjTPW.js.map} +1 -1
  89. package/dist/multishot/golden/index.d.ts +1 -1
  90. package/dist/multishot/index.d.ts +2 -2
  91. package/dist/openapi.json +1 -1
  92. package/dist/{pareto-BzsxidFD.js → pareto-CTv8vozZ.js} +4 -4
  93. package/dist/{pareto-BzsxidFD.js.map → pareto-CTv8vozZ.js.map} +1 -1
  94. package/dist/{promotion-gate-DaY95yU6.d.ts → promotion-gate-CxEHRsZW.d.ts} +2 -2
  95. package/dist/{promotion-gate-DaY95yU6.d.ts.map → promotion-gate-CxEHRsZW.d.ts.map} +1 -1
  96. package/dist/{proposal-findings-BbWidvUk.js → proposal-findings-n-5WBbEx.js} +2 -2
  97. package/dist/{proposal-findings-BbWidvUk.js.map → proposal-findings-n-5WBbEx.js.map} +1 -1
  98. package/dist/{render-C-w2EZ6p.js → render-Cs34y0iX.js} +404 -208
  99. package/dist/render-Cs34y0iX.js.map +1 -0
  100. package/dist/reporting.d.ts +2 -2
  101. package/dist/{researcher-0ABVIdGa.d.ts → researcher-GU1tV4dn.d.ts} +2 -2
  102. package/dist/{researcher-0ABVIdGa.d.ts.map → researcher-GU1tV4dn.d.ts.map} +1 -1
  103. package/dist/rl.d.ts +2 -2
  104. package/dist/rl.js +4 -4
  105. package/dist/rollout/index.js +5 -5
  106. package/dist/{rollout-D6C50mfA.js → rollout-Dd1ucT_M.js} +5 -5
  107. package/dist/{rollout-D6C50mfA.js.map → rollout-Dd1ucT_M.js.map} +1 -1
  108. package/dist/schema-C-ziyJD7.d.ts.map +1 -1
  109. package/dist/{schema-DxcKTzbi.js → schema-CvhfLjtZ.js} +77 -47
  110. package/dist/schema-CvhfLjtZ.js.map +1 -0
  111. package/dist/search/index.d.ts +2 -2
  112. package/dist/search/index.d.ts.map +1 -1
  113. package/dist/search/index.js +2 -2
  114. package/dist/{search-kernel-DxqjBxA-.d.ts → search-kernel-p9JB3SmL.d.ts} +3 -3
  115. package/dist/{search-kernel-DxqjBxA-.d.ts.map → search-kernel-p9JB3SmL.d.ts.map} +1 -1
  116. package/dist/{search-ledger-TUvB5gWH.js → search-ledger-ClpN4I3e.js} +4 -4
  117. package/dist/{search-ledger-TUvB5gWH.js.map → search-ledger-ClpN4I3e.js.map} +1 -1
  118. package/dist/{search-ledger-file-UKCO2r8a.js → search-ledger-file-Bd5Tioq6.js} +3 -3
  119. package/dist/{search-ledger-file-UKCO2r8a.js.map → search-ledger-file-Bd5Tioq6.js.map} +1 -1
  120. package/dist/{search-shipper-Cw2z3-td.js → search-shipper-Bg2HW3Uv.js} +3 -3
  121. package/dist/{search-shipper-Cw2z3-td.js.map → search-shipper-Bg2HW3Uv.js.map} +1 -1
  122. package/dist/{search-summary-DQIvJsSB.js → search-summary-CrBuvVnf.js} +3 -3
  123. package/dist/{search-summary-DQIvJsSB.js.map → search-summary-CrBuvVnf.js.map} +1 -1
  124. package/dist/{server-DoVbqqtJ.js → server-C6M0qR8h.js} +2 -2
  125. package/dist/{server-DoVbqqtJ.js.map → server-C6M0qR8h.js.map} +1 -1
  126. package/dist/{single-run-lock-U58yf8N6.js → single-run-lock-Dekd8_Wv.js} +7 -7
  127. package/dist/single-run-lock-Dekd8_Wv.js.map +1 -0
  128. package/dist/{skillopt-optimization-method-kyL94-ri.js → skillopt-optimization-method-5dlex7MJ.js} +1339 -1059
  129. package/dist/skillopt-optimization-method-5dlex7MJ.js.map +1 -0
  130. package/dist/{statistical-heldout-C9AbgREN.d.ts → statistical-heldout-BHfLZHrm.d.ts} +2 -2
  131. package/dist/{statistical-heldout-C9AbgREN.d.ts.map → statistical-heldout-BHfLZHrm.d.ts.map} +1 -1
  132. package/dist/{summary-report-DM7tlml1.d.ts → summary-report-CkbRcSuu.d.ts} +16 -1
  133. package/dist/summary-report-CkbRcSuu.d.ts.map +1 -0
  134. package/dist/supervisor-run/index.d.ts.map +1 -1
  135. package/dist/supervisor-run/index.js +3 -3
  136. package/dist/{systemone-Bp_Ac0p1.d.ts → systemone-BMzDJb1i.d.ts} +3 -3
  137. package/dist/{systemone-Bp_Ac0p1.d.ts.map → systemone-BMzDJb1i.d.ts.map} +1 -1
  138. package/dist/systemone.d.ts +2 -2
  139. package/dist/{terminal-record-78g6E4vh.js → terminal-record-D4Rv-j1W.js} +241 -193
  140. package/dist/{terminal-record-78g6E4vh.js.map → terminal-record-D4Rv-j1W.js.map} +1 -1
  141. package/dist/trajectory-replay/index.d.ts +4 -1
  142. package/dist/trajectory-replay/index.d.ts.map +1 -1
  143. package/dist/trajectory-replay/index.js +834 -824
  144. package/dist/trajectory-replay/index.js.map +1 -1
  145. package/dist/{tree-BGRglkKd.js → tree-B5e1uAeL.js} +122 -14
  146. package/dist/tree-B5e1uAeL.js.map +1 -0
  147. package/dist/{types-DtMbFw6U.d.ts → types-BKCzzmit.d.ts} +2 -2
  148. package/dist/{types-DtMbFw6U.d.ts.map → types-BKCzzmit.d.ts.map} +1 -1
  149. package/dist/{types-D8GhJoHk.d.ts → types-DtkO1G9L.d.ts} +2 -2
  150. package/dist/{types-D8GhJoHk.d.ts.map → types-DtkO1G9L.d.ts.map} +1 -1
  151. package/dist/wire/index.js +1 -1
  152. package/docs/design/statistics-decisions.md +1 -1
  153. package/docs/eval-surface-map.md +1 -0
  154. package/docs/profile-json-identity.md +1 -2
  155. package/docs/public-api.md +27 -16
  156. package/package.json +7 -2
  157. package/dist/benchmark-command-xQK8nOI6.js.map +0 -1
  158. package/dist/define-agent-eval-BDxNlP3D.js.map +0 -1
  159. package/dist/eval-campaign-BLEfBGbA.js +0 -343
  160. package/dist/eval-campaign-BLEfBGbA.js.map +0 -1
  161. package/dist/index-9jJ2fKSX.d.ts.map +0 -1
  162. package/dist/index-ZuWx52WG.d.ts.map +0 -1
  163. package/dist/integrity-DOd9Q86O.js.map +0 -1
  164. package/dist/journal-CR4QikYp.js.map +0 -1
  165. package/dist/llm-client-BshCREn6.js.map +0 -1
  166. package/dist/llm-judge-C8jMTNNG.js.map +0 -1
  167. package/dist/render-C-w2EZ6p.js.map +0 -1
  168. package/dist/schema-DxcKTzbi.js.map +0 -1
  169. package/dist/single-run-lock-U58yf8N6.js.map +0 -1
  170. package/dist/skillopt-optimization-method-kyL94-ri.js.map +0 -1
  171. package/dist/summary-report-DM7tlml1.d.ts.map +0 -1
  172. package/dist/tree-BGRglkKd.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eval-campaign-BUMIxKTE.js","names":[],"sources":["../src/eval-campaign.ts"],"sourcesContent":["/**\n * EvalCampaign — opinionated matrix runner that wires the four\n * capture-integrity directives by construction.\n *\n * The canonical benchmark shape — matrix runner → for each\n * (variant, scenario, seed) → start a TraceEmitter → call LLMs → end the\n * run → analyze — has a bug class at the integration boundary: raw\n * events not captured, route silently wrong, integrity not asserted,\n * analyst never run. The directives in `SKILL.md § Capture integrity`\n * are the mitigations.\n *\n * `EvalCampaign` is the structural fix — consumers don't wire the\n * integrity surface themselves; the campaign owns it. Specifically:\n *\n * - constructs a per-run `TraceStore` and `RawProviderSink` via factories\n * - builds the run's `ChatClient` through `chatFactory`, handing it the\n * run's raw sink and trace context — a transport built any other way has\n * no raw HTTP envelope, and `assertRunCaptured` says so\n * - calls `assertRunCaptured` after every `endRun` and routes failures\n * through a configurable policy (`throw` / `mark_failed` / `log`)\n * - assembles per-run `RunRecord`s and runs `researchReport` at the end\n * so the campaign artifact is launch-decision-grade by default\n * - embeds the campaign fingerprint (a SHA-256 over the canonicalised\n * run set) and optional `preregistrationHash` in the report\n *\n * The runner contract is intentionally narrow: produce a `CampaignRunOutcome`\n * given a fully-wired `CampaignRunContext`. Everything orchestration-shaped\n * lives in the campaign. This is the inversion-of-control point — consumers\n * stop writing matrix runners and start writing scenario-runners.\n *\n * Out of scope for v1 (tracked in `docs/research-report-methodology.md`):\n *\n * - Distributed/cluster execution (concurrency is local async)\n * - Adaptive sampling / sequential interim looks\n * - Resume from partial state across crashes\n * - LLM-call retry beyond what the caller's transport already does\n */\n\nimport {\n type AgentProfileCell,\n type AgentProfileCellInput,\n buildAgentProfileCell,\n verifyAgentProfileCell,\n} from './agent-profile-cell'\nimport type { ChatClient } from './analyst/chat-client'\nimport { hashJson } from './pre-registration'\nimport type {\n JudgeScoresRecord,\n RunCostProvenance,\n RunJudgeMetadata,\n RunOutcome,\n RunRecord,\n RunSplitTag,\n RunTaskFailure,\n RunTokenUsage,\n} from './run-record'\nimport { validateRunRecord } from './run-record'\nimport { type ResearchReport, type ResearchReportOptions, researchReport } from './summary-report'\nimport type { RunCompleteHook } from './trace/emitter'\nimport { TraceEmitter } from './trace/emitter'\nimport {\n assertRunCaptured,\n RunIntegrityError,\n type RunIntegrityExpectations,\n type RunIntegrityReport,\n} from './trace/integrity'\nimport { FileSystemRawProviderSink, type RawProviderSink } from './trace/raw-provider-sink'\nimport type { TraceStore } from './trace/store'\n\n// ── Public types ─────────────────────────────────────────────────────────\n\nexport interface CampaignVariant<V> {\n id: string\n payload: V\n}\n\nexport interface CampaignScenario {\n scenarioId: string\n /** Free-form metadata propagated to runs and reports. */\n tags?: Record<string, string>\n}\n\nexport interface CampaignRunContext<V> {\n /** Stable run id. The campaign generates this; the runner does not. */\n runId: string\n /** Logical experiment id (campaignId by default; overridable per-run via opts). */\n experimentId: string\n variant: V\n variantId: string\n scenarioId: string\n scenarioTags: Record<string, string>\n seed: number\n splitTag: RunSplitTag\n /**\n * The TraceEmitter for this run, with `onRunComplete` hooks pre-wired\n * (analyst auto-execution if configured, plus integrity check). The\n * runner MUST call `emitter.startRun` before doing any work and either\n * `emitter.endRun` or `emitter.abortRun` before returning.\n */\n emitter: TraceEmitter\n store: TraceStore\n rawSink: RawProviderSink\n /**\n * The run's model transport, built by `chatFactory` with this run's\n * `rawSink` and `runId` already bound.\n */\n chat: ChatClient\n}\n\n/** What the campaign binds into the run's transport. */\nexport interface CampaignChatWiring {\n /**\n * Raw provider sink for this run. Bind it into the transport: the campaign's\n * integrity check requires every LLM span to carry a matching raw request\n * event, so a transport built without it fails `assertRunCaptured`.\n */\n rawSink: RawProviderSink\n runId: string\n}\n\ninterface CampaignRunOutcomeFields {\n /** Did the run pass? Mirrors `RunOutcome.pass` semantics. */\n pass: boolean\n /** Score for the run on its split. Maps to `searchScore` or `holdoutScore`. */\n score: number\n /** Cost in USD, or null when the runner could not capture it. */\n costUsd: number | null\n /** Source of the cost amount. */\n costProvenance: RunCostProvenance\n tokenUsage: RunTokenUsage\n /** Snapshot model id (e.g. `claude-sonnet-4-6@2025-04-15`). */\n model: string\n /** sha256 of the effective prompt sent to the model. */\n promptHash: string\n /** sha256 of the effective config (model, temperature, tools, judges, splits). */\n configHash: string\n /** Optional extra numeric metrics to land in `outcome.raw`. */\n raw?: Record<string, number>\n /** Optional judge metadata when a judge was used. */\n judgeMetadata?: RunJudgeMetadata\n /**\n * Optional per-judge / per-dim breakdown for ensemble-judged runs.\n * Propagated to `outcome.judgeScores` on the resulting `RunRecord`.\n * Single-judge or scalar-only runs leave this unset.\n */\n judgeScores?: JudgeScoresRecord\n /**\n * Agent profile cell observed by the runner. When supplied, it overrides\n * `EvalCampaignOptions.agentProfile` for this run and must match the\n * outcome's `model` and `promptHash`.\n */\n agentProfile?: AgentProfileCell | AgentProfileCellInput\n}\n\n/** Campaign result with the same task-failure invariant as `RunRecord`. */\nexport type CampaignRunOutcome = CampaignRunOutcomeFields & RunTaskFailure\n\nexport type CampaignRunner<V> = (ctx: CampaignRunContext<V>) => Promise<CampaignRunOutcome>\n\nexport type CampaignIntegrityPolicy = 'throw' | 'mark_failed' | 'log'\n\nexport interface EvalCampaignOptions<V> {\n /**\n * Stable id for the campaign. Used as the default `experimentId` on\n * every run, and folded into the campaign fingerprint.\n */\n campaignId: string\n variants: CampaignVariant<V>[]\n scenarios: CampaignScenario[]\n /** Default `[0, 1, 2]`. */\n seeds?: number[]\n /** Default `'holdout'` — the split that anchors a launch decision. */\n splitTag?: RunSplitTag\n /** Git SHA the campaign is run against. Mandatory; `RunRecord` rejects unset. */\n commitSha: string\n /**\n * Build the model transport for one run. agent-eval executes no paid model:\n * the caller owns the transport and the credential never enters this\n * package. The campaign calls this once per run and passes the run's raw\n * provider sink and `runId`, so a transport that binds them captures the\n * raw HTTP envelope `assertRunCaptured` checks for.\n */\n chatFactory: (wiring: CampaignChatWiring) => ChatClient\n /**\n * Caller-declared identity of the execution route, folded into the campaign\n * fingerprint so two campaigns run against different endpoints do not share\n * one identity. agent-eval no longer knows the endpoint; the owner of\n * execution names it.\n */\n executionRef?: string\n /**\n * Per-run TraceStore factory. Common shape: a fresh store per run keyed\n * on `runId`. Implementations that share a store across the campaign\n * are valid — the campaign only writes through `emitter`.\n */\n storeFactory: (params: CampaignFactoryParams) => TraceStore\n /**\n * Per-run RawProviderSink factory. Defaults to `FileSystemRawProviderSink`\n * rooted at `${workDir}/raw-events/${runId}` if `workDir` is supplied;\n * otherwise required. Forensic capture is non-negotiable in a campaign\n * run — pass `NoopRawProviderSink` explicitly if you want to opt out.\n */\n rawSinkFactory?: (params: CampaignFactoryParams) => RawProviderSink\n /**\n * Filesystem root for default `rawSinkFactory`. Ignored if\n * `rawSinkFactory` is supplied.\n */\n workDir?: string\n /**\n * Extra `onRunComplete` hooks the campaign appends (after its own\n * integrity-check hook). Pass `traceAnalystOnRunComplete(...)` here.\n */\n onRunComplete?: RunCompleteHook[]\n /**\n * Per-run integrity expectations. Defaults to:\n * `{ llmSpansMin: 1, requireRawCoverageOfLlmSpans: true, requireOutcome: true }`.\n * Override (e.g. `{ llmSpansMin: 0 }`) for runs that don't call LLMs.\n */\n integrity?: RunIntegrityExpectations\n /** Behaviour when integrity fails. Default `'mark_failed'`. */\n onIntegrityFailure?: CampaignIntegrityPolicy\n /**\n * Per-run runner. Receives a fully-wired context; produces an outcome\n * the campaign converts into a `RunRecord`.\n */\n runner: CampaignRunner<V>\n /**\n * If set, the campaign computes `researchReport` at the end. `comparator`\n * is a `variantId`. Other fields are forwarded verbatim.\n */\n report?: { comparator?: string } & Omit<\n ResearchReportOptions,\n 'comparator' | 'preregistrationHash' | 'generatedAt'\n >\n /**\n * Hash of a signed `HypothesisManifest` (see `pre-registration.ts`).\n * Embedded in the campaign fingerprint and the research report.\n */\n preregistrationHash?: string\n /** Local concurrency. Default `1` (sequential). */\n concurrency?: number\n /**\n * Override the time source. Tests pass a mock to make wallMs deterministic.\n */\n now?: () => number\n /** Override the runId generator. Tests pin this. */\n runId?: (params: CampaignFactoryParams) => string\n /**\n * Agent profile cell for campaign runs. Static profiles can pass an object;\n * routers or variant-specific harnesses can pass a factory. The campaign\n * stamps the built cell onto every `RunRecord` and rejects profile/model or\n * profile/prompt contradictions.\n */\n agentProfile?:\n | AgentProfileCell\n | AgentProfileCellInput\n | ((\n params: CampaignFactoryParams & {\n variant: V\n scenarioTags: Record<string, string>\n },\n ) =>\n | AgentProfileCell\n | AgentProfileCellInput\n | Promise<AgentProfileCell | AgentProfileCellInput>)\n}\n\nexport interface CampaignFactoryParams {\n campaignId: string\n runId: string\n variantId: string\n scenarioId: string\n seed: number\n}\n\nexport interface FailedRun {\n runId: string\n variantId: string\n scenarioId: string\n seed: number\n reason: string\n error?: string\n}\n\nexport interface EvalCampaignResult {\n campaignId: string\n /** SHA-256 over canonicalised `(variantIds, scenarioIds, seeds, comparator, splitTag, executionRef, preregistrationHash)`. */\n campaignFingerprint: string\n preregistrationHash: string | null\n /** Successful runs only. Failed runs land in `failedRuns`. */\n runs: RunRecord[]\n /** Integrity reports for every successful run. */\n integrityReports: RunIntegrityReport[]\n failedRuns: FailedRun[]\n /** Computed when `report` is set on options. */\n report?: ResearchReport\n startedAt: string\n endedAt: string\n}\n\n// ── Implementation ───────────────────────────────────────────────────────\n\nconst DEFAULT_INTEGRITY: RunIntegrityExpectations = {\n llmSpansMin: 1,\n requireRawCoverageOfLlmSpans: true,\n requireOutcome: true,\n}\n\ntype CampaignCell<V> = { variant: CampaignVariant<V>; scenario: CampaignScenario; seed: number }\n\ntype CampaignRunResult = { record: RunRecord; integrity: RunIntegrityReport }\n\n/** Resolved options shared by every step of one campaign. */\ninterface CampaignSettings {\n seeds: number[]\n splitTag: RunSplitTag\n concurrency: number\n integrity: RunIntegrityExpectations\n onIntegrityFailure: CampaignIntegrityPolicy\n now: () => number\n executionRef: string | null\n preregistrationHash: string | null\n rawSinkFactory: (params: CampaignFactoryParams) => RawProviderSink\n}\n\n/**\n * Mutable state of one campaign's worker pool.\n *\n * A genuine (non-CellExecutionError) error from any worker is a bug, not a\n * run-level failure. We must NOT let `Promise.all` reject mid-flight and\n * orphan the other workers' in-progress runs (emitters never finalized,\n * sinks/handles leak, partial work silently discarded). Instead: capture the\n * first genuine error, stop dispatching new cells so in-flight workers wind\n * down, finalize every still-open run, then re-throw the aggregated error.\n */\ninterface CampaignPool<V> {\n opts: EvalCampaignOptions<V>\n settings: CampaignSettings\n cells: CampaignCell<V>[]\n cursor: number\n aborting: boolean\n genuineErrors: unknown[]\n /**\n * Emitters for runs that are currently mid-flight, keyed by runId. A worker\n * registers its emitter before invoking the runner and removes it once the\n * run is finalized (via endRun/abortRun, success or failure). Anything left\n * here after the pool settles is an orphan we must abort.\n */\n openRuns: Map<string, TraceEmitter>\n runs: RunRecord[]\n integrityReports: RunIntegrityReport[]\n failedRuns: FailedRun[]\n}\n\nexport async function runEvalCampaign<V>(\n opts: EvalCampaignOptions<V>,\n): Promise<EvalCampaignResult> {\n assertCampaignPreflight(opts)\n const settings = resolveCampaignSettings(opts)\n const campaignFingerprint = await fingerprintCampaign(opts, settings)\n\n const startedAt = new Date(settings.now()).toISOString()\n const pool: CampaignPool<V> = {\n opts,\n settings,\n cells: planCampaignCells(opts, settings.seeds),\n cursor: 0,\n aborting: false,\n genuineErrors: [],\n openRuns: new Map(),\n runs: [],\n integrityReports: [],\n failedRuns: [],\n }\n await drainCampaignPool(pool)\n\n const report = await buildCampaignReport(opts, settings, pool.runs)\n const endedAt = new Date(settings.now()).toISOString()\n\n return {\n campaignId: opts.campaignId,\n campaignFingerprint,\n preregistrationHash: settings.preregistrationHash,\n runs: pool.runs,\n integrityReports: pool.integrityReports,\n failedRuns: pool.failedRuns,\n report,\n startedAt,\n endedAt,\n }\n}\n\n/** Reject structurally invalid campaigns before any work starts. */\nfunction assertCampaignPreflight<V>(opts: EvalCampaignOptions<V>): void {\n if (opts.variants.length === 0) {\n throw new Error('runEvalCampaign: variants must be non-empty.')\n }\n if (opts.scenarios.length === 0) {\n throw new Error('runEvalCampaign: scenarios must be non-empty.')\n }\n const variantIds = new Set<string>()\n for (const v of opts.variants) {\n if (variantIds.has(v.id)) {\n throw new Error(`runEvalCampaign: duplicate variant id \"${v.id}\".`)\n }\n variantIds.add(v.id)\n }\n const scenarioIds = new Set<string>()\n for (const s of opts.scenarios) {\n if (scenarioIds.has(s.scenarioId)) {\n throw new Error(`runEvalCampaign: duplicate scenarioId \"${s.scenarioId}\".`)\n }\n scenarioIds.add(s.scenarioId)\n }\n if (opts.report?.comparator && !variantIds.has(opts.report.comparator)) {\n throw new Error(\n `runEvalCampaign: report.comparator \"${opts.report.comparator}\" is not a configured variantId.`,\n )\n }\n if (!opts.commitSha) {\n throw new Error('runEvalCampaign: commitSha is required (every RunRecord needs it).')\n }\n}\n\n/** Apply defaults to the optional campaign options. */\nfunction resolveCampaignSettings<V>(opts: EvalCampaignOptions<V>): CampaignSettings {\n return {\n seeds: opts.seeds ?? [0, 1, 2],\n splitTag: opts.splitTag ?? 'holdout',\n concurrency: Math.max(1, opts.concurrency ?? 1),\n integrity: { ...DEFAULT_INTEGRITY, ...(opts.integrity ?? {}) },\n onIntegrityFailure: opts.onIntegrityFailure ?? 'mark_failed',\n now: opts.now ?? (() => Date.now()),\n executionRef: opts.executionRef ?? null,\n preregistrationHash: opts.preregistrationHash ?? null,\n rawSinkFactory: opts.rawSinkFactory ?? defaultRawSinkFactory(opts.workDir),\n }\n}\n\n/** SHA-256 over the canonicalised matrix definition. */\nfunction fingerprintCampaign<V>(\n opts: EvalCampaignOptions<V>,\n settings: CampaignSettings,\n): Promise<string> {\n return hashJson({\n campaignId: opts.campaignId,\n variants: opts.variants.map((v) => v.id).sort(),\n scenarios: opts.scenarios.map((s) => s.scenarioId).sort(),\n seeds: [...settings.seeds].sort((a, b) => a - b),\n splitTag: settings.splitTag,\n comparator: opts.report?.comparator ?? null,\n executionRef: settings.executionRef,\n preregistrationHash: settings.preregistrationHash,\n })\n}\n\n/** Expand variants x scenarios x seeds, variant-major. */\nfunction planCampaignCells<V>(opts: EvalCampaignOptions<V>, seeds: number[]): CampaignCell<V>[] {\n const cells: CampaignCell<V>[] = []\n for (const variant of opts.variants) {\n for (const scenario of opts.scenarios) {\n for (const seed of seeds) {\n cells.push({ variant, scenario, seed })\n }\n }\n }\n return cells\n}\n\n/**\n * Run the bounded-concurrency worker pool to completion, finalize any run left\n * open, and re-throw the genuine errors the workers captured.\n */\nasync function drainCampaignPool<V>(pool: CampaignPool<V>): Promise<void> {\n const workers = Array.from(\n { length: Math.min(pool.settings.concurrency, pool.cells.length) },\n () => campaignWorker(pool),\n )\n // allSettled (not all): a genuine error in one worker must not reject the\n // pool mid-flight and orphan the others. Each worker captures its own\n // genuine error into `genuineErrors` and returns; we re-throw below.\n await Promise.allSettled(workers)\n\n // Finalize any run still open after the pool wound down. With the\n // stop-dispatch flag these are the runs that were mid-flight in peer workers\n // when the first genuine error fired — abort them so their emitters finalize\n // (hooks fire, store records a terminal status) instead of leaking.\n for (const [runId, emitter] of pool.openRuns) {\n await finalizeAbort(emitter, runId, 'campaign aborted: genuine error in a sibling run')\n }\n pool.openRuns.clear()\n\n if (pool.genuineErrors.length > 0) {\n throw pool.genuineErrors.length === 1\n ? pool.genuineErrors[0]\n : new AggregateError(\n pool.genuineErrors,\n `runEvalCampaign: ${pool.genuineErrors.length} runs failed with genuine (non-run-level) errors`,\n )\n }\n}\n\n/** Pull cells off the shared cursor until none remain or the pool is aborting. */\nasync function campaignWorker<V>(pool: CampaignPool<V>): Promise<void> {\n while (!pool.aborting) {\n const i = pool.cursor++\n if (i >= pool.cells.length) return\n const cell = pool.cells[i]!\n try {\n const result = await runCampaignCell(pool, cell)\n pool.runs.push(result.record)\n pool.integrityReports.push(result.integrity)\n } catch (err) {\n if (err instanceof CellExecutionError) {\n pool.failedRuns.push(err.failed)\n if (err.integrity) pool.integrityReports.push(err.integrity)\n } else {\n // Genuine bug — not a runner failure, not an integrity failure.\n // Capture it and stop dispatching so peers wind down gracefully;\n // re-thrown after the pool settles. Do not surface here — that would\n // reject Promise.all and orphan the other workers' runs.\n pool.genuineErrors.push(err)\n pool.aborting = true\n return\n }\n }\n }\n}\n\n/** Run one matrix cell: runner, integrity check, then the validated RunRecord. */\nasync function runCampaignCell<V>(\n pool: CampaignPool<V>,\n cell: CampaignCell<V>,\n): Promise<CampaignRunResult> {\n const { opts, settings } = pool\n const runId = (opts.runId ?? defaultRunId)({\n campaignId: opts.campaignId,\n runId: '', // unused by default generator\n variantId: cell.variant.id,\n scenarioId: cell.scenario.scenarioId,\n seed: cell.seed,\n })\n const factoryParams: CampaignFactoryParams = {\n campaignId: opts.campaignId,\n runId,\n variantId: cell.variant.id,\n scenarioId: cell.scenario.scenarioId,\n seed: cell.seed,\n }\n const store = opts.storeFactory(factoryParams)\n const rawSink = settings.rawSinkFactory(factoryParams)\n\n const emitter = new TraceEmitter(store, {\n runId,\n now: opts.now,\n onRunComplete: opts.onRunComplete,\n })\n // Track this run as open so a genuine error elsewhere in the pool can\n // finalize it instead of orphaning it. Removed in the finally below.\n pool.openRuns.set(runId, emitter)\n\n const chat = opts.chatFactory({ rawSink, runId })\n\n const ctx: CampaignRunContext<V> = {\n runId,\n experimentId: opts.campaignId,\n variant: cell.variant.payload,\n variantId: cell.variant.id,\n scenarioId: cell.scenario.scenarioId,\n scenarioTags: cell.scenario.tags ?? {},\n seed: cell.seed,\n splitTag: settings.splitTag,\n emitter,\n store,\n rawSink,\n chat,\n }\n\n try {\n const wallStart = settings.now()\n const outcome = await invokeCampaignRunner(opts, cell, ctx)\n const wallMs = settings.now() - wallStart\n\n const integrityReport = await assertRunCaptured(store, runId, {\n ...settings.integrity,\n rawSink,\n })\n if (!integrityReport.ok) admitOrRejectIntegrity(settings, cell, runId, integrityReport)\n\n const record = buildCampaignRunRecord(opts, settings, cell, runId, outcome, wallMs)\n await stampAgentProfile(opts, cell, record, runId, outcome)\n return { record: validateRunRecord(record), integrity: integrityReport }\n } finally {\n // This run's worker has finished with it (success, run-level failure, or\n // genuine error). It is no longer the pool's job to finalize — drop it so\n // the post-settle sweep doesn't double-abort a finalized run.\n pool.openRuns.delete(runId)\n }\n}\n\n/** Invoke the runner; a throw aborts the run and becomes a run-level failure. */\nasync function invokeCampaignRunner<V>(\n opts: EvalCampaignOptions<V>,\n cell: CampaignCell<V>,\n ctx: CampaignRunContext<V>,\n): Promise<CampaignRunOutcome> {\n try {\n return await opts.runner(ctx)\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n // The runner threw mid-execution. Abort the run so the emitter\n // finalizes. The only benign abortRun failure is \"the runner never\n // started the run\" (nothing to finalize). A store-write failure (disk\n // full, FS error) is a genuine diagnostic — surface it rather than\n // masking it as a plain runner failure.\n await finalizeAbort(ctx.emitter, ctx.runId, message)\n throw new CellExecutionError({\n runId: ctx.runId,\n variantId: cell.variant.id,\n scenarioId: cell.scenario.scenarioId,\n seed: cell.seed,\n reason: 'runner_threw',\n error: message,\n })\n }\n}\n\n/** Apply the integrity-failure policy to a report that is not ok. */\nfunction admitOrRejectIntegrity<V>(\n settings: CampaignSettings,\n cell: CampaignCell<V>,\n runId: string,\n integrityReport: RunIntegrityReport,\n): void {\n switch (settings.onIntegrityFailure) {\n case 'throw':\n throw new RunIntegrityError(integrityReport)\n case 'mark_failed':\n throw new CellExecutionError(\n {\n runId,\n variantId: cell.variant.id,\n scenarioId: cell.scenario.scenarioId,\n seed: cell.seed,\n reason: 'integrity_failed',\n error: integrityReport.issues.map((i) => i.code).join(', '),\n },\n integrityReport,\n )\n case 'log':\n // Caller wants the run admitted with a flagged report; fall through.\n break\n }\n}\n\n/** Assemble the RunRecord for a successful run, before profile stamping. */\nfunction buildCampaignRunRecord<V>(\n opts: EvalCampaignOptions<V>,\n settings: CampaignSettings,\n cell: CampaignCell<V>,\n runId: string,\n outcome: CampaignRunOutcome,\n wallMs: number,\n): RunRecord {\n const recordOutcome: RunOutcome = {\n raw: outcome.raw ?? {},\n }\n if (settings.splitTag === 'holdout') recordOutcome.holdoutScore = outcome.score\n else recordOutcome.searchScore = outcome.score\n if (outcome.judgeScores !== undefined) recordOutcome.judgeScores = outcome.judgeScores\n\n return {\n runId,\n experimentId: opts.campaignId,\n candidateId: cell.variant.id,\n seed: cell.seed,\n model: outcome.model,\n promptHash: outcome.promptHash,\n configHash: outcome.configHash,\n commitSha: opts.commitSha,\n wallMs,\n costUsd: outcome.costUsd,\n costProvenance: outcome.costProvenance,\n tokenUsage: outcome.tokenUsage,\n terminalOutcome: 'succeeded',\n judgeMetadata: outcome.judgeMetadata,\n outcome: recordOutcome,\n ...(outcome.failureClass ? { failureClass: outcome.failureClass } : {}),\n failureMode: outcome.failureMode,\n splitTag: settings.splitTag,\n scenarioId: cell.scenario.scenarioId,\n }\n}\n\n/** Resolve the run's agent profile (outcome first, then options) and stamp it on the record. */\nasync function stampAgentProfile<V>(\n opts: EvalCampaignOptions<V>,\n cell: CampaignCell<V>,\n record: RunRecord,\n runId: string,\n outcome: CampaignRunOutcome,\n): Promise<void> {\n const profileSource =\n outcome.agentProfile ??\n (typeof opts.agentProfile === 'function'\n ? await opts.agentProfile({\n campaignId: opts.campaignId,\n runId,\n variantId: cell.variant.id,\n scenarioId: cell.scenario.scenarioId,\n seed: cell.seed,\n variant: cell.variant.payload,\n scenarioTags: cell.scenario.tags ?? {},\n })\n : opts.agentProfile)\n if (profileSource !== undefined) {\n const agentProfile = await resolveAgentProfileCell(profileSource)\n assertAgentProfileMatchesRun(agentProfile, outcome.model, outcome.promptHash)\n record.agentProfile = agentProfile\n }\n}\n\n/** Build the optional research report over the successful runs. */\nasync function buildCampaignReport<V>(\n opts: EvalCampaignOptions<V>,\n settings: CampaignSettings,\n runs: RunRecord[],\n): Promise<ResearchReport | undefined> {\n if (!opts.report) return undefined\n const reportOpts: ResearchReportOptions = {\n ...opts.report,\n comparator: opts.report.comparator,\n split: settings.splitTag === 'dev' ? 'search' : settings.splitTag,\n generatedAt: new Date(settings.now()).toISOString(),\n preregistrationHash: settings.preregistrationHash ?? undefined,\n }\n return researchReport(runs, reportOpts)\n}\n\n// ── Internal ─────────────────────────────────────────────────────────────\n\nclass CellExecutionError extends Error {\n readonly failed: FailedRun\n readonly integrity?: RunIntegrityReport\n constructor(failed: FailedRun, integrity?: RunIntegrityReport) {\n super(`cell ${failed.variantId}/${failed.scenarioId}@${failed.seed} failed: ${failed.reason}`)\n this.failed = failed\n this.integrity = integrity\n }\n}\n\n/**\n * Abort a run whose owning work threw or was orphaned by a sibling's genuine\n * error, finalizing the emitter so hooks fire and the store records a terminal\n * status. Safe to call unconditionally: it only aborts runs that are still\n * `running`. Two no-op cases are intentional and benign:\n *\n * - the run was never started (absent from the store) — nothing to finalize\n * - the run is already terminal (`completed` / `failed` / `aborted`) —\n * finalizing again would overwrite the real outcome (e.g. flip a passed run\n * to `aborted` with `{ pass: false, notes: reason }`), so we leave it alone\n *\n * Any OTHER failure of the store read or the abort write (disk full, FS fault,\n * backend down) is a genuine diagnostic and propagates rather than being\n * swallowed.\n */\nasync function finalizeAbort(emitter: TraceEmitter, runId: string, reason: string): Promise<void> {\n const existing = await emitter.traceStore.getRun(runId)\n if (existing === undefined) return // run never started; nothing to abort\n if (existing.status !== 'running') return // already finalized; never overwrite a real outcome\n // The emitter never throws on a failed store write; it counts it. A failed\n // abort write is a genuine diagnostic here, so read the count and surface it.\n const droppedBefore = emitter.captureStats().dropped\n await emitter.abortRun(reason)\n const after = emitter.captureStats()\n if (after.dropped > droppedBefore) {\n throw new Error(`finalizeAbort: run ${runId} could not be finalized: ${after.lastError}`)\n }\n}\n\nfunction defaultRawSinkFactory(workDir: string | undefined) {\n return (params: CampaignFactoryParams): RawProviderSink => {\n if (!workDir) {\n throw new Error(\n 'runEvalCampaign: rawSinkFactory not supplied and workDir not set. Pass either to enable raw provider capture, or pass `new NoopRawProviderSink()` via rawSinkFactory to opt out explicitly.',\n )\n }\n return new FileSystemRawProviderSink({\n dir: `${workDir}/raw-events/${params.runId}`,\n })\n }\n}\n\nasync function resolveAgentProfileCell(\n input: AgentProfileCell | AgentProfileCellInput,\n): Promise<AgentProfileCell> {\n if (isAgentProfileCell(input)) {\n if (!(await verifyAgentProfileCell(input))) {\n throw new Error(`runEvalCampaign: agentProfile.cellId does not match its content`)\n }\n return input\n }\n return buildAgentProfileCell(input)\n}\n\nfunction isAgentProfileCell(\n input: AgentProfileCell | AgentProfileCellInput,\n): input is AgentProfileCell {\n return 'schemaVersion' in input && 'cellId' in input\n}\n\nfunction assertAgentProfileMatchesRun(\n profile: AgentProfileCell,\n model: string,\n promptHash: string,\n): void {\n if (profile.model !== undefined && profile.model !== model) {\n throw new Error(\n `runEvalCampaign: agentProfile.model \"${profile.model}\" does not match outcome.model \"${model}\"`,\n )\n }\n if (profile.promptHash !== undefined && profile.promptHash !== promptHash) {\n throw new Error(\n `runEvalCampaign: agentProfile.promptHash \"${profile.promptHash}\" does not match outcome.promptHash \"${promptHash}\"`,\n )\n }\n}\n\nfunction defaultRunId(params: CampaignFactoryParams): string {\n // Stable across re-runs: fingerprint of (campaignId, variantId, scenarioId, seed).\n // Caller can override via opts.runId for non-deterministic IDs.\n const base = `${params.campaignId}::${params.variantId}::${params.scenarioId}::${params.seed}`\n // TWO 32-bit FNV-1a accumulators with different offsets, concatenated for a\n // 64-bit-wide id. Not crypto-grade; stability and uniqueness are what this\n // needs. Frozen: the value names a persisted cell, and the second\n // accumulator's offset is part of the identity, so no single-accumulator\n // helper can replace it.\n let h1 = 0x811c9dc5\n let h2 = 0x12345678\n for (let i = 0; i < base.length; i++) {\n const c = base.charCodeAt(i)\n h1 = Math.imul(h1 ^ c, 0x01000193) >>> 0\n h2 = Math.imul(h2 ^ c, 0x9e3779b1) >>> 0\n }\n return `run-${h1.toString(16).padStart(8, '0')}${h2.toString(16).padStart(8, '0')}`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8SA,MAAM,oBAA8C;CAClD,aAAa;CACb,8BAA8B;CAC9B,gBAAgB;AAClB;AAgDA,eAAsB,gBACpB,MAC6B;CAC7B,wBAAwB,IAAI;CAC5B,MAAM,WAAW,wBAAwB,IAAI;CAC7C,MAAM,sBAAsB,MAAM,oBAAoB,MAAM,QAAQ;CAEpE,MAAM,YAAY,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,YAAY;CACvD,MAAM,OAAwB;EAC5B;EACA;EACA,OAAO,kBAAkB,MAAM,SAAS,KAAK;EAC7C,QAAQ;EACR,UAAU;EACV,eAAe,CAAC;EAChB,0BAAU,IAAI,IAAI;EAClB,MAAM,CAAC;EACP,kBAAkB,CAAC;EACnB,YAAY,CAAC;CACf;CACA,MAAM,kBAAkB,IAAI;CAE5B,MAAM,SAAS,MAAM,oBAAoB,MAAM,UAAU,KAAK,IAAI;CACl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AAwC,QAAQ,MAAM,kCAAkC,MAAM,EAChG;CAEF,IAAI,QAAQ,eAAe,KAAA,KAAa,QAAQ,eAAe,YAC7D,MAAM,IAAI,MACR,6CAA6C,QAAQ,WAAW,uCAAuC,WAAW,EACpH;AAEJ;AAEA,SAAS,aAAa,QAAuC;CAG3D,MAAM,OAAO,GAAG,OAAO,WAAW,IAAI,OAAO,UAAU,IAAI,OAAO,WAAW,IAAI,OAAO;CAMxF,IAAI,KAAK;CACT,IAAI,KAAK;CACT,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,MAAM,IAAI,KAAK,WAAW,CAAC;EAC3B,KAAK,KAAK,KAAK,KAAK,GAAG,QAAU,MAAM;EACvC,KAAK,KAAK,KAAK,KAAK,GAAG,UAAU,MAAM;CACzC;CACA,OAAO,OAAO,GAAG,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,IAAI,GAAG,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG;AAClF"}
@@ -1,6 +1,6 @@
1
1
  import { a as CostLedgerHandle, d as CostReceiptInput, m as MaximumCharge, r as CostChannel, u as CostReceipt } from "./cost-ledger-Jk62OBfF.js";
2
2
  import { i as AnalystFinding, n as AnalystContext, t as Analyst } from "./types-CW8ewATZ.js";
3
- import { R as Scenario, S as JudgeConfig, w as JudgeScore } from "./types-D8GhJoHk.js";
3
+ import { R as Scenario, S as JudgeConfig, w as JudgeScore } from "./types-DtkO1G9L.js";
4
4
  //#region src/evaluation.d.ts
5
5
  interface EvaluationResult<T> {
6
6
  value: T;
@@ -72,4 +72,4 @@ interface EvaluationAnalystOptions<I, O> {
72
72
  declare function asAnalyst<I, O>(options: EvaluationAnalystOptions<I, O>): Analyst<I>;
73
73
  //#endregion
74
74
  export { EvaluationResult as a, asJudge as c, EvaluationJudgeOptions as i, createEvaluator as l, EvaluationAnalystOptions as n, EvaluatorOptions as o, EvaluationContext as r, asAnalyst as s, CostedEvaluator as t };
75
- //# sourceMappingURL=evaluation-jTjC_QQD.d.ts.map
75
+ //# sourceMappingURL=evaluation-BOZ38vOH.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evaluation-jTjC_QQD.d.ts","names":[],"sources":["../src/evaluation.ts"],"mappings":";;;;UAWiB,iBAAiB;EAChC,OAAO;EACP,SAAS;EACT;;UAGe;;;EAGf;EACA,SAAS;EACT,aAAa;EACb;EACA,UAAU;EACV;EACA,WAAW;EACX,gBAAgB;;EAEhB,aAAa,SAAS,uBAAuB;;KAGnC,gBAAgB,GAAG,MAC7B,OAAO,GACP,UAAU,sBACP,QAAQ,iBAAiB;UAEb,iBAAiB,GAAG;EACnC,UAAU,OAAO,GAAG;IAAW,QAAQ;IAAa;QAA6B,QAAQ;EACzF,UAAU,OAAO,MAAM;EACvB,oBAAoB,OAAO,UAAU;EACrC,mBAAmB,OAAO;EAC1B,aAAa;EACb,gBAAgB;;EAEhB,YAAY,OAAO,GAAG,OAAO,aAAa;;;iBAI5B,gBAAgB,GAAG,GAAG,SAAS,iBAAiB,GAAG,KAAK,gBAAgB,GAAG;UA6B1E,uBAAuB,GAAG,UAAU,UAAU;EAC7D;EACA;EACA,YAAY,YAAY,GAAG;EAC3B,UAAU;IAAkB,UAAU;IAAG,UAAU;KAAK;EACxD,MAAM,OAAO,GAAG;IAAS,UAAU;IAAG,UAAU;QAAQ,aAAa,QAAQ;;EAE7E,UACE,QAAQ,iBAAiB,IACzB;IAAS,UAAU;IAAG,UAAU;eACtB;EACZ,aAAa,UAAU;;;iBAIT,QAAQ,GAAG,UAAU,UAAU,GAC7C,SAAS,uBAAuB,GAAG,GAAG,KACrC,YAAY,GAAG;UA4BD,yBAAyB,GAAG;EAC3C;EACA;EACA;EACA,WAAW,QAAQ;EACnB,MAAM,QAAQ;EACd,WACE,OAAO,GACP,SAAS,mBACT,gBAAgB,mBACb,QAAQ,iBAAiB;EAC9B,MAAM,OAAO,GAAG,OAAO,GAAG,SAAS,mBAAmB,mBAAmB,QAA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O,GAAG,SAAS,mBAAmB,mBAAmB,QAAQ;EACjF,UAAU,QAAQ,iBAAiB,IAAI,OAAO,GAAG,SAAS,0BAA0B;;;iBAItE,UAAU,GAAG,GAAG,SAAS,yBAAyB,GAAG,KAAK,QAAQ"}
@@ -1,2 +1,2 @@
1
- import { a as EvaluationResult, c as asJudge, i as EvaluationJudgeOptions, l as createEvaluator, n as EvaluationAnalystOptions, o as EvaluatorOptions, r as EvaluationContext, s as asAnalyst, t as CostedEvaluator } from "./evaluation-jTjC_QQD.js";
1
+ import { a as EvaluationResult, c as asJudge, i as EvaluationJudgeOptions, l as createEvaluator, n as EvaluationAnalystOptions, o as EvaluatorOptions, r as EvaluationContext, s as asAnalyst, t as CostedEvaluator } from "./evaluation-BOZ38vOH.js";
2
2
  export { CostedEvaluator, EvaluationAnalystOptions, EvaluationContext, EvaluationJudgeOptions, EvaluationResult, EvaluatorOptions, asAnalyst, asJudge, createEvaluator };
@@ -1,5 +1,5 @@
1
1
  import { n as bonferroni, r as holm, t as benjaminiHochberg } from "../multiplicity-DIWHvysC.js";
2
- import { At as EProcessStep, B as powerPreflight, Bt as pairedRiskDifferenceScore, C as signManifest, Ct as FinalEvidenceOutcome, Dt as EProcess, E as MatchedPair, Et as openFinalEvidenceLedger, F as comparePairedArms, Ht as wilson, I as pairArms, J as PromotionPolicy, L as pairRunRecords, Lt as mcnemar, O as PairArmsOptions, Ot as EProcessOptions, Pt as ProportionInterval, R as PowerPreflight, Rt as pairedRiskDifference, S as manifestContentDigest, St as FinalEvidenceMeasurement, Tt as FinalEvidenceReservation, W as EvidenceVector, X as paretoPolicy, Y as buildEvidenceVector, Z as paretoSignificanceGate, _ as HypothesisManifest, at as EvidenceAuthority, b as SignedManifestAlgo, bt as FinalEvidenceError, ct as EvidenceReceipt, d as SequentialObservation, dt as isIndependentEvidence, f as SequentialPairedGate, ft as verifyEvidenceReceipt, g as sequentialPairedGate, h as sequentialDecide, i as PairedHoldout, it as CreateEvidenceReceiptInput, j as PairedArmRow, jt as eProcess, k as PairArmsResult, kt as EProcessState, lt as EvidenceReceiptVerification, n as HeldoutSignificance, nt as CampaignEvidenceContext, o as heldoutSignificance, ot as EvidenceAuthorityKind, p as SequentialPairedGateOptions, r as HeldoutSignificanceOptions, rt as createCampaignEvidenceReceipt, s as pairHoldout, st as EvidenceBinding, u as SequentialGateDecision, ut as createEvidenceReceipt, v as HypothesisResult, w as verifyManifest, wt as FinalEvidenceRecord, x as hashJson, xt as FinalEvidenceLedger, y as SignedManifest, yt as FinalEvidenceConflictError, z as PowerPreflightOptions, zt as pairedRiskDifferenceExact } from "../statistical-heldout-C9AbgREN.js";
2
+ import { At as EProcessStep, B as powerPreflight, Bt as pairedRiskDifferenceScore, C as signManifest, Ct as FinalEvidenceOutcome, Dt as EProcess, E as MatchedPair, Et as openFinalEvidenceLedger, F as comparePairedArms, Ht as wilson, I as pairArms, J as PromotionPolicy, L as pairRunRecords, Lt as mcnemar, O as PairArmsOptions, Ot as EProcessOptions, Pt as ProportionInterval, R as PowerPreflight, Rt as pairedRiskDifference, S as manifestContentDigest, St as FinalEvidenceMeasurement, Tt as FinalEvidenceReservation, W as EvidenceVector, X as paretoPolicy, Y as buildEvidenceVector, Z as paretoSignificanceGate, _ as HypothesisManifest, at as EvidenceAuthority, b as SignedManifestAlgo, bt as FinalEvidenceError, ct as EvidenceReceipt, d as SequentialObservation, dt as isIndependentEvidence, f as SequentialPairedGate, ft as verifyEvidenceReceipt, g as sequentialPairedGate, h as sequentialDecide, i as PairedHoldout, it as CreateEvidenceReceiptInput, j as PairedArmRow, jt as eProcess, k as PairArmsResult, kt as EProcessState, lt as EvidenceReceiptVerification, n as HeldoutSignificance, nt as CampaignEvidenceContext, o as heldoutSignificance, ot as EvidenceAuthorityKind, p as SequentialPairedGateOptions, r as HeldoutSignificanceOptions, rt as createCampaignEvidenceReceipt, s as pairHoldout, st as EvidenceBinding, u as SequentialGateDecision, ut as createEvidenceReceipt, v as HypothesisResult, w as verifyManifest, wt as FinalEvidenceRecord, x as hashJson, xt as FinalEvidenceLedger, y as SignedManifest, yt as FinalEvidenceConflictError, z as PowerPreflightOptions, zt as pairedRiskDifferenceExact } from "../statistical-heldout-BHfLZHrm.js";
3
3
  import { c as BOOTSTRAP_GATE_MIN_N, l as PairedBootstrapOptions, m as pairedBootstrap, u as PairedBootstrapResult } from "../paired-promotion-decision-CQMJ5xGN.js";
4
4
  import { a as requiredPairedSampleSize, i as pairedMde, n as mcnemarPower, o as requiredSampleSize, r as mcnemarRequiredN, t as mulberry32 } from "../random-DGEyr3zG.js";
5
5
  import { at as summarizeEvaluationUnits, it as defineEvaluationClaim, nt as EvaluationClaim, rt as EvaluationUnitSummary } from "../search-ledger-types-p2xKfiDJ.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/experiment/ast/predicate.ts","../../src/experiment/ast/validity.ts","../../src/experiment/ast/budget.ts","../../src/experiment/ast/decision.ts","../../src/experiment/ast/estimand.ts","../../src/experiment/ast/reissue.ts","../../src/experiment/ast/selection.ts","../../src/experiment/budget.ts","../../src/experiment/funnel.ts","../../src/experiment/define.ts","../../src/experiment/evidence-record.ts","../../src/experiment/power.ts","../../src/experiment/randomized-canary.ts","../../src/experiment/prospective-canary-join.ts"],"mappings":";;;;;;;;;;;;;KAQY;EAEN;EACA;EACA;EACA,OAAO;;EAEP;EAAY;EAAe,QAAQ;;EACnC;EAAa,IAAI;;EACjB;EAAa,IAAI;;EACjB;EAAa,IAAI;;;wBAGP,UAAU,QAAQ,gBAAgB;;;;UChBjC;EACf;EACA;EACA;;;KAMU;EAEN;EACA;EACA;EACA;;EAGA;EACA;EACA;EACA;;EAEA;EAA8B,OAAO;;EAErC;EACA;;EAEA;EACA;EACA;IAAO;IAAgB;IAAmB;;;EAE1C;EAAkB;EAAuB;EAAmB;;UAEjD;EACf;EACA;EACA,UAAU;;;;;;;wBA+EI,uBACd,YACA,MAAM,QAAQ;EAAgB;IAC9B;EAAkB;EAAgB;M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;UAGU,0BAA0B;;EAEzC;EACA;;EAEA;EACA;;EAEA;;EAEA;;EAEA;EACA;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;;KAIU,wBACV,SAAS,qBACT,UAAU;EAGN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EAAiB;;UAEN;EACf,MAAM;EACN;EACA;;KAGU;UASK;EACf;EACA;EACA;EACA;EACA;;EAEA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU,OACR;IAEE;IACA;IACA;IACA;;EAGJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;IAAqB;IAAa;;EAClC;EACA;IAA0B;IAAa;;EACvC;;EAEA;EACA;EACA;EACA;EACA;EACA,SAAS;;EAET;;;wBAwBc,6BAA6B,eAAe;;wBA6B5C,kCAAkC,eAAe;;wBAiFjD,yBAAyB,MAAM,uBAAuB;;wBAOtD,uBACd,QAAQ,4BACR,QAAQ,qBACR,eAAe,qBACf,cAAc,uBACb;;;;UC3Sc,oCAAoC;EACnD;EACA;;;UAIe;EACf;EACA;EACA;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;;EAEf;EACA,QAAQ;;EAER;;EAEA;EACA,sBAAsB;EACtB,mBAAmB;EACnB,qBAAqB;EACrB,kBAAkB;;;;;;;wBA4DJ,8BACd,OAAO,6BACN"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/experiment/ast/predicate.ts","../../src/experiment/ast/validity.ts","../../src/experiment/ast/budget.ts","../../src/experiment/ast/decision.ts","../../src/experiment/ast/estimand.ts","../../src/experiment/ast/reissue.ts","../../src/experiment/ast/selection.ts","../../src/experiment/budget.ts","../../src/experiment/funnel.ts","../../src/experiment/define.ts","../../src/experiment/evidence-record.ts","../../src/experiment/power.ts","../../src/experiment/randomized-canary.ts","../../src/experiment/prospective-canary-join.ts"],"mappings":";;;;;;;;;;;;;KAQY;EAEN;EACA;EACA;EACA,OAAO;;EAEP;EAAY;EAAe,QAAQ;;EACnC;EAAa,IAAI;;EACjB;EAAa,IAAI;;EACjB;EAAa,IAAI;;;wBAGP,UAAU,QAAQ,gBAAgB;;;;UChBjC;EACf;EACA;EACA;;;KAMU;EAEN;EACA;EACA;EACA;;EAGA;EACA;EACA;EACA;;EAEA;EAA8B,OAAO;;EAErC;EACA;;EAEA;EACA;EACA;IAAO;IAAgB;IAAmB;;;EAE1C;EAAkB;EAAuB;EAAmB;;UAEjD;EACf;EACA;EACA,UAAU;;;;;;;wBA+EI,uBACd,YACA,MAAM,QAAQ;EAAgB;IAC9B;EAAkB;EAAgB;MACjC;;;;UCxHc;EACf;IAAQ;IAAyB;;EACjC;EACA;;UAGe;EACf;EACA;EACA;;;;;;KAuBU;EAEN;EACA;EACA;EACA;EACA;EACA;IAAU;IAAY;;EACtB;;EAGA;EACA;EACA;EACA;EACA;;UAGW;EACf;EACA;EACA;EACA;;UAGe;EACf,WAAW;EACX;;UAmCe;EACf;EACA;IAAe;IAAW;IAAsB;;EAChD;IAAkB;IAAuC;;;;UA+B1C;EACf;EACA;EACA;;;;;KC9HU;EACN;EAAgC;EAAkB;;EAClD;EAAgC;;EAChC;EAA4B;EAAkB;EAAiC;;EAC/E;EAAwB;;EACxB;EAAa,IAAI;;EACjB;EAAa,IAAI;;EACjB;EAAa,IAAI;;;UAGN;EACf,WAAW;IAAiB;IAAe;;EAC3C,YAAY;EACZ,gBAAgB;;wBAGF,kBAAkB,WAAW,WAAW,UAAU;UAyCjD;EACf,MAAM;EACN;EACA;;;;;;;;;KAUU;EACN;EAAe,UAAU;;EAEzB;EACA;EACA;EACA;EACA;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A;EACA,SAAS;;EAET;;;wBAwBc,6BAA6B,eAAe;;wBA6B5C,kCAAkC,eAAe;;wBAiFjD,yBAAyB,MAAM,uBAAuB;;wBAoYtD,uBACd,QAAQ,4BACR,QAAQ,qBACR,eAAe,qBACf,cAAc,uBACb;;;;UCxqBc,oCAAoC;EACnD;EACA;;;UAIe;EACf;EACA;EACA;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;;EAEf;EACA,QAAQ;;EAER;;EAEA;EACA,sBAAsB;EACtB,mBAAmB;EACnB,qBAAqB;EACrB,kBAAkB;;;;;;;wBA4DJ,8BACd,OAAO,6BACN"}
@@ -9,7 +9,7 @@ import { c as studentTCdf, i as pairedBootstrap, l as studentTQuantile, n as BOO
9
9
  import { a as requiredSampleSize, i as requiredPairedSampleSize, n as mcnemarRequiredN, r as pairedMde, t as mcnemarPower } from "../power-and-mde-N5nU4_Ly.js";
10
10
  import { t as eProcess } from "../sequential-eprocess-DodI6RoF.js";
11
11
  import { a as heldoutSignificance, o as pairHoldout } from "../statistical-heldout-Bksv92Th.js";
12
- import { S as openFinalEvidenceLedger, b as FinalEvidenceConflictError, i as verifyEvidenceReceipt, n as createEvidenceReceipt, r as isIndependentEvidence, t as createCampaignEvidenceReceipt, x as FinalEvidenceError, y as powerPreflight } from "../campaign-evidence-CQYw8_0H.js";
12
+ import { S as openFinalEvidenceLedger, b as FinalEvidenceConflictError, i as verifyEvidenceReceipt, n as createEvidenceReceipt, r as isIndependentEvidence, t as createCampaignEvidenceReceipt, x as FinalEvidenceError, y as powerPreflight } from "../campaign-evidence-DunzcJGv.js";
13
13
  import { n as evaluatePredicate, r as readField, t as compareValues } from "../predicate-FdKmElA_.js";
14
14
  import { r as summarizeEvaluationUnits, t as defineEvaluationClaim } from "../claim-BPVuyHuy.js";
15
15
  import { n as pairedEvalueSequence } from "../sequential-BVv1sjsw.js";
@@ -1261,8 +1261,8 @@ function sealRandomizedCanaryRule(rule) {
1261
1261
  algo: "sha256-rfc8785"
1262
1262
  };
1263
1263
  }
1264
- /** Apply one registered analysis to the entire frozen assignment roster. */
1265
- function decideRandomizedCanary(sealed, cohort, rows, verifyCohort) {
1264
+ /** Check the registration seal, the cohort receipt, the frozen roster and the independent verifier. */
1265
+ function verifyCohortEvidence(sealed, cohort, rows, verifyCohort) {
1266
1266
  if (sealed.algo !== "sha256-rfc8785") throw new ValidationError("randomized canary: unsupported registration digest scheme");
1267
1267
  validateRule(sealed.rule);
1268
1268
  if (hashCanonical(sealed.rule) !== sealed.digest) throw new ValidationError("randomized canary: registration digest mismatch");
@@ -1287,57 +1287,83 @@ function decideRandomizedCanary(sealed, cohort, rows, verifyCohort) {
1287
1287
  if (!Number.isSafeInteger(cohort.assignmentCount) || cohort.assignmentCount < 1 || rows.length !== cohort.assignmentCount) throw new ValidationError("randomized canary: assignment count differs from complete ledger receipt");
1288
1288
  if (randomizedCanaryRosterDigest(rows) !== cohort.assignmentRosterDigest) throw new ValidationError("randomized canary: assignment roster digest mismatch");
1289
1289
  if (randomizedCanaryObservationDigest(rows) !== cohort.observationSnapshotDigest) throw new ValidationError("randomized canary: frozen observation snapshot digest mismatch");
1290
+ verifyCohortTimes(sealed, cohort);
1291
+ if (typeof verifyCohort !== "function") throw new ValidationError("randomized canary: independent cohort verifier is required");
1292
+ const verification = verifyCohort(cohort, sealed);
1293
+ if (verification?.verified !== true || verification.authorityId !== cohort.authorityId || verification.protocolWitnessedBeforeTraffic !== true || verification.familySlotReservedBeforeTraffic !== true || verification.eligibilityAndDispositionVerified !== true || verification.randomizationVerified !== true || verification.rosterCompleteAtCutoff !== true || verification.outcomeAndBillingSnapshotFrozen !== true || verification.sourceJoinsVerified !== true || verification.armIsolationVerified !== true) throw new ValidationError(`randomized canary: cohort attestation or completeness unverified${verification?.verified === false ? `: ${verification.reason}` : ""}`);
1294
+ }
1295
+ /** Require the ledger closure, observation freeze and attestation times to match the registered cutoff. */
1296
+ function verifyCohortTimes(sealed, cohort) {
1290
1297
  const cutoff = Date.parse(sealed.rule.analysisCutoff);
1291
1298
  const closedAt = Date.parse(cohort.closedAt);
1292
1299
  const frozenAt = Date.parse(cohort.observationFrozenAt);
1293
1300
  const attestedAt = Date.parse(cohort.attestedAt);
1294
1301
  const expectedFreezeAt = cutoff + sealed.rule.outcomeMaturityMs;
1295
1302
  if (!Number.isFinite(closedAt) || closedAt < cutoff || !cohort.closedAt.endsWith("Z") || !Number.isFinite(frozenAt) || frozenAt !== expectedFreezeAt || closedAt > frozenAt || !cohort.observationFrozenAt.endsWith("Z") || !Number.isFinite(attestedAt) || attestedAt < frozenAt || !cohort.attestedAt.endsWith("Z")) throw new ValidationError("randomized canary: ledger closure or frozen observation time differs from registered cutoffs");
1296
- if (typeof verifyCohort !== "function") throw new ValidationError("randomized canary: independent cohort verifier is required");
1297
- const verification = verifyCohort(cohort, sealed);
1298
- if (verification?.verified !== true || verification.authorityId !== cohort.authorityId || verification.protocolWitnessedBeforeTraffic !== true || verification.familySlotReservedBeforeTraffic !== true || verification.eligibilityAndDispositionVerified !== true || verification.randomizationVerified !== true || verification.rosterCompleteAtCutoff !== true || verification.outcomeAndBillingSnapshotFrozen !== true || verification.sourceJoinsVerified !== true || verification.armIsolationVerified !== true) throw new ValidationError(`randomized canary: cohort attestation or completeness unverified${verification?.verified === false ? `: ${verification.reason}` : ""}`);
1299
- const clusters = /* @__PURE__ */ new Map();
1300
- const arms = {
1301
- control: [],
1302
- candidate: []
1303
+ }
1304
+ /** Validate one row's evidence fields and count its gaps; returns whether it is a recorded no-execution. */
1305
+ function checkObservationRow(row, index, tally) {
1306
+ if (row.checkedOutcome !== 0 && row.checkedOutcome !== 1 && row.checkedOutcome !== null) throw new ValidationError(`randomized canary: assignment ${index} outcome must be 0, 1, or null`);
1307
+ if (row.checkedOutcome === null) tally.missingOutcomes++;
1308
+ if (row.outcomeSourceId === null) {
1309
+ if (row.checkedOutcome !== null) throw new ValidationError(`randomized canary: assignment ${index} has an outcome without its source`);
1310
+ } else nonEmpty(row.outcomeSourceId, `assignment ${index} outcome source id`);
1311
+ if (row.billedCostUsd === null) tally.missingBilling++;
1312
+ else if (!Number.isFinite(row.billedCostUsd) || row.billedCostUsd < 0) throw new ValidationError(`randomized canary: assignment ${index} billed cost must be nonnegative`);
1313
+ if (row.billingSourceId === null) {
1314
+ if (row.billedCostUsd !== null) throw new ValidationError(`randomized canary: assignment ${index} has billed cost without its source`);
1315
+ } else nonEmpty(row.billingSourceId, `assignment ${index} billing source id`);
1316
+ if (row.turns === null) tally.missingTurns++;
1317
+ else if (!Number.isSafeInteger(row.turns) || row.turns < 0) throw new ValidationError(`randomized canary: assignment ${index} turns must be a nonnegative integer`);
1318
+ if (row.traceSourceId !== null) nonEmpty(row.traceSourceId, `assignment ${index} trace source id`);
1319
+ if (row.noExecutionSourceId !== null) nonEmpty(row.noExecutionSourceId, `assignment ${index} no-execution source id`);
1320
+ if (row.traceSourceId !== null && row.noExecutionSourceId !== null) throw new ValidationError(`randomized canary: assignment ${index} has conflicting trace and no-execution receipts`);
1321
+ const noExecution = row.noExecutionSourceId !== null && row.turns === 0 && row.billedCostUsd === 0 && row.checkedOutcome === 0;
1322
+ if (row.traceSourceId === null && !noExecution) tally.missingTraces++;
1323
+ for (const field of [
1324
+ "servedProfileDigest",
1325
+ "servedCodeRevisionDigest",
1326
+ "outcomeCheckerDigest"
1327
+ ]) if (row[field] !== null) nonEmpty(row[field], `assignment ${index} ${field}`);
1328
+ return noExecution;
1329
+ }
1330
+ /** Whether a row was served by, or checked with, anything other than the registered profile, code and checker. */
1331
+ function drifted(row, noExecution, rule) {
1332
+ const expectedProfile = row.arm === "control" ? rule.controlProfileDigest : rule.candidateProfileDigest;
1333
+ return row.traceSourceId !== null && (row.servedProfileDigest !== expectedProfile || row.servedCodeRevisionDigest !== rule.servedCodeRevisionDigest) || row.checkedOutcome !== null && row.outcomeCheckerDigest !== rule.outcomeCheckerDigest || noExecution && (row.servedProfileDigest !== null || row.servedCodeRevisionDigest !== null);
1334
+ }
1335
+ /** Validate every row against the registered rule, then group by arm and cluster. */
1336
+ function tallyObservations(rule, rows) {
1337
+ const tally = {
1338
+ clusters: /* @__PURE__ */ new Map(),
1339
+ arms: {
1340
+ control: [],
1341
+ candidate: []
1342
+ },
1343
+ missingOutcomes: 0,
1344
+ missingBilling: 0,
1345
+ missingTurns: 0,
1346
+ missingTraces: 0,
1347
+ executionDrift: 0
1303
1348
  };
1304
- let missingOutcomes = 0;
1305
- let missingBilling = 0;
1306
- let missingTurns = 0;
1307
- let missingTraces = 0;
1308
- let executionDrift = 0;
1309
1349
  for (const [index, row] of rows.entries()) {
1310
- if (row.checkedOutcome !== 0 && row.checkedOutcome !== 1 && row.checkedOutcome !== null) throw new ValidationError(`randomized canary: assignment ${index} outcome must be 0, 1, or null`);
1311
- if (row.checkedOutcome === null) missingOutcomes++;
1312
- if (row.outcomeSourceId === null) {
1313
- if (row.checkedOutcome !== null) throw new ValidationError(`randomized canary: assignment ${index} has an outcome without its source`);
1314
- } else nonEmpty(row.outcomeSourceId, `assignment ${index} outcome source id`);
1315
- if (row.billedCostUsd === null) missingBilling++;
1316
- else if (!Number.isFinite(row.billedCostUsd) || row.billedCostUsd < 0) throw new ValidationError(`randomized canary: assignment ${index} billed cost must be nonnegative`);
1317
- if (row.billingSourceId === null) {
1318
- if (row.billedCostUsd !== null) throw new ValidationError(`randomized canary: assignment ${index} has billed cost without its source`);
1319
- } else nonEmpty(row.billingSourceId, `assignment ${index} billing source id`);
1320
- if (row.turns === null) missingTurns++;
1321
- else if (!Number.isSafeInteger(row.turns) || row.turns < 0) throw new ValidationError(`randomized canary: assignment ${index} turns must be a nonnegative integer`);
1322
- if (row.traceSourceId !== null) nonEmpty(row.traceSourceId, `assignment ${index} trace source id`);
1323
- if (row.noExecutionSourceId !== null) nonEmpty(row.noExecutionSourceId, `assignment ${index} no-execution source id`);
1324
- if (row.traceSourceId !== null && row.noExecutionSourceId !== null) throw new ValidationError(`randomized canary: assignment ${index} has conflicting trace and no-execution receipts`);
1325
- const noExecution = row.noExecutionSourceId !== null && row.turns === 0 && row.billedCostUsd === 0 && row.checkedOutcome === 0;
1326
- if (row.traceSourceId === null && !noExecution) missingTraces++;
1327
- for (const field of [
1328
- "servedProfileDigest",
1329
- "servedCodeRevisionDigest",
1330
- "outcomeCheckerDigest"
1331
- ]) if (row[field] !== null) nonEmpty(row[field], `assignment ${index} ${field}`);
1332
- const expectedProfile = row.arm === "control" ? sealed.rule.controlProfileDigest : sealed.rule.candidateProfileDigest;
1333
- if (row.traceSourceId !== null && (row.servedProfileDigest !== expectedProfile || row.servedCodeRevisionDigest !== sealed.rule.servedCodeRevisionDigest) || row.checkedOutcome !== null && row.outcomeCheckerDigest !== sealed.rule.outcomeCheckerDigest || noExecution && (row.servedProfileDigest !== null || row.servedCodeRevisionDigest !== null)) executionDrift++;
1334
- arms[row.arm].push(row);
1335
- const bucket = clusters.get(row.clusterId) ?? [];
1350
+ if (drifted(row, checkObservationRow(row, index, tally), rule)) tally.executionDrift++;
1351
+ tally.arms[row.arm].push(row);
1352
+ const bucket = tally.clusters.get(row.clusterId) ?? [];
1336
1353
  bucket.push(row);
1337
- clusters.set(row.clusterId, bucket);
1354
+ tally.clusters.set(row.clusterId, bucket);
1338
1355
  }
1339
- const controlClusters = [...clusters.values()].filter((bucket) => bucket.some((r) => r.arm === "control")).length;
1340
- const candidateClusters = [...clusters.values()].filter((bucket) => bucket.some((r) => r.arm === "candidate")).length;
1356
+ return tally;
1357
+ }
1358
+ /** Count the clusters that hold at least one row of the arm. */
1359
+ function clustersWithArm(tally, arm) {
1360
+ return [...tally.clusters.values()].filter((bucket) => bucket.some((r) => r.arm === arm)).length;
1361
+ }
1362
+ /** The decision with every count and total filled in and no interval or pass yet. */
1363
+ function baseDecision(sealed, cohort, rowCount, tally) {
1364
+ const { clusters, arms, missingOutcomes, missingBilling, missingTurns } = tally;
1365
+ const controlClusters = clustersWithArm(tally, "control");
1366
+ const candidateClusters = clustersWithArm(tally, "candidate");
1341
1367
  if (sealed.rule.assignmentUnit === sealed.rule.clusterUnit) {
1342
1368
  for (const [clusterId, bucket] of clusters) if (bucket.length !== 1) throw new ValidationError(`randomized canary: ${sealed.rule.assignmentUnit} cluster '${clusterId}' has multiple assignments`);
1343
1369
  }
@@ -1358,7 +1384,7 @@ function decideRandomizedCanary(sealed, cohort, rows, verifyCohort) {
1358
1384
  const p0 = outcomesComplete ? sum("control", "checkedOutcome") / n0 : null;
1359
1385
  const p1 = outcomesComplete ? sum("candidate", "checkedOutcome") / n1 : null;
1360
1386
  const delta = p0 === null || p1 === null ? null : p1 - p0;
1361
- const result = {
1387
+ return {
1362
1388
  registrationDigest: sealed.digest,
1363
1389
  cohortReceiptSourceId: cohort.attestationSourceId,
1364
1390
  assignmentRosterDigest: cohort.assignmentRosterDigest,
@@ -1366,7 +1392,7 @@ function decideRandomizedCanary(sealed, cohort, rows, verifyCohort) {
1366
1392
  method: "cluster-robust-t",
1367
1393
  confidence: .95,
1368
1394
  familyAdjustedConfidence: 1 - .05 / sealed.rule.confirmatoryFamilySize,
1369
- assignments: rows.length,
1395
+ assignments: rowCount,
1370
1396
  controlAssignments: n0,
1371
1397
  candidateAssignments: n1,
1372
1398
  clusters: clusters.size,
@@ -1376,8 +1402,8 @@ function decideRandomizedCanary(sealed, cohort, rows, verifyCohort) {
1376
1402
  missingOutcomes,
1377
1403
  missingBilling,
1378
1404
  missingTurns,
1379
- missingTraces,
1380
- executionDrift,
1405
+ missingTraces: tally.missingTraces,
1406
+ executionDrift: tally.executionDrift,
1381
1407
  controlSuccessRate: p0,
1382
1408
  candidateSuccessRate: p1,
1383
1409
  delta,
@@ -1393,32 +1419,33 @@ function decideRandomizedCanary(sealed, cohort, rows, verifyCohort) {
1393
1419
  refusal: null,
1394
1420
  successCriterionMet: false
1395
1421
  };
1396
- if (missingOutcomes > 0 || missingBilling > 0 || missingTurns > 0 || n0 === 0 || n1 === 0) {
1397
- result.refusal = "missing-evidence";
1398
- return result;
1399
- }
1400
- if (missingTraces > 0) {
1401
- result.refusal = "missing-trace";
1402
- return result;
1403
- }
1404
- if (executionDrift > 0) {
1405
- result.refusal = "execution-drift";
1406
- return result;
1407
- }
1408
- if (clusters.size < sealed.rule.minimumClusters || controlClusters < 20 || candidateClusters < 20) {
1409
- result.refusal = "insufficient-clusters";
1410
- return result;
1411
- }
1412
- for (const bucket of clusters.values()) if (bucket.filter((r) => r.arm === "control").length / n0 > .1 || bucket.filter((r) => r.arm === "candidate").length / n1 > .1) {
1413
- result.refusal = "dominant-cluster";
1414
- return result;
1415
- }
1422
+ }
1423
+ /** The first reason the evidence cannot support an estimate, or null when it can. */
1424
+ function refusalReason(rule, tally, result) {
1425
+ const { clusters } = tally;
1426
+ const n0 = result.controlAssignments;
1427
+ const n1 = result.candidateAssignments;
1428
+ if (tally.missingOutcomes > 0 || tally.missingBilling > 0 || tally.missingTurns > 0 || n0 === 0 || n1 === 0) return "missing-evidence";
1429
+ if (tally.missingTraces > 0) return "missing-trace";
1430
+ if (tally.executionDrift > 0) return "execution-drift";
1431
+ if (clusters.size < rule.minimumClusters || result.controlClusters < 20 || result.candidateClusters < 20) return "insufficient-clusters";
1432
+ for (const bucket of clusters.values()) if (bucket.filter((r) => r.arm === "control").length / n0 > .1 || bucket.filter((r) => r.arm === "candidate").length / n1 > .1) return "dominant-cluster";
1433
+ return null;
1434
+ }
1435
+ /** Fill the intervals, p-value and passes, or refuse on zero variance. */
1436
+ function estimateRiskDifference(rule, tally, result) {
1437
+ const { clusters } = tally;
1438
+ const p0 = result.controlSuccessRate;
1439
+ const p1 = result.candidateSuccessRate;
1440
+ const delta = result.delta;
1441
+ const n0 = result.controlAssignments;
1442
+ const n1 = result.candidateAssignments;
1416
1443
  const scores = [...clusters.values()].map((bucket) => bucket.reduce((score, row) => score + (row.arm === "candidate" ? (row.checkedOutcome - p1) / n1 : -(row.checkedOutcome - p0) / n0), 0));
1417
1444
  const G = clusters.size;
1418
- const variance = G / (G - 1) * (rows.length - 1) / (rows.length - 2) * scores.reduce((total, score) => total + score * score, 0);
1445
+ const variance = G / (G - 1) * (result.assignments - 1) / (result.assignments - 2) * scores.reduce((total, score) => total + score * score, 0);
1419
1446
  if (!Number.isFinite(variance) || variance <= 0) {
1420
1447
  result.refusal = "zero-variance";
1421
- return result;
1448
+ return;
1422
1449
  }
1423
1450
  const se = Math.sqrt(variance);
1424
1451
  const t = delta / se;
@@ -1434,8 +1461,20 @@ function decideRandomizedCanary(sealed, cohort, rows, verifyCohort) {
1434
1461
  };
1435
1462
  result.unadjustedPValue = Math.min(1, 2 * (1 - studentTCdf(Math.abs(t), G - 1)));
1436
1463
  result.headline95Pass = result.nominal95Interval.low > 0;
1437
- result.familywisePass = result.familyAdjustedInterval.low > sealed.rule.minimumLift;
1464
+ result.familywisePass = result.familyAdjustedInterval.low > rule.minimumLift;
1438
1465
  result.successCriterionMet = result.headline95Pass && result.familywisePass;
1466
+ }
1467
+ /** Apply one registered analysis to the entire frozen assignment roster. */
1468
+ function decideRandomizedCanary(sealed, cohort, rows, verifyCohort) {
1469
+ verifyCohortEvidence(sealed, cohort, rows, verifyCohort);
1470
+ const tally = tallyObservations(sealed.rule, rows);
1471
+ const result = baseDecision(sealed, cohort, rows.length, tally);
1472
+ const refusal = refusalReason(sealed.rule, tally, result);
1473
+ if (refusal !== null) {
1474
+ result.refusal = refusal;
1475
+ return result;
1476
+ }
1477
+ estimateRiskDifference(sealed.rule, tally, result);
1439
1478
  return result;
1440
1479
  }
1441
1480
  //#endregion