@tangle-network/agent-eval 0.117.1 → 0.118.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/analyst/index.d.ts +2772 -21
- package/dist/analyst/index.js +7 -6
- package/dist/analyst/index.js.map +1 -1
- package/dist/belief-state/index.d.ts +706 -10
- package/dist/belief-state/index.js +2 -1
- package/dist/belief-state/index.js.map +1 -1
- package/dist/benchmarks/index.d.ts +958 -14
- package/dist/benchmarks/index.js +12 -10
- package/dist/builder-eval/index.d.ts +449 -4
- package/dist/builder-eval/index.js +4 -3
- package/dist/builder-eval/index.js.map +1 -1
- package/dist/campaign/index.d.ts +4275 -73
- package/dist/campaign/index.js +12 -10
- package/dist/{chunk-VF3XSYTI.js → chunk-33JA4TFA.js} +6 -6
- package/dist/{chunk-4JLWXDYA.js → chunk-3EHHMC6E.js} +2 -2
- package/dist/{chunk-CCZIVI3F.js → chunk-BFW56GTT.js} +2 -2
- package/dist/{chunk-YZPO4UHR.js → chunk-FTUMG2U7.js} +124 -149
- package/dist/chunk-FTUMG2U7.js.map +1 -0
- package/dist/{chunk-E4BUPP7Z.js → chunk-HKUCJ437.js} +38 -66
- package/dist/chunk-HKUCJ437.js.map +1 -0
- package/dist/{chunk-HZHNRYHK.js → chunk-K6N6XJJX.js} +2 -2
- package/dist/chunk-KSDQVPLR.js +286 -0
- package/dist/chunk-KSDQVPLR.js.map +1 -0
- package/dist/chunk-MA6HLL3S.js +65 -0
- package/dist/chunk-MA6HLL3S.js.map +1 -0
- package/dist/{chunk-MGEHEHSN.js → chunk-OIIMMLRB.js} +11 -11
- package/dist/{chunk-DXZRATT5.js → chunk-OYZAPX5G.js} +3 -3
- package/dist/chunk-PXE2VKMX.js +140 -0
- package/dist/chunk-PXE2VKMX.js.map +1 -0
- package/dist/{chunk-JSJZ4PJ6.js → chunk-Q442S5AS.js} +17 -17
- package/dist/{chunk-ODVOOEWQ.js → chunk-QBRSJK47.js} +2 -2
- package/dist/{chunk-S2F4J57L.js → chunk-QKEGNI5B.js} +77 -32
- package/dist/chunk-QKEGNI5B.js.map +1 -0
- package/dist/{chunk-5UF54T55.js → chunk-S3UZOQ5Y.js} +34 -7
- package/dist/chunk-S3UZOQ5Y.js.map +1 -0
- package/dist/{chunk-FQNLDL4D.js → chunk-SVH2ANFD.js} +136 -4
- package/dist/chunk-SVH2ANFD.js.map +1 -0
- package/dist/{chunk-GQCZRZ7L.js → chunk-U5CHZ5M3.js} +9 -9
- package/dist/{chunk-TVVP3ZZQ.js → chunk-VQMK5FMP.js} +2 -1
- package/dist/{chunk-TVVP3ZZQ.js.map → chunk-VQMK5FMP.js.map} +1 -1
- package/dist/chunk-WDHBCA3M.js +31 -0
- package/dist/chunk-WDHBCA3M.js.map +1 -0
- package/dist/{chunk-HQPHZGL6.js → chunk-YLMUS4MM.js} +9 -9
- package/dist/{chunk-LQUTGLOZ.js → chunk-ZET2UAYW.js} +15 -65
- package/dist/chunk-ZET2UAYW.js.map +1 -0
- package/dist/contract/index.d.ts +4012 -38
- package/dist/contract/index.js +56 -29
- package/dist/contract/index.js.map +1 -1
- package/dist/control.d.ts +1013 -9
- package/dist/control.js +4 -3
- package/dist/fuzz.d.ts +194 -4
- package/dist/fuzz.js +3 -3
- package/dist/hosted/index.d.ts +498 -17
- package/dist/index.d.ts +10992 -1288
- package/dist/index.js +101 -80
- package/dist/index.js.map +1 -1
- package/dist/matrix/index.d.ts +139 -4
- package/dist/meta-eval/index.d.ts +862 -15
- package/dist/meta-eval/index.js +2 -1
- package/dist/meta-eval/index.js.map +1 -1
- package/dist/multishot/index.d.ts +214 -14
- package/dist/openapi.json +1 -1
- package/dist/pipelines/index.d.ts +392 -7
- package/dist/pipelines/index.js +5 -3
- package/dist/pipelines/index.js.map +1 -1
- package/dist/reporting.d.ts +1277 -17
- package/dist/rl.d.ts +2359 -28
- package/dist/rl.js +6 -5
- package/dist/rl.js.map +1 -1
- package/dist/storyboard/index.d.ts +86 -1
- package/dist/trace-attributes.d.ts +16 -0
- package/dist/trace-attributes.js +32 -0
- package/dist/trace-attributes.js.map +1 -0
- package/dist/traces.d.ts +1978 -697
- package/dist/traces.js +53 -32
- package/dist/wire/index.d.ts +655 -9
- package/docs/insight-report.md +44 -0
- package/package.json +9 -3
- package/dist/adversarial-B7loGVVX.d.ts +0 -19
- package/dist/analyst-C8HHvfJp.d.ts +0 -88
- package/dist/analyze-runs--2x39HZ7.d.ts +0 -81
- package/dist/baseline-DKq3gJpP.d.ts +0 -141
- package/dist/calibration-C8MTS7cw.d.ts +0 -101
- package/dist/chunk-5UF54T55.js.map +0 -1
- package/dist/chunk-E4BUPP7Z.js.map +0 -1
- package/dist/chunk-FQNLDL4D.js.map +0 -1
- package/dist/chunk-LQUTGLOZ.js.map +0 -1
- package/dist/chunk-S2F4J57L.js.map +0 -1
- package/dist/chunk-YZPO4UHR.js.map +0 -1
- package/dist/code-agent-session-CjZsVd19.d.ts +0 -87
- package/dist/control-6vuGfmDH.d.ts +0 -258
- package/dist/cost-ledger-DWy3XdJc.d.ts +0 -183
- package/dist/dataset-NENEzRgk.d.ts +0 -115
- package/dist/default-registry-DaK8b3fv.d.ts +0 -155
- package/dist/emitter-CjD7vUwv.d.ts +0 -122
- package/dist/errors-oeQrLqXC.d.ts +0 -74
- package/dist/failure-cluster-DOAcSJ87.d.ts +0 -76
- package/dist/feedback-trajectory-BUnM58xL.d.ts +0 -348
- package/dist/gepa-eESocoDi.d.ts +0 -642
- package/dist/index-PdX4VnPA.d.ts +0 -423
- package/dist/insight-report-DY4nDW9Q.d.ts +0 -310
- package/dist/integrity-DqlBiLyK.d.ts +0 -81
- package/dist/judge-calibration-7C-IDmKr.d.ts +0 -145
- package/dist/kind-factory-ClZmO25A.d.ts +0 -171
- package/dist/llm-client-qoDd18Qz.d.ts +0 -289
- package/dist/multi-layer-verifier-BsqKuLyN.d.ts +0 -150
- package/dist/off-policy-DiwuKKg7.d.ts +0 -132
- package/dist/outcome-store-rnXLEqSn.d.ts +0 -63
- package/dist/policy-edit-wG9uFEFm.d.ts +0 -455
- package/dist/pre-registration-BWQhJ3vz.d.ts +0 -761
- package/dist/provenance-DpjwyseI.d.ts +0 -541
- package/dist/query-CF7PG61p.d.ts +0 -35
- package/dist/raw-provider-sink-C46HDghv.d.ts +0 -132
- package/dist/release-report-C8G2i5Xi.d.ts +0 -236
- package/dist/researcher-C8XyxQsu.d.ts +0 -387
- package/dist/rubric-predictive-validity-p49lLVrE.d.ts +0 -105
- package/dist/run-record-BDH49H2E.d.ts +0 -360
- package/dist/runtime-trajectory-DGBIUt4B.d.ts +0 -49
- package/dist/schema-B3Q3l9Z_.d.ts +0 -201
- package/dist/semantic-concept-judge-CXnPEJbf.d.ts +0 -723
- package/dist/sequential-5iSVfzl2.d.ts +0 -139
- package/dist/series-convergence-D5OWMBg6.d.ts +0 -33
- package/dist/statistics-KUnG73jH.d.ts +0 -494
- package/dist/storage-DrX3v_5B.d.ts +0 -50
- package/dist/store-C1YxJDEK.d.ts +0 -248
- package/dist/store-DGqD0Pyo.d.ts +0 -116
- package/dist/summary-report-C5bKFfm-.d.ts +0 -445
- package/dist/test-graded-scenario-B0ybnPY7.d.ts +0 -166
- package/dist/types-BSw1rOUB.d.ts +0 -634
- package/dist/types-BUxNaJ8c.d.ts +0 -108
- package/dist/types-BkfcQnxV.d.ts +0 -313
- package/dist/verdict-C9MlYujm.d.ts +0 -35
- /package/dist/{chunk-VF3XSYTI.js.map → chunk-33JA4TFA.js.map} +0 -0
- /package/dist/{chunk-4JLWXDYA.js.map → chunk-3EHHMC6E.js.map} +0 -0
- /package/dist/{chunk-CCZIVI3F.js.map → chunk-BFW56GTT.js.map} +0 -0
- /package/dist/{chunk-HZHNRYHK.js.map → chunk-K6N6XJJX.js.map} +0 -0
- /package/dist/{chunk-MGEHEHSN.js.map → chunk-OIIMMLRB.js.map} +0 -0
- /package/dist/{chunk-DXZRATT5.js.map → chunk-OYZAPX5G.js.map} +0 -0
- /package/dist/{chunk-JSJZ4PJ6.js.map → chunk-Q442S5AS.js.map} +0 -0
- /package/dist/{chunk-ODVOOEWQ.js.map → chunk-QBRSJK47.js.map} +0 -0
- /package/dist/{chunk-GQCZRZ7L.js.map → chunk-U5CHZ5M3.js.map} +0 -0
- /package/dist/{chunk-HQPHZGL6.js.map → chunk-YLMUS4MM.js.map} +0 -0
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { b as FeedbackLabel, A as ProposedSideEffect, a as ControlEvalResult, i as ControlRunResult, j as ControlRuntimeConfig } from './feedback-trajectory-BUnM58xL.js';
|
|
2
|
-
import { T as TraceEmitter } from './emitter-CjD7vUwv.js';
|
|
3
|
-
import { F as FailureClass } from './schema-B3Q3l9Z_.js';
|
|
4
|
-
import { T as TraceStore } from './store-DGqD0Pyo.js';
|
|
5
|
-
import { a as RunSplitTag, c as RunTokenUsage, R as RunRecord } from './run-record-BDH49H2E.js';
|
|
6
|
-
|
|
7
|
-
interface ActionExecutionPolicy {
|
|
8
|
-
allowedTypes?: string[];
|
|
9
|
-
blockedTypes?: string[];
|
|
10
|
-
alwaysRequireApprovalTypes?: string[];
|
|
11
|
-
autoApproveTypes?: string[];
|
|
12
|
-
requireApprovalForExternalSideEffects?: boolean;
|
|
13
|
-
requireApprovalAboveCostUsd?: number;
|
|
14
|
-
maxActionCostUsd?: number;
|
|
15
|
-
remainingBudgetUsd?: number;
|
|
16
|
-
expectedOutcomeRequired?: boolean;
|
|
17
|
-
killCriteriaRequired?: boolean;
|
|
18
|
-
}
|
|
19
|
-
interface ActionPolicyDecision {
|
|
20
|
-
allowed: boolean;
|
|
21
|
-
blocked: boolean;
|
|
22
|
-
requiresApproval: boolean;
|
|
23
|
-
reasons: string[];
|
|
24
|
-
label?: FeedbackLabel;
|
|
25
|
-
}
|
|
26
|
-
declare function evaluateActionPolicy(action: ProposedSideEffect, policy?: ActionExecutionPolicy, options?: {
|
|
27
|
-
createdAt?: string;
|
|
28
|
-
}): ActionPolicyDecision;
|
|
29
|
-
|
|
30
|
-
interface RunEvidenceMetadata {
|
|
31
|
-
experimentId: string;
|
|
32
|
-
candidateId: string;
|
|
33
|
-
seed: number;
|
|
34
|
-
model: string;
|
|
35
|
-
promptHash: string;
|
|
36
|
-
configHash: string;
|
|
37
|
-
commitSha: string;
|
|
38
|
-
splitTag: RunSplitTag;
|
|
39
|
-
tokenUsage: RunTokenUsage;
|
|
40
|
-
queueMs?: number;
|
|
41
|
-
judgeMetadata?: RunRecord['judgeMetadata'];
|
|
42
|
-
raw?: Record<string, number>;
|
|
43
|
-
}
|
|
44
|
-
interface ControlRunToRunRecordOptions extends RunEvidenceMetadata {
|
|
45
|
-
runId?: string;
|
|
46
|
-
score?: number;
|
|
47
|
-
failureMode?: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Project a completed control-loop run into the strict RunRecord shape used by
|
|
51
|
-
* release gates, optimizer tables, and research reports.
|
|
52
|
-
*
|
|
53
|
-
* The control loop owns live execution evidence. The caller still supplies the
|
|
54
|
-
* experiment-cell metadata because prompt/config hashes, split assignment,
|
|
55
|
-
* model snapshot, and commit SHA are product/harness concerns.
|
|
56
|
-
*/
|
|
57
|
-
declare function controlRunToRunRecord<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult>(run: ControlRunResult<TState, TAction, TActionResult, TEval>, options: ControlRunToRunRecordOptions): RunRecord;
|
|
58
|
-
declare function scoreFromEvals(evals: readonly ControlEvalResult[]): number | undefined;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Propose / Verify / Review — the core multi-shot primitive.
|
|
62
|
-
*
|
|
63
|
-
* shot N: propose(state, priorReview) → new state
|
|
64
|
-
* verify(state) → pass/fail, optional layers
|
|
65
|
-
* review(state, verification, memory) → observations + next-shot
|
|
66
|
-
* instruction + shouldContinue
|
|
67
|
-
* memory.append(entry)
|
|
68
|
-
*
|
|
69
|
-
* Roles are strictly separated:
|
|
70
|
-
*
|
|
71
|
-
* - The WORKER is whatever the caller wraps in `propose`. It is
|
|
72
|
-
* stateful — caller owns its resume/session mechanism.
|
|
73
|
-
* - The VERIFIER grades the state. It produces the ground truth.
|
|
74
|
-
* The reviewer cannot overturn or downgrade a verification layer.
|
|
75
|
-
* - The REVIEWER is stateless per call. Its continuity is the
|
|
76
|
-
* `ReviewMemoryStore` — durable JSONL by default, or any store
|
|
77
|
-
* implementing the interface. It reads memory + trace summary +
|
|
78
|
-
* verification and directs the NEXT proposer shot.
|
|
79
|
-
*
|
|
80
|
-
* This shape is load-bearing. The reviewer never grades; the verifier
|
|
81
|
-
* never directs. Two processes, two prompts, two concerns — which is
|
|
82
|
-
* what keeps the loop from confirmation-biasing itself into "all
|
|
83
|
-
* passed" when it didn't.
|
|
84
|
-
*
|
|
85
|
-
* Short-circuits and soft-fails are both first-class:
|
|
86
|
-
* - verify.pass === true → reviewer LLM call is skipped, memory
|
|
87
|
-
* records a success entry, loop exits.
|
|
88
|
-
* - review throws → the shot still counts; the loop uses the
|
|
89
|
-
* last-known instruction (or `fallbackInstruction`) for the next
|
|
90
|
-
* propose call. A transient reviewer failure must NEVER abort a
|
|
91
|
-
* valid arc.
|
|
92
|
-
*
|
|
93
|
-
* Composable: `propose` itself can be another `runProposeReview` call.
|
|
94
|
-
* That's the dogfooding path — a harness built on this primitive is in
|
|
95
|
-
* turn evaluable by it.
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
|
-
interface Verification {
|
|
99
|
-
pass: boolean;
|
|
100
|
-
score?: number;
|
|
101
|
-
failingLayers?: string[];
|
|
102
|
-
details?: unknown;
|
|
103
|
-
}
|
|
104
|
-
interface Review {
|
|
105
|
-
observations: string;
|
|
106
|
-
diagnosis: string;
|
|
107
|
-
nextShotInstruction: string;
|
|
108
|
-
shouldContinue: boolean;
|
|
109
|
-
confidence: number;
|
|
110
|
-
}
|
|
111
|
-
interface ReviewMemoryEntry extends Review {
|
|
112
|
-
shot: number;
|
|
113
|
-
timestamp: number;
|
|
114
|
-
verification: {
|
|
115
|
-
pass: boolean;
|
|
116
|
-
score?: number;
|
|
117
|
-
failingLayers?: string[];
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
interface ProposeInput<State> {
|
|
121
|
-
shot: number;
|
|
122
|
-
goal: string;
|
|
123
|
-
state: State;
|
|
124
|
-
priorReview: Review | null;
|
|
125
|
-
abortSignal: AbortSignal;
|
|
126
|
-
emitter?: TraceEmitter;
|
|
127
|
-
}
|
|
128
|
-
interface ProposeOutput<State, Summary = unknown> {
|
|
129
|
-
state: State;
|
|
130
|
-
traceSummary?: Summary;
|
|
131
|
-
}
|
|
132
|
-
interface ReviewInput<State, Summary = unknown> {
|
|
133
|
-
shot: number;
|
|
134
|
-
goal: string;
|
|
135
|
-
state: State;
|
|
136
|
-
verification: Verification;
|
|
137
|
-
traceSummary: Summary | undefined;
|
|
138
|
-
memory: ReviewMemoryEntry[];
|
|
139
|
-
}
|
|
140
|
-
type ProposeFn<State, Summary = unknown> = (input: ProposeInput<State>) => Promise<ProposeOutput<State, Summary>>;
|
|
141
|
-
type VerifyFn<State> = (state: State) => Promise<Verification>;
|
|
142
|
-
type ReviewFn<State, Summary = unknown> = (input: ReviewInput<State, Summary>) => Promise<Review>;
|
|
143
|
-
interface ReviewMemoryStore {
|
|
144
|
-
load(): Promise<ReviewMemoryEntry[]>;
|
|
145
|
-
append(entry: ReviewMemoryEntry): Promise<void>;
|
|
146
|
-
}
|
|
147
|
-
interface ProposeReviewConfig<State, Summary = unknown> {
|
|
148
|
-
goal: string;
|
|
149
|
-
initialState: State;
|
|
150
|
-
propose: ProposeFn<State, Summary>;
|
|
151
|
-
verify: VerifyFn<State>;
|
|
152
|
-
review: ReviewFn<State, Summary>;
|
|
153
|
-
/** Hard shot cap. Default 10. */
|
|
154
|
-
maxShots?: number;
|
|
155
|
-
/** Wall-clock cap in ms. Default 10 min. */
|
|
156
|
-
maxWallMs?: number;
|
|
157
|
-
/**
|
|
158
|
-
* If the reviewer returns confidence ≤ floor on `confidenceFloorWindow`
|
|
159
|
-
* consecutive shots, terminate early. Default floor 0.3, window 2.
|
|
160
|
-
* Set window to 0 or floor to <0 to disable.
|
|
161
|
-
*/
|
|
162
|
-
confidenceFloor?: number;
|
|
163
|
-
confidenceFloorWindow?: number;
|
|
164
|
-
/** Defaults to an in-memory store if omitted. */
|
|
165
|
-
memory?: ReviewMemoryStore;
|
|
166
|
-
/** If provided, emit a Run + per-shot spans. */
|
|
167
|
-
store?: TraceStore;
|
|
168
|
-
scenarioId?: string;
|
|
169
|
-
projectId?: string;
|
|
170
|
-
variantId?: string;
|
|
171
|
-
/**
|
|
172
|
-
* Used when the reviewer soft-fails on shot 1 (no prior instruction to
|
|
173
|
-
* fall back to). Default is a generic "inspect failures and fix".
|
|
174
|
-
*/
|
|
175
|
-
fallbackInstruction?: string;
|
|
176
|
-
}
|
|
177
|
-
interface ProposeReviewShot<State, Summary = unknown> {
|
|
178
|
-
shot: number;
|
|
179
|
-
state: State;
|
|
180
|
-
verification: Verification;
|
|
181
|
-
traceSummary: Summary | undefined;
|
|
182
|
-
review: Review;
|
|
183
|
-
reviewAvailable: boolean;
|
|
184
|
-
reviewError?: string;
|
|
185
|
-
durationMs: number;
|
|
186
|
-
}
|
|
187
|
-
interface ProposeReviewReport<State, Summary = unknown> {
|
|
188
|
-
runId: string | null;
|
|
189
|
-
completed: boolean;
|
|
190
|
-
shots: ProposeReviewShot<State, Summary>[];
|
|
191
|
-
finalState: State;
|
|
192
|
-
finalVerification: Verification;
|
|
193
|
-
failureClass?: FailureClass;
|
|
194
|
-
wallMs: number;
|
|
195
|
-
score: number;
|
|
196
|
-
}
|
|
197
|
-
declare function inMemoryReviewStore(initial?: ReviewMemoryEntry[]): ReviewMemoryStore;
|
|
198
|
-
declare function jsonlReviewStore(path: string): ReviewMemoryStore;
|
|
199
|
-
declare function runProposeReview<State, Summary = unknown>(config: ProposeReviewConfig<State, Summary>): Promise<ProposeReviewReport<State, Summary>>;
|
|
200
|
-
type LlmJsonCall = (req: {
|
|
201
|
-
system: string;
|
|
202
|
-
user: string;
|
|
203
|
-
}) => Promise<unknown>;
|
|
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 };
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { V as ValidationError } from './errors-oeQrLqXC.js';
|
|
2
|
-
|
|
3
|
-
type CostChannel = 'agent' | 'judge' | 'verifier' | 'analyst' | 'driver' | (string & {});
|
|
4
|
-
interface CostUsage {
|
|
5
|
-
inputTokens: number;
|
|
6
|
-
outputTokens: number;
|
|
7
|
-
cachedTokens?: number;
|
|
8
|
-
}
|
|
9
|
-
interface CostCallBase {
|
|
10
|
-
callId: string;
|
|
11
|
-
channel: CostChannel;
|
|
12
|
-
phase: string;
|
|
13
|
-
actor: string;
|
|
14
|
-
model: string;
|
|
15
|
-
maximumCostUsd?: number;
|
|
16
|
-
tags?: Record<string, string>;
|
|
17
|
-
timestamp: number;
|
|
18
|
-
}
|
|
19
|
-
interface CostReceipt extends CostCallBase, CostUsage {
|
|
20
|
-
status: 'settled';
|
|
21
|
-
costUsd: number;
|
|
22
|
-
costUnknown: boolean;
|
|
23
|
-
usageUnknown?: boolean;
|
|
24
|
-
pricing?: {
|
|
25
|
-
inputUsdPerThousand: number;
|
|
26
|
-
outputUsdPerThousand: number;
|
|
27
|
-
};
|
|
28
|
-
actualCostUsd?: number;
|
|
29
|
-
error?: string;
|
|
30
|
-
}
|
|
31
|
-
/** @deprecated Read-only compatibility shape. New paid work uses `runPaidCall`. */
|
|
32
|
-
type CostLedgerEntry = Omit<CostReceipt, 'status' | 'callId' | 'phase' | 'actor' | 'maximumCostUsd' | 'usageUnknown' | 'pricing' | 'error'>;
|
|
33
|
-
interface CostReceiptInput extends CostUsage {
|
|
34
|
-
model: string;
|
|
35
|
-
actualCostUsd?: number;
|
|
36
|
-
costUnknown?: boolean;
|
|
37
|
-
usageUnknown?: boolean;
|
|
38
|
-
}
|
|
39
|
-
type MaximumCharge = {
|
|
40
|
-
externallyEnforcedMaximumUsd: number;
|
|
41
|
-
} | ({
|
|
42
|
-
model: string;
|
|
43
|
-
} & CostUsage);
|
|
44
|
-
interface RunPaidCallInput<T> {
|
|
45
|
-
callId?: string;
|
|
46
|
-
channel: CostChannel;
|
|
47
|
-
phase: string;
|
|
48
|
-
actor: string;
|
|
49
|
-
/** Used before a provider receipt exists and on failures without one. */
|
|
50
|
-
model?: string;
|
|
51
|
-
tags?: Record<string, string>;
|
|
52
|
-
signal?: AbortSignal;
|
|
53
|
-
/** Provider-enforced dollar maximum, or maximum priced token usage. Required when capped. */
|
|
54
|
-
maximumCharge?: MaximumCharge;
|
|
55
|
-
/** `callId` can be forwarded as the provider's idempotency key. */
|
|
56
|
-
execute(signal: AbortSignal, callId: string): Promise<T>;
|
|
57
|
-
receipt(value: T): CostReceiptInput;
|
|
58
|
-
receiptFromError?(error: Error): CostReceiptInput | undefined;
|
|
59
|
-
}
|
|
60
|
-
type PaidCallResult<T> = {
|
|
61
|
-
succeeded: true;
|
|
62
|
-
callId: string;
|
|
63
|
-
value: T;
|
|
64
|
-
receipt: CostReceipt;
|
|
65
|
-
} | {
|
|
66
|
-
succeeded: false;
|
|
67
|
-
callId?: string;
|
|
68
|
-
error: Error;
|
|
69
|
-
receipt?: CostReceipt;
|
|
70
|
-
};
|
|
71
|
-
interface ChannelRollup {
|
|
72
|
-
channel: CostChannel;
|
|
73
|
-
calls: number;
|
|
74
|
-
inputTokens: number;
|
|
75
|
-
outputTokens: number;
|
|
76
|
-
cachedTokens: number;
|
|
77
|
-
costUsd: number;
|
|
78
|
-
unpricedCalls: number;
|
|
79
|
-
unknownUsageCalls: number;
|
|
80
|
-
}
|
|
81
|
-
interface CostLedgerSummary {
|
|
82
|
-
totalCalls: number;
|
|
83
|
-
pendingCalls: number;
|
|
84
|
-
unresolvedCalls: number;
|
|
85
|
-
reservedCostUsd: number;
|
|
86
|
-
inputTokens: number;
|
|
87
|
-
outputTokens: number;
|
|
88
|
-
cachedTokens: number;
|
|
89
|
-
totalCostUsd: number;
|
|
90
|
-
byChannel: ChannelRollup[];
|
|
91
|
-
unpricedModels: string[];
|
|
92
|
-
fullyPriced: boolean;
|
|
93
|
-
usageComplete: boolean;
|
|
94
|
-
accountingComplete: boolean;
|
|
95
|
-
incompleteReasons: string[];
|
|
96
|
-
}
|
|
97
|
-
interface CostLedgerFilter {
|
|
98
|
-
channel?: CostChannel;
|
|
99
|
-
phase?: string;
|
|
100
|
-
tags?: Record<string, string>;
|
|
101
|
-
}
|
|
102
|
-
/** Append-only storage. `append` must atomically reject stale revisions. */
|
|
103
|
-
interface CostLedgerPersistence {
|
|
104
|
-
read(): {
|
|
105
|
-
revision: string;
|
|
106
|
-
events: string;
|
|
107
|
-
};
|
|
108
|
-
append(expectedRevision: string, event: string): string | undefined;
|
|
109
|
-
}
|
|
110
|
-
interface CostLedgerOptions {
|
|
111
|
-
costCeilingUsd?: number;
|
|
112
|
-
persistence?: CostLedgerPersistence;
|
|
113
|
-
/** Import already-settled receipts without admitting new paid work. */
|
|
114
|
-
receipts?: readonly CostReceipt[];
|
|
115
|
-
}
|
|
116
|
-
declare class CostCeilingReachedError extends ValidationError {
|
|
117
|
-
constructor(ceilingUsd: number, committedAndReservedUsd: number, requestedUsd: number, phase: string, actor: string);
|
|
118
|
-
}
|
|
119
|
-
declare class CostAccountingIncompleteError extends ValidationError {
|
|
120
|
-
}
|
|
121
|
-
declare class CostReservationExceededError extends ValidationError {
|
|
122
|
-
constructor(actor: string, actualUsd: number, maximumUsd: number);
|
|
123
|
-
}
|
|
124
|
-
declare class CostCallConflictError extends ValidationError {
|
|
125
|
-
readonly callId?: string;
|
|
126
|
-
readonly receipt?: CostReceipt;
|
|
127
|
-
constructor(message: string, options?: {
|
|
128
|
-
callId?: string;
|
|
129
|
-
receipt?: CostReceipt;
|
|
130
|
-
cause?: unknown;
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
declare class CostLedgerPersistenceError extends ValidationError {
|
|
134
|
-
readonly callId?: string;
|
|
135
|
-
readonly receipt?: CostReceipt;
|
|
136
|
-
constructor(cause: unknown, callId?: string, receipt?: CostReceipt);
|
|
137
|
-
}
|
|
138
|
-
declare class CostReceiptCaptureError extends ValidationError {
|
|
139
|
-
readonly callId: string;
|
|
140
|
-
readonly receipt?: CostReceipt;
|
|
141
|
-
readonly receiptError: Error;
|
|
142
|
-
constructor(callId: string, cause: unknown, receiptError: unknown, receipt?: CostReceipt);
|
|
143
|
-
}
|
|
144
|
-
/** Run-wide paid-call admission, durable call state, receipts, and summaries. */
|
|
145
|
-
declare class CostLedger {
|
|
146
|
-
private readonly records;
|
|
147
|
-
private readonly activeCallIds;
|
|
148
|
-
private readonly lateCallIds;
|
|
149
|
-
private completedTasks;
|
|
150
|
-
private revision;
|
|
151
|
-
private costLimitPersisted;
|
|
152
|
-
readonly costCeilingUsd?: number;
|
|
153
|
-
private readonly persistence?;
|
|
154
|
-
constructor(input?: number | CostLedgerOptions);
|
|
155
|
-
runPaidCall<T>(input: RunPaidCallInput<T>): Promise<PaidCallResult<T>>;
|
|
156
|
-
/** Settle a call left pending by a crashed process after reconciling with the provider. */
|
|
157
|
-
reconcile(callId: string, observed: CostReceiptInput, options?: {
|
|
158
|
-
error?: string;
|
|
159
|
-
}): CostReceipt;
|
|
160
|
-
list(filter?: CostLedgerFilter): CostReceipt[];
|
|
161
|
-
summary(filter?: CostLedgerFilter): CostLedgerSummary;
|
|
162
|
-
markCompleted(count?: number): void;
|
|
163
|
-
costPerCompletedTask(): number | null;
|
|
164
|
-
private execute;
|
|
165
|
-
private captureLateOutcome;
|
|
166
|
-
private commitOutcome;
|
|
167
|
-
private captureFailure;
|
|
168
|
-
private commitReceipt;
|
|
169
|
-
private resolveMaximum;
|
|
170
|
-
private hasIncompleteSettledCall;
|
|
171
|
-
private appendRecord;
|
|
172
|
-
private ensureCostLimitPersisted;
|
|
173
|
-
private appendEvent;
|
|
174
|
-
}
|
|
175
|
-
/** Return the canonical pricing-table key, or null when the model is unpriced. */
|
|
176
|
-
declare function modelPriceKey(model: string): string | null;
|
|
177
|
-
interface CostResult {
|
|
178
|
-
costUsd: number;
|
|
179
|
-
costUnknown: boolean;
|
|
180
|
-
}
|
|
181
|
-
declare function costForUsage(model: string, usage: CostUsage): CostResult;
|
|
182
|
-
|
|
183
|
-
export { CostLedger as C, type MaximumCharge as M, type PaidCallResult as P, type RunPaidCallInput as R, type CostChannel as a, type CostLedgerSummary as b, type CostReceiptInput as c, type CostReceipt as d, type ChannelRollup as e, CostAccountingIncompleteError as f, CostCallConflictError as g, CostCeilingReachedError as h, type CostLedgerEntry as i, type CostLedgerFilter as j, type CostLedgerOptions as k, type CostLedgerPersistence as l, CostLedgerPersistenceError as m, CostReceiptCaptureError as n, CostReservationExceededError as o, type CostResult as p, type CostUsage as q, costForUsage as r, modelPriceKey as s };
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { V as ValidationError } from './errors-oeQrLqXC.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Dataset — versioned, sliceable, content-hashed scenario collection.
|
|
5
|
-
*
|
|
6
|
-
* Scenarios stop being ephemeral arrays and become first-class
|
|
7
|
-
* artifacts. Every Dataset carries:
|
|
8
|
-
* - content hash (sha256 over canonicalized scenario array)
|
|
9
|
-
* - provenance (contributor, createdAt, sourceUrl)
|
|
10
|
-
* - split labels (train | dev | test | holdout)
|
|
11
|
-
* - difficulty tiers (easy | medium | hard | extreme)
|
|
12
|
-
* - tags (free-form, per-scenario)
|
|
13
|
-
*
|
|
14
|
-
* `Dataset.slice({ difficulty, split, holdout, seed })` returns a
|
|
15
|
-
* deterministic, reproducible subset. Holdout slices are locked: you
|
|
16
|
-
* can read them but `mutate` throws, which prevents "oh I'll just
|
|
17
|
-
* tweak that one scenario" contamination drift.
|
|
18
|
-
*/
|
|
19
|
-
type DatasetSplit = 'train' | 'dev' | 'test' | 'holdout';
|
|
20
|
-
type DatasetDifficulty = 'easy' | 'medium' | 'hard' | 'extreme';
|
|
21
|
-
interface DatasetScenario {
|
|
22
|
-
id: string;
|
|
23
|
-
/** Arbitrary payload; the framework doesn't interpret it. */
|
|
24
|
-
payload: unknown;
|
|
25
|
-
split?: DatasetSplit;
|
|
26
|
-
difficulty?: DatasetDifficulty;
|
|
27
|
-
/** Canary token that MUST NOT round-trip through a correct agent output. */
|
|
28
|
-
canary?: string;
|
|
29
|
-
/**
|
|
30
|
-
* Behavioral-canary forbidden pattern. A string OR a serialized regex
|
|
31
|
-
* (`/.../flags`) that the agent under test MUST NOT emit. Used by
|
|
32
|
-
* {@link import('./canary').checkBehavioralCanary | checkBehavioralCanary},
|
|
33
|
-
* which inverts the contamination-style semantic: presence in the
|
|
34
|
-
* agent output is a LEAK / failure, not a positive signal.
|
|
35
|
-
*
|
|
36
|
-
* Falls back to {@link canary} when omitted.
|
|
37
|
-
*/
|
|
38
|
-
forbiddenPattern?: string;
|
|
39
|
-
tags?: Record<string, string>;
|
|
40
|
-
}
|
|
41
|
-
interface DatasetProvenance {
|
|
42
|
-
contributor?: string;
|
|
43
|
-
createdAt: string;
|
|
44
|
-
sourceUrl?: string;
|
|
45
|
-
license?: string;
|
|
46
|
-
description?: string;
|
|
47
|
-
/** Monotonic human-readable version (e.g. "2026.04.20"). */
|
|
48
|
-
version: string;
|
|
49
|
-
}
|
|
50
|
-
interface DatasetManifest {
|
|
51
|
-
name: string;
|
|
52
|
-
provenance: DatasetProvenance;
|
|
53
|
-
/** sha256 hex over canonicalized scenarios. */
|
|
54
|
-
contentHash: string;
|
|
55
|
-
scenarioCount: number;
|
|
56
|
-
splitCounts: Record<DatasetSplit, number>;
|
|
57
|
-
}
|
|
58
|
-
interface SliceOptions {
|
|
59
|
-
split?: DatasetSplit;
|
|
60
|
-
difficulty?: DatasetDifficulty;
|
|
61
|
-
/** Number of scenarios (random sample, seeded). Omit to take all that match. */
|
|
62
|
-
limit?: number;
|
|
63
|
-
seed?: number;
|
|
64
|
-
/** Predicate narrowing. Applied after split/difficulty filters. */
|
|
65
|
-
filter?: (scenario: DatasetScenario) => boolean;
|
|
66
|
-
/** If true, include scenarios marked as holdout. Default false. */
|
|
67
|
-
includeHoldout?: boolean;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** Locked holdouts — throws on mutate. Callers that need a mutable dataset fork it. */
|
|
71
|
-
declare class HoldoutLockedError extends ValidationError {
|
|
72
|
-
constructor(datasetName: string);
|
|
73
|
-
}
|
|
74
|
-
declare class Dataset {
|
|
75
|
-
readonly name: string;
|
|
76
|
-
readonly provenance: DatasetProvenance;
|
|
77
|
-
private scenarios;
|
|
78
|
-
private locked;
|
|
79
|
-
constructor(init: {
|
|
80
|
-
name: string;
|
|
81
|
-
provenance: DatasetProvenance;
|
|
82
|
-
scenarios: DatasetScenario[];
|
|
83
|
-
locked?: boolean;
|
|
84
|
-
});
|
|
85
|
-
/** All scenarios. Readonly — callers must go through `slice` or `clone`. */
|
|
86
|
-
all(): readonly DatasetScenario[];
|
|
87
|
-
get size(): number;
|
|
88
|
-
/**
|
|
89
|
-
* Deterministic sliced subset. Seed is REQUIRED when `limit` is set so
|
|
90
|
-
* the same arguments always produce the same slice across machines.
|
|
91
|
-
*/
|
|
92
|
-
slice(options?: SliceOptions): DatasetScenario[];
|
|
93
|
-
/**
|
|
94
|
-
* Assemble the manifest (name + provenance + content hash + counts).
|
|
95
|
-
* Content hash is deterministic over canonicalized scenarios.
|
|
96
|
-
*/
|
|
97
|
-
manifest(): Promise<DatasetManifest>;
|
|
98
|
-
/** Fresh unlocked copy — for post-release forks when mutation is needed. */
|
|
99
|
-
clone(overrides?: Partial<{
|
|
100
|
-
name: string;
|
|
101
|
-
version: string;
|
|
102
|
-
}>): Dataset;
|
|
103
|
-
lock(): void;
|
|
104
|
-
add(scenario: DatasetScenario): void;
|
|
105
|
-
remove(scenarioId: string): void;
|
|
106
|
-
/**
|
|
107
|
-
* Stable JSON-Lines serialization — deterministic byte-for-byte.
|
|
108
|
-
* Write to disk for contamination-verifiable archives.
|
|
109
|
-
*/
|
|
110
|
-
toJsonl(): string;
|
|
111
|
-
static fromJsonl(jsonl: string, manifest: Omit<DatasetManifest, 'contentHash' | 'scenarioCount' | 'splitCounts'>): Dataset;
|
|
112
|
-
}
|
|
113
|
-
declare function hashScenarios(scenarios: DatasetScenario[]): Promise<string>;
|
|
114
|
-
|
|
115
|
-
export { type DatasetScenario as D, HoldoutLockedError as H, type SliceOptions as S, type DatasetSplit as a, type DatasetManifest as b, Dataset as c, type DatasetDifficulty as d, type DatasetProvenance as e, hashScenarios as h };
|