agent-inspect 6.19.1 → 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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/docs/TRACE-CONTRACTS.md +64 -52
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-QDYVK4MF.mjs → chunk-QPRJUVLH.mjs} +2 -2
- package/packages/cli/dist/{chunk-QDYVK4MF.mjs.map → chunk-QPRJUVLH.mjs.map} +1 -1
- package/packages/cli/dist/index.cjs +1 -1
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +4 -4
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-CIC27TS2.mjs → src-6W5ZR3I7.mjs} +3 -3
- package/packages/cli/dist/{src-CIC27TS2.mjs.map → src-6W5ZR3I7.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.d.cts +1 -1
- package/packages/core/dist/advanced.d.ts +1 -1
- package/packages/core/dist/advanced.mjs +1 -1
- package/packages/core/dist/checks.cjs +443 -9
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.d.cts +78 -16
- package/packages/core/dist/checks.d.ts +78 -16
- package/packages/core/dist/checks.mjs +1 -1
- package/packages/core/dist/{chunk-6LP2J5CA.mjs → chunk-G47KQB42.mjs} +444 -12
- package/packages/core/dist/chunk-G47KQB42.mjs.map +1 -0
- package/packages/core/dist/{index-DKwuGSe-.d.ts → index-Bg9ZdsdS.d.ts} +10 -0
- package/packages/core/dist/{index-DCR816Yt.d.cts → index-rVpX5PPh.d.cts} +10 -0
- package/packages/core/dist/chunk-6LP2J5CA.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LogicalTraceEvent, a as LogicalProjectionDiagnostic, T as TraceCheckInput, b as TraceCheckResult } from './index-
|
|
2
|
-
export { B as BaselineRegressionRuleOptions, D as DecisionRuleOptions, G as GuardrailRuleOptions, c as LlmUsageRuleOptions, M as MaxStepDurationRuleOptions, O as ObservedOutcomeRuleOptions, R as RetrievalRuleOptions, d as RunDepthRuleOptions, e as RunDurationRuleOptions, f as RunEventCountRuleOptions, g as RunStatusRuleOptions, h as RunTraceChecksOptions, S as SafetyFindingCategory, i as SafetyFindingConfidence, j as SafetyOversizedAttributeRuleOptions, k as SafetyRawContentRuleOptions, l as SafetyRedactionRuleOptions, m as SafetySecretPattern, n as SafetySecretPatternRuleOptions, o as StallDetectionRuleOptions, p as StructureIncompleteRuleOptions, q as StructureOrphanRuleOptions, r as StructureParallelWidthRuleOptions, s as StructureRelationshipRuleOptions, t as ToolFailureRuleOptions, u as ToolOrderingRuleOptions, v as ToolUsageRuleOptions, w as TraceCheckContext, x as TraceCheckDiagnostic, y as TraceCheckDiagnosticCode, z as TraceCheckEvidence, A as TraceCheckFacts, C as TraceCheckFinding, E as TraceCheckFindingStatus, F as TraceCheckRule, H as TraceCheckRuleCategory, I as TraceCheckRuleExecution, J as TraceCheckRuleExecutionStatus, K as TraceCheckSeverity, N as TraceCheckStatus, P as TraceCheckSummary, Q as TraceSignalRuleOptions, U as createBaselineRegressionRule, V as createDecisionRule, W as createGuardrailRule, X as createLlmUsageRule, Y as createMaxStepDurationRule, Z as createObservedOutcomeRule, _ as createRequireCompletedRule, $ as createRetrievalRule, a0 as createRunDepthRule, a1 as createRunDurationRule, a2 as createRunEventCountRule, a3 as createRunStatusRule, a4 as createSafetyOversizedAttributeRule, a5 as createSafetyRawContentRule, a6 as createSafetyRedactionRule, a7 as createSafetySecretPatternRule, a8 as createStallDetectionRule, a9 as createStructureCycleRule, aa as createStructureIncompleteRule, ab as createStructureOrphanRule, ac as createStructureParallelWidthRule, ad as createStructureRelationshipRule, ae as createToolFailureRule, af as createToolOrderingRule, ag as createToolUsageRule, ah as projectLogicalEvents, ai as resolveCanonicalToolName, aj as runTraceChecks } from './index-
|
|
1
|
+
import { L as LogicalTraceEvent, a as LogicalProjectionDiagnostic, T as TraceCheckInput, b as TraceCheckResult } from './index-rVpX5PPh.cjs';
|
|
2
|
+
export { B as BaselineRegressionRuleOptions, D as DecisionRuleOptions, G as GuardrailRuleOptions, c as LlmUsageRuleOptions, M as MaxStepDurationRuleOptions, O as ObservedOutcomeRuleOptions, R as RetrievalRuleOptions, d as RunDepthRuleOptions, e as RunDurationRuleOptions, f as RunEventCountRuleOptions, g as RunStatusRuleOptions, h as RunTraceChecksOptions, S as SafetyFindingCategory, i as SafetyFindingConfidence, j as SafetyOversizedAttributeRuleOptions, k as SafetyRawContentRuleOptions, l as SafetyRedactionRuleOptions, m as SafetySecretPattern, n as SafetySecretPatternRuleOptions, o as StallDetectionRuleOptions, p as StructureIncompleteRuleOptions, q as StructureOrphanRuleOptions, r as StructureParallelWidthRuleOptions, s as StructureRelationshipRuleOptions, t as ToolFailureRuleOptions, u as ToolOrderingRuleOptions, v as ToolUsageRuleOptions, w as TraceCheckContext, x as TraceCheckDiagnostic, y as TraceCheckDiagnosticCode, z as TraceCheckEvidence, A as TraceCheckFacts, C as TraceCheckFinding, E as TraceCheckFindingStatus, F as TraceCheckRule, H as TraceCheckRuleCategory, I as TraceCheckRuleExecution, J as TraceCheckRuleExecutionStatus, K as TraceCheckSeverity, N as TraceCheckStatus, P as TraceCheckSummary, Q as TraceSignalRuleOptions, U as createBaselineRegressionRule, V as createDecisionRule, W as createGuardrailRule, X as createLlmUsageRule, Y as createMaxStepDurationRule, Z as createObservedOutcomeRule, _ as createRequireCompletedRule, $ as createRetrievalRule, a0 as createRunDepthRule, a1 as createRunDurationRule, a2 as createRunEventCountRule, a3 as createRunStatusRule, a4 as createSafetyOversizedAttributeRule, a5 as createSafetyRawContentRule, a6 as createSafetyRedactionRule, a7 as createSafetySecretPatternRule, a8 as createStallDetectionRule, a9 as createStructureCycleRule, aa as createStructureIncompleteRule, ab as createStructureOrphanRule, ac as createStructureParallelWidthRule, ad as createStructureRelationshipRule, ae as createToolFailureRule, af as createToolOrderingRule, ag as createToolUsageRule, ah as projectLogicalEvents, ai as resolveCanonicalToolName, aj as runTraceChecks } from './index-rVpX5PPh.cjs';
|
|
3
3
|
export { PROGRAMMATIC_DIAGNOSTIC_SPECS, ProgrammaticDiagnosticCode, ProgrammaticDiagnosticSpec, formatProgrammaticDiagnostic } from './readers.cjs';
|
|
4
4
|
import { a as TraceReadResult } from './index-vqr-g6ev.cjs';
|
|
5
5
|
import { P as PersistedInspectEvent } from './persisted-inspect-event-CVZWZldL.cjs';
|
|
@@ -146,7 +146,8 @@ interface TraceContractToolRules {
|
|
|
146
146
|
/**
|
|
147
147
|
* Unconditional tool presence invariant. Every named tool must appear at least
|
|
148
148
|
* once. Do not use for cache-hit or alternate-path shortcuts — prefer
|
|
149
|
-
* `
|
|
149
|
+
* `alternatives.anyOf` or `observations.required` when a legitimate path may
|
|
150
|
+
* skip the tool.
|
|
150
151
|
*
|
|
151
152
|
* @see docs/TRACE-CONTRACTS.md
|
|
152
153
|
*/
|
|
@@ -159,25 +160,34 @@ interface TraceContractToolRules {
|
|
|
159
160
|
allowed?: string[];
|
|
160
161
|
maxCalls?: number;
|
|
161
162
|
/**
|
|
162
|
-
* Required tool order
|
|
163
|
+
* Required tool order expanded into adjacent pairs.
|
|
163
164
|
*
|
|
164
165
|
* `[A, B, C]` expands to “A before B” and “B before C”, each comparing the
|
|
165
|
-
*
|
|
166
|
-
* allowed.
|
|
166
|
+
* selected `requiredOrderMode` to every pair. Unlisted intermediate tools
|
|
167
|
+
* are allowed.
|
|
167
168
|
*
|
|
168
169
|
* TraceContract `requiredOrder` **implies presence**: every listed name is
|
|
169
170
|
* added to the effective required-tool set. Low-level `createToolOrderingRule`
|
|
170
171
|
* alone may still pass vacuously when an endpoint is missing.
|
|
171
172
|
*
|
|
172
|
-
*
|
|
173
|
-
* non-failing
|
|
174
|
-
*
|
|
173
|
+
* The default `first-occurrence` mode preserves first-occurrence encounter
|
|
174
|
+
* ordering; overlapping intervals emit a non-failing warning. `happens-before`
|
|
175
|
+
* requires the first before event to finish before the first after event starts.
|
|
176
|
+
* `all-occurrences` applies that causal boundary to every occurrence.
|
|
175
177
|
*
|
|
176
178
|
* @see docs/TRACE-CONTRACTS.md
|
|
177
179
|
* @beta Available through `agent-inspect/checks`. Additive changes may ship
|
|
178
180
|
* in minor releases; breaking changes require a future major.
|
|
179
181
|
*/
|
|
180
182
|
requiredOrder?: string[];
|
|
183
|
+
/**
|
|
184
|
+
* Ordering semantics applied to every adjacent pair in `requiredOrder`.
|
|
185
|
+
* Causal modes fail closed when a required interval boundary is unavailable.
|
|
186
|
+
*
|
|
187
|
+
* @defaultValue `"first-occurrence"`
|
|
188
|
+
* @beta Available through `agent-inspect/checks`.
|
|
189
|
+
*/
|
|
190
|
+
requiredOrderMode?: "first-occurrence" | "happens-before" | "all-occurrences";
|
|
181
191
|
}
|
|
182
192
|
interface TraceContractLlmRules {
|
|
183
193
|
maxCalls?: number;
|
|
@@ -188,17 +198,54 @@ interface TraceContractObservationRules {
|
|
|
188
198
|
required?: string[];
|
|
189
199
|
failOn?: Array<"failed" | "unknown" | "skipped">;
|
|
190
200
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
201
|
+
/**
|
|
202
|
+
* One deterministic alternate path. Branch contracts are one level only —
|
|
203
|
+
* nested `alternatives` are rejected.
|
|
204
|
+
*
|
|
205
|
+
* @experimental
|
|
206
|
+
*/
|
|
207
|
+
interface TraceContractAlternativeBranch {
|
|
208
|
+
/** Unique branch id within `alternatives.anyOf`. */
|
|
209
|
+
id: string;
|
|
210
|
+
description?: string;
|
|
211
|
+
/** Branch body: run/tools/llm/observations only (no nested alternatives). */
|
|
212
|
+
contract: TraceContractBody;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Bounded alternative valid paths for legitimate shortcuts (GitHub #309).
|
|
216
|
+
*
|
|
217
|
+
* @experimental
|
|
218
|
+
*/
|
|
219
|
+
interface TraceContractAlternatives {
|
|
220
|
+
/**
|
|
221
|
+
* One level of named branches. The overall contract passes when the base
|
|
222
|
+
* rules pass and **at least one** complete branch passes.
|
|
223
|
+
*/
|
|
224
|
+
anyOf: TraceContractAlternativeBranch[];
|
|
196
225
|
}
|
|
197
|
-
|
|
226
|
+
/** Contract body without alternatives (base or branch). */
|
|
227
|
+
type TraceContractBody = {
|
|
198
228
|
run?: TraceContractRunRules;
|
|
199
229
|
tools?: TraceContractToolRules;
|
|
200
230
|
llm?: TraceContractLlmRules;
|
|
201
231
|
observations?: TraceContractObservationRules;
|
|
232
|
+
};
|
|
233
|
+
interface TraceContractInput extends TraceContractBody {
|
|
234
|
+
alternatives?: TraceContractAlternatives;
|
|
235
|
+
}
|
|
236
|
+
interface TraceContract extends TraceContractBody {
|
|
237
|
+
alternatives?: TraceContractAlternatives;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Lint diagnostic for brittle or invalid TraceContract shapes.
|
|
241
|
+
*
|
|
242
|
+
* @experimental
|
|
243
|
+
*/
|
|
244
|
+
interface TraceContractLintDiagnostic {
|
|
245
|
+
code: string;
|
|
246
|
+
severity: "error" | "warning" | "info";
|
|
247
|
+
message: string;
|
|
248
|
+
path?: string;
|
|
202
249
|
}
|
|
203
250
|
/**
|
|
204
251
|
* Define a normalized trace contract object.
|
|
@@ -209,6 +256,9 @@ declare function defineTraceContract(input: TraceContractInput): TraceContract;
|
|
|
209
256
|
/**
|
|
210
257
|
* Evaluate a trace contract against an opened trace read result.
|
|
211
258
|
*
|
|
259
|
+
* Base rules always apply. When `alternatives.anyOf` is present, at least one
|
|
260
|
+
* complete branch must also pass.
|
|
261
|
+
*
|
|
212
262
|
* @experimental
|
|
213
263
|
*/
|
|
214
264
|
declare function evaluateTraceContract(input: TraceCheckInput, contract: TraceContract, options?: {
|
|
@@ -222,5 +272,17 @@ declare function evaluateTraceContract(input: TraceCheckInput, contract: TraceCo
|
|
|
222
272
|
declare function evaluateTraceContractRead(read: TraceReadResult, contract: TraceContract, options?: {
|
|
223
273
|
runId?: string;
|
|
224
274
|
}): TraceCheckResult;
|
|
275
|
+
/**
|
|
276
|
+
* Lint a TraceContract for invalid or brittle shapes (does not evaluate a trace).
|
|
277
|
+
*
|
|
278
|
+
* @experimental
|
|
279
|
+
*/
|
|
280
|
+
declare function lintTraceContract(contract: TraceContract): TraceContractLintDiagnostic[];
|
|
281
|
+
/**
|
|
282
|
+
* Explain a TraceContract as short human-readable lines (does not evaluate a trace).
|
|
283
|
+
*
|
|
284
|
+
* @experimental
|
|
285
|
+
*/
|
|
286
|
+
declare function explainTraceContract(contract: TraceContract): string[];
|
|
225
287
|
|
|
226
|
-
export { type DerivedFailureConfidence, type DerivedFailureFact, type DerivedFailureRole, type FailureRoleCounts, LogicalProjectionDiagnostic, LogicalTraceEvent, type SemanticParitySummary, TraceCheckInput, TraceCheckResult, type TraceContract, type TraceContractInput, type TraceContractLlmRules, type TraceContractObservationRules, type TraceContractRunRules, type TraceContractToolRules, type TraceFacts, buildTraceFacts, defineTraceContract, deriveFailureFacts, evaluateTraceContract, evaluateTraceContractRead, summarizeSemanticParity };
|
|
288
|
+
export { type DerivedFailureConfidence, type DerivedFailureFact, type DerivedFailureRole, type FailureRoleCounts, LogicalProjectionDiagnostic, LogicalTraceEvent, type SemanticParitySummary, TraceCheckInput, TraceCheckResult, type TraceContract, type TraceContractAlternativeBranch, type TraceContractAlternatives, type TraceContractBody, type TraceContractInput, type TraceContractLintDiagnostic, type TraceContractLlmRules, type TraceContractObservationRules, type TraceContractRunRules, type TraceContractToolRules, type TraceFacts, buildTraceFacts, defineTraceContract, deriveFailureFacts, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, lintTraceContract, summarizeSemanticParity };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LogicalTraceEvent, a as LogicalProjectionDiagnostic, T as TraceCheckInput, b as TraceCheckResult } from './index-
|
|
2
|
-
export { B as BaselineRegressionRuleOptions, D as DecisionRuleOptions, G as GuardrailRuleOptions, c as LlmUsageRuleOptions, M as MaxStepDurationRuleOptions, O as ObservedOutcomeRuleOptions, R as RetrievalRuleOptions, d as RunDepthRuleOptions, e as RunDurationRuleOptions, f as RunEventCountRuleOptions, g as RunStatusRuleOptions, h as RunTraceChecksOptions, S as SafetyFindingCategory, i as SafetyFindingConfidence, j as SafetyOversizedAttributeRuleOptions, k as SafetyRawContentRuleOptions, l as SafetyRedactionRuleOptions, m as SafetySecretPattern, n as SafetySecretPatternRuleOptions, o as StallDetectionRuleOptions, p as StructureIncompleteRuleOptions, q as StructureOrphanRuleOptions, r as StructureParallelWidthRuleOptions, s as StructureRelationshipRuleOptions, t as ToolFailureRuleOptions, u as ToolOrderingRuleOptions, v as ToolUsageRuleOptions, w as TraceCheckContext, x as TraceCheckDiagnostic, y as TraceCheckDiagnosticCode, z as TraceCheckEvidence, A as TraceCheckFacts, C as TraceCheckFinding, E as TraceCheckFindingStatus, F as TraceCheckRule, H as TraceCheckRuleCategory, I as TraceCheckRuleExecution, J as TraceCheckRuleExecutionStatus, K as TraceCheckSeverity, N as TraceCheckStatus, P as TraceCheckSummary, Q as TraceSignalRuleOptions, U as createBaselineRegressionRule, V as createDecisionRule, W as createGuardrailRule, X as createLlmUsageRule, Y as createMaxStepDurationRule, Z as createObservedOutcomeRule, _ as createRequireCompletedRule, $ as createRetrievalRule, a0 as createRunDepthRule, a1 as createRunDurationRule, a2 as createRunEventCountRule, a3 as createRunStatusRule, a4 as createSafetyOversizedAttributeRule, a5 as createSafetyRawContentRule, a6 as createSafetyRedactionRule, a7 as createSafetySecretPatternRule, a8 as createStallDetectionRule, a9 as createStructureCycleRule, aa as createStructureIncompleteRule, ab as createStructureOrphanRule, ac as createStructureParallelWidthRule, ad as createStructureRelationshipRule, ae as createToolFailureRule, af as createToolOrderingRule, ag as createToolUsageRule, ah as projectLogicalEvents, ai as resolveCanonicalToolName, aj as runTraceChecks } from './index-
|
|
1
|
+
import { L as LogicalTraceEvent, a as LogicalProjectionDiagnostic, T as TraceCheckInput, b as TraceCheckResult } from './index-Bg9ZdsdS.js';
|
|
2
|
+
export { B as BaselineRegressionRuleOptions, D as DecisionRuleOptions, G as GuardrailRuleOptions, c as LlmUsageRuleOptions, M as MaxStepDurationRuleOptions, O as ObservedOutcomeRuleOptions, R as RetrievalRuleOptions, d as RunDepthRuleOptions, e as RunDurationRuleOptions, f as RunEventCountRuleOptions, g as RunStatusRuleOptions, h as RunTraceChecksOptions, S as SafetyFindingCategory, i as SafetyFindingConfidence, j as SafetyOversizedAttributeRuleOptions, k as SafetyRawContentRuleOptions, l as SafetyRedactionRuleOptions, m as SafetySecretPattern, n as SafetySecretPatternRuleOptions, o as StallDetectionRuleOptions, p as StructureIncompleteRuleOptions, q as StructureOrphanRuleOptions, r as StructureParallelWidthRuleOptions, s as StructureRelationshipRuleOptions, t as ToolFailureRuleOptions, u as ToolOrderingRuleOptions, v as ToolUsageRuleOptions, w as TraceCheckContext, x as TraceCheckDiagnostic, y as TraceCheckDiagnosticCode, z as TraceCheckEvidence, A as TraceCheckFacts, C as TraceCheckFinding, E as TraceCheckFindingStatus, F as TraceCheckRule, H as TraceCheckRuleCategory, I as TraceCheckRuleExecution, J as TraceCheckRuleExecutionStatus, K as TraceCheckSeverity, N as TraceCheckStatus, P as TraceCheckSummary, Q as TraceSignalRuleOptions, U as createBaselineRegressionRule, V as createDecisionRule, W as createGuardrailRule, X as createLlmUsageRule, Y as createMaxStepDurationRule, Z as createObservedOutcomeRule, _ as createRequireCompletedRule, $ as createRetrievalRule, a0 as createRunDepthRule, a1 as createRunDurationRule, a2 as createRunEventCountRule, a3 as createRunStatusRule, a4 as createSafetyOversizedAttributeRule, a5 as createSafetyRawContentRule, a6 as createSafetyRedactionRule, a7 as createSafetySecretPatternRule, a8 as createStallDetectionRule, a9 as createStructureCycleRule, aa as createStructureIncompleteRule, ab as createStructureOrphanRule, ac as createStructureParallelWidthRule, ad as createStructureRelationshipRule, ae as createToolFailureRule, af as createToolOrderingRule, ag as createToolUsageRule, ah as projectLogicalEvents, ai as resolveCanonicalToolName, aj as runTraceChecks } from './index-Bg9ZdsdS.js';
|
|
3
3
|
export { PROGRAMMATIC_DIAGNOSTIC_SPECS, ProgrammaticDiagnosticCode, ProgrammaticDiagnosticSpec, formatProgrammaticDiagnostic } from './readers.js';
|
|
4
4
|
import { a as TraceReadResult } from './index-AMAGuO_i.js';
|
|
5
5
|
import { P as PersistedInspectEvent } from './persisted-inspect-event-BVucFVrP.js';
|
|
@@ -146,7 +146,8 @@ interface TraceContractToolRules {
|
|
|
146
146
|
/**
|
|
147
147
|
* Unconditional tool presence invariant. Every named tool must appear at least
|
|
148
148
|
* once. Do not use for cache-hit or alternate-path shortcuts — prefer
|
|
149
|
-
* `
|
|
149
|
+
* `alternatives.anyOf` or `observations.required` when a legitimate path may
|
|
150
|
+
* skip the tool.
|
|
150
151
|
*
|
|
151
152
|
* @see docs/TRACE-CONTRACTS.md
|
|
152
153
|
*/
|
|
@@ -159,25 +160,34 @@ interface TraceContractToolRules {
|
|
|
159
160
|
allowed?: string[];
|
|
160
161
|
maxCalls?: number;
|
|
161
162
|
/**
|
|
162
|
-
* Required tool order
|
|
163
|
+
* Required tool order expanded into adjacent pairs.
|
|
163
164
|
*
|
|
164
165
|
* `[A, B, C]` expands to “A before B” and “B before C”, each comparing the
|
|
165
|
-
*
|
|
166
|
-
* allowed.
|
|
166
|
+
* selected `requiredOrderMode` to every pair. Unlisted intermediate tools
|
|
167
|
+
* are allowed.
|
|
167
168
|
*
|
|
168
169
|
* TraceContract `requiredOrder` **implies presence**: every listed name is
|
|
169
170
|
* added to the effective required-tool set. Low-level `createToolOrderingRule`
|
|
170
171
|
* alone may still pass vacuously when an endpoint is missing.
|
|
171
172
|
*
|
|
172
|
-
*
|
|
173
|
-
* non-failing
|
|
174
|
-
*
|
|
173
|
+
* The default `first-occurrence` mode preserves first-occurrence encounter
|
|
174
|
+
* ordering; overlapping intervals emit a non-failing warning. `happens-before`
|
|
175
|
+
* requires the first before event to finish before the first after event starts.
|
|
176
|
+
* `all-occurrences` applies that causal boundary to every occurrence.
|
|
175
177
|
*
|
|
176
178
|
* @see docs/TRACE-CONTRACTS.md
|
|
177
179
|
* @beta Available through `agent-inspect/checks`. Additive changes may ship
|
|
178
180
|
* in minor releases; breaking changes require a future major.
|
|
179
181
|
*/
|
|
180
182
|
requiredOrder?: string[];
|
|
183
|
+
/**
|
|
184
|
+
* Ordering semantics applied to every adjacent pair in `requiredOrder`.
|
|
185
|
+
* Causal modes fail closed when a required interval boundary is unavailable.
|
|
186
|
+
*
|
|
187
|
+
* @defaultValue `"first-occurrence"`
|
|
188
|
+
* @beta Available through `agent-inspect/checks`.
|
|
189
|
+
*/
|
|
190
|
+
requiredOrderMode?: "first-occurrence" | "happens-before" | "all-occurrences";
|
|
181
191
|
}
|
|
182
192
|
interface TraceContractLlmRules {
|
|
183
193
|
maxCalls?: number;
|
|
@@ -188,17 +198,54 @@ interface TraceContractObservationRules {
|
|
|
188
198
|
required?: string[];
|
|
189
199
|
failOn?: Array<"failed" | "unknown" | "skipped">;
|
|
190
200
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
201
|
+
/**
|
|
202
|
+
* One deterministic alternate path. Branch contracts are one level only —
|
|
203
|
+
* nested `alternatives` are rejected.
|
|
204
|
+
*
|
|
205
|
+
* @experimental
|
|
206
|
+
*/
|
|
207
|
+
interface TraceContractAlternativeBranch {
|
|
208
|
+
/** Unique branch id within `alternatives.anyOf`. */
|
|
209
|
+
id: string;
|
|
210
|
+
description?: string;
|
|
211
|
+
/** Branch body: run/tools/llm/observations only (no nested alternatives). */
|
|
212
|
+
contract: TraceContractBody;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Bounded alternative valid paths for legitimate shortcuts (GitHub #309).
|
|
216
|
+
*
|
|
217
|
+
* @experimental
|
|
218
|
+
*/
|
|
219
|
+
interface TraceContractAlternatives {
|
|
220
|
+
/**
|
|
221
|
+
* One level of named branches. The overall contract passes when the base
|
|
222
|
+
* rules pass and **at least one** complete branch passes.
|
|
223
|
+
*/
|
|
224
|
+
anyOf: TraceContractAlternativeBranch[];
|
|
196
225
|
}
|
|
197
|
-
|
|
226
|
+
/** Contract body without alternatives (base or branch). */
|
|
227
|
+
type TraceContractBody = {
|
|
198
228
|
run?: TraceContractRunRules;
|
|
199
229
|
tools?: TraceContractToolRules;
|
|
200
230
|
llm?: TraceContractLlmRules;
|
|
201
231
|
observations?: TraceContractObservationRules;
|
|
232
|
+
};
|
|
233
|
+
interface TraceContractInput extends TraceContractBody {
|
|
234
|
+
alternatives?: TraceContractAlternatives;
|
|
235
|
+
}
|
|
236
|
+
interface TraceContract extends TraceContractBody {
|
|
237
|
+
alternatives?: TraceContractAlternatives;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Lint diagnostic for brittle or invalid TraceContract shapes.
|
|
241
|
+
*
|
|
242
|
+
* @experimental
|
|
243
|
+
*/
|
|
244
|
+
interface TraceContractLintDiagnostic {
|
|
245
|
+
code: string;
|
|
246
|
+
severity: "error" | "warning" | "info";
|
|
247
|
+
message: string;
|
|
248
|
+
path?: string;
|
|
202
249
|
}
|
|
203
250
|
/**
|
|
204
251
|
* Define a normalized trace contract object.
|
|
@@ -209,6 +256,9 @@ declare function defineTraceContract(input: TraceContractInput): TraceContract;
|
|
|
209
256
|
/**
|
|
210
257
|
* Evaluate a trace contract against an opened trace read result.
|
|
211
258
|
*
|
|
259
|
+
* Base rules always apply. When `alternatives.anyOf` is present, at least one
|
|
260
|
+
* complete branch must also pass.
|
|
261
|
+
*
|
|
212
262
|
* @experimental
|
|
213
263
|
*/
|
|
214
264
|
declare function evaluateTraceContract(input: TraceCheckInput, contract: TraceContract, options?: {
|
|
@@ -222,5 +272,17 @@ declare function evaluateTraceContract(input: TraceCheckInput, contract: TraceCo
|
|
|
222
272
|
declare function evaluateTraceContractRead(read: TraceReadResult, contract: TraceContract, options?: {
|
|
223
273
|
runId?: string;
|
|
224
274
|
}): TraceCheckResult;
|
|
275
|
+
/**
|
|
276
|
+
* Lint a TraceContract for invalid or brittle shapes (does not evaluate a trace).
|
|
277
|
+
*
|
|
278
|
+
* @experimental
|
|
279
|
+
*/
|
|
280
|
+
declare function lintTraceContract(contract: TraceContract): TraceContractLintDiagnostic[];
|
|
281
|
+
/**
|
|
282
|
+
* Explain a TraceContract as short human-readable lines (does not evaluate a trace).
|
|
283
|
+
*
|
|
284
|
+
* @experimental
|
|
285
|
+
*/
|
|
286
|
+
declare function explainTraceContract(contract: TraceContract): string[];
|
|
225
287
|
|
|
226
|
-
export { type DerivedFailureConfidence, type DerivedFailureFact, type DerivedFailureRole, type FailureRoleCounts, LogicalProjectionDiagnostic, LogicalTraceEvent, type SemanticParitySummary, TraceCheckInput, TraceCheckResult, type TraceContract, type TraceContractInput, type TraceContractLlmRules, type TraceContractObservationRules, type TraceContractRunRules, type TraceContractToolRules, type TraceFacts, buildTraceFacts, defineTraceContract, deriveFailureFacts, evaluateTraceContract, evaluateTraceContractRead, summarizeSemanticParity };
|
|
288
|
+
export { type DerivedFailureConfidence, type DerivedFailureFact, type DerivedFailureRole, type FailureRoleCounts, LogicalProjectionDiagnostic, LogicalTraceEvent, type SemanticParitySummary, TraceCheckInput, TraceCheckResult, type TraceContract, type TraceContractAlternativeBranch, type TraceContractAlternatives, type TraceContractBody, type TraceContractInput, type TraceContractLintDiagnostic, type TraceContractLlmRules, type TraceContractObservationRules, type TraceContractRunRules, type TraceContractToolRules, type TraceFacts, buildTraceFacts, defineTraceContract, deriveFailureFacts, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, lintTraceContract, summarizeSemanticParity };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { buildTraceFacts, createBaselineRegressionRule, createDecisionRule, createGuardrailRule, createLlmUsageRule, createMaxStepDurationRule, createObservedOutcomeRule, createRequireCompletedRule, createRetrievalRule, createRunDepthRule, createRunDurationRule, createRunEventCountRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStructureCycleRule, createStructureIncompleteRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolFailureRule, createToolOrderingRule, createToolUsageRule, defineTraceContract, deriveFailureFacts, evaluateTraceContract, evaluateTraceContractRead, projectLogicalEvents, resolveCanonicalToolName, runTraceChecks, summarizeSemanticParity } from './chunk-
|
|
1
|
+
export { buildTraceFacts, createBaselineRegressionRule, createDecisionRule, createGuardrailRule, createLlmUsageRule, createMaxStepDurationRule, createObservedOutcomeRule, createRequireCompletedRule, createRetrievalRule, createRunDepthRule, createRunDurationRule, createRunEventCountRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStructureCycleRule, createStructureIncompleteRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolFailureRule, createToolOrderingRule, createToolUsageRule, defineTraceContract, deriveFailureFacts, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, lintTraceContract, projectLogicalEvents, resolveCanonicalToolName, runTraceChecks, summarizeSemanticParity } from './chunk-G47KQB42.mjs';
|
|
2
2
|
import './chunk-3XS5O4JI.mjs';
|
|
3
3
|
import './chunk-U25RHRSU.mjs';
|
|
4
4
|
import './chunk-VU6O5QAH.mjs';
|