@agentskit/harness 0.1.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.
- package/CHANGELOG.md +77 -0
- package/CODE_OF_CONDUCT.md +5 -0
- package/CONTRIBUTING.md +26 -0
- package/LICENSE +21 -0
- package/README.md +473 -0
- package/SECURITY.md +11 -0
- package/dist/cli.js +1308 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +968 -0
- package/dist/index.js +1828 -0
- package/dist/index.js.map +1 -0
- package/docs/ADR-0001-extensible-kernel.md +41 -0
- package/docs/ADR-0002-profiles-and-context.md +22 -0
- package/docs/ADR-0003-doc-bridge-context-binding.md +36 -0
- package/docs/ADR-0004-run-metrics.md +29 -0
- package/docs/ADR-0005-benchmark-manifest.md +27 -0
- package/docs/ADR-0006-agent-session-protocol.md +36 -0
- package/docs/ADR-0007-policy-gate.md +33 -0
- package/docs/ADR-0008-runtime-executor.md +33 -0
- package/docs/ADR-0009-process-runtime-boundary.md +34 -0
- package/docs/ADR-0010-docker-sandbox-runtime.md +32 -0
- package/docs/ADR-0011-runtime-attestation.md +30 -0
- package/docs/ADR-0012-controlled-baseline-observations.md +27 -0
- package/docs/ADR-0013-honest-benchmark-comparability.md +27 -0
- package/docs/ADR-0014-criterion-level-benchmark-evidence.md +24 -0
- package/docs/ADR-0015-directional-benchmark-outcomes.md +23 -0
- package/docs/ADR-0016-baseline-evidence-digests.md +21 -0
- package/docs/ADR-0017-event-log-integrity.md +25 -0
- package/docs/ADR-0018-verification-projection-attestation.md +23 -0
- package/docs/ADR-0019-human-decision-attestation.md +27 -0
- package/docs/ADR-0020-terminal-reconciliation.md +26 -0
- package/docs/ADR-0021-event-lock-recovery.md +25 -0
- package/docs/ADR-0022-signed-evidence-bundle.md +27 -0
- package/docs/ADR-0023-safe-action-recovery.md +30 -0
- package/docs/ADR-0024-controlled-completion-metrics.md +27 -0
- package/docs/ADR-0025-ci-dogfood.md +22 -0
- package/docs/ADR-0026-ci-evidence-artifact.md +22 -0
- package/docs/ADR-0027-portable-evidence.md +19 -0
- package/docs/ADR-0028-effective-metrics.md +20 -0
- package/docs/ADR-0029-honest-ci-preparation.md +20 -0
- package/docs/ADR-0030-agentskit-os-benchmark-bridge.md +20 -0
- package/docs/ADR-0031-real-provider-baseline.md +18 -0
- package/docs/ADR-0032-harness-equivalent-benchmark.md +25 -0
- package/docs/ADR-0033-portable-agent-gate.md +25 -0
- package/docs/ADR-0034-measurement-quality-gates.md +25 -0
- package/docs/ADR-0035-reproducible-benchmark-samples.md +20 -0
- package/docs/ADR-0036-comparable-baseline-samples.md +20 -0
- package/docs/ADR-0037-replicated-baseline-collection.md +27 -0
- package/docs/ADR-0038-end-to-end-benchmark-boundary.md +28 -0
- package/docs/ADR-0039-artifact-and-protocol-metrics.md +39 -0
- package/docs/ADR-0040-benchmark-corpus-surfaces.md +32 -0
- package/package.json +68 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,968 @@
|
|
|
1
|
+
declare const STATES: readonly ["CLARIFYING", "PLANNED", "IMPLEMENTING", "VERIFYING", "AWAITING_HUMAN_APPROVAL", "AWAITING_AUTHORIZATION", "COMPLETE", "BLOCKED", "STALE", "CANCELLED", "SUPERSEDED"];
|
|
2
|
+
declare const LEGAL_TRANSITIONS: {
|
|
3
|
+
readonly CLARIFYING: readonly ["PLANNED", "BLOCKED", "CANCELLED"];
|
|
4
|
+
readonly PLANNED: readonly ["IMPLEMENTING", "CLARIFYING", "STALE", "CANCELLED"];
|
|
5
|
+
readonly IMPLEMENTING: readonly ["VERIFYING", "CLARIFYING", "STALE", "CANCELLED"];
|
|
6
|
+
readonly VERIFYING: readonly ["AWAITING_HUMAN_APPROVAL", "BLOCKED", "STALE", "CANCELLED"];
|
|
7
|
+
readonly AWAITING_HUMAN_APPROVAL: readonly ["AWAITING_AUTHORIZATION", "COMPLETE", "BLOCKED", "IMPLEMENTING", "STALE", "CANCELLED"];
|
|
8
|
+
readonly AWAITING_AUTHORIZATION: readonly ["COMPLETE", "BLOCKED", "IMPLEMENTING", "STALE", "CANCELLED"];
|
|
9
|
+
readonly COMPLETE: readonly ["STALE", "SUPERSEDED"];
|
|
10
|
+
readonly BLOCKED: readonly ["SUPERSEDED"];
|
|
11
|
+
readonly STALE: readonly ["SUPERSEDED", "PLANNED"];
|
|
12
|
+
readonly CANCELLED: readonly ["SUPERSEDED"];
|
|
13
|
+
readonly SUPERSEDED: readonly [];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type HarnessErrorCode = 'HARNESS_ERROR' | 'INVALID_CONFIG' | 'INVALID_INPUT' | 'INVALID_STATE' | 'POLICY_BLOCKED' | 'CLARIFYING' | 'STALE' | 'WORKTREE_DIRTY' | 'ACTIVE_RUN' | 'NO_RUN' | 'HUMAN_APPROVAL_REQUIRED';
|
|
17
|
+
declare class HarnessError extends Error {
|
|
18
|
+
readonly code: HarnessErrorCode;
|
|
19
|
+
constructor(message: string, code?: HarnessErrorCode);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface ToolExecutionRequest {
|
|
23
|
+
readonly actionId: string;
|
|
24
|
+
readonly turnId: string;
|
|
25
|
+
readonly toolId: string;
|
|
26
|
+
readonly argumentsHash: string;
|
|
27
|
+
readonly arguments: unknown;
|
|
28
|
+
readonly signal: AbortSignal;
|
|
29
|
+
}
|
|
30
|
+
interface ToolDefinition {
|
|
31
|
+
readonly toolId: string;
|
|
32
|
+
readonly execute: (request: ToolExecutionRequest) => Promise<unknown> | unknown;
|
|
33
|
+
}
|
|
34
|
+
interface ToolRuntime {
|
|
35
|
+
execute(request: Omit<ToolExecutionRequest, 'signal'>): Promise<ToolExecutionResult>;
|
|
36
|
+
}
|
|
37
|
+
interface ProcessToolDefinition {
|
|
38
|
+
readonly toolId: string;
|
|
39
|
+
readonly command: string;
|
|
40
|
+
readonly args?: readonly string[];
|
|
41
|
+
readonly cwd?: string;
|
|
42
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
43
|
+
}
|
|
44
|
+
interface DockerMount {
|
|
45
|
+
readonly source: string;
|
|
46
|
+
readonly target: string;
|
|
47
|
+
readonly readOnly?: boolean;
|
|
48
|
+
}
|
|
49
|
+
interface DockerToolDefinition {
|
|
50
|
+
readonly toolId: string;
|
|
51
|
+
readonly image: string;
|
|
52
|
+
readonly command: readonly string[];
|
|
53
|
+
readonly args?: readonly string[];
|
|
54
|
+
readonly cwd?: string;
|
|
55
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
56
|
+
readonly mounts?: readonly DockerMount[];
|
|
57
|
+
}
|
|
58
|
+
interface DockerRuntimeEvidence {
|
|
59
|
+
readonly provider: 'docker';
|
|
60
|
+
readonly profileHash: string;
|
|
61
|
+
readonly image: string;
|
|
62
|
+
readonly imageDigest?: string;
|
|
63
|
+
readonly network: 'none';
|
|
64
|
+
readonly readOnlyRootFilesystem: true;
|
|
65
|
+
readonly noNewPrivileges: true;
|
|
66
|
+
readonly capabilities: 'drop-all';
|
|
67
|
+
readonly user: string;
|
|
68
|
+
readonly memoryLimit: string;
|
|
69
|
+
readonly cpus: string;
|
|
70
|
+
readonly pidsLimit: number;
|
|
71
|
+
}
|
|
72
|
+
type ToolExecutionResult = {
|
|
73
|
+
readonly status: 'completed';
|
|
74
|
+
readonly resultHash: string;
|
|
75
|
+
readonly durationMs: number;
|
|
76
|
+
readonly runtimeEvidence?: DockerRuntimeEvidence;
|
|
77
|
+
} | {
|
|
78
|
+
readonly status: 'failed';
|
|
79
|
+
readonly errorCode: string;
|
|
80
|
+
readonly retryable: boolean;
|
|
81
|
+
readonly durationMs: number;
|
|
82
|
+
readonly runtimeEvidence?: DockerRuntimeEvidence;
|
|
83
|
+
};
|
|
84
|
+
declare const createToolRuntime: ({ tools, timeoutMs }: {
|
|
85
|
+
readonly tools: readonly ToolDefinition[];
|
|
86
|
+
readonly timeoutMs?: number;
|
|
87
|
+
}) => ToolRuntime;
|
|
88
|
+
declare const createProcessToolRuntime: ({ tools, timeoutMs, maxOutputBytes }: {
|
|
89
|
+
readonly tools: readonly ProcessToolDefinition[];
|
|
90
|
+
readonly timeoutMs?: number;
|
|
91
|
+
readonly maxOutputBytes?: number;
|
|
92
|
+
}) => ToolRuntime;
|
|
93
|
+
declare const createDockerToolRuntime: ({ tools, timeoutMs, maxOutputBytes, dockerCommand, memoryLimit, cpus, pidsLimit, user, pull, }: {
|
|
94
|
+
readonly tools: readonly DockerToolDefinition[];
|
|
95
|
+
readonly timeoutMs?: number;
|
|
96
|
+
readonly maxOutputBytes?: number;
|
|
97
|
+
readonly dockerCommand?: string;
|
|
98
|
+
readonly memoryLimit?: string;
|
|
99
|
+
readonly cpus?: number | string;
|
|
100
|
+
readonly pidsLimit?: number;
|
|
101
|
+
readonly user?: string;
|
|
102
|
+
readonly pull?: "never" | "missing" | "always";
|
|
103
|
+
}) => ToolRuntime;
|
|
104
|
+
|
|
105
|
+
declare const HARNESS_EVENT_SCHEMA_VERSION: 1;
|
|
106
|
+
declare const EVENT_LOG_GENESIS: "GENESIS";
|
|
107
|
+
declare const HARNESS_EVENT_TYPES: readonly ["run.created", "state.transitioned", "context.attached", "verification.completed", "approval.recorded", "authorization.recorded", "session.started", "session.resumed", "agent.turn.started", "policy.evaluated", "tool.approval.requested", "tool.approval.recorded", "tool.requested", "tool.execution.started", "tool.recovery.recorded", "tool.blocked", "tool.completed", "tool.failed", "session.ended"];
|
|
108
|
+
type HarnessEventType = typeof HARNESS_EVENT_TYPES[number];
|
|
109
|
+
interface HarnessEventPayloads {
|
|
110
|
+
readonly 'run.created': {
|
|
111
|
+
readonly project: string;
|
|
112
|
+
readonly baselineRevision: string;
|
|
113
|
+
readonly baselineStatusHash: string;
|
|
114
|
+
};
|
|
115
|
+
readonly 'state.transitioned': {
|
|
116
|
+
readonly from: RunState | null;
|
|
117
|
+
readonly to: RunState;
|
|
118
|
+
readonly actor: string;
|
|
119
|
+
readonly reason?: string;
|
|
120
|
+
readonly transitionIndex: number;
|
|
121
|
+
};
|
|
122
|
+
readonly 'context.attached': {
|
|
123
|
+
readonly providerId: string;
|
|
124
|
+
readonly sourceHash: string;
|
|
125
|
+
readonly snapshotHash: string;
|
|
126
|
+
readonly query: ContextQuery;
|
|
127
|
+
};
|
|
128
|
+
readonly 'verification.completed': {
|
|
129
|
+
readonly verificationDigest: string;
|
|
130
|
+
readonly checkCount: number;
|
|
131
|
+
readonly outcomeCount: number;
|
|
132
|
+
readonly totalDurationMs: number;
|
|
133
|
+
readonly budgetExceeded: boolean;
|
|
134
|
+
};
|
|
135
|
+
readonly 'approval.recorded': {
|
|
136
|
+
readonly decision: 'approved' | 'rejected';
|
|
137
|
+
readonly resultingState: RunState;
|
|
138
|
+
readonly verificationDigest: string;
|
|
139
|
+
readonly actor: 'human';
|
|
140
|
+
readonly sourceRevision: string;
|
|
141
|
+
readonly contractHash: string;
|
|
142
|
+
};
|
|
143
|
+
readonly 'authorization.recorded': {
|
|
144
|
+
readonly decision: 'approved' | 'rejected';
|
|
145
|
+
readonly resultingState: RunState;
|
|
146
|
+
readonly verificationDigest: string;
|
|
147
|
+
readonly actor: 'human';
|
|
148
|
+
readonly target: string;
|
|
149
|
+
readonly sourceRevision: string;
|
|
150
|
+
readonly contractHash: string;
|
|
151
|
+
};
|
|
152
|
+
readonly 'session.started': {
|
|
153
|
+
readonly adapterId: string;
|
|
154
|
+
readonly adapterVersion: string;
|
|
155
|
+
readonly capabilities: readonly string[];
|
|
156
|
+
};
|
|
157
|
+
readonly 'session.resumed': {
|
|
158
|
+
readonly recovery: 'event-log';
|
|
159
|
+
};
|
|
160
|
+
readonly 'agent.turn.started': {
|
|
161
|
+
readonly turnId: string;
|
|
162
|
+
readonly inputHash: string;
|
|
163
|
+
};
|
|
164
|
+
readonly 'policy.evaluated': {
|
|
165
|
+
readonly actionId: string;
|
|
166
|
+
readonly turnId: string;
|
|
167
|
+
readonly toolId: string;
|
|
168
|
+
readonly decision: 'allow' | 'block' | 'approve';
|
|
169
|
+
readonly policyId: string;
|
|
170
|
+
readonly reason: string;
|
|
171
|
+
};
|
|
172
|
+
readonly 'tool.approval.requested': {
|
|
173
|
+
readonly turnId: string;
|
|
174
|
+
readonly actionId: string;
|
|
175
|
+
readonly toolId: string;
|
|
176
|
+
readonly argumentsHash: string;
|
|
177
|
+
readonly policyId: string;
|
|
178
|
+
readonly reason: string;
|
|
179
|
+
};
|
|
180
|
+
readonly 'tool.approval.recorded': {
|
|
181
|
+
readonly turnId: string;
|
|
182
|
+
readonly actionId: string;
|
|
183
|
+
readonly toolId: string;
|
|
184
|
+
readonly argumentsHash: string;
|
|
185
|
+
readonly decision: 'approved' | 'rejected';
|
|
186
|
+
readonly actor: 'human';
|
|
187
|
+
readonly policyId: string;
|
|
188
|
+
readonly reason: string;
|
|
189
|
+
};
|
|
190
|
+
readonly 'tool.requested': {
|
|
191
|
+
readonly turnId: string;
|
|
192
|
+
readonly actionId: string;
|
|
193
|
+
readonly toolId: string;
|
|
194
|
+
readonly argumentsHash: string;
|
|
195
|
+
};
|
|
196
|
+
readonly 'tool.execution.started': {
|
|
197
|
+
readonly turnId: string;
|
|
198
|
+
readonly actionId: string;
|
|
199
|
+
readonly toolId: string;
|
|
200
|
+
readonly attempt: number;
|
|
201
|
+
};
|
|
202
|
+
readonly 'tool.recovery.recorded': {
|
|
203
|
+
readonly turnId: string;
|
|
204
|
+
readonly actionId: string;
|
|
205
|
+
readonly toolId: string;
|
|
206
|
+
readonly decision: 'retry' | 'abandon';
|
|
207
|
+
readonly actor: 'human';
|
|
208
|
+
readonly reason: string;
|
|
209
|
+
};
|
|
210
|
+
readonly 'tool.blocked': {
|
|
211
|
+
readonly turnId: string;
|
|
212
|
+
readonly actionId: string;
|
|
213
|
+
readonly toolId: string;
|
|
214
|
+
readonly policyId: string;
|
|
215
|
+
readonly reason: string;
|
|
216
|
+
};
|
|
217
|
+
readonly 'tool.completed': {
|
|
218
|
+
readonly actionId: string;
|
|
219
|
+
readonly resultHash: string;
|
|
220
|
+
readonly durationMs: number;
|
|
221
|
+
readonly runtimeEvidence?: DockerRuntimeEvidence;
|
|
222
|
+
};
|
|
223
|
+
readonly 'tool.failed': {
|
|
224
|
+
readonly actionId: string;
|
|
225
|
+
readonly errorCode: string;
|
|
226
|
+
readonly retryable: boolean;
|
|
227
|
+
readonly durationMs: number;
|
|
228
|
+
readonly runtimeEvidence?: DockerRuntimeEvidence;
|
|
229
|
+
};
|
|
230
|
+
readonly 'session.ended': {
|
|
231
|
+
readonly status: 'completed' | 'failed' | 'cancelled';
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
type HarnessEvent<K extends HarnessEventType = HarnessEventType> = K extends HarnessEventType ? {
|
|
235
|
+
readonly schemaVersion: typeof HARNESS_EVENT_SCHEMA_VERSION;
|
|
236
|
+
readonly runId: string;
|
|
237
|
+
readonly sequence: number;
|
|
238
|
+
readonly at: string;
|
|
239
|
+
readonly sourceRevision: string;
|
|
240
|
+
readonly configHash: string;
|
|
241
|
+
readonly previousHash?: string;
|
|
242
|
+
readonly eventHash?: string;
|
|
243
|
+
readonly sessionId?: string;
|
|
244
|
+
readonly type: K;
|
|
245
|
+
readonly payload: HarnessEventPayloads[K];
|
|
246
|
+
} : never;
|
|
247
|
+
type HarnessEventInput<K extends HarnessEventType = HarnessEventType> = Omit<HarnessEvent<K>, 'schemaVersion' | 'sequence' | 'at'>;
|
|
248
|
+
type HarnessEventListener<K extends HarnessEventType> = (event: HarnessEvent<K>) => void;
|
|
249
|
+
interface EventStore {
|
|
250
|
+
append<K extends HarnessEventType>(event: HarnessEventInput<K>): HarnessEvent<K>;
|
|
251
|
+
read(runId: string): readonly HarnessEvent[];
|
|
252
|
+
verify(runId: string): EventLogVerification;
|
|
253
|
+
}
|
|
254
|
+
interface EventLogVerification {
|
|
255
|
+
readonly status: 'verified' | 'legacy';
|
|
256
|
+
readonly eventCount: number;
|
|
257
|
+
readonly headHash?: string;
|
|
258
|
+
}
|
|
259
|
+
interface EventLogLock {
|
|
260
|
+
readonly pid: number;
|
|
261
|
+
readonly at: string;
|
|
262
|
+
}
|
|
263
|
+
interface EventLogLockStatus {
|
|
264
|
+
readonly status: 'locked' | 'unlocked';
|
|
265
|
+
readonly path: string;
|
|
266
|
+
readonly lock?: EventLogLock;
|
|
267
|
+
}
|
|
268
|
+
interface EventLogLockRecovery {
|
|
269
|
+
readonly status: 'recovered' | 'unlocked';
|
|
270
|
+
readonly path: string;
|
|
271
|
+
readonly lock?: EventLogLock;
|
|
272
|
+
}
|
|
273
|
+
declare class FileEventStore implements EventStore {
|
|
274
|
+
private readonly stateDir;
|
|
275
|
+
constructor(stateDir: string);
|
|
276
|
+
append<K extends HarnessEventType>(event: HarnessEventInput<K>): HarnessEvent<K>;
|
|
277
|
+
private readUnlocked;
|
|
278
|
+
read(runId: string): readonly HarnessEvent[];
|
|
279
|
+
verify(runId: string): EventLogVerification;
|
|
280
|
+
}
|
|
281
|
+
declare const inspectEventLogLock: (stateDir: string, runId: string) => EventLogLockStatus;
|
|
282
|
+
declare const recoverEventLogLock: ({ stateDir, runId, actor, maxAgeMs }: {
|
|
283
|
+
readonly stateDir: string;
|
|
284
|
+
readonly runId: string;
|
|
285
|
+
readonly actor: string;
|
|
286
|
+
readonly maxAgeMs?: number;
|
|
287
|
+
}) => EventLogLockRecovery;
|
|
288
|
+
|
|
289
|
+
declare const HARNESS_PLUGIN_API_VERSION: 1;
|
|
290
|
+
type Disposer = () => void;
|
|
291
|
+
interface PluginSlot<T> {
|
|
292
|
+
readonly id: string;
|
|
293
|
+
}
|
|
294
|
+
declare const createPluginSlot: <T>(id: string) => PluginSlot<T>;
|
|
295
|
+
interface HarnessPluginContext {
|
|
296
|
+
readonly apiVersion: typeof HARNESS_PLUGIN_API_VERSION;
|
|
297
|
+
register<T>(slot: PluginSlot<T>, id: string, value: T): Disposer;
|
|
298
|
+
effect(disposer: Disposer): void;
|
|
299
|
+
on<K extends HarnessEventType>(type: K, listener: HarnessEventListener<K>): Disposer;
|
|
300
|
+
}
|
|
301
|
+
interface HarnessPlugin {
|
|
302
|
+
readonly id: string;
|
|
303
|
+
readonly version: string;
|
|
304
|
+
readonly apiVersion: typeof HARNESS_PLUGIN_API_VERSION;
|
|
305
|
+
readonly requires?: readonly string[];
|
|
306
|
+
readonly apply: (context: HarnessPluginContext) => void | Disposer;
|
|
307
|
+
}
|
|
308
|
+
interface PluginContribution<T> {
|
|
309
|
+
readonly pluginId: string;
|
|
310
|
+
readonly id: string;
|
|
311
|
+
readonly value: T;
|
|
312
|
+
}
|
|
313
|
+
interface PluginRegistry {
|
|
314
|
+
register(plugin: HarnessPlugin): void;
|
|
315
|
+
mount(): void;
|
|
316
|
+
emit<K extends HarnessEventType>(event: HarnessEvent<K>): void;
|
|
317
|
+
on<K extends HarnessEventType>(type: K, listener: HarnessEventListener<K>): Disposer;
|
|
318
|
+
contributions<T>(slot: PluginSlot<T>): readonly PluginContribution<T>[];
|
|
319
|
+
dispose(): void;
|
|
320
|
+
}
|
|
321
|
+
declare const createPluginRegistry: () => PluginRegistry;
|
|
322
|
+
|
|
323
|
+
interface ContextQuery {
|
|
324
|
+
readonly query: string;
|
|
325
|
+
readonly scope?: readonly string[];
|
|
326
|
+
readonly sourceRevision?: string;
|
|
327
|
+
}
|
|
328
|
+
interface ContextReference {
|
|
329
|
+
readonly id: string;
|
|
330
|
+
readonly uri: string;
|
|
331
|
+
readonly title?: string;
|
|
332
|
+
readonly version?: string;
|
|
333
|
+
readonly contentHash?: string;
|
|
334
|
+
}
|
|
335
|
+
interface ContextSnapshot {
|
|
336
|
+
readonly providerId: string;
|
|
337
|
+
readonly query: ContextQuery;
|
|
338
|
+
readonly references: readonly ContextReference[];
|
|
339
|
+
readonly sourceHash: string;
|
|
340
|
+
readonly snapshotHash: string;
|
|
341
|
+
readonly resolvedAt: string;
|
|
342
|
+
}
|
|
343
|
+
interface ContextProvider {
|
|
344
|
+
readonly id: string;
|
|
345
|
+
readonly version: string;
|
|
346
|
+
readonly resolve: (query: ContextQuery) => Promise<ContextSnapshot>;
|
|
347
|
+
}
|
|
348
|
+
declare const hashContextSnapshot: ({ providerId, query, references, sourceHash }: Pick<ContextSnapshot, "providerId" | "query" | "references" | "sourceHash">) => string;
|
|
349
|
+
declare const hashContextSnapshots: (snapshots: readonly ContextSnapshot[]) => string;
|
|
350
|
+
declare const validateContextSnapshot: (value: unknown, index?: number) => ContextSnapshot;
|
|
351
|
+
declare const readContextSnapshots: (path: string) => readonly ContextSnapshot[];
|
|
352
|
+
declare const validateContextSnapshots: (snapshots: readonly ContextSnapshot[]) => readonly ContextSnapshot[];
|
|
353
|
+
declare const CONTEXT_PROVIDER_SLOT: PluginSlot<ContextProvider>;
|
|
354
|
+
|
|
355
|
+
declare const SURFACE_NAMES: readonly ["logic", "endpoint", "database", "cli", "mcp", "ui", "docs"];
|
|
356
|
+
type SurfaceName = typeof SURFACE_NAMES[number];
|
|
357
|
+
declare const CHECK_CATEGORIES: readonly ["build", "test", "lint", "logic", "endpoint", "database", "cli", "mcp", "ui", "docs", "custom"];
|
|
358
|
+
type CheckCategory = typeof CHECK_CATEGORIES[number];
|
|
359
|
+
declare const RUN_STATES: readonly ["CLARIFYING", "PLANNED", "IMPLEMENTING", "VERIFYING", "AWAITING_HUMAN_APPROVAL", "AWAITING_AUTHORIZATION", "COMPLETE", "BLOCKED", "STALE", "CANCELLED", "SUPERSEDED"];
|
|
360
|
+
type RunState = typeof RUN_STATES[number];
|
|
361
|
+
interface SurfaceRequirement {
|
|
362
|
+
readonly required: boolean;
|
|
363
|
+
readonly reason?: string;
|
|
364
|
+
}
|
|
365
|
+
interface ContractScope {
|
|
366
|
+
readonly inScope: readonly string[];
|
|
367
|
+
readonly outOfScope: readonly string[];
|
|
368
|
+
}
|
|
369
|
+
interface ContractOutcome {
|
|
370
|
+
readonly id: string;
|
|
371
|
+
readonly statement: string;
|
|
372
|
+
readonly checks: readonly string[];
|
|
373
|
+
}
|
|
374
|
+
interface TaskContract {
|
|
375
|
+
readonly intent: string;
|
|
376
|
+
readonly scope: ContractScope;
|
|
377
|
+
readonly ambiguities: readonly string[];
|
|
378
|
+
readonly outcomes: readonly ContractOutcome[];
|
|
379
|
+
}
|
|
380
|
+
interface VerificationCheck {
|
|
381
|
+
readonly id: string;
|
|
382
|
+
readonly category: CheckCategory;
|
|
383
|
+
readonly command: string;
|
|
384
|
+
readonly required: boolean;
|
|
385
|
+
readonly timeoutMs: number;
|
|
386
|
+
readonly execution?: 'real';
|
|
387
|
+
readonly capabilities?: readonly string[];
|
|
388
|
+
readonly evidence: 'structured';
|
|
389
|
+
}
|
|
390
|
+
interface TrackingConfig {
|
|
391
|
+
readonly required: boolean;
|
|
392
|
+
readonly target?: string;
|
|
393
|
+
readonly reason?: string;
|
|
394
|
+
}
|
|
395
|
+
interface BenchmarkBinding {
|
|
396
|
+
readonly suiteId: string;
|
|
397
|
+
readonly taskId: string;
|
|
398
|
+
readonly mode: 'harness';
|
|
399
|
+
}
|
|
400
|
+
interface VerificationConfig {
|
|
401
|
+
readonly schemaVersion: 1;
|
|
402
|
+
readonly project: string;
|
|
403
|
+
readonly root?: string;
|
|
404
|
+
readonly stateDir?: string;
|
|
405
|
+
readonly profile: string;
|
|
406
|
+
readonly contract: TaskContract;
|
|
407
|
+
readonly surfaces: Readonly<Record<SurfaceName, SurfaceRequirement>>;
|
|
408
|
+
readonly checks: readonly VerificationCheck[];
|
|
409
|
+
readonly tracking: TrackingConfig;
|
|
410
|
+
readonly budget?: {
|
|
411
|
+
readonly maxDurationMs?: number;
|
|
412
|
+
};
|
|
413
|
+
readonly cleanup?: {
|
|
414
|
+
readonly roots?: readonly string[];
|
|
415
|
+
};
|
|
416
|
+
readonly benchmark?: BenchmarkBinding;
|
|
417
|
+
}
|
|
418
|
+
interface LoadedConfig {
|
|
419
|
+
readonly absolute: string;
|
|
420
|
+
readonly root: string;
|
|
421
|
+
readonly stateDir: string;
|
|
422
|
+
readonly config: VerificationConfig;
|
|
423
|
+
readonly configHash: string;
|
|
424
|
+
}
|
|
425
|
+
interface SourceSnapshot {
|
|
426
|
+
readonly revision: string;
|
|
427
|
+
readonly status: string;
|
|
428
|
+
readonly statusHash: string;
|
|
429
|
+
}
|
|
430
|
+
interface EvidenceArtifact {
|
|
431
|
+
readonly type?: string;
|
|
432
|
+
readonly path: string;
|
|
433
|
+
readonly sha256: string;
|
|
434
|
+
readonly viewport?: {
|
|
435
|
+
readonly width: number;
|
|
436
|
+
readonly height: number;
|
|
437
|
+
} | string;
|
|
438
|
+
}
|
|
439
|
+
interface StructuredEvidence {
|
|
440
|
+
readonly status: string;
|
|
441
|
+
readonly criteria: readonly string[];
|
|
442
|
+
readonly capability?: string;
|
|
443
|
+
readonly artifacts?: readonly EvidenceArtifact[];
|
|
444
|
+
readonly [key: string]: unknown;
|
|
445
|
+
}
|
|
446
|
+
interface CheckResult {
|
|
447
|
+
readonly id: string;
|
|
448
|
+
readonly category: CheckCategory;
|
|
449
|
+
readonly status: 'pending' | 'passed' | 'failed';
|
|
450
|
+
readonly exitCode?: number;
|
|
451
|
+
readonly durationMs?: number;
|
|
452
|
+
readonly evidence?: StructuredEvidence;
|
|
453
|
+
readonly failures?: readonly string[];
|
|
454
|
+
}
|
|
455
|
+
interface RunOutcome extends ContractOutcome {
|
|
456
|
+
readonly status: 'pending' | 'passed' | 'failed';
|
|
457
|
+
}
|
|
458
|
+
interface EvidenceReference {
|
|
459
|
+
readonly checkId: string;
|
|
460
|
+
readonly stdout: string;
|
|
461
|
+
readonly stderr: string;
|
|
462
|
+
}
|
|
463
|
+
interface VerificationRun {
|
|
464
|
+
readonly type: 'agentskit-harness-run';
|
|
465
|
+
readonly schemaVersion: 1;
|
|
466
|
+
readonly runId: string;
|
|
467
|
+
readonly project: string;
|
|
468
|
+
readonly state: RunState;
|
|
469
|
+
readonly configHash: string;
|
|
470
|
+
readonly contractHash: string;
|
|
471
|
+
readonly sourceRevision: string;
|
|
472
|
+
readonly sourceStatusHash: string;
|
|
473
|
+
readonly baseline: SourceSnapshot;
|
|
474
|
+
/** A human-approved plan, retained for backwards compatibility with v1 runs. */
|
|
475
|
+
readonly contractApproval?: {
|
|
476
|
+
readonly actor: 'human';
|
|
477
|
+
readonly at: string;
|
|
478
|
+
readonly contractHash: string;
|
|
479
|
+
};
|
|
480
|
+
/** An automated preparation is never an approval and cannot complete a run. */
|
|
481
|
+
readonly contractPreparation?: {
|
|
482
|
+
readonly actor: 'ci';
|
|
483
|
+
readonly at: string;
|
|
484
|
+
readonly contractHash: string;
|
|
485
|
+
};
|
|
486
|
+
readonly checks: readonly CheckResult[];
|
|
487
|
+
readonly outcomes: readonly RunOutcome[];
|
|
488
|
+
readonly transitions: readonly StateTransition[];
|
|
489
|
+
readonly evidenceReferences: readonly EvidenceReference[];
|
|
490
|
+
readonly contextSnapshots: readonly ContextSnapshot[];
|
|
491
|
+
readonly contextHash?: string;
|
|
492
|
+
readonly verificationDigest?: string;
|
|
493
|
+
readonly benchmark?: BenchmarkBinding;
|
|
494
|
+
readonly supersedes?: string;
|
|
495
|
+
readonly dirtyBaselineAuthorized?: boolean;
|
|
496
|
+
readonly metrics?: {
|
|
497
|
+
readonly totalDurationMs: number;
|
|
498
|
+
readonly budgetExceeded: boolean;
|
|
499
|
+
};
|
|
500
|
+
readonly humanApproval?: {
|
|
501
|
+
readonly actor: 'human';
|
|
502
|
+
readonly at: string;
|
|
503
|
+
readonly sourceRevision: string;
|
|
504
|
+
readonly contractHash: string;
|
|
505
|
+
readonly verificationDigest?: string;
|
|
506
|
+
};
|
|
507
|
+
readonly authorization?: {
|
|
508
|
+
readonly actor: 'human';
|
|
509
|
+
readonly at: string;
|
|
510
|
+
readonly target: string;
|
|
511
|
+
readonly sourceRevision: string;
|
|
512
|
+
readonly contractHash: string;
|
|
513
|
+
readonly verificationDigest?: string;
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
interface RunReconciliation {
|
|
517
|
+
readonly status: 'verified';
|
|
518
|
+
readonly runId: string;
|
|
519
|
+
readonly state: RunState;
|
|
520
|
+
readonly eventCount: number;
|
|
521
|
+
readonly headHash?: string;
|
|
522
|
+
readonly verificationDigest?: string;
|
|
523
|
+
}
|
|
524
|
+
interface StateTransition {
|
|
525
|
+
readonly from: RunState | null;
|
|
526
|
+
readonly to: RunState;
|
|
527
|
+
readonly at: string;
|
|
528
|
+
readonly actor?: string;
|
|
529
|
+
readonly reason?: string;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
declare const validateConfig: (rawValue: unknown) => VerificationConfig;
|
|
533
|
+
declare const loadConfig: (configPath?: string) => LoadedConfig;
|
|
534
|
+
|
|
535
|
+
declare const transition: (run: Pick<VerificationRun, "state" | "transitions">, to: RunState, reason?: string, actor?: string) => Pick<VerificationRun, "state" | "transitions">;
|
|
536
|
+
declare const assertHuman: (actor: string) => void;
|
|
537
|
+
declare const approvedDecision: (decision: string) => boolean;
|
|
538
|
+
|
|
539
|
+
declare const loadLatestRun: (stateDir: string) => VerificationRun | null;
|
|
540
|
+
|
|
541
|
+
declare const planRun: ({ configPath, decision, actor, allowDirty, contextSnapshots }: {
|
|
542
|
+
readonly configPath: string;
|
|
543
|
+
readonly decision: string;
|
|
544
|
+
readonly actor?: string;
|
|
545
|
+
readonly allowDirty?: boolean;
|
|
546
|
+
readonly contextSnapshots?: readonly ContextSnapshot[];
|
|
547
|
+
}) => Promise<VerificationRun>;
|
|
548
|
+
declare const startRun: (loaded: LoadedConfig) => VerificationRun;
|
|
549
|
+
declare const cancelRun: ({ configPath, runId, reason, actor }: {
|
|
550
|
+
readonly configPath: string;
|
|
551
|
+
readonly runId?: string;
|
|
552
|
+
readonly reason?: string;
|
|
553
|
+
readonly actor?: string;
|
|
554
|
+
}) => Promise<VerificationRun>;
|
|
555
|
+
declare const verifyRun: ({ configPath }: {
|
|
556
|
+
readonly configPath: string;
|
|
557
|
+
}) => Promise<VerificationRun>;
|
|
558
|
+
declare const reconcileRun: ({ configPath, runId }: {
|
|
559
|
+
readonly configPath: string;
|
|
560
|
+
readonly runId?: string;
|
|
561
|
+
}) => Promise<RunReconciliation>;
|
|
562
|
+
declare const approveRun: ({ configPath, runId, decision, actor }: {
|
|
563
|
+
readonly configPath: string;
|
|
564
|
+
readonly runId?: string;
|
|
565
|
+
readonly decision: string;
|
|
566
|
+
readonly actor?: string;
|
|
567
|
+
}) => Promise<VerificationRun>;
|
|
568
|
+
declare const authorizeRun: ({ configPath, runId, decision, actor }: {
|
|
569
|
+
readonly configPath: string;
|
|
570
|
+
readonly runId?: string;
|
|
571
|
+
readonly decision: string;
|
|
572
|
+
readonly actor?: string;
|
|
573
|
+
}) => Promise<VerificationRun>;
|
|
574
|
+
declare const retryRun: ({ configPath }: {
|
|
575
|
+
readonly configPath: string;
|
|
576
|
+
}) => Promise<VerificationRun>;
|
|
577
|
+
declare const cleanTaskArtifacts: (configPath: string) => {
|
|
578
|
+
readonly cleaned: readonly string[];
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
interface DocBridgeContextProviderOptions {
|
|
582
|
+
readonly root: string;
|
|
583
|
+
readonly indexPath?: string;
|
|
584
|
+
}
|
|
585
|
+
declare const createDocBridgeContextProvider: ({ root, indexPath }: DocBridgeContextProviderOptions) => ContextProvider;
|
|
586
|
+
|
|
587
|
+
declare const BENCHMARK_SCHEMA_VERSION: 1;
|
|
588
|
+
type BenchmarkObservationStatus = 'passed' | 'failed' | 'blocked' | 'not-run';
|
|
589
|
+
type BenchmarkImprovementDirection = 'improved' | 'regressed' | 'unchanged' | 'unavailable';
|
|
590
|
+
type BenchmarkConfidence = 'insufficient' | 'directional' | 'reliable';
|
|
591
|
+
interface BenchmarkPolicy {
|
|
592
|
+
readonly minComparableTasks: number;
|
|
593
|
+
readonly maxDurationRegressionRate: number;
|
|
594
|
+
readonly minCompletedRunsPerTask: number;
|
|
595
|
+
readonly minBaselineSamplesPerTask: number;
|
|
596
|
+
readonly requireZeroEscapedIncomplete: boolean;
|
|
597
|
+
}
|
|
598
|
+
interface BenchmarkQualityGate {
|
|
599
|
+
readonly status: 'passed' | 'failed' | 'insufficient-data';
|
|
600
|
+
readonly confidence: BenchmarkConfidence;
|
|
601
|
+
readonly comparableTaskCount: number;
|
|
602
|
+
readonly policy: BenchmarkPolicy;
|
|
603
|
+
readonly durationRegressionTaskIds: readonly string[];
|
|
604
|
+
readonly escapedIncompleteTaskIds: readonly string[];
|
|
605
|
+
readonly reasons: readonly string[];
|
|
606
|
+
}
|
|
607
|
+
interface BenchmarkTask {
|
|
608
|
+
readonly id: string;
|
|
609
|
+
readonly title: string;
|
|
610
|
+
readonly acceptanceCriteria: readonly string[];
|
|
611
|
+
/** Product/runtime surfaces exercised by the task. */
|
|
612
|
+
readonly surfaces?: readonly SurfaceName[];
|
|
613
|
+
readonly kind?: string;
|
|
614
|
+
readonly prompt?: BenchmarkTaskFile;
|
|
615
|
+
readonly source?: BenchmarkTaskSource;
|
|
616
|
+
readonly scope?: BenchmarkTaskScope;
|
|
617
|
+
}
|
|
618
|
+
interface BenchmarkTaskFile {
|
|
619
|
+
readonly path: string;
|
|
620
|
+
readonly sha256: string;
|
|
621
|
+
}
|
|
622
|
+
interface BenchmarkTaskSource {
|
|
623
|
+
readonly repository: string;
|
|
624
|
+
readonly path: string;
|
|
625
|
+
readonly revision: string;
|
|
626
|
+
}
|
|
627
|
+
interface BenchmarkSuiteSource {
|
|
628
|
+
readonly repository: string;
|
|
629
|
+
readonly revision: string;
|
|
630
|
+
readonly taskDefinition: string;
|
|
631
|
+
}
|
|
632
|
+
interface BenchmarkTaskScope {
|
|
633
|
+
readonly read: readonly string[];
|
|
634
|
+
readonly write: readonly string[];
|
|
635
|
+
}
|
|
636
|
+
interface BenchmarkObservation {
|
|
637
|
+
readonly taskId: string;
|
|
638
|
+
readonly mode: 'baseline';
|
|
639
|
+
readonly status: BenchmarkObservationStatus;
|
|
640
|
+
readonly source: string;
|
|
641
|
+
readonly recordedAt: string;
|
|
642
|
+
readonly attempts?: number;
|
|
643
|
+
readonly durationMs?: number;
|
|
644
|
+
readonly durationSamplesMs?: readonly number[];
|
|
645
|
+
/** Fraction of repeated samples whose task artifact passed acceptance validation. */
|
|
646
|
+
readonly artifactAcceptanceRate?: number;
|
|
647
|
+
/** Fraction of repeated samples whose verification protocol completed. */
|
|
648
|
+
readonly protocolCompletionRate?: number;
|
|
649
|
+
readonly reviewMinutes?: number;
|
|
650
|
+
readonly escapedIncomplete?: number;
|
|
651
|
+
readonly evidence?: readonly BenchmarkObservationEvidence[];
|
|
652
|
+
readonly evidenceDigest?: string;
|
|
653
|
+
}
|
|
654
|
+
interface BenchmarkObservationEvidence {
|
|
655
|
+
readonly criterion: string;
|
|
656
|
+
readonly status: BenchmarkObservationStatus;
|
|
657
|
+
readonly source: string;
|
|
658
|
+
}
|
|
659
|
+
interface BenchmarkManifest {
|
|
660
|
+
readonly type: 'agentskit-harness-benchmark-manifest';
|
|
661
|
+
readonly schemaVersion: typeof BENCHMARK_SCHEMA_VERSION;
|
|
662
|
+
readonly suiteId: string;
|
|
663
|
+
readonly name: string;
|
|
664
|
+
readonly provenance?: BenchmarkSuiteSource;
|
|
665
|
+
readonly tasks: readonly BenchmarkTask[];
|
|
666
|
+
readonly observations: readonly BenchmarkObservation[];
|
|
667
|
+
readonly policy?: BenchmarkPolicy;
|
|
668
|
+
}
|
|
669
|
+
interface BenchmarkRun {
|
|
670
|
+
readonly runId: string;
|
|
671
|
+
readonly state: RunState;
|
|
672
|
+
readonly sourceRevision: string;
|
|
673
|
+
readonly configHash: string;
|
|
674
|
+
readonly contractHash: string;
|
|
675
|
+
readonly supersedes?: string;
|
|
676
|
+
readonly durationMs?: number;
|
|
677
|
+
readonly checks: {
|
|
678
|
+
readonly total: number;
|
|
679
|
+
readonly passed: number;
|
|
680
|
+
readonly failed: number;
|
|
681
|
+
};
|
|
682
|
+
readonly outcomes: {
|
|
683
|
+
readonly total: number;
|
|
684
|
+
readonly passed: number;
|
|
685
|
+
readonly failed: number;
|
|
686
|
+
};
|
|
687
|
+
readonly evidence: {
|
|
688
|
+
readonly total: number;
|
|
689
|
+
readonly attached: number;
|
|
690
|
+
};
|
|
691
|
+
/** Optional artifact outcome emitted by structured benchmark evidence. */
|
|
692
|
+
readonly artifactAcceptanceRate?: number;
|
|
693
|
+
readonly escapedIncomplete?: number;
|
|
694
|
+
readonly humanApproved: boolean;
|
|
695
|
+
readonly humanReviewMinutes?: number;
|
|
696
|
+
readonly authorized: boolean;
|
|
697
|
+
readonly benchmark?: BenchmarkBinding;
|
|
698
|
+
}
|
|
699
|
+
interface BenchmarkComparison {
|
|
700
|
+
readonly taskId: string;
|
|
701
|
+
readonly title: string;
|
|
702
|
+
readonly comparability: 'comparable' | 'missing-baseline' | 'baseline-not-run' | 'baseline-evidence-missing' | 'baseline-incomplete' | 'baseline-samples-insufficient' | 'harness-not-run' | 'harness-not-complete';
|
|
703
|
+
readonly comparable: boolean;
|
|
704
|
+
readonly baselineDeliveryComplete: boolean;
|
|
705
|
+
readonly baseline?: BenchmarkObservation;
|
|
706
|
+
readonly baselineEvidenceCoverageRate: number | null;
|
|
707
|
+
readonly baselineSampleCount: number;
|
|
708
|
+
readonly baselineArtifactAcceptanceRate: number | null;
|
|
709
|
+
readonly baselineProtocolCompletionRate: number | null;
|
|
710
|
+
readonly baselineMedianDurationMs?: number;
|
|
711
|
+
readonly improvement: {
|
|
712
|
+
readonly durationRate: number | null;
|
|
713
|
+
readonly duration: BenchmarkImprovementDirection;
|
|
714
|
+
readonly attemptsRate: number | null;
|
|
715
|
+
readonly attempts: BenchmarkImprovementDirection;
|
|
716
|
+
readonly reviewRate: number | null;
|
|
717
|
+
readonly review: BenchmarkImprovementDirection;
|
|
718
|
+
readonly artifactAcceptanceRate: number | null;
|
|
719
|
+
readonly artifactAcceptance: BenchmarkImprovementDirection;
|
|
720
|
+
readonly artifactAcceptanceDelta: number | null;
|
|
721
|
+
readonly protocolCompletionRate: number | null;
|
|
722
|
+
readonly protocolCompletion: BenchmarkImprovementDirection;
|
|
723
|
+
readonly protocolCompletionDelta: number | null;
|
|
724
|
+
readonly escapedIncompleteRate: number | null;
|
|
725
|
+
readonly escapedIncomplete: BenchmarkImprovementDirection;
|
|
726
|
+
};
|
|
727
|
+
readonly harness: {
|
|
728
|
+
readonly attempts: number;
|
|
729
|
+
readonly retryCount: number;
|
|
730
|
+
readonly completedRuns: number;
|
|
731
|
+
readonly durationSamplesMs: readonly number[];
|
|
732
|
+
readonly medianDurationMs?: number;
|
|
733
|
+
readonly latestState: RunState | 'NOT_RUN';
|
|
734
|
+
readonly latestRunId?: string;
|
|
735
|
+
readonly latestDurationMs?: number;
|
|
736
|
+
readonly checkPassRate: number | null;
|
|
737
|
+
readonly outcomePassRate: number | null;
|
|
738
|
+
readonly evidenceCoverageRate: number | null;
|
|
739
|
+
readonly artifactAcceptanceRate?: number;
|
|
740
|
+
readonly artifactAcceptanceSampleCount: number;
|
|
741
|
+
readonly protocolCompletionRate: number | null;
|
|
742
|
+
readonly protocolCompletionSampleCount: number;
|
|
743
|
+
readonly humanApproved: boolean;
|
|
744
|
+
readonly escapedIncomplete?: number;
|
|
745
|
+
readonly humanReviewMinutes?: number;
|
|
746
|
+
};
|
|
747
|
+
readonly confidence: BenchmarkConfidence;
|
|
748
|
+
readonly durationDeltaMs?: number;
|
|
749
|
+
readonly attemptDelta?: number;
|
|
750
|
+
readonly reviewDeltaMinutes?: number;
|
|
751
|
+
readonly escapedIncompleteDelta?: number;
|
|
752
|
+
}
|
|
753
|
+
interface BenchmarkSummary {
|
|
754
|
+
readonly totalRuns: number;
|
|
755
|
+
readonly stateCounts: Readonly<Record<RunState, number>>;
|
|
756
|
+
readonly completeRuns: number;
|
|
757
|
+
readonly retriedRuns: number;
|
|
758
|
+
readonly staleRuns: number;
|
|
759
|
+
readonly firstAttemptRuns: number;
|
|
760
|
+
readonly humanApprovedRuns: number;
|
|
761
|
+
readonly authorizedRuns: number;
|
|
762
|
+
readonly effectiveRunCount: number;
|
|
763
|
+
readonly effectiveCompleteRuns: number;
|
|
764
|
+
readonly effectiveCompletionRate: number | null;
|
|
765
|
+
readonly effectiveCheckPassRate: number | null;
|
|
766
|
+
readonly effectiveOutcomePassRate: number | null;
|
|
767
|
+
readonly effectiveEvidenceCoverageRate: number | null;
|
|
768
|
+
readonly checkPassRate: number | null;
|
|
769
|
+
readonly outcomePassRate: number | null;
|
|
770
|
+
readonly evidenceCoverageRate: number | null;
|
|
771
|
+
readonly firstAttemptApprovalRate: number | null;
|
|
772
|
+
readonly retryRate: number | null;
|
|
773
|
+
readonly staleRate: number | null;
|
|
774
|
+
readonly averageDurationMs: number | null;
|
|
775
|
+
readonly medianDurationMs: number | null;
|
|
776
|
+
}
|
|
777
|
+
interface BenchmarkReport {
|
|
778
|
+
readonly type: 'agentskit-harness-benchmark';
|
|
779
|
+
readonly schemaVersion: typeof BENCHMARK_SCHEMA_VERSION;
|
|
780
|
+
readonly stateDir: string;
|
|
781
|
+
readonly generatedAt: string;
|
|
782
|
+
readonly runs: readonly BenchmarkRun[];
|
|
783
|
+
readonly summary: BenchmarkSummary;
|
|
784
|
+
readonly manifest?: {
|
|
785
|
+
readonly suiteId: string;
|
|
786
|
+
readonly taskCount: number;
|
|
787
|
+
readonly baselineCount: number;
|
|
788
|
+
readonly comparableTaskCount: number;
|
|
789
|
+
};
|
|
790
|
+
readonly comparisons: readonly BenchmarkComparison[];
|
|
791
|
+
readonly qualityGate: BenchmarkQualityGate;
|
|
792
|
+
}
|
|
793
|
+
interface BenchmarkObservationInput {
|
|
794
|
+
readonly taskId: string;
|
|
795
|
+
readonly status: BenchmarkObservationStatus;
|
|
796
|
+
readonly source: string;
|
|
797
|
+
readonly recordedAt?: string;
|
|
798
|
+
readonly attempts?: number;
|
|
799
|
+
readonly durationMs?: number;
|
|
800
|
+
readonly durationSamplesMs?: readonly number[];
|
|
801
|
+
readonly artifactAcceptanceRate?: number;
|
|
802
|
+
readonly protocolCompletionRate?: number;
|
|
803
|
+
readonly reviewMinutes?: number;
|
|
804
|
+
readonly escapedIncomplete?: number;
|
|
805
|
+
readonly evidence?: readonly BenchmarkObservationEvidence[];
|
|
806
|
+
readonly evidenceDigest?: string;
|
|
807
|
+
}
|
|
808
|
+
declare const validateBenchmarkManifest: (value: unknown) => BenchmarkManifest;
|
|
809
|
+
declare const loadBenchmarkManifest: (path: string) => BenchmarkManifest;
|
|
810
|
+
declare const recordBenchmarkObservation: (path: string, input: BenchmarkObservationInput) => BenchmarkManifest;
|
|
811
|
+
declare const benchmarkRuns: (stateDir: string, manifest?: BenchmarkManifest) => BenchmarkReport;
|
|
812
|
+
|
|
813
|
+
type ExternalCodingBenchmarkStatus = 'ok' | 'partial' | 'fail' | 'timeout';
|
|
814
|
+
interface ExternalCodingBenchmarkRow {
|
|
815
|
+
readonly providerId: string;
|
|
816
|
+
readonly status: ExternalCodingBenchmarkStatus;
|
|
817
|
+
readonly completenessScore: number;
|
|
818
|
+
readonly fileEditCount: number;
|
|
819
|
+
readonly summary: string;
|
|
820
|
+
readonly durationMs?: number;
|
|
821
|
+
readonly inputTokens?: number;
|
|
822
|
+
readonly outputTokens?: number;
|
|
823
|
+
readonly costUsd?: number;
|
|
824
|
+
readonly successPassed?: boolean;
|
|
825
|
+
}
|
|
826
|
+
interface ExternalCodingBenchmarkReport {
|
|
827
|
+
readonly kind: string;
|
|
828
|
+
readonly prompt: string;
|
|
829
|
+
readonly dryRun: boolean;
|
|
830
|
+
readonly isolateWorktrees: boolean;
|
|
831
|
+
readonly repoRoot: string;
|
|
832
|
+
readonly rows: readonly ExternalCodingBenchmarkRow[];
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Validates the stable report shape emitted by AgentsKit OS coding benchmarks.
|
|
836
|
+
* Provider heuristics remain observations; this function never grants human acceptance.
|
|
837
|
+
*/
|
|
838
|
+
declare const validateExternalCodingBenchmarkReport: (value: unknown) => ExternalCodingBenchmarkReport;
|
|
839
|
+
|
|
840
|
+
interface PolicyRule {
|
|
841
|
+
readonly id: string;
|
|
842
|
+
readonly effect: 'allow' | 'block' | 'approve';
|
|
843
|
+
readonly toolIds: readonly string[];
|
|
844
|
+
readonly reason: string;
|
|
845
|
+
}
|
|
846
|
+
interface PolicyRequest {
|
|
847
|
+
readonly actionId: string;
|
|
848
|
+
readonly turnId: string;
|
|
849
|
+
readonly toolId: string;
|
|
850
|
+
readonly argumentsHash: string;
|
|
851
|
+
}
|
|
852
|
+
interface PolicyDecision {
|
|
853
|
+
readonly decision: 'allow' | 'block' | 'approve';
|
|
854
|
+
readonly policyId: string;
|
|
855
|
+
readonly reason: string;
|
|
856
|
+
}
|
|
857
|
+
interface PolicyGate {
|
|
858
|
+
evaluate(request: PolicyRequest): PolicyDecision;
|
|
859
|
+
}
|
|
860
|
+
declare const createPolicyGate: ({ rules }: {
|
|
861
|
+
readonly rules: readonly PolicyRule[];
|
|
862
|
+
}) => PolicyGate;
|
|
863
|
+
|
|
864
|
+
interface AgentAdapter {
|
|
865
|
+
readonly id: string;
|
|
866
|
+
readonly version: string;
|
|
867
|
+
readonly capabilities: readonly string[];
|
|
868
|
+
}
|
|
869
|
+
interface AgentSessionOptions {
|
|
870
|
+
readonly stateDir: string;
|
|
871
|
+
readonly run: VerificationRun;
|
|
872
|
+
readonly adapter: AgentAdapter;
|
|
873
|
+
readonly policy: PolicyGate;
|
|
874
|
+
readonly runtime: ToolRuntime;
|
|
875
|
+
readonly sessionId?: string;
|
|
876
|
+
readonly resume?: boolean;
|
|
877
|
+
}
|
|
878
|
+
interface SessionRecorder {
|
|
879
|
+
readonly sessionId: string;
|
|
880
|
+
startTurn(inputHash: string, turnId?: string): HarnessEvent<'agent.turn.started'>;
|
|
881
|
+
requestTool(input: {
|
|
882
|
+
readonly turnId: string;
|
|
883
|
+
readonly toolId: string;
|
|
884
|
+
readonly argumentsHash: string;
|
|
885
|
+
readonly actionId?: string;
|
|
886
|
+
}): HarnessEvent<'tool.requested'> | HarnessEvent<'tool.approval.requested'>;
|
|
887
|
+
approveTool(input: {
|
|
888
|
+
readonly actionId: string;
|
|
889
|
+
readonly decision: 'approved' | 'rejected';
|
|
890
|
+
readonly actor?: 'human';
|
|
891
|
+
}): HarnessEvent<'tool.requested'> | HarnessEvent<'tool.blocked'>;
|
|
892
|
+
recoverTool(input: {
|
|
893
|
+
readonly actionId: string;
|
|
894
|
+
readonly decision: 'retry' | 'abandon';
|
|
895
|
+
readonly actor?: 'human';
|
|
896
|
+
}): HarnessEvent<'tool.recovery.recorded'> | HarnessEvent<'tool.blocked'>;
|
|
897
|
+
completeTool(input: {
|
|
898
|
+
readonly actionId: string;
|
|
899
|
+
readonly resultHash: string;
|
|
900
|
+
readonly durationMs: number;
|
|
901
|
+
readonly runtimeEvidence?: ToolExecutionResult['runtimeEvidence'];
|
|
902
|
+
}): HarnessEvent<'tool.completed'>;
|
|
903
|
+
failTool(input: {
|
|
904
|
+
readonly actionId: string;
|
|
905
|
+
readonly errorCode: string;
|
|
906
|
+
readonly retryable: boolean;
|
|
907
|
+
readonly durationMs: number;
|
|
908
|
+
readonly runtimeEvidence?: ToolExecutionResult['runtimeEvidence'];
|
|
909
|
+
}): HarnessEvent<'tool.failed'>;
|
|
910
|
+
executeTool(input: {
|
|
911
|
+
readonly actionId: string;
|
|
912
|
+
readonly arguments: unknown;
|
|
913
|
+
}): Promise<ToolExecutionResult>;
|
|
914
|
+
end(status: 'completed' | 'failed' | 'cancelled'): HarnessEvent<'session.ended'>;
|
|
915
|
+
}
|
|
916
|
+
declare const createSessionRecorder: ({ stateDir, run, adapter, policy, runtime, sessionId, resume }: AgentSessionOptions) => SessionRecorder;
|
|
917
|
+
|
|
918
|
+
declare const EVIDENCE_BUNDLE_SCHEMA_VERSION: 1;
|
|
919
|
+
interface EvidenceBundleFile {
|
|
920
|
+
readonly path: string;
|
|
921
|
+
readonly sha256: string;
|
|
922
|
+
readonly contentBase64: string;
|
|
923
|
+
}
|
|
924
|
+
interface EvidenceBundleSignature {
|
|
925
|
+
readonly algorithm: 'ed25519';
|
|
926
|
+
readonly keyId: string;
|
|
927
|
+
readonly publicKeyPem: string;
|
|
928
|
+
readonly signatureBase64: string;
|
|
929
|
+
}
|
|
930
|
+
interface TrustedEvidenceKey {
|
|
931
|
+
readonly keyId: string;
|
|
932
|
+
readonly publicKeyPem: string;
|
|
933
|
+
readonly status: 'active' | 'revoked';
|
|
934
|
+
}
|
|
935
|
+
interface EvidenceBundle {
|
|
936
|
+
readonly type: 'agentskit-harness-evidence-bundle';
|
|
937
|
+
readonly schemaVersion: typeof EVIDENCE_BUNDLE_SCHEMA_VERSION;
|
|
938
|
+
readonly runId: string;
|
|
939
|
+
readonly signerKeyId: string;
|
|
940
|
+
readonly sourceRevision: string;
|
|
941
|
+
readonly configHash: string;
|
|
942
|
+
readonly contractHash: string;
|
|
943
|
+
readonly verificationDigest: string;
|
|
944
|
+
readonly eventLog: EventLogVerification;
|
|
945
|
+
readonly files: readonly EvidenceBundleFile[];
|
|
946
|
+
readonly payloadHash: string;
|
|
947
|
+
readonly signature: EvidenceBundleSignature;
|
|
948
|
+
}
|
|
949
|
+
interface EvidenceBundleVerification {
|
|
950
|
+
readonly status: 'verified';
|
|
951
|
+
readonly runId: string;
|
|
952
|
+
readonly payloadHash: string;
|
|
953
|
+
readonly fileCount: number;
|
|
954
|
+
readonly signed: true;
|
|
955
|
+
}
|
|
956
|
+
declare const exportEvidenceBundle: ({ configPath, runId, outputPath, privateKeyPath, keyId }: {
|
|
957
|
+
readonly configPath: string;
|
|
958
|
+
readonly runId?: string;
|
|
959
|
+
readonly outputPath: string;
|
|
960
|
+
readonly privateKeyPath: string;
|
|
961
|
+
readonly keyId: string;
|
|
962
|
+
}) => Promise<EvidenceBundle>;
|
|
963
|
+
declare const verifyEvidenceBundle: (path: string, { trustedKeys }?: {
|
|
964
|
+
readonly trustedKeys?: readonly TrustedEvidenceKey[];
|
|
965
|
+
}) => EvidenceBundleVerification;
|
|
966
|
+
declare const readEvidenceTrustStore: (path: string) => readonly TrustedEvidenceKey[];
|
|
967
|
+
|
|
968
|
+
export { type AgentAdapter, type AgentSessionOptions, BENCHMARK_SCHEMA_VERSION, type BenchmarkBinding, type BenchmarkComparison, type BenchmarkConfidence, type BenchmarkImprovementDirection, type BenchmarkManifest, type BenchmarkObservation, type BenchmarkObservationEvidence, type BenchmarkObservationInput, type BenchmarkObservationStatus, type BenchmarkPolicy, type BenchmarkQualityGate, type BenchmarkReport, type BenchmarkRun, type BenchmarkSuiteSource, type BenchmarkSummary, type BenchmarkTask, type BenchmarkTaskFile, type BenchmarkTaskScope, type BenchmarkTaskSource, CHECK_CATEGORIES, CONTEXT_PROVIDER_SLOT, type CheckCategory, type CheckResult, type ContextProvider, type ContextQuery, type ContextReference, type ContextSnapshot, type ContractOutcome, type ContractScope, type Disposer, type DockerMount, type DockerRuntimeEvidence, type DockerToolDefinition, EVENT_LOG_GENESIS, EVIDENCE_BUNDLE_SCHEMA_VERSION, type EventLogLock, type EventLogLockRecovery, type EventLogLockStatus, type EventLogVerification, type EventStore, type EvidenceArtifact, type EvidenceBundle, type EvidenceBundleFile, type EvidenceBundleSignature, type EvidenceBundleVerification, type EvidenceReference, type ExternalCodingBenchmarkReport, type ExternalCodingBenchmarkRow, type ExternalCodingBenchmarkStatus, FileEventStore, HARNESS_EVENT_SCHEMA_VERSION, HARNESS_EVENT_TYPES, HARNESS_PLUGIN_API_VERSION, HarnessError, type HarnessEvent, type HarnessEventInput, type HarnessEventListener, type HarnessEventPayloads, type HarnessEventType, type HarnessPlugin, type HarnessPluginContext, LEGAL_TRANSITIONS, type LoadedConfig, type PluginContribution, type PluginRegistry, type PluginSlot, type PolicyDecision, type PolicyGate, type PolicyRequest, type PolicyRule, type ProcessToolDefinition, RUN_STATES, type RunOutcome, type RunReconciliation, type RunState, STATES, SURFACE_NAMES, type SessionRecorder, type SourceSnapshot, type StateTransition, type StructuredEvidence, type SurfaceName, type SurfaceRequirement, type TaskContract, type ToolDefinition, type ToolExecutionRequest, type ToolExecutionResult, type ToolRuntime, type TrackingConfig, type TrustedEvidenceKey, type VerificationCheck, type VerificationConfig, type VerificationRun, approveRun, approvedDecision, assertHuman, authorizeRun, benchmarkRuns, cancelRun, cleanTaskArtifacts, createDocBridgeContextProvider, createDockerToolRuntime, createPluginRegistry, createPluginSlot, createPolicyGate, createProcessToolRuntime, createSessionRecorder, createToolRuntime, exportEvidenceBundle, hashContextSnapshot, hashContextSnapshots, inspectEventLogLock, loadBenchmarkManifest, loadConfig, loadLatestRun, planRun, readContextSnapshots, readEvidenceTrustStore, reconcileRun, recordBenchmarkObservation, recoverEventLogLock, retryRun, startRun, transition, validateBenchmarkManifest, validateConfig, validateContextSnapshot, validateContextSnapshots, validateExternalCodingBenchmarkReport, verifyEvidenceBundle, verifyRun };
|