@tangle-network/agent-eval 0.20.11 → 0.20.12
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/README.md +99 -170
- package/dist/benchmarks/index.d.ts +2 -1
- package/dist/{chunk-JAOLXRIA.js → chunk-75MCTH7P.js} +8 -2
- package/dist/chunk-75MCTH7P.js.map +1 -0
- package/dist/chunk-HKYRWNHV.js +1354 -0
- package/dist/chunk-HKYRWNHV.js.map +1 -0
- package/dist/{chunk-LSR4IAYN.js → chunk-HNJLMAJ2.js} +2 -2
- package/dist/chunk-IKFVX537.js +717 -0
- package/dist/chunk-IKFVX537.js.map +1 -0
- package/dist/chunk-KWUAAIHR.js +1764 -0
- package/dist/chunk-KWUAAIHR.js.map +1 -0
- package/dist/chunk-MCMV7DUL.js +1310 -0
- package/dist/chunk-MCMV7DUL.js.map +1 -0
- package/dist/chunk-ODFINDLQ.js +413 -0
- package/dist/chunk-ODFINDLQ.js.map +1 -0
- package/dist/chunk-PKCVBYTQ.js +200 -0
- package/dist/chunk-PKCVBYTQ.js.map +1 -0
- package/dist/chunk-YUFXO3TU.js +148 -0
- package/dist/chunk-YUFXO3TU.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/control-C8NKbF3w.d.ts +258 -0
- package/dist/control.d.ts +5 -0
- package/dist/control.js +30 -0
- package/dist/control.js.map +1 -0
- package/dist/dataset-B9qvlm_o.d.ts +112 -0
- package/dist/emitter-BYO2nSDA.d.ts +387 -0
- package/dist/feedback-trajectory-BGQ_ANCN.d.ts +345 -0
- package/dist/{index-1PZOtZFr.d.ts → index-c5saLbKD.d.ts} +2 -133
- package/dist/index.d.ts +115 -2870
- package/dist/index.js +1049 -6156
- package/dist/index.js.map +1 -1
- package/dist/multi-shot-optimization-Bvtz294B.d.ts +598 -0
- package/dist/openapi.json +1 -1
- package/dist/optimization.d.ts +145 -0
- package/dist/optimization.js +60 -0
- package/dist/optimization.js.map +1 -0
- package/dist/reporting.d.ts +426 -0
- package/dist/reporting.js +32 -0
- package/dist/reporting.js.map +1 -0
- package/dist/run-record-CX_jcAyr.d.ts +134 -0
- package/dist/traces.d.ts +658 -0
- package/dist/traces.js +100 -0
- package/dist/traces.js.map +1 -0
- package/dist/wire/index.js +2 -2
- package/docs/concepts.md +16 -11
- package/docs/feature-guide.md +10 -17
- package/docs/integration-launch-gates.md +77 -0
- package/docs/product-eval-adoption.md +27 -0
- package/docs/trace-analysis.md +75 -0
- package/package.json +21 -1
- package/dist/chunk-JAOLXRIA.js.map +0 -1
- /package/dist/{chunk-LSR4IAYN.js.map → chunk-HNJLMAJ2.js.map} +0 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { c as ControlEvalResult, i as ControlRunResult, F as FeedbackLabel, A as ProposedSideEffect, j as ControlRuntimeConfig } from './feedback-trajectory-BGQ_ANCN.js';
|
|
2
|
+
import { R as RunSplitTag, e as RunTokenUsage, a as RunRecord } from './run-record-CX_jcAyr.js';
|
|
3
|
+
import { T as TraceEmitter, a as TraceStore, F as FailureClass } from './emitter-BYO2nSDA.js';
|
|
4
|
+
|
|
5
|
+
interface RunEvidenceMetadata {
|
|
6
|
+
experimentId: string;
|
|
7
|
+
candidateId: string;
|
|
8
|
+
seed: number;
|
|
9
|
+
model: string;
|
|
10
|
+
promptHash: string;
|
|
11
|
+
configHash: string;
|
|
12
|
+
commitSha: string;
|
|
13
|
+
splitTag: RunSplitTag;
|
|
14
|
+
tokenUsage: RunTokenUsage;
|
|
15
|
+
queueMs?: number;
|
|
16
|
+
judgeMetadata?: RunRecord['judgeMetadata'];
|
|
17
|
+
raw?: Record<string, number>;
|
|
18
|
+
}
|
|
19
|
+
interface ControlRunToRunRecordOptions extends RunEvidenceMetadata {
|
|
20
|
+
runId?: string;
|
|
21
|
+
score?: number;
|
|
22
|
+
failureMode?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Project a completed control-loop run into the strict RunRecord shape used by
|
|
26
|
+
* release gates, optimizer tables, and research reports.
|
|
27
|
+
*
|
|
28
|
+
* The control loop owns live execution evidence. The caller still supplies the
|
|
29
|
+
* experimental cell metadata because prompt/config hashes, split assignment,
|
|
30
|
+
* model snapshot, and commit SHA are product/harness concerns.
|
|
31
|
+
*/
|
|
32
|
+
declare function controlRunToRunRecord<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult>(run: ControlRunResult<TState, TAction, TActionResult, TEval>, options: ControlRunToRunRecordOptions): RunRecord;
|
|
33
|
+
declare function scoreFromEvals(evals: readonly ControlEvalResult[]): number | undefined;
|
|
34
|
+
|
|
35
|
+
interface ActionExecutionPolicy {
|
|
36
|
+
allowedTypes?: string[];
|
|
37
|
+
blockedTypes?: string[];
|
|
38
|
+
alwaysRequireApprovalTypes?: string[];
|
|
39
|
+
autoApproveTypes?: string[];
|
|
40
|
+
requireApprovalForExternalSideEffects?: boolean;
|
|
41
|
+
requireApprovalAboveCostUsd?: number;
|
|
42
|
+
maxActionCostUsd?: number;
|
|
43
|
+
remainingBudgetUsd?: number;
|
|
44
|
+
expectedOutcomeRequired?: boolean;
|
|
45
|
+
killCriteriaRequired?: boolean;
|
|
46
|
+
}
|
|
47
|
+
interface ActionPolicyDecision {
|
|
48
|
+
allowed: boolean;
|
|
49
|
+
blocked: boolean;
|
|
50
|
+
requiresApproval: boolean;
|
|
51
|
+
reasons: string[];
|
|
52
|
+
label?: FeedbackLabel;
|
|
53
|
+
}
|
|
54
|
+
declare function evaluateActionPolicy(action: ProposedSideEffect, policy?: ActionExecutionPolicy, options?: {
|
|
55
|
+
createdAt?: string;
|
|
56
|
+
}): ActionPolicyDecision;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Propose / Verify / Review — the core multi-shot primitive.
|
|
60
|
+
*
|
|
61
|
+
* shot N: propose(state, priorReview) → new state
|
|
62
|
+
* verify(state) → pass/fail, optional layers
|
|
63
|
+
* review(state, verification, memory) → observations + next-shot
|
|
64
|
+
* instruction + shouldContinue
|
|
65
|
+
* memory.append(entry)
|
|
66
|
+
*
|
|
67
|
+
* Roles are strictly separated:
|
|
68
|
+
*
|
|
69
|
+
* - The WORKER is whatever the caller wraps in `propose`. It is
|
|
70
|
+
* stateful — caller owns its resume/session mechanism.
|
|
71
|
+
* - The VERIFIER grades the state. It produces the ground truth.
|
|
72
|
+
* The reviewer cannot overturn or downgrade a verification layer.
|
|
73
|
+
* - The REVIEWER is stateless per call. Its continuity is the
|
|
74
|
+
* `ReviewMemoryStore` — durable JSONL by default, or any store
|
|
75
|
+
* implementing the interface. It reads memory + trace summary +
|
|
76
|
+
* verification and directs the NEXT proposer shot.
|
|
77
|
+
*
|
|
78
|
+
* This shape is load-bearing. The reviewer never grades; the verifier
|
|
79
|
+
* never directs. Two processes, two prompts, two concerns — which is
|
|
80
|
+
* what keeps the loop from confirmation-biasing itself into "all
|
|
81
|
+
* passed" when it didn't.
|
|
82
|
+
*
|
|
83
|
+
* Short-circuits and soft-fails are both first-class:
|
|
84
|
+
* - verify.pass === true → reviewer LLM call is skipped, memory
|
|
85
|
+
* records a success entry, loop exits.
|
|
86
|
+
* - review throws → the shot still counts; the loop uses the
|
|
87
|
+
* last-known instruction (or `fallbackInstruction`) for the next
|
|
88
|
+
* propose call. A transient reviewer failure must NEVER abort a
|
|
89
|
+
* valid arc.
|
|
90
|
+
*
|
|
91
|
+
* Composable: `propose` itself can be another `runProposeReview` call.
|
|
92
|
+
* That's the dogfooding path — a harness built on this primitive is in
|
|
93
|
+
* turn evaluable by it.
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
interface Verification {
|
|
97
|
+
pass: boolean;
|
|
98
|
+
score?: number;
|
|
99
|
+
failingLayers?: string[];
|
|
100
|
+
details?: unknown;
|
|
101
|
+
}
|
|
102
|
+
interface Review {
|
|
103
|
+
observations: string;
|
|
104
|
+
diagnosis: string;
|
|
105
|
+
nextShotInstruction: string;
|
|
106
|
+
shouldContinue: boolean;
|
|
107
|
+
confidence: number;
|
|
108
|
+
}
|
|
109
|
+
interface ReviewMemoryEntry extends Review {
|
|
110
|
+
shot: number;
|
|
111
|
+
timestamp: number;
|
|
112
|
+
verification: {
|
|
113
|
+
pass: boolean;
|
|
114
|
+
score?: number;
|
|
115
|
+
failingLayers?: string[];
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
interface ProposeInput<State> {
|
|
119
|
+
shot: number;
|
|
120
|
+
goal: string;
|
|
121
|
+
state: State;
|
|
122
|
+
priorReview: Review | null;
|
|
123
|
+
abortSignal: AbortSignal;
|
|
124
|
+
emitter?: TraceEmitter;
|
|
125
|
+
}
|
|
126
|
+
interface ProposeOutput<State, Summary = unknown> {
|
|
127
|
+
state: State;
|
|
128
|
+
traceSummary?: Summary;
|
|
129
|
+
}
|
|
130
|
+
interface ReviewInput<State, Summary = unknown> {
|
|
131
|
+
shot: number;
|
|
132
|
+
goal: string;
|
|
133
|
+
state: State;
|
|
134
|
+
verification: Verification;
|
|
135
|
+
traceSummary: Summary | undefined;
|
|
136
|
+
memory: ReviewMemoryEntry[];
|
|
137
|
+
}
|
|
138
|
+
type ProposeFn<State, Summary = unknown> = (input: ProposeInput<State>) => Promise<ProposeOutput<State, Summary>>;
|
|
139
|
+
type VerifyFn<State> = (state: State) => Promise<Verification>;
|
|
140
|
+
type ReviewFn<State, Summary = unknown> = (input: ReviewInput<State, Summary>) => Promise<Review>;
|
|
141
|
+
interface ReviewMemoryStore {
|
|
142
|
+
load(): Promise<ReviewMemoryEntry[]>;
|
|
143
|
+
append(entry: ReviewMemoryEntry): Promise<void>;
|
|
144
|
+
}
|
|
145
|
+
interface ProposeReviewConfig<State, Summary = unknown> {
|
|
146
|
+
goal: string;
|
|
147
|
+
initialState: State;
|
|
148
|
+
propose: ProposeFn<State, Summary>;
|
|
149
|
+
verify: VerifyFn<State>;
|
|
150
|
+
review: ReviewFn<State, Summary>;
|
|
151
|
+
/** Hard shot cap. Default 10. */
|
|
152
|
+
maxShots?: number;
|
|
153
|
+
/** Wall-clock cap in ms. Default 10 min. */
|
|
154
|
+
maxWallMs?: number;
|
|
155
|
+
/**
|
|
156
|
+
* If the reviewer returns confidence ≤ floor on `confidenceFloorWindow`
|
|
157
|
+
* consecutive shots, terminate early. Default floor 0.3, window 2.
|
|
158
|
+
* Set window to 0 or floor to <0 to disable.
|
|
159
|
+
*/
|
|
160
|
+
confidenceFloor?: number;
|
|
161
|
+
confidenceFloorWindow?: number;
|
|
162
|
+
/** Defaults to an in-memory store if omitted. */
|
|
163
|
+
memory?: ReviewMemoryStore;
|
|
164
|
+
/** If provided, emit a Run + per-shot spans. */
|
|
165
|
+
store?: TraceStore;
|
|
166
|
+
scenarioId?: string;
|
|
167
|
+
projectId?: string;
|
|
168
|
+
variantId?: string;
|
|
169
|
+
/**
|
|
170
|
+
* Used when the reviewer soft-fails on shot 1 (no prior instruction to
|
|
171
|
+
* fall back to). Default is a generic "inspect failures and fix".
|
|
172
|
+
*/
|
|
173
|
+
fallbackInstruction?: string;
|
|
174
|
+
}
|
|
175
|
+
interface ProposeReviewShot<State, Summary = unknown> {
|
|
176
|
+
shot: number;
|
|
177
|
+
state: State;
|
|
178
|
+
verification: Verification;
|
|
179
|
+
traceSummary: Summary | undefined;
|
|
180
|
+
review: Review;
|
|
181
|
+
reviewAvailable: boolean;
|
|
182
|
+
reviewError?: string;
|
|
183
|
+
durationMs: number;
|
|
184
|
+
}
|
|
185
|
+
interface ProposeReviewReport<State, Summary = unknown> {
|
|
186
|
+
runId: string | null;
|
|
187
|
+
completed: boolean;
|
|
188
|
+
shots: ProposeReviewShot<State, Summary>[];
|
|
189
|
+
finalState: State;
|
|
190
|
+
finalVerification: Verification;
|
|
191
|
+
failureClass?: FailureClass;
|
|
192
|
+
wallMs: number;
|
|
193
|
+
score: number;
|
|
194
|
+
}
|
|
195
|
+
declare function inMemoryReviewStore(initial?: ReviewMemoryEntry[]): ReviewMemoryStore;
|
|
196
|
+
declare function jsonlReviewStore(path: string): ReviewMemoryStore;
|
|
197
|
+
declare function runProposeReview<State, Summary = unknown>(config: ProposeReviewConfig<State, Summary>): Promise<ProposeReviewReport<State, Summary>>;
|
|
198
|
+
interface LlmJsonCall {
|
|
199
|
+
(req: {
|
|
200
|
+
system: string;
|
|
201
|
+
user: string;
|
|
202
|
+
}): Promise<unknown>;
|
|
203
|
+
}
|
|
204
|
+
interface LlmReviewerConfig<State, Summary = unknown> {
|
|
205
|
+
callJson: LlmJsonCall;
|
|
206
|
+
renderState?: (state: State) => string;
|
|
207
|
+
renderTraceSummary?: (summary: Summary | undefined) => string;
|
|
208
|
+
/** Appended to the default system prompt. */
|
|
209
|
+
systemPromptAddendum?: string;
|
|
210
|
+
}
|
|
211
|
+
declare function createLlmReviewer<State, Summary = unknown>(cfg: LlmReviewerConfig<State, Summary>): ReviewFn<State, Summary>;
|
|
212
|
+
|
|
213
|
+
interface ProposeReviewControlState<State, Summary = unknown> {
|
|
214
|
+
shot: number;
|
|
215
|
+
state: State;
|
|
216
|
+
priorReview: Review | null;
|
|
217
|
+
verification: Verification;
|
|
218
|
+
traceSummary?: Summary;
|
|
219
|
+
memory: ReviewMemoryEntry[];
|
|
220
|
+
completed: boolean;
|
|
221
|
+
reviewAvailable: boolean;
|
|
222
|
+
reviewError?: string;
|
|
223
|
+
}
|
|
224
|
+
interface ProposeReviewControlAction {
|
|
225
|
+
type: 'propose-review-shot';
|
|
226
|
+
shot: number;
|
|
227
|
+
}
|
|
228
|
+
interface ProposeReviewControlResult<State, Summary = unknown> {
|
|
229
|
+
state: State;
|
|
230
|
+
verification: Verification;
|
|
231
|
+
traceSummary?: Summary;
|
|
232
|
+
review: Review | null;
|
|
233
|
+
reviewAvailable: boolean;
|
|
234
|
+
reviewError?: string;
|
|
235
|
+
}
|
|
236
|
+
interface ProposeReviewControlConfig<State, Summary = unknown> {
|
|
237
|
+
goal: string;
|
|
238
|
+
initialState: State;
|
|
239
|
+
propose: ProposeFn<State, Summary>;
|
|
240
|
+
verify: VerifyFn<State>;
|
|
241
|
+
review: ReviewFn<State, Summary>;
|
|
242
|
+
maxShots?: number;
|
|
243
|
+
maxWallMs?: number;
|
|
244
|
+
memory?: ReviewMemoryStore;
|
|
245
|
+
store?: TraceStore;
|
|
246
|
+
scenarioId?: string;
|
|
247
|
+
projectId?: string;
|
|
248
|
+
variantId?: string;
|
|
249
|
+
fallbackInstruction?: string;
|
|
250
|
+
confidenceFloor?: number;
|
|
251
|
+
confidenceFloorWindow?: number;
|
|
252
|
+
failureClassFromVerification?: (verification: Verification) => FailureClass | undefined;
|
|
253
|
+
actionFailure?: ControlRuntimeConfig<ProposeReviewControlState<State, Summary>, ProposeReviewControlAction, ProposeReviewControlResult<State, Summary>>['actionFailure'];
|
|
254
|
+
}
|
|
255
|
+
declare function runProposeReviewAsControlLoop<State, Summary = unknown>(config: ProposeReviewControlConfig<State, Summary>): Promise<ControlRunResult<ProposeReviewControlState<State, Summary>, ProposeReviewControlAction, ProposeReviewControlResult<State, Summary>>>;
|
|
256
|
+
declare function controlFailureClassFromVerification(verification: Verification): FailureClass | undefined;
|
|
257
|
+
|
|
258
|
+
export { type ActionExecutionPolicy as A, type ControlRunToRunRecordOptions as C, type LlmJsonCall as L, type ProposeFn as P, type Review as R, type Verification as V, type ActionPolicyDecision as a, type LlmReviewerConfig as b, type ProposeInput as c, type ProposeOutput as d, type ProposeReviewConfig as e, type ProposeReviewControlAction as f, type ProposeReviewControlConfig as g, type ProposeReviewControlResult as h, type ProposeReviewControlState as i, type ProposeReviewReport as j, type ProposeReviewShot as k, type ReviewFn as l, type ReviewInput as m, type ReviewMemoryEntry as n, type ReviewMemoryStore as o, type RunEvidenceMetadata as p, type VerifyFn as q, controlFailureClassFromVerification as r, controlRunToRunRecord as s, createLlmReviewer as t, evaluateActionPolicy as u, inMemoryReviewStore as v, jsonlReviewStore as w, runProposeReview as x, runProposeReviewAsControlLoop as y, scoreFromEvals as z };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { d as ControlActionFailureMode, e as ControlActionOutcome, f as ControlBudget, g as ControlContext, h as ControlDecision, c as ControlEvalResult, i as ControlRunResult, j as ControlRuntimeConfig, k as ControlRuntimeError, C as ControlSeverity, l as ControlStep, m as ControlStopPolicies, S as StopDecision, B as allCriticalPassed, M as objectiveEval, T as runAgentControlLoop, V as stopOnNoProgress, W as stopOnRepeatedAction, X as subjectiveEval } from './feedback-trajectory-BGQ_ANCN.js';
|
|
2
|
+
export { A as ActionExecutionPolicy, a as ActionPolicyDecision, C as ControlRunToRunRecordOptions, e as ProposeReviewConfig, f as ProposeReviewControlAction, g as ProposeReviewControlConfig, h as ProposeReviewControlResult, i as ProposeReviewControlState, j as ProposeReviewReport, p as RunEvidenceMetadata, s as controlRunToRunRecord, u as evaluateActionPolicy, x as runProposeReview, y as runProposeReviewAsControlLoop, z as scoreFromEvals } from './control-C8NKbF3w.js';
|
|
3
|
+
import './dataset-B9qvlm_o.js';
|
|
4
|
+
import './emitter-BYO2nSDA.js';
|
|
5
|
+
import './run-record-CX_jcAyr.js';
|
package/dist/control.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
allCriticalPassed,
|
|
3
|
+
controlRunToRunRecord,
|
|
4
|
+
evaluateActionPolicy,
|
|
5
|
+
objectiveEval,
|
|
6
|
+
runAgentControlLoop,
|
|
7
|
+
runProposeReview,
|
|
8
|
+
runProposeReviewAsControlLoop,
|
|
9
|
+
scoreFromEvals,
|
|
10
|
+
stopOnNoProgress,
|
|
11
|
+
stopOnRepeatedAction,
|
|
12
|
+
subjectiveEval
|
|
13
|
+
} from "./chunk-MCMV7DUL.js";
|
|
14
|
+
import "./chunk-YUFXO3TU.js";
|
|
15
|
+
import "./chunk-PKCVBYTQ.js";
|
|
16
|
+
import "./chunk-PZ5AY32C.js";
|
|
17
|
+
export {
|
|
18
|
+
allCriticalPassed,
|
|
19
|
+
controlRunToRunRecord,
|
|
20
|
+
evaluateActionPolicy,
|
|
21
|
+
objectiveEval,
|
|
22
|
+
runAgentControlLoop,
|
|
23
|
+
runProposeReview,
|
|
24
|
+
runProposeReviewAsControlLoop,
|
|
25
|
+
scoreFromEvals,
|
|
26
|
+
stopOnNoProgress,
|
|
27
|
+
stopOnRepeatedAction,
|
|
28
|
+
subjectiveEval
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dataset — versioned, sliceable, content-hashed scenario collection.
|
|
3
|
+
*
|
|
4
|
+
* Scenarios stop being ephemeral arrays and become first-class
|
|
5
|
+
* artifacts. Every Dataset carries:
|
|
6
|
+
* - content hash (sha256 over canonicalized scenario array)
|
|
7
|
+
* - provenance (contributor, createdAt, sourceUrl)
|
|
8
|
+
* - split labels (train | dev | test | holdout)
|
|
9
|
+
* - difficulty tiers (easy | medium | hard | extreme)
|
|
10
|
+
* - tags (free-form, per-scenario)
|
|
11
|
+
*
|
|
12
|
+
* `Dataset.slice({ difficulty, split, holdout, seed })` returns a
|
|
13
|
+
* deterministic, reproducible subset. Holdout slices are locked: you
|
|
14
|
+
* can read them but `mutate` throws, which prevents "oh I'll just
|
|
15
|
+
* tweak that one scenario" contamination drift.
|
|
16
|
+
*/
|
|
17
|
+
type DatasetSplit = 'train' | 'dev' | 'test' | 'holdout';
|
|
18
|
+
type DatasetDifficulty = 'easy' | 'medium' | 'hard' | 'extreme';
|
|
19
|
+
interface DatasetScenario {
|
|
20
|
+
id: string;
|
|
21
|
+
/** Arbitrary payload; the framework doesn't interpret it. */
|
|
22
|
+
payload: unknown;
|
|
23
|
+
split?: DatasetSplit;
|
|
24
|
+
difficulty?: DatasetDifficulty;
|
|
25
|
+
/** Canary token that MUST NOT round-trip through a correct agent output. */
|
|
26
|
+
canary?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Behavioral-canary forbidden pattern. A string OR a serialized regex
|
|
29
|
+
* (`/.../flags`) that the agent under test MUST NOT emit. Used by
|
|
30
|
+
* {@link import('./canary').checkBehavioralCanary | checkBehavioralCanary},
|
|
31
|
+
* which inverts the contamination-style semantic: presence in the
|
|
32
|
+
* agent output is a LEAK / failure, not a positive signal.
|
|
33
|
+
*
|
|
34
|
+
* Falls back to {@link canary} when omitted.
|
|
35
|
+
*/
|
|
36
|
+
forbiddenPattern?: string;
|
|
37
|
+
tags?: Record<string, string>;
|
|
38
|
+
}
|
|
39
|
+
interface DatasetProvenance {
|
|
40
|
+
contributor?: string;
|
|
41
|
+
createdAt: string;
|
|
42
|
+
sourceUrl?: string;
|
|
43
|
+
license?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
/** Monotonic human-readable version (e.g. "2026.04.20"). */
|
|
46
|
+
version: string;
|
|
47
|
+
}
|
|
48
|
+
interface DatasetManifest {
|
|
49
|
+
name: string;
|
|
50
|
+
provenance: DatasetProvenance;
|
|
51
|
+
/** sha256 hex over canonicalized scenarios. */
|
|
52
|
+
contentHash: string;
|
|
53
|
+
scenarioCount: number;
|
|
54
|
+
splitCounts: Record<DatasetSplit, number>;
|
|
55
|
+
}
|
|
56
|
+
interface SliceOptions {
|
|
57
|
+
split?: DatasetSplit;
|
|
58
|
+
difficulty?: DatasetDifficulty;
|
|
59
|
+
/** Number of scenarios (random sample, seeded). Omit to take all that match. */
|
|
60
|
+
limit?: number;
|
|
61
|
+
seed?: number;
|
|
62
|
+
/** Predicate narrowing. Applied after split/difficulty filters. */
|
|
63
|
+
filter?: (scenario: DatasetScenario) => boolean;
|
|
64
|
+
/** If true, include scenarios marked as holdout. Default false. */
|
|
65
|
+
includeHoldout?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/** Locked holdouts — throws on mutate. Callers that need a mutable dataset fork it. */
|
|
68
|
+
declare class HoldoutLockedError extends Error {
|
|
69
|
+
constructor(datasetName: string);
|
|
70
|
+
}
|
|
71
|
+
declare class Dataset {
|
|
72
|
+
readonly name: string;
|
|
73
|
+
readonly provenance: DatasetProvenance;
|
|
74
|
+
private scenarios;
|
|
75
|
+
private locked;
|
|
76
|
+
constructor(init: {
|
|
77
|
+
name: string;
|
|
78
|
+
provenance: DatasetProvenance;
|
|
79
|
+
scenarios: DatasetScenario[];
|
|
80
|
+
locked?: boolean;
|
|
81
|
+
});
|
|
82
|
+
/** All scenarios. Readonly — callers must go through `slice` or `clone`. */
|
|
83
|
+
all(): readonly DatasetScenario[];
|
|
84
|
+
get size(): number;
|
|
85
|
+
/**
|
|
86
|
+
* Deterministic sliced subset. Seed is REQUIRED when `limit` is set so
|
|
87
|
+
* the same arguments always produce the same slice across machines.
|
|
88
|
+
*/
|
|
89
|
+
slice(options?: SliceOptions): DatasetScenario[];
|
|
90
|
+
/**
|
|
91
|
+
* Assemble the manifest (name + provenance + content hash + counts).
|
|
92
|
+
* Content hash is deterministic over canonicalized scenarios.
|
|
93
|
+
*/
|
|
94
|
+
manifest(): Promise<DatasetManifest>;
|
|
95
|
+
/** Fresh unlocked copy — for post-release forks when mutation is needed. */
|
|
96
|
+
clone(overrides?: Partial<{
|
|
97
|
+
name: string;
|
|
98
|
+
version: string;
|
|
99
|
+
}>): Dataset;
|
|
100
|
+
lock(): void;
|
|
101
|
+
add(scenario: DatasetScenario): void;
|
|
102
|
+
remove(scenarioId: string): void;
|
|
103
|
+
/**
|
|
104
|
+
* Stable JSON-Lines serialization — deterministic byte-for-byte.
|
|
105
|
+
* Write to disk for contamination-verifiable archives.
|
|
106
|
+
*/
|
|
107
|
+
toJsonl(): string;
|
|
108
|
+
static fromJsonl(jsonl: string, manifest: Omit<DatasetManifest, 'contentHash' | 'scenarioCount' | 'splitCounts'>): Dataset;
|
|
109
|
+
}
|
|
110
|
+
declare function hashScenarios(scenarios: DatasetScenario[]): Promise<string>;
|
|
111
|
+
|
|
112
|
+
export { type DatasetSplit as D, HoldoutLockedError as H, type SliceOptions as S, type DatasetScenario as a, Dataset as b, type DatasetManifest as c, type DatasetDifficulty as d, type DatasetProvenance as e, hashScenarios as h };
|