agent-inspect 6.20.0 → 6.22.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 +39 -0
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-QPRJUVLH.mjs → chunk-CHBYF4LE.mjs} +25 -2
- package/packages/cli/dist/chunk-CHBYF4LE.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +50 -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-6W5ZR3I7.mjs → src-MY5WIBPF.mjs} +3 -3
- package/packages/cli/dist/{src-6W5ZR3I7.mjs.map → src-MY5WIBPF.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +41 -0
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.d.cts +39 -157
- package/packages/core/dist/advanced.d.ts +39 -157
- package/packages/core/dist/advanced.mjs +35 -61
- package/packages/core/dist/advanced.mjs.map +1 -1
- package/packages/core/dist/checks.cjs +736 -45
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.d.cts +132 -5
- package/packages/core/dist/checks.d.ts +132 -5
- package/packages/core/dist/checks.mjs +2 -2
- package/packages/core/dist/{chunk-HT54OLPE.mjs → chunk-NDRMIL7Z.mjs} +103 -3
- package/packages/core/dist/chunk-NDRMIL7Z.mjs.map +1 -0
- package/packages/core/dist/{chunk-G47KQB42.mjs → chunk-OG3GAWCX.mjs} +727 -43
- package/packages/core/dist/chunk-OG3GAWCX.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-rVpX5PPh.d.cts → index-CR4CCRqP.d.cts} +159 -2
- package/packages/core/dist/{index-Bg9ZdsdS.d.ts → index-CtK_p-ps.d.ts} +159 -2
- package/packages/core/dist/{index-AMAGuO_i.d.ts → index-D72DPqAF.d.ts} +2 -1
- package/packages/core/dist/{index-vqr-g6ev.d.cts → index-DLLz9sce.d.cts} +2 -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/programmatic-gZTWLObB.d.cts +25 -0
- package/packages/core/dist/programmatic-gZTWLObB.d.ts +25 -0
- package/packages/core/dist/readers.cjs +105 -0
- package/packages/core/dist/readers.cjs.map +1 -1
- package/packages/core/dist/readers.d.cts +43 -18
- package/packages/core/dist/readers.d.ts +43 -18
- package/packages/core/dist/readers.mjs +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-QPRJUVLH.mjs.map +0 -1
- package/packages/core/dist/chunk-3XS5O4JI.mjs.map +0 -1
- package/packages/core/dist/chunk-G47KQB42.mjs.map +0 -1
- package/packages/core/dist/chunk-HT54OLPE.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,
|
|
3
|
-
export { PROGRAMMATIC_DIAGNOSTIC_SPECS, ProgrammaticDiagnosticCode, ProgrammaticDiagnosticSpec, formatProgrammaticDiagnostic } from './
|
|
4
|
-
import {
|
|
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
|
+
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
|
|
|
@@ -65,6 +67,43 @@ declare function deriveFailureFacts(logicalEvents: readonly LogicalTraceEvent[])
|
|
|
65
67
|
failureRoleCounts: FailureRoleCounts;
|
|
66
68
|
};
|
|
67
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
|
+
|
|
68
107
|
/**
|
|
69
108
|
* Shared semantic parity summary over logical lifecycle projection.
|
|
70
109
|
*
|
|
@@ -125,6 +164,18 @@ interface TraceFacts {
|
|
|
125
164
|
* @experimental Additive in 6.19.
|
|
126
165
|
*/
|
|
127
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[];
|
|
128
179
|
}
|
|
129
180
|
/**
|
|
130
181
|
* Build TraceFacts from a TraceReadResult or normalized persisted events.
|
|
@@ -134,6 +185,44 @@ interface TraceFacts {
|
|
|
134
185
|
declare function buildTraceFacts(input: TraceReadResult): TraceFacts;
|
|
135
186
|
declare function buildTraceFacts(input: readonly PersistedInspectEvent[]): TraceFacts;
|
|
136
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
|
+
|
|
137
226
|
/**
|
|
138
227
|
* @experimental Typed trace contract input. Evolves during v6.5.x.
|
|
139
228
|
*/
|
|
@@ -194,9 +283,35 @@ interface TraceContractLlmRules {
|
|
|
194
283
|
maxTotalTokens?: number;
|
|
195
284
|
allowedModels?: string[];
|
|
196
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* Structural provenance requirements for named observed outcomes (#321).
|
|
288
|
+
*
|
|
289
|
+
* These checks prove method/evidence linkage was recorded. They do **not**
|
|
290
|
+
* prove the claim is semantically true, authorized, complete, or externally
|
|
291
|
+
* trusted.
|
|
292
|
+
*
|
|
293
|
+
* @experimental
|
|
294
|
+
*/
|
|
295
|
+
interface TraceContractObservationProvenance {
|
|
296
|
+
/** Require a non-empty method from the bounded ObservedOutcomeMethod vocabulary. */
|
|
297
|
+
method?: boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Require bounded evidence references. Supported shapes:
|
|
300
|
+
* `string` event id, `{ eventId }`, or `{ eventIds: string[] }` (max 16 ids).
|
|
301
|
+
*/
|
|
302
|
+
evidence?: boolean;
|
|
303
|
+
/** When true with evidence, each referenced event id must exist in the same run. */
|
|
304
|
+
sameRunEventReference?: boolean;
|
|
305
|
+
}
|
|
197
306
|
interface TraceContractObservationRules {
|
|
198
307
|
required?: string[];
|
|
199
308
|
failOn?: Array<"failed" | "unknown" | "skipped">;
|
|
309
|
+
/**
|
|
310
|
+
* Structural provenance gates for `required` observation names.
|
|
311
|
+
*
|
|
312
|
+
* @experimental
|
|
313
|
+
*/
|
|
314
|
+
requireProvenance?: TraceContractObservationProvenance;
|
|
200
315
|
}
|
|
201
316
|
/**
|
|
202
317
|
* One deterministic alternate path. Branch contracts are one level only —
|
|
@@ -231,9 +346,21 @@ type TraceContractBody = {
|
|
|
231
346
|
observations?: TraceContractObservationRules;
|
|
232
347
|
};
|
|
233
348
|
interface TraceContractInput extends TraceContractBody {
|
|
349
|
+
/**
|
|
350
|
+
* Optional actor/run projection applied before evaluation (#320).
|
|
351
|
+
*
|
|
352
|
+
* @experimental
|
|
353
|
+
*/
|
|
354
|
+
scope?: TraceContractScope;
|
|
234
355
|
alternatives?: TraceContractAlternatives;
|
|
235
356
|
}
|
|
236
357
|
interface TraceContract extends TraceContractBody {
|
|
358
|
+
/**
|
|
359
|
+
* Optional actor/run projection applied before evaluation (#320).
|
|
360
|
+
*
|
|
361
|
+
* @experimental
|
|
362
|
+
*/
|
|
363
|
+
scope?: TraceContractScope;
|
|
237
364
|
alternatives?: TraceContractAlternatives;
|
|
238
365
|
}
|
|
239
366
|
/**
|
|
@@ -285,4 +412,4 @@ declare function lintTraceContract(contract: TraceContract): TraceContractLintDi
|
|
|
285
412
|
*/
|
|
286
413
|
declare function explainTraceContract(contract: TraceContract): string[];
|
|
287
414
|
|
|
288
|
-
export { type DerivedFailureConfidence, type DerivedFailureFact, type DerivedFailureRole, type FailureRoleCounts, LogicalProjectionDiagnostic, LogicalTraceEvent, type SemanticParitySummary, TraceCheckInput, TraceCheckResult, type TraceContract, type TraceContractAlternativeBranch, type TraceContractAlternatives, type TraceContractBody, type TraceContractInput, type TraceContractLintDiagnostic, type TraceContractLlmRules, type TraceContractObservationRules, type TraceContractRunRules, type TraceContractToolRules, type TraceFacts, buildTraceFacts, defineTraceContract, deriveFailureFacts, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, lintTraceContract, summarizeSemanticParity };
|
|
415
|
+
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, type TraceRelationship, type TraceRelationshipConfidence, type TraceRelationshipDiagnostic, type TraceRelationshipType, buildTraceFacts, defineTraceContract, deriveFailureFacts, deriveRelationshipFacts, 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,
|
|
3
|
-
export { PROGRAMMATIC_DIAGNOSTIC_SPECS, ProgrammaticDiagnosticCode, ProgrammaticDiagnosticSpec, formatProgrammaticDiagnostic } from './
|
|
4
|
-
import {
|
|
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
|
+
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
|
|
|
@@ -65,6 +67,43 @@ declare function deriveFailureFacts(logicalEvents: readonly LogicalTraceEvent[])
|
|
|
65
67
|
failureRoleCounts: FailureRoleCounts;
|
|
66
68
|
};
|
|
67
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
|
+
|
|
68
107
|
/**
|
|
69
108
|
* Shared semantic parity summary over logical lifecycle projection.
|
|
70
109
|
*
|
|
@@ -125,6 +164,18 @@ interface TraceFacts {
|
|
|
125
164
|
* @experimental Additive in 6.19.
|
|
126
165
|
*/
|
|
127
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[];
|
|
128
179
|
}
|
|
129
180
|
/**
|
|
130
181
|
* Build TraceFacts from a TraceReadResult or normalized persisted events.
|
|
@@ -134,6 +185,44 @@ interface TraceFacts {
|
|
|
134
185
|
declare function buildTraceFacts(input: TraceReadResult): TraceFacts;
|
|
135
186
|
declare function buildTraceFacts(input: readonly PersistedInspectEvent[]): TraceFacts;
|
|
136
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
|
+
|
|
137
226
|
/**
|
|
138
227
|
* @experimental Typed trace contract input. Evolves during v6.5.x.
|
|
139
228
|
*/
|
|
@@ -194,9 +283,35 @@ interface TraceContractLlmRules {
|
|
|
194
283
|
maxTotalTokens?: number;
|
|
195
284
|
allowedModels?: string[];
|
|
196
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* Structural provenance requirements for named observed outcomes (#321).
|
|
288
|
+
*
|
|
289
|
+
* These checks prove method/evidence linkage was recorded. They do **not**
|
|
290
|
+
* prove the claim is semantically true, authorized, complete, or externally
|
|
291
|
+
* trusted.
|
|
292
|
+
*
|
|
293
|
+
* @experimental
|
|
294
|
+
*/
|
|
295
|
+
interface TraceContractObservationProvenance {
|
|
296
|
+
/** Require a non-empty method from the bounded ObservedOutcomeMethod vocabulary. */
|
|
297
|
+
method?: boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Require bounded evidence references. Supported shapes:
|
|
300
|
+
* `string` event id, `{ eventId }`, or `{ eventIds: string[] }` (max 16 ids).
|
|
301
|
+
*/
|
|
302
|
+
evidence?: boolean;
|
|
303
|
+
/** When true with evidence, each referenced event id must exist in the same run. */
|
|
304
|
+
sameRunEventReference?: boolean;
|
|
305
|
+
}
|
|
197
306
|
interface TraceContractObservationRules {
|
|
198
307
|
required?: string[];
|
|
199
308
|
failOn?: Array<"failed" | "unknown" | "skipped">;
|
|
309
|
+
/**
|
|
310
|
+
* Structural provenance gates for `required` observation names.
|
|
311
|
+
*
|
|
312
|
+
* @experimental
|
|
313
|
+
*/
|
|
314
|
+
requireProvenance?: TraceContractObservationProvenance;
|
|
200
315
|
}
|
|
201
316
|
/**
|
|
202
317
|
* One deterministic alternate path. Branch contracts are one level only —
|
|
@@ -231,9 +346,21 @@ type TraceContractBody = {
|
|
|
231
346
|
observations?: TraceContractObservationRules;
|
|
232
347
|
};
|
|
233
348
|
interface TraceContractInput extends TraceContractBody {
|
|
349
|
+
/**
|
|
350
|
+
* Optional actor/run projection applied before evaluation (#320).
|
|
351
|
+
*
|
|
352
|
+
* @experimental
|
|
353
|
+
*/
|
|
354
|
+
scope?: TraceContractScope;
|
|
234
355
|
alternatives?: TraceContractAlternatives;
|
|
235
356
|
}
|
|
236
357
|
interface TraceContract extends TraceContractBody {
|
|
358
|
+
/**
|
|
359
|
+
* Optional actor/run projection applied before evaluation (#320).
|
|
360
|
+
*
|
|
361
|
+
* @experimental
|
|
362
|
+
*/
|
|
363
|
+
scope?: TraceContractScope;
|
|
237
364
|
alternatives?: TraceContractAlternatives;
|
|
238
365
|
}
|
|
239
366
|
/**
|
|
@@ -285,4 +412,4 @@ declare function lintTraceContract(contract: TraceContract): TraceContractLintDi
|
|
|
285
412
|
*/
|
|
286
413
|
declare function explainTraceContract(contract: TraceContract): string[];
|
|
287
414
|
|
|
288
|
-
export { type DerivedFailureConfidence, type DerivedFailureFact, type DerivedFailureRole, type FailureRoleCounts, LogicalProjectionDiagnostic, LogicalTraceEvent, type SemanticParitySummary, TraceCheckInput, TraceCheckResult, type TraceContract, type TraceContractAlternativeBranch, type TraceContractAlternatives, type TraceContractBody, type TraceContractInput, type TraceContractLintDiagnostic, type TraceContractLlmRules, type TraceContractObservationRules, type TraceContractRunRules, type TraceContractToolRules, type TraceFacts, buildTraceFacts, defineTraceContract, deriveFailureFacts, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, lintTraceContract, summarizeSemanticParity };
|
|
415
|
+
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, type TraceRelationship, type TraceRelationshipConfidence, type TraceRelationshipDiagnostic, type TraceRelationshipType, buildTraceFacts, defineTraceContract, deriveFailureFacts, deriveRelationshipFacts, 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, explainTraceContract, lintTraceContract, 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, deriveRelationshipFacts, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, lintTraceContract, projectLogicalEvents, resolveCanonicalToolName, resolveTraceContractScope, runTraceChecks, summarizeSemanticParity, workflowMetadataForRun } from './chunk-OG3GAWCX.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';
|
|
@@ -4,6 +4,106 @@ import { parseTraceJsonl } from './chunk-WRE4CNPF.mjs';
|
|
|
4
4
|
import { readFile, readdir } from 'fs/promises';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
|
|
7
|
+
// packages/core/src/readers/mapping-ledger.ts
|
|
8
|
+
var OPENINFERENCE_MAPPING_LEDGER = {
|
|
9
|
+
id: "openinference-to-agent-inspect",
|
|
10
|
+
sourceFormat: "openinference-json",
|
|
11
|
+
targetFormat: "agent-inspect-persisted-1.0",
|
|
12
|
+
convention: {
|
|
13
|
+
name: "OpenInference",
|
|
14
|
+
version: "0.2.x",
|
|
15
|
+
specUrl: "https://github.com/Arize-ai/openinference"
|
|
16
|
+
},
|
|
17
|
+
entries: [
|
|
18
|
+
{
|
|
19
|
+
source: "span.context.span_id",
|
|
20
|
+
target: "eventId / trace.spanId",
|
|
21
|
+
transformation: "hex identity when present",
|
|
22
|
+
confidence: "explicit",
|
|
23
|
+
loss: "none"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
source: "span.context.trace_id",
|
|
27
|
+
target: "trace.traceId",
|
|
28
|
+
transformation: "hex identity when present",
|
|
29
|
+
confidence: "explicit",
|
|
30
|
+
loss: "none"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
source: "span.parent_id",
|
|
34
|
+
target: "parentId",
|
|
35
|
+
transformation: "direct when resolvable in batch",
|
|
36
|
+
confidence: "explicit",
|
|
37
|
+
loss: "none"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
source: "attributes.openinference.span.kind",
|
|
41
|
+
target: "kind",
|
|
42
|
+
transformation: "enumerated kind map with degrade-to-LOGIC",
|
|
43
|
+
confidence: "correlated",
|
|
44
|
+
loss: "kind-degraded",
|
|
45
|
+
privacyDecision: "unknown kinds preserved under bounds as attributes"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
source: "attributes.llm.input_messages / output_messages",
|
|
49
|
+
target: "inputSummary / outputSummary",
|
|
50
|
+
transformation: "bounded summaries only",
|
|
51
|
+
confidence: "heuristic",
|
|
52
|
+
loss: "privacy-redacted",
|
|
53
|
+
privacyDecision: "raw message bodies are not required and may be omitted"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
knownLosses: [
|
|
57
|
+
"Chain-of-thought / private reasoning fields are never imported as raw content.",
|
|
58
|
+
"Oversized attributes are bounded or marked unsupported.",
|
|
59
|
+
"Unknown OpenInference kinds degrade to LOGIC with a warning."
|
|
60
|
+
]
|
|
61
|
+
};
|
|
62
|
+
var OTLP_JSON_MAPPING_LEDGER = {
|
|
63
|
+
id: "otlp-json-to-agent-inspect",
|
|
64
|
+
sourceFormat: "otlp-json",
|
|
65
|
+
targetFormat: "agent-inspect-persisted-1.0",
|
|
66
|
+
convention: {
|
|
67
|
+
name: "OpenTelemetry GenAI semantic conventions",
|
|
68
|
+
version: "1.36.0",
|
|
69
|
+
specUrl: "https://opentelemetry.io/docs/specs/semconv/gen-ai/"
|
|
70
|
+
},
|
|
71
|
+
entries: [
|
|
72
|
+
{
|
|
73
|
+
source: "resourceSpans[].scopeSpans[].spans[]",
|
|
74
|
+
target: "PersistedInspectEvent[]",
|
|
75
|
+
transformation: "one span \u2192 one event when mappable",
|
|
76
|
+
confidence: "explicit",
|
|
77
|
+
loss: "none"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
source: "span.attributes[gen_ai.*]",
|
|
81
|
+
target: "attributes / tokenUsage / kind",
|
|
82
|
+
transformation: "pinned GenAI attribute family",
|
|
83
|
+
confidence: "correlated",
|
|
84
|
+
loss: "bounded"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
source: "span.attributes (unknown keys)",
|
|
88
|
+
target: "attributes.* / unsupportedFields",
|
|
89
|
+
transformation: "preserve under bounds or list as unsupported",
|
|
90
|
+
confidence: "unknown",
|
|
91
|
+
loss: "unsupported"
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
knownLosses: [
|
|
95
|
+
"Schema 1.0 is not bound to Development-status OTel GenAI revisions.",
|
|
96
|
+
"Status rewrite to fit a local narrative is forbidden.",
|
|
97
|
+
"Payload bodies may be omitted; digests are optional application metadata."
|
|
98
|
+
]
|
|
99
|
+
};
|
|
100
|
+
var BUILTIN_MAPPING_LEDGERS = Object.freeze([
|
|
101
|
+
OPENINFERENCE_MAPPING_LEDGER,
|
|
102
|
+
OTLP_JSON_MAPPING_LEDGER
|
|
103
|
+
]);
|
|
104
|
+
function getMappingLedger(id) {
|
|
105
|
+
return BUILTIN_MAPPING_LEDGERS.find((ledger) => ledger.id === id);
|
|
106
|
+
}
|
|
7
107
|
var DEFAULT_MAX_TRACE_INPUT_BYTES = 10 * 1024 * 1024;
|
|
8
108
|
var MIN_DETECTION_CONFIDENCE = 0.5;
|
|
9
109
|
var AMBIGUOUS_CONFIDENCE_DELTA = 0.05;
|
|
@@ -1623,6 +1723,6 @@ function openTraceText(content, options = {}) {
|
|
|
1623
1723
|
return openTrace({ type: "string", content }, options);
|
|
1624
1724
|
}
|
|
1625
1725
|
|
|
1626
|
-
export { DEFAULT_TRACE_READERS, TraceReadError, agentInspectJsonlReader, assertTraceInput, detectTraceFormat, openInferenceJsonReader, openTrace, openTraceDirectory, openTraceFile, openTraceText, otlpJsonReader, readTrace };
|
|
1627
|
-
//# sourceMappingURL=chunk-
|
|
1628
|
-
//# sourceMappingURL=chunk-
|
|
1726
|
+
export { BUILTIN_MAPPING_LEDGERS, DEFAULT_TRACE_READERS, OPENINFERENCE_MAPPING_LEDGER, OTLP_JSON_MAPPING_LEDGER, TraceReadError, agentInspectJsonlReader, assertTraceInput, detectTraceFormat, getMappingLedger, openInferenceJsonReader, openTrace, openTraceDirectory, openTraceFile, openTraceText, otlpJsonReader, readTrace };
|
|
1727
|
+
//# sourceMappingURL=chunk-NDRMIL7Z.mjs.map
|
|
1728
|
+
//# sourceMappingURL=chunk-NDRMIL7Z.mjs.map
|