@tangle-network/agent-eval 0.196.0 → 0.198.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/dist/active-curriculum-B_Lc9kfO.js +61 -0
  3. package/dist/active-curriculum-B_Lc9kfO.js.map +1 -0
  4. package/dist/adapters/http.d.ts +2 -2
  5. package/dist/analyst/index.d.ts +5 -5
  6. package/dist/analyst/index.js +3 -3
  7. package/dist/{analyze-runs-B6gv7vAT.js → analyze-runs-DFbp2gB8.js} +5 -5
  8. package/dist/{analyze-runs-B6gv7vAT.js.map → analyze-runs-DFbp2gB8.js.map} +1 -1
  9. package/dist/{benchmark-command-Bw1he2JM.js → benchmark-command-D8E5TaPC.js} +6 -5
  10. package/dist/{benchmark-command-Bw1he2JM.js.map → benchmark-command-D8E5TaPC.js.map} +1 -1
  11. package/dist/benchmarks/index.d.ts +4 -3
  12. package/dist/benchmarks/index.d.ts.map +1 -1
  13. package/dist/benchmarks/index.js +3 -3
  14. package/dist/campaign/index.d.ts +5 -4
  15. package/dist/campaign/index.js +13 -11
  16. package/dist/{campaign-qe1WC3Sz.js → campaign-Dlg2iOzH.js} +13 -12
  17. package/dist/{campaign-qe1WC3Sz.js.map → campaign-Dlg2iOzH.js.map} +1 -1
  18. package/dist/{campaign-evidence-DJc60F9C.js → campaign-evidence-jL_U7Ikv.js} +2 -2
  19. package/dist/{campaign-evidence-DJc60F9C.js.map → campaign-evidence-jL_U7Ikv.js.map} +1 -1
  20. package/dist/cli.js +243 -13
  21. package/dist/cli.js.map +1 -1
  22. package/dist/contract/index.d.ts +7 -6
  23. package/dist/contract/index.js +9 -9
  24. package/dist/{default-registry-D2csUBBQ.d.ts → default-registry-oK9hHfX_.d.ts} +3 -3
  25. package/dist/{default-registry-D2csUBBQ.d.ts.map → default-registry-oK9hHfX_.d.ts.map} +1 -1
  26. package/dist/{define-agent-eval-DwAaPvvH.d.ts → define-agent-eval-By9PImpa.d.ts} +5 -4
  27. package/dist/define-agent-eval-By9PImpa.d.ts.map +1 -0
  28. package/dist/{define-agent-eval-h2qYe0xY.js → define-agent-eval-DvBgSzAI.js} +6 -6
  29. package/dist/{define-agent-eval-h2qYe0xY.js.map → define-agent-eval-DvBgSzAI.js.map} +1 -1
  30. package/dist/diagnosis/index.js +1 -1
  31. package/dist/{dspy-rlm-engine-k_QdEBZo.js → dspy-rlm-engine-B5T43BkZ.js} +2 -2
  32. package/dist/{dspy-rlm-engine-k_QdEBZo.js.map → dspy-rlm-engine-B5T43BkZ.js.map} +1 -1
  33. package/dist/{engine-De2hfuiQ.d.ts → engine-Dc996kAg.d.ts} +2 -2
  34. package/dist/{engine-De2hfuiQ.d.ts.map → engine-Dc996kAg.d.ts.map} +1 -1
  35. package/dist/{eval-campaign-CXT2WYUe.js → eval-campaign-GapmPHIA.js} +2 -2
  36. package/dist/{eval-campaign-CXT2WYUe.js.map → eval-campaign-GapmPHIA.js.map} +1 -1
  37. package/dist/evaluation.d.ts +1 -1
  38. package/dist/experiment/index.d.ts +1 -1
  39. package/dist/experiment/index.js +8 -6
  40. package/dist/experiment/index.js.map +1 -1
  41. package/dist/{external-optimizer-process-_YIECYJ7.js → external-optimizer-process-CEXcCKqd.js} +2 -2
  42. package/dist/{external-optimizer-process-_YIECYJ7.js.map → external-optimizer-process-CEXcCKqd.js.map} +1 -1
  43. package/dist/{external-optimizer-subprocess-BrghTvEp.js → external-optimizer-subprocess-laM1-UDV.js} +2 -61
  44. package/dist/external-optimizer-subprocess-laM1-UDV.js.map +1 -0
  45. package/dist/fuzz.d.ts.map +1 -1
  46. package/dist/fuzz.js +2 -3
  47. package/dist/fuzz.js.map +1 -1
  48. package/dist/hosted/index.js +1 -1
  49. package/dist/{index-CigojbNH.d.ts → index-BhoOCduB.d.ts} +38 -945
  50. package/dist/index-BhoOCduB.d.ts.map +1 -0
  51. package/dist/{index-CpCIXObe.d.ts → index-D-tI1vgf.d.ts} +6 -6
  52. package/dist/{index-CpCIXObe.d.ts.map → index-D-tI1vgf.d.ts.map} +1 -1
  53. package/dist/{index-kKECJfib.d.ts → index-lbwvO9vJ.d.ts} +3 -3
  54. package/dist/{index-kKECJfib.d.ts.map → index-lbwvO9vJ.d.ts.map} +1 -1
  55. package/dist/index.d.ts +9 -9
  56. package/dist/index.js +15 -13
  57. package/dist/index.js.map +1 -1
  58. package/dist/jev-protocol.d.ts +17 -9
  59. package/dist/jev-protocol.d.ts.map +1 -1
  60. package/dist/jev-protocol.js +22 -14
  61. package/dist/jev-protocol.js.map +1 -1
  62. package/dist/jev.d.ts +3 -3
  63. package/dist/jev.js +3 -7
  64. package/dist/jev.js.map +1 -1
  65. package/dist/{llm-judge-CxfoYqdk.js → llm-judge-BYWXsxhZ.js} +529 -2079
  66. package/dist/llm-judge-BYWXsxhZ.js.map +1 -0
  67. package/dist/{matrix-C1X-fIVX.d.ts → matrix-BnksRaDD.d.ts} +2 -2
  68. package/dist/{matrix-C1X-fIVX.d.ts.map → matrix-BnksRaDD.d.ts.map} +1 -1
  69. package/dist/multiplicity-D9cjmStq.js +101 -0
  70. package/dist/multiplicity-D9cjmStq.js.map +1 -0
  71. package/dist/multishot/golden/index.d.ts +1 -1
  72. package/dist/multishot/golden/index.js +1 -1
  73. package/dist/multishot/index.d.ts +2 -2
  74. package/dist/multishot/index.js +1 -1
  75. package/dist/openapi.json +1 -1
  76. package/dist/{paired-arms-JSDcs2zx.js → paired-arms-DKZFVPt8.js} +4 -398
  77. package/dist/paired-arms-DKZFVPt8.js.map +1 -0
  78. package/dist/paired-binary-fzkwENI4.js +399 -0
  79. package/dist/paired-binary-fzkwENI4.js.map +1 -0
  80. package/dist/{paired-promotion-decision-DTKl6-G8.js → paired-promotion-decision-D5B1Cxc2.js} +78 -5
  81. package/dist/paired-promotion-decision-D5B1Cxc2.js.map +1 -0
  82. package/dist/{power-and-mde-BJOpt6pq.js → power-and-mde-K_CmO3dc.js} +3 -101
  83. package/dist/power-and-mde-K_CmO3dc.js.map +1 -0
  84. package/dist/{produced-state-B0QMdiLh.js → produced-state-DOfmCEwP.js} +3 -3
  85. package/dist/{produced-state-B0QMdiLh.js.map → produced-state-DOfmCEwP.js.map} +1 -1
  86. package/dist/{promotion-policy-Cy5OV8BV.js → promotion-policy-C6FAJvmZ.js} +3 -3
  87. package/dist/{promotion-policy-Cy5OV8BV.js.map → promotion-policy-C6FAJvmZ.js.map} +1 -1
  88. package/dist/reporting.js +3 -3
  89. package/dist/rl.d.ts +17 -39
  90. package/dist/rl.d.ts.map +1 -1
  91. package/dist/rl.js +5 -5
  92. package/dist/search/index.d.ts +1162 -0
  93. package/dist/search/index.d.ts.map +1 -0
  94. package/dist/search/index.js +187 -0
  95. package/dist/search/index.js.map +1 -0
  96. package/dist/search-kernel-CuvbakC_.d.ts +1176 -0
  97. package/dist/search-kernel-CuvbakC_.d.ts.map +1 -0
  98. package/dist/search-kernel-D8_kxChy.js +2399 -0
  99. package/dist/search-kernel-D8_kxChy.js.map +1 -0
  100. package/dist/{search-ledger-9W0g5FP6.js → search-ledger-BnUytR8X.js} +3 -1
  101. package/dist/search-ledger-BnUytR8X.js.map +1 -0
  102. package/dist/{search-shipper-CYbmJQx8.js → search-shipper-Cn8cxcyp.js} +2 -2
  103. package/dist/{search-shipper-CYbmJQx8.js.map → search-shipper-Cn8cxcyp.js.map} +1 -1
  104. package/dist/search-summary-Dmppg8kV.js +133 -0
  105. package/dist/search-summary-Dmppg8kV.js.map +1 -0
  106. package/dist/{semantic-concept-judge-Bh5lvKGg.js → semantic-concept-judge-2SE_kXGF.js} +2 -2
  107. package/dist/{semantic-concept-judge-Bh5lvKGg.js.map → semantic-concept-judge-2SE_kXGF.js.map} +1 -1
  108. package/dist/{sequential-C21_PP7F.js → sequential-Yz3OSskl.js} +2 -2
  109. package/dist/{sequential-C21_PP7F.js.map → sequential-Yz3OSskl.js.map} +1 -1
  110. package/dist/single-run-lock-fVu3MZWH.js +62 -0
  111. package/dist/single-run-lock-fVu3MZWH.js.map +1 -0
  112. package/dist/{skillopt-optimization-method-IbEhlA1V.js → skillopt-optimization-method-BMP2qV_1.js} +46 -33
  113. package/dist/{skillopt-optimization-method-IbEhlA1V.js.map → skillopt-optimization-method-BMP2qV_1.js.map} +1 -1
  114. package/dist/{statistical-heldout-DANVmyug.js → statistical-heldout-BAFDCo07.js} +2 -2
  115. package/dist/{statistical-heldout-DANVmyug.js.map → statistical-heldout-BAFDCo07.js.map} +1 -1
  116. package/dist/{statistical-heldout-BedVSZb2.d.ts → statistical-heldout-CMpxMjlQ.d.ts} +2 -2
  117. package/dist/{statistical-heldout-BedVSZb2.d.ts.map → statistical-heldout-CMpxMjlQ.d.ts.map} +1 -1
  118. package/dist/{store-tool-spans-CawP-WxM.d.ts → store-tool-spans-CUwWSXoj.d.ts} +3 -3
  119. package/dist/{store-tool-spans-CawP-WxM.d.ts.map → store-tool-spans-CUwWSXoj.d.ts.map} +1 -1
  120. package/dist/{summary-report-BMvou2oZ.js → summary-report-BeYnvddy.js} +4 -3
  121. package/dist/{summary-report-BMvou2oZ.js.map → summary-report-BeYnvddy.js.map} +1 -1
  122. package/dist/{tool-groups-B4JVrH3g.d.ts → tool-groups-DVJAR1GE.d.ts} +2 -2
  123. package/dist/tool-groups-DVJAR1GE.d.ts.map +1 -0
  124. package/dist/trace-repair/index.d.ts +1 -1
  125. package/dist/traces.d.ts +2 -2
  126. package/dist/tree-DHHWsH-X.js +4045 -0
  127. package/dist/tree-DHHWsH-X.js.map +1 -0
  128. package/dist/{types-B3jzCp0p.js → types-B3jzCp0p2.js} +1 -1
  129. package/dist/types-B3jzCp0p2.js.map +1 -0
  130. package/dist/{types-CjFDKMDe.d.ts → types-D94EanDL.d.ts} +2 -2
  131. package/dist/{types-CjFDKMDe.d.ts.map → types-D94EanDL.d.ts.map} +1 -1
  132. package/dist/{types-B2673PBj.d.ts → types-EBUav9Bu.d.ts} +8 -4
  133. package/dist/types-EBUav9Bu.d.ts.map +1 -0
  134. package/docs/campaign-proposers.md +2 -0
  135. package/docs/design/statistics-decisions.md +1 -1
  136. package/docs/jev.md +3 -2
  137. package/docs/search-ledger.md +145 -8
  138. package/package.json +6 -1
  139. package/dist/active-curriculum-OjIWgrUJ.js +0 -204
  140. package/dist/active-curriculum-OjIWgrUJ.js.map +0 -1
  141. package/dist/define-agent-eval-DwAaPvvH.d.ts.map +0 -1
  142. package/dist/external-optimizer-subprocess-BrghTvEp.js.map +0 -1
  143. package/dist/index-CigojbNH.d.ts.map +0 -1
  144. package/dist/llm-judge-CxfoYqdk.js.map +0 -1
  145. package/dist/paired-arms-JSDcs2zx.js.map +0 -1
  146. package/dist/paired-delta-test-BF-FEP8V.js +0 -78
  147. package/dist/paired-delta-test-BF-FEP8V.js.map +0 -1
  148. package/dist/paired-promotion-decision-DTKl6-G8.js.map +0 -1
  149. package/dist/power-and-mde-BJOpt6pq.js.map +0 -1
  150. package/dist/search-ledger-9W0g5FP6.js.map +0 -1
  151. package/dist/search-summary-CcavvYLe.js +0 -378
  152. package/dist/search-summary-CcavvYLe.js.map +0 -1
  153. package/dist/tool-groups-B4JVrH3g.d.ts.map +0 -1
  154. package/dist/types-B2673PBj.d.ts.map +0 -1
  155. package/dist/types-B3jzCp0p.js.map +0 -1
@@ -0,0 +1,1162 @@
1
+ import { A as SearchLedgerHash, C as SearchEdgeOperator, G as SearchSplit, H as SearchProposerKind, I as SearchNodeStatus, L as SearchOpenedEvent, T as SearchEstimateMethod, W as SearchSourceRef, i as SearchArtifactRef, j as SearchModelIdentity, l as SearchCandidateSurface, m as SearchClaim, t as NodeEstimate, y as SearchCloseReason } from "../search-ledger-types-p2xKfiDJ.js";
2
+ import { $ as SearchNode, it as SearchStateView } from "../types-EBUav9Bu.js";
3
+ import { $ as EXPANSION_OPERATORS, L as SearchPolicy, M as SearchUnitExtension, at as OperatorYieldRow, ct as LensResult, dt as rankingSplit, et as ExpansionOperator, ft as summarizeSamples, it as OperatorYieldOptions, lt as LensSignal, nt as OperatorOutcomeCounts, ot as OperatorYieldSignal, p as SearchRunResult, r as SearchArtifactCodec, rt as OperatorYieldData, s as SearchLane, st as operatorYield, t as RunSearchOptions, tt as MIN_OUTCOMES_FOR_WEIGHT, ut as SampleSummary, z as SearchPolicyView } from "../search-kernel-CuvbakC_.js";
4
+ import { AgentProfileResourceRef } from "@tangle-network/agent-interface";
5
+ //#region src/search/lenses/edit-credit.d.ts
6
+ /** Signal name a policy reads. */
7
+ declare const EDIT_CREDIT_SIGNAL = "reusableHunks";
8
+ /** The estimator every gene credit names. */
9
+ declare const EDIT_CREDIT_ESTIMATOR: SearchSourceRef;
10
+ interface EditCreditOptions {
11
+ /**
12
+ * The parsed content a node's artifact reference names, or undefined when
13
+ * it is unavailable. The caller must verify the bytes against `ref.sha256`;
14
+ * the lens trusts what it is handed.
15
+ */
16
+ readArtifact(ref: SearchArtifactRef): unknown | undefined;
17
+ /** Split credit is measured on. Default: selection when the search declares
18
+ * one, else train. */
19
+ split?: SearchSplit;
20
+ /** Genes tested for pairwise interaction: those with the most measured
21
+ * units, one per linkage group. Default 24, so at most 276 pairs. */
22
+ interactionGenes?: number;
23
+ }
24
+ type EditGeneVerdict = 'reusable' | 'harmful' | 'unresolved' | 'insufficient';
25
+ interface EditIntroduction {
26
+ nodeId: string;
27
+ edgeId: string;
28
+ operator: SearchEdgeOperator;
29
+ parents: string[];
30
+ /** The edge is a re-proposal into a node registered earlier. */
31
+ reproposal: boolean;
32
+ }
33
+ interface EditGene {
34
+ geneId: string;
35
+ kind: 'insert' | 'delete';
36
+ /** Where in the artifact: `prompt`, `component:<name>`, or a JSON path such
37
+ * as `/prompt/systemPrompt`. */
38
+ path: string;
39
+ /** Normalized lines: the gene's identity. */
40
+ lines: string[];
41
+ /** The lines as the first proposer wrote them. */
42
+ text: string;
43
+ /** Lineage edges whose child carries the gene while none of its parents
44
+ * did, in ledger order. More than one means a proposer made the same edit
45
+ * again. */
46
+ introduced: EditIntroduction[];
47
+ /** Lineage edges whose child lost the gene that a parent carried. */
48
+ dropped: number;
49
+ /** Genes introduced on the edge that first introduced this one: the edit
50
+ * it was born in, itself included, in artifact order. */
51
+ edit: string[];
52
+ /** Nodes with known content that carry it and are not invalid. */
53
+ carriers: number;
54
+ /** `invalid` carriers (judge integrity or admission failures), excluded from
55
+ * every contrast; an edit that makes nodes invalid shows here. */
56
+ invalidCarriers: number;
57
+ steps: {
58
+ /** Steps on which the gene flips. */
59
+ flips: number;
60
+ /** Of those, the steps its credit reads. */
61
+ clean: number;
62
+ /** Clean steps on which the child gained the gene. */
63
+ gained: number;
64
+ /** Clean steps on which the child lost it. */
65
+ lost: number;
66
+ };
67
+ /** Carrying side against lacking side on clean steps; `delta` is carrier
68
+ * minus non-carrier in the metric's units. */
69
+ credit: NodeEstimate;
70
+ verdict: EditGeneVerdict;
71
+ /** The first gene of this gene's linkage group: genes with the same clean
72
+ * steps, oriented the same way, have one credit and cannot be separated.
73
+ * Null when the gene has no partner. */
74
+ linkage: string | null;
75
+ }
76
+ interface EditInteraction {
77
+ genes: [string, string];
78
+ /** Clean steps of each gene, split by whether both ends carry the other. */
79
+ steps: {
80
+ firstWithSecond: number;
81
+ firstWithoutSecond: number;
82
+ secondWithFirst: number;
83
+ secondWithoutFirst: number;
84
+ };
85
+ /** Units with a contrast in at least one direction. */
86
+ units: number;
87
+ method: SearchEstimateMethod;
88
+ /** Mean per-unit difference of a gene's credit with the other present minus
89
+ * with it absent, both directions averaged, in the metric's units; null
90
+ * below 2 units. */
91
+ interaction: number | null;
92
+ /** Percentile bootstrap spread from 6 units; null below 6 or when every
93
+ * per-unit contrast is equal. */
94
+ interval: [number, number] | null;
95
+ indeterminate: boolean;
96
+ /** Exact two-sided sign test; null below 6 units. */
97
+ signP: number | null;
98
+ /** Holm-adjusted over every pair tested; null when this pair was not tested. */
99
+ adjustedP: number | null;
100
+ interacting: boolean;
101
+ /** The pair does better together than their separate credits add up to, in
102
+ * the objective's direction. Null without an interaction estimate. */
103
+ synergy: boolean | null;
104
+ }
105
+ interface EditSkillCandidate {
106
+ /** An inline skill resource: add it to `profile.resources.skills` (with
107
+ * `resources.failOnError: true`) and pass `improveOptions` to agent-runtime
108
+ * `improve()` with `method: officialSkillOpt(...)` to optimize it. */
109
+ resource: Extract<AgentProfileResourceRef, {
110
+ kind: 'inline';
111
+ }>;
112
+ improveOptions: {
113
+ surface: 'skills';
114
+ skills: {
115
+ resourceName: string;
116
+ };
117
+ };
118
+ /** The linked insert genes the skill holds, in artifact order. */
119
+ genes: string[];
120
+ path: string;
121
+ credit: NodeEstimate;
122
+ }
123
+ interface EditLineageRow {
124
+ nodeId: string;
125
+ ordinal: number;
126
+ depth: number | null;
127
+ primaryParentId: string | null;
128
+ parents: string[];
129
+ operator: SearchEdgeOperator | null;
130
+ status: SearchNode['status'];
131
+ /** Every gene this node carries. */
132
+ carries: string[];
133
+ contentKnown: boolean;
134
+ }
135
+ interface EditCreditData {
136
+ split: SearchSplit;
137
+ direction: 'maximize' | 'minimize';
138
+ edges: {
139
+ /** Edges with at least one parent registered before the child in this search. */
140
+ lineage: number;
141
+ /** Of those, edges whose child and every lineage parent had known content. */
142
+ read: number;
143
+ /** Why an edge's content was unknown, with counts. */
144
+ unknown: Record<string, number>;
145
+ };
146
+ /** Distinct parent-child pairs with known content; those with an invalid
147
+ * end are excluded from every contrast. */
148
+ steps: {
149
+ total: number;
150
+ invalidEnd: number;
151
+ };
152
+ nodes: {
153
+ total: number;
154
+ contentUnknown: number;
155
+ invalid: number;
156
+ };
157
+ /** Reusable, harmful, unresolved, then insufficient; within each, by credit. */
158
+ genes: EditGene[];
159
+ counts: Record<EditGeneVerdict, number>;
160
+ /** Independent edits per verdict: linkage groups, and for genes without a
161
+ * clean step the edit they were born in. */
162
+ editCounts: Record<EditGeneVerdict, number>;
163
+ interactions: {
164
+ genesConsidered: number;
165
+ /** Pairs with a with-and-without split in at least one direction. */
166
+ pairsWithContexts: number;
167
+ /** Pairs with 6 or more units and a non-degenerate contrast. */
168
+ pairsTested: number;
169
+ alpha: number;
170
+ correction: 'holm';
171
+ /** Flagged pairs first, then by adjusted p. */
172
+ pairs: EditInteraction[];
173
+ };
174
+ skillCandidates: EditSkillCandidate[];
175
+ /** What the reusable count would be with no true effect anywhere: credit is
176
+ * not adjusted for the number of edits, so read `reusable` against this. */
177
+ chance: {
178
+ /** Independent edits measured on 6 or more units. */
179
+ measuredEdits: number;
180
+ /** Sum over measured edits of the chance the verdict calls one reusable
181
+ * when it has no effect. */
182
+ expectedReusable: number;
183
+ method: string;
184
+ };
185
+ /** Rows in lineage order (depth-first along primary parents): the matrix a
186
+ * genealogy view draws, genes as columns. */
187
+ lineage: EditLineageRow[];
188
+ method: {
189
+ estimator: SearchSourceRef;
190
+ credit: string;
191
+ verdict: string;
192
+ interaction: string;
193
+ multiplicity: string;
194
+ /** The known bias of a lineage contrast in a search. */
195
+ selectionBias: string;
196
+ };
197
+ }
198
+ /** The signal: independent edits `pairedDeltaTest` finds improve the
199
+ * objective, null below 6 units on every gene. */
200
+ interface EditCreditSignal extends LensSignal<number | null> {
201
+ /** How the value was computed, or why it is null. */
202
+ basis: string;
203
+ /** The first gene of each reusable edit, best first: the hunks a proposer
204
+ * reuses or a skill extraction starts from. */
205
+ top: string[];
206
+ }
207
+ type EditCreditResult = LensResult<EditCreditData, number | null> & {
208
+ signal: EditCreditSignal;
209
+ };
210
+ /**
211
+ * The edit-credit lens. Pure: the result depends only on `state` and what
212
+ * `readArtifact` returns for its references.
213
+ */
214
+ declare function editCredit(state: SearchStateView, options: EditCreditOptions): EditCreditResult;
215
+ /** The lens as compact text: what `agent-eval search show --edit-credit`
216
+ * prints and a proposer can read. */
217
+ declare function editCreditText(result: EditCreditResult, options?: {
218
+ limit?: number;
219
+ }): string;
220
+ //#endregion
221
+ //#region src/search/lenses/front.d.ts
222
+ interface FrontExtraAxis {
223
+ name: string;
224
+ direction: 'maximize' | 'minimize';
225
+ /** Reads the axis value for one node from the same state the lens holds.
226
+ * Returning a non-finite number excludes the node from this axis's frontier
227
+ * pass the same way an unknown score or cost does. */
228
+ value(state: SearchStateView, nodeId: string): number;
229
+ }
230
+ interface FrontRow {
231
+ nodeId: string;
232
+ /** Mean per-unit score on the ranking split, in the objective's own units;
233
+ * null when the node has no scored cell there. */
234
+ score: number | null;
235
+ knownCostUsd: number;
236
+ /** False when any of the node's cells has unknown-cost attempts: its true
237
+ * cost may be higher than `knownCostUsd`, so it never competes on cost. */
238
+ costKnown: boolean;
239
+ /** True only for a node with a known score and a known cost that no other
240
+ * such node dominates on every declared axis. */
241
+ onFront: boolean;
242
+ }
243
+ interface FrontData {
244
+ split: 'train' | 'selection';
245
+ axes: string[];
246
+ rows: FrontRow[];
247
+ frontierSize: number;
248
+ /** Rows excluded from every frontier pass: unknown score, unknown cost, or
249
+ * a non-finite extra-axis read. */
250
+ excludedCount: number;
251
+ }
252
+ interface FrontOptions {
253
+ split?: 'train' | 'selection';
254
+ axes?: FrontExtraAxis[];
255
+ }
256
+ /** nodeId → 1 on the frontier, 0 off it. Every scored node appears; an
257
+ * excluded (unknown-score or unknown-cost) node reads 0, same as a dominated
258
+ * one, because "on the front" is the only claim this signal makes. */
259
+ type FrontSignal = Record<string, number>;
260
+ declare function front(state: SearchStateView, options?: FrontOptions): {
261
+ data: FrontData;
262
+ signal: {
263
+ name: string;
264
+ value: FrontSignal;
265
+ };
266
+ };
267
+ //#endregion
268
+ //#region src/search/lenses/geometry.d.ts
269
+ /** The one number a geometry lens exposes to policies: the shared
270
+ * `LensSignal`, with the noise model and sample it rests on. */
271
+ interface GeometrySignal extends LensSignal<number | null> {
272
+ /** What the value is about when it names one thing, for example the unit
273
+ * `nextUnit` recommends; null otherwise. */
274
+ subject: string | null;
275
+ /** How the value is computed, including its noise model. */
276
+ method: string;
277
+ /** The sample the value rests on, in the unit `method` names. */
278
+ n: number;
279
+ /** Why `value` is null; null when it is not. */
280
+ insufficient: string | null;
281
+ }
282
+ interface GeometryLensResult<TData> extends LensResult<TData, number | null> {
283
+ /** The lens name, for example `landscape`. */
284
+ lens: string;
285
+ searchId: string;
286
+ /** The ledger position the lens read: the head's sequence, or -1 before any entry. */
287
+ sequence: number;
288
+ signal: GeometrySignal;
289
+ }
290
+ /**
291
+ * Nodes whose screen finished, in registration order, root first: the
292
+ * ledger's reading of the kernel's `screened` list. A node counts once it is
293
+ * not decided invalid, has an edge, and every cell it was allocated outside a
294
+ * rung or the claim can no longer run (scored, final, cancelled, or errored
295
+ * with no attempt left). Cells a rung opened later do not un-screen it.
296
+ */
297
+ declare function screenedNodes(state: SearchStateView, options?: {
298
+ maxAttempts?: number;
299
+ }): string[];
300
+ //#endregion
301
+ //#region src/search/lenses/plateau.d.ts
302
+ /** What the plateau reads: a policy view, or the lens's own reading of one. */
303
+ type SearchPlateauView = Pick<SearchPolicyView, 'direction' | 'rootNodeId' | 'screened' | 'complete' | 'unitScores'>;
304
+ interface SearchPlateauOptions {
305
+ /** Accepted nodes the rise is measured across. Default 6. */
306
+ window?: number;
307
+ }
308
+ interface SearchPlateau {
309
+ /** `rise / noise`; null when insufficient. Below 1 the best improvement rose
310
+ * less than one standard error across the window: a plateau. */
311
+ value: number | null;
312
+ window: number;
313
+ /** Screened non-root nodes that dodged no unit and share at least 6 units
314
+ * with the root (the design's `descriptive` threshold), in registration
315
+ * order. Only these can hold the best. */
316
+ accepted: number;
317
+ /** The accepted nodes the window covers, oldest first. */
318
+ windowNodes: string[];
319
+ /** Best improvement over the root after the window minus before it; the
320
+ * root itself is the best before any node, at exactly 0. */
321
+ rise: number | null;
322
+ /** Standard error of the best node's improvement: sqrt(pooled variance / its
323
+ * shared units). */
324
+ noise: number | null;
325
+ best: {
326
+ nodeId: string;
327
+ gain: number;
328
+ pairs: number;
329
+ } | null;
330
+ /** Between-unit variance of per-unit improvements over the root, pooled over
331
+ * every screened complete node with 2 or more shared units. */
332
+ pooledVariance: number | null;
333
+ degreesOfFreedom: number;
334
+ method: string;
335
+ insufficient: string | null;
336
+ }
337
+ /**
338
+ * The plateau score of a search. Nodes are taken in the view's screened
339
+ * order, which is registration order. Insufficient with fewer than `window`
340
+ * accepted nodes, or without a pooled variance above zero.
341
+ */
342
+ declare function searchPlateau(view: SearchPlateauView, options?: SearchPlateauOptions): SearchPlateau;
343
+ interface DraftOnPlateauOptions {
344
+ /** Accepted nodes the plateau's rise is measured across, and expansions
345
+ * between two drafts. Default 6. */
346
+ window?: number;
347
+ /** Draft when the plateau score is below this many standard errors.
348
+ * Default 1: the best improvement rose less than one standard error. */
349
+ below?: number;
350
+ }
351
+ /**
352
+ * `base`, except that on a plateau it drafts: it proposes a fresh artifact
353
+ * (operator `draft`, anchored on the root) instead of refining one. The
354
+ * plateau is the `landscape` lens's signal (`searchPlateau` on this view):
355
+ * how many standard errors the best improvement over the root rose across the
356
+ * last `window` accepted nodes. A draft needs a measured plateau (at least
357
+ * `window` accepted nodes and a pooled variance) and an expansion count that
358
+ * is a multiple of `window`, so `base` expands at least `window − 1` times
359
+ * between drafts and each draft's lineage gets a chance to lift the plateau.
360
+ * Nodes still screening do not hold a draft back: the kernel expands while
361
+ * its screening backlog is below twice the lane capacity, so under a full
362
+ * pipeline some node is always screening, and the plateau reads only nodes
363
+ * whose screen finished. The leader and patience are `base`'s.
364
+ *
365
+ * This is AIDE's draft trigger driven by measured progress instead of a fixed
366
+ * count; `draftOnPlateau(aide(...))` adds it to `aide`'s own drafts. A draft
367
+ * pays off only when `base` then expands drafts that trail the leader:
368
+ * `incumbent` expands only its leader, so a draft that starts below it is
369
+ * never refined.
370
+ */
371
+ declare function draftOnPlateau(base: SearchPolicy, options?: DraftOnPlateauOptions): SearchPolicy;
372
+ //#endregion
373
+ //#region src/search/lenses/landscape.d.ts
374
+ /**
375
+ * How the lens measures the distance between two nodes' profiles.
376
+ *
377
+ * - `lineage`: edits along the lineage graph, one per recorded improve,
378
+ * debug or merge edge between nodes of this search. A draft edge is not an
379
+ * edit (the draft is written afresh), so a draft's lineage is unreachable
380
+ * by this distance and unplaced, never guessed; `surfaceTextEdits` places it.
381
+ * - `distance`: any symmetric distance; null when it cannot be measured.
382
+ * - `vector`: a vector per node, for example a model embedding of the
383
+ * profile; nodes are compared by Euclidean distance.
384
+ */
385
+ type LandscapeEmbedding = {
386
+ kind: 'lineage';
387
+ name: string;
388
+ method: string;
389
+ } | {
390
+ kind: 'distance';
391
+ name: string;
392
+ method: string;
393
+ distance(a: SearchNode, b: SearchNode): number | null;
394
+ } | {
395
+ kind: 'vector';
396
+ name: string;
397
+ method: string;
398
+ vector(node: SearchNode): readonly number[] | null;
399
+ };
400
+ /** The default: edits recorded between two profiles along the lineage. */
401
+ declare function lineageEdits(): LandscapeEmbedding;
402
+ /** Surfaces whose content digests differ: the edit distance between two
403
+ * profiles at the granularity of their declared surfaces. */
404
+ declare function surfaceDigestEdits(): LandscapeEmbedding;
405
+ /**
406
+ * Line edits between the surfaces' texts: for each declared surface, the
407
+ * fewest line insertions and deletions that turn one text into the other
408
+ * (Myers, 1986), summed over surfaces. `read` returns a surface's content:
409
+ * a string, parsed JSON (flattened with `profileTextLines`), or null when it
410
+ * cannot be read, which leaves every distance of that node unknown. The lens
411
+ * stays pure; the caller owns the I/O and its verification.
412
+ */
413
+ declare function surfaceTextEdits(read: (surface: SearchCandidateSurface) => unknown): LandscapeEmbedding;
414
+ /** A caller's vector per node, for example a model embedding of its profile. */
415
+ declare function vectorEmbedding(name: string, vector: (node: SearchNode) => readonly number[] | null): LandscapeEmbedding;
416
+ /**
417
+ * JSON as lines a diff can count: one line per scalar leaf, `path=value`, and
418
+ * one line per line of a string, so an edit inside a long prompt counts the
419
+ * lines it changed rather than the whole prompt. Object keys are visited in
420
+ * code-unit order.
421
+ */
422
+ declare function profileTextLines(value: unknown, path?: string): string[];
423
+ /** Fewest line insertions plus deletions turning `a` into `b` (Myers' O(ND)
424
+ * greedy algorithm, which is fast when the texts are close). */
425
+ declare function lineEditDistance(a: readonly string[], b: readonly string[]): number;
426
+ interface LandscapeOptions {
427
+ /** The split scores come from. Default: the ranked split. */
428
+ split?: 'selection' | 'train';
429
+ /** Landmarks of the scaling. Default 32; a search with fewer nodes scales exactly. */
430
+ landmarks?: number;
431
+ /** Grid columns and rows. Default 24. */
432
+ grid?: number;
433
+ /** Scored nodes the surface is fitted on, evenly spaced in registration
434
+ * order with the root and the best node always in. Default 400. */
435
+ surfaceNodes?: number;
436
+ /** Screened nodes the plateau reads. Default 6. */
437
+ window?: number;
438
+ /** Attempts the kernel gives an errored cell. Default 3. */
439
+ maxAttempts?: number;
440
+ }
441
+ interface LandscapeNode {
442
+ nodeId: string;
443
+ ordinal: number;
444
+ depth: number | null;
445
+ status: SearchNodeStatus | null;
446
+ /** The operator of the node's first edge. */
447
+ operator: string | null;
448
+ /** Null when the node could not be placed; `unplaced` says why. */
449
+ x: number | null;
450
+ y: number | null;
451
+ unplaced: string | null;
452
+ /** Improvement over the root on shared units, larger is better; null
453
+ * without a shared unit. */
454
+ score: number | null;
455
+ /** Standard error of `score`: sqrt(pooled variance / pairs); 0 for the
456
+ * root, null when the pooled variance is unknown. */
457
+ standardError: number | null;
458
+ pairs: number;
459
+ method: SearchEstimateMethod;
460
+ /** Index into `basins.peaks`; null when unplaced, unscored, or when basins
461
+ * are insufficient. */
462
+ basin: number | null;
463
+ }
464
+ interface LandscapeGrid {
465
+ columns: number;
466
+ rows: number;
467
+ x: [number, number];
468
+ y: [number, number];
469
+ /** Posterior mean of the improvement over the root, `values[row][column]`;
470
+ * row 0 is the lowest y. Null where the nodes explain less than half the
471
+ * prior variance: the surface there is unknown, not flat. */
472
+ values: (number | null)[][];
473
+ /** Posterior standard deviation at each cell, supported or not. */
474
+ sd: number[][];
475
+ supportedCells: number;
476
+ /** The kriging model: a constant mean, a squared-exponential covariance of
477
+ * `priorVariance` and `lengthScale` (in coordinate units), and each node's
478
+ * own noise variance, pooled variance over its shared units. */
479
+ model: {
480
+ mean: number;
481
+ priorVariance: number;
482
+ lengthScale: number;
483
+ /** Log marginal likelihood of the chosen length scale. */
484
+ logLikelihood: number;
485
+ /** Log marginal likelihood of the same scores with no spatial
486
+ * correlation; the surface is drawn only when `logLikelihood` beats it
487
+ * by 1 or more. */
488
+ independentLogLikelihood: number;
489
+ /** Nodes the surface was fitted on (at most `surfaceNodes`). */
490
+ fitNodes: number;
491
+ };
492
+ method: string;
493
+ }
494
+ interface LandscapeBasin {
495
+ /** The basin's best node: the peak of its component. */
496
+ peak: {
497
+ nodeId: string;
498
+ x: number;
499
+ y: number;
500
+ score: number;
501
+ pairs: number;
502
+ };
503
+ /** How far the peak stands above the saddle node where its component first
504
+ * met a higher one; null for the highest peak and for a component that
505
+ * never met a higher one (a separate region of the graph). */
506
+ persistence: number | null;
507
+ /** The persistence this peak needed: `z` standard errors of the difference
508
+ * between the peak's and the saddle's scores. Null for the highest peak. */
509
+ threshold: number | null;
510
+ saddle: string | null;
511
+ nodes: number;
512
+ }
513
+ interface LandscapeData {
514
+ split: 'selection' | 'train';
515
+ direction: 'maximize' | 'minimize';
516
+ embedding: {
517
+ name: string;
518
+ method: string;
519
+ landmarks: number;
520
+ /** Median and largest distance between two landmarks, in the embedding's
521
+ * own unit (for example lines edited): how far apart the profiles are. */
522
+ landmarkDistance: {
523
+ median: number;
524
+ max: number;
525
+ } | null;
526
+ /** Of the scaled landmark matrix, largest first. */
527
+ eigenvalues: number[];
528
+ /** Share of the positive eigenvalue mass the two axes hold. */
529
+ explained: number | null;
530
+ /** Share of the absolute eigenvalue mass that is negative: how far the
531
+ * distance departs from a Euclidean one. */
532
+ negativeMass: number | null;
533
+ placed: number;
534
+ unplaced: number;
535
+ };
536
+ nodes: LandscapeNode[];
537
+ /** Parent-to-child segments of every node's lineage. */
538
+ lineage: Array<{
539
+ parent: string;
540
+ child: string;
541
+ operator: string;
542
+ }>;
543
+ grid: LandscapeGrid | null;
544
+ gridInsufficient: string | null;
545
+ basins: {
546
+ count: number | null;
547
+ /** Neighbours each node joins in the graph the basins are read on. */
548
+ neighbours: number;
549
+ /** Nodes with no higher neighbour: the peaks that could each survive. */
550
+ localMaxima: number;
551
+ /** Standard errors a peak must clear its saddle by: the Bonferroni
552
+ * normal quantile over `localMaxima − 1` tests at 5%. */
553
+ z: number | null;
554
+ /** Nodes the graph holds (at most 2000 plus the 100 best). */
555
+ graphNodes: number;
556
+ /** MDS axes the graph's distances use, and their share of the positive
557
+ * eigenvalue mass: the neighbours are near in this space. */
558
+ graphAxes: number;
559
+ graphExplained: number | null;
560
+ method: string;
561
+ insufficient: string | null;
562
+ peaks: LandscapeBasin[];
563
+ };
564
+ plateau: SearchPlateau;
565
+ }
566
+ /**
567
+ * The landscape of a search: every node placed by `embed`, the interpolated
568
+ * score over the placement, the basins of that surface, and the plateau
569
+ * signal. Pure: it reads the state and calls `embed`.
570
+ */
571
+ declare function landscape(state: SearchStateView, embed?: LandscapeEmbedding, options?: LandscapeOptions): GeometryLensResult<LandscapeData>;
572
+ /**
573
+ * The symmetric k-nearest-neighbour graph of points in any dimension: each
574
+ * point joins its k nearest (ties by index) and every edge is kept in both
575
+ * directions. Brute force, so callers keep n in the low thousands.
576
+ */
577
+ declare function nearestNeighbours(points: readonly (readonly number[])[], k: number): number[][];
578
+ /** The landscape as text for a terminal or a proposer's context: the same
579
+ * numbers the view draws, with a coarse shaded map. */
580
+ declare function formatLandscape(lens: GeometryLensResult<LandscapeData>): string;
581
+ //#endregion
582
+ //#region src/search/lenses/meta-search.d.ts
583
+ /** The configuration that ran a search, as its ledger records it. */
584
+ interface SearchPolicyGenome {
585
+ /** `policy.expansion`: the policy's name with its parameters. A parameter
586
+ * equal to the search's own seed (`seed=<n>`) reads `seed=<search>`: the
587
+ * seed varies per search and is not a configuration choice. */
588
+ expansion: string;
589
+ /** `policy.allocation`: the allocator's name with its rung sizes. */
590
+ allocation: string;
591
+ budget: {
592
+ maxUsd: number | null;
593
+ maxCells: number | null;
594
+ maxNodes: number | null;
595
+ maxConcurrency: number | null;
596
+ reservedClaimUsd: number;
597
+ };
598
+ /** Every proposer a non-seed edge names, in canonical order. Unknown when
599
+ * the search recorded no proposal, so its proposer cannot be read. */
600
+ proposers: Array<{
601
+ kind: SearchProposerKind;
602
+ name: string;
603
+ source: SearchSourceRef;
604
+ }> | {
605
+ unknown: string;
606
+ };
607
+ /** What ran the candidate-generation operations (a proposer's model, or
608
+ * deterministic code), in canonical order; unknown with no such operation. */
609
+ proposerExecution: Array<{
610
+ kind: 'model';
611
+ model: SearchModelIdentity;
612
+ } | {
613
+ kind: 'deterministic';
614
+ source: SearchSourceRef;
615
+ }> | {
616
+ unknown: string;
617
+ };
618
+ }
619
+ /** Why a search has no lift to score. */
620
+ type MetaSearchUnscoredReason = 'open' | 'no-claim' | 'claim-mismatch' | 'test-cannot-resolve' | 'no-valid-finalist' | 'insufficient';
621
+ interface MetaSearchSpend {
622
+ knownUsd: number;
623
+ /** Proven lower bounds of unknown costs. */
624
+ floorUsd: number;
625
+ /** Cells and operations whose cost is unknown. */
626
+ unknownCost: number;
627
+ }
628
+ /** A search's lift per dollar: a value, a bound when some cost is only a
629
+ * floor, or unknown. */
630
+ type MetaSearchLiftPerUsd = {
631
+ status: 'known';
632
+ value: number;
633
+ /** The lift's interval divided by the known spend, which is exact. */
634
+ interval: [number, number] | null;
635
+ } | {
636
+ status: 'bound';
637
+ /** The lift divided by the committed spend, a lower bound on the true
638
+ * spend: the true value lies at or below it for a gain and at or above
639
+ * it for a loss. */
640
+ value: number;
641
+ bound: 'at-most' | 'at-least';
642
+ reason: string;
643
+ } | {
644
+ status: 'unknown';
645
+ reason: string;
646
+ };
647
+ type MetaSearchScore = {
648
+ status: 'scored';
649
+ decision: 'ship' | 'hold';
650
+ /** The node whose held-out lift this is. */
651
+ nodeId: string;
652
+ /** The node against the root on the test split. */
653
+ estimate: NodeEstimate;
654
+ /** `estimate.delta` oriented so a gain is positive, in the metric's units. */
655
+ lift: number;
656
+ /** `estimate.interval`, oriented the same way; null below 6 units. */
657
+ liftInterval: [number, number] | null;
658
+ spend: MetaSearchSpend;
659
+ liftPerUsd: MetaSearchLiftPerUsd;
660
+ } | {
661
+ status: 'unscored';
662
+ decision: SearchClaim['decision'] | null;
663
+ reason: MetaSearchUnscoredReason;
664
+ detail: string;
665
+ spend: MetaSearchSpend;
666
+ };
667
+ /** How a search relates to its parent in the forest. */
668
+ type MetaSearchParent = {
669
+ relation: 'derived';
670
+ searchId: string;
671
+ /** The parent's node this search started from. */
672
+ nodeId: string;
673
+ /** The parent is among the searches the lens read. */
674
+ present: boolean;
675
+ } | {
676
+ relation: 'contained';
677
+ searchId: string;
678
+ cellId: string;
679
+ attempt: number;
680
+ /** The outer node whose cell ran this search; null when the outer
681
+ * search was not read. */
682
+ nodeId: string | null;
683
+ present: boolean;
684
+ };
685
+ interface MetaSearchEntry {
686
+ searchId: string;
687
+ subject: string;
688
+ objective: {
689
+ metric: string;
690
+ direction: 'maximize' | 'minimize';
691
+ };
692
+ /** `subject · metric (direction)`: searches are compared only within one. */
693
+ objectiveKey: string;
694
+ status: 'open' | 'closed';
695
+ closeReason: SearchCloseReason | null;
696
+ genome: SearchPolicyGenome;
697
+ genomeDigest: SearchLedgerHash;
698
+ seed: number;
699
+ rootArtifactDigest: string | null;
700
+ nodes: number;
701
+ cells: {
702
+ settled: number;
703
+ test: number;
704
+ };
705
+ claim: {
706
+ decision: SearchClaim['decision'];
707
+ selected: string | null;
708
+ verification: 'verified' | 'mismatch' | 'unknown';
709
+ reason: string;
710
+ } | null;
711
+ score: MetaSearchScore;
712
+ parent: MetaSearchParent | null;
713
+ children: string[];
714
+ /** Edges from the forest's root; 0 for a root. */
715
+ depth: number;
716
+ /** The search's own tree, for a glyph: `[nodeId, primaryParentId, status]`
717
+ * in registration order, the first `glyphNodes`. */
718
+ glyph: {
719
+ nodes: Array<[string, string | null, string | null]>;
720
+ omitted: number;
721
+ };
722
+ }
723
+ /** A configuration's lift per known dollar across its scored searches. */
724
+ interface MetaSearchConfigurationEstimate {
725
+ /** `searches`: the scored searches are the units. `test-units`: one scored
726
+ * search, so its own test units are. */
727
+ basis: 'searches' | 'test-units';
728
+ n: number;
729
+ value: number | null;
730
+ method: SearchEstimateMethod;
731
+ interval: [number, number] | null;
732
+ /** How the interval was computed; null without one. */
733
+ intervalMethod: 'percentile-bootstrap-of-mean' | 'paired-delta-test-over-usd' | null;
734
+ }
735
+ interface MetaSearchConfiguration {
736
+ genomeDigest: SearchLedgerHash;
737
+ objectiveKey: string;
738
+ genome: SearchPolicyGenome;
739
+ searches: string[];
740
+ decisions: {
741
+ ship: number;
742
+ hold: number;
743
+ 'test-cannot-resolve': number;
744
+ none: number;
745
+ };
746
+ /** Searches with a known lift per dollar. */
747
+ scored: number;
748
+ /** Searches whose lift per dollar is a bound. */
749
+ bounded: number;
750
+ unscored: Partial<Record<MetaSearchUnscoredReason, number>>;
751
+ estimate: MetaSearchConfigurationEstimate;
752
+ /** Outer-search nodes whose cells ran this configuration's searches, with
753
+ * the outer node's parent configuration and its paired estimate against it
754
+ * on the outer search's ranking split. */
755
+ outerNodes: Array<{
756
+ searchId: string;
757
+ nodeId: string;
758
+ parentNodeId: string | null;
759
+ parentGenomeDigest: SearchLedgerHash | null;
760
+ againstParent: NodeEstimate | null;
761
+ }>;
762
+ }
763
+ interface MetaSearchData {
764
+ searches: MetaSearchEntry[];
765
+ roots: string[];
766
+ /** Best first: by estimate, then configurations without one. */
767
+ configurations: MetaSearchConfiguration[];
768
+ objectives: string[];
769
+ /** The objective the signal ranks within; null when none could be chosen. */
770
+ signalObjective: string | null;
771
+ }
772
+ /** The signal: the configuration with the largest estimated lift per known
773
+ * dollar within one objective, with its interval, its method and its n. */
774
+ interface BestPolicyConfiguration {
775
+ /** Lift per known dollar of the best configuration; null when none has one. */
776
+ liftPerUsd: number | null;
777
+ objectiveKey: string | null;
778
+ genomeDigest: SearchLedgerHash | null;
779
+ genome: SearchPolicyGenome | null;
780
+ interval: [number, number] | null;
781
+ method: SearchEstimateMethod | null;
782
+ intervalMethod: MetaSearchConfigurationEstimate['intervalMethod'];
783
+ basis: MetaSearchConfigurationEstimate['basis'] | null;
784
+ n: number;
785
+ /** The configuration's searches, and how many of them have a known lift
786
+ * per dollar: the rest are unscored or bounded, never counted as 0. */
787
+ searches: number;
788
+ scored: number;
789
+ /** An outer-search node whose artifact runs this configuration, when an
790
+ * outer search ran it: the runnable configuration a caller derives the next
791
+ * search from. Null for a configuration only free-standing searches ran. */
792
+ outerNode: {
793
+ searchId: string;
794
+ nodeId: string;
795
+ } | null;
796
+ /** Why the value is what it is, including why it is null. */
797
+ reason: string;
798
+ }
799
+ interface MetaSearchOptions {
800
+ /** Nodes of each search's own tree carried for its glyph. Default 64. */
801
+ glyphNodes?: number;
802
+ /** The objective key the signal ranks within. Default: the one objective
803
+ * whose searches have a known lift per dollar; with several, the signal is
804
+ * null until one is named. */
805
+ objective?: string;
806
+ }
807
+ /** The signal's name, as a policy or a view reads it. */
808
+ declare const META_SEARCH_SIGNAL = "metaSearch.bestPolicyConfiguration";
809
+ /** The per-search score `metaSearchScore` computes. An outer search names it
810
+ * as its objective's judge. */
811
+ declare const META_SEARCH_SCORE_SOURCE: SearchSourceRef;
812
+ /**
813
+ * The genome of a search: the configuration its ledger records. Declared
814
+ * parts come from the header; the proposer comes from what the edges and
815
+ * candidate-generation operations name, because the header declares none.
816
+ */
817
+ declare function searchPolicyGenome(state: SearchStateView): SearchPolicyGenome;
818
+ /**
819
+ * A search's held-out lift per known dollar, from its claim and its test
820
+ * cells. Pure; it reads the test split, so a policy view (which holds no test
821
+ * cells) cannot call it; an outer search reads it from a closed inner search.
822
+ */
823
+ declare function metaSearchScore(state: SearchStateView): MetaSearchScore;
824
+ /** The lens: every search as a node of a search of searches. */
825
+ declare function metaSearch(searches: readonly SearchStateView[], options?: MetaSearchOptions): LensResult<MetaSearchData, BestPolicyConfiguration>;
826
+ /** `subject · metric (direction)`: the key searches are compared within. */
827
+ declare function objectiveKey(header: NonNullable<SearchStateView['header']>): string;
828
+ interface MetaSearchTextOptions {
829
+ /** Searches listed under each outer node or parent before the rest are
830
+ * counted. Default 5. */
831
+ searchesPerGroup?: number;
832
+ }
833
+ /**
834
+ * The lens as text, for an agent: the signal, every configuration best first
835
+ * with its coverage and interval, and the forest of searches with contained
836
+ * searches grouped under the outer node that ran them. `agent-eval search show
837
+ * --meta` prints it.
838
+ */
839
+ declare function renderMetaSearchText(result: LensResult<MetaSearchData, BestPolicyConfiguration>, options?: MetaSearchTextOptions): string;
840
+ //#endregion
841
+ //#region src/search/lenses/skill-manifold.d.ts
842
+ interface SkillManifoldOptions {
843
+ /** The split scores come from. Default: the ranked split. */
844
+ split?: 'selection' | 'train';
845
+ /** Largest rank the cross-validation tries. Default 4. */
846
+ maxRank?: number;
847
+ /** Cross-validation folds over observed cells. Default 5. */
848
+ folds?: number;
849
+ /** Leaders the signal separates. Default 3, the claim's finalist cap. */
850
+ leaders?: number;
851
+ /** Explicit leaders, for example an allocator's top of a rung. */
852
+ candidates?: readonly string[];
853
+ /** Read only cells settled at or before this ledger sequence, so a caller
854
+ * can re-derive what the lens said at an earlier point of the ledger. */
855
+ asOfSequence?: number;
856
+ /** Ridge penalty on standardized coordinates and loadings. Default 1: the
857
+ * maximum a posteriori fit under standard-normal priors on both, since
858
+ * standardized cells have unit variance. Weaker penalties overfit a search
859
+ * of a few nodes (on a real 9-node ledger, 0.1 made the rank-1 held-out
860
+ * error 3.5 times the rank-0 error). */
861
+ ridge?: number;
862
+ /** Rows the factor fits and the cross-validation read, evenly spaced in
863
+ * registration order; every row is then placed on the fitted loadings.
864
+ * Default 1000. */
865
+ sampleRows?: number;
866
+ /** Unit loadings from an earlier fit over the same units. When given, the
867
+ * lens fits no loadings: it places this search's nodes on them. */
868
+ calibration?: SkillCalibration;
869
+ /** `linear` factors standardized per-unit means; `logistic` fits the
870
+ * two-parameter item-response model to pass counts and needs every cell to
871
+ * score 0 or 1. Default `auto`: logistic when every cell scores 0 or 1. */
872
+ model?: 'auto' | 'linear' | 'logistic';
873
+ /** Also choose `count` units greedily from `among` (default: every
874
+ * modelled unit), updating the leaders' posteriors after each pick, so a
875
+ * batch does not repeat one direction. Returned as `data.batch`. */
876
+ batch?: {
877
+ count: number;
878
+ among?: readonly string[];
879
+ };
880
+ }
881
+ /** Unit loadings a later search can place its nodes on (`skillCalibration`). */
882
+ interface SkillCalibration {
883
+ /** Where the loadings were fitted, for example `searchId@sequence`. */
884
+ source: string;
885
+ /** `identity`: the linear model on standardized means; `logit`: the
886
+ * item-response model on pass counts. */
887
+ link: SkillLink;
888
+ /** Standardization of the linear model: z = (score − center) / scale; 0
889
+ * and 1 under the logit link. */
890
+ center: number;
891
+ scale: number;
892
+ rank: number;
893
+ ridge: number;
894
+ /** Cross-validated squared error of one cell, on the standardized scale;
895
+ * null under the logit link, whose noise is the binomial's. */
896
+ noiseVariance: number | null;
897
+ /** Each unit's intercept on the model's scale and its loading. */
898
+ units: Array<{
899
+ unitId: string;
900
+ bias: number;
901
+ loading: number[];
902
+ }>;
903
+ }
904
+ type SkillLink = 'identity' | 'logit';
905
+ interface SkillManifoldNode {
906
+ nodeId: string;
907
+ ordinal: number;
908
+ status: SearchNodeStatus | null;
909
+ /** Units the node scored among the modelled ones. */
910
+ observed: number;
911
+ /** Standardized coordinates along each axis; larger is better on axis
912
+ * orientation (see `SkillManifoldData.axes`). */
913
+ coordinates: number[];
914
+ /** The model's mean over every modelled unit, in the metric's units. */
915
+ predictedMean: number;
916
+ leader: boolean;
917
+ }
918
+ interface SkillManifoldUnit {
919
+ unitId: string;
920
+ /** Nodes that scored the unit (0 for a calibrated unit this search has not run). */
921
+ observedBy: number;
922
+ /** The unit's mean for a node at the origin, in the metric's units (a pass
923
+ * rate under the logit link). */
924
+ bias: number;
925
+ /** The same intercept on the model's own scale: standardized under the
926
+ * identity link, log-odds under the logit link. */
927
+ intercept: number;
928
+ /** The unit's direction in skill space (standardized, or log-odds per
929
+ * unit of coordinate under the logit link). */
930
+ loading: number[];
931
+ /** Length of `loading`: how strongly the unit separates nodes. */
932
+ strength: number;
933
+ }
934
+ interface SkillManifoldNextUnit {
935
+ unitId: string;
936
+ /** Expected share of the leaders' contrast variance one more cell on this
937
+ * unit, on every leader, removes; averaged over leader pairs. */
938
+ share: number;
939
+ /** Leaders that already scored the unit. */
940
+ measuredBy: number;
941
+ }
942
+ interface SkillManifoldData {
943
+ split: 'selection' | 'train';
944
+ direction: 'maximize' | 'minimize';
945
+ /** `fitted`: loadings fitted on this search; `calibrated`: taken from `source`. */
946
+ mode: 'fitted' | 'calibrated';
947
+ source: string;
948
+ matrix: {
949
+ rows: number;
950
+ units: number;
951
+ /** Observed cells of the modelled matrix (per-unit means). */
952
+ observed: number;
953
+ density: number | null;
954
+ /** Nodes left out: fewer than 2 modelled units (1 with a calibration). */
955
+ excludedNodes: number;
956
+ /** Units left out: scored by fewer than 2 nodes, or absent from the calibration. */
957
+ excludedUnits: number;
958
+ fitRows: number;
959
+ };
960
+ model: {
961
+ method: string;
962
+ link: SkillLink;
963
+ rank: number;
964
+ ridge: number;
965
+ center: number | null;
966
+ scale: number | null;
967
+ iterations: number;
968
+ converged: boolean;
969
+ } | null;
970
+ /** In-sample R² over rank-0 (unit means only), by rank. */
971
+ explained: {
972
+ byRank: Array<{
973
+ rank: number;
974
+ r2: number;
975
+ }>;
976
+ /** Share of the fitted structure each axis carries (its squared singular value). */
977
+ axisShare: number[];
978
+ method: string;
979
+ } | null;
980
+ intrinsicDimension: {
981
+ value: number | null;
982
+ method: string;
983
+ /** Held-out cells per rank. */
984
+ n: number;
985
+ folds: number;
986
+ curve: Array<{
987
+ rank: number;
988
+ error: number;
989
+ standardError: number;
990
+ }>;
991
+ insufficient: string | null;
992
+ };
993
+ /** Axis orientation: a positive coordinate is better on the objective. */
994
+ axes: string;
995
+ noiseVariance: number | null;
996
+ nodes: SkillManifoldNode[];
997
+ units: SkillManifoldUnit[];
998
+ leaders: Array<{
999
+ nodeId: string;
1000
+ predictedMean: number;
1001
+ observed: number;
1002
+ }>;
1003
+ nextUnits: SkillManifoldNextUnit[];
1004
+ /** The greedy batch `options.batch` asked for; null when not asked or
1005
+ * when no unit's information is known. */
1006
+ batch: string[] | null;
1007
+ insufficient: string | null;
1008
+ }
1009
+ /**
1010
+ * The skill manifold of a search at rank `k` (`auto`: the cross-validated
1011
+ * intrinsic dimension, at least 1, and 1 when too few nodes cross-validate).
1012
+ * Pure: it reads the state, and `calibration` when given.
1013
+ */
1014
+ declare function skillManifold(state: SearchStateView, k?: number | 'auto', options?: SkillManifoldOptions): GeometryLensResult<SkillManifoldData>;
1015
+ /** The loadings of a fitted manifold, for a later search over the same units
1016
+ * to place its nodes on. Null unless cross-validation found at least one skill
1017
+ * axis (intrinsic dimension 1 or more), and, for the linear model, measured
1018
+ * the cell noise: loadings of an axis the held-out cells do not support would
1019
+ * steer allocation by noise. */
1020
+ declare function skillCalibration(lens: GeometryLensResult<SkillManifoldData>): SkillCalibration | null;
1021
+ /**
1022
+ * The `asha` extension that adds, at each rung, the units that best separate
1023
+ * the leaders: the greedy `nextUnit` batch from `calibration`'s loadings,
1024
+ * with this search's nodes placed on them from the cells the ledger held when
1025
+ * the rung opened. The leaders are the lens's (the top 3 by predicted mean on
1026
+ * every calibrated unit). Where the lens cannot rank (fewer than 2 leaders,
1027
+ * or no measured noise), `asha` fills the rung from its seeded order.
1028
+ */
1029
+ declare function nextUnitExtension(calibration: SkillCalibration, options?: {
1030
+ leaders?: number;
1031
+ }): SearchUnitExtension;
1032
+ /** The manifold as text for a terminal or a proposer's context. */
1033
+ declare function formatSkillManifold(lens: GeometryLensResult<SkillManifoldData>): string;
1034
+ //#endregion
1035
+ //#region src/search/lenses/task-matrix.d.ts
1036
+ interface TaskMatrixCell {
1037
+ nodeId: string;
1038
+ unitId: string;
1039
+ /** Mean of the node's scored cells on this unit; absent (not zero) when
1040
+ * the node never scored the unit. */
1041
+ mean: number | null;
1042
+ }
1043
+ interface TaskMatrixCluster {
1044
+ /** Stable id: the lexicographically first member. */
1045
+ id: string;
1046
+ members: string[];
1047
+ }
1048
+ interface TaskMatrixSpecialistRow {
1049
+ clusterId: string;
1050
+ unitIds: string[];
1051
+ /** Best node mean minus the mean of node means over the cluster's units,
1052
+ * among nodes that scored at least one of them. Null with fewer than 2
1053
+ * contributing nodes: no spread to measure, never reported as 0. */
1054
+ gain: number | null;
1055
+ nodesContributing: number;
1056
+ }
1057
+ interface TaskMatrixData {
1058
+ split: 'train' | 'selection';
1059
+ nodeIds: string[];
1060
+ unitIds: string[];
1061
+ nodeClusters: TaskMatrixCluster[];
1062
+ unitClusters: TaskMatrixCluster[];
1063
+ cells: TaskMatrixCell[];
1064
+ specialistGain: TaskMatrixSpecialistRow[];
1065
+ }
1066
+ interface TaskMatrixOptions {
1067
+ split?: 'train' | 'selection';
1068
+ }
1069
+ /** unitClusterId → specialist gain; null clusters (fewer than 2 contributing
1070
+ * nodes) are omitted, not zeroed. */
1071
+ type TaskMatrixSignal = Record<string, number>;
1072
+ declare function taskMatrix(state: SearchStateView, options?: TaskMatrixOptions): {
1073
+ data: TaskMatrixData;
1074
+ signal: {
1075
+ name: string;
1076
+ value: TaskMatrixSignal;
1077
+ };
1078
+ };
1079
+ //#endregion
1080
+ //#region src/search/lenses/tree.d.ts
1081
+ interface TreeNode {
1082
+ nodeId: string;
1083
+ status: SearchNodeStatus | null;
1084
+ rung: number | null;
1085
+ /** Edges from the root along primary parents; null when the node's
1086
+ * parents are unknown (an `unknown`-attribution edge, or a derived root). */
1087
+ depth: number | null;
1088
+ cellCount: number;
1089
+ knownCostUsd: number;
1090
+ /** The operator of the edge that registered this node's primary parent;
1091
+ * null for the root and for a node whose parents are unknown. */
1092
+ operator: SearchEdgeOperator | null;
1093
+ children: TreeNode[];
1094
+ }
1095
+ interface TreeData {
1096
+ /** Normally one entry (the search's root). More than one only when a node
1097
+ * has unknown parents (`primaryParentId === null` but it is not the
1098
+ * root): such a node is shown as its own top-level entry rather than
1099
+ * folded under the root it may or may not descend from. */
1100
+ roots: TreeNode[];
1101
+ nodeCount: number;
1102
+ edgeCount: number;
1103
+ }
1104
+ declare function tree(state: SearchStateView): {
1105
+ data: TreeData;
1106
+ signal: {
1107
+ name: string;
1108
+ value: number;
1109
+ };
1110
+ };
1111
+ //#endregion
1112
+ //#region src/search/nested-search.d.ts
1113
+ /** The outer cell attempt an inner search runs as. */
1114
+ type NestedSearchContainment = NonNullable<SearchOpenedEvent['containment']>;
1115
+ /** One inner search to run: a configuration on one outer task. */
1116
+ interface NestedSearchRunInput<TConfig> {
1117
+ config: TConfig;
1118
+ /** Record this as the inner search's `containment`. */
1119
+ containment: NestedSearchContainment;
1120
+ /** The inner search's id, a digest of `containment`: rerunning the same
1121
+ * attempt opens the same ledger, so an inner search resumes rather than
1122
+ * starting again. */
1123
+ searchId: string;
1124
+ task: {
1125
+ taskId: string;
1126
+ unitId: string;
1127
+ split: SearchSplit;
1128
+ rep: number;
1129
+ };
1130
+ signal: AbortSignal;
1131
+ }
1132
+ interface RunNestedSearchOptions<TConfig> extends Omit<RunSearchOptions<TConfig>, 'codec' | 'executor'> {
1133
+ /** How configurations are stored as nodes. Default `searchConfigCodec()`,
1134
+ * for plain JSON configurations. */
1135
+ codec?: SearchArtifactCodec<TConfig>;
1136
+ /** How many inner searches run at once, and what one is expected to cost:
1137
+ * `cellUsd` is the admission rule's prior for one inner search. */
1138
+ lane: SearchLane;
1139
+ /** Run the inner search for one outer cell attempt to its close, recording
1140
+ * `containment` in its header, and return its closed state. */
1141
+ runInner(input: NestedSearchRunInput<TConfig>): Promise<SearchStateView>;
1142
+ /** The closed inner search of an attempt an earlier outer process started,
1143
+ * or null to run it through `runInner`. Default null. */
1144
+ adoptInner?(input: NestedSearchRunInput<TConfig>): Promise<SearchStateView | null>;
1145
+ }
1146
+ /** The deterministic id of the inner search one outer cell attempt runs. */
1147
+ declare function nestedSearchId(containment: NestedSearchContainment): string;
1148
+ /**
1149
+ * The codec for a plain JSON configuration: the node is the configuration's
1150
+ * canonical JSON, and the diff names each top-level key whose value changed.
1151
+ */
1152
+ declare function searchConfigCodec<TConfig>(): SearchArtifactCodec<TConfig>;
1153
+ /**
1154
+ * Run an outer search over search configurations to its close, or continue
1155
+ * one from its ledger. The outer search must maximize (its score is lift per
1156
+ * dollar), its nodes must be `runtime-config` artifacts, and its judge must be
1157
+ * `META_SEARCH_SCORE_SOURCE`.
1158
+ */
1159
+ declare function runNestedSearch<TConfig>(options: RunNestedSearchOptions<TConfig>): Promise<SearchRunResult>;
1160
+ //#endregion
1161
+ export { type BestPolicyConfiguration, type DraftOnPlateauOptions, EDIT_CREDIT_ESTIMATOR, EDIT_CREDIT_SIGNAL, EXPANSION_OPERATORS, type EditCreditData, type EditCreditOptions, type EditCreditResult, type EditCreditSignal, type EditGene, type EditGeneVerdict, type EditInteraction, type EditIntroduction, type EditLineageRow, type EditSkillCandidate, type ExpansionOperator, type FrontData, type FrontExtraAxis, type FrontOptions, type FrontRow, type FrontSignal, type GeometryLensResult, type GeometrySignal, type LandscapeBasin, type LandscapeData, type LandscapeEmbedding, type LandscapeGrid, type LandscapeNode, type LandscapeOptions, type LensResult, type LensSignal, META_SEARCH_SCORE_SOURCE, META_SEARCH_SIGNAL, MIN_OUTCOMES_FOR_WEIGHT, type MetaSearchConfiguration, type MetaSearchConfigurationEstimate, type MetaSearchData, type MetaSearchEntry, type MetaSearchLiftPerUsd, type MetaSearchOptions, type MetaSearchParent, type MetaSearchScore, type MetaSearchSpend, type MetaSearchTextOptions, type MetaSearchUnscoredReason, type NestedSearchContainment, type NestedSearchRunInput, type OperatorOutcomeCounts, type OperatorYieldData, type OperatorYieldOptions, type OperatorYieldRow, type OperatorYieldSignal, type RunNestedSearchOptions, type SampleSummary, type SearchPlateau, type SearchPlateauOptions, type SearchPlateauView, type SearchPolicyGenome, type SkillCalibration, type SkillManifoldData, type SkillManifoldNextUnit, type SkillManifoldNode, type SkillManifoldOptions, type SkillManifoldUnit, type TaskMatrixCell, type TaskMatrixCluster, type TaskMatrixData, type TaskMatrixOptions, type TaskMatrixSignal, type TaskMatrixSpecialistRow, type TreeData, type TreeNode, draftOnPlateau, editCredit, editCreditText, formatLandscape, formatSkillManifold, front, landscape, lineEditDistance, lineageEdits, metaSearch, metaSearchScore, nearestNeighbours, nestedSearchId, nextUnitExtension, objectiveKey, operatorYield, profileTextLines, rankingSplit, renderMetaSearchText, runNestedSearch, screenedNodes, searchConfigCodec, searchPlateau, searchPolicyGenome, skillCalibration, skillManifold, summarizeSamples, surfaceDigestEdits, surfaceTextEdits, taskMatrix, tree, vectorEmbedding };
1162
+ //# sourceMappingURL=index.d.ts.map