agent-inspect 6.21.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/docs/TRACE-CONTRACTS.md +56 -0
  4. package/package.json +1 -1
  5. package/packages/cli/dist/{chunk-CRUHIL5J.mjs → chunk-BVQO5CWA.mjs} +11 -2
  6. package/packages/cli/dist/chunk-BVQO5CWA.mjs.map +1 -0
  7. package/packages/cli/dist/index.cjs +55 -1
  8. package/packages/cli/dist/index.cjs.map +1 -1
  9. package/packages/cli/dist/index.mjs +4 -4
  10. package/packages/cli/dist/index.mjs.map +1 -1
  11. package/packages/cli/dist/{src-MNJFYW3W.mjs → src-Y4NXOO2K.mjs} +3 -3
  12. package/packages/cli/dist/{src-MNJFYW3W.mjs.map → src-Y4NXOO2K.mjs.map} +1 -1
  13. package/packages/core/dist/advanced.cjs +38 -0
  14. package/packages/core/dist/advanced.cjs.map +1 -1
  15. package/packages/core/dist/advanced.d.cts +36 -4
  16. package/packages/core/dist/advanced.d.ts +36 -4
  17. package/packages/core/dist/advanced.mjs +32 -4
  18. package/packages/core/dist/advanced.mjs.map +1 -1
  19. package/packages/core/dist/checks.cjs +956 -122
  20. package/packages/core/dist/checks.cjs.map +1 -1
  21. package/packages/core/dist/checks.d.cts +227 -5
  22. package/packages/core/dist/checks.d.ts +227 -5
  23. package/packages/core/dist/checks.mjs +1 -1
  24. package/packages/core/dist/{chunk-HT54OLPE.mjs → chunk-NDRMIL7Z.mjs} +103 -3
  25. package/packages/core/dist/chunk-NDRMIL7Z.mjs.map +1 -0
  26. package/packages/core/dist/{chunk-43SHIPZM.mjs → chunk-VMDCDWBE.mjs} +855 -25
  27. package/packages/core/dist/chunk-VMDCDWBE.mjs.map +1 -0
  28. package/packages/core/dist/{index-BG-ZBESI.d.cts → index-CR4CCRqP.d.cts} +7 -2
  29. package/packages/core/dist/{index-xevIlqdd.d.ts → index-CtK_p-ps.d.ts} +7 -2
  30. package/packages/core/dist/{index-AMAGuO_i.d.ts → index-D72DPqAF.d.ts} +2 -1
  31. package/packages/core/dist/{index-vqr-g6ev.d.cts → index-DLLz9sce.d.cts} +2 -1
  32. package/packages/core/dist/programmatic-gZTWLObB.d.cts +25 -0
  33. package/packages/core/dist/programmatic-gZTWLObB.d.ts +25 -0
  34. package/packages/core/dist/readers.cjs +105 -0
  35. package/packages/core/dist/readers.cjs.map +1 -1
  36. package/packages/core/dist/readers.d.cts +43 -18
  37. package/packages/core/dist/readers.d.ts +43 -18
  38. package/packages/core/dist/readers.mjs +1 -1
  39. package/packages/cli/dist/chunk-CRUHIL5J.mjs.map +0 -1
  40. package/packages/core/dist/chunk-43SHIPZM.mjs.map +0 -1
  41. package/packages/core/dist/chunk-HT54OLPE.mjs.map +0 -1
@@ -1,7 +1,7 @@
1
- import { L as LogicalTraceEvent, a as LogicalProjectionDiagnostic, T as TraceCheckInput, b as TraceCheckDiagnostic, S as SessionWorkflowMetadata, c as TraceCheckResult } from './index-BG-ZBESI.cjs';
2
- export { B as BaselineRegressionRuleOptions, D as DecisionRuleOptions, G as GuardrailRuleOptions, d as LlmUsageRuleOptions, M as MaxStepDurationRuleOptions, O as ObservedOutcomeRuleOptions, R as RetrievalRuleOptions, e as RunDepthRuleOptions, f as RunDurationRuleOptions, g as RunEventCountRuleOptions, h as RunStatusRuleOptions, i as RunTraceChecksOptions, j as SafetyFindingCategory, k as SafetyFindingConfidence, l as SafetyOversizedAttributeRuleOptions, m as SafetyRawContentRuleOptions, n as SafetyRedactionRuleOptions, o as SafetySecretPattern, p as SafetySecretPatternRuleOptions, q as StallDetectionRuleOptions, r as StructureIncompleteRuleOptions, s as StructureOrphanRuleOptions, t as StructureParallelWidthRuleOptions, u as StructureRelationshipRuleOptions, v as ToolFailureRuleOptions, w as ToolOrderingRuleOptions, x as ToolUsageRuleOptions, y as TraceCheckContext, z as TraceCheckDiagnosticCode, A as TraceCheckEvidence, C as TraceCheckFacts, E as TraceCheckFinding, F as TraceCheckFindingStatus, H as TraceCheckRule, I as TraceCheckRuleCategory, J as TraceCheckRuleExecution, K as TraceCheckRuleExecutionStatus, N as TraceCheckSeverity, P as TraceCheckStatus, Q as TraceCheckSummary, U as TraceSignalRuleOptions, V as createBaselineRegressionRule, W as createDecisionRule, X as createGuardrailRule, Y as createLlmUsageRule, Z as createMaxStepDurationRule, _ as createObservedOutcomeRule, $ as createRequireCompletedRule, a0 as createRetrievalRule, a1 as createRunDepthRule, a2 as createRunDurationRule, a3 as createRunEventCountRule, a4 as createRunStatusRule, a5 as createSafetyOversizedAttributeRule, a6 as createSafetyRawContentRule, a7 as createSafetyRedactionRule, a8 as createSafetySecretPatternRule, a9 as createStallDetectionRule, aa as createStructureCycleRule, ab as createStructureIncompleteRule, ac as createStructureOrphanRule, ad as createStructureParallelWidthRule, ae as createStructureRelationshipRule, af as createToolFailureRule, ag as createToolOrderingRule, ah as createToolUsageRule, ai as projectLogicalEvents, aj as resolveCanonicalToolName, ak as runTraceChecks } from './index-BG-ZBESI.cjs';
3
- export { PROGRAMMATIC_DIAGNOSTIC_SPECS, ProgrammaticDiagnosticCode, ProgrammaticDiagnosticSpec, formatProgrammaticDiagnostic } from './readers.cjs';
4
- import { a as TraceReadResult } from './index-vqr-g6ev.cjs';
1
+ import { L as LogicalTraceEvent, a as LogicalProjectionDiagnostic, T as TraceCheckInput, b as TraceCheckDiagnostic, S as SessionWorkflowMetadata, c as TraceCheckResult } from './index-CR4CCRqP.cjs';
2
+ export { B as BaselineRegressionRuleOptions, D as DecisionRuleOptions, G as GuardrailRuleOptions, d as LlmUsageRuleOptions, M as MaxStepDurationRuleOptions, O as ObservedOutcomeRuleOptions, R as RetrievalRuleOptions, e as RunDepthRuleOptions, f as RunDurationRuleOptions, g as RunEventCountRuleOptions, h as RunStatusRuleOptions, i as RunTraceChecksOptions, j as SafetyFindingCategory, k as SafetyFindingConfidence, l as SafetyOversizedAttributeRuleOptions, m as SafetyRawContentRuleOptions, n as SafetyRedactionRuleOptions, o as SafetySecretPattern, p as SafetySecretPatternRuleOptions, q as StallDetectionRuleOptions, r as StructureIncompleteRuleOptions, s as StructureOrphanRuleOptions, t as StructureParallelWidthRuleOptions, u as StructureRelationshipRuleOptions, v as ToolFailureRuleOptions, w as ToolOrderingRuleOptions, x as ToolUsageRuleOptions, y as TraceCheckContext, z as TraceCheckDiagnosticCode, A as TraceCheckEvidence, C as TraceCheckFacts, E as TraceCheckFinding, F as TraceCheckFindingStatus, H as TraceCheckRule, I as TraceCheckRuleCategory, J as TraceCheckRuleExecution, K as TraceCheckRuleExecutionStatus, N as TraceCheckSeverity, P as TraceCheckStatus, Q as TraceCheckSummary, U as TraceSignalRuleOptions, V as createBaselineRegressionRule, W as createDecisionRule, X as createGuardrailRule, Y as createLlmUsageRule, Z as createMaxStepDurationRule, _ as createObservedOutcomeRule, $ as createRequireCompletedRule, a0 as createRetrievalRule, a1 as createRunDepthRule, a2 as createRunDurationRule, a3 as createRunEventCountRule, a4 as createRunStatusRule, a5 as createSafetyOversizedAttributeRule, a6 as createSafetyRawContentRule, a7 as createSafetyRedactionRule, a8 as createSafetySecretPatternRule, a9 as createStallDetectionRule, aa as createStructureCycleRule, ab as createStructureIncompleteRule, ac as createStructureOrphanRule, ad as createStructureParallelWidthRule, ae as createStructureRelationshipRule, af as createToolFailureRule, ag as createToolOrderingRule, ah as createToolUsageRule, ai as projectLogicalEvents, aj as resolveCanonicalToolName, ak as runTraceChecks } from './index-CR4CCRqP.cjs';
3
+ export { P as PROGRAMMATIC_DIAGNOSTIC_SPECS, a as ProgrammaticDiagnosticCode, b as ProgrammaticDiagnosticSpec, f as formatProgrammaticDiagnostic } from './programmatic-gZTWLObB.cjs';
4
+ import { g as TraceReadResult } from './index-DLLz9sce.cjs';
5
5
  import { P as PersistedInspectEvent } from './persisted-inspect-event-CVZWZldL.cjs';
6
6
  import './types-VzKihKQo.cjs';
7
7
  import './log-config-CFlIJHTf.cjs';
@@ -67,6 +67,43 @@ declare function deriveFailureFacts(logicalEvents: readonly LogicalTraceEvent[])
67
67
  failureRoleCounts: FailureRoleCounts;
68
68
  };
69
69
 
70
+ /**
71
+ * Read-time typed relationship facts (6.22).
72
+ *
73
+ * Facts never rewrite parent hierarchy. Confidence is explicit or correlated only —
74
+ * never inferred from timestamps alone.
75
+ *
76
+ * @experimental Available through `agent-inspect/checks`.
77
+ */
78
+
79
+ type TraceRelationshipType = "parent-child" | "source-lineage" | "attempt-of" | "retry-of" | "fallback-of" | "remediation-of" | "evidence-for" | "accepted-by" | "supersedes";
80
+ type TraceRelationshipConfidence = "explicit" | "correlated" | "unknown";
81
+ /**
82
+ * Bounded relationship edge derived at read time.
83
+ *
84
+ * @experimental
85
+ */
86
+ interface TraceRelationship {
87
+ type: TraceRelationshipType;
88
+ fromEventId: string;
89
+ toEventId?: string;
90
+ externalRef?: string;
91
+ confidence: TraceRelationshipConfidence;
92
+ basis: readonly string[];
93
+ }
94
+ interface TraceRelationshipDiagnostic {
95
+ code: string;
96
+ message: string;
97
+ eventId?: string;
98
+ }
99
+ /**
100
+ * Derive typed relationship facts from persisted events without mutating hierarchy.
101
+ */
102
+ declare function deriveRelationshipFacts(events: readonly PersistedInspectEvent[]): {
103
+ relationships: readonly TraceRelationship[];
104
+ diagnostics: readonly TraceRelationshipDiagnostic[];
105
+ };
106
+
70
107
  /**
71
108
  * Shared semantic parity summary over logical lifecycle projection.
72
109
  *
@@ -127,6 +164,18 @@ interface TraceFacts {
127
164
  * @experimental Additive in 6.19.
128
165
  */
129
166
  readonly failuresByRole: ReadonlyMap<DerivedFailureRole, readonly DerivedFailureFact[]>;
167
+ /**
168
+ * Read-time typed relationship facts. Does not rewrite parent hierarchy.
169
+ *
170
+ * @experimental Additive in 6.22.
171
+ */
172
+ readonly relationships: readonly TraceRelationship[];
173
+ /**
174
+ * Diagnostics for unsupported or unresolved relationships.
175
+ *
176
+ * @experimental Additive in 6.22.
177
+ */
178
+ readonly relationshipDiagnostics: readonly TraceRelationshipDiagnostic[];
130
179
  }
131
180
  /**
132
181
  * Build TraceFacts from a TraceReadResult or normalized persisted events.
@@ -174,6 +223,141 @@ declare function resolveTraceContractScope(input: TraceCheckInput, scope: TraceC
174
223
  diagnostics: TraceCheckDiagnostic[];
175
224
  };
176
225
 
226
+ /**
227
+ * Declared-versus-enforced control checks for TraceContract (6.23).
228
+ *
229
+ * A stored declaration is not proof of enforcement.
230
+ *
231
+ * @experimental
232
+ */
233
+
234
+ type ControlStage = "declared" | "presented" | "validated" | "enforced" | "observed" | "accepted";
235
+ interface TraceContractControlRules {
236
+ /**
237
+ * Tools declared/presented to the agent (inline). Distinct from `enforcedTools`.
238
+ */
239
+ declaredTools?: string[];
240
+ /**
241
+ * Tools the harness claims to enforce (inline allowlist).
242
+ */
243
+ enforcedTools?: string[];
244
+ /**
245
+ * RUN/event attribute holding a string[] of declared tool names.
246
+ * Used when `declaredTools` is omitted.
247
+ */
248
+ declaredToolsAttribute?: string;
249
+ /**
250
+ * RUN/event attribute holding a string[] of enforced tool names.
251
+ */
252
+ enforcedToolsAttribute?: string;
253
+ /**
254
+ * Fail when both declared and enforced sets resolve and differ.
255
+ */
256
+ requireDeclaredMatchesEnforced?: boolean;
257
+ /**
258
+ * Fail when any observed finished tool is outside the enforced set.
259
+ */
260
+ requireObservedWithinEnforced?: boolean;
261
+ /**
262
+ * Fail when any observed finished tool is outside the declared set.
263
+ */
264
+ requireObservedWithinDeclared?: boolean;
265
+ /**
266
+ * Require observation names for control stages (default `control.<stage>`).
267
+ */
268
+ requiredStages?: Array<{
269
+ stage: ControlStage;
270
+ /** Observation name; defaults to `control.<stage>`. */
271
+ observation?: string;
272
+ }>;
273
+ }
274
+
275
+ /**
276
+ * Retry / side-effect safety checks for TraceContract (6.23).
277
+ *
278
+ * Uses explicit attempt identity from session workflow metadata.
279
+ * AgentInspect evaluates; it does not perform retries.
280
+ *
281
+ * @experimental
282
+ */
283
+
284
+ interface TraceContractRetryRules {
285
+ /**
286
+ * Maximum attempts per `operationId` (or `attemptOf` grouping).
287
+ * Counts distinct `attemptId` values when present, else finished tool/LLM events.
288
+ */
289
+ maxAttempts?: number;
290
+ /**
291
+ * When true, every operation with attempts must include a non-running terminal event.
292
+ */
293
+ requireTerminalResult?: boolean;
294
+ /**
295
+ * Fail when `fallbackOf` is set without a prior error attempt for the referenced operation.
296
+ */
297
+ fallbackOnlyAfterFailure?: boolean;
298
+ /**
299
+ * Tool names treated as non-idempotent. A later attempt after an `ok` occurrence fails
300
+ * unless idempotency / no-side-effect evidence is present on the retry.
301
+ */
302
+ nonIdempotentTools?: string[];
303
+ /**
304
+ * When true, retries require `idempotencyKey` or `attributes.noSideEffect === true`.
305
+ */
306
+ requireIdempotencyEvidenceForRetry?: boolean;
307
+ /**
308
+ * When true, recovered success paths must still retain at least one error attempt event.
309
+ */
310
+ requireRecoveredFailureVisible?: boolean;
311
+ }
312
+
313
+ /**
314
+ * Resolve an RFC 6901 JSON Pointer against a JSON-like value.
315
+ * Returns `{ found: false }` when the path does not exist.
316
+ */
317
+ declare function resolveJsonPointer(document: unknown, pointer: string): {
318
+ found: true;
319
+ value: unknown;
320
+ } | {
321
+ found: false;
322
+ };
323
+ type ToolArgumentOperator = "exists" | "type" | "equals" | "oneOf";
324
+ type ToolArgumentOccurrence = "first" | "last" | "any" | "all";
325
+ interface ToolArgumentCheck {
326
+ tool: string;
327
+ path: string;
328
+ operator: ToolArgumentOperator;
329
+ occurrence?: ToolArgumentOccurrence;
330
+ /** Required for `equals`. */
331
+ expected?: unknown;
332
+ /** Required for `oneOf`. */
333
+ oneOf?: readonly unknown[];
334
+ /** Required for `type` (`string` | `number` | `boolean` | `object` | `array` | `null`). */
335
+ type?: "string" | "number" | "boolean" | "object" | "array" | "null";
336
+ }
337
+ type ToolArgumentEval = {
338
+ status: "pass";
339
+ } | {
340
+ status: "fail";
341
+ message: string;
342
+ code: string;
343
+ } | {
344
+ status: "unavailable";
345
+ message: string;
346
+ code: "AI_CHECK_TOOL_ARGUMENT_EVIDENCE_UNAVAILABLE";
347
+ };
348
+ /**
349
+ * Extract structured tool-argument evidence from a tool event.
350
+ * Preview-only strings and digests do not count as structured evidence.
351
+ */
352
+ declare function extractToolArgumentPayload(event: {
353
+ attributes?: Record<string, unknown>;
354
+ inputSummary?: unknown;
355
+ }): {
356
+ present: boolean;
357
+ value: unknown;
358
+ };
359
+ declare function evaluateToolArgumentValue(value: unknown, check: ToolArgumentCheck, evidencePresent: boolean): ToolArgumentEval;
360
+
177
361
  /**
178
362
  * @experimental Typed trace contract input. Evolves during v6.5.x.
179
363
  */
@@ -228,6 +412,32 @@ interface TraceContractToolRules {
228
412
  * @beta Available through `agent-inspect/checks`.
229
413
  */
230
414
  requiredOrderMode?: "first-occurrence" | "happens-before" | "all-occurrences";
415
+ /**
416
+ * Bounded structured tool-argument checks (JSON Pointer + limited operators).
417
+ *
418
+ * Missing structured evidence fails closed as unevaluable (not pass).
419
+ * Findings never embed full actual inputs.
420
+ *
421
+ * @experimental Additive in 6.23.
422
+ */
423
+ arguments?: ToolArgumentCheck[];
424
+ /**
425
+ * Default occurrence mode for `orderRules` when a rule omits `occurrenceMode`.
426
+ *
427
+ * @experimental Additive in 6.23.
428
+ */
429
+ defaultOccurrenceMode?: "first-occurrence" | "happens-before" | "all-occurrences";
430
+ /**
431
+ * Mixed per-pair ordering rules (additive alongside `requiredOrder`).
432
+ *
433
+ * @experimental Additive in 6.23.
434
+ */
435
+ orderRules?: Array<{
436
+ before: string;
437
+ after: string;
438
+ occurrenceMode?: "first-occurrence" | "happens-before" | "all-occurrences";
439
+ requireEndpoints?: boolean;
440
+ }>;
231
441
  }
232
442
  interface TraceContractLlmRules {
233
443
  maxCalls?: number;
@@ -295,6 +505,18 @@ type TraceContractBody = {
295
505
  tools?: TraceContractToolRules;
296
506
  llm?: TraceContractLlmRules;
297
507
  observations?: TraceContractObservationRules;
508
+ /**
509
+ * Declared-versus-enforced control invariants.
510
+ *
511
+ * @experimental Additive in 6.23.
512
+ */
513
+ controls?: TraceContractControlRules;
514
+ /**
515
+ * Retry / side-effect safety using explicit attempt identity.
516
+ *
517
+ * @experimental Additive in 6.23.
518
+ */
519
+ retry?: TraceContractRetryRules;
298
520
  };
299
521
  interface TraceContractInput extends TraceContractBody {
300
522
  /**
@@ -363,4 +585,4 @@ declare function lintTraceContract(contract: TraceContract): TraceContractLintDi
363
585
  */
364
586
  declare function explainTraceContract(contract: TraceContract): string[];
365
587
 
366
- export { type DerivedFailureConfidence, type DerivedFailureFact, type DerivedFailureRole, type FailureRoleCounts, LogicalProjectionDiagnostic, LogicalTraceEvent, type SemanticParitySummary, TraceCheckDiagnostic, TraceCheckInput, TraceCheckResult, type TraceContract, type TraceContractAlternativeBranch, type TraceContractAlternatives, type TraceContractBody, type TraceContractInput, type TraceContractLintDiagnostic, type TraceContractLlmRules, type TraceContractObservationProvenance, type TraceContractObservationRules, type TraceContractRunRules, type TraceContractScope, type TraceContractToolRules, type TraceFacts, buildTraceFacts, defineTraceContract, deriveFailureFacts, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, lintTraceContract, resolveTraceContractScope, summarizeSemanticParity, workflowMetadataForRun };
588
+ export { type ControlStage, type DerivedFailureConfidence, type DerivedFailureFact, type DerivedFailureRole, type FailureRoleCounts, LogicalProjectionDiagnostic, LogicalTraceEvent, type SemanticParitySummary, type ToolArgumentCheck, type ToolArgumentOccurrence, type ToolArgumentOperator, TraceCheckDiagnostic, TraceCheckInput, TraceCheckResult, type TraceContract, type TraceContractAlternativeBranch, type TraceContractAlternatives, type TraceContractBody, type TraceContractControlRules, type TraceContractInput, type TraceContractLintDiagnostic, type TraceContractLlmRules, type TraceContractObservationProvenance, type TraceContractObservationRules, type TraceContractRetryRules, type TraceContractRunRules, type TraceContractScope, type TraceContractToolRules, type TraceFacts, type TraceRelationship, type TraceRelationshipConfidence, type TraceRelationshipDiagnostic, type TraceRelationshipType, buildTraceFacts, defineTraceContract, deriveFailureFacts, deriveRelationshipFacts, evaluateToolArgumentValue, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, extractToolArgumentPayload, lintTraceContract, resolveJsonPointer, resolveTraceContractScope, summarizeSemanticParity, workflowMetadataForRun };
@@ -1,7 +1,7 @@
1
- import { L as LogicalTraceEvent, a as LogicalProjectionDiagnostic, T as TraceCheckInput, b as TraceCheckDiagnostic, S as SessionWorkflowMetadata, c as TraceCheckResult } from './index-xevIlqdd.js';
2
- export { B as BaselineRegressionRuleOptions, D as DecisionRuleOptions, G as GuardrailRuleOptions, d as LlmUsageRuleOptions, M as MaxStepDurationRuleOptions, O as ObservedOutcomeRuleOptions, R as RetrievalRuleOptions, e as RunDepthRuleOptions, f as RunDurationRuleOptions, g as RunEventCountRuleOptions, h as RunStatusRuleOptions, i as RunTraceChecksOptions, j as SafetyFindingCategory, k as SafetyFindingConfidence, l as SafetyOversizedAttributeRuleOptions, m as SafetyRawContentRuleOptions, n as SafetyRedactionRuleOptions, o as SafetySecretPattern, p as SafetySecretPatternRuleOptions, q as StallDetectionRuleOptions, r as StructureIncompleteRuleOptions, s as StructureOrphanRuleOptions, t as StructureParallelWidthRuleOptions, u as StructureRelationshipRuleOptions, v as ToolFailureRuleOptions, w as ToolOrderingRuleOptions, x as ToolUsageRuleOptions, y as TraceCheckContext, z as TraceCheckDiagnosticCode, A as TraceCheckEvidence, C as TraceCheckFacts, E as TraceCheckFinding, F as TraceCheckFindingStatus, H as TraceCheckRule, I as TraceCheckRuleCategory, J as TraceCheckRuleExecution, K as TraceCheckRuleExecutionStatus, N as TraceCheckSeverity, P as TraceCheckStatus, Q as TraceCheckSummary, U as TraceSignalRuleOptions, V as createBaselineRegressionRule, W as createDecisionRule, X as createGuardrailRule, Y as createLlmUsageRule, Z as createMaxStepDurationRule, _ as createObservedOutcomeRule, $ as createRequireCompletedRule, a0 as createRetrievalRule, a1 as createRunDepthRule, a2 as createRunDurationRule, a3 as createRunEventCountRule, a4 as createRunStatusRule, a5 as createSafetyOversizedAttributeRule, a6 as createSafetyRawContentRule, a7 as createSafetyRedactionRule, a8 as createSafetySecretPatternRule, a9 as createStallDetectionRule, aa as createStructureCycleRule, ab as createStructureIncompleteRule, ac as createStructureOrphanRule, ad as createStructureParallelWidthRule, ae as createStructureRelationshipRule, af as createToolFailureRule, ag as createToolOrderingRule, ah as createToolUsageRule, ai as projectLogicalEvents, aj as resolveCanonicalToolName, ak as runTraceChecks } from './index-xevIlqdd.js';
3
- export { PROGRAMMATIC_DIAGNOSTIC_SPECS, ProgrammaticDiagnosticCode, ProgrammaticDiagnosticSpec, formatProgrammaticDiagnostic } from './readers.js';
4
- import { a as TraceReadResult } from './index-AMAGuO_i.js';
1
+ import { L as LogicalTraceEvent, a as LogicalProjectionDiagnostic, T as TraceCheckInput, b as TraceCheckDiagnostic, S as SessionWorkflowMetadata, c as TraceCheckResult } from './index-CtK_p-ps.js';
2
+ export { B as BaselineRegressionRuleOptions, D as DecisionRuleOptions, G as GuardrailRuleOptions, d as LlmUsageRuleOptions, M as MaxStepDurationRuleOptions, O as ObservedOutcomeRuleOptions, R as RetrievalRuleOptions, e as RunDepthRuleOptions, f as RunDurationRuleOptions, g as RunEventCountRuleOptions, h as RunStatusRuleOptions, i as RunTraceChecksOptions, j as SafetyFindingCategory, k as SafetyFindingConfidence, l as SafetyOversizedAttributeRuleOptions, m as SafetyRawContentRuleOptions, n as SafetyRedactionRuleOptions, o as SafetySecretPattern, p as SafetySecretPatternRuleOptions, q as StallDetectionRuleOptions, r as StructureIncompleteRuleOptions, s as StructureOrphanRuleOptions, t as StructureParallelWidthRuleOptions, u as StructureRelationshipRuleOptions, v as ToolFailureRuleOptions, w as ToolOrderingRuleOptions, x as ToolUsageRuleOptions, y as TraceCheckContext, z as TraceCheckDiagnosticCode, A as TraceCheckEvidence, C as TraceCheckFacts, E as TraceCheckFinding, F as TraceCheckFindingStatus, H as TraceCheckRule, I as TraceCheckRuleCategory, J as TraceCheckRuleExecution, K as TraceCheckRuleExecutionStatus, N as TraceCheckSeverity, P as TraceCheckStatus, Q as TraceCheckSummary, U as TraceSignalRuleOptions, V as createBaselineRegressionRule, W as createDecisionRule, X as createGuardrailRule, Y as createLlmUsageRule, Z as createMaxStepDurationRule, _ as createObservedOutcomeRule, $ as createRequireCompletedRule, a0 as createRetrievalRule, a1 as createRunDepthRule, a2 as createRunDurationRule, a3 as createRunEventCountRule, a4 as createRunStatusRule, a5 as createSafetyOversizedAttributeRule, a6 as createSafetyRawContentRule, a7 as createSafetyRedactionRule, a8 as createSafetySecretPatternRule, a9 as createStallDetectionRule, aa as createStructureCycleRule, ab as createStructureIncompleteRule, ac as createStructureOrphanRule, ad as createStructureParallelWidthRule, ae as createStructureRelationshipRule, af as createToolFailureRule, ag as createToolOrderingRule, ah as createToolUsageRule, ai as projectLogicalEvents, aj as resolveCanonicalToolName, ak as runTraceChecks } from './index-CtK_p-ps.js';
3
+ export { P as PROGRAMMATIC_DIAGNOSTIC_SPECS, a as ProgrammaticDiagnosticCode, b as ProgrammaticDiagnosticSpec, f as formatProgrammaticDiagnostic } from './programmatic-gZTWLObB.js';
4
+ import { g as TraceReadResult } from './index-D72DPqAF.js';
5
5
  import { P as PersistedInspectEvent } from './persisted-inspect-event-BVucFVrP.js';
6
6
  import './types-Bx3mEZ04.js';
7
7
  import './log-config-OZRfpHED.js';
@@ -67,6 +67,43 @@ declare function deriveFailureFacts(logicalEvents: readonly LogicalTraceEvent[])
67
67
  failureRoleCounts: FailureRoleCounts;
68
68
  };
69
69
 
70
+ /**
71
+ * Read-time typed relationship facts (6.22).
72
+ *
73
+ * Facts never rewrite parent hierarchy. Confidence is explicit or correlated only —
74
+ * never inferred from timestamps alone.
75
+ *
76
+ * @experimental Available through `agent-inspect/checks`.
77
+ */
78
+
79
+ type TraceRelationshipType = "parent-child" | "source-lineage" | "attempt-of" | "retry-of" | "fallback-of" | "remediation-of" | "evidence-for" | "accepted-by" | "supersedes";
80
+ type TraceRelationshipConfidence = "explicit" | "correlated" | "unknown";
81
+ /**
82
+ * Bounded relationship edge derived at read time.
83
+ *
84
+ * @experimental
85
+ */
86
+ interface TraceRelationship {
87
+ type: TraceRelationshipType;
88
+ fromEventId: string;
89
+ toEventId?: string;
90
+ externalRef?: string;
91
+ confidence: TraceRelationshipConfidence;
92
+ basis: readonly string[];
93
+ }
94
+ interface TraceRelationshipDiagnostic {
95
+ code: string;
96
+ message: string;
97
+ eventId?: string;
98
+ }
99
+ /**
100
+ * Derive typed relationship facts from persisted events without mutating hierarchy.
101
+ */
102
+ declare function deriveRelationshipFacts(events: readonly PersistedInspectEvent[]): {
103
+ relationships: readonly TraceRelationship[];
104
+ diagnostics: readonly TraceRelationshipDiagnostic[];
105
+ };
106
+
70
107
  /**
71
108
  * Shared semantic parity summary over logical lifecycle projection.
72
109
  *
@@ -127,6 +164,18 @@ interface TraceFacts {
127
164
  * @experimental Additive in 6.19.
128
165
  */
129
166
  readonly failuresByRole: ReadonlyMap<DerivedFailureRole, readonly DerivedFailureFact[]>;
167
+ /**
168
+ * Read-time typed relationship facts. Does not rewrite parent hierarchy.
169
+ *
170
+ * @experimental Additive in 6.22.
171
+ */
172
+ readonly relationships: readonly TraceRelationship[];
173
+ /**
174
+ * Diagnostics for unsupported or unresolved relationships.
175
+ *
176
+ * @experimental Additive in 6.22.
177
+ */
178
+ readonly relationshipDiagnostics: readonly TraceRelationshipDiagnostic[];
130
179
  }
131
180
  /**
132
181
  * Build TraceFacts from a TraceReadResult or normalized persisted events.
@@ -174,6 +223,141 @@ declare function resolveTraceContractScope(input: TraceCheckInput, scope: TraceC
174
223
  diagnostics: TraceCheckDiagnostic[];
175
224
  };
176
225
 
226
+ /**
227
+ * Declared-versus-enforced control checks for TraceContract (6.23).
228
+ *
229
+ * A stored declaration is not proof of enforcement.
230
+ *
231
+ * @experimental
232
+ */
233
+
234
+ type ControlStage = "declared" | "presented" | "validated" | "enforced" | "observed" | "accepted";
235
+ interface TraceContractControlRules {
236
+ /**
237
+ * Tools declared/presented to the agent (inline). Distinct from `enforcedTools`.
238
+ */
239
+ declaredTools?: string[];
240
+ /**
241
+ * Tools the harness claims to enforce (inline allowlist).
242
+ */
243
+ enforcedTools?: string[];
244
+ /**
245
+ * RUN/event attribute holding a string[] of declared tool names.
246
+ * Used when `declaredTools` is omitted.
247
+ */
248
+ declaredToolsAttribute?: string;
249
+ /**
250
+ * RUN/event attribute holding a string[] of enforced tool names.
251
+ */
252
+ enforcedToolsAttribute?: string;
253
+ /**
254
+ * Fail when both declared and enforced sets resolve and differ.
255
+ */
256
+ requireDeclaredMatchesEnforced?: boolean;
257
+ /**
258
+ * Fail when any observed finished tool is outside the enforced set.
259
+ */
260
+ requireObservedWithinEnforced?: boolean;
261
+ /**
262
+ * Fail when any observed finished tool is outside the declared set.
263
+ */
264
+ requireObservedWithinDeclared?: boolean;
265
+ /**
266
+ * Require observation names for control stages (default `control.<stage>`).
267
+ */
268
+ requiredStages?: Array<{
269
+ stage: ControlStage;
270
+ /** Observation name; defaults to `control.<stage>`. */
271
+ observation?: string;
272
+ }>;
273
+ }
274
+
275
+ /**
276
+ * Retry / side-effect safety checks for TraceContract (6.23).
277
+ *
278
+ * Uses explicit attempt identity from session workflow metadata.
279
+ * AgentInspect evaluates; it does not perform retries.
280
+ *
281
+ * @experimental
282
+ */
283
+
284
+ interface TraceContractRetryRules {
285
+ /**
286
+ * Maximum attempts per `operationId` (or `attemptOf` grouping).
287
+ * Counts distinct `attemptId` values when present, else finished tool/LLM events.
288
+ */
289
+ maxAttempts?: number;
290
+ /**
291
+ * When true, every operation with attempts must include a non-running terminal event.
292
+ */
293
+ requireTerminalResult?: boolean;
294
+ /**
295
+ * Fail when `fallbackOf` is set without a prior error attempt for the referenced operation.
296
+ */
297
+ fallbackOnlyAfterFailure?: boolean;
298
+ /**
299
+ * Tool names treated as non-idempotent. A later attempt after an `ok` occurrence fails
300
+ * unless idempotency / no-side-effect evidence is present on the retry.
301
+ */
302
+ nonIdempotentTools?: string[];
303
+ /**
304
+ * When true, retries require `idempotencyKey` or `attributes.noSideEffect === true`.
305
+ */
306
+ requireIdempotencyEvidenceForRetry?: boolean;
307
+ /**
308
+ * When true, recovered success paths must still retain at least one error attempt event.
309
+ */
310
+ requireRecoveredFailureVisible?: boolean;
311
+ }
312
+
313
+ /**
314
+ * Resolve an RFC 6901 JSON Pointer against a JSON-like value.
315
+ * Returns `{ found: false }` when the path does not exist.
316
+ */
317
+ declare function resolveJsonPointer(document: unknown, pointer: string): {
318
+ found: true;
319
+ value: unknown;
320
+ } | {
321
+ found: false;
322
+ };
323
+ type ToolArgumentOperator = "exists" | "type" | "equals" | "oneOf";
324
+ type ToolArgumentOccurrence = "first" | "last" | "any" | "all";
325
+ interface ToolArgumentCheck {
326
+ tool: string;
327
+ path: string;
328
+ operator: ToolArgumentOperator;
329
+ occurrence?: ToolArgumentOccurrence;
330
+ /** Required for `equals`. */
331
+ expected?: unknown;
332
+ /** Required for `oneOf`. */
333
+ oneOf?: readonly unknown[];
334
+ /** Required for `type` (`string` | `number` | `boolean` | `object` | `array` | `null`). */
335
+ type?: "string" | "number" | "boolean" | "object" | "array" | "null";
336
+ }
337
+ type ToolArgumentEval = {
338
+ status: "pass";
339
+ } | {
340
+ status: "fail";
341
+ message: string;
342
+ code: string;
343
+ } | {
344
+ status: "unavailable";
345
+ message: string;
346
+ code: "AI_CHECK_TOOL_ARGUMENT_EVIDENCE_UNAVAILABLE";
347
+ };
348
+ /**
349
+ * Extract structured tool-argument evidence from a tool event.
350
+ * Preview-only strings and digests do not count as structured evidence.
351
+ */
352
+ declare function extractToolArgumentPayload(event: {
353
+ attributes?: Record<string, unknown>;
354
+ inputSummary?: unknown;
355
+ }): {
356
+ present: boolean;
357
+ value: unknown;
358
+ };
359
+ declare function evaluateToolArgumentValue(value: unknown, check: ToolArgumentCheck, evidencePresent: boolean): ToolArgumentEval;
360
+
177
361
  /**
178
362
  * @experimental Typed trace contract input. Evolves during v6.5.x.
179
363
  */
@@ -228,6 +412,32 @@ interface TraceContractToolRules {
228
412
  * @beta Available through `agent-inspect/checks`.
229
413
  */
230
414
  requiredOrderMode?: "first-occurrence" | "happens-before" | "all-occurrences";
415
+ /**
416
+ * Bounded structured tool-argument checks (JSON Pointer + limited operators).
417
+ *
418
+ * Missing structured evidence fails closed as unevaluable (not pass).
419
+ * Findings never embed full actual inputs.
420
+ *
421
+ * @experimental Additive in 6.23.
422
+ */
423
+ arguments?: ToolArgumentCheck[];
424
+ /**
425
+ * Default occurrence mode for `orderRules` when a rule omits `occurrenceMode`.
426
+ *
427
+ * @experimental Additive in 6.23.
428
+ */
429
+ defaultOccurrenceMode?: "first-occurrence" | "happens-before" | "all-occurrences";
430
+ /**
431
+ * Mixed per-pair ordering rules (additive alongside `requiredOrder`).
432
+ *
433
+ * @experimental Additive in 6.23.
434
+ */
435
+ orderRules?: Array<{
436
+ before: string;
437
+ after: string;
438
+ occurrenceMode?: "first-occurrence" | "happens-before" | "all-occurrences";
439
+ requireEndpoints?: boolean;
440
+ }>;
231
441
  }
232
442
  interface TraceContractLlmRules {
233
443
  maxCalls?: number;
@@ -295,6 +505,18 @@ type TraceContractBody = {
295
505
  tools?: TraceContractToolRules;
296
506
  llm?: TraceContractLlmRules;
297
507
  observations?: TraceContractObservationRules;
508
+ /**
509
+ * Declared-versus-enforced control invariants.
510
+ *
511
+ * @experimental Additive in 6.23.
512
+ */
513
+ controls?: TraceContractControlRules;
514
+ /**
515
+ * Retry / side-effect safety using explicit attempt identity.
516
+ *
517
+ * @experimental Additive in 6.23.
518
+ */
519
+ retry?: TraceContractRetryRules;
298
520
  };
299
521
  interface TraceContractInput extends TraceContractBody {
300
522
  /**
@@ -363,4 +585,4 @@ declare function lintTraceContract(contract: TraceContract): TraceContractLintDi
363
585
  */
364
586
  declare function explainTraceContract(contract: TraceContract): string[];
365
587
 
366
- export { type DerivedFailureConfidence, type DerivedFailureFact, type DerivedFailureRole, type FailureRoleCounts, LogicalProjectionDiagnostic, LogicalTraceEvent, type SemanticParitySummary, TraceCheckDiagnostic, TraceCheckInput, TraceCheckResult, type TraceContract, type TraceContractAlternativeBranch, type TraceContractAlternatives, type TraceContractBody, type TraceContractInput, type TraceContractLintDiagnostic, type TraceContractLlmRules, type TraceContractObservationProvenance, type TraceContractObservationRules, type TraceContractRunRules, type TraceContractScope, type TraceContractToolRules, type TraceFacts, buildTraceFacts, defineTraceContract, deriveFailureFacts, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, lintTraceContract, resolveTraceContractScope, summarizeSemanticParity, workflowMetadataForRun };
588
+ export { type ControlStage, type DerivedFailureConfidence, type DerivedFailureFact, type DerivedFailureRole, type FailureRoleCounts, LogicalProjectionDiagnostic, LogicalTraceEvent, type SemanticParitySummary, type ToolArgumentCheck, type ToolArgumentOccurrence, type ToolArgumentOperator, TraceCheckDiagnostic, TraceCheckInput, TraceCheckResult, type TraceContract, type TraceContractAlternativeBranch, type TraceContractAlternatives, type TraceContractBody, type TraceContractControlRules, type TraceContractInput, type TraceContractLintDiagnostic, type TraceContractLlmRules, type TraceContractObservationProvenance, type TraceContractObservationRules, type TraceContractRetryRules, type TraceContractRunRules, type TraceContractScope, type TraceContractToolRules, type TraceFacts, type TraceRelationship, type TraceRelationshipConfidence, type TraceRelationshipDiagnostic, type TraceRelationshipType, buildTraceFacts, defineTraceContract, deriveFailureFacts, deriveRelationshipFacts, evaluateToolArgumentValue, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, extractToolArgumentPayload, lintTraceContract, resolveJsonPointer, resolveTraceContractScope, summarizeSemanticParity, workflowMetadataForRun };
@@ -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, explainTraceContract, lintTraceContract, projectLogicalEvents, resolveCanonicalToolName, resolveTraceContractScope, runTraceChecks, summarizeSemanticParity, workflowMetadataForRun } from './chunk-43SHIPZM.mjs';
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, deriveRelationshipFacts, evaluateToolArgumentValue, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, extractToolArgumentPayload, lintTraceContract, projectLogicalEvents, resolveCanonicalToolName, resolveJsonPointer, resolveTraceContractScope, runTraceChecks, summarizeSemanticParity, workflowMetadataForRun } from './chunk-VMDCDWBE.mjs';
2
2
  import './chunk-R4SSYU6D.mjs';
3
3
  import './chunk-U25RHRSU.mjs';
4
4
  import './chunk-VU6O5QAH.mjs';