@agent-inspect/vitest 6.19.0 → 6.20.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 CHANGED
@@ -182,7 +182,8 @@ interface TraceContractToolRules {
182
182
  /**
183
183
  * Unconditional tool presence invariant. Every named tool must appear at least
184
184
  * once. Do not use for cache-hit or alternate-path shortcuts — prefer
185
- * `observations.required` until `alternatives.anyOf` ships (planned 6.20.0).
185
+ * `alternatives.anyOf` or `observations.required` when a legitimate path may
186
+ * skip the tool.
186
187
  *
187
188
  * @see docs/TRACE-CONTRACTS.md
188
189
  */
@@ -195,25 +196,34 @@ interface TraceContractToolRules {
195
196
  allowed?: string[];
196
197
  maxCalls?: number;
197
198
  /**
198
- * Required tool order as adjacent first-occurrence pairs (start/encounter order).
199
+ * Required tool order expanded into adjacent pairs.
199
200
  *
200
201
  * `[A, B, C]` expands to “A before B” and “B before C”, each comparing the
201
- * first occurrence of the named tool. Unlisted intermediate tools are
202
- * allowed. Later repetitions do not invalidate an earlier valid order.
202
+ * selected `requiredOrderMode` to every pair. Unlisted intermediate tools
203
+ * are allowed.
203
204
  *
204
205
  * TraceContract `requiredOrder` **implies presence**: every listed name is
205
206
  * added to the effective required-tool set. Low-level `createToolOrderingRule`
206
207
  * alone may still pass vacuously when an endpoint is missing.
207
208
  *
208
- * This is **not** causal happens-before. Overlapping intervals emit a
209
- * non-failing overlap warning. Planned modes (6.20.0, GitHub #308):
210
- * `happens-before`, `all-occurrences`.
209
+ * The default `first-occurrence` mode preserves first-occurrence encounter
210
+ * ordering; overlapping intervals emit a non-failing warning. `happens-before`
211
+ * requires the first before event to finish before the first after event starts.
212
+ * `all-occurrences` applies that causal boundary to every occurrence.
211
213
  *
212
214
  * @see docs/TRACE-CONTRACTS.md
213
215
  * @beta Available through `agent-inspect/checks`. Additive changes may ship
214
216
  * in minor releases; breaking changes require a future major.
215
217
  */
216
218
  requiredOrder?: string[];
219
+ /**
220
+ * Ordering semantics applied to every adjacent pair in `requiredOrder`.
221
+ * Causal modes fail closed when a required interval boundary is unavailable.
222
+ *
223
+ * @defaultValue `"first-occurrence"`
224
+ * @beta Available through `agent-inspect/checks`.
225
+ */
226
+ requiredOrderMode?: "first-occurrence" | "happens-before" | "all-occurrences";
217
227
  }
218
228
  interface TraceContractLlmRules {
219
229
  maxCalls?: number;
@@ -224,11 +234,40 @@ interface TraceContractObservationRules {
224
234
  required?: string[];
225
235
  failOn?: Array<"failed" | "unknown" | "skipped">;
226
236
  }
227
- interface TraceContractInput {
237
+ /**
238
+ * One deterministic alternate path. Branch contracts are one level only —
239
+ * nested `alternatives` are rejected.
240
+ *
241
+ * @experimental
242
+ */
243
+ interface TraceContractAlternativeBranch {
244
+ /** Unique branch id within `alternatives.anyOf`. */
245
+ id: string;
246
+ description?: string;
247
+ /** Branch body: run/tools/llm/observations only (no nested alternatives). */
248
+ contract: TraceContractBody;
249
+ }
250
+ /**
251
+ * Bounded alternative valid paths for legitimate shortcuts (GitHub #309).
252
+ *
253
+ * @experimental
254
+ */
255
+ interface TraceContractAlternatives {
256
+ /**
257
+ * One level of named branches. The overall contract passes when the base
258
+ * rules pass and **at least one** complete branch passes.
259
+ */
260
+ anyOf: TraceContractAlternativeBranch[];
261
+ }
262
+ /** Contract body without alternatives (base or branch). */
263
+ type TraceContractBody = {
228
264
  run?: TraceContractRunRules;
229
265
  tools?: TraceContractToolRules;
230
266
  llm?: TraceContractLlmRules;
231
267
  observations?: TraceContractObservationRules;
268
+ };
269
+ interface TraceContractInput extends TraceContractBody {
270
+ alternatives?: TraceContractAlternatives;
232
271
  }
233
272
 
234
273
  /**
package/dist/index.d.ts CHANGED
@@ -182,7 +182,8 @@ interface TraceContractToolRules {
182
182
  /**
183
183
  * Unconditional tool presence invariant. Every named tool must appear at least
184
184
  * once. Do not use for cache-hit or alternate-path shortcuts — prefer
185
- * `observations.required` until `alternatives.anyOf` ships (planned 6.20.0).
185
+ * `alternatives.anyOf` or `observations.required` when a legitimate path may
186
+ * skip the tool.
186
187
  *
187
188
  * @see docs/TRACE-CONTRACTS.md
188
189
  */
@@ -195,25 +196,34 @@ interface TraceContractToolRules {
195
196
  allowed?: string[];
196
197
  maxCalls?: number;
197
198
  /**
198
- * Required tool order as adjacent first-occurrence pairs (start/encounter order).
199
+ * Required tool order expanded into adjacent pairs.
199
200
  *
200
201
  * `[A, B, C]` expands to “A before B” and “B before C”, each comparing the
201
- * first occurrence of the named tool. Unlisted intermediate tools are
202
- * allowed. Later repetitions do not invalidate an earlier valid order.
202
+ * selected `requiredOrderMode` to every pair. Unlisted intermediate tools
203
+ * are allowed.
203
204
  *
204
205
  * TraceContract `requiredOrder` **implies presence**: every listed name is
205
206
  * added to the effective required-tool set. Low-level `createToolOrderingRule`
206
207
  * alone may still pass vacuously when an endpoint is missing.
207
208
  *
208
- * This is **not** causal happens-before. Overlapping intervals emit a
209
- * non-failing overlap warning. Planned modes (6.20.0, GitHub #308):
210
- * `happens-before`, `all-occurrences`.
209
+ * The default `first-occurrence` mode preserves first-occurrence encounter
210
+ * ordering; overlapping intervals emit a non-failing warning. `happens-before`
211
+ * requires the first before event to finish before the first after event starts.
212
+ * `all-occurrences` applies that causal boundary to every occurrence.
211
213
  *
212
214
  * @see docs/TRACE-CONTRACTS.md
213
215
  * @beta Available through `agent-inspect/checks`. Additive changes may ship
214
216
  * in minor releases; breaking changes require a future major.
215
217
  */
216
218
  requiredOrder?: string[];
219
+ /**
220
+ * Ordering semantics applied to every adjacent pair in `requiredOrder`.
221
+ * Causal modes fail closed when a required interval boundary is unavailable.
222
+ *
223
+ * @defaultValue `"first-occurrence"`
224
+ * @beta Available through `agent-inspect/checks`.
225
+ */
226
+ requiredOrderMode?: "first-occurrence" | "happens-before" | "all-occurrences";
217
227
  }
218
228
  interface TraceContractLlmRules {
219
229
  maxCalls?: number;
@@ -224,11 +234,40 @@ interface TraceContractObservationRules {
224
234
  required?: string[];
225
235
  failOn?: Array<"failed" | "unknown" | "skipped">;
226
236
  }
227
- interface TraceContractInput {
237
+ /**
238
+ * One deterministic alternate path. Branch contracts are one level only —
239
+ * nested `alternatives` are rejected.
240
+ *
241
+ * @experimental
242
+ */
243
+ interface TraceContractAlternativeBranch {
244
+ /** Unique branch id within `alternatives.anyOf`. */
245
+ id: string;
246
+ description?: string;
247
+ /** Branch body: run/tools/llm/observations only (no nested alternatives). */
248
+ contract: TraceContractBody;
249
+ }
250
+ /**
251
+ * Bounded alternative valid paths for legitimate shortcuts (GitHub #309).
252
+ *
253
+ * @experimental
254
+ */
255
+ interface TraceContractAlternatives {
256
+ /**
257
+ * One level of named branches. The overall contract passes when the base
258
+ * rules pass and **at least one** complete branch passes.
259
+ */
260
+ anyOf: TraceContractAlternativeBranch[];
261
+ }
262
+ /** Contract body without alternatives (base or branch). */
263
+ type TraceContractBody = {
228
264
  run?: TraceContractRunRules;
229
265
  tools?: TraceContractToolRules;
230
266
  llm?: TraceContractLlmRules;
231
267
  observations?: TraceContractObservationRules;
268
+ };
269
+ interface TraceContractInput extends TraceContractBody {
270
+ alternatives?: TraceContractAlternatives;
232
271
  }
233
272
 
234
273
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-inspect/vitest",
3
- "version": "6.19.0",
3
+ "version": "6.20.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Vitest reporter and experimental TraceContract matchers for AgentInspect local evidence",
@@ -37,7 +37,7 @@
37
37
  "vitest": "^2.1.0 || ^3.2.6"
38
38
  },
39
39
  "dependencies": {
40
- "agent-inspect": "6.19.0"
40
+ "agent-inspect": "6.20.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "vitest": "^3.2.7"