@agent-inspect/jest 6.22.0 → 6.23.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/dist/index.d.cts +140 -0
- package/dist/index.d.ts +140 -0
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -188,6 +188,108 @@ interface TraceContractScope {
|
|
|
188
188
|
rootEventId?: string;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
+
/**
|
|
192
|
+
* Declared-versus-enforced control checks for TraceContract (6.23).
|
|
193
|
+
*
|
|
194
|
+
* A stored declaration is not proof of enforcement.
|
|
195
|
+
*
|
|
196
|
+
* @experimental
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
type ControlStage = "declared" | "presented" | "validated" | "enforced" | "observed" | "accepted";
|
|
200
|
+
interface TraceContractControlRules {
|
|
201
|
+
/**
|
|
202
|
+
* Tools declared/presented to the agent (inline). Distinct from `enforcedTools`.
|
|
203
|
+
*/
|
|
204
|
+
declaredTools?: string[];
|
|
205
|
+
/**
|
|
206
|
+
* Tools the harness claims to enforce (inline allowlist).
|
|
207
|
+
*/
|
|
208
|
+
enforcedTools?: string[];
|
|
209
|
+
/**
|
|
210
|
+
* RUN/event attribute holding a string[] of declared tool names.
|
|
211
|
+
* Used when `declaredTools` is omitted.
|
|
212
|
+
*/
|
|
213
|
+
declaredToolsAttribute?: string;
|
|
214
|
+
/**
|
|
215
|
+
* RUN/event attribute holding a string[] of enforced tool names.
|
|
216
|
+
*/
|
|
217
|
+
enforcedToolsAttribute?: string;
|
|
218
|
+
/**
|
|
219
|
+
* Fail when both declared and enforced sets resolve and differ.
|
|
220
|
+
*/
|
|
221
|
+
requireDeclaredMatchesEnforced?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Fail when any observed finished tool is outside the enforced set.
|
|
224
|
+
*/
|
|
225
|
+
requireObservedWithinEnforced?: boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Fail when any observed finished tool is outside the declared set.
|
|
228
|
+
*/
|
|
229
|
+
requireObservedWithinDeclared?: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Require observation names for control stages (default `control.<stage>`).
|
|
232
|
+
*/
|
|
233
|
+
requiredStages?: Array<{
|
|
234
|
+
stage: ControlStage;
|
|
235
|
+
/** Observation name; defaults to `control.<stage>`. */
|
|
236
|
+
observation?: string;
|
|
237
|
+
}>;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Retry / side-effect safety checks for TraceContract (6.23).
|
|
242
|
+
*
|
|
243
|
+
* Uses explicit attempt identity from session workflow metadata.
|
|
244
|
+
* AgentInspect evaluates; it does not perform retries.
|
|
245
|
+
*
|
|
246
|
+
* @experimental
|
|
247
|
+
*/
|
|
248
|
+
|
|
249
|
+
interface TraceContractRetryRules {
|
|
250
|
+
/**
|
|
251
|
+
* Maximum attempts per `operationId` (or `attemptOf` grouping).
|
|
252
|
+
* Counts distinct `attemptId` values when present, else finished tool/LLM events.
|
|
253
|
+
*/
|
|
254
|
+
maxAttempts?: number;
|
|
255
|
+
/**
|
|
256
|
+
* When true, every operation with attempts must include a non-running terminal event.
|
|
257
|
+
*/
|
|
258
|
+
requireTerminalResult?: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Fail when `fallbackOf` is set without a prior error attempt for the referenced operation.
|
|
261
|
+
*/
|
|
262
|
+
fallbackOnlyAfterFailure?: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Tool names treated as non-idempotent. A later attempt after an `ok` occurrence fails
|
|
265
|
+
* unless idempotency / no-side-effect evidence is present on the retry.
|
|
266
|
+
*/
|
|
267
|
+
nonIdempotentTools?: string[];
|
|
268
|
+
/**
|
|
269
|
+
* When true, retries require `idempotencyKey` or `attributes.noSideEffect === true`.
|
|
270
|
+
*/
|
|
271
|
+
requireIdempotencyEvidenceForRetry?: boolean;
|
|
272
|
+
/**
|
|
273
|
+
* When true, recovered success paths must still retain at least one error attempt event.
|
|
274
|
+
*/
|
|
275
|
+
requireRecoveredFailureVisible?: boolean;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
type ToolArgumentOperator = "exists" | "type" | "equals" | "oneOf";
|
|
279
|
+
type ToolArgumentOccurrence = "first" | "last" | "any" | "all";
|
|
280
|
+
interface ToolArgumentCheck {
|
|
281
|
+
tool: string;
|
|
282
|
+
path: string;
|
|
283
|
+
operator: ToolArgumentOperator;
|
|
284
|
+
occurrence?: ToolArgumentOccurrence;
|
|
285
|
+
/** Required for `equals`. */
|
|
286
|
+
expected?: unknown;
|
|
287
|
+
/** Required for `oneOf`. */
|
|
288
|
+
oneOf?: readonly unknown[];
|
|
289
|
+
/** Required for `type` (`string` | `number` | `boolean` | `object` | `array` | `null`). */
|
|
290
|
+
type?: "string" | "number" | "boolean" | "object" | "array" | "null";
|
|
291
|
+
}
|
|
292
|
+
|
|
191
293
|
/**
|
|
192
294
|
* @experimental Typed trace contract input. Evolves during v6.5.x.
|
|
193
295
|
*/
|
|
@@ -242,6 +344,32 @@ interface TraceContractToolRules {
|
|
|
242
344
|
* @beta Available through `agent-inspect/checks`.
|
|
243
345
|
*/
|
|
244
346
|
requiredOrderMode?: "first-occurrence" | "happens-before" | "all-occurrences";
|
|
347
|
+
/**
|
|
348
|
+
* Bounded structured tool-argument checks (JSON Pointer + limited operators).
|
|
349
|
+
*
|
|
350
|
+
* Missing structured evidence fails closed as unevaluable (not pass).
|
|
351
|
+
* Findings never embed full actual inputs.
|
|
352
|
+
*
|
|
353
|
+
* @experimental Additive in 6.23.
|
|
354
|
+
*/
|
|
355
|
+
arguments?: ToolArgumentCheck[];
|
|
356
|
+
/**
|
|
357
|
+
* Default occurrence mode for `orderRules` when a rule omits `occurrenceMode`.
|
|
358
|
+
*
|
|
359
|
+
* @experimental Additive in 6.23.
|
|
360
|
+
*/
|
|
361
|
+
defaultOccurrenceMode?: "first-occurrence" | "happens-before" | "all-occurrences";
|
|
362
|
+
/**
|
|
363
|
+
* Mixed per-pair ordering rules (additive alongside `requiredOrder`).
|
|
364
|
+
*
|
|
365
|
+
* @experimental Additive in 6.23.
|
|
366
|
+
*/
|
|
367
|
+
orderRules?: Array<{
|
|
368
|
+
before: string;
|
|
369
|
+
after: string;
|
|
370
|
+
occurrenceMode?: "first-occurrence" | "happens-before" | "all-occurrences";
|
|
371
|
+
requireEndpoints?: boolean;
|
|
372
|
+
}>;
|
|
245
373
|
}
|
|
246
374
|
interface TraceContractLlmRules {
|
|
247
375
|
maxCalls?: number;
|
|
@@ -309,6 +437,18 @@ type TraceContractBody = {
|
|
|
309
437
|
tools?: TraceContractToolRules;
|
|
310
438
|
llm?: TraceContractLlmRules;
|
|
311
439
|
observations?: TraceContractObservationRules;
|
|
440
|
+
/**
|
|
441
|
+
* Declared-versus-enforced control invariants.
|
|
442
|
+
*
|
|
443
|
+
* @experimental Additive in 6.23.
|
|
444
|
+
*/
|
|
445
|
+
controls?: TraceContractControlRules;
|
|
446
|
+
/**
|
|
447
|
+
* Retry / side-effect safety using explicit attempt identity.
|
|
448
|
+
*
|
|
449
|
+
* @experimental Additive in 6.23.
|
|
450
|
+
*/
|
|
451
|
+
retry?: TraceContractRetryRules;
|
|
312
452
|
};
|
|
313
453
|
interface TraceContractInput extends TraceContractBody {
|
|
314
454
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -188,6 +188,108 @@ interface TraceContractScope {
|
|
|
188
188
|
rootEventId?: string;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
+
/**
|
|
192
|
+
* Declared-versus-enforced control checks for TraceContract (6.23).
|
|
193
|
+
*
|
|
194
|
+
* A stored declaration is not proof of enforcement.
|
|
195
|
+
*
|
|
196
|
+
* @experimental
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
type ControlStage = "declared" | "presented" | "validated" | "enforced" | "observed" | "accepted";
|
|
200
|
+
interface TraceContractControlRules {
|
|
201
|
+
/**
|
|
202
|
+
* Tools declared/presented to the agent (inline). Distinct from `enforcedTools`.
|
|
203
|
+
*/
|
|
204
|
+
declaredTools?: string[];
|
|
205
|
+
/**
|
|
206
|
+
* Tools the harness claims to enforce (inline allowlist).
|
|
207
|
+
*/
|
|
208
|
+
enforcedTools?: string[];
|
|
209
|
+
/**
|
|
210
|
+
* RUN/event attribute holding a string[] of declared tool names.
|
|
211
|
+
* Used when `declaredTools` is omitted.
|
|
212
|
+
*/
|
|
213
|
+
declaredToolsAttribute?: string;
|
|
214
|
+
/**
|
|
215
|
+
* RUN/event attribute holding a string[] of enforced tool names.
|
|
216
|
+
*/
|
|
217
|
+
enforcedToolsAttribute?: string;
|
|
218
|
+
/**
|
|
219
|
+
* Fail when both declared and enforced sets resolve and differ.
|
|
220
|
+
*/
|
|
221
|
+
requireDeclaredMatchesEnforced?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Fail when any observed finished tool is outside the enforced set.
|
|
224
|
+
*/
|
|
225
|
+
requireObservedWithinEnforced?: boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Fail when any observed finished tool is outside the declared set.
|
|
228
|
+
*/
|
|
229
|
+
requireObservedWithinDeclared?: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Require observation names for control stages (default `control.<stage>`).
|
|
232
|
+
*/
|
|
233
|
+
requiredStages?: Array<{
|
|
234
|
+
stage: ControlStage;
|
|
235
|
+
/** Observation name; defaults to `control.<stage>`. */
|
|
236
|
+
observation?: string;
|
|
237
|
+
}>;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Retry / side-effect safety checks for TraceContract (6.23).
|
|
242
|
+
*
|
|
243
|
+
* Uses explicit attempt identity from session workflow metadata.
|
|
244
|
+
* AgentInspect evaluates; it does not perform retries.
|
|
245
|
+
*
|
|
246
|
+
* @experimental
|
|
247
|
+
*/
|
|
248
|
+
|
|
249
|
+
interface TraceContractRetryRules {
|
|
250
|
+
/**
|
|
251
|
+
* Maximum attempts per `operationId` (or `attemptOf` grouping).
|
|
252
|
+
* Counts distinct `attemptId` values when present, else finished tool/LLM events.
|
|
253
|
+
*/
|
|
254
|
+
maxAttempts?: number;
|
|
255
|
+
/**
|
|
256
|
+
* When true, every operation with attempts must include a non-running terminal event.
|
|
257
|
+
*/
|
|
258
|
+
requireTerminalResult?: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Fail when `fallbackOf` is set without a prior error attempt for the referenced operation.
|
|
261
|
+
*/
|
|
262
|
+
fallbackOnlyAfterFailure?: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Tool names treated as non-idempotent. A later attempt after an `ok` occurrence fails
|
|
265
|
+
* unless idempotency / no-side-effect evidence is present on the retry.
|
|
266
|
+
*/
|
|
267
|
+
nonIdempotentTools?: string[];
|
|
268
|
+
/**
|
|
269
|
+
* When true, retries require `idempotencyKey` or `attributes.noSideEffect === true`.
|
|
270
|
+
*/
|
|
271
|
+
requireIdempotencyEvidenceForRetry?: boolean;
|
|
272
|
+
/**
|
|
273
|
+
* When true, recovered success paths must still retain at least one error attempt event.
|
|
274
|
+
*/
|
|
275
|
+
requireRecoveredFailureVisible?: boolean;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
type ToolArgumentOperator = "exists" | "type" | "equals" | "oneOf";
|
|
279
|
+
type ToolArgumentOccurrence = "first" | "last" | "any" | "all";
|
|
280
|
+
interface ToolArgumentCheck {
|
|
281
|
+
tool: string;
|
|
282
|
+
path: string;
|
|
283
|
+
operator: ToolArgumentOperator;
|
|
284
|
+
occurrence?: ToolArgumentOccurrence;
|
|
285
|
+
/** Required for `equals`. */
|
|
286
|
+
expected?: unknown;
|
|
287
|
+
/** Required for `oneOf`. */
|
|
288
|
+
oneOf?: readonly unknown[];
|
|
289
|
+
/** Required for `type` (`string` | `number` | `boolean` | `object` | `array` | `null`). */
|
|
290
|
+
type?: "string" | "number" | "boolean" | "object" | "array" | "null";
|
|
291
|
+
}
|
|
292
|
+
|
|
191
293
|
/**
|
|
192
294
|
* @experimental Typed trace contract input. Evolves during v6.5.x.
|
|
193
295
|
*/
|
|
@@ -242,6 +344,32 @@ interface TraceContractToolRules {
|
|
|
242
344
|
* @beta Available through `agent-inspect/checks`.
|
|
243
345
|
*/
|
|
244
346
|
requiredOrderMode?: "first-occurrence" | "happens-before" | "all-occurrences";
|
|
347
|
+
/**
|
|
348
|
+
* Bounded structured tool-argument checks (JSON Pointer + limited operators).
|
|
349
|
+
*
|
|
350
|
+
* Missing structured evidence fails closed as unevaluable (not pass).
|
|
351
|
+
* Findings never embed full actual inputs.
|
|
352
|
+
*
|
|
353
|
+
* @experimental Additive in 6.23.
|
|
354
|
+
*/
|
|
355
|
+
arguments?: ToolArgumentCheck[];
|
|
356
|
+
/**
|
|
357
|
+
* Default occurrence mode for `orderRules` when a rule omits `occurrenceMode`.
|
|
358
|
+
*
|
|
359
|
+
* @experimental Additive in 6.23.
|
|
360
|
+
*/
|
|
361
|
+
defaultOccurrenceMode?: "first-occurrence" | "happens-before" | "all-occurrences";
|
|
362
|
+
/**
|
|
363
|
+
* Mixed per-pair ordering rules (additive alongside `requiredOrder`).
|
|
364
|
+
*
|
|
365
|
+
* @experimental Additive in 6.23.
|
|
366
|
+
*/
|
|
367
|
+
orderRules?: Array<{
|
|
368
|
+
before: string;
|
|
369
|
+
after: string;
|
|
370
|
+
occurrenceMode?: "first-occurrence" | "happens-before" | "all-occurrences";
|
|
371
|
+
requireEndpoints?: boolean;
|
|
372
|
+
}>;
|
|
245
373
|
}
|
|
246
374
|
interface TraceContractLlmRules {
|
|
247
375
|
maxCalls?: number;
|
|
@@ -309,6 +437,18 @@ type TraceContractBody = {
|
|
|
309
437
|
tools?: TraceContractToolRules;
|
|
310
438
|
llm?: TraceContractLlmRules;
|
|
311
439
|
observations?: TraceContractObservationRules;
|
|
440
|
+
/**
|
|
441
|
+
* Declared-versus-enforced control invariants.
|
|
442
|
+
*
|
|
443
|
+
* @experimental Additive in 6.23.
|
|
444
|
+
*/
|
|
445
|
+
controls?: TraceContractControlRules;
|
|
446
|
+
/**
|
|
447
|
+
* Retry / side-effect safety using explicit attempt identity.
|
|
448
|
+
*
|
|
449
|
+
* @experimental Additive in 6.23.
|
|
450
|
+
*/
|
|
451
|
+
retry?: TraceContractRetryRules;
|
|
312
452
|
};
|
|
313
453
|
interface TraceContractInput extends TraceContractBody {
|
|
314
454
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-inspect/jest",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.23.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Jest reporter and experimental TraceContract matchers for AgentInspect local evidence",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"agent-inspect": "6.
|
|
45
|
+
"agent-inspect": "6.23.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"jest": "^30.2.0"
|