agent-inspect 6.26.0 → 6.28.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/BUNDLES.md +4 -1
- package/docs/LIMITATIONS.md +1 -1
- package/docs/SAFE-TRACE-SHARING.md +2 -0
- package/docs/TRACE-CONTRACTS.md +21 -3
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-HPR2OJPU.mjs → chunk-JVQ4LTHR.mjs} +4317 -3803
- package/packages/cli/dist/chunk-JVQ4LTHR.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +4541 -4005
- 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-J43ECFHC.mjs → src-M5J5YC5E.mjs} +3 -3
- package/packages/cli/dist/{src-J43ECFHC.mjs.map → src-M5J5YC5E.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +3026 -2501
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.d.cts +172 -16
- package/packages/core/dist/advanced.d.ts +172 -16
- package/packages/core/dist/advanced.mjs +362 -32
- package/packages/core/dist/advanced.mjs.map +1 -1
- package/packages/core/dist/checks.cjs +537 -152
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.d.cts +9 -414
- package/packages/core/dist/checks.d.ts +9 -414
- package/packages/core/dist/checks.mjs +1 -1
- package/packages/core/dist/{chunk-LHSXRIYU.mjs → chunk-ME4WXYY3.mjs} +3609 -3224
- package/packages/core/dist/chunk-ME4WXYY3.mjs.map +1 -0
- package/packages/core/dist/{context-DOOT9GZ-.d.cts → context-DGMqxFpz.d.cts} +4 -4
- package/packages/core/dist/{context-DOX2-RjH.d.ts → context-DgcvkJ9t.d.ts} +4 -4
- package/packages/core/dist/diff.d.cts +3 -3
- package/packages/core/dist/diff.d.ts +3 -3
- package/packages/core/dist/exporters.d.cts +3 -3
- package/packages/core/dist/exporters.d.ts +3 -3
- package/packages/core/dist/{index-CtK_p-ps.d.ts → index-BOA1AeEU.d.ts} +473 -6
- package/packages/core/dist/{index-D72DPqAF.d.ts → index-BzyNPfLm.d.ts} +2 -2
- package/packages/core/dist/{index-DLLz9sce.d.cts → index-C6bCIbFO.d.cts} +2 -2
- package/packages/core/dist/{index-CR4CCRqP.d.cts → index-DVetZwGG.d.cts} +473 -6
- package/packages/core/dist/index.d.cts +7 -7
- package/packages/core/dist/index.d.ts +7 -7
- package/packages/core/dist/{inspect-event-DRthdZlf.d.cts → inspect-event-CDqjcrG_.d.cts} +1 -1
- package/packages/core/dist/{inspect-event-DRthdZlf.d.ts → inspect-event-CDqjcrG_.d.ts} +1 -1
- package/packages/core/dist/{log-config-CFlIJHTf.d.cts → log-config-DcjV8ZjF.d.cts} +1 -1
- package/packages/core/dist/{log-config-OZRfpHED.d.ts → log-config-N_c5AE09.d.ts} +1 -1
- package/packages/core/dist/logs.d.cts +3 -3
- package/packages/core/dist/logs.d.ts +3 -3
- package/packages/core/dist/{persisted-inspect-event-BVucFVrP.d.ts → persisted-inspect-event-CbaRYpbw.d.ts} +1 -1
- package/packages/core/dist/{persisted-inspect-event-CVZWZldL.d.cts → persisted-inspect-event-DiJ0I_vi.d.cts} +1 -1
- package/packages/core/dist/persisted.d.cts +5 -5
- package/packages/core/dist/persisted.d.ts +5 -5
- package/packages/core/dist/readers.d.cts +3 -3
- package/packages/core/dist/readers.d.ts +3 -3
- package/packages/core/dist/{types-B562HgN_.d.cts → types-BA_IOdg4.d.cts} +1 -1
- package/packages/core/dist/{types-B562HgN_.d.ts → types-BA_IOdg4.d.ts} +1 -1
- package/packages/core/dist/{types-VzKihKQo.d.cts → types-wXuxMUop.d.cts} +2 -2
- package/packages/core/dist/{types-Bx3mEZ04.d.ts → types-xv9bSgOK.d.ts} +2 -2
- package/packages/core/dist/writers.d.cts +2 -2
- package/packages/core/dist/writers.d.ts +2 -2
- package/packages/cli/dist/chunk-HPR2OJPU.mjs.map +0 -1
- package/packages/core/dist/chunk-LHSXRIYU.mjs.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { L as LogicalTraceEvent, a as LogicalProjectionDiagnostic
|
|
2
|
-
export { B as BaselineRegressionRuleOptions, D as DecisionRuleOptions, G as GuardrailRuleOptions,
|
|
1
|
+
import { L as LogicalTraceEvent, a as LogicalProjectionDiagnostic } from './index-DVetZwGG.cjs';
|
|
2
|
+
export { B as BaselineRegressionRuleOptions, C as ControlStage, D as DecisionRuleOptions, G as GuardrailRuleOptions, b as LlmUsageRuleOptions, M as MaxStepDurationRuleOptions, O as ObservedOutcomeRuleOptions, R as RecoverySameArgumentsMode, c as RecoverySideEffectClass, d as RetrievalRuleOptions, e as RunDepthRuleOptions, f as RunDurationRuleOptions, g as RunEventCountRuleOptions, h as RunStatusRuleOptions, i as RunTraceChecksOptions, S as SafetyFindingCategory, j as SafetyFindingConfidence, k as SafetyOversizedAttributeRuleOptions, l as SafetyRawContentRuleOptions, m as SafetyRedactionRuleOptions, n as SafetySecretPattern, o as SafetySecretPatternRuleOptions, p as StallDetectionRuleOptions, q as StructureIncompleteRuleOptions, r as StructureOrphanRuleOptions, s as StructureParallelWidthRuleOptions, t as StructureRelationshipRuleOptions, T as ToolArgumentCheck, u as ToolArgumentOccurrence, v as ToolArgumentOperator, w as ToolFailureRuleOptions, x as ToolOrderingRuleOptions, y as ToolUsageRuleOptions, z as TraceCheckContext, A as TraceCheckDiagnostic, E as TraceCheckDiagnosticCode, F as TraceCheckEvidence, H as TraceCheckFacts, I as TraceCheckFinding, J as TraceCheckFindingStatus, K as TraceCheckInput, N as TraceCheckResult, P as TraceCheckRule, Q as TraceCheckRuleCategory, U as TraceCheckRuleExecution, V as TraceCheckRuleExecutionStatus, W as TraceCheckSeverity, X as TraceCheckStatus, Y as TraceCheckSummary, Z as TraceContract, _ as TraceContractAlternativeBranch, $ as TraceContractAlternatives, a0 as TraceContractBody, a1 as TraceContractControlRules, a2 as TraceContractInput, a3 as TraceContractLintDiagnostic, a4 as TraceContractLlmRules, a5 as TraceContractObservationProvenance, a6 as TraceContractObservationRules, a7 as TraceContractRecoveryOperation, a8 as TraceContractRecoveryRetryableErrors, a9 as TraceContractRecoverySuccessfulResultDependency, aa as TraceContractRetryRules, ab as TraceContractRunRules, ac as TraceContractScope, ad as TraceContractToolRules, ae as TraceSignalRuleOptions, af as createBaselineRegressionRule, ag as createDecisionRule, ah as createGuardrailRule, ai as createLlmUsageRule, aj as createMaxStepDurationRule, ak as createObservedOutcomeRule, al as createRequireCompletedRule, am as createRetrievalRule, an as createRunDepthRule, ao as createRunDurationRule, ap as createRunEventCountRule, aq as createRunStatusRule, ar as createSafetyOversizedAttributeRule, as as createSafetyRawContentRule, at as createSafetyRedactionRule, au as createSafetySecretPatternRule, av as createStallDetectionRule, aw as createStructureCycleRule, ax as createStructureIncompleteRule, ay as createStructureOrphanRule, az as createStructureParallelWidthRule, aA as createStructureRelationshipRule, aB as createToolFailureRule, aC as createToolOrderingRule, aD as createToolUsageRule, aE as defineTraceContract, aF as evaluateToolArgumentValue, aG as evaluateTraceContract, aH as evaluateTraceContractRead, aI as explainTraceContract, aJ as extractToolArgumentPayload, aK as lintTraceContract, aL as projectLogicalEvents, aM as resolveCanonicalToolName, aN as resolveJsonPointer, aO as resolveTraceContractScope, aP as runTraceChecks, aQ as workflowMetadataForRun } from './index-DVetZwGG.cjs';
|
|
3
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-
|
|
5
|
-
import { P as PersistedInspectEvent } from './persisted-inspect-event-
|
|
6
|
-
import './
|
|
7
|
-
import './
|
|
8
|
-
import './
|
|
9
|
-
import './
|
|
4
|
+
import { g as TraceReadResult } from './index-C6bCIbFO.cjs';
|
|
5
|
+
import { P as PersistedInspectEvent } from './persisted-inspect-event-DiJ0I_vi.cjs';
|
|
6
|
+
import './inspect-event-CDqjcrG_.cjs';
|
|
7
|
+
import './types-BA_IOdg4.cjs';
|
|
8
|
+
import './types-wXuxMUop.cjs';
|
|
9
|
+
import './log-config-DcjV8ZjF.cjs';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Read-time derived failure roles for TraceFacts (6.19).
|
|
@@ -185,409 +185,4 @@ interface TraceFacts {
|
|
|
185
185
|
declare function buildTraceFacts(input: TraceReadResult): TraceFacts;
|
|
186
186
|
declare function buildTraceFacts(input: readonly PersistedInspectEvent[]): TraceFacts;
|
|
187
187
|
|
|
188
|
-
|
|
189
|
-
* Explicit actor/run projection for TraceContract evaluation (#320).
|
|
190
|
-
*
|
|
191
|
-
* Selectors use only declared metadata (or explicit event ids). Zero matches
|
|
192
|
-
* and singular-actor ambiguity fail closed. No timestamp or display-name
|
|
193
|
-
* inference.
|
|
194
|
-
*
|
|
195
|
-
* @experimental
|
|
196
|
-
*/
|
|
197
|
-
interface TraceContractScope {
|
|
198
|
-
runId?: string;
|
|
199
|
-
subAgentId?: string;
|
|
200
|
-
groupId?: string;
|
|
201
|
-
workflowStep?: string;
|
|
202
|
-
/** Explicit root event id; evaluation projects to that event and descendants. */
|
|
203
|
-
rootEventId?: string;
|
|
204
|
-
}
|
|
205
|
-
interface ResolvedContractScope {
|
|
206
|
-
runId: string;
|
|
207
|
-
rootEventId?: string;
|
|
208
|
-
matchedSelectors: Record<string, string>;
|
|
209
|
-
evidenceEventCount: number;
|
|
210
|
-
input: TraceCheckInput;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Collect explicit session/workflow metadata for a run from persisted events.
|
|
214
|
-
* Prefers RUN-kind attributes; never invents identity from timestamps.
|
|
215
|
-
*/
|
|
216
|
-
declare function workflowMetadataForRun(events: readonly PersistedInspectEvent[], runId: string): SessionWorkflowMetadata;
|
|
217
|
-
/**
|
|
218
|
-
* Resolve TraceContract `scope` against a check input.
|
|
219
|
-
* Returns diagnostics on zero/ambiguous matches or missing root events.
|
|
220
|
-
*/
|
|
221
|
-
declare function resolveTraceContractScope(input: TraceCheckInput, scope: TraceContractScope | undefined): {
|
|
222
|
-
resolved?: ResolvedContractScope;
|
|
223
|
-
diagnostics: TraceCheckDiagnostic[];
|
|
224
|
-
};
|
|
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+; corrected in 6.25.1).
|
|
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
|
-
* Prefers distinct `attemptId` values, else validated contiguous `attemptNumber`s,
|
|
288
|
-
* else finished tool/LLM events in the operation.
|
|
289
|
-
*/
|
|
290
|
-
maxAttempts?: number;
|
|
291
|
-
/**
|
|
292
|
-
* When true, every operation with attempts must include a non-running terminal event.
|
|
293
|
-
*/
|
|
294
|
-
requireTerminalResult?: boolean;
|
|
295
|
-
/**
|
|
296
|
-
* Fail when `fallbackOf` is set without an earlier failure for the referenced operation
|
|
297
|
-
* that chronologically precedes the fallback event.
|
|
298
|
-
*/
|
|
299
|
-
fallbackOnlyAfterFailure?: boolean;
|
|
300
|
-
/**
|
|
301
|
-
* Tool names treated as non-idempotent. A later attempt after an `ok` occurrence fails
|
|
302
|
-
* unless idempotency / no-side-effect evidence is present on the retry.
|
|
303
|
-
*/
|
|
304
|
-
nonIdempotentTools?: string[];
|
|
305
|
-
/**
|
|
306
|
-
* When true, genuine retries (including error→success) require `idempotencyKey`
|
|
307
|
-
* or `attributes.noSideEffect === true` / `sideEffect === false`.
|
|
308
|
-
* A client key alone is not proof of exactly-once mutation.
|
|
309
|
-
*/
|
|
310
|
-
requireIdempotencyEvidenceForRetry?: boolean;
|
|
311
|
-
/**
|
|
312
|
-
* When true, recovered success paths must retain an earlier error attempt in the
|
|
313
|
-
* same operation/retry chain (not merely coexistence of ok+error).
|
|
314
|
-
*/
|
|
315
|
-
requireRecoveredFailureVisible?: boolean;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Resolve an RFC 6901 JSON Pointer against a JSON-like value.
|
|
320
|
-
* Returns `{ found: false }` when the path does not exist.
|
|
321
|
-
*/
|
|
322
|
-
declare function resolveJsonPointer(document: unknown, pointer: string): {
|
|
323
|
-
found: true;
|
|
324
|
-
value: unknown;
|
|
325
|
-
} | {
|
|
326
|
-
found: false;
|
|
327
|
-
};
|
|
328
|
-
type ToolArgumentOperator = "exists" | "type" | "equals" | "oneOf";
|
|
329
|
-
type ToolArgumentOccurrence = "first" | "last" | "any" | "all";
|
|
330
|
-
interface ToolArgumentCheck {
|
|
331
|
-
tool: string;
|
|
332
|
-
path: string;
|
|
333
|
-
operator: ToolArgumentOperator;
|
|
334
|
-
occurrence?: ToolArgumentOccurrence;
|
|
335
|
-
/** Required for `equals`. */
|
|
336
|
-
expected?: unknown;
|
|
337
|
-
/** Required for `oneOf`. */
|
|
338
|
-
oneOf?: readonly unknown[];
|
|
339
|
-
/** Required for `type` (`string` | `number` | `boolean` | `object` | `array` | `null`). */
|
|
340
|
-
type?: "string" | "number" | "boolean" | "object" | "array" | "null";
|
|
341
|
-
}
|
|
342
|
-
type ToolArgumentEval = {
|
|
343
|
-
status: "pass";
|
|
344
|
-
} | {
|
|
345
|
-
status: "fail";
|
|
346
|
-
message: string;
|
|
347
|
-
code: string;
|
|
348
|
-
} | {
|
|
349
|
-
status: "unavailable";
|
|
350
|
-
message: string;
|
|
351
|
-
code: "AI_CHECK_TOOL_ARGUMENT_EVIDENCE_UNAVAILABLE";
|
|
352
|
-
};
|
|
353
|
-
/**
|
|
354
|
-
* Extract structured tool-argument evidence from a tool event.
|
|
355
|
-
* Preview-only strings and digests do not count as structured evidence.
|
|
356
|
-
*/
|
|
357
|
-
declare function extractToolArgumentPayload(event: {
|
|
358
|
-
attributes?: Record<string, unknown>;
|
|
359
|
-
inputSummary?: unknown;
|
|
360
|
-
}): {
|
|
361
|
-
present: boolean;
|
|
362
|
-
value: unknown;
|
|
363
|
-
};
|
|
364
|
-
declare function evaluateToolArgumentValue(value: unknown, check: ToolArgumentCheck, evidencePresent: boolean): ToolArgumentEval;
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* @experimental Typed trace contract input. Evolves during v6.5.x.
|
|
368
|
-
*/
|
|
369
|
-
interface TraceContractRunRules {
|
|
370
|
-
requireCompleted?: boolean;
|
|
371
|
-
allowedStatuses?: string[];
|
|
372
|
-
maxDurationMs?: number;
|
|
373
|
-
}
|
|
374
|
-
interface TraceContractToolRules {
|
|
375
|
-
/**
|
|
376
|
-
* Unconditional tool presence invariant. Every named tool must appear at least
|
|
377
|
-
* once. Do not use for cache-hit or alternate-path shortcuts — prefer
|
|
378
|
-
* `alternatives.anyOf` or `observations.required` when a legitimate path may
|
|
379
|
-
* skip the tool.
|
|
380
|
-
*
|
|
381
|
-
* @see docs/TRACE-CONTRACTS.md
|
|
382
|
-
*/
|
|
383
|
-
required?: string[];
|
|
384
|
-
/** Alias of `required` (TraceContract v2 normalization). */
|
|
385
|
-
requiredTools?: string[];
|
|
386
|
-
forbidden?: string[];
|
|
387
|
-
/** Alias of `forbidden`. */
|
|
388
|
-
forbiddenTools?: string[];
|
|
389
|
-
allowed?: string[];
|
|
390
|
-
maxCalls?: number;
|
|
391
|
-
/**
|
|
392
|
-
* Required tool order expanded into adjacent pairs.
|
|
393
|
-
*
|
|
394
|
-
* `[A, B, C]` expands to “A before B” and “B before C”, each comparing the
|
|
395
|
-
* selected `requiredOrderMode` to every pair. Unlisted intermediate tools
|
|
396
|
-
* are allowed.
|
|
397
|
-
*
|
|
398
|
-
* TraceContract `requiredOrder` **implies presence**: every listed name is
|
|
399
|
-
* added to the effective required-tool set. Low-level `createToolOrderingRule`
|
|
400
|
-
* alone may still pass vacuously when an endpoint is missing.
|
|
401
|
-
*
|
|
402
|
-
* The default `first-occurrence` mode preserves first-occurrence encounter
|
|
403
|
-
* ordering; overlapping intervals emit a non-failing warning. `happens-before`
|
|
404
|
-
* requires the first before event to finish before the first after event starts.
|
|
405
|
-
* `all-occurrences` applies that causal boundary to every occurrence.
|
|
406
|
-
*
|
|
407
|
-
* @see docs/TRACE-CONTRACTS.md
|
|
408
|
-
* @beta Available through `agent-inspect/checks`. Additive changes may ship
|
|
409
|
-
* in minor releases; breaking changes require a future major.
|
|
410
|
-
*/
|
|
411
|
-
requiredOrder?: string[];
|
|
412
|
-
/**
|
|
413
|
-
* Ordering semantics applied to every adjacent pair in `requiredOrder`.
|
|
414
|
-
* Causal modes fail closed when a required interval boundary is unavailable.
|
|
415
|
-
*
|
|
416
|
-
* @defaultValue `"first-occurrence"`
|
|
417
|
-
* @beta Available through `agent-inspect/checks`.
|
|
418
|
-
*/
|
|
419
|
-
requiredOrderMode?: "first-occurrence" | "happens-before" | "all-occurrences";
|
|
420
|
-
/**
|
|
421
|
-
* Bounded structured tool-argument checks (JSON Pointer + limited operators).
|
|
422
|
-
*
|
|
423
|
-
* Missing structured evidence fails closed as unevaluable (not pass).
|
|
424
|
-
* Findings never embed full actual inputs.
|
|
425
|
-
*
|
|
426
|
-
* @experimental Additive in 6.23.
|
|
427
|
-
*/
|
|
428
|
-
arguments?: ToolArgumentCheck[];
|
|
429
|
-
/**
|
|
430
|
-
* Default occurrence mode for `orderRules` when a rule omits `occurrenceMode`.
|
|
431
|
-
*
|
|
432
|
-
* @experimental Additive in 6.23.
|
|
433
|
-
*/
|
|
434
|
-
defaultOccurrenceMode?: "first-occurrence" | "happens-before" | "all-occurrences";
|
|
435
|
-
/**
|
|
436
|
-
* Mixed per-pair ordering rules (additive alongside `requiredOrder`).
|
|
437
|
-
*
|
|
438
|
-
* @experimental Additive in 6.23.
|
|
439
|
-
*/
|
|
440
|
-
orderRules?: Array<{
|
|
441
|
-
before: string;
|
|
442
|
-
after: string;
|
|
443
|
-
occurrenceMode?: "first-occurrence" | "happens-before" | "all-occurrences";
|
|
444
|
-
requireEndpoints?: boolean;
|
|
445
|
-
}>;
|
|
446
|
-
}
|
|
447
|
-
interface TraceContractLlmRules {
|
|
448
|
-
maxCalls?: number;
|
|
449
|
-
maxTotalTokens?: number;
|
|
450
|
-
allowedModels?: string[];
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* Structural provenance requirements for named observed outcomes (#321).
|
|
454
|
-
*
|
|
455
|
-
* These checks prove method/evidence linkage was recorded. They do **not**
|
|
456
|
-
* prove the claim is semantically true, authorized, complete, or externally
|
|
457
|
-
* trusted.
|
|
458
|
-
*
|
|
459
|
-
* @experimental
|
|
460
|
-
*/
|
|
461
|
-
interface TraceContractObservationProvenance {
|
|
462
|
-
/** Require a non-empty method from the bounded ObservedOutcomeMethod vocabulary. */
|
|
463
|
-
method?: boolean;
|
|
464
|
-
/**
|
|
465
|
-
* Require bounded evidence references. Supported shapes:
|
|
466
|
-
* `string` event id, `{ eventId }`, or `{ eventIds: string[] }` (max 16 ids).
|
|
467
|
-
*/
|
|
468
|
-
evidence?: boolean;
|
|
469
|
-
/** When true with evidence, each referenced event id must exist in the same run. */
|
|
470
|
-
sameRunEventReference?: boolean;
|
|
471
|
-
}
|
|
472
|
-
interface TraceContractObservationRules {
|
|
473
|
-
required?: string[];
|
|
474
|
-
failOn?: Array<"failed" | "unknown" | "skipped">;
|
|
475
|
-
/**
|
|
476
|
-
* Structural provenance gates for `required` observation names.
|
|
477
|
-
*
|
|
478
|
-
* @experimental
|
|
479
|
-
*/
|
|
480
|
-
requireProvenance?: TraceContractObservationProvenance;
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* One deterministic alternate path. Branch contracts are one level only —
|
|
484
|
-
* nested `alternatives` are rejected.
|
|
485
|
-
*
|
|
486
|
-
* @experimental
|
|
487
|
-
*/
|
|
488
|
-
interface TraceContractAlternativeBranch {
|
|
489
|
-
/** Unique branch id within `alternatives.anyOf`. */
|
|
490
|
-
id: string;
|
|
491
|
-
description?: string;
|
|
492
|
-
/** Branch body: run/tools/llm/observations only (no nested alternatives). */
|
|
493
|
-
contract: TraceContractBody;
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* Bounded alternative valid paths for legitimate shortcuts (GitHub #309).
|
|
497
|
-
*
|
|
498
|
-
* @experimental
|
|
499
|
-
*/
|
|
500
|
-
interface TraceContractAlternatives {
|
|
501
|
-
/**
|
|
502
|
-
* One level of named branches. The overall contract passes when the base
|
|
503
|
-
* rules pass and **at least one** complete branch passes.
|
|
504
|
-
*/
|
|
505
|
-
anyOf: TraceContractAlternativeBranch[];
|
|
506
|
-
}
|
|
507
|
-
/** Contract body without alternatives (base or branch). */
|
|
508
|
-
type TraceContractBody = {
|
|
509
|
-
run?: TraceContractRunRules;
|
|
510
|
-
tools?: TraceContractToolRules;
|
|
511
|
-
llm?: TraceContractLlmRules;
|
|
512
|
-
observations?: TraceContractObservationRules;
|
|
513
|
-
/**
|
|
514
|
-
* Declared-versus-enforced control invariants.
|
|
515
|
-
*
|
|
516
|
-
* @experimental Additive in 6.23.
|
|
517
|
-
*/
|
|
518
|
-
controls?: TraceContractControlRules;
|
|
519
|
-
/**
|
|
520
|
-
* Retry / side-effect safety using explicit attempt identity.
|
|
521
|
-
*
|
|
522
|
-
* @experimental Additive in 6.23.
|
|
523
|
-
*/
|
|
524
|
-
retry?: TraceContractRetryRules;
|
|
525
|
-
};
|
|
526
|
-
interface TraceContractInput extends TraceContractBody {
|
|
527
|
-
/**
|
|
528
|
-
* Optional actor/run projection applied before evaluation (#320).
|
|
529
|
-
*
|
|
530
|
-
* @experimental
|
|
531
|
-
*/
|
|
532
|
-
scope?: TraceContractScope;
|
|
533
|
-
alternatives?: TraceContractAlternatives;
|
|
534
|
-
}
|
|
535
|
-
interface TraceContract extends TraceContractBody {
|
|
536
|
-
/**
|
|
537
|
-
* Optional actor/run projection applied before evaluation (#320).
|
|
538
|
-
*
|
|
539
|
-
* @experimental
|
|
540
|
-
*/
|
|
541
|
-
scope?: TraceContractScope;
|
|
542
|
-
alternatives?: TraceContractAlternatives;
|
|
543
|
-
}
|
|
544
|
-
/**
|
|
545
|
-
* Lint diagnostic for brittle or invalid TraceContract shapes.
|
|
546
|
-
*
|
|
547
|
-
* @experimental
|
|
548
|
-
*/
|
|
549
|
-
interface TraceContractLintDiagnostic {
|
|
550
|
-
code: string;
|
|
551
|
-
severity: "error" | "warning" | "info";
|
|
552
|
-
message: string;
|
|
553
|
-
path?: string;
|
|
554
|
-
}
|
|
555
|
-
/**
|
|
556
|
-
* Define a normalized trace contract object.
|
|
557
|
-
*
|
|
558
|
-
* @experimental
|
|
559
|
-
*/
|
|
560
|
-
declare function defineTraceContract(input: TraceContractInput): TraceContract;
|
|
561
|
-
/**
|
|
562
|
-
* Evaluate a trace contract against an opened trace read result.
|
|
563
|
-
*
|
|
564
|
-
* Base rules always apply. When `alternatives.anyOf` is present, at least one
|
|
565
|
-
* complete branch must also pass.
|
|
566
|
-
*
|
|
567
|
-
* @experimental
|
|
568
|
-
*/
|
|
569
|
-
declare function evaluateTraceContract(input: TraceCheckInput, contract: TraceContract, options?: {
|
|
570
|
-
runId?: string;
|
|
571
|
-
}): TraceCheckResult;
|
|
572
|
-
/**
|
|
573
|
-
* Convenience: evaluate a contract against a TraceReadResult directly.
|
|
574
|
-
*
|
|
575
|
-
* @experimental Additive wrapper over `evaluateTraceContract({ read }, …)`.
|
|
576
|
-
*/
|
|
577
|
-
declare function evaluateTraceContractRead(read: TraceReadResult, contract: TraceContract, options?: {
|
|
578
|
-
runId?: string;
|
|
579
|
-
}): TraceCheckResult;
|
|
580
|
-
/**
|
|
581
|
-
* Lint a TraceContract for invalid or brittle shapes (does not evaluate a trace).
|
|
582
|
-
*
|
|
583
|
-
* @experimental
|
|
584
|
-
*/
|
|
585
|
-
declare function lintTraceContract(contract: TraceContract): TraceContractLintDiagnostic[];
|
|
586
|
-
/**
|
|
587
|
-
* Explain a TraceContract as short human-readable lines (does not evaluate a trace).
|
|
588
|
-
*
|
|
589
|
-
* @experimental
|
|
590
|
-
*/
|
|
591
|
-
declare function explainTraceContract(contract: TraceContract): string[];
|
|
592
|
-
|
|
593
|
-
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 };
|
|
188
|
+
export { type DerivedFailureConfidence, type DerivedFailureFact, type DerivedFailureRole, type FailureRoleCounts, LogicalProjectionDiagnostic, LogicalTraceEvent, type SemanticParitySummary, type TraceFacts, type TraceRelationship, type TraceRelationshipConfidence, type TraceRelationshipDiagnostic, type TraceRelationshipType, buildTraceFacts, deriveFailureFacts, deriveRelationshipFacts, summarizeSemanticParity };
|