@tangle-network/agent-eval 0.207.4 → 0.209.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/adapters/http.d.ts +2 -2
- package/dist/{agent-profile-CEhxR_I3.d.ts → agent-profile-BGyt2z8U.d.ts} +3 -3
- package/dist/{agent-profile-CEhxR_I3.d.ts.map → agent-profile-BGyt2z8U.d.ts.map} +1 -1
- package/dist/{agent-profile-cell-BHcB-mZX.d.ts → agent-profile-cell-BNp-Js9F.d.ts} +2 -3
- package/dist/agent-profile-cell-BNp-Js9F.d.ts.map +1 -0
- package/dist/{agent-profile-cell-DcFW4vOc.js → agent-profile-cell-BYc0bxsL.js} +2 -2
- package/dist/agent-profile-cell-BYc0bxsL.js.map +1 -0
- package/dist/analyst/index.d.ts +12 -12
- package/dist/analyst/index.js +5 -5
- package/dist/{analyze-runs-GZ0VSwui.js → analyze-runs-0cdYMgob.js} +5 -5
- package/dist/{analyze-runs-GZ0VSwui.js.map → analyze-runs-0cdYMgob.js.map} +1 -1
- package/dist/{analyze-runs-CTJyUplR.d.ts → analyze-runs-BlslTkOJ.d.ts} +4 -4
- package/dist/{analyze-runs-CTJyUplR.d.ts.map → analyze-runs-BlslTkOJ.d.ts.map} +1 -1
- package/dist/{benchmark-command-DiFof9bz.js → benchmark-command-Cve7mHNC.js} +8 -8
- package/dist/{benchmark-command-DiFof9bz.js.map → benchmark-command-Cve7mHNC.js.map} +1 -1
- package/dist/benchmarks/index.d.ts +5 -7
- package/dist/benchmarks/index.d.ts.map +1 -1
- package/dist/benchmarks/index.js +4 -4
- package/dist/builder-eval/index.js +1 -1
- package/dist/campaign/index.d.ts +7 -7
- package/dist/campaign/index.js +10 -10
- package/dist/{campaign-B8MqboM0.js → campaign-CvhmiLKa.js} +15 -15
- package/dist/{campaign-B8MqboM0.js.map → campaign-CvhmiLKa.js.map} +1 -1
- package/dist/{campaign-evidence-DW3Krxov.js → campaign-evidence-B5qsCHEn.js} +3 -3
- package/dist/{campaign-evidence-DW3Krxov.js.map → campaign-evidence-B5qsCHEn.js.map} +1 -1
- package/dist/cli.js +7 -7
- package/dist/contract/index.d.ts +9 -9
- package/dist/contract/index.js +8 -8
- package/dist/{default-registry-DZFWY2_E.d.ts → default-registry-Crk3QEy1.d.ts} +6 -6
- package/dist/{default-registry-DZFWY2_E.d.ts.map → default-registry-Crk3QEy1.d.ts.map} +1 -1
- package/dist/{default-registry-DX5R7_n9.js → default-registry-DF4Yp7HQ.js} +2 -2
- package/dist/{default-registry-DX5R7_n9.js.map → default-registry-DF4Yp7HQ.js.map} +1 -1
- package/dist/{define-agent-eval-BpRdb_Oa.js → define-agent-eval-Csd47ur_.js} +8 -8
- package/dist/{define-agent-eval-BpRdb_Oa.js.map → define-agent-eval-Csd47ur_.js.map} +1 -1
- package/dist/{define-agent-eval-Bmc4AYiB.d.ts → define-agent-eval-_nyV5nev.d.ts} +7 -7
- package/dist/{define-agent-eval-Bmc4AYiB.d.ts.map → define-agent-eval-_nyV5nev.d.ts.map} +1 -1
- package/dist/diagnosis/index.d.ts +2 -5
- package/dist/diagnosis/index.d.ts.map +1 -1
- package/dist/diagnosis/index.js +2 -26
- package/dist/diagnosis/index.js.map +1 -1
- package/dist/{dspy-rlm-engine-AJqjFUUr.js → dspy-rlm-engine-BpaKVKJA.js} +3 -3
- package/dist/{dspy-rlm-engine-AJqjFUUr.js.map → dspy-rlm-engine-BpaKVKJA.js.map} +1 -1
- package/dist/{engine-DProXJ7A.d.ts → engine-D-YZ32ZJ.d.ts} +5 -12
- package/dist/engine-D-YZ32ZJ.d.ts.map +1 -0
- package/dist/{eval-campaign-DU_p8qVt.js → eval-campaign-C31Qbv77.js} +4 -4
- package/dist/{eval-campaign-DU_p8qVt.js.map → eval-campaign-C31Qbv77.js.map} +1 -1
- package/dist/evaluation.d.ts +2 -2
- package/dist/{exact-types-Cq6xXNVR.d.ts → exact-types-DjhfZglz.d.ts} +2 -2
- package/dist/{exact-types-Cq6xXNVR.d.ts.map → exact-types-DjhfZglz.d.ts.map} +1 -1
- package/dist/experiment/index.d.ts +2 -2
- package/dist/experiment/index.js +5 -5
- package/dist/{external-optimizer-process-Bemjoy8y.js → external-optimizer-process-D2Txd-7D.js} +2 -2
- package/dist/{external-optimizer-process-Bemjoy8y.js.map → external-optimizer-process-D2Txd-7D.js.map} +1 -1
- package/dist/{external-optimizer-subprocess-d_EQrcTS.js → external-optimizer-subprocess-C0EsxEbI.js} +11 -3
- package/dist/{external-optimizer-subprocess-d_EQrcTS.js.map → external-optimizer-subprocess-C0EsxEbI.js.map} +1 -1
- package/dist/{feedback-trajectory-C6Z8PRoF.d.ts → feedback-trajectory-CX01700m.d.ts} +3 -3
- package/dist/{feedback-trajectory-C6Z8PRoF.d.ts.map → feedback-trajectory-CX01700m.d.ts.map} +1 -1
- package/dist/hosted/index.js +1 -1
- package/dist/{index-LAFht3x_.d.ts → index-BHh9Z9El.d.ts} +9 -9
- package/dist/{index-LAFht3x_.d.ts.map → index-BHh9Z9El.d.ts.map} +1 -1
- package/dist/{index-B9mXrS0W.d.ts → index-Ddi5M-TQ.d.ts} +8 -8
- package/dist/{index-B9mXrS0W.d.ts.map → index-Ddi5M-TQ.d.ts.map} +1 -1
- package/dist/{index-CbBfavbT.d.ts → index-H-u7f-w3.d.ts} +2 -2
- package/dist/{index-CbBfavbT.d.ts.map → index-H-u7f-w3.d.ts.map} +1 -1
- package/dist/{index-DkucR0KJ.d.ts → index-UxNTvn-w.d.ts} +6 -6
- package/dist/{index-DkucR0KJ.d.ts.map → index-UxNTvn-w.d.ts.map} +1 -1
- package/dist/index.d.ts +27 -36
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -87
- package/dist/index.js.map +1 -1
- package/dist/{kind-factory-Cn1lbsAd.js → kind-factory-ivTx6koH.js} +2 -11
- package/dist/{kind-factory-Cn1lbsAd.js.map → kind-factory-ivTx6koH.js.map} +1 -1
- package/dist/{llm-judge-DBrxRG2D.js → llm-judge-C0256VT_.js} +8 -8
- package/dist/{llm-judge-DBrxRG2D.js.map → llm-judge-C0256VT_.js.map} +1 -1
- package/dist/{matrix-Cqkk7eYI.d.ts → matrix-jHTsHEkR.d.ts} +2 -2
- package/dist/{matrix-Cqkk7eYI.d.ts.map → matrix-jHTsHEkR.d.ts.map} +1 -1
- package/dist/meta-eval/index.d.ts +1 -1
- package/dist/meta-eval/index.js +1 -1
- package/dist/{mint-C1W8w5wo.d.ts → mint-CDy-brUR.d.ts} +2 -2
- package/dist/{mint-C1W8w5wo.d.ts.map → mint-CDy-brUR.d.ts.map} +1 -1
- package/dist/{mint-CWG-s2mI.js → mint-Csor1BLJ.js} +2 -2
- package/dist/{mint-CWG-s2mI.js.map → mint-Csor1BLJ.js.map} +1 -1
- package/dist/multishot/golden/index.d.ts +1 -1
- package/dist/multishot/index.d.ts +2 -2
- package/dist/openapi.json +1 -1
- package/dist/{paired-arms-CgWT7sHy.js → paired-arms-B5v-X7No.js} +2 -4
- package/dist/{paired-arms-CgWT7sHy.js.map → paired-arms-B5v-X7No.js.map} +1 -1
- package/dist/pipelines/index.d.ts +1 -1
- package/dist/pipelines/index.js +2 -2
- package/dist/{prime-protocol-Csr9kcOM.d.ts → prime-protocol-B7et3tI7.d.ts} +2 -2
- package/dist/{prime-protocol-Csr9kcOM.d.ts.map → prime-protocol-B7et3tI7.d.ts.map} +1 -1
- package/dist/{produced-state-DyTuvglz.js → produced-state-CgB9g0VX.js} +3 -3
- package/dist/{produced-state-DyTuvglz.js.map → produced-state-CgB9g0VX.js.map} +1 -1
- package/dist/profile-cell.d.ts +2 -2
- package/dist/profile-cell.js +2 -2
- package/dist/{query-DlV0pdx4.js → query-B1D1qp2Z.js} +2 -2
- package/dist/{query-DlV0pdx4.js.map → query-B1D1qp2Z.js.map} +1 -1
- package/dist/{query-DBUQhehH.d.ts → query-DK1nWcmp.d.ts} +2 -3
- package/dist/{query-DBUQhehH.d.ts.map → query-DK1nWcmp.d.ts.map} +1 -1
- package/dist/{registry-DMkmhBQ5.d.ts → registry-BL7H33tj.d.ts} +3 -3
- package/dist/{registry-DMkmhBQ5.d.ts.map → registry-BL7H33tj.d.ts.map} +1 -1
- package/dist/{release-confidence-CkoXFx9I.d.ts → release-confidence-C4kI7lQi.d.ts} +4 -12
- package/dist/release-confidence-C4kI7lQi.d.ts.map +1 -0
- package/dist/{release-confidence-CiFg1EPq.js → release-confidence-Dbe9AS_X.js} +2 -2
- package/dist/{release-confidence-CiFg1EPq.js.map → release-confidence-Dbe9AS_X.js.map} +1 -1
- package/dist/{report-command-pXtxg5YK.js → report-command-CtIIsQKP.js} +3 -28
- package/dist/{report-command-pXtxg5YK.js.map → report-command-CtIIsQKP.js.map} +1 -1
- package/dist/reporting.d.ts +3 -3
- package/dist/reporting.js +3 -3
- package/dist/{researcher-CZFZjj-u.d.ts → researcher-DuIJ9IaA.d.ts} +4 -4
- package/dist/{researcher-CZFZjj-u.d.ts.map → researcher-DuIJ9IaA.d.ts.map} +1 -1
- package/dist/{reward-hacking-Cyk-QHk9.d.ts → reward-hacking-C6Kp54Av.d.ts} +2 -2
- package/dist/{reward-hacking-Cyk-QHk9.d.ts.map → reward-hacking-C6Kp54Av.d.ts.map} +1 -1
- package/dist/reward-nw2xZGZG.js.map +1 -1
- package/dist/rl.d.ts +10 -29
- package/dist/rl.d.ts.map +1 -1
- package/dist/rl.js +6 -6
- package/dist/rl.js.map +1 -1
- package/dist/rollout/index.d.ts +2 -2
- package/dist/rollout/index.js +2 -2
- package/dist/{rollout-l9w3Gdvh.js → rollout-BZqQc0YY.js} +2 -2
- package/dist/{rollout-l9w3Gdvh.js.map → rollout-BZqQc0YY.js.map} +1 -1
- package/dist/{rubric-predictive-validity-DIUwJJ9Y.d.ts → rubric-predictive-validity-BiNNEjpG.d.ts} +2 -2
- package/dist/{rubric-predictive-validity-DIUwJJ9Y.d.ts.map → rubric-predictive-validity-BiNNEjpG.d.ts.map} +1 -1
- package/dist/{run-record-BRlM99rX.js → run-record-DlTZ_lqe.js} +3 -13
- package/dist/run-record-DlTZ_lqe.js.map +1 -0
- package/dist/{run-record-BB290Y9A.js → run-record-ES07wfz9.js} +2 -2
- package/dist/{run-record-BB290Y9A.js.map → run-record-ES07wfz9.js.map} +1 -1
- package/dist/{run-record-DF-fuu31.d.ts → run-record-p2AYTrCn.d.ts} +3 -7
- package/dist/run-record-p2AYTrCn.d.ts.map +1 -0
- package/dist/search/index.d.ts +2 -24
- package/dist/search/index.d.ts.map +1 -1
- package/dist/search/index.js +3 -3
- package/dist/{search-kernel-mzeNuzr8.js → search-kernel-Bfe3kzRk.js} +45 -3
- package/dist/search-kernel-Bfe3kzRk.js.map +1 -0
- package/dist/{search-kernel-CzTWtv5d.d.ts → search-kernel-ah2GESe3.d.ts} +19 -4
- package/dist/search-kernel-ah2GESe3.d.ts.map +1 -0
- package/dist/{search-ledger-CXQPwdWz.js → search-ledger-aMTNQn_m.js} +2 -2
- package/dist/{search-ledger-CXQPwdWz.js.map → search-ledger-aMTNQn_m.js.map} +1 -1
- package/dist/{search-shipper-DhhofkDX.js → search-shipper-DKXWuLnp.js} +2 -2
- package/dist/{search-shipper-DhhofkDX.js.map → search-shipper-DKXWuLnp.js.map} +1 -1
- package/dist/{search-summary-CDURlgZR.js → search-summary-DK1bwTAf.js} +2 -2
- package/dist/{search-summary-CDURlgZR.js.map → search-summary-DK1bwTAf.js.map} +1 -1
- package/dist/{semantic-concept-judge-DDxUiWIz.js → semantic-concept-judge-BQxZyXdN.js} +3 -3
- package/dist/{semantic-concept-judge-DDxUiWIz.js.map → semantic-concept-judge-BQxZyXdN.js.map} +1 -1
- package/dist/{sequential-DMqr3sni.js → sequential-BOzBND4t.js} +2 -2
- package/dist/{sequential-DMqr3sni.js.map → sequential-BOzBND4t.js.map} +1 -1
- package/dist/{skillopt-optimization-method-D0-bMRGu.js → skillopt-optimization-method-BCojvoP1.js} +6 -6
- package/dist/{skillopt-optimization-method-D0-bMRGu.js.map → skillopt-optimization-method-BCojvoP1.js.map} +1 -1
- package/dist/{statistical-heldout-DFKtp-Qm.d.ts → statistical-heldout-D0rX_IDl.d.ts} +4 -5
- package/dist/statistical-heldout-D0rX_IDl.d.ts.map +1 -0
- package/dist/{store-otlp-BA7G1Du-.js → store-otlp-__ebQ6Hn.js} +2 -2
- package/dist/{store-otlp-BA7G1Du-.js.map → store-otlp-__ebQ6Hn.js.map} +1 -1
- package/dist/{store-tool-spans-DKoVbE-w.js → store-tool-spans-TbRBuIM7.js} +3 -3
- package/dist/{store-tool-spans-DKoVbE-w.js.map → store-tool-spans-TbRBuIM7.js.map} +1 -1
- package/dist/{store-tool-spans-9YJNMP-z.d.ts → store-tool-spans-wQ9idsnn.d.ts} +5 -5
- package/dist/{store-tool-spans-9YJNMP-z.d.ts.map → store-tool-spans-wQ9idsnn.d.ts.map} +1 -1
- package/dist/{summary-report-fXurE2TR.js → summary-report-BsaEFEwA.js} +3 -3
- package/dist/{summary-report-fXurE2TR.js.map → summary-report-BsaEFEwA.js.map} +1 -1
- package/dist/{summary-report-DvvesgR_.d.ts → summary-report-CK0ueoJd.d.ts} +2 -2
- package/dist/{summary-report-DvvesgR_.d.ts.map → summary-report-CK0ueoJd.d.ts.map} +1 -1
- package/dist/supervisor-run/index.d.ts +0 -8
- package/dist/supervisor-run/index.d.ts.map +1 -1
- package/dist/supervisor-run/index.js +2 -2
- package/dist/{systemone-review-Bt4JcxMc.d.ts → systemone-review-BReh3mvm.d.ts} +2 -2
- package/dist/{systemone-review-Bt4JcxMc.d.ts.map → systemone-review-BReh3mvm.d.ts.map} +1 -1
- package/dist/systemone.d.ts +3 -3
- package/dist/{tool-groups-j19pmOfP.d.ts → tool-groups-v28A-ZAF.d.ts} +3 -3
- package/dist/tool-groups-v28A-ZAF.d.ts.map +1 -0
- package/dist/{tool-waste-x_E8h9Ih.js → tool-waste-BYt5rdt8.js} +2 -2
- package/dist/{tool-waste-x_E8h9Ih.js.map → tool-waste-BYt5rdt8.js.map} +1 -1
- package/dist/{tool-waste-DxlebQkx.d.ts → tool-waste-Wi4g6Ekb.d.ts} +2 -2
- package/dist/{tool-waste-DxlebQkx.d.ts.map → tool-waste-Wi4g6Ekb.d.ts.map} +1 -1
- package/dist/{trace-questions-dRvmsbTk.d.ts → trace-questions-C26UvI3D.d.ts} +3 -3
- package/dist/{trace-questions-dRvmsbTk.d.ts.map → trace-questions-C26UvI3D.d.ts.map} +1 -1
- package/dist/trace-repair/index.d.ts +2 -9
- package/dist/trace-repair/index.d.ts.map +1 -1
- package/dist/trace-repair/index.js +1 -1
- package/dist/traces.d.ts +6 -8
- package/dist/traces.d.ts.map +1 -1
- package/dist/traces.js +6 -6
- package/dist/trajectory-replay/index.d.ts +0 -2
- package/dist/trajectory-replay/index.d.ts.map +1 -1
- package/dist/trajectory-replay/index.js +1 -1
- package/dist/{tree-CN8mlzUO.js → tree-CZ78tiPg.js} +4 -24
- package/dist/tree-CZ78tiPg.js.map +1 -0
- package/dist/{types-CFCUZk0B.d.ts → types-Dv9sYwBB.d.ts} +4 -4
- package/dist/{types-CFCUZk0B.d.ts.map → types-Dv9sYwBB.d.ts.map} +1 -1
- package/dist/{types-DAPpAkd4.d.ts → types-KEkKkETv.d.ts} +2 -2
- package/dist/{types-DAPpAkd4.d.ts.map → types-KEkKkETv.d.ts.map} +1 -1
- package/dist/{types-BlSBUNRd.d.ts → types-tWFY6bON.d.ts} +3 -3
- package/dist/{types-BlSBUNRd.d.ts.map → types-tWFY6bON.d.ts.map} +1 -1
- package/dist/wire/index.d.ts +1 -1
- package/docs/public-api.md +399 -424
- package/docs/quickstart-external.md +268 -0
- package/docs/search-ledger.md +4 -1
- package/package.json +3 -3
- package/dist/agent-profile-cell-BHcB-mZX.d.ts.map +0 -1
- package/dist/agent-profile-cell-DcFW4vOc.js.map +0 -1
- package/dist/engine-DProXJ7A.d.ts.map +0 -1
- package/dist/release-confidence-CkoXFx9I.d.ts.map +0 -1
- package/dist/run-record-BRlM99rX.js.map +0 -1
- package/dist/run-record-DF-fuu31.d.ts.map +0 -1
- package/dist/search-kernel-CzTWtv5d.d.ts.map +0 -1
- package/dist/search-kernel-mzeNuzr8.js.map +0 -1
- package/dist/statistical-heldout-DFKtp-Qm.d.ts.map +0 -1
- package/dist/tool-groups-j19pmOfP.d.ts.map +0 -1
- package/dist/tree-CN8mlzUO.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-kernel-mzeNuzr8.js","names":["RESAMPLES","plain"],"sources":["../src/pareto.ts","../src/campaign/estimate-node.ts","../src/search/lenses/shared.ts","../src/search/lenses/operator-yield.ts","../src/paired-promotion-power.ts","../src/campaign/search-claim.ts","../src/campaign/search-kernel.ts"],"sourcesContent":["/**\n * Pareto frontier — multi-objective optimization over candidate runs.\n *\n * Lifted from ADC pareto.ts and blueprint-agent frontier.ts. When you're\n * trading off (cost, latency, quality) or (passRate, tokenBudget,\n * ttfb), you rarely have a single \"winner\" — you have a set of\n * non-dominated candidates. This module exposes:\n *\n * - `paretoFrontier`: filter a set of candidates to the non-dominated ones\n * - `dominates`: does A dominate B across all objectives?\n *\n * Each objective is declared with a direction: 'maximize' (higher=better)\n * or 'minimize' (lower=better). Candidates are any object; pass an\n * `objective(candidate)` accessor.\n */\n\nexport type Direction = 'maximize' | 'minimize'\n\nexport interface Objective<T> {\n /** Stable label used in reports. */\n name: string\n direction: Direction\n value: (candidate: T) => number\n}\n\nexport interface ParetoResult<T> {\n frontier: T[]\n dominated: T[]\n /** Index map: frontier[i] dominates each of dominatedBy[i]. */\n dominanceMap: Array<{ dominator: T; dominated: T[] }>\n}\n\n/** Does candidate A weakly dominate B — strictly better on at least one objective and no worse on any? */\nexport function dominates<T>(a: T, b: T, objectives: Objective<T>[]): boolean {\n let strictlyBetter = false\n for (const obj of objectives) {\n const av = obj.value(a)\n const bv = obj.value(b)\n if (!Number.isFinite(av) || !Number.isFinite(bv)) return false\n const aIsBetter = obj.direction === 'maximize' ? av > bv : av < bv\n const aIsWorse = obj.direction === 'maximize' ? av < bv : av > bv\n if (aIsWorse) return false\n if (aIsBetter) strictlyBetter = true\n }\n return strictlyBetter\n}\n\n/**\n * Compute the non-dominated frontier. Candidates with NaN/Infinity on any\n * objective are excluded (can't rank them). A candidate enters the frontier\n * iff no other candidate dominates it.\n */\nexport function paretoFrontier<T>(candidates: T[], objectives: Objective<T>[]): ParetoResult<T> {\n if (objectives.length === 0) {\n throw new Error('paretoFrontier: at least 1 objective required')\n }\n const valid = candidates.filter((c) => objectives.every((o) => Number.isFinite(o.value(c))))\n const frontier: T[] = []\n const dominated: T[] = []\n for (const c of valid) {\n const isDominated = valid.some((other) => other !== c && dominates(other, c, objectives))\n if (isDominated) dominated.push(c)\n else frontier.push(c)\n }\n const dominanceMap = frontier.map((d) => ({\n dominator: d,\n dominated: dominated.filter((x) => dominates(d, x, objectives)),\n }))\n return { frontier, dominated, dominanceMap }\n}\n\n/**\n * Weighted-sum scalarisation. Use as a tie-break / single-winner selector\n * when callers don't want to consume a frontier. Each objective contributes\n * its normalised value (0..1 via min-max across the candidate pool) times\n * its weight; missing weights default to 1/N.\n *\n * Direction is honoured automatically — `minimize` axes have their values\n * inverted before scaling so \"higher scalar = better\" always holds.\n */\nexport function scalarScore<T>(\n candidates: T[],\n objectives: Objective<T>[],\n options: { weights?: Partial<Record<string, number>> } = {},\n): Array<{ candidate: T; score: number }> {\n if (candidates.length === 0) return []\n const weights = options.weights ?? {}\n const totalWeight = objectives.reduce((s, o) => s + (weights[o.name] ?? 1), 0)\n\n // Pre-compute min/max per objective for normalisation.\n const ranges = objectives.map((obj) => {\n const values = candidates.map((c) => obj.value(c)).filter((v) => Number.isFinite(v))\n if (values.length === 0) return { min: 0, max: 1 }\n const min = Math.min(...values)\n const max = Math.max(...values)\n return { min, max: max === min ? min + 1 : max }\n })\n\n return candidates.map((c) => {\n let score = 0\n objectives.forEach((obj, i) => {\n const v = obj.value(c)\n if (!Number.isFinite(v)) return\n const { min, max } = ranges[i]!\n const normalised = (v - min) / (max - min)\n const directional = obj.direction === 'maximize' ? normalised : 1 - normalised\n const weight = (weights[obj.name] ?? 1) / totalWeight\n score += directional * weight\n })\n return { candidate: c, score }\n })\n}\n\n/**\n * NSGA-II crowding distance — secondary sort for ties on the frontier.\n *\n * When the Pareto front collapses to a single point (or many candidates tie\n * on dominance), naive selection picks arbitrarily and the population\n * degenerates over generations. NSGA-II preserves diversity by preferring\n * candidates with more empty space around them on the frontier.\n *\n * Returns an array of `{ candidate, distance }` in the SAME order as the\n * input. Higher distance = more isolated = should be preferred when\n * preserving diversity.\n */\nexport function crowdingDistance<T>(\n candidates: T[],\n objectives: Objective<T>[],\n): Array<{ candidate: T; distance: number }> {\n const distances = new Map<T, number>(candidates.map((c) => [c, 0]))\n\n for (const obj of objectives) {\n const sorted = [...candidates].sort((a, b) => obj.value(a) - obj.value(b))\n const min = obj.value(sorted[0]!)\n const max = obj.value(sorted[sorted.length - 1]!)\n const range = max - min || 1\n\n // Boundary points get infinity (always preferred for diversity).\n distances.set(sorted[0]!, Infinity)\n distances.set(sorted[sorted.length - 1]!, Infinity)\n for (let i = 1; i < sorted.length - 1; i++) {\n const prev = obj.value(sorted[i - 1]!)\n const next = obj.value(sorted[i + 1]!)\n const current = distances.get(sorted[i]!)!\n if (current === Infinity) continue\n distances.set(sorted[i]!, current + (next - prev) / range)\n }\n }\n\n return candidates.map((c) => ({ candidate: c, distance: distances.get(c) ?? 0 }))\n}\n\n/**\n * Pareto frontier with tie-break by crowding distance — the canonical\n * NSGA-II selection step. Returns the frontier sorted by descending crowding\n * distance so callers can `.slice(0, k)` to pick K diverse winners.\n */\nexport function paretoFrontierWithCrowding<T>(\n candidates: T[],\n objectives: Objective<T>[],\n): Array<{ candidate: T; distance: number }> {\n const { frontier } = paretoFrontier(candidates, objectives)\n if (frontier.length === 0) return []\n const distances = crowdingDistance(frontier, objectives)\n return distances.sort((a, b) => b.distance - a.distance)\n}\n","/**\n * Per-node statistics of a search.\n *\n * `estimateNode` is the one paired contrast of two nodes: it averages each\n * node's cells inside their units, pairs the units both nodes scored, and runs\n * `pairedDeltaTest` on the per-unit deltas. `estimateNodeFromCells` is the same\n * computation over cells a caller already holds, such as rows a server read\n * from its database. The bootstrap seed comes from `cellSetDigest`, the digest\n * of exactly the cells used, so a producer and a verifier that hold the same\n * cells report the same bits.\n *\n * `searchPosterior` gives every node a normal posterior on its improvement over\n * the root, which expansion policies sample parents from. Its numbers steer\n * spend and claim nothing.\n */\n\nimport { compareCodeUnits, hashCanonical } from '../ledger-core/canonical'\nimport { minimumPairsForPairedDeltaTest, pairedDeltaTest } from '../paired-delta-test'\nimport { BOOTSTRAP_GATE_MIN_N, DECISION_PAIRED_DELTA_STATISTIC } from '../statistics'\nimport { SearchLedgerError } from './search-ledger-errors'\nimport type {\n NodeEstimate,\n SearchEstimateMethod,\n SearchLedgerHash,\n SearchSourceRef,\n SearchSplit,\n} from './search-ledger-types'\nimport {\n type SearchScoredCell,\n type SearchStateView,\n type SearchUnitScore,\n searchUnitScores,\n} from './search-state'\n\nconst CONFIDENCE = 0.95\nconst RESAMPLES = 2000\n/** 6 at 95 %: the smallest sample an exact one-sided sign test can resolve. */\nconst DESCRIPTIVE_FROM = minimumPairsForPairedDeltaTest(CONFIDENCE)\n\n/**\n * Every choice the numbers depend on. Its digest is the estimator's revision:\n * a producer and a verifier that report the same revision and the same\n * `cellSetDigest` report the same estimate. Change a value here whenever the\n * computation changes, so the revision moves with it.\n */\nconst ESTIMATOR_DEFINITION = {\n name: 'tangle.estimate-node.2026-09',\n unit: 'mean of the unit’s scored cells, summed in cellId order',\n pairing: 'units both nodes scored, in unitId order',\n statistic: DECISION_PAIRED_DELTA_STATISTIC,\n interval: 'percentile paired bootstrap',\n confidence: CONFIDENCE,\n resamples: RESAMPLES,\n rng: 'mulberry32',\n seed: 'the first 32 bits of cellSetDigest',\n signTest: 'exact, one-sided toward improvement in the objective direction',\n methods: {\n none: 'below 2 pairs',\n insufficient: `below ${DESCRIPTIVE_FROM} pairs`,\n descriptive: `below ${BOOTSTRAP_GATE_MIN_N} pairs`,\n bootstrap: `from ${BOOTSTRAP_GATE_MIN_N} pairs`,\n },\n indeterminate: 'every paired delta equal: no interval and no sign p',\n} as const\n\n/** The estimator every `NodeEstimate` names. */\nexport const SEARCH_ESTIMATOR: SearchSourceRef = {\n uri: 'npm:@tangle-network/agent-eval#estimateNode',\n revision: hashCanonical(ESTIMATOR_DEFINITION),\n}\n\n/** The method a paired sample of `pairs` units supports: the one staging\n * every `NodeEstimate` and every search lens uses. */\nexport function searchEstimateMethod(pairs: number): SearchEstimateMethod {\n if (pairs < 2) return 'none'\n if (pairs < DESCRIPTIVE_FROM) return 'insufficient'\n if (pairs < BOOTSTRAP_GATE_MIN_N) return 'descriptive'\n return 'bootstrap'\n}\n\nexport interface EstimateNodeCellsInput {\n nodeId: string\n against: string\n split: SearchSplit\n direction: 'maximize' | 'minimize'\n /** Every scored cell of `nodeId` on `split`. */\n nodeCells: readonly SearchScoredCell[]\n /** Every scored cell of `against` on `split`. */\n againstCells: readonly SearchScoredCell[]\n}\n\n/**\n * Digest of the cells an estimate reads, with the contrast they serve. Cells\n * are listed in cellId order, so the digest names the set, not the order it\n * was read in.\n */\nexport function searchCellSetDigest(\n input: Omit<EstimateNodeCellsInput, 'direction'>,\n): SearchLedgerHash {\n const list = (cells: readonly SearchScoredCell[]) =>\n [...cells]\n .sort((left, right) => compareCodeUnits(left.cellId, right.cellId))\n .map((cell) => [cell.cellId, cell.unitId, cell.attempt, cell.score])\n return hashCanonical({\n contrast: [input.nodeId, input.against],\n split: input.split,\n nodeCells: list(input.nodeCells),\n againstCells: list(input.againstCells),\n })\n}\n\n/**\n * The paired contrast of `nodeId` against `against` on the units both scored.\n *\n * `delta` is the mean per-unit difference, node minus `against`, in the\n * metric's own units; for a `minimize` objective an improvement is negative.\n * The exact sign test is one-sided toward improvement in the objective's\n * direction. Unscored cells (errored, cancelled or in flight) are absent from\n * the inputs, never zero.\n *\n * - `none` (0 or 1 pair): no delta.\n * - `insufficient` (2 to 5): the delta only.\n * - `descriptive` (6 to 19): the bootstrap interval as spread, and the sign-test p.\n * - `bootstrap` (20 or more): the decision-grade bootstrap interval.\n *\n * When every paired delta is equal the interval would have zero width, which\n * is an absence of evidence; the estimate is then `indeterminate` and carries\n * neither an interval nor a p-value.\n */\nexport function estimateNodeFromCells(input: EstimateNodeCellsInput): NodeEstimate {\n const { nodeId, against, split, direction } = input\n if (nodeId === against) {\n throw new SearchLedgerError(`node ${nodeId} cannot be estimated against itself`)\n }\n assertDistinctCells([...input.nodeCells, ...input.againstCells], nodeId, against)\n const cellSetDigest = searchCellSetDigest(input)\n const nodeUnits = searchUnitScores(input.nodeCells)\n const { node, other } = pairUnits(nodeUnits, unitMeans(searchUnitScores(input.againstCells)))\n const pairs = node.length\n const method = searchEstimateMethod(pairs)\n const base = {\n against,\n split,\n units: nodeUnits.length,\n pairs,\n method,\n cellSetDigest,\n estimator: SEARCH_ESTIMATOR,\n }\n if (method === 'none') {\n return { ...base, delta: null, interval: null, exactSignP: null, indeterminate: false }\n }\n // The test's `after - before` is the improvement: node minus against when\n // larger is better, against minus node when smaller is.\n const maximize = direction === 'maximize'\n const test = pairedDeltaTest(maximize ? other : node, maximize ? node : other, {\n statistic: DECISION_PAIRED_DELTA_STATISTIC,\n confidence: CONFIDENCE,\n resamples: RESAMPLES,\n seed: seedFromDigest(cellSetDigest),\n })\n const { mean, low, high } = test.bootstrap\n const indeterminate = test.indeterminate\n const spread = (method === 'descriptive' || method === 'bootstrap') && !indeterminate\n return {\n ...base,\n delta: plain(maximize ? mean : -mean),\n interval: spread ? (maximize ? [plain(low), plain(high)] : [plain(-high), plain(-low)]) : null,\n exactSignP: method === 'descriptive' && !indeterminate ? test.pValue : null,\n indeterminate,\n }\n}\n\n/**\n * `estimateNodeFromCells` over the cells a search state holds: `nodeId`\n * against `against` on one split, in the direction the search's objective\n * declares.\n */\nexport function estimateNode(\n state: SearchStateView,\n nodeId: string,\n options: { against: string; split: SearchSplit },\n): NodeEstimate {\n const header = state.header\n if (!header) throw new SearchLedgerError(`search ${state.searchId} has not been opened`)\n for (const id of [nodeId, options.against]) {\n if (!state.hasNode(id)) {\n throw new SearchLedgerError(`node ${id} is not in search ${state.searchId}`)\n }\n }\n return estimateNodeFromCells({\n nodeId,\n against: options.against,\n split: options.split,\n direction: header.objective.direction,\n nodeCells: state.scoredCells(nodeId, options.split),\n againstCells: state.scoredCells(options.against, options.split),\n })\n}\n\n/** A node's normal posterior on its improvement over the root. */\nexport interface NodePosterior {\n nodeId: string\n /** Units the node and the root both scored. */\n pairs: number\n /** Mean per-unit improvement over the root in the objective's direction,\n * so larger is better for either direction. Null without a shared unit. */\n mean: number | null\n /** The pooled variance divided by `pairs`. Null when either is unknown. */\n variance: number | null\n}\n\nexport interface SearchPosterior {\n split: SearchSplit\n rootNodeId: string\n /**\n * Between-unit variance of the per-unit improvements over the root, pooled\n * across every non-root node with at least 2 shared units. Null until some\n * node has 2.\n */\n pooledVariance: number | null\n /** Sum over the pooled nodes of their shared units minus one. */\n degreesOfFreedom: number\n /** Every node in registration order; the root first, at exactly 0. */\n nodes: NodePosterior[]\n}\n\n/**\n * The posterior every node's parent-selection draw uses. Each node's mean is\n * its improvement over the root on shared units; its variance is the search's\n * pooled between-unit variance divided by its unit count, so a node measured\n * on one unit has a wide posterior rather than none. The root is the reference\n * and sits at exactly 0.\n */\nexport function searchPosterior(\n state: SearchStateView,\n options: { split?: SearchSplit } = {},\n): SearchPosterior {\n const split = options.split ?? 'selection'\n const header = state.header\n if (!header) throw new SearchLedgerError(`search ${state.searchId} has not been opened`)\n const rootNodeId = state.rootNodeId\n if (rootNodeId === null) {\n throw new SearchLedgerError(`search ${state.searchId} has no root node yet`)\n }\n const sign = header.objective.direction === 'maximize' ? 1 : -1\n const root = searchUnitScores(state.scoredCells(rootNodeId, split))\n const rootMeans = unitMeans(root)\n const nodes: NodePosterior[] = []\n let squares = 0\n let degreesOfFreedom = 0\n for (const nodeId of state.nodeIds()) {\n if (nodeId === rootNodeId) {\n const measured = root.length > 0\n nodes.push({\n nodeId,\n pairs: root.length,\n mean: measured ? 0 : null,\n variance: measured ? 0 : null,\n })\n continue\n }\n const { node, other } = pairUnits(searchUnitScores(state.scoredCells(nodeId, split)), rootMeans)\n const gains = node.map((value, index) => sign * (value - other[index]!))\n const mean = gains.length > 0 ? sum(gains) / gains.length : null\n if (mean !== null && gains.length >= 2) {\n squares += sum(gains.map((gain) => (gain - mean) ** 2))\n degreesOfFreedom += gains.length - 1\n }\n nodes.push({\n nodeId,\n pairs: gains.length,\n mean: mean === null ? null : plain(mean),\n variance: null,\n })\n }\n const pooledVariance = degreesOfFreedom > 0 ? squares / degreesOfFreedom : null\n if (pooledVariance !== null) {\n for (const posterior of nodes) {\n if (posterior.nodeId !== rootNodeId && posterior.pairs > 0) {\n posterior.variance = pooledVariance / posterior.pairs\n }\n }\n }\n return { split, rootNodeId, pooledVariance, degreesOfFreedom, nodes }\n}\n\nfunction unitMeans(units: readonly SearchUnitScore[]): ReadonlyMap<string, number> {\n return new Map(units.map((unit) => [unit.unitId, unit.mean]))\n}\n\n/** Unit means of two nodes on the units both scored, aligned in the node's\n * unitId order. */\nfunction pairUnits(\n node: readonly SearchUnitScore[],\n otherMeans: ReadonlyMap<string, number>,\n): { node: number[]; other: number[] } {\n const paired = { node: [] as number[], other: [] as number[] }\n for (const unit of node) {\n const mean = otherMeans.get(unit.unitId)\n if (mean === undefined) continue\n paired.node.push(unit.mean)\n paired.other.push(mean)\n }\n return paired\n}\n\nfunction assertDistinctCells(\n cells: readonly SearchScoredCell[],\n nodeId: string,\n against: string,\n): void {\n const seen = new Set<string>()\n for (const cell of cells) {\n if (seen.has(cell.cellId)) {\n throw new SearchLedgerError(\n `cell ${cell.cellId} appears twice in the estimate of ${nodeId} against ${against}`,\n )\n }\n if (!Number.isFinite(cell.score)) {\n throw new SearchLedgerError(`cell ${cell.cellId} has a non-finite score ${cell.score}`)\n }\n seen.add(cell.cellId)\n }\n}\n\n/** The first 32 bits of a `sha256:` digest, as a bootstrap's seed. */\nexport function seedFromDigest(digest: SearchLedgerHash): number {\n return Number.parseInt(digest.slice('sha256:'.length, 'sha256:'.length + 8), 16) | 0\n}\n\nfunction sum(values: readonly number[]): number {\n let total = 0\n for (const value of values) total += value\n return total\n}\n\n/** Canonical JSON has one zero; never hand it a negative one. */\nfunction plain(value: number): number {\n return value === 0 ? 0 : value\n}\n","/**\n * Shared, pure helpers for `src/search/lenses/*`.\n *\n * Every lens is a pure function of a `SearchStateView` (search-tree-design\n * §12): it reads no other record type and does no I/O. These helpers exist so\n * each lens states its own numbers instead of re-deriving thresholds; they\n * reuse agent-eval's own statistics and estimator revisions rather than\n * inventing new ones.\n */\n\nimport { searchEstimateMethod } from '../../campaign/estimate-node'\nimport type { SearchStateView } from '../../campaign/search-state'\nimport { minimumPairsForPairedDeltaTest } from '../../paired-delta-test'\nimport { confidenceInterval } from '../../statistics'\n\n/** The search's own ranking split: selection when the search declares one,\n * else train. Matches `searchPolicyView` and `agent-eval search show`, so a\n * lens ranks nodes on exactly the split the search itself ranks them on. */\nexport function rankingSplit(state: SearchStateView): 'train' | 'selection' {\n const header = state.header\n return header && header.splits.selection.tasks.length > 0 ? 'selection' : 'train'\n}\n\n/** The smallest sample an exact one-sided sign test can resolve at 95%: the\n * same gate `NodeEstimate.method` uses for `insufficient`. */\nexport const INSUFFICIENT_FROM = minimumPairsForPairedDeltaTest(0.95)\n\n/** One named signal a `SearchPolicy` can read: a small, quantitative payload\n * under one label, so a policy reads `signal.value` without knowing a lens's\n * full `data` shape. */\nexport interface LensSignal<T> {\n name: string\n value: T\n}\n\nexport interface LensResult<TData, TSignal> {\n data: TData\n signal: LensSignal<TSignal>\n}\n\n/** A descriptive summary of an independent (unpaired) numeric sample, staged\n * by `NodeEstimate.method`'s own function (`searchEstimateMethod`): `none`\n * below 2 observations, with no mean (one observation is no estimate, §6.4),\n * `insufficient` below {@link INSUFFICIENT_FROM}, `descriptive` (bootstrap\n * interval, spread only) below `BOOTSTRAP_GATE_MIN_N`, `bootstrap`\n * (decision-grade interval) from there. Unlike `estimateNode`, these samples\n * are not paired on a shared unit, so this is never a claim — only a\n * lens's own honest description of what it measured. */\nexport interface SampleSummary {\n n: number\n mean: number | null\n method: 'none' | 'insufficient' | 'descriptive' | 'bootstrap'\n interval: [number, number] | null\n /** How `interval` was computed; null without one. The samples are\n * independent (unpaired), so it is a percentile bootstrap of their mean:\n * 1000 resamples at 95%, seeded by the caller or else by a hash of the data,\n * so a fixed sample always gives the same interval. */\n intervalMethod: 'percentile-bootstrap-of-mean' | null\n}\n\nexport function summarizeSamples(samples: readonly number[], seed?: number): SampleSummary {\n const n = samples.length\n const method = searchEstimateMethod(n)\n if (method === 'none') return { n, mean: null, method, interval: null, intervalMethod: null }\n const mean = samples.reduce((a, b) => a + b, 0) / n\n if (method === 'insufficient') {\n return { n, mean, method, interval: null, intervalMethod: null }\n }\n const { lower, upper } = confidenceInterval(\n [...samples],\n 0.95,\n seed === undefined ? {} : { seed },\n )\n return {\n n,\n mean,\n method,\n interval: [lower, upper],\n intervalMethod: 'percentile-bootstrap-of-mean',\n }\n}\n","/**\n * `operatorYield(state)`: outcome counts and yield per known dollar, by the\n * operator each edge names (search-tree-design §12).\n *\n * A node counts once, under the operator of the edge that registered it. A\n * re-proposal (an edge into a node an earlier edge registered) adds a\n * proposal and a `reproposals` count to its operator, but no outcome and no\n * yield sample: it produced no new artifact and no new measurement, so\n * counting its node again would repeat one measurement as independent\n * evidence.\n *\n * \"Yield\" reuses `searchPosterior` (E3, `../../campaign/estimate-node`): its\n * per-node mean is already the node's improvement over the root, oriented so\n * larger is always better regardless of the objective's direction — this\n * lens adds no second orientation rule of its own. A child's sample is\n * `posteriorMean / screenCostUsd`: the gain over the known cost of producing\n * and screening the node, which is the operator's doing. That cost is the\n * node's share of its proposal (the candidate-generation operation's cost\n * split evenly over every child edge the operation recorded, re-proposals\n * included) plus its cells allocated before its first decision: the first\n * rung and the proposer's train feedback, which the allocator plans together\n * at admission. Cells a later rung or the claim adds come after an\n * `advanced` or `finalist` decision; they are the allocator's and the\n * claim's choice, not the operator's, so an operator whose children advance\n * is not charged for the measurement their success earned. A seed edge\n * proposed nothing, so the root's cost is its cells alone.\n *\n * A child enters the sample only when both numbers are known: the node\n * shares 2 or more units with the root (one shared unit is no estimate,\n * §6.4); the edge names a recorded proposal operation whose cost is known;\n * every screen cell has run and has a known cost (an unpriced or unrecorded\n * part never floors a node to an artificially cheap, inflated yield); and it\n * was not decided `invalid` (a judge integrity or admission failure: its\n * score is not evidence of improvement, and `editCredit` excludes such nodes\n * the same way). A $0-known-cost node is excluded from yield (division by\n * zero is not a yield), not treated as free.\n */\n\nimport { searchPosterior } from '../../campaign/estimate-node'\nimport type {\n SearchEdgeOperator,\n SearchEdgeRecordedEvent,\n SearchNodeStatus,\n} from '../../campaign/search-ledger-types'\nimport type { SearchNode, SearchStateView } from '../../campaign/search-state'\nimport { rankingSplit, type SampleSummary, summarizeSamples } from './shared'\n\n/** The operators an expansion may choose (`SearchExpansion.operator` in\n * `search-policy.ts`): every edge operator except `seed` (the search's own\n * start) and `derive` (a cross-search edge a proposer never chooses). */\nexport const EXPANSION_OPERATORS = ['draft', 'improve', 'debug', 'merge'] as const\nexport type ExpansionOperator = (typeof EXPANSION_OPERATORS)[number]\n\n/** The bandit's own gate: an operator's weight is used only once it has this\n * many yield-eligible outcomes; below it, the policy falls back to a fixed\n * weight for that operator. Same threshold `NodeEstimate.method` uses for\n * `insufficient` (`minimumPairsForPairedDeltaTest(0.95)` = 6). */\nexport const MIN_OUTCOMES_FOR_WEIGHT = 6\n\nconst YIELD_METHOD =\n \"per registered node, searchPosterior's mean gain over the root divided by the known cost of producing and screening the node: its even share of the proposal operation's cost over the operation's child edges, plus its cells allocated before its first decision (first rung and train feedback; later rungs and the claim excluded); no sample when the node was decided invalid, shares fewer than 2 units with the root, or any part of that cost is unknown, unrecorded or zero\"\n\nexport interface OperatorOutcomeCounts {\n advanced: number\n finalist: number\n selected: number\n pruned: number\n rejected: number\n invalid: number\n undecided: number\n}\n\nexport interface OperatorYieldRow {\n operator: SearchEdgeOperator\n /** Edges recorded with this operator, re-proposals included. */\n proposals: number\n /** Of `proposals`, edges into a node an earlier edge registered. */\n reproposals: number\n /** Nodes this operator registered, by their latest status: one per node. */\n outcomes: OperatorOutcomeCounts\n /** Registered nodes excluded from `yield`: decided invalid, fewer than 2\n * units shared with the root, or a proposal or screen cost that is\n * unknown, unrecorded or zero. Never imputed into `yield`. */\n excluded: number\n yield: SampleSummary\n}\n\nexport interface OperatorYieldData {\n split: 'train' | 'selection'\n /** How a yield sample is computed. */\n method: string\n rows: OperatorYieldRow[]\n}\n\nexport interface OperatorYieldOptions {\n split?: 'train' | 'selection'\n}\n\n/** One weight per expandable operator: an operator's yield mean once it has\n * `MIN_OUTCOMES_FOR_WEIGHT` or more samples, else `null` (not yet trusted —\n * the policy's own fallback decides what an untrusted operator gets). */\nexport type OperatorYieldSignal = Record<ExpansionOperator, number | null>\n\nexport function operatorYield(\n state: SearchStateView,\n options: OperatorYieldOptions = {},\n): { data: OperatorYieldData; signal: { name: string; value: OperatorYieldSignal } } {\n const split = options.split ?? rankingSplit(state)\n // `searchPosterior` needs an opened search with a root; before that there\n // is no edge to count either.\n const posteriorByNode = new Map(\n state.header && state.rootNodeId !== null\n ? searchPosterior(state, { split }).nodes.map((node) => [node.nodeId, node])\n : [],\n )\n\n const grouped = new Map<\n SearchEdgeOperator,\n {\n proposals: number\n reproposals: number\n outcomes: OperatorOutcomeCounts\n excluded: number\n samples: number[]\n }\n >()\n const group = (operator: SearchEdgeOperator) => {\n let existing = grouped.get(operator)\n if (!existing) {\n existing = {\n proposals: 0,\n reproposals: 0,\n outcomes: {\n advanced: 0,\n finalist: 0,\n selected: 0,\n pruned: 0,\n rejected: 0,\n invalid: 0,\n undecided: 0,\n },\n excluded: 0,\n samples: [],\n }\n grouped.set(operator, existing)\n }\n return existing\n }\n\n const edges = state.edges()\n // Every child a proposal returned shares its cost evenly, a re-proposal's\n // share included: the proposal produced that artifact too.\n const childEdges = new Map<string, number>()\n for (const edge of edges) {\n const operationId = edge.proposer?.operationId\n if (operationId) childEdges.set(operationId, (childEdges.get(operationId) ?? 0) + 1)\n }\n\n for (const edge of edges) {\n const child = state.node(edge.childNodeId)\n if (!child) continue\n const bucket = group(edge.operator)\n bucket.proposals += 1\n if (child.edgeIds[0] !== edge.edgeId) {\n bucket.reproposals += 1\n continue\n }\n bucket.outcomes[statusKey(child.status)] += 1\n\n const posterior = posteriorByNode.get(child.nodeId)\n const costUsd = screenCostUsd(state, child, edge, childEdges)\n if (\n child.status === 'invalid' ||\n !posterior ||\n posterior.mean === null ||\n posterior.pairs < 2 ||\n costUsd === null ||\n costUsd <= 0\n ) {\n bucket.excluded += 1\n continue\n }\n bucket.samples.push(posterior.mean / costUsd)\n }\n\n const rows: OperatorYieldRow[] = [...grouped.entries()]\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n .map(([operator, bucket]) => ({\n operator,\n proposals: bucket.proposals,\n reproposals: bucket.reproposals,\n outcomes: bucket.outcomes,\n excluded: bucket.excluded,\n yield: summarizeSamples(bucket.samples),\n }))\n\n const signalValue = {} as OperatorYieldSignal\n for (const operator of EXPANSION_OPERATORS) {\n const row = rows.find((r) => r.operator === operator)\n signalValue[operator] =\n row && row.yield.n >= MIN_OUTCOMES_FOR_WEIGHT && row.yield.mean !== null\n ? row.yield.mean\n : null\n }\n\n return {\n data: { split, method: YIELD_METHOD, rows },\n signal: { name: 'operatorYield.weights', value: signalValue },\n }\n}\n\n/** The known cost of producing and screening `node`, which `edge` registered;\n * null when any part of it is unknown. The screen ends at the node's first\n * decision: the allocator records `advanced` before it allocates a further\n * rung, and the claim decides `finalist` before it allocates test cells. */\nfunction screenCostUsd(\n state: SearchStateView,\n node: SearchNode,\n edge: SearchEdgeRecordedEvent,\n childEdges: ReadonlyMap<string, number>,\n): number | null {\n let usd = 0\n if (edge.proposer !== null) {\n const { operationId } = edge.proposer\n if (operationId === null) return null\n const operation = state.operation(operationId)\n if (!operation?.recorded || !operation.costKnown) return null\n usd += operation.spentUsd / childEdges.get(operationId)!\n }\n const screenEnd = node.decisions[0]?.sequence ?? Number.POSITIVE_INFINITY\n for (const cell of state.cells({ nodeId: node.nodeId })) {\n if (cell.allocatedSequence > screenEnd) continue\n // A cell that has not run has no cost yet, so its cost is not known.\n if (!cell.costKnown || (cell.attempts === 0 && cell.cancelled === null)) return null\n usd += cell.spentUsd\n }\n return usd\n}\n\nfunction statusKey(status: SearchNodeStatus | null): keyof OperatorOutcomeCounts {\n return status ?? 'undecided'\n}\n","/**\n * @module\n * Joint power of a configured {@link decidePairedPromotion} call, computed by\n * running that call on data drawn from a registered alternative.\n *\n * Why a simulation and not a formula: `decidePairedPromotion` is not one test.\n * It routes by sample size (exact sign test below `BOOTSTRAP_GATE_MIN_N`,\n * paired bootstrap at or above it) and by shape (Tango's score interval on a\n * two-point outcome), and on top of the deciding interval it applies a\n * sufficiency floor, a zero-width refusal and McNemar's exact veto. A\n * preregistration usually seals two such calls, a continuous primary and a\n * pass/fail veto drawn from the same episodes, and promotes only when both\n * promote. The sample size at which THAT procedure reaches a target power is\n * not the power of any one channel: the sign-test power at n can be 0.8 while\n * the promotion probability is well below it because the veto binds\n * (agent-eval#785). Closed forms exist for single channels only, and each one\n * shipped here under-sized the call it stood in for (`mcnemarRequiredN` is\n * Lachin's normal approximation, 0.65 exact power where it promised 0.8 at 14\n * pairs; `requiredPairedSampleSize` sizes a paired t the procedure never runs).\n * So the only faithful power is the procedure's own promotion rate under the\n * alternative, and that is what this module computes: draw n pairs from the\n * registered law, run every configured call on them exactly as the caller\n * will, repeat, count.\n *\n * The alternative is DECLARATIVE and serializable, never a sampler function,\n * so a preregistration can seal it as bytes: a mixture of cells, each with a\n * probability, an optional pass/fail outcome per arm for the binary calls,\n * and a law for the candidate-minus-baseline delta on the continuous scale.\n * Drawing the cell first and the delta given the cell is what makes the two\n * channels one joint law rather than two marginals.\n *\n * Everything is seeded (`mulberry32`), so a sizing is reproducible from its\n * inputs, and every estimate carries its Monte Carlo standard error and a\n * Wilson interval: a power read at 0.80 from 1,000 simulations is 0.80 ± 0.013.\n */\n\nimport {\n decidePairedPromotion,\n type PairedDecisionMethod,\n type PairedPromotionDecision,\n type PairedPromotionDecisionOptions,\n} from './paired-promotion-decision'\nimport { wilson } from './statistics/paired-binary'\nimport { mulberry32 } from './statistics/random'\n\n/** A serializable law for one scalar draw. */\nexport type PairedValueLaw =\n | { kind: 'point'; value: number }\n | { kind: 'atoms'; atoms: ReadonlyArray<{ value: number; probability: number }> }\n | { kind: 'normal'; mean: number; sd: number }\n\nexport interface PairedPromotionAlternativeCell {\n /** Probability of this cell. The cells' probabilities sum to 1. */\n probability: number\n /** Pass/fail outcome of each arm in this cell. Required by every call whose\n * `outcome` is `'pass'`; ignored otherwise. */\n pass?: { control: boolean; treatment: boolean }\n /** Law of the candidate-minus-baseline delta on the continuous scale, given\n * this cell. A tie is `{ kind: 'point', value: 0 }`. */\n delta: PairedValueLaw\n}\n\nexport interface PairedPromotionAlternative {\n /** The registered joint law: the cell is drawn first, then the delta given\n * the cell, so pass/fail and delta are dependent exactly as registered. */\n cells: ReadonlyArray<PairedPromotionAlternativeCell>\n /**\n * Law of the control arm's value on the continuous scale; the candidate is\n * control plus delta. Default `{ kind: 'point', value: 0 }`. The mean and\n * median bootstraps read only the deltas, so the baseline changes nothing\n * there; it matters only when a `'delta'` call infers its shape from the\n * observed values (see `continuous` on {@link PairedPromotionDecisionOptions}).\n */\n baseline?: PairedValueLaw\n}\n\nexport interface PairedPromotionPowerCall {\n /** What the call reads from each simulated pair: `'delta'` gives it\n * `(control, control + delta)` on the continuous scale, `'pass'` gives it\n * each arm's pass/fail as `0` or `options.binaryScale ?? 1`. */\n outcome: 'delta' | 'pass'\n /** The call's options, exactly as the caller will run it. `minPairs`\n * defaults to the simulated n, the value a gate seals; a caller-supplied\n * value is kept, and one above n refuses every simulation. A `'pass'` call\n * must declare `binaryScale`: the simulation never declares one on the\n * caller's behalf, because a declared scale routes an all-zero sample to\n * the score interval where an inferred one refuses it. */\n options: PairedPromotionDecisionOptions\n}\n\nexport interface PairedPromotionPowerOptions {\n /** Total paired episodes, ties included. */\n n: number\n alternative: PairedPromotionAlternative\n /** Every call must return `promote: true` for a simulation to count as a\n * promotion. At least one call. */\n calls: ReadonlyArray<PairedPromotionPowerCall>\n /** Simulated data sets. Default 1000. */\n simulations?: number\n /** PRNG seed for the simulated draws (not the bootstrap's seed, which each\n * call carries in its own options). Default 1. */\n seed?: number\n}\n\nexport interface PairedPromotionCallRates {\n outcome: 'delta' | 'pass'\n /** Fraction of simulations in which this call alone promoted. */\n promote: number\n /** Fractions of simulations in which each refusal channel fired. */\n insufficient: number\n indeterminate: number\n exactTestVetoes: number\n /** Fraction in which the call was sufficient, determinate, not vetoed, and\n * still did not clear its threshold. */\n hold: number\n /** Fraction of simulations decided by each method; the regime the call\n * actually ran in at this n. */\n methods: Partial<Record<PairedDecisionMethod, number>>\n}\n\nexport interface PairedPromotionPowerResult {\n n: number\n simulations: number\n seed: number\n /** Fraction of simulations in which every call promoted: the joint power. */\n power: number\n /** Monte Carlo standard error of `power`. */\n standardError: number\n /** Wilson 95% interval on `power`. */\n low: number\n high: number\n /** Fraction in which at least one call refused (insufficient, indeterminate\n * or vetoed); the rest of the non-promotions are holds. */\n refuse: number\n hold: number\n /** Per-call rates, in the order the calls were supplied. */\n calls: PairedPromotionCallRates[]\n}\n\nexport interface RequiredPairsForPairedPromotionOptions {\n /** Target joint power. Default 0.8. */\n target?: number\n alternative: PairedPromotionAlternative\n calls: ReadonlyArray<PairedPromotionPowerCall>\n /** Smallest n to consider. Default 1. */\n minPairs?: number\n /** Largest n to consider; the scan stops there with `n: null` if the target\n * is never reached. Default 200. */\n maxPairs?: number\n simulations?: number\n seed?: number\n}\n\nexport interface RequiredPairsForPairedPromotionResult {\n target: number\n /** First n scanned whose estimated joint power reaches the target, or null\n * when no n up to `maxPairs` does. Descriptive only: power is not monotone\n * in n on the exact and discrete routes, the scan reads one noisy estimate\n * per n, and the first crossing of many is biased low. Read the curve. */\n n: number | null\n /**\n * The conservative choice, which a preregistration should prefer: the first\n * scanned n whose Wilson lower bound reaches the target AND whose\n * independent confirmation (a second simulation at that n on a fresh seed,\n * `confirmation` below) also has its lower bound at or above the target. The\n * confirmation is what keeps the 95 % coverage: a scan over many n gives\n * Monte Carlo noise many chances to push one bound across, so the scan's own\n * bound selects a candidate and never certifies it. Never set while `n` is\n * null. Null when not reached by `maxPairs`.\n */\n nAtLowerBound: number | null\n /** The independent simulation at `nAtLowerBound`; null when not reached. */\n confirmation: PairedPromotionPowerResult | null\n /** Every n scanned, in order, with its scan estimate; candidates whose\n * confirmation failed are in `rejected`. The scan stops at `nAtLowerBound`\n * when that is reached, else at `maxPairs`. */\n curve: PairedPromotionPowerResult[]\n /** Candidates the scan's bound selected and the confirmation refused. */\n rejected: PairedPromotionPowerResult[]\n}\n\n/**\n * Joint power of the configured calls at `n` under the registered alternative:\n * the fraction of simulated data sets on which every call promotes.\n */\nexport function pairedPromotionPower(\n options: PairedPromotionPowerOptions,\n): PairedPromotionPowerResult {\n const n = options.n\n if (!Number.isInteger(n) || n < 1) {\n throw new Error(`pairedPromotionPower: n must be a positive integer, got ${n}`)\n }\n const simulations = options.simulations ?? 1000\n if (!Number.isInteger(simulations) || simulations < 1) {\n throw new Error(\n `pairedPromotionPower: simulations must be a positive integer, got ${simulations}`,\n )\n }\n const seed = options.seed ?? 1\n if (!Number.isFinite(seed)) {\n throw new Error(`pairedPromotionPower: seed must be finite, got ${seed}`)\n }\n const calls = validateCalls(options.calls)\n const alternative = validateAlternative(options.alternative, calls)\n const rng = mulberry32(seed)\n\n let promotions = 0\n let refusals = 0\n const perCall = calls.map(() => ({\n promote: 0,\n insufficient: 0,\n indeterminate: 0,\n exactTestVetoes: 0,\n hold: 0,\n methods: new Map<PairedDecisionMethod, number>(),\n }))\n\n for (let s = 0; s < simulations; s++) {\n const pairs = drawPairs(alternative, n, rng)\n let all = true\n let anyRefusal = false\n for (let c = 0; c < calls.length; c++) {\n const call = calls[c]!\n const decision = runCall(call, pairs, n)\n const tally = perCall[c]!\n tally.methods.set(decision.method, (tally.methods.get(decision.method) ?? 0) + 1)\n if (decision.promote) tally.promote++\n else {\n if (!decision.sufficient) tally.insufficient++\n if (decision.indeterminate) tally.indeterminate++\n if (decision.exactTestVetoes) tally.exactTestVetoes++\n if (decision.sufficient && !decision.indeterminate && !decision.exactTestVetoes) {\n tally.hold++\n }\n }\n if (!decision.promote) all = false\n if (!decision.sufficient || decision.indeterminate || decision.exactTestVetoes) {\n anyRefusal = true\n }\n }\n if (all) promotions++\n else if (anyRefusal) refusals++\n }\n\n const power = promotions / simulations\n const interval = wilson(promotions, simulations, 0.95)\n return {\n n,\n simulations,\n seed,\n power,\n standardError: Math.sqrt((power * (1 - power)) / simulations),\n low: interval.lower,\n high: interval.upper,\n refuse: refusals / simulations,\n hold: (simulations - promotions - refusals) / simulations,\n calls: perCall.map((tally, c) => ({\n outcome: calls[c]!.outcome,\n promote: tally.promote / simulations,\n insufficient: tally.insufficient / simulations,\n indeterminate: tally.indeterminate / simulations,\n exactTestVetoes: tally.exactTestVetoes / simulations,\n hold: tally.hold / simulations,\n methods: Object.fromEntries(\n [...tally.methods.entries()].map(([method, count]) => [method, count / simulations]),\n ) as Partial<Record<PairedDecisionMethod, number>>,\n })),\n }\n}\n\n/**\n * First n at which {@link pairedPromotionPower} reaches the target, scanning\n * every n from `minPairs` upward. Both the point-estimate answer and the\n * confirmed lower-bound answer are returned; the scan runs until the latter is\n * reached (so the curve past `n` is retained) or `maxPairs` is exhausted. A\n * candidate selected by the scan's bound is certified only by an independent\n * simulation at that n on a different seed; a candidate that fails it is\n * recorded and the scan continues.\n */\nexport function requiredPairsForPairedPromotion(\n options: RequiredPairsForPairedPromotionOptions,\n): RequiredPairsForPairedPromotionResult {\n const target = options.target ?? 0.8\n if (!Number.isFinite(target) || target <= 0 || target >= 1) {\n throw new Error(`requiredPairsForPairedPromotion: target must be in (0,1), got ${target}`)\n }\n const minPairs = options.minPairs ?? 1\n const maxPairs = options.maxPairs ?? 200\n if (!Number.isInteger(minPairs) || minPairs < 1) {\n throw new Error(\n `requiredPairsForPairedPromotion: minPairs must be a positive integer, got ${minPairs}`,\n )\n }\n if (!Number.isInteger(maxPairs) || maxPairs < minPairs) {\n throw new Error(\n `requiredPairsForPairedPromotion: maxPairs must be an integer >= minPairs, got ${maxPairs}`,\n )\n }\n const seed = options.seed ?? 1\n const curve: PairedPromotionPowerResult[] = []\n const rejected: PairedPromotionPowerResult[] = []\n let n: number | null = null\n let nAtLowerBound: number | null = null\n let confirmation: PairedPromotionPowerResult | null = null\n for (let candidate = minPairs; candidate <= maxPairs; candidate++) {\n const result = pairedPromotionPower({\n n: candidate,\n alternative: options.alternative,\n calls: options.calls,\n simulations: options.simulations,\n seed,\n })\n curve.push(result)\n if (n === null && result.power >= target) n = candidate\n if (result.low >= target) {\n // A fresh stream, keyed by the candidate so no two confirmations share\n // draws with each other or with the scan.\n const check = pairedPromotionPower({\n n: candidate,\n alternative: options.alternative,\n calls: options.calls,\n simulations: options.simulations,\n seed: confirmationSeed(seed, candidate),\n })\n if (check.low >= target) {\n nAtLowerBound = candidate\n confirmation = check\n break\n }\n rejected.push(check)\n }\n }\n return { target, n, nAtLowerBound, confirmation, curve, rejected }\n}\n\n/** A seed for the confirmation at `n` that never equals the scan seed. */\nfunction confirmationSeed(seed: number, n: number): number {\n // Golden-ratio hashing keeps distinct (seed, n) pairs on distinct 32-bit\n // streams; the final `| 1` guarantees it differs from the scan's own seed\n // for every n, whose stream the scan already consumed.\n return ((Math.imul((seed | 0) ^ 0x9e3779b9, 0x85ebca6b) + Math.imul(n, 0xc2b2ae35)) | 1) >>> 0\n}\n\ninterface DrawnPairs {\n control: number[]\n candidate: number[]\n controlPass: boolean[]\n candidatePass: boolean[]\n}\n\nfunction drawPairs(\n alternative: PairedPromotionAlternative,\n n: number,\n rng: () => number,\n): DrawnPairs {\n const baseline = alternative.baseline ?? { kind: 'point', value: 0 }\n const control: number[] = new Array(n)\n const candidate: number[] = new Array(n)\n const controlPass: boolean[] = new Array(n)\n const candidatePass: boolean[] = new Array(n)\n for (let i = 0; i < n; i++) {\n const cell = drawCell(alternative.cells, rng)\n const base = drawValue(baseline, rng)\n control[i] = base\n candidate[i] = base + drawValue(cell.delta, rng)\n controlPass[i] = cell.pass?.control ?? false\n candidatePass[i] = cell.pass?.treatment ?? false\n }\n return { control, candidate, controlPass, candidatePass }\n}\n\nfunction drawCell(\n cells: ReadonlyArray<PairedPromotionAlternativeCell>,\n rng: () => number,\n): PairedPromotionAlternativeCell {\n const u = rng()\n let cumulative = 0\n for (const cell of cells) {\n cumulative += cell.probability\n if (u < cumulative) return cell\n }\n // Rounding at the top of the cumulative sum lands here with probability ~0.\n return cells[cells.length - 1]!\n}\n\nfunction drawValue(law: PairedValueLaw, rng: () => number): number {\n switch (law.kind) {\n case 'point':\n return law.value\n case 'atoms': {\n const u = rng()\n let cumulative = 0\n for (const atom of law.atoms) {\n cumulative += atom.probability\n if (u < cumulative) return atom.value\n }\n return law.atoms[law.atoms.length - 1]!.value\n }\n case 'normal': {\n // Box-Muller; one normal per call keeps the stream simple and seeded.\n const u1 = 1 - rng()\n const u2 = rng()\n return law.mean + law.sd * Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2)\n }\n }\n}\n\nfunction runCall(\n call: PairedPromotionPowerCall,\n pairs: DrawnPairs,\n n: number,\n): PairedPromotionDecision {\n const options: PairedPromotionDecisionOptions = { minPairs: n, ...call.options }\n if (call.outcome === 'pass') {\n // Validated present: the scale is the caller's, never filled in here.\n const scale = call.options.binaryScale as number\n return decidePairedPromotion(\n pairs.controlPass.map((p) => (p ? scale : 0)),\n pairs.candidatePass.map((p) => (p ? scale : 0)),\n options,\n )\n }\n return decidePairedPromotion(pairs.control, pairs.candidate, options)\n}\n\nfunction validateCalls(\n calls: ReadonlyArray<PairedPromotionPowerCall>,\n): ReadonlyArray<PairedPromotionPowerCall> {\n if (!Array.isArray(calls) || calls.length === 0) {\n throw new Error('pairedPromotionPower: at least one call is required')\n }\n calls.forEach((call, i) => {\n if (call.outcome !== 'delta' && call.outcome !== 'pass') {\n throw new Error(`pairedPromotionPower: calls[${i}].outcome must be 'delta' or 'pass'`)\n }\n if (call.options === null || typeof call.options !== 'object') {\n throw new Error(`pairedPromotionPower: calls[${i}].options must be an object`)\n }\n if (\n call.options.minPairs !== undefined &&\n (!Number.isInteger(call.options.minPairs) || call.options.minPairs < 1)\n ) {\n throw new Error(\n `pairedPromotionPower: calls[${i}].options.minPairs must be a positive integer`,\n )\n }\n // Every combination the decision itself refuses is refused here, before\n // the first draw, with the reason named.\n if (call.outcome === 'pass') {\n const scale = call.options.binaryScale\n if (scale === undefined || !Number.isFinite(scale) || scale <= 0) {\n throw new Error(\n `pairedPromotionPower: calls[${i}] is a 'pass' call and must declare a finite positive options.binaryScale`,\n )\n }\n if (call.options.continuous) {\n throw new Error(\n `pairedPromotionPower: calls[${i}] is a 'pass' call; continuous cannot accompany it`,\n )\n }\n if (call.options.statistic === 'median') {\n throw new Error(\n `pairedPromotionPower: calls[${i}] is a 'pass' call; binaryScale requires the mean statistic, not median`,\n )\n }\n } else if (call.options.binaryScale !== undefined) {\n throw new Error(\n `pairedPromotionPower: calls[${i}] is a 'delta' call and cannot declare binaryScale; use a 'pass' call for a two-point outcome`,\n )\n }\n })\n return calls\n}\n\nfunction validateAlternative(\n alternative: PairedPromotionAlternative,\n calls: ReadonlyArray<PairedPromotionPowerCall>,\n): PairedPromotionAlternative {\n if (!alternative || !Array.isArray(alternative.cells) || alternative.cells.length === 0) {\n throw new Error('pairedPromotionPower: alternative.cells must be a non-empty array')\n }\n const needsPass = calls.some((call) => call.outcome === 'pass')\n let total = 0\n alternative.cells.forEach((cell, i) => {\n if (!Number.isFinite(cell.probability) || cell.probability < 0) {\n throw new Error(`pairedPromotionPower: cells[${i}].probability must be a finite number >= 0`)\n }\n total += cell.probability\n if (needsPass) {\n if (\n !cell.pass ||\n typeof cell.pass.control !== 'boolean' ||\n typeof cell.pass.treatment !== 'boolean'\n ) {\n throw new Error(\n `pairedPromotionPower: cells[${i}].pass must give control and treatment booleans when a 'pass' call is configured`,\n )\n }\n }\n validateLaw(cell.delta, `cells[${i}].delta`)\n })\n if (Math.abs(total - 1) > 1e-9) {\n throw new Error(`pairedPromotionPower: cell probabilities must sum to 1, got ${total}`)\n }\n if (alternative.baseline !== undefined) validateLaw(alternative.baseline, 'baseline')\n return alternative\n}\n\nfunction validateLaw(law: PairedValueLaw, where: string): void {\n if (!law || typeof law !== 'object') {\n throw new Error(`pairedPromotionPower: ${where} must be a law object`)\n }\n switch (law.kind) {\n case 'point':\n if (!Number.isFinite(law.value)) {\n throw new Error(`pairedPromotionPower: ${where}.value must be finite`)\n }\n return\n case 'atoms': {\n if (!Array.isArray(law.atoms) || law.atoms.length === 0) {\n throw new Error(`pairedPromotionPower: ${where}.atoms must be a non-empty array`)\n }\n let total = 0\n law.atoms.forEach((atom, i) => {\n if (!Number.isFinite(atom.value)) {\n throw new Error(`pairedPromotionPower: ${where}.atoms[${i}].value must be finite`)\n }\n if (!Number.isFinite(atom.probability) || atom.probability < 0) {\n throw new Error(\n `pairedPromotionPower: ${where}.atoms[${i}].probability must be a finite number >= 0`,\n )\n }\n total += atom.probability\n })\n if (Math.abs(total - 1) > 1e-9) {\n throw new Error(\n `pairedPromotionPower: ${where}.atoms probabilities must sum to 1, got ${total}`,\n )\n }\n return\n }\n case 'normal':\n if (!Number.isFinite(law.mean) || !Number.isFinite(law.sd) || law.sd < 0) {\n throw new Error(`pairedPromotionPower: ${where} needs a finite mean and a finite sd >= 0`)\n }\n return\n default:\n throw new Error(`pairedPromotionPower: ${where}.kind must be 'point', 'atoms' or 'normal'`)\n }\n}\n","/**\n * The claim: the one statement a search makes about its nodes, made once, on\n * its sealed test split, after the search stops expanding.\n *\n * `planSearchClaim` fixes the claim's design from the ledger before any test\n * cell runs: up to 3 finalists ranked by selection mean, the estimator the\n * paired decision will use, the number of finalists the family-wise confidence\n * is divided among, and a power check on selection data. The kernel stores the\n * plan on the ledger's `claim` operation, so the ledger proves the design was\n * fixed before the test data existed. `decideSearchClaim` then reads the test\n * cells of the root and the finalists, which ran together, and decides each\n * finalist against the root with `decidePairedPromotion` at the Bonferroni\n * confidence `1 - 0.05 / k`.\n *\n * Every number is a pure function of the ledger: the power simulation is\n * seeded from the search's seed and the decisions from the digest of the test\n * cells they read, so a verifier with the same ledger gets the same claim.\n */\n\nimport { canonicalString, hashCanonical } from '../ledger-core/canonical'\nimport { decidePairedPromotion, type PairedPromotionDecision } from '../paired-promotion-decision'\nimport {\n type PairedPromotionAlternative,\n type PairedPromotionPowerCall,\n pairedPromotionPower,\n} from '../paired-promotion-power'\nimport { estimateNode, searchPosterior, seedFromDigest } from './estimate-node'\nimport type {\n NodeEstimate,\n SearchClaim,\n SearchClaimEstimator,\n SearchClaimFinalist,\n SearchClaimPower,\n SearchClaimTest,\n SearchCloseReason,\n SearchNodeDecision,\n SearchSourceRef,\n} from './search-ledger-types'\nimport {\n SEARCH_CLAIM_MAX_FINALISTS,\n type SearchStateView,\n type SearchUnitScore,\n} from './search-state'\n\nconst FAMILY_CONFIDENCE = 0.95\nconst TARGET_POWER = 0.8\nconst POWER_SIMULATIONS = 500\nconst RESAMPLES = 2000\n\n/**\n * Every rule and parameter the claim depends on. Its digest is the claim's\n * revision; change a value here whenever the procedure changes, so the\n * revision moves with it.\n */\nconst CLAIM_DEFINITION = {\n name: 'tangle.search-claim.2026-09',\n finalists: `up to ${SEARCH_CLAIM_MAX_FINALISTS} non-root nodes not decided invalid that scored every selection unit and beat the root's mean on the selection units they share, ranked by selection mean in the objective's direction, then registration order`,\n familyConfidence: FAMILY_CONFIDENCE,\n correction: 'Bonferroni: each of k finalists against the root at 1 - (1 - familyConfidence) / k',\n finalistCount:\n 'the largest k whose test cells the unspent claim reserve and headroom cover and whose power reaches the target',\n estimator:\n 'binary with scale s when every train, selection and test unit has one task at one repeat and every pre-test score is 0 or s; otherwise continuous',\n power: {\n method: 'pairedPromotionPower of the claim decision, simulated at the claim minimumEffect',\n continuous: 'per-unit improvement normal with the pooled selection variance',\n binary:\n 'discordant units at the pooled selection variance over 2 s^2 per side, shifted by minimumEffect / s; concordant units pass at the root selection pass rate',\n targetPower: TARGET_POWER,\n simulations: POWER_SIMULATIONS,\n seed: 'the first 32 bits of hashCanonical([search seed, k])',\n },\n decision: {\n call: 'decidePairedPromotion(root, finalist) on per-unit test means in the objective direction',\n threshold: 0,\n minPairs: 'every test unit',\n resamples: RESAMPLES,\n seed: \"the first 32 bits of the finalist's test cellSetDigest\",\n },\n select: 'the promoted finalist with the largest improvement; ties to the better selection rank',\n ship: 'a promoted finalist that scored every test unit, with the root, on held-out units, under a pinned judge',\n} as const\n\n/** The claim procedure every `SearchClaim` and claim plan names. */\nexport const SEARCH_CLAIM_RULE: SearchSourceRef = {\n uri: 'npm:@tangle-network/agent-eval#searchClaim',\n revision: hashCanonical(CLAIM_DEFINITION),\n}\n\n/** The rule name decisions made by the claim record. */\nexport const SEARCH_CLAIM_RULE_NAME = CLAIM_DEFINITION.name\n\n/**\n * The claim reserve a search needs: the root and 3 finalists on every test\n * task at `reps` repeats, each held at `cellUsd`. Declare at least this as\n * `budget.reservedClaimUsd`; `runSearch` refuses to start a capped search\n * with less.\n */\nexport function searchClaimReserveUsd(input: {\n testTasks: number\n reps: number\n cellUsd: number\n}): number {\n return (1 + SEARCH_CLAIM_MAX_FINALISTS) * input.testTasks * input.reps * input.cellUsd\n}\n\n/**\n * The claim's design, fixed before any test cell runs, and stored as the\n * `claim-plan` artifact of the ledger's `claim` operation.\n */\nexport interface SearchClaimPlan {\n kind: 'search-claim-plan'\n rule: SearchSourceRef\n /** Why expansion stopped; the search closes with this reason. */\n stopReason: SearchCloseReason\n /** Best first. Every one is decided `finalist` and named by the claim. */\n finalists: Array<{ nodeId: string; selectionMean: number }>\n power: SearchClaimPower\n /** `run`: the root and the finalists run every test task. Otherwise the\n * claim closes with this decision and spends nothing on test cells. */\n test: 'run' | 'hold' | 'test-cannot-resolve'\n reason: string\n}\n\nexport interface PlanSearchClaimInput {\n stopReason: SearchCloseReason\n /** Repeats per test task. */\n reps: number\n /** Whether the budget admits the test cells of the root and `finalists`. */\n affordable(finalists: number): boolean\n}\n\n/** Fix the claim's design from a search that stopped expanding. */\nexport function planSearchClaim(\n state: SearchStateView,\n input: PlanSearchClaimInput,\n): SearchClaimPlan {\n const header = requireHeader(state)\n const root = state.rootNodeId!\n const plan = (\n finalists: SearchClaimPlan['finalists'],\n power: SearchClaimPower,\n test: SearchClaimPlan['test'],\n reason: string,\n ): SearchClaimPlan => ({\n kind: 'search-claim-plan',\n rule: SEARCH_CLAIM_RULE,\n stopReason: input.stopReason,\n finalists,\n power,\n test,\n reason,\n })\n const selectionUnits = unitIds(header.splits.selection.tasks)\n const testUnits = unitIds(header.splits.test.tasks)\n if (testUnits.length === 0) {\n return plan(\n [],\n { unknown: 'the search has no test split' },\n 'hold',\n 'the search has no test split, so it makes no claim',\n )\n }\n if (selectionUnits.length === 0) {\n return plan(\n [],\n { unknown: 'the search has no selection split to choose finalists on' },\n 'hold',\n 'the search has no selection split, so no finalist can be chosen without the test data',\n )\n }\n const candidates = rankFinalists(state, selectionUnits)\n if (candidates.length === 0) {\n return plan(\n [],\n { unknown: 'no node went to test' },\n 'hold',\n \"no node scored every selection unit and beat the root's selection mean, so the search keeps the root\",\n )\n }\n const minimumEffect = header.objective.claim.minimumEffect\n if (minimumEffect === undefined) {\n return plan(\n candidates.slice(0, 1),\n { unknown: 'the claim declares no minimumEffect' },\n 'test-cannot-resolve',\n 'the claim declares no minimumEffect, so no test split can be shown to resolve it',\n )\n }\n const { pooledVariance } = searchPosterior(state, { split: 'selection' })\n if (pooledVariance === null) {\n return plan(\n candidates.slice(0, 1),\n { unknown: 'no node shares 2 selection units with the root, so the variance is unknown' },\n 'test-cannot-resolve',\n 'the selection split gives no variance for the power check, so the test cannot be shown to resolve the minimum effect',\n )\n }\n const estimator = claimEstimator(state, input.reps)\n const rootPassRate = passRate(state.unitScores(root, 'selection'), estimator)\n let best: SearchClaimPower | null = null\n let budgetBound = false\n for (let k = candidates.length; k >= 1; k--) {\n const power = claimPower({\n units: testUnits.length,\n finalists: k,\n minimumEffect,\n pooledVariance,\n estimator,\n rootPassRate,\n seed: header.policy.seed,\n })\n best = power\n if (!power.adequate) continue\n if (!input.affordable(k)) {\n budgetBound = true\n continue\n }\n return plan(\n candidates.slice(0, k),\n power,\n 'run',\n `${k} finalist${k === 1 ? '' : 's'} go to test: power ${round(power.powerAtMinimumEffect)} at an improvement of ${minimumEffect} on ${testUnits.length} test units reaches ${TARGET_POWER} at confidence ${round(bonferroni(k))} each`,\n )\n }\n const power = best!\n return plan(\n candidates.slice(0, 1),\n power,\n 'test-cannot-resolve',\n budgetBound\n ? 'the unspent claim reserve and headroom do not cover the test cells of the root and one finalist'\n : `even one finalist reaches power ${round('adequate' in power ? power.powerAtMinimumEffect : 0)} at an improvement of ${minimumEffect} on ${testUnits.length} test units, below ${TARGET_POWER}`,\n )\n}\n\n/** A node decision the claim makes, ready for `recorder.decideNode`. */\nexport interface SearchClaimDecision {\n nodeId: string\n decision: SearchNodeDecision\n basis: NodeEstimate | null\n rule: string\n reason: string\n}\n\n/**\n * Decide the claim from the test cells of the root and the finalists. Call it\n * once every claim cell is settled or cancelled. It returns the claim and the\n * terminal decisions of the root and every finalist.\n */\nexport function decideSearchClaim(\n state: SearchStateView,\n plan: SearchClaimPlan,\n): { claim: SearchClaim; decisions: SearchClaimDecision[] } {\n const header = requireHeader(state)\n const root = state.rootNodeId!\n const rootScored = (['train', 'selection', 'test'] as const).some(\n (split) => state.scoredCells(root, split).length > 0,\n )\n const keepRoot = rootScored ? root : null\n const rule = SEARCH_CLAIM_RULE_NAME\n const decisions: SearchClaimDecision[] = []\n const claimOf = (\n finalists: SearchClaimFinalist[],\n selected: string | null,\n decision: SearchClaim['decision'],\n reason: string,\n ): SearchClaim => ({\n rule: SEARCH_CLAIM_RULE,\n confidence: FAMILY_CONFIDENCE,\n power: plan.power,\n finalists,\n selected,\n decision,\n reason,\n })\n\n if (plan.test !== 'run') {\n for (const finalist of plan.finalists) {\n decisions.push({\n nodeId: finalist.nodeId,\n decision: { status: 'rejected' },\n basis: null,\n rule,\n reason: `no test cell ran: ${plan.reason}`,\n })\n }\n decisions.push(rootDecision(root, rootScored ? 'kept' : 'unscored', rule, plan.reason))\n return {\n claim: claimOf(\n plan.finalists.map((finalist) => ({\n nodeId: finalist.nodeId,\n estimate: null,\n test: null,\n promote: false,\n })),\n keepRoot,\n plan.test,\n plan.reason,\n ),\n decisions,\n }\n }\n\n const power = plan.power\n if (!('adequate' in power)) throw new Error('a claim that runs its test cells has a known power')\n const k = plan.finalists.length\n const confidence = bonferroni(k)\n const testUnits = unitIds(header.splits.test.tasks)\n const maximize = header.objective.direction === 'maximize'\n const rootUnits = state.unitScores(root, 'test')\n const tested = plan.finalists.map(({ nodeId }) => {\n const estimate = estimateNode(state, nodeId, { against: root, split: 'test' })\n const test = pairedTest({\n root: rootUnits,\n node: state.unitScores(nodeId, 'test'),\n testUnits,\n confidence,\n estimator: power.estimator,\n maximize,\n seed: seedFromDigest(estimate.cellSetDigest),\n })\n return { nodeId, estimate, ...test }\n })\n\n const promoted = tested\n .map((entry, rank) => ({ ...entry, rank }))\n .filter((entry) => entry.promote)\n .sort((a, b) => b.improvement! - a.improvement! || a.rank - b.rank)\n const winner = promoted[0] ?? null\n const blockers: string[] = []\n if (!header.splits.heldOutUnits) blockers.push('the test units also appear in train or selection')\n if ('unknown' in header.objective.judge) blockers.push('the judge is not pinned')\n const ship = winner !== null && blockers.length === 0\n const selected = ship ? winner.nodeId : keepRoot\n const reason = ship\n ? `finalist ${winner.nodeId} beat the root on the ${testUnits.length} test units at confidence ${round(confidence)} (${k} finalist${k === 1 ? '' : 's'}, family-wise ${FAMILY_CONFIDENCE})`\n : winner !== null\n ? `finalist ${winner.nodeId} beat the root, but the claim cannot ship: ${blockers.join('; ')}`\n : `no finalist beat the root on the test split at confidence ${round(confidence)} (${k} finalist${k === 1 ? '' : 's'}, family-wise ${FAMILY_CONFIDENCE})`\n\n for (const entry of tested) {\n decisions.push({\n nodeId: entry.nodeId,\n decision: { status: ship && entry.nodeId === winner!.nodeId ? 'selected' : 'rejected' },\n basis: entry.estimate,\n rule,\n reason:\n ship && entry.nodeId === winner!.nodeId\n ? reason\n : entry.promote\n ? ship\n ? `promoted, but finalist ${winner!.nodeId} improved more on the test split`\n : reason\n : entry.why,\n })\n }\n decisions.push(\n rootDecision(root, ship ? 'replaced' : rootScored ? 'kept' : 'unscored', rule, reason),\n )\n return {\n claim: claimOf(\n tested.map((entry) => ({\n nodeId: entry.nodeId,\n estimate: entry.estimate,\n test: entry.test,\n promote: entry.promote,\n })),\n selected,\n ship ? 'ship' : 'hold',\n reason,\n ),\n decisions,\n }\n}\n\n/** Whether a closed search's claim is the one its own ledger supports. */\nexport type SearchClaimVerification =\n | { status: 'verified' }\n /** The claim differs from the one the claim rule makes from the ledger. */\n | { status: 'mismatch'; differences: string[] }\n /** The claim names a rule revision this code does not implement, so this\n * code can neither confirm nor refute it. */\n | { status: 'unknown'; reason: string }\n\n/**\n * Make a closed search's claim again from its ledger alone and compare it with\n * the recorded one, byte for byte: the power check, the finalists, each\n * finalist's test estimate and deciding interval, the selection, the decision\n * and the reason. A producer's claim is not evidence until this holds; a store\n * keeps what this function derives, not what the producer wrote.\n *\n * It needs no blob, so it works on a store that keeps digests only. The\n * finalists are the nodes the ledger decided `finalist`, in decision order.\n * The one input the ledger cannot replay is whether the budget covered k\n * finalists' test cells; the claim cells that ran answer it (none ran: the\n * budget covered none). Test repeats come from the claim cells too; without\n * test cells, the recorded estimator stands for them (binary needs one repeat,\n * so any other count reproduces continuous).\n *\n * Returns null for a search that made no claim.\n */\nexport function verifySearchClaim(state: SearchStateView): SearchClaimVerification | null {\n const closed = state.closed\n if (!closed) {\n throw new Error(`search ${state.searchId} is open; its claim is made when it closes`)\n }\n const recorded = closed.claim\n if (recorded === null) return null\n if (recorded.rule.revision !== SEARCH_CLAIM_RULE.revision) {\n return {\n status: 'unknown',\n reason: `the claim names rule revision ${recorded.rule.revision}; this code implements ${SEARCH_CLAIM_RULE.revision}`,\n }\n }\n const claimCells = state.cells().filter((cell) => cell.stage === 'claim')\n const decided = state\n .nodes()\n .flatMap((node) => {\n const first = node.decisions.find((record) => record.decision.status === 'finalist')\n return first ? [{ nodeId: node.nodeId, sequence: first.sequence }] : []\n })\n .sort((a, b) => a.sequence - b.sequence)\n .map((entry) => entry.nodeId)\n const reps =\n claimCells.length > 0\n ? 1 + Math.max(...claimCells.map((cell) => cell.rep))\n : 'adequate' in recorded.power && recorded.power.estimator.kind === 'binary'\n ? 1\n : 2\n const plan = planSearchClaim(state, {\n stopReason: closed.reason,\n reps,\n affordable: (finalists) => claimCells.length > 0 && finalists <= decided.length,\n })\n const differences: string[] = []\n const planned = plan.finalists.map((finalist) => finalist.nodeId)\n if (canonicalString(planned) !== canonicalString(decided)) {\n differences.push(\n `finalists: the rule picks [${planned.join(', ')}], the ledger decided [${decided.join(', ')}]`,\n )\n }\n if ((plan.test === 'run') !== claimCells.length > 0) {\n differences.push(\n `test: the plan ${plan.test === 'run' ? 'runs' : 'skips'} the test cells, and ${claimCells.length} ran`,\n )\n }\n const expected = decideSearchClaim(state, plan).claim\n for (const key of ['decision', 'selected', 'confidence', 'power', 'reason'] as const) {\n if (canonicalString(expected[key]) !== canonicalString(recorded[key])) {\n differences.push(\n `${key}: the ledger supports ${canonicalString(expected[key])}, the claim records ${canonicalString(recorded[key])}`,\n )\n }\n }\n const count = Math.max(expected.finalists.length, recorded.finalists.length)\n for (let index = 0; index < count; index++) {\n const want = expected.finalists[index]\n const have = recorded.finalists[index]\n if (canonicalString(want ?? null) === canonicalString(have ?? null)) continue\n const fields = (['nodeId', 'promote', 'test', 'estimate'] as const).filter(\n (field) => canonicalString(want?.[field] ?? null) !== canonicalString(have?.[field] ?? null),\n )\n differences.push(\n `finalist ${index + 1} (${have?.nodeId ?? want?.nodeId}): ${fields.join(', ')} differ from what the ledger supports`,\n )\n }\n return differences.length === 0 ? { status: 'verified' } : { status: 'mismatch', differences }\n}\n\n/** Per-finalist confidence for `k` finalists. */\nfunction bonferroni(k: number): number {\n return 1 - (1 - FAMILY_CONFIDENCE) / k\n}\n\nfunction rootDecision(\n root: string,\n fate: 'kept' | 'replaced' | 'unscored',\n rule: string,\n reason: string,\n): SearchClaimDecision {\n return {\n nodeId: root,\n decision: { status: fate === 'kept' ? 'selected' : 'rejected' },\n basis: null,\n rule,\n reason:\n fate === 'kept'\n ? `the search keeps the root: ${reason}`\n : fate === 'replaced'\n ? `a finalist replaces the root: ${reason}`\n : 'the root has no scored cell, so the search keeps nothing',\n }\n}\n\n/** Nodes eligible to go to test, best first, at most `SEARCH_CLAIM_MAX_FINALISTS`. */\nfunction rankFinalists(\n state: SearchStateView,\n selectionUnits: readonly string[],\n): Array<{ nodeId: string; selectionMean: number }> {\n const header = requireHeader(state)\n const sign = header.objective.direction === 'maximize' ? 1 : -1\n const root = state.rootNodeId!\n const rootMeans = new Map(\n state.unitScores(root, 'selection').map((unit) => [unit.unitId, unit.mean]),\n )\n const ranked: Array<{ nodeId: string; selectionMean: number; ordinal: number }> = []\n for (const node of state.nodes()) {\n if (node.nodeId === root || node.status === 'invalid') continue\n const units = state.unitScores(node.nodeId, 'selection')\n if (units.length !== selectionUnits.length) continue\n let gain = 0\n let shared = 0\n for (const unit of units) {\n const rootMean = rootMeans.get(unit.unitId)\n if (rootMean === undefined) continue\n gain += sign * (unit.mean - rootMean)\n shared += 1\n }\n if (shared === 0 || gain <= 0) continue\n ranked.push({\n nodeId: node.nodeId,\n selectionMean: mean(units.map((unit) => unit.mean)),\n ordinal: node.ordinal,\n })\n }\n ranked.sort((a, b) => sign * (b.selectionMean - a.selectionMean) || a.ordinal - b.ordinal)\n return ranked\n .slice(0, SEARCH_CLAIM_MAX_FINALISTS)\n .map(({ nodeId, selectionMean }) => ({ nodeId, selectionMean }))\n}\n\n/**\n * The paired decision's estimator, fixed from pre-test data. A per-unit mean\n * is binary only when each unit holds one task at one repeat and every score\n * seen before the test is 0 or one positive value.\n */\nfunction claimEstimator(state: SearchStateView, reps: number): SearchClaimEstimator {\n const header = requireHeader(state)\n const oneTaskPerUnit = (['train', 'selection', 'test'] as const).every((split) => {\n const tasks = header.splits[split].tasks\n return unitIds(tasks).length === tasks.length\n })\n if (!oneTaskPerUnit || reps !== 1) return { kind: 'continuous' }\n let scale: number | null = null\n for (const nodeId of state.nodeIds()) {\n for (const split of ['train', 'selection'] as const) {\n for (const cell of state.scoredCells(nodeId, split)) {\n if (cell.score === 0) continue\n if (cell.score < 0 || (scale !== null && cell.score !== scale))\n return { kind: 'continuous' }\n scale = cell.score\n }\n }\n }\n return scale === null ? { kind: 'continuous' } : { kind: 'binary', scale }\n}\n\nfunction passRate(units: readonly SearchUnitScore[], estimator: SearchClaimEstimator): number {\n if (estimator.kind !== 'binary' || units.length === 0) return 0\n return units.filter((unit) => unit.mean === estimator.scale).length / units.length\n}\n\nfunction claimPower(input: {\n units: number\n finalists: number\n minimumEffect: number\n pooledVariance: number\n estimator: SearchClaimEstimator\n rootPassRate: number\n seed: number\n}): Extract<SearchClaimPower, { adequate: boolean }> {\n const { units, finalists, minimumEffect, pooledVariance, estimator } = input\n const confidence = bonferroni(finalists)\n let alternative: PairedPromotionAlternative\n let call: PairedPromotionPowerCall\n if (estimator.kind === 'binary') {\n const s = estimator.scale\n const shift = Math.min(1, minimumEffect / s)\n const discordance = Math.min(0.5, pooledVariance / (2 * s * s))\n const loss = Math.max(0, discordance - shift / 2)\n const win = Math.min(1 - loss, loss + shift)\n const concordant = Math.max(0, 1 - win - loss)\n alternative = {\n cells: [\n {\n probability: win,\n pass: { control: false, treatment: true },\n delta: { kind: 'point', value: s },\n },\n {\n probability: loss,\n pass: { control: true, treatment: false },\n delta: { kind: 'point', value: -s },\n },\n {\n probability: concordant * input.rootPassRate,\n pass: { control: true, treatment: true },\n delta: { kind: 'point', value: 0 },\n },\n {\n probability: concordant * (1 - input.rootPassRate),\n pass: { control: false, treatment: false },\n delta: { kind: 'point', value: 0 },\n },\n ],\n }\n call = { outcome: 'pass', options: { binaryScale: s, confidence, threshold: 0 } }\n } else {\n alternative = {\n cells: [\n {\n probability: 1,\n delta: { kind: 'normal', mean: minimumEffect, sd: Math.sqrt(pooledVariance) },\n },\n ],\n }\n call = {\n outcome: 'delta',\n options: { continuous: true, confidence, threshold: 0, resamples: RESAMPLES },\n }\n }\n const simulated = pairedPromotionPower({\n n: units,\n alternative,\n calls: [call],\n simulations: POWER_SIMULATIONS,\n seed: seedFromDigest(hashCanonical([input.seed, finalists])),\n })\n return {\n adequate: simulated.power >= TARGET_POWER,\n minimumEffect,\n powerAtMinimumEffect: simulated.power,\n targetPower: TARGET_POWER,\n units,\n finalists,\n pooledVariance,\n estimator,\n }\n}\n\n/**\n * One finalist against the root on the test split, in the objective's\n * direction, requiring every test unit scored by both.\n */\nfunction pairedTest(input: {\n root: readonly SearchUnitScore[]\n node: readonly SearchUnitScore[]\n testUnits: readonly string[]\n confidence: number\n estimator: SearchClaimEstimator\n maximize: boolean\n seed: number\n}): { test: SearchClaimTest | null; promote: boolean; improvement: number | null; why: string } {\n const rootMeans = new Map(input.root.map((unit) => [unit.unitId, unit.mean]))\n const before: number[] = []\n const after: number[] = []\n for (const unit of input.node) {\n const rootMean = rootMeans.get(unit.unitId)\n if (rootMean === undefined) continue\n // `after - before` is the improvement in either direction.\n before.push(input.maximize ? rootMean : unit.mean)\n after.push(input.maximize ? unit.mean : rootMean)\n }\n const pairs = before.length\n if (pairs === 0) {\n return {\n test: null,\n promote: false,\n improvement: null,\n why: 'no test unit was scored by both it and the root',\n }\n }\n const { estimator } = input\n if (\n estimator.kind === 'binary' &&\n [...before, ...after].some((value) => value !== 0 && value !== estimator.scale)\n ) {\n return {\n test: null,\n promote: false,\n improvement: null,\n why: `a test score left the two-point scale {0, ${estimator.scale}} the claim fixed before the test`,\n }\n }\n const decision: PairedPromotionDecision = decidePairedPromotion(before, after, {\n confidence: input.confidence,\n threshold: 0,\n minPairs: input.testUnits.length,\n resamples: RESAMPLES,\n seed: input.seed,\n ...(estimator.kind === 'binary' ? { binaryScale: estimator.scale } : { continuous: true }),\n })\n const test: SearchClaimTest = {\n pairs,\n confidence: input.confidence,\n method: decision.method,\n delta: plain(input.maximize ? decision.delta : -decision.delta),\n interval: input.maximize\n ? [plain(decision.low), plain(decision.high)]\n : [plain(-decision.high), plain(-decision.low)],\n }\n const complete = pairs === input.testUnits.length\n const promote = decision.promote && complete\n const why = !complete\n ? `it and the root scored ${pairs} of ${input.testUnits.length} test units, and a claim needs every one`\n : decision.promote\n ? 'promoted'\n : !decision.sufficient\n ? `${pairs} test units are below the ${decision.minimumPairs} its paired test needs`\n : decision.indeterminate\n ? `its test interval has no width: ${decision.indeterminateCause}`\n : decision.exactTestVetoes\n ? \"McNemar's exact test vetoes the improvement\"\n : `its improvement interval [${round(decision.low)}, ${round(decision.high)}] at confidence ${round(input.confidence)} does not exclude 0`\n return { test, promote, improvement: decision.delta, why }\n}\n\nfunction requireHeader(state: SearchStateView) {\n const header = state.header\n if (!header) throw new Error(`search ${state.searchId} has not been opened`)\n if (state.rootNodeId === null) throw new Error(`search ${state.searchId} has no root node`)\n return header\n}\n\nfunction unitIds(tasks: ReadonlyArray<{ unitId: string }>): string[] {\n return [...new Set(tasks.map((task) => task.unitId))]\n}\n\nfunction mean(values: readonly number[]): number {\n let total = 0\n for (const value of values) total += value\n return total / values.length\n}\n\nfunction round(value: number): number {\n return Math.round(value * 1e4) / 1e4\n}\n\n/** Canonical JSON has one zero; never hand it a negative one. */\nfunction plain(value: number): number {\n return value === 0 ? 0 : value\n}\n","/**\n * The search kernel: one event-driven loop that every optimizer runs on.\n *\n * It separates three decisions that a generation loop fuses: where to expand\n * (the `SearchPolicy`), where to spend rollouts (the `SearchAllocator`), and\n * what to claim (the claim step, on the sealed test split). There is no\n * generation barrier: a lane that frees up takes the next allocated cell, and\n * the policy proposes when no cell waits and the budget admits a screen.\n *\n * Every step appends to the search ledger before the kernel acts on it, and the\n * ledger is the only checkpoint. Restarting the kernel on the same ledger\n * replays it and continues: an operation that started without a result is\n * recorded as failed with an unknown cost; a recorded proposal whose children\n * were not all registered is finished from its stored output; an allocated\n * cell without an outcome is first offered to `executor.adopt`, then run.\n *\n * The admission rule is the ledger's: committed spend, open reservations, the\n * unspent claim reserve and a new reservation stay within the cap. The kernel\n * checks it before it asks, prices an expansion (one proposal plus one screen)\n * before the proposer runs, and records spend above a reservation as\n * overspend, never refused.\n *\n * A search with a test split ends in its claim. When expansion stops, the\n * kernel fixes the claim's design (`planSearchClaim`) and stores it on the\n * ledger's `claim` operation before any test cell exists, decides the\n * finalists, runs the root's and the finalists' test cells together, and\n * closes with the claim `decideSearchClaim` makes from them. A node whose\n * train mean rises while its selection interval against its parent lies below\n * zero is decided `invalid` by the divergence rule and never becomes a parent.\n */\n\nimport { hashCanonical } from '../ledger-core/canonical'\nimport { type OperatorYieldSignal, operatorYield } from '../search/lenses/operator-yield'\nimport { redactText } from '../trace/redact'\nimport type {\n SearchAllocationView,\n SearchAllocator,\n SearchCellPlan,\n SearchRungDecision,\n} from './allocation'\nimport { estimateNode, type SearchPosterior, searchPosterior } from './estimate-node'\nimport {\n decideSearchClaim,\n planSearchClaim,\n SEARCH_CLAIM_RULE,\n SEARCH_CLAIM_RULE_NAME,\n type SearchClaimPlan,\n type SearchClaimVerification,\n searchClaimReserveUsd,\n verifySearchClaim,\n} from './search-claim'\nimport { FileSearchLedger } from './search-ledger'\nimport type {\n RegisterSearchNodeInput,\n SearchRecorder,\n SettleSearchCellInput,\n} from './search-ledger-recording'\nimport type {\n NodeEstimate,\n SearchArtifactRef,\n SearchAttemptAccounting,\n SearchCellStage,\n SearchClaim,\n SearchCloseReason,\n SearchEdgeOperator,\n SearchOperationRecordedEvent,\n SearchProposerKind,\n SearchReservation,\n SearchSourceRef,\n SearchSplit,\n SearchUnknown,\n} from './search-ledger-types'\nimport type { SearchPolicy, SearchPolicyNode, SearchPolicyView } from './search-policy'\nimport {\n type SearchCell,\n type SearchNode,\n type SearchStateView,\n searchCellId,\n} from './search-state'\nimport { acquireSingleRunLock } from './single-run-lock'\n\n/**\n * Every rule the kernel's decisions depend on. Its digest is the kernel's\n * revision in a ledger's `process.executionRef`; change a value here whenever\n * a rule changes, so the revision moves with it.\n */\nconst KERNEL_DEFINITION = {\n name: 'tangle.search-kernel.2026-09',\n dispatch:\n 'claim, then rung and root, then screen, then train; first allocated first within a stage',\n expansion:\n 'when no cell waits, fewer than twice the lanes capacity run, the cap admits one proposal and its expected screens, and overspend has not taken the search past its cap',\n parents: 'a policy names at least one parent, and every parent finished its screen',\n reservation: {\n hard: 'the lane per-cell maximum',\n estimate: '1.5 times the p99 of the lane settled cells once 20 settled, else the lane prior',\n },\n retries: 'a retryable errored attempt runs again, up to maxAttempts',\n rungs:\n 'when a node finishes its cells, the allocator names the nodes it advances, deepest rung first; each is recorded advanced and its rung allocated when the cap admits the rung',\n resume:\n 'an unrecorded operation is recorded failed at an unknown cost with floor 0; a recorded proposal is finished from its stored output; an unsettled cell is offered to adopt before it runs',\n writers: 'one kernel per ledger file on a host, by a pid lock beside the ledger',\n divergence:\n 'a node whose train mean over shared units rises above its parent while its descriptive or bootstrap selection interval against the parent lies wholly on the worse side is decided invalid when its cells finish',\n claim:\n 'with a test split: after expansion stops, the claim plan is stored on the claim operation, the finalists are decided, the root and finalist test cells run together, and the claim decides; the kernel refuses to start a claim without a selection split, a minimumEffect, a pinned judge, or (under a cap) a claim reserve for the root and 3 finalists plus a cap for one screening round',\n close:\n 'the allocator prunes the nodes left waiting on a rung, except the policy leader; then, with a test split, the claim decides; without one, the policy leader is selected when it has a scored cell; every other undecided node is rejected',\n complete:\n 'a node leads only when it has a scored cell on the ranked split and no cell there ended unscored: a final unscored outcome, or an error with no attempt left',\n} as const\n\n/** The kernel every `runSearch` ledger names as its search implementation. */\nexport const SEARCH_KERNEL_SOURCE: SearchSourceRef = {\n uri: 'npm:@tangle-network/agent-eval#runSearch',\n revision: hashCanonical(KERNEL_DEFINITION),\n}\n\nconst USD_TOLERANCE = 1e-9\n/** The operation that holds the claim's plan. */\nconst CLAIM_OPERATION = 'claim'\n/** Settled cells a lane needs before its own cost distribution sets its estimate. */\nconst ESTIMATE_FROM_CELLS = 20\nconst ESTIMATE_MARGIN = 1.5\nconst DEFAULT_MAX_ATTEMPTS = 3\n/** Dispatch order: claim cells first, then rungs and the root, then screens, then train. */\nconst STAGE_PRIORITY: Record<SearchCellStage, number> = {\n claim: 0,\n rung: 1,\n root: 1,\n screen: 2,\n train: 3,\n external: 3,\n}\n\n/** An execution lane: a pool of slots whose cells share a cost rule. */\nexport interface SearchLane {\n name: string\n /** Cells the lane runs at once. */\n capacity: number\n /** `hard`: the lane enforces `cellUsd` as each cell's maximum. `estimate`:\n * it cannot, and the kernel holds an estimate, recording any overshoot. */\n costCap: 'hard' | 'estimate'\n /** The enforced per-cell maximum of a hard lane; the prior estimate of an\n * estimate lane until it has settled enough cells to estimate its own. */\n cellUsd: number\n}\n\n/** One attempt at one cell, as the kernel hands it to an executor. */\nexport interface SearchCellWork<TArtifact> {\n searchId: string\n cellId: string\n nodeId: string\n taskId: string\n unitId: string\n split: SearchSplit\n rep: number\n stage: SearchCellStage\n lane: string\n attempt: number\n /** `cellId:attempt`: the id an executor keys the attempt's run by. */\n runId: string\n artifact: TArtifact\n signal: AbortSignal\n}\n\n/** What an attempt produced: everything `cell-settled` records except the\n * coordinates the kernel owns. An environment fault is an `errored` outcome,\n * not a rejection; a rejection stops the search. */\nexport type SearchCellResult = Omit<SettleSearchCellInput, 'cellId' | 'attempt'>\n\n/** The executor port: lanes, placement, running a cell, and adopting an\n * attempt an earlier kernel process started. */\nexport interface SearchExecutor<TArtifact> {\n lanes(): readonly SearchLane[]\n /** The lane a planned cell runs on. */\n place(cell: SearchCellPlan & { nodeId: string }): string\n run(work: SearchCellWork<TArtifact>): Promise<SearchCellResult>\n /** The result of `work.runId` if the executor already has it, else null.\n * Called before the first dispatch of a cell the ledger shows unsettled when\n * the kernel starts, so a restart does not run an attempt twice. */\n adopt(work: SearchCellWork<TArtifact>): Promise<SearchCellResult | null>\n}\n\n/** How a search stores, compares and restores its artifacts. */\nexport interface SearchArtifactCodec<TArtifact> {\n /** The artifact as a content-addressed node; stores its bytes. */\n node(recorder: SearchRecorder, artifact: TArtifact): RegisterSearchNodeInput\n /** The parent-to-child diff, stored as a blob, or why there is none. */\n diff(\n recorder: SearchRecorder,\n parent: TArtifact,\n child: TArtifact,\n ): SearchArtifactRef | SearchUnknown\n /** The artifact a node holds, read back from its stored bytes. */\n load(recorder: SearchRecorder, node: SearchNode): TArtifact\n}\n\nexport interface SearchProposalRequest<TArtifact> {\n expansion: number\n operationId: string\n operator: Exclude<SearchEdgeOperator, 'seed' | 'derive'>\n /** The parents the policy chose, primary first. */\n parents: ReadonlyArray<{ nodeId: string; artifact: TArtifact }>\n /** The node the search keeps now. */\n leader: string\n signal: AbortSignal\n}\n\n/** One child a proposal returned. */\nexport interface SearchProposedChild<TArtifact> {\n artifact: TArtifact\n label: string\n /** The proposer's reason; redacted with the share profile before it is stored. */\n rationale: string\n /** Typed JSON the proposer attaches to the child, stored with the proposal\n * and never interpreted by the kernel. */\n attribution?: Readonly<Record<string, unknown>>\n}\n\nexport interface SearchProposalResult<TArtifact> {\n children: ReadonlyArray<SearchProposedChild<TArtifact>>\n /** Set when the proposer judges the search converged; expansion stops. */\n stop?: string\n /** What generated the children; default the port's `execution`. */\n execution?: SearchOperationRecordedEvent['execution']\n accounting: SearchAttemptAccounting\n}\n\n/** The proposer port: derives children from the parents the policy chose. */\nexport interface SearchProposerPort<TArtifact> {\n readonly name: string\n readonly kind: SearchProposerKind\n readonly source: SearchSourceRef\n readonly execution: SearchOperationRecordedEvent['execution']\n /** Prior hold for one proposal until 20 proposals have settled. Default 0. */\n readonly reservationUsd?: number\n /** Children one proposal usually returns, to price an expansion's screens\n * before it runs. Default 1. */\n readonly childrenPerProposal?: number\n propose(request: SearchProposalRequest<TArtifact>): Promise<SearchProposalResult<TArtifact>>\n}\n\nexport interface RunSearchOptions<TArtifact> {\n /** An opened recorder; its header names this policy and allocator. */\n recorder: SearchRecorder\n /** The starting artifact: the seeded root. */\n root: TArtifact\n codec: SearchArtifactCodec<TArtifact>\n policy: SearchPolicy\n allocation: SearchAllocator\n proposer: SearchProposerPort<TArtifact>\n executor: SearchExecutor<TArtifact>\n /** Refuse a child before it runs: the reason, or null to admit it. A\n * refused child is recorded, decided `invalid`, and never becomes a parent. */\n admit?: (artifact: TArtifact) => string | null\n /** Stop expanding after this many proposals. */\n maxExpansions?: number\n /** Attempts per cell for retryable environment errors. Default 3. */\n maxAttempts?: number\n /** Aborting pauses the search: in-flight cells are aborted, what settled is\n * recorded, the ledger stays open, and the call rejects. Run the kernel on\n * the same ledger again to continue. */\n signal?: AbortSignal\n /** Milliseconds since the epoch, for the deadline. Default `Date.now`. */\n now?: () => number\n}\n\nexport interface SearchRunResult {\n /** The closed search. */\n state: SearchStateView\n /** The node the search keeps: the claim's selection, or without a claim the\n * policy leader; the root when nothing was selected. */\n leader: string\n reason: SearchCloseReason\n /** The claim on the sealed test split; null for a search without one. */\n claim: SearchClaim | null\n /** The claim made again from the ledger alone (`verifySearchClaim`): never\n * `mismatch`, which `runSearch` throws; `unknown` for a claim another rule\n * revision made; null without a claim. */\n claimVerification: SearchClaimVerification | null\n}\n\n/** Run a search to its close, or continue one from its ledger. */\nexport async function runSearch<TArtifact>(\n options: RunSearchOptions<TArtifact>,\n): Promise<SearchRunResult> {\n return new SearchKernel(options).run()\n}\n\n/** The expansion index a kernel operation id encodes, or null. */\nexport function searchExpansionIndex(operationId: string): number | null {\n const match = /^expand-(\\d+)$/.exec(operationId)\n return match ? Number(match[1]) : null\n}\n\ninterface LaneState extends SearchLane {\n inFlight: number\n /** Queued cell ids by stage priority. */\n queues: string[][]\n settledCosts: number[]\n}\n\ntype Completion =\n | { kind: 'cell'; cellId: string; attempt: number; result?: SearchCellResult; error?: unknown }\n | {\n kind: 'proposal'\n expansion: number\n operationId: string\n request: SearchProposalRequest<unknown>\n selection: { rule: string; evidence: Record<string, number> }\n result?: SearchProposalResult<unknown>\n error?: unknown\n }\n\n/** The stored output of one proposal: enough to register its children again. */\nexport interface SearchProposalBlob {\n kind: 'search-proposal'\n operator: SearchProposalRequest<unknown>['operator']\n parents: string[]\n selection: { rule: string; evidence: Record<string, number> }\n children: Array<{\n node: RegisterSearchNodeInput\n diffs: Array<SearchArtifactRef | SearchUnknown>\n label: string\n rationale: string\n attribution: Readonly<Record<string, unknown>> | null\n invalid: string | null\n }>\n}\n\nclass SearchKernel<TArtifact> {\n private readonly options: RunSearchOptions<TArtifact>\n private readonly recorder: SearchRecorder\n private readonly maxAttempts: number\n private readonly now: () => number\n private state!: SearchStateView\n private readonly lanes = new Map<string, LaneState>()\n private readonly inFlight = new Map<string, AbortController>()\n private proposal: Promise<void> | null = null\n private proposalController: AbortController | null = null\n private readonly completions: Completion[] = []\n private wake: (() => void) | null = null\n /** Unfinished cells per node. */\n private readonly pending = new Map<string, number>()\n /** Admitted nodes whose screen finished, in registration order. */\n private screened: string[] = []\n private readonly screenedSet = new Set<string>()\n private readonly admitted = new Set<string>()\n private readonly expansionOf = new Map<string, number>()\n private readonly artifacts = new Map<string, TArtifact>()\n /** Children a proposal returned, by artifact digest, until they are registered. */\n private readonly proposed = new Map<string, TArtifact>()\n /** Cells the ledger showed unsettled at start: an earlier process may hold their attempt. */\n private readonly adoptable = new Set<string>()\n private readonly operationCosts: number[] = []\n /** Operations started: the next one's id. */\n private expansions = 0\n /** Proposals that completed, by operation index. A proposal an interrupted\n * process lost counts toward none of the stop rules, so a resumed search\n * makes the proposals the uninterrupted one would have made. */\n private readonly completed: number[] = []\n private stopReason: SearchCloseReason | null = null\n private failure: { error: unknown } | null = null\n /** The claim's design once expansion stopped; the search then only claims. */\n private claimPlan: SearchClaimPlan | null = null\n\n constructor(options: RunSearchOptions<TArtifact>) {\n this.options = options\n this.recorder = options.recorder\n this.maxAttempts = options.maxAttempts ?? DEFAULT_MAX_ATTEMPTS\n this.now = options.now ?? Date.now\n if (!Number.isSafeInteger(this.maxAttempts) || this.maxAttempts < 1) {\n throw new TypeError('runSearch: maxAttempts must be a positive integer')\n }\n const { maxExpansions } = options\n if (\n maxExpansions !== undefined &&\n (!Number.isSafeInteger(maxExpansions) || maxExpansions < 0)\n ) {\n throw new TypeError('runSearch: maxExpansions must be a non-negative integer')\n }\n for (const lane of options.executor.lanes()) {\n if (!Number.isSafeInteger(lane.capacity) || lane.capacity < 1) {\n throw new TypeError(`runSearch: lane ${lane.name} needs a positive integer capacity`)\n }\n if (!Number.isFinite(lane.cellUsd) || lane.cellUsd < 0) {\n throw new TypeError(`runSearch: lane ${lane.name} needs a finite non-negative cellUsd`)\n }\n if (this.lanes.has(lane.name))\n throw new TypeError(`runSearch: lane ${lane.name} is declared twice`)\n this.lanes.set(lane.name, {\n ...lane,\n inFlight: 0,\n queues: [[], [], [], []],\n settledCosts: [],\n })\n }\n if (this.lanes.size === 0) throw new TypeError('runSearch: the executor declares no lane')\n }\n\n async run(): Promise<SearchRunResult> {\n // One writer per search on a host: a second kernel on the same ledger\n // file is refused while the first lives; a killed holder's lock is\n // reclaimed. Across hosts the ledger's own chain refuses a fork.\n const { ledger } = this.recorder\n const lock =\n ledger instanceof FileSearchLedger\n ? acquireSingleRunLock({ lockPath: `${ledger.path}.run.lock` })\n : null\n try {\n return await this.runLocked()\n } finally {\n lock?.release()\n }\n }\n\n private async runLocked(): Promise<SearchRunResult> {\n await this.refresh()\n const header = this.state.header\n if (!header) throw new Error(`runSearch: search ${this.recorder.searchId} has not been opened`)\n if (\n header.policy.expansion !== this.options.policy.name ||\n header.policy.allocation !== this.options.allocation.name\n ) {\n throw new Error(\n `runSearch: search ${this.recorder.searchId} was opened with policy ${header.policy.expansion} and allocation ${header.policy.allocation}, not ${this.options.policy.name} and ${this.options.allocation.name}`,\n )\n }\n if (this.state.closed) return this.closedResult()\n await this.restore()\n const { signal } = this.options\n const onAbort = (): void => {\n for (const controller of this.inFlight.values()) controller.abort(signal?.reason)\n this.proposalController?.abort(signal?.reason)\n this.wakeUp()\n }\n signal?.addEventListener('abort', onAbort, { once: true })\n try {\n if (this.claimPlan) await this.applyClaimPlan(this.claimPlan)\n await this.loop()\n if (!this.failure && !this.claimPlan && this.state.header!.splits.test.tasks.length > 0) {\n await this.beginClaim()\n await this.loop()\n }\n } finally {\n signal?.removeEventListener('abort', onAbort)\n }\n if (this.failure) throw this.failure.error\n await this.close()\n return this.closedResult()\n }\n\n // ── Start and resume ────────────────────────────────────────────────\n\n private async restore(): Promise<void> {\n const rootInput = this.options.codec.node(this.recorder, this.options.root)\n const rootId = this.state.rootNodeId\n if (rootId === null) {\n const { nodeId } = await this.recorder.registerNode(rootInput)\n await this.recorder.recordEdge({\n childNodeId: nodeId,\n parents: [],\n operator: 'seed',\n attribution: 'explicit',\n proposer: null,\n proposalKey: 'root',\n rationale: { unknown: 'the root is the caller-supplied starting artifact' },\n diffs: [],\n label: 'root',\n })\n await this.refresh()\n } else if (this.state.node(rootId)!.artifactDigest !== rootInput.artifactDigest) {\n throw new Error(\n `runSearch: search ${this.recorder.searchId} started from another root artifact; a changed start is a derived search`,\n )\n }\n const root = this.state.rootNodeId!\n this.artifacts.set(root, this.options.root)\n this.expansionOf.set(root, -1)\n if (this.state.audit.cells.allocated === 0) this.assertClaimReady()\n await this.restoreClaimPlan()\n\n // Operations an earlier process started and never recorded: their spend\n // is unknown, so each is recorded failed with a floor of zero.\n const recorded: number[] = []\n for (let expansion = 0; ; expansion++) {\n const operationId = `expand-${expansion}`\n const operation = this.state.operation(operationId)\n if (!operation) break\n this.expansions = expansion + 1\n if (operation.recorded) {\n this.operationCosts.push(operation.spentUsd)\n recorded.push(expansion)\n if (operation.outcome === 'completed') this.completed.push(expansion)\n continue\n }\n await this.recorder.recordOperation({\n operationId,\n operationKind: 'candidate-generation',\n execution: this.options.proposer.execution,\n outcome: {\n status: 'failed',\n failure: {\n code: 'interrupted',\n message: 'the search stopped while this proposal ran; its output was lost',\n },\n },\n accounting: interruptedAccounting(),\n })\n await this.refresh()\n }\n\n for (const node of this.state.nodes()) {\n if (node.edgeIds.length === 0) continue\n const edge = this.state.edge(node.edgeIds[0]!)!\n const expansion = edge.proposer?.operationId\n ? searchExpansionIndex(edge.proposer.operationId)\n : null\n this.expansionOf.set(node.nodeId, expansion ?? -1)\n if (node.status !== 'invalid') this.admitted.add(node.nodeId)\n }\n for (const cell of this.state.cells()) {\n const lane = cell.lane === null ? undefined : this.lanes.get(cell.lane)\n if (cell.final && lane) lane.settledCosts.push(cell.spentUsd)\n if (this.cellDone(cell)) continue\n if (!lane) {\n throw new Error(\n `runSearch: cell ${cell.cellId} was placed on lane ${String(cell.lane)}, which the executor does not declare`,\n )\n }\n this.adoptable.add(cell.cellId)\n this.enqueue(cell)\n if (cell.stage !== 'claim') {\n this.pending.set(cell.nodeId, (this.pending.get(cell.nodeId) ?? 0) + 1)\n }\n }\n // Once the claim began the search only claims: nothing is proposed or\n // allocated outside the test.\n if (this.claimPlan) return\n // A proposal recorded before its children all were: finish it from its output.\n for (const expansion of recorded) await this.finishProposal(expansion)\n for (const node of this.state.nodes()) {\n if (this.admitted.has(node.nodeId) && !isTerminal(node)) await this.allocateFor(node.nodeId)\n }\n for (const nodeId of this.state.nodeIds()) {\n if (!this.admitted.has(nodeId)) continue\n // An advanced node finished its screen before its rung cells were\n // allocated, so it stays a parent while they run, as it was before the\n // restart.\n if (this.state.node(nodeId)!.status === 'advanced') this.markScreened(nodeId)\n else if ((this.pending.get(nodeId) ?? 0) === 0) await this.screenDone(nodeId)\n }\n // A node may have finished a rung before the interrupted process recorded\n // what its rank earned.\n await this.advance()\n }\n\n /**\n * A search that will claim must be able to: finalists come from a selection\n * split, the power check needs the claim's minimum effect, a ship needs a\n * pinned judge, and under a cap the claim reserve must cover the root and 3\n * finalists on every test task while the rest of the cap covers one\n * screening round. Checked before the first cell, so a search that cannot\n * claim spends nothing.\n */\n private assertClaimReady(): void {\n const header = this.state.header!\n const testTasks = header.splits.test.tasks.length\n if (testTasks === 0) return\n const refuse = (why: string): never => {\n throw new Error(`runSearch: search ${this.recorder.searchId} has a test split, but ${why}`)\n }\n if (header.splits.selection.tasks.length === 0) {\n refuse('no selection split to choose its finalists on')\n }\n if (header.objective.claim.minimumEffect === undefined) {\n refuse('its claim declares no minimumEffect for the power check')\n }\n if ('unknown' in header.objective.judge) {\n refuse(\n 'its judge is not pinned; a claim with an unknown judge cannot ship, and a resumed search could mix two judges',\n )\n }\n const { maxUsd, reservedClaimUsd } = header.budget\n if (maxUsd === null) return\n const cellUsd = this.maxCellReservation()\n const need = searchClaimReserveUsd({ testTasks, reps: this.options.allocation.reps, cellUsd })\n if (reservedClaimUsd + USD_TOLERANCE < need) {\n refuse(\n `its claim reserve $${reservedClaimUsd} is below the $${need} the root and 3 finalists need on ${testTasks} test tasks at $${cellUsd} a cell`,\n )\n }\n const rootCells = this.options.allocation.plan(this.state, this.state.rootNodeId!, 0).length\n const screens =\n (this.options.proposer.childrenPerProposal ?? 1) *\n this.options.allocation.screenSize(this.state)\n const round = this.operationReservation().usd + (rootCells + screens) * cellUsd\n if (maxUsd - reservedClaimUsd + USD_TOLERANCE < round) {\n refuse(\n `its cap $${maxUsd} less the claim reserve $${reservedClaimUsd} does not cover the root and one screening round ($${round})`,\n )\n }\n }\n\n /** A claim an earlier process began: continue it from its stored plan. */\n private async restoreClaimPlan(): Promise<void> {\n const operation = this.state.operation(CLAIM_OPERATION)\n if (!operation) return\n const ref = operation.artifacts.find((artifact) => artifact.role === 'claim-plan')\n if (!ref) throw new Error(`runSearch: the ${CLAIM_OPERATION} operation has no stored plan`)\n const plan = this.recorder.readBlob(ref) as SearchClaimPlan\n if (!operation.recorded) await this.recordClaimOperation()\n this.claimPlan = plan\n this.stopReason = plan.stopReason\n }\n\n // ── The loop ────────────────────────────────────────────────────────\n\n private async loop(): Promise<void> {\n for (;;) {\n if (this.failure || this.options.signal?.aborted) {\n await this.drain(this.failure?.error ?? this.options.signal?.reason)\n this.failure ??= { error: this.options.signal?.reason ?? new Error('aborted') }\n return\n }\n if (this.pastDeadline()) {\n // Past the deadline nothing new starts, so what waits is cancelled.\n this.stopReason ??= 'deadline'\n if (this.queuedCount() > 0) await this.cancelQueued('deadline')\n }\n this.dispatch()\n const blocked =\n this.stopReason === null && this.proposal === null ? await this.tryExpand() : null\n const busy = this.inFlight.size > 0 || this.proposal !== null\n if (!busy) {\n if (this.queuedCount() > 0) continue\n this.stopReason ??= blocked ?? 'converged'\n return\n }\n await this.handle(await this.next())\n }\n }\n\n /** The next completion, or null when an abort woke the loop without one. */\n private async next(): Promise<Completion | null> {\n if (this.completions.length === 0) {\n await new Promise<void>((resolve) => {\n this.wake = resolve\n })\n }\n return this.completions.shift() ?? null\n }\n\n private push(completion: Completion): void {\n this.completions.push(completion)\n this.wakeUp()\n }\n\n private wakeUp(): void {\n const wake = this.wake\n this.wake = null\n wake?.()\n }\n\n private async handle(completion: Completion | null): Promise<void> {\n if (completion === null) return\n if (completion.kind === 'cell') await this.settle(completion)\n else await this.recordProposal(completion)\n }\n\n /** Abort everything in flight and record what still completes. */\n private async drain(reason: unknown): Promise<void> {\n for (const controller of this.inFlight.values()) controller.abort(reason)\n this.proposalController?.abort(reason)\n while (this.inFlight.size > 0 || this.proposal !== null) {\n await this.handle(await this.next())\n }\n }\n\n // ── Cells ───────────────────────────────────────────────────────────\n\n /** Fill free lane slots with queued cells. A queued cell was admitted when\n * it was allocated, so starting it needs no further decision. */\n private dispatch(): void {\n if (this.failure || this.options.signal?.aborted) return\n // Past the deadline the search stops, but its claim still runs: the\n // claim's budget was reserved at the start.\n const claimOnly = this.pastDeadline()\n const cap = this.state.header!.budget.maxConcurrency\n for (const lane of this.lanes.values()) {\n while (lane.inFlight < lane.capacity && (cap === null || this.inFlight.size < cap)) {\n const queue = claimOnly\n ? lane.queues[STAGE_PRIORITY.claim]\n : lane.queues.find((waiting) => waiting.length > 0)\n const cellId = queue?.shift()\n if (cellId === undefined) break\n this.start(cellId, lane)\n }\n }\n }\n\n private start(cellId: string, lane: LaneState): void {\n const cell = this.state.cell(cellId)!\n const attempt = cell.attempts + 1\n const controller = new AbortController()\n const work: SearchCellWork<TArtifact> = {\n searchId: this.recorder.searchId,\n cellId,\n nodeId: cell.nodeId,\n taskId: cell.taskId,\n unitId: cell.unitId,\n split: cell.split,\n rep: cell.rep,\n stage: cell.stage,\n lane: lane.name,\n attempt,\n runId: `${cellId}:${attempt}`,\n artifact: this.artifact(cell.nodeId),\n signal: controller.signal,\n }\n const adopt = this.adoptable.delete(cellId)\n this.inFlight.set(cellId, controller)\n lane.inFlight += 1\n const { executor } = this.options\n void (async () =>\n (adopt ? await executor.adopt(work) : null) ?? (await executor.run(work)))().then(\n (result) => this.push({ kind: 'cell', cellId, attempt, result }),\n (error: unknown) => this.push({ kind: 'cell', cellId, attempt, error }),\n )\n }\n\n private async settle(completion: Extract<Completion, { kind: 'cell' }>): Promise<void> {\n const { cellId, attempt } = completion\n this.inFlight.delete(cellId)\n const before = this.state.cell(cellId)!\n const lane = this.lanes.get(before.lane!)!\n lane.inFlight -= 1\n if (!completion.result) {\n this.failure ??= { error: completion.error }\n return\n }\n // The freed slot takes the next queued cell before this result is\n // written, so no slot idles while the ledger syncs.\n this.dispatch()\n if (\n (this.failure || this.options.signal?.aborted) &&\n completion.result.outcome.status === 'errored'\n ) {\n // An attempt that ends in an error while the search stops may have\n // failed because it was interrupted. It stays unsettled, so a resumed\n // search adopts or reruns it instead of recording the interruption.\n return\n }\n await this.recorder.settleCell({ ...completion.result, cellId, attempt })\n await this.refresh()\n const cell = this.state.cell(cellId)!\n if (cell.final) lane.settledCosts.push(cell.spentUsd)\n if (!this.cellDone(cell)) {\n if (this.failure || this.options.signal?.aborted) return\n this.enqueue(cell)\n return\n }\n if (cell.stage === 'claim') return\n const left = (this.pending.get(cell.nodeId) ?? 1) - 1\n this.pending.set(cell.nodeId, left)\n if (left === 0) await this.onNodeIdle(cell.nodeId)\n }\n\n /** Every cell allocated to the node is done: its screen, or a rung. */\n private async onNodeIdle(nodeId: string): Promise<void> {\n if (!(await this.screenDone(nodeId))) return\n await this.advance()\n }\n\n /** Record the rank decisions the allocator now supports and allocate the\n * rungs they open. Past the deadline, once the claim began, or once the\n * search fails or is aborted, no rung opens; a search that stopped\n * expanding still measures the nodes that earned it. */\n private async advance(): Promise<void> {\n if (this.claimPlan || this.failure || this.options.signal?.aborted || this.pastDeadline()) {\n return\n }\n for (const decision of this.options.allocation.advance(this.allocationView())) {\n await this.allocateFor(decision.nodeId, decision)\n }\n }\n\n /**\n * A node's allocated cells all finished. A node that diverges (its train\n * mean rose over its parent's while its selection interval against the\n * parent lies wholly on the worse side) is decided `invalid` and never\n * becomes a parent; any other node is screened. Returns whether it was.\n */\n private async screenDone(nodeId: string): Promise<boolean> {\n // The check reads the screen alone: a node the allocator advanced passed\n // it when its screen finished, and a restart must not re-judge it on the\n // rung cells it earned since.\n if (\n !this.claimPlan &&\n !this.screenedSet.has(nodeId) &&\n this.state.node(nodeId)!.status !== 'advanced'\n ) {\n const divergence = searchDivergence(this.state, nodeId)\n if (divergence) {\n await this.recorder.decideNode({\n nodeId,\n decision: { status: 'invalid' },\n basis: divergence.basis,\n rule: 'divergence',\n reason: divergence.reason,\n })\n await this.refresh()\n this.admitted.delete(nodeId)\n return false\n }\n }\n this.markScreened(nodeId)\n return true\n }\n\n private markScreened(nodeId: string): void {\n if (this.screenedSet.has(nodeId)) return\n this.screenedSet.add(nodeId)\n const ordinal = this.state.node(nodeId)!.ordinal\n let index = this.screened.length\n while (index > 0 && this.state.node(this.screened[index - 1]!)!.ordinal > ordinal) index--\n this.screened = [...this.screened.slice(0, index), nodeId, ...this.screened.slice(index)]\n }\n\n /**\n * Allocate the cells the allocator plans for a node through its rung and the\n * ledger lacks. With a rank decision, the rung is the decision's, and the\n * decision is recorded first, only once the cap admits the rung's cells.\n * Returns false when the cap or `maxCells` refused them.\n */\n private async allocateFor(nodeId: string, decision?: SearchRungDecision): Promise<boolean> {\n const rung =\n decision?.decision.status === 'advanced'\n ? decision.decision.rung\n : (this.state.node(nodeId)!.rung ?? 0)\n const plans = this.options.allocation\n .plan(this.state, nodeId, rung)\n .filter(\n (plan) =>\n !this.state.cell(\n searchCellId(this.recorder.searchId, nodeId, plan.taskId, plan.split, plan.rep),\n ),\n )\n if (plans.length === 0) {\n if (decision) await this.decide(decision)\n return true\n }\n const placed = plans.map((plan) => {\n const laneName = this.options.executor.place({ ...plan, nodeId })\n const lane = this.lanes.get(laneName)\n if (!lane)\n throw new Error(`runSearch: the executor placed a cell on unknown lane ${laneName}`)\n return { plan, lane, reservation: this.cellReservation(lane) }\n })\n const hold = placed.reduce((sum, { reservation }) => sum + reservation.usd, 0)\n const { headroomUsd } = this.state.budget\n if (headroomUsd !== null && hold > headroomUsd + USD_TOLERANCE) return false\n const { maxCells } = this.state.header!.budget\n if (maxCells !== null && this.state.audit.cells.allocated + placed.length > maxCells) {\n return false\n }\n if (decision) await this.decide(decision)\n for (const { plan, lane, reservation } of placed) {\n await this.recorder.allocateCell({\n nodeId,\n taskId: plan.taskId,\n split: plan.split,\n rep: plan.rep,\n stage: plan.stage,\n lane: lane.name,\n reservation,\n })\n }\n await this.refresh()\n for (const { plan } of placed) {\n const cellId = searchCellId(this.recorder.searchId, nodeId, plan.taskId, plan.split, plan.rep)\n this.enqueue(this.state.cell(cellId)!)\n }\n this.pending.set(nodeId, (this.pending.get(nodeId) ?? 0) + placed.length)\n this.dispatch()\n return true\n }\n\n private async decide(decision: SearchRungDecision): Promise<void> {\n await this.recorder.decideNode(decision)\n await this.refresh()\n }\n\n private enqueue(cell: SearchCell): void {\n this.lanes.get(cell.lane!)!.queues[STAGE_PRIORITY[cell.stage]]!.push(cell.cellId)\n }\n\n private queuedCount(): number {\n let count = 0\n for (const lane of this.lanes.values()) {\n for (const queue of lane.queues) count += queue.length\n }\n return count\n }\n\n // ── Claim ───────────────────────────────────────────────────────────\n\n /** Fix the claim's design, store it, and start its test cells. */\n private async beginClaim(): Promise<void> {\n await this.refresh()\n const stopReason = this.stopReason ?? 'converged'\n const header = this.state.header!\n const reps = this.options.allocation.reps\n const plan = planSearchClaim(this.state, {\n stopReason,\n reps,\n affordable: (finalists) => {\n const placed = this.claimCells(finalists, this.state.rootNodeId!)\n const hold = placed.reduce((sum, cell) => sum + cell.reservation.usd, 0)\n const { headroomUsd, claimReserveUsd } = this.state.budget\n const { maxCells } = header.budget\n return (\n (headroomUsd === null || hold <= headroomUsd + claimReserveUsd + USD_TOLERANCE) &&\n (maxCells === null || this.state.audit.cells.allocated + placed.length <= maxCells)\n )\n },\n })\n await this.recorder.startOperation({\n operationId: CLAIM_OPERATION,\n operationKind: 'selection',\n reservation: null,\n artifacts: [this.recorder.blob('claim-plan', plan)],\n })\n await this.recordClaimOperation()\n this.claimPlan = plan\n this.stopReason = stopReason\n await this.applyClaimPlan(plan)\n }\n\n private async recordClaimOperation(): Promise<void> {\n await this.recorder.recordOperation({\n operationId: CLAIM_OPERATION,\n operationKind: 'selection',\n execution: { kind: 'deterministic', source: SEARCH_CLAIM_RULE },\n outcome: { status: 'completed' },\n accounting: {\n tokens: { status: 'known', inputTokens: 0, outputTokens: 0, cachedTokens: 0 },\n cost: { status: 'known', usd: 0, source: 'free' },\n },\n })\n await this.refresh()\n }\n\n /**\n * Decide the plan's finalists and allocate the test cells of the root and\n * the finalists, interleaved by task so the arms of one task run side by\n * side. Allocation finishes before any claim cell starts. Idempotent.\n */\n private async applyClaimPlan(plan: SearchClaimPlan): Promise<void> {\n const root = this.state.rootNodeId!\n // Estimate from one read of the state, then append: an append retires the view.\n const bases = plan.finalists.map((finalist) =>\n estimateNode(this.state, finalist.nodeId, { against: root, split: 'selection' }),\n )\n for (const [rank, finalist] of plan.finalists.entries()) {\n await this.recorder.decideNode({\n nodeId: finalist.nodeId,\n decision: { status: 'finalist' },\n basis: bases[rank]!,\n rule: SEARCH_CLAIM_RULE_NAME,\n reason: `rank ${rank + 1} of ${plan.finalists.length} by selection mean (${finalist.selectionMean}); ${plan.reason}`,\n })\n }\n await this.refresh()\n if (plan.test !== 'run') return\n const missing = this.claimCells(plan.finalists.length, root, plan)\n .map((cell) => ({\n ...cell,\n cellId: searchCellId(\n this.recorder.searchId,\n cell.nodeId,\n cell.plan.taskId,\n 'test',\n cell.plan.rep,\n ),\n }))\n .filter((cell) => !this.state.cell(cell.cellId))\n for (const cell of missing) {\n await this.recorder.allocateCell({\n nodeId: cell.nodeId,\n taskId: cell.plan.taskId,\n split: 'test',\n rep: cell.plan.rep,\n stage: 'claim',\n lane: cell.lane.name,\n reservation: cell.reservation,\n })\n }\n await this.refresh()\n for (const cell of missing) this.enqueue(this.state.cell(cell.cellId)!)\n }\n\n /** The test cells of the root and the first `finalists` of the plan (or of\n * the finalist count being priced), task by task, with their lanes and holds. */\n private claimCells(\n finalists: number,\n root: string,\n plan?: SearchClaimPlan,\n ): Array<{\n nodeId: string\n plan: SearchCellPlan\n lane: LaneState\n reservation: SearchReservation\n }> {\n const header = this.state.header!\n // While pricing, the arms are placeholders: placement and holds depend on\n // the lane, never on which node runs.\n const arms = [root, ...(plan ? plan.finalists.map((entry) => entry.nodeId) : [])]\n while (arms.length < finalists + 1) arms.push(root)\n const cells = []\n for (const task of header.splits.test.tasks) {\n for (let rep = 0; rep < this.options.allocation.reps; rep++) {\n for (const nodeId of arms) {\n const cellPlan: SearchCellPlan = {\n taskId: task.taskId,\n split: 'test',\n rep,\n stage: 'claim',\n }\n const laneName = this.options.executor.place({ ...cellPlan, nodeId })\n const lane = this.lanes.get(laneName)\n if (!lane) {\n throw new Error(`runSearch: the executor placed a cell on unknown lane ${laneName}`)\n }\n cells.push({ nodeId, plan: cellPlan, lane, reservation: this.cellReservation(lane) })\n }\n }\n }\n return cells\n }\n\n private async cancelQueued(reason: 'deadline' | 'budget'): Promise<void> {\n for (const lane of this.lanes.values()) {\n for (const [priority, queue] of lane.queues.entries()) {\n if (priority === STAGE_PRIORITY.claim) continue\n for (const cellId of queue.splice(0)) {\n const cell = this.state.cell(cellId)!\n // A cell with a settled attempt already counts as settled; only a\n // never-run cell is cancelled.\n if (cell.attempts === 0) {\n await this.recorder.cancelCell({ cellId, reason })\n await this.refresh()\n }\n const left = (this.pending.get(cell.nodeId) ?? 1) - 1\n this.pending.set(cell.nodeId, left)\n if (left === 0) this.markScreened(cell.nodeId)\n }\n }\n }\n }\n\n /** No further attempt will run: a final outcome, a cancellation, or a\n * retryable error that used up its attempts. */\n private cellDone(cell: SearchCell): boolean {\n return (\n cell.final ||\n cell.cancelled !== null ||\n (cell.outcome === 'errored' && cell.attempts >= this.maxAttempts)\n )\n }\n\n // ── Expansion ───────────────────────────────────────────────────────\n\n /** Start a proposal when the rules admit one; otherwise say why not. */\n private async tryExpand(): Promise<SearchCloseReason | null> {\n const { maxNodes, maxCells } = this.state.header!.budget\n if (maxNodes !== null && this.state.audit.nodes >= maxNodes) return 'max-nodes'\n const { maxExpansions } = this.options\n if (maxExpansions !== undefined && this.completed.length >= maxExpansions) return 'max-nodes'\n if (this.queuedCount() > 0) return 'converged'\n if (this.inFlight.size >= 2 * this.capacity()) return 'converged'\n const view = this.policyView()\n const { policy } = this.options\n const leader = policy.leader(view)\n if (\n policy.patience !== undefined &&\n this.completed.filter((index) => index > (this.expansionOf.get(leader) ?? -1)).length >=\n policy.patience\n ) {\n return 'patience'\n }\n const screen = this.options.allocation.screenSize(this.state)\n const operation = this.operationReservation()\n const children = this.options.proposer.childrenPerProposal ?? 1\n const need = operation.usd + children * screen * this.maxCellReservation()\n const { headroomUsd } = this.state.budget\n if (headroomUsd !== null && (need > headroomUsd + USD_TOLERANCE || this.overCap())) {\n return 'budget'\n }\n if (maxCells !== null && this.state.audit.cells.allocated + children * screen > maxCells) {\n return 'budget'\n }\n const expansion = policy.expand(view)\n if (expansion === null) return 'converged'\n const screened = new Set(view.screened)\n if (expansion.parents.length === 0) {\n throw new Error(`runSearch: policy ${policy.name} proposed an expansion without a parent`)\n }\n for (const parent of expansion.parents) {\n if (!screened.has(parent)) {\n throw new Error(\n `runSearch: policy ${policy.name} named parent ${parent}, which has not finished its screen; a node becomes a parent only after its screen completes`,\n )\n }\n }\n\n const index = this.expansions++\n const operationId = `expand-${index}`\n await this.recorder.startOperation({\n operationId,\n operationKind: 'candidate-generation',\n reservation: operation,\n })\n await this.refresh()\n const controller = new AbortController()\n const request: SearchProposalRequest<TArtifact> = {\n expansion: index,\n operationId,\n operator: expansion.operator,\n parents: expansion.parents.map((nodeId) => ({ nodeId, artifact: this.artifact(nodeId) })),\n leader,\n signal: controller.signal,\n }\n this.proposalController = controller\n this.proposal = this.options.proposer.propose(request).then(\n (result) =>\n this.push({\n kind: 'proposal',\n expansion: index,\n operationId,\n request,\n selection: expansion.selection,\n result,\n }),\n (error: unknown) =>\n this.push({\n kind: 'proposal',\n expansion: index,\n operationId,\n request,\n selection: expansion.selection,\n error,\n }),\n )\n return null\n }\n\n private async recordProposal(\n completion: Extract<Completion, { kind: 'proposal' }>,\n ): Promise<void> {\n this.proposal = null\n this.proposalController = null\n const { operationId, expansion } = completion\n const { proposer, codec, admit } = this.options\n const result = completion.result as SearchProposalResult<TArtifact> | undefined\n if (!result) {\n await this.recorder.recordOperation({\n operationId,\n operationKind: 'candidate-generation',\n execution: proposer.execution,\n outcome: {\n status: 'failed',\n failure: { code: 'proposer-error', message: errorMessage(completion.error) },\n },\n accounting: interruptedAccounting(),\n })\n await this.refresh()\n this.failure ??= { error: completion.error }\n return\n }\n const { maxNodes } = this.state.header!.budget\n const room = maxNodes === null ? Number.POSITIVE_INFINITY : maxNodes - this.state.audit.nodes\n const parents = completion.request.parents as ReadonlyArray<{\n nodeId: string\n artifact: TArtifact\n }>\n const blob: SearchProposalBlob = {\n kind: 'search-proposal',\n operator: completion.request.operator,\n parents: parents.map((parent) => parent.nodeId),\n selection: completion.selection,\n children: result.children.slice(0, Math.max(0, room)).map((child) => ({\n node: codec.node(this.recorder, child.artifact),\n diffs: parents.map((parent) => codec.diff(this.recorder, parent.artifact, child.artifact)),\n label: redactText(child.label, { profile: 'share' }),\n rationale: redactText(child.rationale, { profile: 'share' }),\n attribution: child.attribution ?? null,\n invalid: admit?.(child.artifact) ?? null,\n })),\n }\n await this.recorder.recordOperation({\n operationId,\n operationKind: 'candidate-generation',\n execution: result.execution ?? proposer.execution,\n outcome: { status: 'completed' },\n accounting: result.accounting,\n artifacts: [this.recorder.blob('proposal', blob)],\n })\n await this.refresh()\n this.operationCosts.push(this.state.operation(operationId)!.spentUsd)\n this.completed.push(expansion)\n for (const [index, child] of blob.children.entries()) {\n this.proposed.set(child.node.artifactDigest, result.children[index]!.artifact)\n }\n if (result.stop !== undefined || blob.children.length === 0) this.stopReason ??= 'converged'\n await this.finishProposal(expansion)\n }\n\n /** Register every child a recorded proposal produced, each once. */\n private async finishProposal(expansion: number): Promise<void> {\n const operationId = `expand-${expansion}`\n const operation = this.state.operation(operationId)\n const ref = operation?.artifacts.find((artifact) => artifact.role === 'proposal')\n if (!operation?.recorded || operation.outcome !== 'completed' || !ref) return\n const blob = this.recorder.readBlob(ref) as SearchProposalBlob\n const { proposer } = this.options\n for (const [index, child] of blob.children.entries()) {\n const { nodeId } = await this.recorder.registerNode(child.node)\n const held = this.proposed.get(child.node.artifactDigest)\n if (held !== undefined) {\n this.proposed.delete(child.node.artifactDigest)\n if (!this.artifacts.has(nodeId)) this.artifacts.set(nodeId, held)\n }\n const edgeId = await this.recorder.recordEdge({\n childNodeId: nodeId,\n parents: blob.parents,\n operator: blob.operator,\n attribution: 'explicit',\n proposer: {\n kind: proposer.kind,\n name: proposer.name,\n operationId,\n source: proposer.source,\n },\n proposalKey: `${operationId}:${index}`,\n selection: blob.selection,\n rationale: child.rationale,\n diffs: child.diffs,\n label: child.label,\n })\n await this.refresh()\n const node = this.state.node(nodeId)!\n if (node.edgeIds[0] !== edgeId) continue // a re-proposal: a second edge, not re-measured\n this.expansionOf.set(nodeId, expansion)\n if (child.invalid !== null) {\n await this.recorder.decideNode({\n nodeId,\n decision: { status: 'invalid' },\n rule: 'admission',\n reason: child.invalid,\n })\n await this.refresh()\n continue\n }\n // On resume, a child the divergence rule already decided invalid stays\n // out: it is never screened, so it is never a parent.\n if (this.admitted.has(nodeId) || node.status === 'invalid') continue\n this.admitted.add(nodeId)\n await this.allocateFor(nodeId)\n if ((this.pending.get(nodeId) ?? 0) === 0) this.markScreened(nodeId)\n }\n }\n\n // ── Close ───────────────────────────────────────────────────────────\n\n private async close(): Promise<void> {\n await this.refresh()\n // Nodes left waiting on a rung are pruned with their rank; the policy's\n // leader is kept for the decisions below.\n const keep = this.options.policy.leader(this.policyView())\n for (const decision of this.options.allocation.prune(this.allocationView(), keep)) {\n await this.decide(decision)\n }\n if (this.claimPlan) {\n await this.closeWithClaim(this.claimPlan)\n return\n }\n const view = this.policyView()\n const leader = this.options.policy.leader(view)\n const { split } = view\n const root = this.state.rootNodeId!\n const rule = this.options.policy.name\n const leaderUnits = view.unitScores(leader).map((unit) => unit.unitId)\n // Decide from one read of the state, then append: an append moves the\n // ledger on and retires the view.\n const decisions = this.state\n .nodes()\n .filter((node) => !isTerminal(node))\n .map((node) => {\n const scored = this.state.scoredCells(node.nodeId, split).length > 0\n const lead = node.nodeId === leader && scored\n const against = node.nodeId === leader ? root : leader\n const basis: NodeEstimate | null =\n node.nodeId === against || !scored\n ? null\n : estimateNode(this.state, node.nodeId, { against, split })\n const units = new Set(view.unitScores(node.nodeId).map((unit) => unit.unitId))\n return {\n nodeId: node.nodeId,\n decision: { status: lead ? ('selected' as const) : ('rejected' as const) },\n basis,\n rule,\n reason: lead\n ? `the leader when the search stopped (${this.stopReason}): a budget decision on the ${split} split, which claims nothing`\n : !this.screenedSet.has(node.nodeId) || !scored\n ? 'the search stopped before this node was measured'\n : !view.complete(node.nodeId)\n ? 'it left a unit unscored, so it could not lead'\n : leaderUnits.some((unitId) => !units.has(unitId))\n ? 'the search stopped before it was measured on every unit the leader was'\n : 'it did not beat the leader on the units they share',\n }\n })\n for (const decision of decisions) await this.recorder.decideNode(decision)\n await this.recorder.close({ reason: this.stopReason ?? 'converged', claim: null })\n await this.refresh()\n }\n\n /** Close with the claim: the claim's decisions, then every other open node\n * rejected with its selection estimate against the root. */\n private async closeWithClaim(plan: SearchClaimPlan): Promise<void> {\n const { claim, decisions } = decideSearchClaim(this.state, plan)\n const decided = new Set(decisions.map((decision) => decision.nodeId))\n const root = this.state.rootNodeId!\n const rest = this.state\n .nodes()\n .filter((node) => !decided.has(node.nodeId) && !isTerminal(node))\n .map((node) => {\n const scored = this.state.scoredCells(node.nodeId, 'selection').length > 0\n return {\n nodeId: node.nodeId,\n decision: { status: 'rejected' as const },\n basis: scored\n ? estimateNode(this.state, node.nodeId, { against: root, split: 'selection' })\n : null,\n rule: SEARCH_CLAIM_RULE_NAME,\n reason: scored\n ? 'not a finalist: the claim tests at most 3 nodes that scored every selection unit and beat the root, best selection mean first'\n : 'the search stopped before this node was measured on the selection split',\n }\n })\n for (const decision of [...decisions, ...rest]) await this.recorder.decideNode(decision)\n await this.recorder.close({ reason: plan.stopReason, claim })\n await this.refresh()\n }\n\n /** The closed search, with its claim made again from the ledger alone. A\n * claim the ledger does not support throws: a tampered ledger, or a\n * producer and verifier that disagree. */\n private closedResult(): SearchRunResult {\n const state = this.state\n const claimVerification = verifySearchClaim(state)\n if (claimVerification?.status === 'mismatch') {\n throw new Error(\n `runSearch: search ${state.searchId} closed with a claim its ledger does not support: ${claimVerification.differences.join('; ')}`,\n )\n }\n return {\n state,\n leader: state.audit.selectedNodeId ?? state.rootNodeId!,\n reason: state.closed!.reason,\n claim: state.closed!.claim,\n claimVerification,\n }\n }\n\n // ── Reads ───────────────────────────────────────────────────────────\n\n private policyView(): SearchPolicyView {\n return searchPolicyView(this.state, {\n screened: this.screened,\n screening: this.admitted.size - this.screenedSet.size,\n expansions: this.completed.length,\n maxAttempts: this.maxAttempts,\n })\n }\n\n private allocationView(): SearchAllocationView {\n return {\n state: this.state,\n idle: (nodeId) => this.admitted.has(nodeId) && (this.pending.get(nodeId) ?? 0) === 0,\n }\n }\n\n private artifact(nodeId: string): TArtifact {\n const held = this.artifacts.get(nodeId)\n if (held !== undefined) return held\n const artifact = this.options.codec.load(this.recorder, this.state.node(nodeId)!)\n this.artifacts.set(nodeId, artifact)\n return artifact\n }\n\n private capacity(): number {\n let total = 0\n for (const lane of this.lanes.values()) total += lane.capacity\n const cap = this.state.header!.budget.maxConcurrency\n return cap === null ? total : Math.min(cap, total)\n }\n\n /** A hard lane holds its enforced maximum. An estimate lane holds 1.5 times\n * the 99th percentile of its settled cells once 20 settled, else its prior. */\n private cellReservation(lane: LaneState): SearchReservation {\n if (lane.costCap === 'hard') return { kind: 'hard', usd: lane.cellUsd }\n return { kind: 'estimate', usd: estimate(lane.settledCosts, lane.cellUsd) }\n }\n\n private maxCellReservation(): number {\n let most = 0\n for (const lane of this.lanes.values()) most = Math.max(most, this.cellReservation(lane).usd)\n return most\n }\n\n private operationReservation(): SearchReservation {\n return {\n kind: 'estimate',\n usd: estimate(this.operationCosts, this.options.proposer.reservationUsd ?? 0),\n }\n }\n\n /** Overspend took committed spend, open holds and the unspent claim reserve\n * past the cap. Nothing new is proposed then, even at a zero-dollar prior. */\n private overCap(): boolean {\n const { maxUsd } = this.state.header!.budget\n if (maxUsd === null) return false\n const { committedUsd, openReservationUsd } = this.state.audit.spend\n const used = committedUsd + openReservationUsd + this.state.budget.claimReserveUsd\n return used > maxUsd + USD_TOLERANCE\n }\n\n private pastDeadline(): boolean {\n const deadline = this.state.header!.budget.deadline\n return deadline !== null && this.now() >= Date.parse(deadline)\n }\n\n private async refresh(): Promise<void> {\n this.state = await this.recorder.state()\n }\n}\n\n/**\n * A policy's read of a search: `screened` lists the admitted nodes whose screen\n * finished, in registration order; `screening` counts the admitted nodes still\n * being screened. Nodes are ranked on the selection split, or on train when\n * the search declares no selection split. The view reads no test cell.\n * `maxAttempts` (default 3, the kernel's) says when an errored cell has no\n * attempt left, which makes its unit a dodge.\n */\nexport function searchPolicyView(\n state: SearchStateView,\n input: {\n screened: readonly string[]\n screening: number\n expansions: number\n maxAttempts?: number\n },\n): SearchPolicyView {\n const maxAttempts = input.maxAttempts ?? DEFAULT_MAX_ATTEMPTS\n const header = state.header\n if (!header) throw new Error(`search ${state.searchId} has not been opened`)\n const split = header.splits.selection.tasks.length > 0 ? 'selection' : 'train'\n let nodes: SearchPolicyNode[] | undefined\n let operatorWeights: OperatorYieldSignal | undefined\n return {\n searchId: state.searchId,\n seed: header.policy.seed,\n direction: header.objective.direction,\n split,\n rootNodeId: state.rootNodeId!,\n expansions: input.expansions,\n screened: [...input.screened],\n screening: input.screening,\n complete: (nodeId) => {\n // A cell still to run (queued, in flight, or retrying) and a cell\n // cancelled before it ran do not count against the node; a cell that\n // ran and ended unscored does.\n let scored = false\n for (const cell of state.cells({ nodeId })) {\n if (cell.split !== split) continue\n if (cell.score !== null) scored = true\n else if (cell.final || (cell.outcome === 'errored' && cell.attempts >= maxAttempts)) {\n return false\n }\n }\n return scored\n },\n unitScores: (nodeId) => state.unitScores(nodeId, split),\n estimate: (nodeId, against) => estimateNode(state, nodeId, { against, split }),\n nodes: () => {\n nodes ??= policyNodes(state)\n return nodes\n },\n get posterior() {\n let posterior = POSTERIORS.get(state)\n if (!posterior) {\n posterior = searchPosterior(state, { split })\n POSTERIORS.set(state, posterior)\n }\n return posterior\n },\n get operatorWeights() {\n operatorWeights ??= operatorYield(state, { split }).signal.value\n return operatorWeights\n },\n }\n}\n\n/** One posterior per ledger state: a state view is retired when the ledger\n * moves on, so the view it was computed from names the sequence. */\nconst POSTERIORS = new WeakMap<SearchStateView, SearchPosterior>()\n\n/** Every node whose edge is recorded, with its lineage and its defects outside\n * the test split. */\nfunction policyNodes(state: SearchStateView): SearchPolicyNode[] {\n const nodes: SearchPolicyNode[] = []\n for (const node of state.nodes()) {\n const edgeId = node.edgeIds[0]\n if (edgeId === undefined) continue\n let outcomes = 0\n let defects = 0\n for (const cell of state.cells({ nodeId: node.nodeId })) {\n if (cell.split === 'test' || !cell.final) continue\n outcomes += 1\n if (cell.outcome === 'failed') defects += 1\n }\n const edge = state.edge(edgeId)!\n nodes.push({\n nodeId: node.nodeId,\n ordinal: node.ordinal,\n parent: node.primaryParentId,\n operator: edge.operator,\n rule: edge.selection?.rule ?? null,\n children: node.children,\n status: node.status,\n outcomes,\n defects,\n })\n }\n return nodes\n}\n\n/**\n * The divergence rule: a node whose train mean rose over its parent's on the\n * train units they share while its selection interval against the parent (6\n * or more units, not indeterminate) lies wholly on the worse side. Train is\n * what the proposer reads; a gain there that selection contradicts is the\n * signature of fitting the feedback instead of the task.\n */\nexport function searchDivergence(\n state: SearchStateView,\n nodeId: string,\n): { basis: NodeEstimate; reason: string } | null {\n const header = state.header\n const node = state.node(nodeId)\n const parent = node?.primaryParentId ?? null\n if (!header || parent === null || header.splits.selection.tasks.length === 0) return null\n const selection = estimateNode(state, nodeId, { against: parent, split: 'selection' })\n if (selection.interval === null) return null\n const maximize = header.objective.direction === 'maximize'\n const [low, high] = selection.interval\n if (maximize ? high >= 0 : low <= 0) return null\n const parentTrain = new Map(\n state.unitScores(parent, 'train').map((unit) => [unit.unitId, unit.mean]),\n )\n let gain = 0\n let shared = 0\n for (const unit of state.unitScores(nodeId, 'train')) {\n const before = parentTrain.get(unit.unitId)\n if (before === undefined) continue\n gain += maximize ? unit.mean - before : before - unit.mean\n shared += 1\n }\n if (shared === 0 || gain <= 0) return null\n const trainGain = Math.round((gain / shared) * 1e4) / 1e4\n return {\n basis: selection,\n reason: `its train mean rose ${trainGain} over its parent's on ${shared} shared train unit${shared === 1 ? '' : 's'}, while its selection interval against the parent, [${round4(low)}, ${round4(high)}] on ${selection.pairs} units, lies wholly on the worse side`,\n }\n}\n\nfunction round4(value: number): number {\n return Math.round(value * 1e4) / 1e4\n}\n\nfunction isTerminal(node: SearchNode): boolean {\n return node.status !== null && node.status !== 'advanced'\n}\n\nfunction estimate(costs: readonly number[], prior: number): number {\n if (costs.length < ESTIMATE_FROM_CELLS) return prior\n const sorted = [...costs].sort((a, b) => a - b)\n const p99 = sorted[Math.min(sorted.length - 1, Math.ceil(0.99 * sorted.length) - 1)]!\n return Math.round(ESTIMATE_MARGIN * p99 * 1e9) / 1e9\n}\n\n/** Spend of work whose result was lost: unknown, with no proven floor. */\nfunction interruptedAccounting(): SearchAttemptAccounting {\n return {\n tokens: { status: 'unknown', reason: 'the result of this work was lost' },\n cost: {\n status: 'unknown',\n knownLowerBoundUsd: 0,\n reason: 'the result of this work was lost, so its spend is unknown',\n },\n }\n}\n\nfunction errorMessage(error: unknown): string {\n const text = error instanceof Error ? error.message : String(error)\n return text.trim().length > 0 ? text : 'the proposer failed without a message'\n}\n"],"mappings":";;;;;;;;;;;;AAiCA,SAAgB,UAAa,GAAM,GAAM,YAAqC;CAC5E,IAAI,iBAAiB;CACrB,KAAK,MAAM,OAAO,YAAY;EAC5B,MAAM,KAAK,IAAI,MAAM,CAAC;EACtB,MAAM,KAAK,IAAI,MAAM,CAAC;EACtB,IAAI,CAAC,OAAO,SAAS,EAAE,KAAK,CAAC,OAAO,SAAS,EAAE,GAAG,OAAO;EACzD,MAAM,YAAY,IAAI,cAAc,aAAa,KAAK,KAAK,KAAK;EAEhE,IADiB,IAAI,cAAc,aAAa,KAAK,KAAK,KAAK,IACjD,OAAO;EACrB,IAAI,WAAW,iBAAiB;CAClC;CACA,OAAO;AACT;;;;;;AAOA,SAAgB,eAAkB,YAAiB,YAA6C;CAC9F,IAAI,WAAW,WAAW,GACxB,MAAM,IAAI,MAAM,+CAA+C;CAEjE,MAAM,QAAQ,WAAW,QAAQ,MAAM,WAAW,OAAO,MAAM,OAA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KAAK,IAAI,OAAO,SAAS,GAAG,KAAK,KAAK,MAAO,OAAO,MAAM,IAAI,CAAC;CAClF,OAAO,KAAK,MAAM,kBAAkB,MAAM,GAAG,IAAI;AACnD;;AAGA,SAAS,wBAAiD;CACxD,OAAO;EACL,QAAQ;GAAE,QAAQ;GAAW,QAAQ;EAAmC;EACxE,MAAM;GACJ,QAAQ;GACR,oBAAoB;GACpB,QAAQ;EACV;CACF;AACF;AAEA,SAAS,aAAa,OAAwB;CAC5C,MAAM,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CAClE,OAAO,KAAK,KAAK,CAAC,CAAC,SAAS,IAAI,OAAO;AACzC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"statistical-heldout-DFKtp-Qm.d.ts","names":["_$__evidence_receipt0.EvidenceReceipt"],"sources":["../src/statistics/paired-binary.ts","../src/statistics/sequential-eprocess.ts","../src/experiment/final-evidence.ts","../src/attestation.ts","../src/experiment/evidence-receipt.ts","../src/experiment/campaign-evidence.ts","../src/pareto.ts","../src/campaign/gates/promotion-policy.ts","../src/campaign/gates/power-preflight.ts","../src/paired-arms.ts","../src/pre-registration.ts","../src/campaign/gates/sequential.ts","../src/campaign/gates/statistical-heldout.ts"],"mappings":";;;;;;;UAgBiB;;EAEf;;EAEA;;EAEA;;;;;;;;;;iBAWc,OAAO,mBAAmB,WAAW,sBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiDzD,sBAAsB,QAAQ;;UAU7B;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;;;;;;iBAec,QACd,SAAS,6BACT,WAAW,8BACV;;UAmBc;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;;;;;;;;;iBAkBc,qBACd,SAAS,6BACT,WAAW,6BACX,sBACC;;;;UAkCc;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA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