agent-inspect 1.5.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +14 -4
  3. package/docs/ADAPTER-CONFORMANCE.md +35 -0
  4. package/docs/ADAPTERS.md +79 -1
  5. package/docs/API.md +184 -10
  6. package/docs/ARCHITECTURE.md +4 -0
  7. package/docs/CLI.md +41 -12
  8. package/docs/KNOWN-ISSUES.md +11 -1
  9. package/docs/LIMITATIONS.md +19 -2
  10. package/docs/SCHEMA.md +17 -7
  11. package/package.json +23 -2
  12. package/packages/cli/dist/index.cjs +2449 -157
  13. package/packages/cli/dist/index.cjs.map +1 -1
  14. package/packages/cli/dist/index.mjs +2450 -158
  15. package/packages/cli/dist/index.mjs.map +1 -1
  16. package/packages/core/dist/advanced.cjs +839 -18
  17. package/packages/core/dist/advanced.cjs.map +1 -1
  18. package/packages/core/dist/advanced.d.cts +98 -3
  19. package/packages/core/dist/advanced.d.ts +98 -3
  20. package/packages/core/dist/advanced.mjs +7 -4
  21. package/packages/core/dist/chunk-57S5D6HR.mjs +655 -0
  22. package/packages/core/dist/chunk-57S5D6HR.mjs.map +1 -0
  23. package/packages/core/dist/chunk-6QSLZCBJ.mjs +743 -0
  24. package/packages/core/dist/chunk-6QSLZCBJ.mjs.map +1 -0
  25. package/packages/core/dist/chunk-6SZPTECC.mjs +342 -0
  26. package/packages/core/dist/chunk-6SZPTECC.mjs.map +1 -0
  27. package/packages/core/dist/{chunk-QX3ZMPUF.mjs → chunk-74XZ6N7Q.mjs} +13 -55
  28. package/packages/core/dist/chunk-74XZ6N7Q.mjs.map +1 -0
  29. package/packages/core/dist/{chunk-QPAU2TPA.mjs → chunk-HR7G62IE.mjs} +4 -4
  30. package/packages/core/dist/{chunk-QPAU2TPA.mjs.map → chunk-HR7G62IE.mjs.map} +1 -1
  31. package/packages/core/dist/chunk-S4YWKV4G.mjs +48 -0
  32. package/packages/core/dist/chunk-S4YWKV4G.mjs.map +1 -0
  33. package/packages/core/dist/chunk-TFLPUZ56.mjs +1571 -0
  34. package/packages/core/dist/chunk-TFLPUZ56.mjs.map +1 -0
  35. package/packages/core/dist/{chunk-Q6EPNB3V.mjs → chunk-TZISEVLQ.mjs} +34 -183
  36. package/packages/core/dist/chunk-TZISEVLQ.mjs.map +1 -0
  37. package/packages/core/dist/chunk-U2BGPESY.mjs +150 -0
  38. package/packages/core/dist/chunk-U2BGPESY.mjs.map +1 -0
  39. package/packages/core/dist/chunk-VTIB5MDK.mjs +304 -0
  40. package/packages/core/dist/chunk-VTIB5MDK.mjs.map +1 -0
  41. package/packages/core/dist/{chunk-5EMIZZXD.mjs → chunk-Y56BPA3B.mjs} +87 -4
  42. package/packages/core/dist/chunk-Y56BPA3B.mjs.map +1 -0
  43. package/packages/core/dist/diff.d.cts +3 -2
  44. package/packages/core/dist/diff.d.ts +3 -2
  45. package/packages/core/dist/exporters.cjs.map +1 -1
  46. package/packages/core/dist/exporters.d.cts +3 -2
  47. package/packages/core/dist/exporters.d.ts +3 -2
  48. package/packages/core/dist/exporters.mjs +2 -2
  49. package/packages/core/dist/index.cjs +2975 -229
  50. package/packages/core/dist/index.cjs.map +1 -1
  51. package/packages/core/dist/index.d.cts +27 -6
  52. package/packages/core/dist/index.d.ts +27 -6
  53. package/packages/core/dist/index.mjs +113 -60
  54. package/packages/core/dist/index.mjs.map +1 -1
  55. package/packages/core/dist/{log-config-BzGmDYum.d.cts → inspect-event-Des4JDHo.d.cts} +1 -31
  56. package/packages/core/dist/{log-config-BzGmDYum.d.ts → inspect-event-Des4JDHo.d.ts} +1 -31
  57. package/packages/core/dist/log-config-BnH8Ykcb.d.cts +33 -0
  58. package/packages/core/dist/log-config-C1GcJPIM.d.ts +33 -0
  59. package/packages/core/dist/logs.d.cts +3 -2
  60. package/packages/core/dist/logs.d.ts +3 -2
  61. package/packages/core/dist/logs.mjs +3 -3
  62. package/packages/core/dist/persisted-inspect-event-0kaRADsp.d.cts +56 -0
  63. package/packages/core/dist/persisted-inspect-event-DiFto0K2.d.ts +56 -0
  64. package/packages/core/dist/persisted.cjs +38 -40
  65. package/packages/core/dist/persisted.cjs.map +1 -1
  66. package/packages/core/dist/persisted.d.cts +6 -55
  67. package/packages/core/dist/persisted.d.ts +6 -55
  68. package/packages/core/dist/persisted.mjs +4 -2
  69. package/packages/core/dist/readers.cjs +2590 -0
  70. package/packages/core/dist/readers.cjs.map +1 -0
  71. package/packages/core/dist/readers.d.cts +80 -0
  72. package/packages/core/dist/readers.d.ts +80 -0
  73. package/packages/core/dist/readers.mjs +9 -0
  74. package/packages/core/dist/readers.mjs.map +1 -0
  75. package/packages/core/dist/{types-CNbheSdk.d.cts → types-DB8jB6Jg.d.cts} +7 -1
  76. package/packages/core/dist/{types-Bkt7LS01.d.ts → types-tSix7tfv.d.ts} +7 -1
  77. package/packages/core/dist/writers.cjs +997 -0
  78. package/packages/core/dist/writers.cjs.map +1 -0
  79. package/packages/core/dist/writers.d.cts +62 -0
  80. package/packages/core/dist/writers.d.ts +62 -0
  81. package/packages/core/dist/writers.mjs +9 -0
  82. package/packages/core/dist/writers.mjs.map +1 -0
  83. package/packages/core/dist/chunk-5EMIZZXD.mjs.map +0 -1
  84. package/packages/core/dist/chunk-Q6EPNB3V.mjs.map +0 -1
  85. package/packages/core/dist/chunk-QX3ZMPUF.mjs.map +0 -1
  86. package/packages/core/dist/chunk-XDBND27A.mjs +0 -975
  87. package/packages/core/dist/chunk-XDBND27A.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 94a7220: Release v1.7.0 framework-native adoption with the experimental AI SDK telemetry adapter, adapter conformance coverage, and local-first adapter documentation.
8
+
9
+ ## 1.6.0
10
+
11
+ Released **2026-06-25**.
12
+
13
+ ### Added
14
+
15
+ - Added experimental `agent-inspect/writers` subpath with `TraceWriter`, `fileWriter`, `bufferedFileWriter`, `compositeWriter`, `memoryWriter`, and `nullWriter` as the first v1.6 runtime foundation slice.
16
+ - Added experimental `createInspectorRuntime()` as the low-level instance-scoped runtime foundation.
17
+ - Added experimental `createInspector()` public instance API for isolated local tracing with explicit writers.
18
+ - Added experimental `agent-inspect/readers` subpath with the `TraceReader` contract, deterministic format detection, `readTrace()`, and `openTrace()` for future local ingestion readers.
19
+ - Added the default AgentInspect JSONL reader behind `readTrace()` / `openTrace()` for v0.1, v0.2, and mixed local trace files.
20
+ - Added local OpenInference JSON and OTLP JSON readers behind `agent-inspect/readers`.
21
+ - Added `agent-inspect open` for local AgentInspect JSONL, OpenInference JSON, OTLP JSON, directory, and stdin ingestion through the canonical reader pipeline.
22
+ - Added deterministic runtime/universal-ingestion recipe coverage for memory writer, buffered writer, `createInspector()`, explicit formats, stdin, and safe shutdown.
23
+
24
+ ### Changed
25
+
26
+ - Shared inspection commands now route AgentInspect JSONL loading through the canonical reader pipeline where compatible.
27
+
28
+ ### Fixed
29
+
30
+ - Corrects the published CLI version path so `agent-inspect --version` reports the public package version.
31
+ - Makes `list`, `stats`, and `search` use the canonical dual-format read path for v0.1 and v0.2 trace files.
32
+ - Applies `report --redaction-profile share|strict` to the complete report, not only the execution tree section.
33
+ - Preserves mixed v0.1/v0.2 source ordering during normalization.
34
+ - Preserves error stack fidelity when converting persisted v0.2 events; `error.name` is no longer mapped to v0.1 `stack`.
35
+ - Preserves supported token usage fields across converters and inspection summaries: `input`, `output`, `total`, and `cached`.
36
+
37
+ ### Notes
38
+
39
+ - Manual trace writing remains `schemaVersion: "0.1"`.
40
+ - v0.2 remains an experimental persisted-event foundation and dual-read input format, not the default writer.
41
+ - No provider pricing, token counting, cost engine, vendor upload, hosted ingestion, replay, or default telemetry behavior is included.
42
+ - This release includes corrective work accumulated after v1.5.0 plus the v1.6.0 runtime/reader foundation.
43
+
3
44
  ## 1.5.0
4
45
 
5
46
  Released **2026-06-24**.
package/README.md CHANGED
@@ -22,7 +22,7 @@ agent-inspect gives those runs **structure**: an **execution tree** you can read
22
22
 
23
23
  ## Install
24
24
 
25
- Current npm release: **1.5.0** (`agent-inspect`, `@agent-inspect/langchain`, `@agent-inspect/tui` — all aligned).
25
+ Current npm release: **1.6.0** (`agent-inspect`, `@agent-inspect/langchain`, `@agent-inspect/tui` — all aligned).
26
26
 
27
27
  ```bash
28
28
  npm install agent-inspect
@@ -111,18 +111,19 @@ await maybeInspectRun("eval-case-42", async () => runAgent());
111
111
  AGENT_INSPECT=1 node eval-runner.mjs
112
112
  ```
113
113
 
114
- ## What you can do today (v1.5.0)
114
+ ## What you can do today (v1.6.0)
115
115
 
116
116
  - **Trace manually** with `inspectRun`, `step`, `step.llm`, `step.tool`, and `observe` — local JSONL under `.agent-inspect/` by default.
117
117
  - **Toggle tracing** with `maybeInspectRun` and `AGENT_INSPECT=1` in eval harnesses or CI.
118
118
  - **Correlate runs** with optional `correlationId`, `requestId`, `decisionId`, and `groupId` on `run_started` metadata.
119
119
  - **Redact before disk** with default key-based redaction, or choose `redactionProfile`: `local`, `share`, or `strict`.
120
- - **Inspect from the CLI** — `list`, `view`, `clean`, `logs`, `tail`, `export`, `diff`, `timeline`, `stats`, `search`, `what`, `report`.
120
+ - **Inspect from the CLI** — `list`, `view`, `clean`, `logs`, `tail`, `export`, `open`, `diff`, `timeline`, `stats`, `search`, `what`, `report`.
121
121
  - **Export share-safe copies** — `export --redaction-profile share` (or `strict`) writes local Markdown/HTML/OpenInference/OTLP JSON only.
122
122
  - **Parse structured logs** you already emit (JSON first-class; log4js best-effort).
123
123
  - **Optional LangChain adapter** — metadata-only by default; optional `persist: true` and `stream: true` streaming metadata (no full token capture by default).
124
124
  - **Optional TUI** — `view --tui` when `@agent-inspect/tui` is installed.
125
125
  - **Persisted-event foundation (v1.2.0+)** — in-memory `PersistedInspectEvent` converters; manual writing stays `schemaVersion: "0.1"`.
126
+ - **Experimental v1.6.0 APIs** — `agent-inspect/writers`, `agent-inspect/readers`, `createInspector()`, and `agent-inspect open` for local AgentInspect/OpenInference/OTLP ingestion.
126
127
 
127
128
  Nothing uploads traces by default. Review exports before sharing — see [safe trace sharing](docs/SAFE-TRACE-SHARING.md).
128
129
 
@@ -172,6 +173,7 @@ More detail: [docs/LOGS.md](docs/LOGS.md) · [docs/LOG-TO-TREE-QUICKSTART.md](do
172
173
  | `logs` | Turn existing structured logs into a local tree/timeline |
173
174
  | `tail` | Watch structured logs while the app runs |
174
175
  | `export` | Write Markdown / HTML / OpenInference-compatible JSON / OTLP JSON **locally** |
176
+ | `open` | Read AgentInspect JSONL, OpenInference JSON, or OTLP JSON locally |
175
177
  | `diff` | Compare two local runs (read-only) |
176
178
  | `timeline` | Chronological view of one run |
177
179
  | `stats` | Local aggregates over a trace directory |
@@ -196,7 +198,7 @@ Full flags and behavior: [docs/CLI.md](docs/CLI.md).
196
198
 
197
199
  ## Stable foundation (AgentInspect 1.x)
198
200
 
199
- **agent-inspect 1.x** (current: **1.5.0**) is the **local-first trace workbench** for TypeScript AI agents:
201
+ **agent-inspect 1.x** (current: **1.6.0**) is the **local-first trace workbench** for TypeScript AI agents:
200
202
 
201
203
  - Instrument runs with `inspectRun` and `step`
202
204
  - Write **local JSONL traces** (`schemaVersion: "0.1"` — compatibility retained)
@@ -206,8 +208,14 @@ Full flags and behavior: [docs/CLI.md](docs/CLI.md).
206
208
 
207
209
  Pass `enabled: false` to `inspectRun` for a no-trace passthrough. Use `maybeInspectRun` with `AGENT_INSPECT=1` to toggle tracing in eval or CI — see [docs/API.md](docs/API.md).
208
210
 
211
+ **Shipped in 1.6.0:** experimental writer subpath (`agent-inspect/writers`), isolated `createInspector()` API via `agent-inspect/advanced`, local trace readers via `agent-inspect/readers`, OpenInference/OTLP JSON readers, universal `agent-inspect open`, and deterministic [runtime-and-ingestion recipe](examples/recipes/runtime-and-ingestion/). These remain local-only and do not add upload behavior. Linked release aligns all three npm packages at **1.6.0**.
212
+
213
+ **In progress for 1.7.0 on main:** experimental `@agent-inspect/ai-sdk` telemetry integration for AI SDK v6 with a local no-network [ai-sdk-local-telemetry recipe](examples/recipes/ai-sdk-local-telemetry/). Examples keep `recordInputs: false`, `recordOutputs: false`, metadata-only capture, and no upload behavior.
214
+
209
215
  **Shipped in 1.5.0:** non-breaking subpath exports; `what` and `report` CLI; dual-format read path (v0.1 + v0.2 JSONL); [what-report-inspect recipe](examples/recipes/what-report-inspect/). Linked release aligns all three npm packages at **1.5.0**.
210
216
 
217
+ **Roadmap beyond current release work:** future work continues from the local runtime and universal ingestion foundation before broadening framework adapters. See [ROADMAP.md](ROADMAP.md).
218
+
211
219
  **Shipped in 1.4.0:** CI artifact recipe ([docs/CI-ARTIFACTS.md](docs/CI-ARTIFACTS.md)); `timeline`, `stats`, and `search` CLI; core helpers `buildRunTimeline`, `buildTraceStats`, `searchTraces`. Linked release aligns all three npm packages at **1.4.0**.
212
220
 
213
221
  **Shipped in 1.3.0:** correlation metadata; redaction profiles (`local` / `share` / `strict`); `export --redaction-profile`; LangChain `stream: true` metadata (chunk counts, duration — no full token capture by default).
@@ -283,6 +291,8 @@ The TUI is available as a separate optional package; its programmatic API is exp
283
291
  | [examples/recipes/retry-fallback](examples/recipes/retry-fallback) | Fallback pattern |
284
292
  | [examples/recipes/parallel-tools](examples/recipes/parallel-tools) | Parallel tools |
285
293
  | [examples/recipes/github-actions-artifact](examples/recipes/github-actions-artifact) | CI trace artifacts |
294
+ | [examples/recipes/what-report-inspect](examples/recipes/what-report-inspect/) | `what` + `report` inspection |
295
+ | [examples/recipes/runtime-and-ingestion](examples/recipes/runtime-and-ingestion/) | v1.6 runtime writers + universal ingestion |
286
296
 
287
297
  **Recipes** are deterministic and require **no external services** by default. Index: [examples/README.md](examples/README.md), [examples/recipes/README.md](examples/recipes/README.md).
288
298
 
@@ -0,0 +1,35 @@
1
+ # Adapter conformance
2
+
3
+ AgentInspect optional framework adapters must stay local-first, dependency-isolated, and metadata-only by default.
4
+
5
+ The machine-readable matrix lives at [docs/implementation/adapter-conformance-matrix.json](./implementation/adapter-conformance-matrix.json). It tracks expected coverage for:
6
+
7
+ - run lifecycle
8
+ - generic steps
9
+ - tools
10
+ - LLM calls
11
+ - errors
12
+ - streaming metadata
13
+ - metadata bounds and privacy controls
14
+
15
+ ## Current matrix
16
+
17
+ | Adapter | Package | Status | Default install mode | Boundary |
18
+ | --- | --- | --- | --- | --- |
19
+ | AI SDK | `@agent-inspect/ai-sdk` | implemented experimental | AI SDK telemetry integration | optional package peer dependency |
20
+ | LangChain | `@agent-inspect/langchain` | implemented experimental | explicit callback | optional package peer dependency |
21
+ | OpenAI Agents JS | `@agent-inspect/openai-agents` | scaffold only | `setTraceProcessors()` replacement | optional package peer dependency |
22
+ | LangGraph | `@agent-inspect/langchain` | decision only | explicit LangChain callback | existing LangChain adapter first |
23
+
24
+ ## Required defaults
25
+
26
+ - No network behavior.
27
+ - No default upload behavior.
28
+ - No root/core dependency on framework SDKs.
29
+ - Metadata-only capture by default.
30
+ - Raw prompts, messages, outputs, tool payloads, headers, request bodies, and response bodies must not be persisted by default.
31
+ - Framework-specific fixtures must be no-network and dependency-isolated.
32
+
33
+ ## Before claiming support
34
+
35
+ An adapter can be documented as supported only after no-network fixtures cover run, step, tool, LLM, error, streaming, and metadata-bound expectations for that framework path.
package/docs/ADAPTERS.md CHANGED
@@ -2,6 +2,54 @@
2
2
 
3
3
  AgentInspect is **framework-agnostic** at its core. Optional adapter packages integrate specific frameworks without monkey-patching, vendor sinks, or network upload.
4
4
 
5
+ ## Vercel AI SDK (`@agent-inspect/ai-sdk`)
6
+
7
+ **Status:** experimental v1.7 train — optional workspace package; publication waits for v1.7 release readiness.
8
+
9
+ ### Install
10
+
11
+ ```bash
12
+ npm install agent-inspect @agent-inspect/ai-sdk ai
13
+ ```
14
+
15
+ ### Local telemetry integration
16
+
17
+ ```ts
18
+ import { generateText } from "ai";
19
+ import { agentInspect } from "@agent-inspect/ai-sdk";
20
+
21
+ const result = await generateText({
22
+ model,
23
+ prompt,
24
+ experimental_telemetry: {
25
+ isEnabled: true,
26
+ recordInputs: false,
27
+ recordOutputs: false,
28
+ integrations: [
29
+ agentInspect({
30
+ traceDir: "./.agent-inspect",
31
+ runName: "support-agent",
32
+ capture: "metadata-only",
33
+ }),
34
+ ],
35
+ },
36
+ });
37
+ ```
38
+
39
+ - **No monkey-patching** — pass the integration explicitly through AI SDK telemetry.
40
+ - **No upload behavior** — the adapter writes only to an explicit local writer or `traceDir`.
41
+ - **Metadata-only by default** — records model, finish reason, token usage, timing, and safe counts/summaries.
42
+ - **Required safe telemetry settings** — set `recordInputs: false` and `recordOutputs: false` on every AI SDK call using this adapter.
43
+ - **No raw payload capture by default** — prompts, messages, generated text, stream chunks, tool inputs/outputs, headers, request bodies, and response bodies are not persisted.
44
+
45
+ ### Local no-network recipe
46
+
47
+ [examples/recipes/ai-sdk-local-telemetry](../examples/recipes/ai-sdk-local-telemetry/) uses AI SDK test utilities only (`MockLanguageModelV3`, `simulateReadableStream`) and writes local v0.2 adapter events for `agent-inspect open`.
48
+
49
+ Full API: [API.md](./API.md) §11.
50
+
51
+ ---
52
+
5
53
  ## LangChain.js (`@agent-inspect/langchain`)
6
54
 
7
55
  **Status:** experimental — programmatic API may evolve independently of stable core tracing.
@@ -114,6 +162,14 @@ Full API: [API.md](./API.md) §9.
114
162
 
115
163
  [examples/08-langchain-adapter](../examples/08-langchain-adapter/README.md)
116
164
 
165
+ ### LangGraph boundary
166
+
167
+ LangGraph support is expected to ride through this same `@agent-inspect/langchain` callback boundary first. A dedicated LangGraph package is deferred until no-network fixtures prove that LangGraph exposes important lifecycle data unavailable through LangChain callbacks.
168
+
169
+ Future LangGraph examples must keep the same safety defaults: explicit callback installation, metadata-only capture, no raw prompt/output/tool payload capture by default, no hosted sink, and local persistence only when `persist: true` is set.
170
+
171
+ Decision note: [LANGGRAPH-ADAPTER-BOUNDARY.md](./proposals/LANGGRAPH-ADAPTER-BOUNDARY.md).
172
+
117
173
  ---
118
174
 
119
175
  ## TUI (`@agent-inspect/tui`)
@@ -131,11 +187,32 @@ Requires an interactive terminal. See [API.md](./API.md) §10.
131
187
 
132
188
  ---
133
189
 
190
+ ## OpenAI Agents JS (`@agent-inspect/openai-agents`)
191
+
192
+ **Status:** scaffolded for v1.7 train — optional workspace package; runtime mapping is not implemented yet.
193
+
194
+ The safe integration boundary is documented in [OPENAI-AGENTS-JS-TRACING.md](./proposals/OPENAI-AGENTS-JS-TRACING.md). Future examples must install the AgentInspect processor by replacing processors:
195
+
196
+ ```ts
197
+ import { setTraceProcessors } from "@openai/agents";
198
+ import { agentInspectProcessor } from "@agent-inspect/openai-agents";
199
+
200
+ setTraceProcessors([
201
+ agentInspectProcessor({
202
+ traceDir: "./.agent-inspect",
203
+ capture: "metadata-only",
204
+ }),
205
+ ]);
206
+ ```
207
+
208
+ Do not use `addTraceProcessor()` as the default AgentInspect path; that preserves the OpenAI default exporter in server runtimes. The scaffold does not auto-install a processor, does not upload, and does not add OpenAI Agents dependencies to root/core.
209
+
210
+ ---
211
+
134
212
  ## Future adapters (not shipped)
135
213
 
136
214
  Direction only — see [ROADMAP.md](../ROADMAP.md):
137
215
 
138
- - **Vercel AI SDK** — optional callback-style adapter (metadata-first, no vendor sink)
139
216
  - **NestJS / logging bridges** — deeper recipes or helper patterns beyond [LOGGING-PLAYBOOK.md](./LOGGING-PLAYBOOK.md)
140
217
 
141
218
  No automatic universal instrumentation. Integrations remain explicit and opt-in.
@@ -145,5 +222,6 @@ No automatic universal instrumentation. Integrations remain explicit and opt-in.
145
222
  ## Related docs
146
223
 
147
224
  - [API.md](./API.md) — adapter options and stability policy
225
+ - [ADAPTER-CONFORMANCE.md](./ADAPTER-CONFORMANCE.md) — no-network fixture matrix and shared expectations
148
226
  - [SAFE-TRACE-SHARING.md](./SAFE-TRACE-SHARING.md) — review exports before sharing
149
227
  - [LIMITATIONS.md](./LIMITATIONS.md) — LangChain streaming and metadata boundaries
package/docs/API.md CHANGED
@@ -9,12 +9,14 @@ AgentInspect is a **local-first execution-tree debugger**. It is not a SaaS, not
9
9
  - **Stable**: intended to be compatible across v1.x. Breaking changes require v2.0.
10
10
  - **Experimental**: available for adoption, but subject to refinement (including naming/shape changes) before a future stability declaration. Experimental APIs may change in v1.x.
11
11
 
12
- **v1.5.0 subpath exports:** Additive subpaths (`/logs`, `/exporters`, `/persisted`, `/diff`, `/advanced`) narrow the import surface for experimental and advanced APIs. Root `"."` imports remain valid through v1.x. Design: [API-BOUNDARY-V1.5.md](./implementation/API-BOUNDARY-V1.5.md).
12
+ **1.x subpath exports:** Additive subpaths (`/logs`, `/exporters`, `/persisted`, `/diff`, `/advanced`, `/writers`, `/readers`) narrow the import surface for experimental and advanced APIs. Root `"."` imports remain valid through v1.x. Design: [API-BOUNDARY-V1.5.md](./implementation/API-BOUNDARY-V1.5.md).
13
13
 
14
14
  ```ts
15
15
  import { inspectRun, step } from "agent-inspect";
16
16
  import { parseLogsToTrees } from "agent-inspect/logs";
17
17
  import { exportMarkdown } from "agent-inspect/exporters";
18
+ import { memoryWriter } from "agent-inspect/writers";
19
+ import { openTrace } from "agent-inspect/readers";
18
20
  ```
19
21
 
20
22
  Notes:
@@ -148,7 +150,66 @@ Rationale: v1.x includes one official adapter and **zero production sinks**, so
148
150
 
149
151
  - `runTraceViewer`, `loadTraceForTui`, `buildTuiTraceModel`, etc.
150
152
 
151
- ## 11. Experimental persisted-event foundation (v1.2.0)
153
+ ## 11. Experimental `@agent-inspect/ai-sdk` APIs
154
+
155
+ `@agent-inspect/ai-sdk` is an optional v1.7 adapter package for Vercel AI SDK v6 telemetry integrations. It is experimental during the v1.7 train and remains private until release readiness.
156
+
157
+ Import from `@agent-inspect/ai-sdk`:
158
+
159
+ ```ts
160
+ import { agentInspect } from "@agent-inspect/ai-sdk";
161
+ ```
162
+
163
+ - **`agentInspect(options?)`**: returns an AI SDK `TelemetryIntegration` bound with `bindTelemetryIntegration()`.
164
+ - **`writer`**: optional explicit local `TraceWriter` for tests, recipes, and controlled runtime integration.
165
+ - **`traceDir`**: optional local directory that creates a file writer inside the adapter package.
166
+ - **`runName`**: optional local run name.
167
+ - **`capture`**: `"metadata-only"` (default) or `"preview"` (reserved for explicit bounded capture).
168
+ - **`redactionProfile`** and **`maxPreviewChars`**: reserved for bounded/redacted future preview behavior.
169
+ - **`getDiagnostics()`**: exposes isolated adapter write failures without throwing into AI SDK callbacks.
170
+
171
+ Every AI SDK call using the adapter must keep telemetry local and metadata-only:
172
+
173
+ ```ts
174
+ experimental_telemetry: {
175
+ isEnabled: true,
176
+ recordInputs: false,
177
+ recordOutputs: false,
178
+ integrations: [agentInspect({ traceDir: "./.agent-inspect" })],
179
+ }
180
+ ```
181
+
182
+ The adapter records local v0.2 persisted events for run, LLM step, and tool lifecycle metadata. By default it does not persist raw prompts, messages, generated text, stream chunks, tool inputs, tool outputs, headers, request bodies, response bodies, or user `experimental_context`.
183
+
184
+ No network writer, OpenTelemetry exporter, provider wrapper, or global monkey-patch is part of this package.
185
+
186
+ Recipe: [examples/recipes/ai-sdk-local-telemetry](../examples/recipes/ai-sdk-local-telemetry/).
187
+
188
+ ## 12. Experimental `@agent-inspect/openai-agents` APIs
189
+
190
+ `@agent-inspect/openai-agents` is an optional v1.7 scaffold for future OpenAI Agents JS tracing processor integration. Runtime span mapping is not implemented yet.
191
+
192
+ Import from `@agent-inspect/openai-agents`:
193
+
194
+ ```ts
195
+ import { agentInspectProcessor } from "@agent-inspect/openai-agents";
196
+ ```
197
+
198
+ - **`agentInspectProcessor(options?)`**: returns a local-only scaffold object with diagnostics.
199
+ - **`installMode`**: always `"setTraceProcessors"` to document the safe replacement install path.
200
+ - **`localOnly`**: always `true`; the scaffold performs no network I/O and does not install itself globally.
201
+ - **`writer`**, **`traceDir`**, **`workflowName`**, **`capture`**, **`redactionProfile`**, and **`maxPreviewChars`** are reserved for the later runtime mapping chunk.
202
+ - **`getDiagnostics()`**: exposes scaffold diagnostics and reports `runtimeMappingImplemented: false`.
203
+
204
+ Safe future usage must replace processors explicitly:
205
+
206
+ ```ts
207
+ setTraceProcessors([agentInspectProcessor({ traceDir: "./.agent-inspect" })]);
208
+ ```
209
+
210
+ Do not use `addTraceProcessor()` as the default AgentInspect path; that leaves existing/default processors in place and can preserve backend export behavior in server runtimes.
211
+
212
+ ## 13. Experimental persisted-event foundation (v1.2.0)
152
213
 
153
214
  These helpers expose the **source-agnostic `PersistedInspectEvent` model** (`schemaVersion: "0.2"`). They are **local-only**, **in-memory**, and **do not change** storage write/read or CLI behavior in v1.2.0.
154
215
 
@@ -172,11 +233,11 @@ Related types: `PersistedInspectEvent`, `PersistedEventSourceType`, `PersistedEv
172
233
 
173
234
  - Manual trace **writing** remains `schemaVersion: "0.1"`.
174
235
  - v0.2 is **not written by default**; use converters and `fixtures/traces-v0.2/` samples for validation.
175
- - Storage dual-read and CLI integration are future work.
236
+ - Inspection read paths normalize v0.1 and v0.2 JSONL for local CLI/API use. v0.2 remains experimental as a persisted-event foundation and is not the default writer.
176
237
 
177
- ## 12. Local observability helpers (v1.4.0)
238
+ ## 14. Local observability helpers (v1.4.0+)
178
239
 
179
- Read-only helpers for timeline, stats, and search over manual `TraceEvent` JSONL. Local files only.
240
+ Read-only helpers for timeline, stats, and search over local JSONL traces. v0.1 manual traces remain the default writer; v0.2 persisted-event files are accepted where the shared dual-format read path is used. Local files only.
180
241
 
181
242
  - **`buildRunTimeline`**, **`renderTimeline`** — chronological run view; types `RunTimeline`, `TimelineEntry`
182
243
  - **`buildTraceStats`**, **`renderTraceStats`** — directory aggregates; type `TraceStats`
@@ -184,23 +245,137 @@ Read-only helpers for timeline, stats, and search over manual `TraceEvent` JSONL
184
245
 
185
246
  CLI wrappers: `agent-inspect timeline`, `stats`, `search` — see [CLI.md](./CLI.md).
186
247
 
187
- ## 13. Deprecated APIs
248
+ ## 15. Report and what helpers (v1.5.0+)
249
+
250
+ Read-only helpers for concise inspection summaries and local reports:
251
+
252
+ - **`buildRunWhatSummary`**, **`renderRunWhat`** — summarize status, duration, step counts, correlation metadata, slowest step, errors, and supplied token usage.
253
+ - **`buildRunReport`** — render Markdown or HTML reports from local trace events.
254
+
255
+ Report redaction profiles are key-based safeguards applied to the complete rendered report input, not only to the tree section. Review generated reports before sharing; this is not compliance-grade DLP.
256
+
257
+ ## 16. Experimental trace writers (v1.6)
258
+
259
+ Trace writers are the first slice of the v1.6 runtime foundation. They are experimental during v1.x and intended for tests, adapters, and future `createInspector` work.
260
+
261
+ Import from `agent-inspect/writers`:
262
+
263
+ ```ts
264
+ import {
265
+ bufferedFileWriter,
266
+ compositeWriter,
267
+ fileWriter,
268
+ memoryWriter,
269
+ nullWriter,
270
+ } from "agent-inspect/writers";
271
+ import type {
272
+ BufferedFileWriterOptions,
273
+ CompositeTraceWriterOptions,
274
+ FileTraceWriterOptions,
275
+ TraceWriter,
276
+ TraceWriterStats,
277
+ } from "agent-inspect/writers";
278
+ ```
279
+
280
+ - **`TraceWriter`**: async `write(event)`, optional `flush()`, optional `close()`, optional `getStats()`.
281
+ - **`fileWriter({ dir?, filePath? })`**: appends v0.2 `PersistedInspectEvent` JSONL rows to local disk. By default it derives one file per `event.runId`; `filePath` writes all events to an explicit local file. Filesystem and serialization failures are reflected in writer stats instead of being thrown into application code.
282
+ - **`bufferedFileWriter({ dir?, filePath?, maxQueueSize?, flushIntervalMs?, maxBatchSize?, overflow? })`**: buffers local JSONL writes with bounded queue behavior. Overflow supports `drop-oldest` and `drop-newest`; neither mode throws into application code.
283
+ - **`compositeWriter([...writers])`**: fans out events to multiple explicit local/custom writers. A failing child writer does not prevent other children from receiving events; failures are reflected in composite stats.
284
+ - **`memoryWriter()`**: stores cloned `PersistedInspectEvent` rows in memory for tests, adapter fixtures, and eval harnesses.
285
+ - **`nullWriter()`**: accepts events without retaining them for disabled mode, overhead comparisons, and no-output tests.
286
+
287
+ No network writer or vendor sink exists in this package.
288
+
289
+ ## 17. Experimental inspector API/runtime (v1.6)
290
+
291
+ `createInspector()` is the experimental public instance API for local-first tracing with explicit writers. It owns an instance-specific runtime context, records v0.2 persisted inspect events, preserves application return values/errors, and exposes diagnostics plus deterministic `flush()`/`close()` lifecycle hooks.
292
+
293
+ Import from `agent-inspect/advanced`:
294
+
295
+ ```ts
296
+ import { createInspector } from "agent-inspect/advanced";
297
+ import { memoryWriter } from "agent-inspect/writers";
298
+
299
+ const writer = memoryWriter();
300
+ const inspector = createInspector({
301
+ writer,
302
+ capture: { onSuccess: "metadata-only", onError: "metadata-only" },
303
+ });
304
+
305
+ await inspector.run("support-agent", async () => {
306
+ await inspector.step("plan", async () => "ok");
307
+ await inspector.tool("retrieve-policy", async () => "policy");
308
+ return inspector.llm("fixture-model", async () => "done");
309
+ });
310
+
311
+ await inspector.flush();
312
+ ```
313
+
314
+ Public methods:
315
+
316
+ - **`run(name, fn, options?)`**: starts an isolated run context and writes run lifecycle events.
317
+ - **`step(name, fn, options?)`**: writes nested step lifecycle events when called inside the same inspector's run context; outside a context it passes through.
318
+ - **`tool(name, fn, options?)`** / **`llm(name, fn, options?)`**: convenience wrappers that set `type` and metadata.
319
+ - **`observe(name, fn, options?)`**: returns an async wrapper that records the function call as an inspector step.
320
+ - **`getDiagnostics()`**: returns instrumentation error counts and writer stats without requiring direct runtime access.
321
+ - **`flush()`** / **`close()`**: delegate to the configured writer through the runtime.
322
+
323
+ `capture` is explicit and metadata-only. `onSuccess: "metadata-only"` records safe type/length/key-count summaries in `outputSummary`; `onError: "metadata-only"` records thrown-value type/name summaries. It does not store raw return values, prompts, outputs, or thrown objects. Use `"none"` to disable a capture side.
324
+
325
+ `traceDir` and `silent` on `createInspector()` are context metadata for compatibility with existing helpers. They do not configure persistence or terminal output. Prefer writer-owned output configuration such as `fileWriter({ dir })` or `fileWriter({ filePath })`.
326
+
327
+ `createInspectorRuntime()` is also available from `agent-inspect/advanced` as the low-level isolation primitive. Most users should prefer `createInspector()` and `inspector.getDiagnostics()`. Root exports for the runtime remain available for 1.x compatibility, but new advanced usage should import from `agent-inspect/advanced`.
328
+
329
+ These APIs are experimental during v1.x. They do not add a default network writer or vendor sink.
330
+
331
+ ## 18. Experimental trace readers (v1.6)
332
+
333
+ `agent-inspect/readers` exposes the experimental local trace reader contract and detection pipeline. It includes AgentInspect JSONL for v0.1, v0.2, and mixed local trace files, plus local OpenInference JSON and OTLP JSON compatibility readers.
334
+
335
+ Import from `agent-inspect/readers`:
336
+
337
+ ```ts
338
+ import {
339
+ DEFAULT_TRACE_READERS,
340
+ agentInspectJsonlReader,
341
+ detectTraceFormat,
342
+ openInferenceJsonReader,
343
+ openTrace,
344
+ otlpJsonReader,
345
+ readTrace,
346
+ } from "agent-inspect/readers";
347
+ import type { TraceReader } from "agent-inspect/readers";
348
+ ```
349
+
350
+ - **`TraceInput`**: file, directory, string, buffer, or stdin input descriptor.
351
+ - **`TraceReader`**: experimental reader interface with `format`, `detect(input)`, and `read(input)`.
352
+ - **`detectTraceFormat(input, { readers?, format? })`**: deterministic, conservative format detection. Explicit `format` acts as an override only when a matching reader is registered.
353
+ - **`readTrace(input, { readers?, format? })`**: detects a reader and returns `TraceReadResult`; unsupported or ambiguous input throws `TraceReadError`.
354
+ - **`openTrace(input, options?)`**: alias for `readTrace()` and the API path used by the universal `agent-inspect open` command.
355
+ - **`agentInspectJsonlReader`**: built-in local AgentInspect JSONL reader for v0.1, v0.2, and mixed files/directories.
356
+ - **`openInferenceJsonReader`**: local OpenInference JSON compatibility reader. Prompt/output-like attributes are summarized and bounded rather than stored as raw content.
357
+ - **`otlpJsonReader`**: local OTLP/HTTP JSON trace payload reader. Resource, scope, span, status, event, and parent metadata are preserved where possible with warnings for unsupported fields.
358
+ - **`DEFAULT_TRACE_READERS`**: ordered built-in reader registry used when no custom `readers` array is supplied.
359
+
360
+ The reader contract does not silently accept arbitrary JSON and does not add OTel SDK, database, hosted ingestion, or network upload dependencies.
361
+
362
+ ## 19. Deprecated APIs
188
363
 
189
364
  No deprecated APIs are declared as of 1.4.0.
190
365
 
191
- ## 14. Removal / deprecation policy
366
+ ## 20. Removal / deprecation policy
192
367
 
193
368
  - Stable APIs are not removed in v1.x.
194
369
  - If removal is necessary, the API should be **deprecated** first, documented, and kept for a reasonable window (target: at least one minor line) unless security requires faster action.
195
370
 
196
- ## 15. Backward compatibility policy
371
+ ## 21. Backward compatibility policy
197
372
 
198
373
  - Manual trace JSONL (`schemaVersion: "0.1"`) remains readable.
199
374
  - Additive schema changes are allowed in minor versions.
200
375
  - Breaking changes require a major version.
201
376
  - Unknown fields should be ignored where safe.
202
377
 
203
- ## 16. Examples
378
+ ## 22. Examples
204
379
 
205
380
  ### Minimal manual trace
206
381
 
@@ -214,4 +389,3 @@ await inspectRun("demo-agent", async () => {
214
389
  return { plan, hits, answer };
215
390
  });
216
391
  ```
217
-
@@ -39,6 +39,10 @@ See [SECURITY.md](../SECURITY.md) and [LIMITATIONS.md](./LIMITATIONS.md).
39
39
 
40
40
  See [ADAPTERS.md](./ADAPTERS.md).
41
41
 
42
+ ### Architecture proposals
43
+
44
+ Maintainer-owned RFCs and planning proposals are indexed in [proposals/README.md](./proposals/README.md). The active post-v1.5 roadmap is [implementation/ROADMAP-V1.6-TO-V3.md](./implementation/ROADMAP-V1.6-TO-V3.md).
45
+
42
46
  ### Where to read next
43
47
 
44
48
  - New users: [GETTING-STARTED.md](./GETTING-STARTED.md)
package/docs/CLI.md CHANGED
@@ -25,6 +25,7 @@ Core commands:
25
25
  - `logs` — parse structured logs into local execution trees
26
26
  - `tail` — live-tail logs into updating local trees
27
27
  - `export` — export manual traces to Markdown/HTML/OpenInference/OTLP JSON (local only)
28
+ - `open` — read supported local trace files, directories, or stdin through the canonical reader pipeline
28
29
  - `diff` — compare two manual traces (local, read-only)
29
30
  - `timeline` — chronological view of one run (local JSONL)
30
31
  - `stats` — local aggregate stats over a trace directory
@@ -192,7 +193,36 @@ npx agent-inspect export <run-id> --format markdown --redaction-profile share
192
193
  npx agent-inspect export <run-id> --format html --redaction-profile strict
193
194
  ```
194
195
 
195
- ### 6.7 `diff`
196
+ ### 6.7 `open`
197
+
198
+ Open any local trace format supported by the canonical reader pipeline. This command is read-only: it does not mutate input files, upload traces, or run agents.
199
+
200
+ ```bash
201
+ agent-inspect open [input] [options]
202
+ ```
203
+
204
+ `input` may be a file, directory, `-` for stdin, or omitted to read stdin.
205
+
206
+ Options:
207
+
208
+ - `--format <agent-inspect-jsonl|openinference-json|otlp-json>`: explicit reader format override
209
+ - `--run <run-id>`: select a run when input contains multiple runs
210
+ - `--json`: print structured JSON output
211
+ - `--diagnostics`: print reader warnings and unsupported fields in human output
212
+
213
+ Examples:
214
+
215
+ ```bash
216
+ npx agent-inspect open fixtures/traces/minimal-success.jsonl --format agent-inspect-jsonl
217
+ npx agent-inspect open fixtures/traces-v0.2/manual-basic.jsonl --format agent-inspect-jsonl
218
+ npx agent-inspect open packages/core/test/fixtures/openinference-basic.json --format openinference-json
219
+ npx agent-inspect open packages/core/test/fixtures/otlp-basic.json --format otlp-json
220
+ cat packages/core/test/fixtures/openinference-basic.json | npx agent-inspect open - --format openinference-json --json
221
+ ```
222
+
223
+ When a directory or payload contains multiple runs, `open` lists the run ids and exits until you pass `--run <run-id>`.
224
+
225
+ ### 6.8 `diff`
196
226
 
197
227
  Compare two manual trace runs. Diff is **local** and **read-only** (does not rerun agents).
198
228
 
@@ -256,7 +286,7 @@ Differences:
256
286
 
257
287
  More examples, including timing-only and structure-only diffs, are in `docs/DIFF.md`.
258
288
 
259
- ### 6.8 `timeline`
289
+ ### 6.9 `timeline`
260
290
 
261
291
  Chronological step list for one manual trace. Read-only; does not mutate JSONL files.
262
292
 
@@ -272,7 +302,7 @@ Options:
272
302
 
273
303
  ![Timeline with slow-step focus](../assets/demos/timeline.gif)
274
304
 
275
- ### 6.9 `stats`
305
+ ### 6.10 `stats`
276
306
 
277
307
  Local aggregate statistics over trace files in a directory. Read-only.
278
308
 
@@ -292,7 +322,7 @@ Options:
292
322
 
293
323
  Use `--correlation-id` or `--group-id` to filter runs by `run_started` metadata (see [API.md](./API.md)).
294
324
 
295
- ### 6.10 `search`
325
+ ### 6.11 `search`
296
326
 
297
327
  Deterministic search over local traces (substring / exact filters). No semantic search.
298
328
 
@@ -322,9 +352,9 @@ npx agent-inspect search --duration ">100ms" --json
322
352
 
323
353
  ![Search traces by status error](../assets/demos/search.gif)
324
354
 
325
- ### 6.11 `what`
355
+ ### 6.12 `what`
326
356
 
327
- Concise human-readable summary of one manual trace run. Read-only; uses local v0.1 JSONL (v0.2 dual-read lands in v1.5.0 Chunks 7–8). Vocabulary: [TRACE-VOCABULARY-V1.5.md](./proposals/TRACE-VOCABULARY-V1.5.md).
357
+ Concise human-readable summary of one local trace run. Read-only; accepts v0.1 manual JSONL and v0.2 persisted-event JSONL through the shared dual-format normalization path. Vocabulary: [TRACE-VOCABULARY-V1.5.md](./proposals/TRACE-VOCABULARY-V1.5.md).
328
358
 
329
359
  ```bash
330
360
  agent-inspect what <run-id> [options]
@@ -351,9 +381,9 @@ Outcome: Completed successfully.
351
381
  Slowest: plan (100ms, logic)
352
382
  ```
353
383
 
354
- ### 6.12 `report`
384
+ ### 6.13 `report`
355
385
 
356
- Generate a local inspection report combining **what happened**, **timeline**, and **execution tree** sections. Read-only over v0.1 JSONL. Distinct from `export` (which targets shareable tree snapshots and standards formats).
386
+ Generate a local inspection report combining **what happened**, **timeline**, and **execution tree** sections. The command reads local v0.1 manual JSONL and v0.2 persisted-event JSONL through the shared dual-format normalization path without mutating them. Distinct from `export` (which targets shareable tree snapshots and standards formats).
357
387
 
358
388
  ```bash
359
389
  agent-inspect report <run-id> [options]
@@ -365,10 +395,10 @@ Options:
365
395
  - `--format <markdown|html>` — default `markdown`
366
396
  - `-o, --output <path>` — write to file
367
397
  - `--json` — JSON wrapper (includes `content` when writing to stdout)
368
- - `--include-attributes` — bounded attributes in tree section
369
- - `--no-errors` — omit error details from tree section
398
+ - `--include-attributes` — bounded attributes in the execution tree section
399
+ - `--no-errors` — omit error details from the execution tree section
370
400
  - `--no-correlation` — omit correlation ids from what section
371
- - `--redaction-profile <local|share|strict>` — tree section redaction (default `local`)
401
+ - `--redaction-profile <local|share|strict>` — key-based redaction profile applied to the complete report (default `local`); review output before sharing
372
402
 
373
403
  Example:
374
404
 
@@ -390,4 +420,3 @@ See:
390
420
 
391
421
  - `docs/KNOWN-ISSUES.md`
392
422
  - `docs/LIMITATIONS.md`
393
-