agent-inspect 6.19.1 → 6.21.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 +12 -0
- package/README.md +1 -1
- package/docs/TRACE-CONTRACTS.md +94 -43
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-QDYVK4MF.mjs → chunk-CRUHIL5J.mjs} +16 -2
- package/packages/cli/dist/chunk-CRUHIL5J.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +22 -3
- 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-MNJFYW3W.mjs} +3 -3
- package/packages/cli/dist/{src-CIC27TS2.mjs.map → src-MNJFYW3W.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +3 -0
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.d.cts +6 -156
- package/packages/core/dist/advanced.d.ts +6 -156
- package/packages/core/dist/advanced.mjs +6 -60
- package/packages/core/dist/advanced.mjs.map +1 -1
- package/packages/core/dist/checks.cjs +988 -21
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.d.cts +156 -16
- package/packages/core/dist/checks.d.ts +156 -16
- package/packages/core/dist/checks.mjs +2 -2
- package/packages/core/dist/{chunk-6LP2J5CA.mjs → chunk-43SHIPZM.mjs} +984 -25
- package/packages/core/dist/chunk-43SHIPZM.mjs.map +1 -0
- package/packages/core/dist/{chunk-3XS5O4JI.mjs → chunk-R4SSYU6D.mjs} +3 -3
- package/packages/core/dist/chunk-R4SSYU6D.mjs.map +1 -0
- package/packages/core/dist/{chunk-5YFJJFXU.mjs → chunk-WGDSM37E.mjs} +3 -3
- package/packages/core/dist/{chunk-5YFJJFXU.mjs.map → chunk-WGDSM37E.mjs.map} +1 -1
- package/packages/core/dist/{context-C5ye_xcS.d.cts → context-DOOT9GZ-.d.cts} +1 -1
- package/packages/core/dist/{context-CNsNSgE2.d.ts → context-DOX2-RjH.d.ts} +1 -1
- package/packages/core/dist/diff.d.cts +1 -1
- package/packages/core/dist/diff.d.ts +1 -1
- package/packages/core/dist/exporters.d.cts +1 -1
- package/packages/core/dist/exporters.d.ts +1 -1
- package/packages/core/dist/exporters.mjs +1 -1
- package/packages/core/dist/{index-DCR816Yt.d.cts → index-BG-ZBESI.d.cts} +163 -1
- package/packages/core/dist/{index-DKwuGSe-.d.ts → index-xevIlqdd.d.ts} +163 -1
- package/packages/core/dist/index.d.cts +3 -3
- package/packages/core/dist/index.d.ts +3 -3
- package/packages/core/dist/index.mjs +3 -3
- package/packages/core/dist/persisted.d.cts +1 -1
- package/packages/core/dist/persisted.d.ts +1 -1
- package/packages/core/dist/{types--ainI31J.d.ts → types-Bx3mEZ04.d.ts} +1 -1
- package/packages/core/dist/{types-UnrNaTo2.d.cts → types-VzKihKQo.d.cts} +1 -1
- package/packages/cli/dist/chunk-QDYVK4MF.mjs.map +0 -1
- package/packages/core/dist/chunk-3XS5O4JI.mjs.map +0 -1
- package/packages/core/dist/chunk-6LP2J5CA.mjs.map +0 -1
|
@@ -1,8 +1,10 @@
|
|
|
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,
|
|
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
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';
|
|
6
|
+
import './types-VzKihKQo.cjs';
|
|
7
|
+
import './log-config-CFlIJHTf.cjs';
|
|
6
8
|
import './inspect-event-DRthdZlf.cjs';
|
|
7
9
|
import './types-B562HgN_.cjs';
|
|
8
10
|
|
|
@@ -134,6 +136,44 @@ interface TraceFacts {
|
|
|
134
136
|
declare function buildTraceFacts(input: TraceReadResult): TraceFacts;
|
|
135
137
|
declare function buildTraceFacts(input: readonly PersistedInspectEvent[]): TraceFacts;
|
|
136
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Explicit actor/run projection for TraceContract evaluation (#320).
|
|
141
|
+
*
|
|
142
|
+
* Selectors use only declared metadata (or explicit event ids). Zero matches
|
|
143
|
+
* and singular-actor ambiguity fail closed. No timestamp or display-name
|
|
144
|
+
* inference.
|
|
145
|
+
*
|
|
146
|
+
* @experimental
|
|
147
|
+
*/
|
|
148
|
+
interface TraceContractScope {
|
|
149
|
+
runId?: string;
|
|
150
|
+
subAgentId?: string;
|
|
151
|
+
groupId?: string;
|
|
152
|
+
workflowStep?: string;
|
|
153
|
+
/** Explicit root event id; evaluation projects to that event and descendants. */
|
|
154
|
+
rootEventId?: string;
|
|
155
|
+
}
|
|
156
|
+
interface ResolvedContractScope {
|
|
157
|
+
runId: string;
|
|
158
|
+
rootEventId?: string;
|
|
159
|
+
matchedSelectors: Record<string, string>;
|
|
160
|
+
evidenceEventCount: number;
|
|
161
|
+
input: TraceCheckInput;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Collect explicit session/workflow metadata for a run from persisted events.
|
|
165
|
+
* Prefers RUN-kind attributes; never invents identity from timestamps.
|
|
166
|
+
*/
|
|
167
|
+
declare function workflowMetadataForRun(events: readonly PersistedInspectEvent[], runId: string): SessionWorkflowMetadata;
|
|
168
|
+
/**
|
|
169
|
+
* Resolve TraceContract `scope` against a check input.
|
|
170
|
+
* Returns diagnostics on zero/ambiguous matches or missing root events.
|
|
171
|
+
*/
|
|
172
|
+
declare function resolveTraceContractScope(input: TraceCheckInput, scope: TraceContractScope | undefined): {
|
|
173
|
+
resolved?: ResolvedContractScope;
|
|
174
|
+
diagnostics: TraceCheckDiagnostic[];
|
|
175
|
+
};
|
|
176
|
+
|
|
137
177
|
/**
|
|
138
178
|
* @experimental Typed trace contract input. Evolves during v6.5.x.
|
|
139
179
|
*/
|
|
@@ -146,7 +186,8 @@ interface TraceContractToolRules {
|
|
|
146
186
|
/**
|
|
147
187
|
* Unconditional tool presence invariant. Every named tool must appear at least
|
|
148
188
|
* once. Do not use for cache-hit or alternate-path shortcuts — prefer
|
|
149
|
-
* `
|
|
189
|
+
* `alternatives.anyOf` or `observations.required` when a legitimate path may
|
|
190
|
+
* skip the tool.
|
|
150
191
|
*
|
|
151
192
|
* @see docs/TRACE-CONTRACTS.md
|
|
152
193
|
*/
|
|
@@ -159,46 +200,130 @@ interface TraceContractToolRules {
|
|
|
159
200
|
allowed?: string[];
|
|
160
201
|
maxCalls?: number;
|
|
161
202
|
/**
|
|
162
|
-
* Required tool order
|
|
203
|
+
* Required tool order expanded into adjacent pairs.
|
|
163
204
|
*
|
|
164
205
|
* `[A, B, C]` expands to “A before B” and “B before C”, each comparing the
|
|
165
|
-
*
|
|
166
|
-
* allowed.
|
|
206
|
+
* selected `requiredOrderMode` to every pair. Unlisted intermediate tools
|
|
207
|
+
* are allowed.
|
|
167
208
|
*
|
|
168
209
|
* TraceContract `requiredOrder` **implies presence**: every listed name is
|
|
169
210
|
* added to the effective required-tool set. Low-level `createToolOrderingRule`
|
|
170
211
|
* alone may still pass vacuously when an endpoint is missing.
|
|
171
212
|
*
|
|
172
|
-
*
|
|
173
|
-
* non-failing
|
|
174
|
-
*
|
|
213
|
+
* The default `first-occurrence` mode preserves first-occurrence encounter
|
|
214
|
+
* ordering; overlapping intervals emit a non-failing warning. `happens-before`
|
|
215
|
+
* requires the first before event to finish before the first after event starts.
|
|
216
|
+
* `all-occurrences` applies that causal boundary to every occurrence.
|
|
175
217
|
*
|
|
176
218
|
* @see docs/TRACE-CONTRACTS.md
|
|
177
219
|
* @beta Available through `agent-inspect/checks`. Additive changes may ship
|
|
178
220
|
* in minor releases; breaking changes require a future major.
|
|
179
221
|
*/
|
|
180
222
|
requiredOrder?: string[];
|
|
223
|
+
/**
|
|
224
|
+
* Ordering semantics applied to every adjacent pair in `requiredOrder`.
|
|
225
|
+
* Causal modes fail closed when a required interval boundary is unavailable.
|
|
226
|
+
*
|
|
227
|
+
* @defaultValue `"first-occurrence"`
|
|
228
|
+
* @beta Available through `agent-inspect/checks`.
|
|
229
|
+
*/
|
|
230
|
+
requiredOrderMode?: "first-occurrence" | "happens-before" | "all-occurrences";
|
|
181
231
|
}
|
|
182
232
|
interface TraceContractLlmRules {
|
|
183
233
|
maxCalls?: number;
|
|
184
234
|
maxTotalTokens?: number;
|
|
185
235
|
allowedModels?: string[];
|
|
186
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Structural provenance requirements for named observed outcomes (#321).
|
|
239
|
+
*
|
|
240
|
+
* These checks prove method/evidence linkage was recorded. They do **not**
|
|
241
|
+
* prove the claim is semantically true, authorized, complete, or externally
|
|
242
|
+
* trusted.
|
|
243
|
+
*
|
|
244
|
+
* @experimental
|
|
245
|
+
*/
|
|
246
|
+
interface TraceContractObservationProvenance {
|
|
247
|
+
/** Require a non-empty method from the bounded ObservedOutcomeMethod vocabulary. */
|
|
248
|
+
method?: boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Require bounded evidence references. Supported shapes:
|
|
251
|
+
* `string` event id, `{ eventId }`, or `{ eventIds: string[] }` (max 16 ids).
|
|
252
|
+
*/
|
|
253
|
+
evidence?: boolean;
|
|
254
|
+
/** When true with evidence, each referenced event id must exist in the same run. */
|
|
255
|
+
sameRunEventReference?: boolean;
|
|
256
|
+
}
|
|
187
257
|
interface TraceContractObservationRules {
|
|
188
258
|
required?: string[];
|
|
189
259
|
failOn?: Array<"failed" | "unknown" | "skipped">;
|
|
260
|
+
/**
|
|
261
|
+
* Structural provenance gates for `required` observation names.
|
|
262
|
+
*
|
|
263
|
+
* @experimental
|
|
264
|
+
*/
|
|
265
|
+
requireProvenance?: TraceContractObservationProvenance;
|
|
190
266
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
267
|
+
/**
|
|
268
|
+
* One deterministic alternate path. Branch contracts are one level only —
|
|
269
|
+
* nested `alternatives` are rejected.
|
|
270
|
+
*
|
|
271
|
+
* @experimental
|
|
272
|
+
*/
|
|
273
|
+
interface TraceContractAlternativeBranch {
|
|
274
|
+
/** Unique branch id within `alternatives.anyOf`. */
|
|
275
|
+
id: string;
|
|
276
|
+
description?: string;
|
|
277
|
+
/** Branch body: run/tools/llm/observations only (no nested alternatives). */
|
|
278
|
+
contract: TraceContractBody;
|
|
196
279
|
}
|
|
197
|
-
|
|
280
|
+
/**
|
|
281
|
+
* Bounded alternative valid paths for legitimate shortcuts (GitHub #309).
|
|
282
|
+
*
|
|
283
|
+
* @experimental
|
|
284
|
+
*/
|
|
285
|
+
interface TraceContractAlternatives {
|
|
286
|
+
/**
|
|
287
|
+
* One level of named branches. The overall contract passes when the base
|
|
288
|
+
* rules pass and **at least one** complete branch passes.
|
|
289
|
+
*/
|
|
290
|
+
anyOf: TraceContractAlternativeBranch[];
|
|
291
|
+
}
|
|
292
|
+
/** Contract body without alternatives (base or branch). */
|
|
293
|
+
type TraceContractBody = {
|
|
198
294
|
run?: TraceContractRunRules;
|
|
199
295
|
tools?: TraceContractToolRules;
|
|
200
296
|
llm?: TraceContractLlmRules;
|
|
201
297
|
observations?: TraceContractObservationRules;
|
|
298
|
+
};
|
|
299
|
+
interface TraceContractInput extends TraceContractBody {
|
|
300
|
+
/**
|
|
301
|
+
* Optional actor/run projection applied before evaluation (#320).
|
|
302
|
+
*
|
|
303
|
+
* @experimental
|
|
304
|
+
*/
|
|
305
|
+
scope?: TraceContractScope;
|
|
306
|
+
alternatives?: TraceContractAlternatives;
|
|
307
|
+
}
|
|
308
|
+
interface TraceContract extends TraceContractBody {
|
|
309
|
+
/**
|
|
310
|
+
* Optional actor/run projection applied before evaluation (#320).
|
|
311
|
+
*
|
|
312
|
+
* @experimental
|
|
313
|
+
*/
|
|
314
|
+
scope?: TraceContractScope;
|
|
315
|
+
alternatives?: TraceContractAlternatives;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Lint diagnostic for brittle or invalid TraceContract shapes.
|
|
319
|
+
*
|
|
320
|
+
* @experimental
|
|
321
|
+
*/
|
|
322
|
+
interface TraceContractLintDiagnostic {
|
|
323
|
+
code: string;
|
|
324
|
+
severity: "error" | "warning" | "info";
|
|
325
|
+
message: string;
|
|
326
|
+
path?: string;
|
|
202
327
|
}
|
|
203
328
|
/**
|
|
204
329
|
* Define a normalized trace contract object.
|
|
@@ -209,6 +334,9 @@ declare function defineTraceContract(input: TraceContractInput): TraceContract;
|
|
|
209
334
|
/**
|
|
210
335
|
* Evaluate a trace contract against an opened trace read result.
|
|
211
336
|
*
|
|
337
|
+
* Base rules always apply. When `alternatives.anyOf` is present, at least one
|
|
338
|
+
* complete branch must also pass.
|
|
339
|
+
*
|
|
212
340
|
* @experimental
|
|
213
341
|
*/
|
|
214
342
|
declare function evaluateTraceContract(input: TraceCheckInput, contract: TraceContract, options?: {
|
|
@@ -222,5 +350,17 @@ declare function evaluateTraceContract(input: TraceCheckInput, contract: TraceCo
|
|
|
222
350
|
declare function evaluateTraceContractRead(read: TraceReadResult, contract: TraceContract, options?: {
|
|
223
351
|
runId?: string;
|
|
224
352
|
}): TraceCheckResult;
|
|
353
|
+
/**
|
|
354
|
+
* Lint a TraceContract for invalid or brittle shapes (does not evaluate a trace).
|
|
355
|
+
*
|
|
356
|
+
* @experimental
|
|
357
|
+
*/
|
|
358
|
+
declare function lintTraceContract(contract: TraceContract): TraceContractLintDiagnostic[];
|
|
359
|
+
/**
|
|
360
|
+
* Explain a TraceContract as short human-readable lines (does not evaluate a trace).
|
|
361
|
+
*
|
|
362
|
+
* @experimental
|
|
363
|
+
*/
|
|
364
|
+
declare function explainTraceContract(contract: TraceContract): string[];
|
|
225
365
|
|
|
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 };
|
|
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 };
|
|
@@ -1,8 +1,10 @@
|
|
|
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,
|
|
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
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';
|
|
6
|
+
import './types-Bx3mEZ04.js';
|
|
7
|
+
import './log-config-OZRfpHED.js';
|
|
6
8
|
import './inspect-event-DRthdZlf.js';
|
|
7
9
|
import './types-B562HgN_.js';
|
|
8
10
|
|
|
@@ -134,6 +136,44 @@ interface TraceFacts {
|
|
|
134
136
|
declare function buildTraceFacts(input: TraceReadResult): TraceFacts;
|
|
135
137
|
declare function buildTraceFacts(input: readonly PersistedInspectEvent[]): TraceFacts;
|
|
136
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Explicit actor/run projection for TraceContract evaluation (#320).
|
|
141
|
+
*
|
|
142
|
+
* Selectors use only declared metadata (or explicit event ids). Zero matches
|
|
143
|
+
* and singular-actor ambiguity fail closed. No timestamp or display-name
|
|
144
|
+
* inference.
|
|
145
|
+
*
|
|
146
|
+
* @experimental
|
|
147
|
+
*/
|
|
148
|
+
interface TraceContractScope {
|
|
149
|
+
runId?: string;
|
|
150
|
+
subAgentId?: string;
|
|
151
|
+
groupId?: string;
|
|
152
|
+
workflowStep?: string;
|
|
153
|
+
/** Explicit root event id; evaluation projects to that event and descendants. */
|
|
154
|
+
rootEventId?: string;
|
|
155
|
+
}
|
|
156
|
+
interface ResolvedContractScope {
|
|
157
|
+
runId: string;
|
|
158
|
+
rootEventId?: string;
|
|
159
|
+
matchedSelectors: Record<string, string>;
|
|
160
|
+
evidenceEventCount: number;
|
|
161
|
+
input: TraceCheckInput;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Collect explicit session/workflow metadata for a run from persisted events.
|
|
165
|
+
* Prefers RUN-kind attributes; never invents identity from timestamps.
|
|
166
|
+
*/
|
|
167
|
+
declare function workflowMetadataForRun(events: readonly PersistedInspectEvent[], runId: string): SessionWorkflowMetadata;
|
|
168
|
+
/**
|
|
169
|
+
* Resolve TraceContract `scope` against a check input.
|
|
170
|
+
* Returns diagnostics on zero/ambiguous matches or missing root events.
|
|
171
|
+
*/
|
|
172
|
+
declare function resolveTraceContractScope(input: TraceCheckInput, scope: TraceContractScope | undefined): {
|
|
173
|
+
resolved?: ResolvedContractScope;
|
|
174
|
+
diagnostics: TraceCheckDiagnostic[];
|
|
175
|
+
};
|
|
176
|
+
|
|
137
177
|
/**
|
|
138
178
|
* @experimental Typed trace contract input. Evolves during v6.5.x.
|
|
139
179
|
*/
|
|
@@ -146,7 +186,8 @@ interface TraceContractToolRules {
|
|
|
146
186
|
/**
|
|
147
187
|
* Unconditional tool presence invariant. Every named tool must appear at least
|
|
148
188
|
* once. Do not use for cache-hit or alternate-path shortcuts — prefer
|
|
149
|
-
* `
|
|
189
|
+
* `alternatives.anyOf` or `observations.required` when a legitimate path may
|
|
190
|
+
* skip the tool.
|
|
150
191
|
*
|
|
151
192
|
* @see docs/TRACE-CONTRACTS.md
|
|
152
193
|
*/
|
|
@@ -159,46 +200,130 @@ interface TraceContractToolRules {
|
|
|
159
200
|
allowed?: string[];
|
|
160
201
|
maxCalls?: number;
|
|
161
202
|
/**
|
|
162
|
-
* Required tool order
|
|
203
|
+
* Required tool order expanded into adjacent pairs.
|
|
163
204
|
*
|
|
164
205
|
* `[A, B, C]` expands to “A before B” and “B before C”, each comparing the
|
|
165
|
-
*
|
|
166
|
-
* allowed.
|
|
206
|
+
* selected `requiredOrderMode` to every pair. Unlisted intermediate tools
|
|
207
|
+
* are allowed.
|
|
167
208
|
*
|
|
168
209
|
* TraceContract `requiredOrder` **implies presence**: every listed name is
|
|
169
210
|
* added to the effective required-tool set. Low-level `createToolOrderingRule`
|
|
170
211
|
* alone may still pass vacuously when an endpoint is missing.
|
|
171
212
|
*
|
|
172
|
-
*
|
|
173
|
-
* non-failing
|
|
174
|
-
*
|
|
213
|
+
* The default `first-occurrence` mode preserves first-occurrence encounter
|
|
214
|
+
* ordering; overlapping intervals emit a non-failing warning. `happens-before`
|
|
215
|
+
* requires the first before event to finish before the first after event starts.
|
|
216
|
+
* `all-occurrences` applies that causal boundary to every occurrence.
|
|
175
217
|
*
|
|
176
218
|
* @see docs/TRACE-CONTRACTS.md
|
|
177
219
|
* @beta Available through `agent-inspect/checks`. Additive changes may ship
|
|
178
220
|
* in minor releases; breaking changes require a future major.
|
|
179
221
|
*/
|
|
180
222
|
requiredOrder?: string[];
|
|
223
|
+
/**
|
|
224
|
+
* Ordering semantics applied to every adjacent pair in `requiredOrder`.
|
|
225
|
+
* Causal modes fail closed when a required interval boundary is unavailable.
|
|
226
|
+
*
|
|
227
|
+
* @defaultValue `"first-occurrence"`
|
|
228
|
+
* @beta Available through `agent-inspect/checks`.
|
|
229
|
+
*/
|
|
230
|
+
requiredOrderMode?: "first-occurrence" | "happens-before" | "all-occurrences";
|
|
181
231
|
}
|
|
182
232
|
interface TraceContractLlmRules {
|
|
183
233
|
maxCalls?: number;
|
|
184
234
|
maxTotalTokens?: number;
|
|
185
235
|
allowedModels?: string[];
|
|
186
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Structural provenance requirements for named observed outcomes (#321).
|
|
239
|
+
*
|
|
240
|
+
* These checks prove method/evidence linkage was recorded. They do **not**
|
|
241
|
+
* prove the claim is semantically true, authorized, complete, or externally
|
|
242
|
+
* trusted.
|
|
243
|
+
*
|
|
244
|
+
* @experimental
|
|
245
|
+
*/
|
|
246
|
+
interface TraceContractObservationProvenance {
|
|
247
|
+
/** Require a non-empty method from the bounded ObservedOutcomeMethod vocabulary. */
|
|
248
|
+
method?: boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Require bounded evidence references. Supported shapes:
|
|
251
|
+
* `string` event id, `{ eventId }`, or `{ eventIds: string[] }` (max 16 ids).
|
|
252
|
+
*/
|
|
253
|
+
evidence?: boolean;
|
|
254
|
+
/** When true with evidence, each referenced event id must exist in the same run. */
|
|
255
|
+
sameRunEventReference?: boolean;
|
|
256
|
+
}
|
|
187
257
|
interface TraceContractObservationRules {
|
|
188
258
|
required?: string[];
|
|
189
259
|
failOn?: Array<"failed" | "unknown" | "skipped">;
|
|
260
|
+
/**
|
|
261
|
+
* Structural provenance gates for `required` observation names.
|
|
262
|
+
*
|
|
263
|
+
* @experimental
|
|
264
|
+
*/
|
|
265
|
+
requireProvenance?: TraceContractObservationProvenance;
|
|
190
266
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
267
|
+
/**
|
|
268
|
+
* One deterministic alternate path. Branch contracts are one level only —
|
|
269
|
+
* nested `alternatives` are rejected.
|
|
270
|
+
*
|
|
271
|
+
* @experimental
|
|
272
|
+
*/
|
|
273
|
+
interface TraceContractAlternativeBranch {
|
|
274
|
+
/** Unique branch id within `alternatives.anyOf`. */
|
|
275
|
+
id: string;
|
|
276
|
+
description?: string;
|
|
277
|
+
/** Branch body: run/tools/llm/observations only (no nested alternatives). */
|
|
278
|
+
contract: TraceContractBody;
|
|
196
279
|
}
|
|
197
|
-
|
|
280
|
+
/**
|
|
281
|
+
* Bounded alternative valid paths for legitimate shortcuts (GitHub #309).
|
|
282
|
+
*
|
|
283
|
+
* @experimental
|
|
284
|
+
*/
|
|
285
|
+
interface TraceContractAlternatives {
|
|
286
|
+
/**
|
|
287
|
+
* One level of named branches. The overall contract passes when the base
|
|
288
|
+
* rules pass and **at least one** complete branch passes.
|
|
289
|
+
*/
|
|
290
|
+
anyOf: TraceContractAlternativeBranch[];
|
|
291
|
+
}
|
|
292
|
+
/** Contract body without alternatives (base or branch). */
|
|
293
|
+
type TraceContractBody = {
|
|
198
294
|
run?: TraceContractRunRules;
|
|
199
295
|
tools?: TraceContractToolRules;
|
|
200
296
|
llm?: TraceContractLlmRules;
|
|
201
297
|
observations?: TraceContractObservationRules;
|
|
298
|
+
};
|
|
299
|
+
interface TraceContractInput extends TraceContractBody {
|
|
300
|
+
/**
|
|
301
|
+
* Optional actor/run projection applied before evaluation (#320).
|
|
302
|
+
*
|
|
303
|
+
* @experimental
|
|
304
|
+
*/
|
|
305
|
+
scope?: TraceContractScope;
|
|
306
|
+
alternatives?: TraceContractAlternatives;
|
|
307
|
+
}
|
|
308
|
+
interface TraceContract extends TraceContractBody {
|
|
309
|
+
/**
|
|
310
|
+
* Optional actor/run projection applied before evaluation (#320).
|
|
311
|
+
*
|
|
312
|
+
* @experimental
|
|
313
|
+
*/
|
|
314
|
+
scope?: TraceContractScope;
|
|
315
|
+
alternatives?: TraceContractAlternatives;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Lint diagnostic for brittle or invalid TraceContract shapes.
|
|
319
|
+
*
|
|
320
|
+
* @experimental
|
|
321
|
+
*/
|
|
322
|
+
interface TraceContractLintDiagnostic {
|
|
323
|
+
code: string;
|
|
324
|
+
severity: "error" | "warning" | "info";
|
|
325
|
+
message: string;
|
|
326
|
+
path?: string;
|
|
202
327
|
}
|
|
203
328
|
/**
|
|
204
329
|
* Define a normalized trace contract object.
|
|
@@ -209,6 +334,9 @@ declare function defineTraceContract(input: TraceContractInput): TraceContract;
|
|
|
209
334
|
/**
|
|
210
335
|
* Evaluate a trace contract against an opened trace read result.
|
|
211
336
|
*
|
|
337
|
+
* Base rules always apply. When `alternatives.anyOf` is present, at least one
|
|
338
|
+
* complete branch must also pass.
|
|
339
|
+
*
|
|
212
340
|
* @experimental
|
|
213
341
|
*/
|
|
214
342
|
declare function evaluateTraceContract(input: TraceCheckInput, contract: TraceContract, options?: {
|
|
@@ -222,5 +350,17 @@ declare function evaluateTraceContract(input: TraceCheckInput, contract: TraceCo
|
|
|
222
350
|
declare function evaluateTraceContractRead(read: TraceReadResult, contract: TraceContract, options?: {
|
|
223
351
|
runId?: string;
|
|
224
352
|
}): TraceCheckResult;
|
|
353
|
+
/**
|
|
354
|
+
* Lint a TraceContract for invalid or brittle shapes (does not evaluate a trace).
|
|
355
|
+
*
|
|
356
|
+
* @experimental
|
|
357
|
+
*/
|
|
358
|
+
declare function lintTraceContract(contract: TraceContract): TraceContractLintDiagnostic[];
|
|
359
|
+
/**
|
|
360
|
+
* Explain a TraceContract as short human-readable lines (does not evaluate a trace).
|
|
361
|
+
*
|
|
362
|
+
* @experimental
|
|
363
|
+
*/
|
|
364
|
+
declare function explainTraceContract(contract: TraceContract): string[];
|
|
225
365
|
|
|
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 };
|
|
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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
2
|
-
import './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, resolveTraceContractScope, runTraceChecks, summarizeSemanticParity, workflowMetadataForRun } from './chunk-43SHIPZM.mjs';
|
|
2
|
+
import './chunk-R4SSYU6D.mjs';
|
|
3
3
|
import './chunk-U25RHRSU.mjs';
|
|
4
4
|
import './chunk-VU6O5QAH.mjs';
|
|
5
5
|
export { PROGRAMMATIC_DIAGNOSTIC_SPECS, formatProgrammaticDiagnostic } from './chunk-FWK3Q3OJ.mjs';
|