@evomap/evolver-core 2.0.0-beta.19 → 2.0.0-beta.22
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/assets/gep/genes.jsonl +5 -5
- package/dist/algo/bans.d.ts +10 -1
- package/dist/algo/bans.js +56 -6
- package/dist/algo/candidateAssembly.d.ts +25 -2
- package/dist/algo/candidateAssembly.js +143 -20
- package/dist/algo/capabilityCandidates.js +10 -0
- package/dist/algo/cycleEngine.d.ts +40 -5
- package/dist/algo/cycleEngine.js +277 -37
- package/dist/algo/evolutionEvent.d.ts +26 -0
- package/dist/algo/evolutionEvent.js +32 -0
- package/dist/algo/exploration.d.ts +7 -0
- package/dist/algo/exploration.js +16 -3
- package/dist/algo/geneHealth.d.ts +34 -1
- package/dist/algo/geneHealth.js +42 -0
- package/dist/algo/geneIntake.d.ts +46 -1
- package/dist/algo/geneIntake.js +121 -10
- package/dist/algo/geneSelection.d.ts +115 -6
- package/dist/algo/geneSelection.js +459 -32
- package/dist/algo/index.d.ts +4 -1
- package/dist/algo/index.js +4 -1
- package/dist/algo/kautoProjection.d.ts +41 -0
- package/dist/algo/kautoProjection.js +95 -0
- package/dist/algo/kautoValidator.d.ts +68 -0
- package/dist/algo/kautoValidator.js +256 -0
- package/dist/algo/orchestrator.d.ts +14 -1
- package/dist/algo/orchestrator.js +9 -2
- package/dist/algo/solidify.d.ts +11 -2
- package/dist/algo/solidify.js +37 -7
- package/dist/algo/ucb1.d.ts +53 -0
- package/dist/algo/ucb1.js +156 -0
- package/dist/assetrepair/hubRejection.d.ts +12 -0
- package/dist/assetrepair/hubRejection.js +109 -0
- package/dist/assetrepair/index.d.ts +2 -0
- package/dist/assetrepair/index.js +2 -0
- package/dist/assetrepair/repair.d.ts +33 -0
- package/dist/assetrepair/repair.js +155 -0
- package/dist/assetstore/assetSidecarRecords.js +5 -1
- package/dist/assetstore/assetStoreHealth.d.ts +2 -3
- package/dist/assetstore/assetStoreHealth.js +4 -10
- package/dist/assetstore/foreignJsonlSource.d.ts +48 -0
- package/dist/assetstore/foreignJsonlSource.js +150 -0
- package/dist/assetstore/index.d.ts +3 -0
- package/dist/assetstore/index.js +3 -0
- package/dist/assetstore/learningHistory.js +3 -3
- package/dist/assetstore/localAssetStoreSnapshot.d.ts +51 -0
- package/dist/assetstore/localAssetStoreSnapshot.js +329 -0
- package/dist/assetstore/localJsonl.d.ts +8 -0
- package/dist/assetstore/localJsonl.js +128 -3
- package/dist/assetstore/provenance.d.ts +38 -3
- package/dist/assetstore/provenance.js +103 -45
- package/dist/assetstore/provider.d.ts +4 -0
- package/dist/assetstore/reviewFilter.d.ts +19 -1
- package/dist/assetstore/reviewFilter.js +36 -0
- package/dist/assetstore/unionReadStore.d.ts +25 -0
- package/dist/assetstore/unionReadStore.js +119 -0
- package/dist/benchmark/antiGeneBenchmark.d.ts +2 -0
- package/dist/benchmark/antiGeneBenchmark.js +4 -3
- package/dist/benchmark/antiGeneRollout.d.ts +2 -0
- package/dist/benchmark/antiGeneRollout.js +4 -3
- package/dist/benchmark/index.d.ts +2 -1
- package/dist/benchmark/index.js +2 -1
- package/dist/benchmark/selectionFlatAbstention.d.ts +152 -0
- package/dist/benchmark/selectionFlatAbstention.js +481 -0
- package/dist/bootstrap/envFingerprint.d.ts +9 -0
- package/dist/bootstrap/envFingerprint.js +5 -0
- package/dist/bootstrap/index.d.ts +2 -1
- package/dist/bootstrap/index.js +2 -1
- package/dist/bootstrap/lifecycleBootstrap.d.ts +111 -0
- package/dist/bootstrap/lifecycleBootstrap.js +433 -0
- package/dist/bootstrap/v1EnvCompat.d.ts +3 -0
- package/dist/bootstrap/v1EnvCompat.js +48 -1
- package/dist/events/eventArchive.d.ts +2 -0
- package/dist/events/eventArchive.js +13 -3
- package/dist/events/eventSchema.d.ts +7 -7
- package/dist/events/eventStore.d.ts +2 -0
- package/dist/events/eventStore.js +5 -1
- package/dist/events/ingest.d.ts +2 -1
- package/dist/events/ingest.js +6 -0
- package/dist/exec/autoExec.d.ts +30 -3
- package/dist/exec/autoExec.js +294 -29
- package/dist/exec/autonomousCycle.d.ts +7 -0
- package/dist/exec/autonomousCycle.js +2 -0
- package/dist/exec/claudeBridge.d.ts +28 -6
- package/dist/exec/claudeBridge.js +411 -258
- package/dist/exec/executionBinding.d.ts +414 -0
- package/dist/exec/executionBinding.js +588 -0
- package/dist/exec/index.d.ts +1 -0
- package/dist/exec/index.js +1 -0
- package/dist/exec/proofOfWork.d.ts +1 -1
- package/dist/exec/proofOfWork.js +2 -2
- package/dist/exec/runnerRegistry.d.ts +5 -0
- package/dist/exec/runnerRegistry.js +54 -14
- package/dist/hub/capability.d.ts +40 -1
- package/dist/hub/conversationDistiller.d.ts +19 -0
- package/dist/hub/conversationDistiller.js +115 -37
- package/dist/hub/fake.d.ts +1 -0
- package/dist/hub/fake.js +1 -0
- package/dist/hub/index.d.ts +1 -0
- package/dist/hub/index.js +1 -0
- package/dist/hub/recipeCompose.d.ts +27 -0
- package/dist/hub/recipeCompose.js +90 -0
- package/dist/hub/sanitize.js +119 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/mailbox/ipcServer.d.ts +2 -0
- package/dist/mailbox/ipcServer.js +20 -0
- package/dist/mailbox/store.d.ts +52 -2
- package/dist/mailbox/store.js +546 -81
- package/dist/modelCompatibility.d.ts +164 -0
- package/dist/modelCompatibility.js +309 -0
- package/dist/observers/valueDigestObserver.d.ts +9 -0
- package/dist/observers/valueDigestObserver.js +35 -2
- package/dist/ops/cleanup.js +1 -1
- package/dist/ops/evolutionGraphProjection.d.ts +20 -0
- package/dist/ops/evolutionGraphProjection.js +315 -0
- package/dist/ops/index.d.ts +2 -1
- package/dist/ops/index.js +2 -1
- package/dist/ops/selfUpdate.d.ts +8 -0
- package/dist/ops/selfUpdate.js +24 -8
- package/dist/ops/valueOutreach.d.ts +3 -1
- package/dist/ops/valueOutreach.js +5 -1
- package/dist/personality/schema.d.ts +18 -18
- package/dist/schema/evolutionGraph.d.ts +784 -0
- package/dist/schema/evolutionGraph.js +187 -0
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.js +1 -0
- package/dist/schema/proofOfWork.d.ts +125 -6
- package/dist/schema/proofOfWork.js +102 -4
- package/dist/shadow/shadowHub.js +1 -0
- package/dist/signals/expand.d.ts +15 -1
- package/dist/signals/expand.js +148 -0
- package/dist/signals/index.d.ts +3 -1
- package/dist/signals/index.js +3 -1
- package/dist/signals/scopeVocabulary.d.ts +75 -0
- package/dist/signals/scopeVocabulary.js +91 -0
- package/dist/signals/taskDomain.d.ts +22 -0
- package/dist/signals/taskDomain.js +43 -0
- package/dist/trace/learningTrace.d.ts +7 -0
- package/dist/trace/learningTrace.js +22 -0
- package/dist/trace/trajectory.d.ts +8 -0
- package/dist/trace/trajectory.js +14 -2
- package/dist/util/fileLock.d.ts +92 -5
- package/dist/util/fileLock.js +809 -70
- package/dist/util/index.d.ts +2 -1
- package/dist/util/index.js +1 -1
- package/dist/verify/index.d.ts +2 -1
- package/dist/verify/index.js +1 -1
- package/dist/verify/sandboxRunner.d.ts +2 -0
- package/dist/verify/sandboxRunner.js +154 -10
- package/dist/verify/sandboxedValidation.d.ts +7 -2
- package/dist/verify/sandboxedValidation.js +102 -24
- package/dist/verify/validation.d.ts +24 -3
- package/dist/verify/validation.js +141 -24
- package/dist/wire/geneHints.d.ts +88 -16
- package/dist/wire/geneHints.js +124 -15
- package/dist/wire/index.d.ts +8 -3
- package/dist/wire/index.js +2 -2
- package/dist/wire/schemaGate.d.ts +21 -0
- package/dist/wire/schemaGate.js +119 -10
- package/package.json +5 -4
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Read-union over one writable pool plus any number of read-only ones.
|
|
2
|
+
//
|
|
3
|
+
// Why a provider and not a helper: every evidence consumer already takes an AssetStoreProvider and calls
|
|
4
|
+
// `search`/`list` on it — aggregateLearningHistory, assessGenePublishEvidence, candidateAssembly,
|
|
5
|
+
// probationWouldPromote. Widening what they can see by threading a second store through each of them
|
|
6
|
+
// would fork four call chains and leave the next consumer to remember. Composing at the provider seam
|
|
7
|
+
// instead means they are untouched: whoever builds the store decides how wide the evidence pool is.
|
|
8
|
+
//
|
|
9
|
+
// Writes go to the primary and ONLY the primary. Reads merge, deduplicating by asset_id — records are
|
|
10
|
+
// content-addressed, so the same asset present in two pools is the same asset, and primary wins so a
|
|
11
|
+
// locally-verified record is never shadowed by a foreign copy.
|
|
12
|
+
const DEFAULT_LIMIT = 1000;
|
|
13
|
+
/**
|
|
14
|
+
* Take from the queues one at a time in source order until `limit` is reached.
|
|
15
|
+
*
|
|
16
|
+
* Concatenating instead would let a mature primary fill every slot on its own — at the ~1000-record
|
|
17
|
+
* limits the real callers pass (candidateAssembly, recall, reviewFilter), a local pool that size returns
|
|
18
|
+
* ZERO foreign records and the union silently degrades back to the single-store blind spot it exists to
|
|
19
|
+
* fix. Interleaving also refills: a source that runs out yields its remaining slots to the others, so a
|
|
20
|
+
* small foreign pool never costs the result its cap.
|
|
21
|
+
*/
|
|
22
|
+
function interleave(queues, limit) {
|
|
23
|
+
const out = [];
|
|
24
|
+
for (let cursor = 0; out.length < limit; cursor += 1) {
|
|
25
|
+
let advanced = false;
|
|
26
|
+
for (const queue of queues) {
|
|
27
|
+
const record = queue[cursor];
|
|
28
|
+
if (record === undefined)
|
|
29
|
+
continue;
|
|
30
|
+
advanced = true;
|
|
31
|
+
out.push(record);
|
|
32
|
+
if (out.length >= limit)
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
if (!advanced)
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
export class UnionReadStore {
|
|
41
|
+
primary;
|
|
42
|
+
readOnly;
|
|
43
|
+
// Mirrored as assigned-in-constructor properties rather than plain methods on purpose: the optional
|
|
44
|
+
// write capabilities are feature-DETECTED by callers (`supportsAtomicConditionalPut`, and
|
|
45
|
+
// `ingestUnverified`'s `putFrozen` probe). A method declared on the class is always present, so a
|
|
46
|
+
// union wrapping a primary that lacks the capability would answer "supported" and then throw — the
|
|
47
|
+
// undeclared-exception failure those probes exist to prevent. Assigning only when the primary has it
|
|
48
|
+
// keeps the union exactly as capable as the pool it writes to.
|
|
49
|
+
putConditional;
|
|
50
|
+
putBundle;
|
|
51
|
+
putFrozen;
|
|
52
|
+
putFrozenConditional;
|
|
53
|
+
// Conditional for the same reason, on the read side: cliContracts.findLogicalAsset and
|
|
54
|
+
// assetLineage.resolveAsset feature-detect this, and when it is absent fall back to a wide scan that
|
|
55
|
+
// REPORTS truncation. Answering on behalf of a source that cannot resolve logical ids would strand
|
|
56
|
+
// those callers on a narrow answer with no truncation signal — a silent "not found" where they would
|
|
57
|
+
// otherwise have said "lookup is truncated; use an exact asset_id".
|
|
58
|
+
findByLogicalId;
|
|
59
|
+
/**
|
|
60
|
+
* @param primary the writable pool this engine owns; every mutation lands here
|
|
61
|
+
* @param readOnly additional pools to read, in precedence order after `primary`
|
|
62
|
+
*/
|
|
63
|
+
constructor(primary, readOnly) {
|
|
64
|
+
this.primary = primary;
|
|
65
|
+
this.readOnly = readOnly;
|
|
66
|
+
if ([primary, ...readOnly].every((source) => source.findByLogicalId)) {
|
|
67
|
+
this.findByLogicalId = (id, limit = DEFAULT_LIMIT, kind) => this.merged((source) => source.findByLogicalId(id, limit, kind), limit);
|
|
68
|
+
}
|
|
69
|
+
const { putBundle, putConditional, putFrozen, putFrozenConditional } = primary;
|
|
70
|
+
if (putBundle)
|
|
71
|
+
this.putBundle = (assets) => putBundle.call(primary, assets);
|
|
72
|
+
if (putConditional)
|
|
73
|
+
this.putConditional = (asset, options) => putConditional.call(primary, asset, options);
|
|
74
|
+
if (putFrozen)
|
|
75
|
+
this.putFrozen = (record) => putFrozen.call(primary, record);
|
|
76
|
+
if (putFrozenConditional) {
|
|
77
|
+
this.putFrozenConditional = (record, options) => putFrozenConditional.call(primary, record, options);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
get sources() {
|
|
81
|
+
return [this.primary, ...this.readOnly];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Merge one read across every source: deduplicate by asset_id with earlier sources winning, then fill
|
|
85
|
+
* the result by {@link interleave} so every source gets a fair share of the cap.
|
|
86
|
+
*/
|
|
87
|
+
async merged(read, limit) {
|
|
88
|
+
const seen = new Set();
|
|
89
|
+
const queues = [];
|
|
90
|
+
for (const source of this.sources) {
|
|
91
|
+
const unique = [];
|
|
92
|
+
for (const record of await read(source)) {
|
|
93
|
+
if (seen.has(record.asset_id))
|
|
94
|
+
continue;
|
|
95
|
+
seen.add(record.asset_id);
|
|
96
|
+
unique.push(record);
|
|
97
|
+
}
|
|
98
|
+
queues.push(unique);
|
|
99
|
+
}
|
|
100
|
+
return interleave(queues, limit);
|
|
101
|
+
}
|
|
102
|
+
async put(asset) {
|
|
103
|
+
return this.primary.put(asset);
|
|
104
|
+
}
|
|
105
|
+
async get(assetId) {
|
|
106
|
+
for (const source of this.sources) {
|
|
107
|
+
const found = await source.get(assetId);
|
|
108
|
+
if (found)
|
|
109
|
+
return found;
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
async list(kind, limit = DEFAULT_LIMIT) {
|
|
114
|
+
return this.merged((source) => source.list(kind, limit), limit);
|
|
115
|
+
}
|
|
116
|
+
async search(q) {
|
|
117
|
+
return this.merged((source) => source.search(q), q.limit ?? DEFAULT_LIMIT);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -70,6 +70,8 @@ export interface AntiGeneBenchmarkOptions {
|
|
|
70
70
|
minFailureDelta?: number;
|
|
71
71
|
now?: () => number;
|
|
72
72
|
eventsPath?: string;
|
|
73
|
+
/** Apply the pre-IDF semantic scorer consistently to both A/B arms. */
|
|
74
|
+
disableSemanticIdf?: boolean;
|
|
73
75
|
}
|
|
74
76
|
export interface AntiGeneBenchmarkDeps {
|
|
75
77
|
store: AssetStoreProvider;
|
|
@@ -79,7 +79,7 @@ function executeFor(outcome) {
|
|
|
79
79
|
},
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
-
async function runOneArm(arm, task, source, sourceReview, rootDir, now) {
|
|
82
|
+
async function runOneArm(arm, task, source, sourceReview, rootDir, now, disableSemanticIdf) {
|
|
83
83
|
const armDir = join(rootDir, arm, task.id);
|
|
84
84
|
const store = new LocalJsonlProvider(join(armDir, 'assets'));
|
|
85
85
|
const review = new ReviewLedger(join(armDir, 'assets'), now);
|
|
@@ -105,6 +105,7 @@ async function runOneArm(arm, task, source, sourceReview, rootDir, now) {
|
|
|
105
105
|
execute: executeFor(spec),
|
|
106
106
|
review,
|
|
107
107
|
consumePendingSignals: false,
|
|
108
|
+
...(disableSemanticIdf ? { disableSemanticIdf: true } : {}),
|
|
108
109
|
};
|
|
109
110
|
const result = await runEvolutionCycle(engine, store, opts);
|
|
110
111
|
const observed = observedWarningIds(result.decision);
|
|
@@ -168,8 +169,8 @@ export async function runAntiGeneBenchmark(suite, deps, options = {}) {
|
|
|
168
169
|
for (const task of suite.tasks) {
|
|
169
170
|
taskResults.push({
|
|
170
171
|
taskId: task.id,
|
|
171
|
-
baseline: await runOneArm('baseline', task, deps.store, sourceReview, rootDir, now),
|
|
172
|
-
antiGene: await runOneArm('antiGene', task, deps.store, sourceReview, rootDir, now),
|
|
172
|
+
baseline: await runOneArm('baseline', task, deps.store, sourceReview, rootDir, now, options.disableSemanticIdf === true),
|
|
173
|
+
antiGene: await runOneArm('antiGene', task, deps.store, sourceReview, rootDir, now, options.disableSemanticIdf === true),
|
|
173
174
|
});
|
|
174
175
|
}
|
|
175
176
|
const report = buildReport(suite, taskResults, minSamples, minFailureDelta);
|
|
@@ -75,6 +75,8 @@ export interface AntiGeneRolloutOptions {
|
|
|
75
75
|
minFailureDelta?: number;
|
|
76
76
|
now?: () => number;
|
|
77
77
|
eventsPath?: string;
|
|
78
|
+
/** Apply the pre-IDF semantic scorer consistently to both A/B arms. */
|
|
79
|
+
disableSemanticIdf?: boolean;
|
|
78
80
|
}
|
|
79
81
|
export declare function runAntiGeneRollout(suite: AntiGeneRolloutSuite, deps: AntiGeneRolloutDeps, options?: AntiGeneRolloutOptions): Promise<AntiGeneRolloutReport>;
|
|
80
82
|
export declare function writeAntiGeneRolloutResult(report: AntiGeneRolloutReport, eventsPath: string, now?: () => number): Promise<void>;
|
|
@@ -82,7 +82,7 @@ function scoreFromResult(result, status) {
|
|
|
82
82
|
const score = result.capsule?.outcome?.score;
|
|
83
83
|
return typeof score === 'number' && Number.isFinite(score) ? score : status === 'success' ? 0.9 : 0.2;
|
|
84
84
|
}
|
|
85
|
-
async function runOneArm(arm, task, source, sourceReview, makeExecute, rootDir, now) {
|
|
85
|
+
async function runOneArm(arm, task, source, sourceReview, makeExecute, rootDir, now, disableSemanticIdf) {
|
|
86
86
|
const armDir = join(rootDir, arm, task.id);
|
|
87
87
|
const store = new LocalJsonlProvider(join(armDir, 'assets'));
|
|
88
88
|
const review = new ReviewLedger(join(armDir, 'assets'), now);
|
|
@@ -107,6 +107,7 @@ async function runOneArm(arm, task, source, sourceReview, makeExecute, rootDir,
|
|
|
107
107
|
execute: makeExecute({ arm, task, store, review, armDir }),
|
|
108
108
|
review,
|
|
109
109
|
consumePendingSignals: false,
|
|
110
|
+
...(disableSemanticIdf ? { disableSemanticIdf: true } : {}),
|
|
110
111
|
};
|
|
111
112
|
const result = await runEvolutionCycle(engine, store, opts);
|
|
112
113
|
const status = statusFromResult(result);
|
|
@@ -183,8 +184,8 @@ export async function runAntiGeneRollout(suite, deps, options = {}) {
|
|
|
183
184
|
for (const task of suite.tasks) {
|
|
184
185
|
taskResults.push({
|
|
185
186
|
taskId: task.id,
|
|
186
|
-
baseline: await runOneArm('baseline', task, deps.store, sourceReview, deps.makeExecute, rootDir, now),
|
|
187
|
-
antiGene: await runOneArm('antiGene', task, deps.store, sourceReview, deps.makeExecute, rootDir, now),
|
|
187
|
+
baseline: await runOneArm('baseline', task, deps.store, sourceReview, deps.makeExecute, rootDir, now, options.disableSemanticIdf === true),
|
|
188
|
+
antiGene: await runOneArm('antiGene', task, deps.store, sourceReview, deps.makeExecute, rootDir, now, options.disableSemanticIdf === true),
|
|
188
189
|
});
|
|
189
190
|
}
|
|
190
191
|
const report = buildReport(suite, taskResults, minSamples, minFailureDelta);
|
|
@@ -3,4 +3,5 @@ export * from './thesis.js';
|
|
|
3
3
|
export * from './evolutionThesisSolver.js';
|
|
4
4
|
export * from './antiGeneBenchmark.js';
|
|
5
5
|
export * from './antiGeneRollout.js';
|
|
6
|
-
export * from './triggerShift.js';
|
|
6
|
+
export * from './triggerShift.js';
|
|
7
|
+
export * from './selectionFlatAbstention.js';
|
package/dist/benchmark/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export * from './thesis.js';
|
|
|
3
3
|
export * from './evolutionThesisSolver.js';
|
|
4
4
|
export * from './antiGeneBenchmark.js';
|
|
5
5
|
export * from './antiGeneRollout.js';
|
|
6
|
-
export * from './triggerShift.js';
|
|
6
|
+
export * from './triggerShift.js';
|
|
7
|
+
export * from './selectionFlatAbstention.js';
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { type GeneDecision, type SelectionInput } from '../algo/geneSelection.js';
|
|
2
|
+
export declare const SELECTION_FLAT_ABSTENTION_BENCHMARK_VERSION = "global-flat-abstention-paired-v1";
|
|
3
|
+
export type SelectionFlatArm = 'current' | 'global-flat-abstain';
|
|
4
|
+
export type SelectionFlatSplit = 'calibration' | 'holdout';
|
|
5
|
+
export type SelectionFlatAction = {
|
|
6
|
+
kind: 'reuse';
|
|
7
|
+
geneId: string;
|
|
8
|
+
assetId?: string;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'innovate';
|
|
11
|
+
};
|
|
12
|
+
export interface SelectionFlatComparison {
|
|
13
|
+
targeted: boolean;
|
|
14
|
+
targetReason?: 'outside_plateau_flat_positive';
|
|
15
|
+
currentDecision: GeneDecision;
|
|
16
|
+
currentAction: SelectionFlatAction;
|
|
17
|
+
globalFlatAbstainAction: SelectionFlatAction;
|
|
18
|
+
}
|
|
19
|
+
export interface SelectionFlatCohort {
|
|
20
|
+
id: string;
|
|
21
|
+
version: string;
|
|
22
|
+
sourceCommit: string;
|
|
23
|
+
taskFingerprints: readonly string[];
|
|
24
|
+
verifier: {
|
|
25
|
+
id: string;
|
|
26
|
+
version: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export type SelectionFlatExpectedRole = 'target' | 'control';
|
|
30
|
+
export interface SelectionFlatExpectation {
|
|
31
|
+
role: SelectionFlatExpectedRole;
|
|
32
|
+
currentAction: SelectionFlatAction;
|
|
33
|
+
globalFlatAbstainAction: SelectionFlatAction;
|
|
34
|
+
}
|
|
35
|
+
export interface SelectionFlatTaskSnapshot<I> {
|
|
36
|
+
id: string;
|
|
37
|
+
workspaceSnapshotDigest: string;
|
|
38
|
+
split: SelectionFlatSplit;
|
|
39
|
+
stratum: string;
|
|
40
|
+
/** Verifier input is a private structured-clone-normalized copy (for example, Node Buffer becomes Uint8Array). */
|
|
41
|
+
payload: I;
|
|
42
|
+
selection: Omit<SelectionInput, 'selectionGuard'>;
|
|
43
|
+
expectation: SelectionFlatExpectation;
|
|
44
|
+
}
|
|
45
|
+
export interface SelectionFlatTask<I> extends SelectionFlatTaskSnapshot<I> {
|
|
46
|
+
taskFingerprint: string;
|
|
47
|
+
}
|
|
48
|
+
export interface SelectionFlatBenchmarkSuite<I> {
|
|
49
|
+
name: string;
|
|
50
|
+
cohort: SelectionFlatCohort;
|
|
51
|
+
tasks: readonly SelectionFlatTask<I>[];
|
|
52
|
+
}
|
|
53
|
+
export interface SelectionFlatVerifierProof {
|
|
54
|
+
id: string;
|
|
55
|
+
version: string;
|
|
56
|
+
proofSha256: string;
|
|
57
|
+
}
|
|
58
|
+
export interface SelectionFlatObjectiveOutcome {
|
|
59
|
+
passed: boolean;
|
|
60
|
+
producedValue: boolean;
|
|
61
|
+
unsafe: boolean;
|
|
62
|
+
cost: number;
|
|
63
|
+
verifier: SelectionFlatVerifierProof;
|
|
64
|
+
}
|
|
65
|
+
export interface SelectionFlatVerificationRequest<I> {
|
|
66
|
+
task: SelectionFlatTask<I>;
|
|
67
|
+
arm: SelectionFlatArm;
|
|
68
|
+
action: SelectionFlatAction;
|
|
69
|
+
isolationKey: string;
|
|
70
|
+
order: 0 | 1;
|
|
71
|
+
}
|
|
72
|
+
export type SelectionFlatVerifier<I> = (request: SelectionFlatVerificationRequest<I>) => Promise<SelectionFlatObjectiveOutcome> | SelectionFlatObjectiveOutcome;
|
|
73
|
+
export interface SelectionFlatBenchmarkRow {
|
|
74
|
+
taskFingerprint: string;
|
|
75
|
+
split: SelectionFlatSplit;
|
|
76
|
+
stratum: string;
|
|
77
|
+
armOrder: readonly [SelectionFlatArm, SelectionFlatArm];
|
|
78
|
+
current: {
|
|
79
|
+
action: SelectionFlatAction['kind'];
|
|
80
|
+
outcome: SelectionFlatObjectiveOutcome;
|
|
81
|
+
};
|
|
82
|
+
globalFlatAbstain: {
|
|
83
|
+
action: SelectionFlatAction['kind'];
|
|
84
|
+
outcome: SelectionFlatObjectiveOutcome;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export interface SelectionFlatPairedStats {
|
|
88
|
+
n: number;
|
|
89
|
+
currentPasses: number;
|
|
90
|
+
globalFlatAbstainPasses: number;
|
|
91
|
+
bothPass: number;
|
|
92
|
+
bothFail: number;
|
|
93
|
+
globalOnlyPass: number;
|
|
94
|
+
currentOnlyPass: number;
|
|
95
|
+
currentPassRate: number;
|
|
96
|
+
globalFlatAbstainPassRate: number;
|
|
97
|
+
pairedRiskDifference: number;
|
|
98
|
+
ci95Low: number;
|
|
99
|
+
ci95High: number;
|
|
100
|
+
mcnemarPValue: number;
|
|
101
|
+
currentProducedValueRate: number;
|
|
102
|
+
globalFlatAbstainProducedValueRate: number;
|
|
103
|
+
currentUnsafeRate: number;
|
|
104
|
+
globalFlatAbstainUnsafeRate: number;
|
|
105
|
+
unsafeRateDelta: number;
|
|
106
|
+
currentAverageCost: number;
|
|
107
|
+
globalFlatAbstainAverageCost: number;
|
|
108
|
+
averageCostDelta: number;
|
|
109
|
+
currentInnovateRate: number;
|
|
110
|
+
globalFlatAbstainInnovateRate: number;
|
|
111
|
+
}
|
|
112
|
+
export interface SelectionFlatBenchmarkReport {
|
|
113
|
+
benchmarkVersion: typeof SELECTION_FLAT_ABSTENTION_BENCHMARK_VERSION;
|
|
114
|
+
statisticalMethods: {
|
|
115
|
+
mcnemar: 'exact-two-sided-binomial';
|
|
116
|
+
riskDifferenceCi: 'paired-hoeffding-95';
|
|
117
|
+
};
|
|
118
|
+
suite: string;
|
|
119
|
+
cohort: Omit<SelectionFlatCohort, 'taskFingerprints'> & {
|
|
120
|
+
registeredTasks: number;
|
|
121
|
+
};
|
|
122
|
+
datasetDigest: string;
|
|
123
|
+
targetTasks: number;
|
|
124
|
+
controlTasks: number;
|
|
125
|
+
controlDivergences: 0;
|
|
126
|
+
rows: SelectionFlatBenchmarkRow[];
|
|
127
|
+
overall: SelectionFlatPairedStats;
|
|
128
|
+
calibration: SelectionFlatPairedStats;
|
|
129
|
+
holdout: SelectionFlatPairedStats;
|
|
130
|
+
strata: Record<string, SelectionFlatPairedStats>;
|
|
131
|
+
}
|
|
132
|
+
export interface SelectionFlatPassPair {
|
|
133
|
+
currentPassed: boolean;
|
|
134
|
+
globalFlatAbstainPassed: boolean;
|
|
135
|
+
}
|
|
136
|
+
/** Compare production with a benchmark-only global flat-positive abstention counterfactual. */
|
|
137
|
+
export declare function compareOutsidePlateauFlatSelection(input: Omit<SelectionInput, 'selectionGuard'>): SelectionFlatComparison;
|
|
138
|
+
/** Compute the digest that the cohort manifest must pre-register for this exact task snapshot. */
|
|
139
|
+
export declare function computeSelectionFlatTaskFingerprint<I>(task: SelectionFlatTaskSnapshot<I>): string;
|
|
140
|
+
/** Exact two-sided McNemar p-value over the discordant pairs. */
|
|
141
|
+
export declare function exactMcNemarTwoSided(globalOnlyPass: number, currentOnlyPass: number): number;
|
|
142
|
+
/** Distribution-free Hoeffding 95% CI for the mean paired success difference (global minus current). */
|
|
143
|
+
export declare function pairedRiskDifference95(pairs: readonly SelectionFlatPassPair[]): {
|
|
144
|
+
difference: number;
|
|
145
|
+
ci95Low: number;
|
|
146
|
+
ci95High: number;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Run a pre-registered, full-information paired benchmark. Controls are classification checks only and are never
|
|
150
|
+
* executed. Target tasks run both arms on separately cloned inputs and caller-owned isolated workspaces.
|
|
151
|
+
*/
|
|
152
|
+
export declare function runSelectionFlatAbstentionBenchmark<I>(suite: SelectionFlatBenchmarkSuite<I>, verifier: SelectionFlatVerifier<I>): Promise<SelectionFlatBenchmarkReport>;
|