agent-inspect 6.31.6 → 6.31.8
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 +13 -0
- package/README.md +1 -1
- package/docs/AI-SDK-ADOPTION.md +62 -34
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-YXDNWHNJ.mjs → chunk-6FE47XSF.mjs} +119 -34
- package/packages/cli/dist/chunk-6FE47XSF.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +569 -102
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +454 -74
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-H22KNWAZ.mjs → src-NXAYHG34.mjs} +3 -3
- package/packages/cli/dist/{src-H22KNWAZ.mjs.map → src-NXAYHG34.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +116 -31
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.mjs +7 -7
- package/packages/core/dist/checks.mjs +2 -2
- package/packages/core/dist/{chunk-LXYPM2ZO.mjs → chunk-2CCRUI42.mjs} +19 -318
- package/packages/core/dist/chunk-2CCRUI42.mjs.map +1 -0
- package/packages/core/dist/{chunk-Q5SLKV2Y.mjs → chunk-2IRRUNIN.mjs} +28 -5
- package/packages/core/dist/chunk-2IRRUNIN.mjs.map +1 -0
- package/packages/core/dist/{chunk-EXGQLMVB.mjs → chunk-7YYS742B.mjs} +49 -12
- package/packages/core/dist/chunk-7YYS742B.mjs.map +1 -0
- package/packages/core/dist/{chunk-OSGNGRHF.mjs → chunk-IJJSPJXV.mjs} +51 -25
- package/packages/core/dist/chunk-IJJSPJXV.mjs.map +1 -0
- package/packages/core/dist/chunk-L5WLVBW4.mjs +355 -0
- package/packages/core/dist/chunk-L5WLVBW4.mjs.map +1 -0
- package/packages/core/dist/exporters.cjs +327 -58
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.mjs +281 -49
- package/packages/core/dist/exporters.mjs.map +1 -1
- package/packages/core/dist/persisted.cjs +361 -9
- package/packages/core/dist/persisted.cjs.map +1 -1
- package/packages/core/dist/persisted.d.cts +8 -1
- package/packages/core/dist/persisted.d.ts +8 -1
- package/packages/core/dist/persisted.mjs +3 -2
- package/packages/core/dist/persisted.mjs.map +1 -1
- package/packages/core/dist/readers.cjs +425 -100
- package/packages/core/dist/readers.cjs.map +1 -1
- package/packages/core/dist/readers.mjs +3 -3
- package/packages/cli/dist/chunk-YXDNWHNJ.mjs.map +0 -1
- package/packages/core/dist/chunk-EXGQLMVB.mjs.map +0 -1
- package/packages/core/dist/chunk-FWK3Q3OJ.mjs +0 -56
- package/packages/core/dist/chunk-FWK3Q3OJ.mjs.map +0 -1
- package/packages/core/dist/chunk-LXYPM2ZO.mjs.map +0 -1
- package/packages/core/dist/chunk-OSGNGRHF.mjs.map +0 -1
- package/packages/core/dist/chunk-Q5SLKV2Y.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 6.31.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5bbe8c0: Restore CLI export lifecycle coalescing for schema 0.1 nested tools, map adapter modelId/source/fractional duration on OTLP export, keep OTLP parent lookup trace-scoped, strengthen producer validation, and make Promptfoo/Collector/Elastic recipe verifiers honest.
|
|
8
|
+
|
|
9
|
+
## 6.31.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 3f7abb5: Make timeline depth resolution cycle-safe and stack-safe for cyclic or very deep parent chains (GitHub #453 / #454).
|
|
14
|
+
- 3f7abb5: Preserve framework source attribution on CLI export via the persisted tree bridge, emit numeric OTLP StatusCode/SpanKind enums, map numeric status 0/1/2 on import, and harden OTLP nested validation with field-path diagnostics.
|
|
15
|
+
|
|
3
16
|
## 6.31.6
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -213,7 +213,7 @@ The root package is enough for custom capture, the CLI, checks, and Evidence wor
|
|
|
213
213
|
|
|
214
214
|
## Status and documentation
|
|
215
215
|
|
|
216
|
-
**Current published baseline:** **6.31.
|
|
216
|
+
**Current published baseline:** **6.31.8** · persisted schema `1.0` · Node.js `>=20` · MIT.
|
|
217
217
|
|
|
218
218
|
Legacy v0.1 and v0.2 traces remain readable. Check the npm badge and [changelog](CHANGELOG.md) for the current published version.
|
|
219
219
|
|
package/docs/AI-SDK-ADOPTION.md
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Blessed path for **Vercel AI SDK** + AgentInspect — local traces only, metadata-first by default.
|
|
4
4
|
|
|
5
|
+
**Peer:** `ai@^6.0.0` — tested with **`ai@6.0.210`**. This guide does not claim AI SDK 7 support.
|
|
6
|
+
|
|
5
7
|
## Install
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
|
-
npm install agent-inspect @agent-inspect/ai-sdk ai
|
|
10
|
+
npm install agent-inspect @agent-inspect/ai-sdk ai@6.0.210
|
|
9
11
|
```
|
|
10
12
|
|
|
11
13
|
Or bootstrap a project:
|
|
@@ -20,54 +22,79 @@ npx agent-inspect init --framework ai-sdk
|
|
|
20
22
|
import { generateText } from "ai";
|
|
21
23
|
import { agentInspect } from "@agent-inspect/ai-sdk";
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
isEnabled: true,
|
|
28
|
-
recordInputs: false,
|
|
29
|
-
recordOutputs: false,
|
|
30
|
-
integrations: [
|
|
31
|
-
agentInspect({
|
|
32
|
-
traceDir: ".agent-inspect",
|
|
33
|
-
runName: "support-agent",
|
|
34
|
-
capture: "metadata-only",
|
|
35
|
-
}),
|
|
36
|
-
],
|
|
37
|
-
},
|
|
25
|
+
const integration = agentInspect({
|
|
26
|
+
traceDir: ".agent-inspect",
|
|
27
|
+
runName: "support-agent",
|
|
28
|
+
capture: "metadata-only",
|
|
38
29
|
});
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
await generateText({
|
|
33
|
+
model: yourModel,
|
|
34
|
+
prompt: "Hello",
|
|
35
|
+
experimental_telemetry: {
|
|
36
|
+
isEnabled: true,
|
|
37
|
+
recordInputs: false,
|
|
38
|
+
recordOutputs: false,
|
|
39
|
+
integrations: [integration],
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
} finally {
|
|
43
|
+
await integration.flush();
|
|
44
|
+
await integration.close();
|
|
45
|
+
}
|
|
39
46
|
```
|
|
40
47
|
|
|
48
|
+
Pass the integration only through `experimental_telemetry.integrations`. AgentInspect does **not** expose `getTelemetryMetadata()` or `getTelemetryHandlers()`.
|
|
49
|
+
|
|
41
50
|
## `streamText` (metadata-only)
|
|
42
51
|
|
|
43
52
|
```ts
|
|
44
53
|
import { streamText } from "ai";
|
|
45
54
|
import { agentInspect } from "@agent-inspect/ai-sdk";
|
|
46
55
|
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
isEnabled: true,
|
|
52
|
-
recordInputs: false,
|
|
53
|
-
recordOutputs: false,
|
|
54
|
-
integrations: [
|
|
55
|
-
agentInspect({
|
|
56
|
-
traceDir: ".agent-inspect",
|
|
57
|
-
runName: "stream-demo",
|
|
58
|
-
capture: "metadata-only",
|
|
59
|
-
}),
|
|
60
|
-
],
|
|
61
|
-
},
|
|
56
|
+
const integration = agentInspect({
|
|
57
|
+
traceDir: ".agent-inspect",
|
|
58
|
+
runName: "stream-demo",
|
|
59
|
+
capture: "metadata-only",
|
|
62
60
|
});
|
|
63
61
|
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
try {
|
|
63
|
+
const result = streamText({
|
|
64
|
+
model: yourModel,
|
|
65
|
+
prompt: "Hello",
|
|
66
|
+
experimental_telemetry: {
|
|
67
|
+
isEnabled: true,
|
|
68
|
+
recordInputs: false,
|
|
69
|
+
recordOutputs: false,
|
|
70
|
+
integrations: [integration],
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
for await (const _chunk of result.textStream) {
|
|
75
|
+
// consume stream
|
|
76
|
+
}
|
|
77
|
+
} finally {
|
|
78
|
+
await integration.flush();
|
|
79
|
+
await integration.close();
|
|
66
80
|
}
|
|
67
81
|
```
|
|
68
82
|
|
|
69
83
|
Streaming lifecycle metadata is captured; raw token streams are not persisted by default.
|
|
70
84
|
|
|
85
|
+
## Concurrent generations
|
|
86
|
+
|
|
87
|
+
Create a **new** `agentInspect()` instance for each concurrent generation. Do not share one integration across overlapping `generateText` / `streamText` calls.
|
|
88
|
+
|
|
89
|
+
## Diagnostics
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
const d = integration.getDiagnostics();
|
|
93
|
+
console.log(d.writeFailures, d.lifecycleWarnings, d.lastWarning, d.capture);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Use `onDiagnostic` in options for live callbacks. Failures degrade locally; they do not throw into your agent return path.
|
|
97
|
+
|
|
71
98
|
## Tool calls
|
|
72
99
|
|
|
73
100
|
Tool spans appear when the model invokes tools. Keep `recordInputs` / `recordOutputs` false unless you explicitly accept content capture risk.
|
|
@@ -110,10 +137,11 @@ Use `--fail-on-observation` only when the run records explicit OUTCOME events.
|
|
|
110
137
|
|
|
111
138
|
| Symptom | Fix |
|
|
112
139
|
| ------- | --- |
|
|
113
|
-
| No trace file | Ensure `experimental_telemetry.isEnabled: true` and integrations
|
|
140
|
+
| No trace file | Ensure `experimental_telemetry.isEnabled: true` and `integrations: [integration]` |
|
|
114
141
|
| Empty trace | Confirm `AGENT_INSPECT` is not `0` |
|
|
115
142
|
| Prompts in trace | Set `recordInputs: false` and `recordOutputs: false` on the AI SDK call |
|
|
116
143
|
| Wrong directory | Pass `traceDir` to `agentInspect()` or set `AGENT_INSPECT_TRACE_DIR` |
|
|
144
|
+
| Mixed concurrent runs | Use a separate `agentInspect()` instance per overlapping generation |
|
|
117
145
|
|
|
118
146
|
## Recipes (no network)
|
|
119
147
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-inspect",
|
|
3
|
-
"version": "6.31.
|
|
3
|
+
"version": "6.31.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Local evidence debugger and trajectory-test toolkit for TypeScript AI agents — execution trees, TraceContract checks, Evidence v2, and read-only MCP",
|
|
@@ -2243,6 +2243,8 @@ function renderTraceStats(stats) {
|
|
|
2243
2243
|
}
|
|
2244
2244
|
|
|
2245
2245
|
// packages/core/src/timeline.ts
|
|
2246
|
+
var ROOT_TIMELINE_DEPTH = 0;
|
|
2247
|
+
var MAX_TIMELINE_DEPTH = 1e3;
|
|
2246
2248
|
function finite(n) {
|
|
2247
2249
|
return typeof n === "number" && Number.isFinite(n);
|
|
2248
2250
|
}
|
|
@@ -2313,16 +2315,51 @@ function buildRunTimeline(events, options = {}) {
|
|
|
2313
2315
|
const computeDepth = (stepId) => {
|
|
2314
2316
|
const cached = depthCache.get(stepId);
|
|
2315
2317
|
if (cached !== void 0) return cached;
|
|
2316
|
-
const
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2318
|
+
const ancestry = [];
|
|
2319
|
+
const ancestryIndexes = /* @__PURE__ */ new Map();
|
|
2320
|
+
let currentStepId = stepId;
|
|
2321
|
+
let resolvedDepth;
|
|
2322
|
+
while (resolvedDepth === void 0) {
|
|
2323
|
+
const cachedDepth = depthCache.get(currentStepId);
|
|
2324
|
+
if (cachedDepth !== void 0) {
|
|
2325
|
+
resolvedDepth = cachedDepth;
|
|
2326
|
+
continue;
|
|
2327
|
+
}
|
|
2328
|
+
const cycleStart = ancestryIndexes.get(currentStepId);
|
|
2329
|
+
if (cycleStart !== void 0) {
|
|
2330
|
+
const cycleStepIds = ancestry.splice(cycleStart);
|
|
2331
|
+
for (const cycleStepId of cycleStepIds) {
|
|
2332
|
+
depthCache.set(cycleStepId, ROOT_TIMELINE_DEPTH);
|
|
2333
|
+
}
|
|
2334
|
+
resolvedDepth = ROOT_TIMELINE_DEPTH;
|
|
2335
|
+
continue;
|
|
2336
|
+
}
|
|
2337
|
+
const currentStep = steps.get(currentStepId);
|
|
2338
|
+
if (!currentStep) {
|
|
2339
|
+
resolvedDepth = ROOT_TIMELINE_DEPTH;
|
|
2340
|
+
continue;
|
|
2341
|
+
}
|
|
2342
|
+
ancestryIndexes.set(currentStepId, ancestry.length);
|
|
2343
|
+
ancestry.push(currentStepId);
|
|
2344
|
+
const parentId = currentStep.parentId;
|
|
2345
|
+
if (typeof parentId !== "string" || parentId.trim() === "" || !steps.has(parentId)) {
|
|
2346
|
+
ancestry.pop();
|
|
2347
|
+
depthCache.set(currentStepId, ROOT_TIMELINE_DEPTH);
|
|
2348
|
+
resolvedDepth = ROOT_TIMELINE_DEPTH;
|
|
2349
|
+
continue;
|
|
2350
|
+
}
|
|
2351
|
+
currentStepId = parentId;
|
|
2352
|
+
}
|
|
2353
|
+
ancestry.reverse();
|
|
2354
|
+
for (const ancestorStepId of ancestry) {
|
|
2355
|
+
resolvedDepth = Math.min(MAX_TIMELINE_DEPTH, resolvedDepth + 1);
|
|
2356
|
+
depthCache.set(ancestorStepId, resolvedDepth);
|
|
2357
|
+
}
|
|
2358
|
+
const resolvedStepDepth = depthCache.get(stepId);
|
|
2359
|
+
if (resolvedStepDepth === void 0) {
|
|
2360
|
+
throw new Error(`Failed to resolve timeline depth for step "${stepId}"`);
|
|
2322
2361
|
}
|
|
2323
|
-
|
|
2324
|
-
depthCache.set(stepId, d);
|
|
2325
|
-
return d;
|
|
2362
|
+
return resolvedStepDepth;
|
|
2326
2363
|
};
|
|
2327
2364
|
const entries = [];
|
|
2328
2365
|
for (const [stepId, s] of steps.entries()) {
|
|
@@ -11882,6 +11919,23 @@ function persistedInspectEventToInspectEvent(event) {
|
|
|
11882
11919
|
if (event.durationMs !== void 0 && Number.isFinite(event.durationMs) && event.durationMs >= 0) {
|
|
11883
11920
|
out.durationMs = event.durationMs;
|
|
11884
11921
|
}
|
|
11922
|
+
if (event.startedAt !== void 0) {
|
|
11923
|
+
const started = parseIsoToMs3(event.startedAt);
|
|
11924
|
+
if (!started.invalidTimestamp) {
|
|
11925
|
+
attrs.startedAtMs = started.ms;
|
|
11926
|
+
out.timestamp = started.ms;
|
|
11927
|
+
}
|
|
11928
|
+
}
|
|
11929
|
+
if (event.endedAt !== void 0) {
|
|
11930
|
+
const ended = parseIsoToMs3(event.endedAt);
|
|
11931
|
+
if (!ended.invalidTimestamp) {
|
|
11932
|
+
attrs.endedAtMs = ended.ms;
|
|
11933
|
+
if (out.durationMs === void 0 && typeof attrs.startedAtMs === "number" && ended.ms >= attrs.startedAtMs) {
|
|
11934
|
+
out.durationMs = ended.ms - attrs.startedAtMs;
|
|
11935
|
+
}
|
|
11936
|
+
}
|
|
11937
|
+
}
|
|
11938
|
+
out.attributes = compactAttributes3(attrs);
|
|
11885
11939
|
return out;
|
|
11886
11940
|
}
|
|
11887
11941
|
function persistedInspectEventsToInspectEvents(events, options) {
|
|
@@ -11900,8 +11954,13 @@ function persistedInspectEventsToInspectEvents(events, options) {
|
|
|
11900
11954
|
}
|
|
11901
11955
|
|
|
11902
11956
|
// packages/core/src/persisted/tree-bridge.ts
|
|
11957
|
+
function logicalToPersisted(event) {
|
|
11958
|
+
const { sourceEventIds: _sourceEventIds, projection: _projection, ...rest } = event;
|
|
11959
|
+
return rest;
|
|
11960
|
+
}
|
|
11903
11961
|
function persistedInspectEventsToRunTrees(events, options) {
|
|
11904
|
-
const
|
|
11962
|
+
const sourceEvents = options?.coalesceLifecycle === true ? projectLogicalEvents(events).logicalEvents.map(logicalToPersisted) : events;
|
|
11963
|
+
const inspectEvents = persistedInspectEventsToInspectEvents(sourceEvents, {
|
|
11905
11964
|
skipInvalid: options?.skipInvalid
|
|
11906
11965
|
});
|
|
11907
11966
|
return new TreeBuilder().build(inspectEvents);
|
|
@@ -12595,7 +12654,7 @@ function mapOpenInferenceSpan(span, index, version) {
|
|
|
12595
12654
|
const errorMessage = isRecord11(span.status) && typeof span.status.message === "string" ? span.status.message : void 0;
|
|
12596
12655
|
const event = {
|
|
12597
12656
|
schemaVersion: "0.2",
|
|
12598
|
-
eventId: typeof rawAttributes["agent_inspect.event_id"] === "string" ? rawAttributes["agent_inspect.event_id"] : spanId
|
|
12657
|
+
eventId: typeof rawAttributes["agent_inspect.event_id"] === "string" ? rawAttributes["agent_inspect.event_id"] : `${traceId}:${spanId}`,
|
|
12599
12658
|
runId: typeof rawAttributes["agent_inspect.run_id"] === "string" ? rawAttributes["agent_inspect.run_id"] : traceId,
|
|
12600
12659
|
kind,
|
|
12601
12660
|
name,
|
|
@@ -12646,12 +12705,16 @@ function mapOpenInferenceEvents(document) {
|
|
|
12646
12705
|
const mapped = document.spans.map(
|
|
12647
12706
|
(span, index) => mapOpenInferenceSpan(span, index, document.version)
|
|
12648
12707
|
);
|
|
12649
|
-
const
|
|
12650
|
-
mapped.map((span) =>
|
|
12708
|
+
const spanKeyToEventId = new Map(
|
|
12709
|
+
mapped.map((span) => {
|
|
12710
|
+
const traceId = typeof span.event.trace?.traceId === "string" ? span.event.trace.traceId : "";
|
|
12711
|
+
return [`${traceId}:${span.spanId}`, span.event.eventId];
|
|
12712
|
+
})
|
|
12651
12713
|
);
|
|
12652
12714
|
for (const span of mapped) {
|
|
12653
12715
|
if (span.parentSpanId === void 0) continue;
|
|
12654
|
-
span.event.
|
|
12716
|
+
const traceId = typeof span.event.trace?.traceId === "string" ? span.event.trace.traceId : "";
|
|
12717
|
+
span.event.parentId = spanKeyToEventId.get(`${traceId}:${span.parentSpanId}`) ?? span.parentSpanId;
|
|
12655
12718
|
}
|
|
12656
12719
|
return {
|
|
12657
12720
|
events: mapped.map((span) => span.event),
|
|
@@ -12943,20 +13006,38 @@ function extractOtlpDocument(root) {
|
|
|
12943
13006
|
function mapOtlpStatus(status) {
|
|
12944
13007
|
if (!isRecord11(status)) return void 0;
|
|
12945
13008
|
const rawCode = status.code;
|
|
12946
|
-
if (typeof rawCode
|
|
12947
|
-
|
|
12948
|
-
|
|
12949
|
-
|
|
12950
|
-
|
|
12951
|
-
|
|
12952
|
-
|
|
12953
|
-
|
|
12954
|
-
|
|
12955
|
-
|
|
12956
|
-
|
|
12957
|
-
|
|
12958
|
-
|
|
13009
|
+
if (typeof rawCode === "number" && Number.isFinite(rawCode)) {
|
|
13010
|
+
switch (rawCode) {
|
|
13011
|
+
case 0:
|
|
13012
|
+
return "unknown";
|
|
13013
|
+
case 1:
|
|
13014
|
+
return "ok";
|
|
13015
|
+
case 2:
|
|
13016
|
+
return "error";
|
|
13017
|
+
default:
|
|
13018
|
+
return "unknown";
|
|
13019
|
+
}
|
|
13020
|
+
}
|
|
13021
|
+
if (typeof rawCode === "string") {
|
|
13022
|
+
const trimmed = rawCode.trim();
|
|
13023
|
+
if (/^\d+$/.test(trimmed)) {
|
|
13024
|
+
return mapOtlpStatus({ code: Number(trimmed) });
|
|
13025
|
+
}
|
|
13026
|
+
switch (trimmed.toUpperCase()) {
|
|
13027
|
+
case "STATUS_CODE_OK":
|
|
13028
|
+
case "OK":
|
|
13029
|
+
return "ok";
|
|
13030
|
+
case "STATUS_CODE_ERROR":
|
|
13031
|
+
case "ERROR":
|
|
13032
|
+
return "error";
|
|
13033
|
+
case "STATUS_CODE_UNSET":
|
|
13034
|
+
case "UNSET":
|
|
13035
|
+
return "unknown";
|
|
13036
|
+
default:
|
|
13037
|
+
return "unknown";
|
|
13038
|
+
}
|
|
12959
13039
|
}
|
|
13040
|
+
return void 0;
|
|
12960
13041
|
}
|
|
12961
13042
|
function readOtlpKind(attributes, pathPrefix) {
|
|
12962
13043
|
const warnings = [];
|
|
@@ -13182,7 +13263,7 @@ function mapOtlpSpan(context) {
|
|
|
13182
13263
|
const errorMessage = isRecord11(span.status) && typeof span.status.message === "string" ? span.status.message : void 0;
|
|
13183
13264
|
const event = {
|
|
13184
13265
|
schemaVersion: "0.2",
|
|
13185
|
-
eventId: typeof parsedSpanAttributes.attributes["agent_inspect.event_id"] === "string" ? parsedSpanAttributes.attributes["agent_inspect.event_id"] : spanId
|
|
13266
|
+
eventId: typeof parsedSpanAttributes.attributes["agent_inspect.event_id"] === "string" ? parsedSpanAttributes.attributes["agent_inspect.event_id"] : `${traceId}:${spanId}`,
|
|
13186
13267
|
runId: typeof parsedSpanAttributes.attributes["agent_inspect.run_id"] === "string" ? parsedSpanAttributes.attributes["agent_inspect.run_id"] : traceId,
|
|
13187
13268
|
kind,
|
|
13188
13269
|
name: readStringField(span, ["name"]) ?? spanId,
|
|
@@ -13231,12 +13312,16 @@ function mapOtlpSpan(context) {
|
|
|
13231
13312
|
}
|
|
13232
13313
|
function mapOtlpEventsToPersisted(document) {
|
|
13233
13314
|
const mapped = document.spans.map((span) => mapOtlpSpan(span));
|
|
13234
|
-
const
|
|
13235
|
-
mapped.map((span) =>
|
|
13315
|
+
const spanKeyToEventId = new Map(
|
|
13316
|
+
mapped.map((span) => {
|
|
13317
|
+
const traceId = typeof span.event.trace?.traceId === "string" ? span.event.trace.traceId : "";
|
|
13318
|
+
return [`${traceId}:${span.spanId}`, span.event.eventId];
|
|
13319
|
+
})
|
|
13236
13320
|
);
|
|
13237
13321
|
for (const span of mapped) {
|
|
13238
13322
|
if (span.parentSpanId === void 0) continue;
|
|
13239
|
-
span.event.
|
|
13323
|
+
const traceId = typeof span.event.trace?.traceId === "string" ? span.event.trace.traceId : "";
|
|
13324
|
+
span.event.parentId = spanKeyToEventId.get(`${traceId}:${span.parentSpanId}`) ?? span.parentSpanId;
|
|
13240
13325
|
}
|
|
13241
13326
|
return {
|
|
13242
13327
|
events: mapped.map((span) => span.event),
|
|
@@ -14887,6 +14972,6 @@ function renderGateReport(result, options = {}) {
|
|
|
14887
14972
|
return renderGateSummaryMarkdown(result);
|
|
14888
14973
|
}
|
|
14889
14974
|
|
|
14890
|
-
export { ATTRIBUTION_CONFIDENCES, COHORT_METRIC_IDS, DEFAULT_REDACT_KEYS, DEFAULT_SUITE_ARTIFACTS_DIR, EVIDENCE_FORMAT_VERSION, EVIDENCE_HTML_FILENAME, EVIDENCE_MANIFEST_FILENAME, Redactor, TraceDirectory, TraceReadError, TreeBuilder, aggregateBundleSafeStatus, aggregateSessionCheckResults, analyzeCohort, applyProfileMetadataCaps, assertBundlePathContained, assertEvidenceRelativePath, buildActivitySummary, buildBundleMetadata, buildBundleSummaryMarkdown, buildEvidenceCausalFailureViewHtml, buildEvidenceCiPackage, buildEvidenceCircuitViewHtml, buildEvidenceContractsViewHtml, buildEvidenceDiffViewHtml, buildEvidenceHtmlShell, buildEvidenceManifest, buildEvidenceOutcomesViewHtml, buildEvidenceProvenanceViewHtml, buildEvidenceSafetyViewHtml, buildEvidenceTimelineViewHtml, buildEvidenceToolsLlmViewHtml, buildEvidenceTreeViewHtml, buildLocalExplanation, buildPlaceholderArtifact, buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildSessionIndex, buildTraceStats, buildZipArchive, bundleFailsOnSafety, bundleRunAssetRelativePath, collectTraceSchemaVersions, compactAttributes, createBaselineRegressionRule, createLlmUsageRule, createMaxStepDurationRule, createObservedOutcomeRule, createRequireCompletedRule, createRunDepthRule, createRunDurationRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStructureCycleRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolUsageRule, defaultBundleOutputPath, defaultSuiteConfigTemplate, defineTraceContract, diffRuns, diffTraceEvents, enrichSessionRunRecord, escapeHtml, escapeMarkdown, evaluateTraceContract, extractMetadata, extractOutcomesFromTraceEvents, filterMetasBySessionScope, filterTraces, flattenTree, formatDuration2 as formatDuration, formatStepLabel, formatTimestamp, gateHasThresholds, getIndent, getTraceFilePath, inferEvidenceFileRole, isAgentInspectTrace, isAttributionConfidence, isCredentialSensitiveKey, isPersistedInspectEvent, loadSessionRunRecords, loadSuiteConfig, loadTraceMetadataList, manualTraceEventsToComparableRun, nanoid, normalizeBundleOutputPath, openTrace, parseCohortMetricList, parseDuration, parseDurationFilter, parseGateList, parseTraceJsonl, persistedInspectEventsToTraceEvents, projectLogicalEvents, renderActivitySummaryHuman, renderCohortReport, renderErrorLine, renderGateReport, renderObservedOutcomesHtml, renderObservedOutcomesMarkdown, renderRunDiff, renderRunWhat, renderStepLine, renderSuiteReport, renderTimeline, renderTraceStats, resolveBundleRunIds, resolveRedactionProfile, resolveSuiteTemplate, resolveTraceDir, runGate, runSuite, runTraceChecks, safeString, sanitizeBundleRunId, searchTraces, serializeEvidenceManifest, sha256Hex, stableJson, stringContainsHighConfidenceCredential, summarizeObservedOutcomes, summarizeSemanticParity, traceEventToPersistedInspectEvent, truncateName, truncateStringForProfile, validateEvent, validateSuiteConfig, verifyEvidenceDirectory, zeroKinds };
|
|
14891
|
-
//# sourceMappingURL=chunk-
|
|
14892
|
-
//# sourceMappingURL=chunk-
|
|
14975
|
+
export { ATTRIBUTION_CONFIDENCES, COHORT_METRIC_IDS, DEFAULT_REDACT_KEYS, DEFAULT_SUITE_ARTIFACTS_DIR, EVIDENCE_FORMAT_VERSION, EVIDENCE_HTML_FILENAME, EVIDENCE_MANIFEST_FILENAME, Redactor, TraceDirectory, TraceReadError, TreeBuilder, aggregateBundleSafeStatus, aggregateSessionCheckResults, analyzeCohort, applyProfileMetadataCaps, assertBundlePathContained, assertEvidenceRelativePath, buildActivitySummary, buildBundleMetadata, buildBundleSummaryMarkdown, buildEvidenceCausalFailureViewHtml, buildEvidenceCiPackage, buildEvidenceCircuitViewHtml, buildEvidenceContractsViewHtml, buildEvidenceDiffViewHtml, buildEvidenceHtmlShell, buildEvidenceManifest, buildEvidenceOutcomesViewHtml, buildEvidenceProvenanceViewHtml, buildEvidenceSafetyViewHtml, buildEvidenceTimelineViewHtml, buildEvidenceToolsLlmViewHtml, buildEvidenceTreeViewHtml, buildLocalExplanation, buildPlaceholderArtifact, buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildSessionIndex, buildTraceStats, buildZipArchive, bundleFailsOnSafety, bundleRunAssetRelativePath, collectTraceSchemaVersions, compactAttributes, createBaselineRegressionRule, createLlmUsageRule, createMaxStepDurationRule, createObservedOutcomeRule, createRequireCompletedRule, createRunDepthRule, createRunDurationRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStructureCycleRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolUsageRule, defaultBundleOutputPath, defaultSuiteConfigTemplate, defineTraceContract, diffRuns, diffTraceEvents, enrichSessionRunRecord, escapeHtml, escapeMarkdown, evaluateTraceContract, extractMetadata, extractOutcomesFromTraceEvents, filterMetasBySessionScope, filterTraces, flattenTree, formatDuration2 as formatDuration, formatStepLabel, formatTimestamp, gateHasThresholds, getIndent, getTraceFilePath, inferEvidenceFileRole, isAgentInspectTrace, isAttributionConfidence, isCredentialSensitiveKey, isPersistedInspectEvent, loadSessionRunRecords, loadSuiteConfig, loadTraceMetadataList, manualTraceEventsToComparableRun, nanoid, normalizeBundleOutputPath, openTrace, parseCohortMetricList, parseDuration, parseDurationFilter, parseGateList, parseTraceJsonl, persistedInspectEventsToRunTrees, persistedInspectEventsToTraceEvents, projectLogicalEvents, renderActivitySummaryHuman, renderCohortReport, renderErrorLine, renderGateReport, renderObservedOutcomesHtml, renderObservedOutcomesMarkdown, renderRunDiff, renderRunWhat, renderStepLine, renderSuiteReport, renderTimeline, renderTraceStats, resolveBundleRunIds, resolveRedactionProfile, resolveSuiteTemplate, resolveTraceDir, runGate, runSuite, runTraceChecks, safeString, sanitizeBundleRunId, searchTraces, serializeEvidenceManifest, sha256Hex, stableJson, stringContainsHighConfidenceCredential, summarizeObservedOutcomes, summarizeSemanticParity, traceEventToPersistedInspectEvent, truncateName, truncateStringForProfile, validateEvent, validateSuiteConfig, verifyEvidenceDirectory, zeroKinds };
|
|
14976
|
+
//# sourceMappingURL=chunk-6FE47XSF.mjs.map
|
|
14977
|
+
//# sourceMappingURL=chunk-6FE47XSF.mjs.map
|