agent-inspect 2.2.0 → 2.4.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 (43) hide show
  1. package/CHANGELOG.md +31 -4
  2. package/README.md +47 -4
  3. package/docs/ADAPTER-CONFORMANCE.md +25 -5
  4. package/docs/ADAPTERS.md +102 -11
  5. package/docs/CLI.md +54 -1
  6. package/docs/SCHEMA.md +1 -0
  7. package/package.json +2 -2
  8. package/packages/cli/dist/index.cjs +757 -14
  9. package/packages/cli/dist/index.cjs.map +1 -1
  10. package/packages/cli/dist/index.mjs +757 -14
  11. package/packages/cli/dist/index.mjs.map +1 -1
  12. package/packages/core/dist/advanced.cjs +581 -3
  13. package/packages/core/dist/advanced.cjs.map +1 -1
  14. package/packages/core/dist/advanced.d.cts +172 -8
  15. package/packages/core/dist/advanced.d.ts +172 -8
  16. package/packages/core/dist/advanced.mjs +572 -4
  17. package/packages/core/dist/advanced.mjs.map +1 -1
  18. package/packages/core/dist/checks.d.cts +2 -2
  19. package/packages/core/dist/checks.d.ts +2 -2
  20. package/packages/core/dist/{context-yv2VSDQF.d.ts → context-BDZmi53V.d.ts} +3 -3
  21. package/packages/core/dist/{context-CSKnzpXR.d.cts → context-DjY-jvQk.d.cts} +3 -3
  22. package/packages/core/dist/diff.d.cts +3 -3
  23. package/packages/core/dist/diff.d.ts +3 -3
  24. package/packages/core/dist/exporters.d.cts +3 -3
  25. package/packages/core/dist/exporters.d.ts +3 -3
  26. package/packages/core/dist/index.d.cts +6 -6
  27. package/packages/core/dist/index.d.ts +6 -6
  28. package/packages/core/dist/{inspect-event-CevRYp58.d.cts → inspect-event-CYAV7Hxm.d.cts} +1 -1
  29. package/packages/core/dist/{inspect-event-CevRYp58.d.ts → inspect-event-CYAV7Hxm.d.ts} +1 -1
  30. package/packages/core/dist/{log-config-8aE5Kxtr.d.cts → log-config-BNQ9UTmP.d.cts} +1 -1
  31. package/packages/core/dist/{log-config-DVimQJho.d.ts → log-config-D3Yp1SZN.d.ts} +1 -1
  32. package/packages/core/dist/logs.d.cts +3 -3
  33. package/packages/core/dist/logs.d.ts +3 -3
  34. package/packages/core/dist/{persisted-inspect-event-D-WpXeZX.d.ts → persisted-inspect-event-BLvb0jSX.d.ts} +1 -1
  35. package/packages/core/dist/{persisted-inspect-event-DHcHPUKv.d.cts → persisted-inspect-event-D5SjBz9b.d.cts} +1 -1
  36. package/packages/core/dist/persisted.d.cts +5 -5
  37. package/packages/core/dist/persisted.d.ts +5 -5
  38. package/packages/core/dist/readers.d.cts +2 -2
  39. package/packages/core/dist/readers.d.ts +2 -2
  40. package/packages/core/dist/{types-DgMN3qow.d.cts → types-C-llnPH0.d.cts} +1 -1
  41. package/packages/core/dist/{types-D-Y1kOU-.d.ts → types-CQun9LW6.d.ts} +1 -1
  42. package/packages/core/dist/writers.d.cts +2 -2
  43. package/packages/core/dist/writers.d.ts +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 483168d: Release v2.4.0 with sessions workflow navigation and MCP client telemetry.
8
+
9
+ This train adds multi-run session indexing on `agent-inspect/advanced`, `sessions` / `session` CLI, session-aware `search` and `check`, and the new `@agent-inspect/mcp` package for local MCP client `tools/list` and `tools/call` tracing. No schema break, no MCP gateway/server, and no default network behavior.
10
+
11
+ ## 2.3.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 22cad5a: Release v2.3.0 with hardened framework adapter paths.
16
+
17
+ This train strengthens the official AI SDK, OpenAI Agents JS, and LangChain/LangGraph integrations with no-network fixtures, clearer local-only defaults, adapter conformance evidence, and adoption-ready recipes. Mastra and NestJS framework packages remain demand-gated; NestJS stays on the structured-log ingestion recipe path for this release.
18
+
3
19
  ## 2.2.0
4
20
 
5
21
  ### Minor Changes
@@ -10,11 +26,22 @@
10
26
 
11
27
  ## Unreleased
12
28
 
13
- ### Draft v2.2.0 Notes
29
+ ### Draft v2.4.0 Notes
30
+
31
+ - Added session/workflow causality model and `agent-inspect/advanced` session index helpers (`buildSessionIndex`, scope/cohort helpers, session fixtures).
32
+ - Added `agent-inspect sessions` and `agent-inspect session` CLI for multi-run handoff/retry navigation with timeline, critical-path, diagnostics, and JSON output.
33
+ - Added session-aware `search --session` and `check --session` / `--group` with aggregated per-run evidence.
34
+ - Added public optional `@agent-inspect/mcp` for local MCP **client** `tools/list` and `tools/call` telemetry with bounded summaries and `source.type: mcp-client` metadata.
35
+ - No schema version change, no MCP gateway/server, no timestamp-only causality inference, and no root/core dependency on MCP SDKs.
36
+
37
+ ### Draft v2.3.0 Notes
14
38
 
15
- - Prepared the v2.2 reporter and CI workflow release notes for local Vitest/Jest reporter artifacts, the shared `agent-inspect/reporters` manifest helpers, and `agent-inspect ci-summary`.
16
- - Reporter artifacts remain local-only and metadata-bounded. `ci-summary` reads reporter manifest JSON only, validates relative artifact paths, and does not read trace contents, upload artifacts, call GitHub APIs, or mutate repository state.
17
- - `@agent-inspect/vitest` and `@agent-inspect/jest` remain private/unpublished until maintainer first-publication setup is explicitly cleared before release prep.
39
+ - Hardened the official adapter paths for AI SDK, OpenAI Agents JS, and LangChain/LangGraph with no-network recipes, local-only defaults, clearer lifecycle coverage, and executable adapter conformance evidence.
40
+ - AI SDK coverage now includes route-style telemetry factory guidance, per-request integration isolation, tool/stream/error/parallel fixtures, token metadata, and the required `recordInputs: false` / `recordOutputs: false` host settings.
41
+ - OpenAI Agents JS documentation and fixtures distinguish local-only replacement via `setTraceProcessors()` from advanced additional processor usage.
42
+ - LangGraph support remains through `@agent-inspect/langchain`, with graph/node identity, subgraphs, checkpoint/session IDs, stream modes, handoffs, and parallel branch hints covered through callback metadata.
43
+ - Mastra and NestJS framework packages remain explicitly deferred. NestJS support stays on structured-log ingestion unless future demand proves a narrow local-only helper is worth maintaining.
44
+ - No root/core framework dependency, hosted upload, provider call, schema change, or public breaking change is added in this train.
18
45
 
19
46
  ## 2.1.0
20
47
 
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 line: **2.1.x** for the existing public packages. v2.1.0 adds deterministic local eval and reusable redaction utilities on top of the stable v2 trace contract: small root API, schema 1.0 persisted writer path, v0.1/v0.2/v1.0 read compatibility, and explicit non-destructive migration workflow.
25
+ Current npm release line: **2.3.x** for the existing public packages. **v2.4.0** (release prep) adds multi-run **session** navigation (`sessions` / `session` CLI), session-aware `search` and `check`, and optional **`@agent-inspect/mcp`** client telemetry all local-first on top of the stable v2 trace contract.
26
26
 
27
27
  ```bash
28
28
  npm install agent-inspect
@@ -334,12 +334,18 @@ AgentInspect is the **local-first trace workbench** for TypeScript AI agents:
334
334
 
335
335
  - Instrument runs with `inspectRun` and `step`
336
336
  - Write and read **local JSONL traces** (`schemaVersion: "0.1"` manual traces remain readable; schema 1.0 persisted rows are the v2 writer target)
337
- - Inspect with **`list`**, **`view`**, **`clean`**, **`logs`**, **`tail`**, **`export`**, **`diff`**, **`timeline`**, **`stats`**, **`search`**
337
+ - Inspect with **`list`**, **`view`**, **`clean`**, **`logs`**, **`tail`**, **`export`**, **`diff`**, **`timeline`**, **`stats`**, **`search`**, **`sessions`**, **`session`**
338
338
 
339
339
  **Stable root APIs:** `createInspector()`, `inspectRun()`, `maybeInspectRun()`, `step()`, `step.llm()`, `step.tool()`, `observe()`, `getCurrentCorrelationMetadata()`.
340
340
 
341
341
  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).
342
342
 
343
+ **v2.4 train status:** session/workflow causality helpers ship on `agent-inspect/advanced` (`buildSessionIndex`, scope/cohort helpers). CLI adds `sessions`, `session`, `search --session`, and `check --session` / `--group`. Optional `@agent-inspect/mcp` wraps MCP client `tools/list` and `tools/call` as local tool steps with bounded summaries — no gateway or server product.
344
+
345
+ **v2.3 shipped:** adapter hardening for AI SDK, OpenAI Agents JS, and LangChain/LangGraph with no-network recipes and executable conformance coverage. Mastra and NestJS framework packages remain demand-gated; NestJS is covered through structured-log ingestion.
346
+
347
+ **Shipped in 2.2.0:** public optional Vitest/Jest reporter packages, shared `agent-inspect/reporters` helpers, and `agent-inspect ci-summary` for deterministic local reporter artifact summaries. Linked release aligns `agent-inspect`, `@agent-inspect/ai-sdk`, `@agent-inspect/langchain`, `@agent-inspect/tui`, `@agent-inspect/openai-agents`, `@agent-inspect/redact`, `@agent-inspect/eval`, `@agent-inspect/vitest`, and `@agent-inspect/jest` at **2.2.0**.
348
+
343
349
  **Shipped in 2.1.0:** deterministic local eval and redaction utilities. Linked release aligns `agent-inspect`, `@agent-inspect/ai-sdk`, `@agent-inspect/langchain`, `@agent-inspect/tui`, `@agent-inspect/openai-agents`, `@agent-inspect/redact`, and `@agent-inspect/eval` at **2.1.0**.
344
350
 
345
351
  **Shipped in 2.0.0:** stable root API contract, schema 1.0 persisted writer path, v0.1/v0.2/v1.0 read compatibility, and explicit trace migration workflow. Linked release aligns `agent-inspect`, `@agent-inspect/ai-sdk`, `@agent-inspect/langchain`, `@agent-inspect/tui`, and `@agent-inspect/openai-agents` at **2.0.0**.
@@ -354,7 +360,7 @@ Pass `enabled: false` to `inspectRun` for a no-trace passthrough. Use `maybeInsp
354
360
 
355
361
  **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**.
356
362
 
357
- **Roadmap beyond current release work:** v2.2 prepares test reporters and CI workflows, followed by adapter hardening, sessions/MCP telemetry, guardrails, optional viewer/IDE surfaces, and conditional v3 extensibility. See [ROADMAP.md](ROADMAP.md).
363
+ **Roadmap beyond current release work:** v2.5 guardrails/circuit patterns, optional viewer/IDE surfaces, and conditional v3 extensibility. See [ROADMAP.md](ROADMAP.md).
358
364
 
359
365
  **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**.
360
366
 
@@ -370,6 +376,16 @@ Pass `enabled: false` to `inspectRun` for a no-trace passthrough. Use `maybeInsp
370
376
 
371
377
  ## Optional packages
372
378
 
379
+ ### Framework adapters (`@agent-inspect/ai-sdk`, `@agent-inspect/openai-agents`, `@agent-inspect/langchain`)
380
+
381
+ Official framework adapters are optional packages and stay explicit, local-first, and metadata-only by default:
382
+
383
+ - **AI SDK:** pass `agentInspect(...)` through AI SDK telemetry with `recordInputs: false` and `recordOutputs: false`.
384
+ - **OpenAI Agents JS:** use `setTraceProcessors([agentInspectProcessor(...)])` for the documented local-only replacement path.
385
+ - **LangChain/LangGraph:** pass `new AgentInspectCallback(...)` through callbacks; LangGraph support rides through the LangChain callback boundary.
386
+
387
+ No-network recipes: [ai-sdk-local-telemetry](examples/recipes/ai-sdk-local-telemetry/), [ai-sdk-next-route](examples/recipes/ai-sdk-next-route/), [openai-agents-local-tracing](examples/recipes/openai-agents-local-tracing/), and [langgraph-callback-local](examples/recipes/langgraph-callback-local/). Conformance and limits are documented in [docs/ADAPTERS.md](docs/ADAPTERS.md) and [docs/ADAPTER-CONFORMANCE.md](docs/ADAPTER-CONFORMANCE.md).
388
+
373
389
  ### LangChain callback adapter (`@agent-inspect/langchain`)
374
390
 
375
391
  Optional package: official **LangChain.js callbacks** (`BaseCallbackHandler`), **metadata-oriented by default**, **no monkey-patching**, **no vendor sink**. Optional **`stream: true`** records chunk counts and stream duration **without storing full token text by default**. The LangChain adapter ships with 1.x; its programmatic API remains experimental and may evolve independently of the stable core tracing API.
@@ -398,6 +414,30 @@ const events = callback.getEvents();
398
414
 
399
415
  See [examples/08-langchain-adapter](examples/08-langchain-adapter/README.md) and [docs/ADAPTERS.md](docs/ADAPTERS.md).
400
416
 
417
+ ### MCP client telemetry (`@agent-inspect/mcp`)
418
+
419
+ Optional package for **local MCP client** tracing only. Wrap `tools/list` and `tools/call` so they emit tool steps with `source.type: mcp-client`, bounded argument summaries, server identity, and optional `sessionId` metadata.
420
+
421
+ ```bash
422
+ pnpm add agent-inspect @agent-inspect/mcp
423
+ ```
424
+
425
+ ```ts
426
+ import { inspectRun } from "agent-inspect";
427
+ import { wrapMcpClient } from "@agent-inspect/mcp";
428
+
429
+ const traced = wrapMcpClient(mcpClient, {
430
+ serverName: "docs-server",
431
+ sessionId: "sess-123",
432
+ });
433
+
434
+ await inspectRun("agent-with-mcp", async () => {
435
+ await traced.callTool({ name: "search", arguments: { query: "sessions" } });
436
+ });
437
+ ```
438
+
439
+ No-network recipe: [mcp-client-tracing](examples/recipes/mcp-client-tracing/). This is **not** an MCP server, gateway, or hosted broker — see [docs/ADAPTERS.md](docs/ADAPTERS.md).
440
+
401
441
  ### TUI viewer (`@agent-inspect/tui`)
402
442
 
403
443
  Optional **Ink/React** package, installed separately. Use with an interactive terminal:
@@ -411,7 +451,7 @@ The TUI is available as a separate optional package; its programmatic API is exp
411
451
 
412
452
  ### Test reporter artifacts (`@agent-inspect/vitest`, `@agent-inspect/jest`)
413
453
 
414
- Optional Vitest/Jest reporter packages are implemented in the workspace for local failure artifacts, but remain private/unpublished until the maintainer clears first-publication setup for a v2.2 release. They write shared `schemaVersion: "0.1"` reporter manifests with safe relative artifact paths and bounded structural metadata. Use `agent-inspect ci-summary` to summarize those local manifests in CI without reading trace contents or calling GitHub APIs.
454
+ Optional Vitest/Jest reporter packages are public as of v2.2. They write shared `schemaVersion: "0.1"` reporter manifests with safe relative artifact paths and bounded structural metadata. Use `agent-inspect ci-summary` to summarize those local manifests in CI without reading trace contents or calling GitHub APIs.
415
455
 
416
456
  Reporter artifact behavior and API details are documented in [docs/API.md](docs/API.md) and [docs/CI-ARTIFACTS.md](docs/CI-ARTIFACTS.md).
417
457
 
@@ -444,6 +484,9 @@ Reporter artifact behavior and API details are documented in [docs/API.md](docs/
444
484
  | [examples/recipes/test-reporter-artifacts](examples/recipes/test-reporter-artifacts) | Vitest/Jest reporter artifact patterns |
445
485
  | [examples/recipes/what-report-inspect](examples/recipes/what-report-inspect/) | `what` + `report` inspection |
446
486
  | [examples/recipes/runtime-and-ingestion](examples/recipes/runtime-and-ingestion/) | v1.6 runtime writers + universal ingestion |
487
+ | [examples/recipes/mcp-client-tracing](examples/recipes/mcp-client-tracing) | v2.4 MCP client tool-call tracing |
488
+
489
+ **Multi-run sessions:** set `sessionId` (and optional handoff/retry metadata) on `run_started`, then browse with `npx agent-inspect sessions` and `npx agent-inspect session <id> --timeline`. See [SESSIONS-AND-WORKFLOW-CAUSALITY](docs/proposals/SESSIONS-AND-WORKFLOW-CAUSALITY.md).
447
490
 
448
491
  **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).
449
492
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  AgentInspect optional framework adapters must stay local-first, dependency-isolated, and metadata-only by default.
4
4
 
5
- The machine-readable matrix lives at [docs/implementation/adapter-conformance-matrix.json](./implementation/adapter-conformance-matrix.json). It tracks expected coverage for:
5
+ The machine-readable matrix lives at [docs/implementation/adapter-conformance-matrix.json](./implementation/adapter-conformance-matrix.json). The release-evidence fixture manifest lives at [docs/implementation/adapter-conformance-fixtures.json](./implementation/adapter-conformance-fixtures.json). These files track expected coverage for:
6
6
 
7
7
  - run lifecycle
8
8
  - generic steps
@@ -12,19 +12,39 @@ The machine-readable matrix lives at [docs/implementation/adapter-conformance-ma
12
12
  - streaming metadata
13
13
  - metadata bounds and privacy controls
14
14
 
15
- The v1.7 matrix is declarative coverage guidance. v1.8 makes conformance executable and requires canonical-reader round trips before adapter output is used by checks.
15
+ The v1.7 matrix began as declarative coverage guidance. v1.8 made the core conformance path executable and requires canonical-reader round trips before adapter output is used by checks. v2.3 uses that foundation to harden official adapters without adding shallow new adapter packages.
16
16
 
17
17
  Executable shared assertions live in `packages/core/test/adapter-executable-conformance.test.ts` and `packages/core/test/adapter-conformance-utils.ts`. Adapter-specific suites may add deeper fixture coverage, but the shared suite owns the cross-adapter defaults: local-only execution, no raw payload persistence, lifecycle identity, parentage, streaming summaries, token usage where exposed, and reader round trips.
18
18
 
19
+ Release evidence gate:
20
+
21
+ ```bash
22
+ pnpm exec vitest run packages/core/test/adapter-executable-conformance.test.ts packages/core/test/adapter-conformance-matrix.test.ts
23
+ ```
24
+
25
+ This is an internal official-adapter gate, not a third-party certification program.
26
+
19
27
  ## Current matrix
20
28
 
21
29
  | Adapter | Package | Status | Default install mode | Boundary |
22
30
  | --- | --- | --- | --- | --- |
23
- | AI SDK | `@agent-inspect/ai-sdk` | implemented experimental; v1.8 correctness hardening pending | AI SDK telemetry integration | optional package peer dependency |
24
- | LangChain | `@agent-inspect/langchain` | implemented experimental | explicit callback | optional package peer dependency |
25
- | OpenAI Agents JS | `@agent-inspect/openai-agents` | implemented experimental; public package, with v1.9 publication recovery tracked separately | `setTraceProcessors()` replacement | optional package peer dependency |
31
+ | AI SDK | `@agent-inspect/ai-sdk` | implemented experimental; v2.3 priority 1 | AI SDK telemetry integration | optional package peer dependency |
32
+ | OpenAI Agents JS | `@agent-inspect/openai-agents` | implemented experimental; v2.3 priority 2 | `setTraceProcessors()` replacement | optional package peer dependency |
33
+ | LangChain | `@agent-inspect/langchain` | implemented experimental; v2.3 priority 3 | explicit callback | optional package peer dependency |
26
34
  | LangGraph | `@agent-inspect/langchain` | fixture-backed through LangChain callback | explicit LangChain callback | existing LangChain adapter first |
27
35
 
36
+ ## v2.3 scorecard
37
+
38
+ | Adapter path | Current coverage | Hardening gap | Decision |
39
+ | ------------ | ---------------- | ------------- | -------- |
40
+ | AI SDK | Shared conformance marks run, step, tool, LLM, error, streaming, and metadata bounds covered. | More adoption-grade fixtures for `generateText`, `streamText`, tool calls, Next.js route usage, parallel calls, abort/error lifecycle, and token metadata. | Harden first. |
41
+ | OpenAI Agents JS | Shared conformance covers run, step, tool, LLM, error, metadata bounds, and local-only replacement metadata; adapter fixtures cover agents, generations, tools, handoffs, guardrails, response, MCP tools, custom, transcription, and speech shapes without provider calls. | Streaming remains planned in the matrix; `addTraceProcessor()` remains documented only as an advanced user-owned additional mode. | Hardened second. |
42
+ | LangChain/LangGraph | LangChain and LangGraph-through-LangChain fixtures cover shared signals plus graph/node identity, subgraphs, checkpoint/session IDs, stream modes, handoffs, and parallel branch hints through callback metadata. | Callback-surface limits remain documented; no separate package is justified yet. | Hardened third. |
43
+ | Mastra | No official package, no conformance fixture, no root dependency. | Demand and extension-point evidence are not yet sufficient for local-only useful traces. | Defer. |
44
+ | NestJS | Structured-log recipe exists; no official framework adapter or conformance fixture. | Current evidence supports log ingestion. Demand may justify a narrow harness/bootstrap helper, not a broad monkey-patching adapter. | Defer package; keep recipe/helper gate. |
45
+
46
+ `@agent-inspect/vitest` and `@agent-inspect/jest` are public reporter packages, not framework trace adapters. Their artifact-manifest behavior is covered by reporter tests and CI-summary tests rather than this adapter conformance matrix.
47
+
28
48
  ## Required defaults
29
49
 
30
50
  - No network behavior.
package/docs/ADAPTERS.md CHANGED
@@ -2,11 +2,25 @@
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
+ ## v2.3 hardening scorecard
6
+
7
+ v2.3 hardens existing official adapters before adding new ones. Priority is based on the current package set, open issue/adoption signals, conformance coverage, and how directly a framework can produce useful local traces without root/core dependencies.
8
+
9
+ | Priority | Adapter path | Decision | v2.3 focus |
10
+ | -------- | ------------ | -------- | ---------- |
11
+ | 1 | AI SDK (`@agent-inspect/ai-sdk`) | Harden first | Improve low-friction `generateText`, `streamText`, tool-call, parallel-call, abort/error, token metadata, and Next.js route coverage while keeping `recordInputs: false` and `recordOutputs: false` as required host controls. |
12
+ | 2 | OpenAI Agents JS (`@agent-inspect/openai-agents`) | Harden second | Make local-only replacement vs additional processor modes unmistakable, with fixtures for agents, generations, tools, handoffs, guardrails, and no default upload confusion. |
13
+ | 3 | LangChain/LangGraph (`@agent-inspect/langchain`) | Harden third | Improve LangGraph-through-LangChain mapping for node identity, subgraphs, checkpoints, stream modes, branches, handoffs, and session/thread IDs without adding a separate package unless the callback surface proves insufficient. |
14
+ | Defer | Mastra | No package in v2.3 | Current evidence does not justify an official package. Revisit only when there is explicit user demand and a verified extension point that avoids hidden monkey-patching, hosted sinks, or root dependencies. |
15
+ | Defer | NestJS | No framework adapter in v2.3 | Keep the supported path at structured-log ingestion via the existing NestJS JSON logging recipe. Revisit a narrow harness/bootstrap helper only with concrete demand; do not add a package only to wrap app bootstrap. |
16
+
17
+ Reporters (`@agent-inspect/vitest` and `@agent-inspect/jest`) are public packages as of v2.2, but they are CI/test artifact reporters rather than framework trace adapters. They stay outside the v2.3 adapter-hardening priority order.
18
+
5
19
  ## Vercel AI SDK (`@agent-inspect/ai-sdk`)
6
20
 
7
- **Status:** experimental adapter — optional package published in the aligned v1.8.0 package set.
21
+ **Status:** experimental adapter — optional package published in the aligned v2.2.0 package set and hardened in the v2.3 adapter train.
8
22
 
9
- The v1.8 train has hardened lifecycle identity and parallel integration isolation. The adapter remains metadata-only: `capture: "preview"` and preview-only redaction options emit diagnostics and fall back to metadata-only capture until bounded free-text previews are implemented.
23
+ The adapter has hardened lifecycle identity and parallel integration isolation. It remains metadata-only: `capture: "preview"` and preview-only redaction options emit diagnostics and fall back to metadata-only capture until bounded free-text previews are implemented.
10
24
 
11
25
  ### Install
12
26
 
@@ -49,9 +63,11 @@ const result = await generateText({
49
63
 
50
64
  [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`.
51
65
 
66
+ [examples/recipes/ai-sdk-next-route](../examples/recipes/ai-sdk-next-route/) shows a route-style telemetry factory that creates one AgentInspect integration per request while keeping the same no-network, metadata-only defaults.
67
+
52
68
  ### Common host shapes
53
69
 
54
- Use the same explicit telemetry block for route handlers, streaming, and tool calls. The adapter does not wrap providers or change host-call settings.
70
+ Use the same explicit telemetry block shape for route handlers, streaming, and tool calls. Create a fresh `agentInspect(...)` integration per concurrent request/generation. The adapter does not wrap providers or change host-call settings.
55
71
 
56
72
  ```ts
57
73
  const telemetry = {
@@ -83,7 +99,7 @@ Full API: [API.md](./API.md) §11.
83
99
 
84
100
  ## LangChain.js (`@agent-inspect/langchain`)
85
101
 
86
- **Status:** experimental — programmatic API may evolve independently of stable core tracing.
102
+ **Status:** experimental adapter optional package published in the aligned v2.2.0 package set; programmatic API may evolve independently of stable core tracing.
87
103
 
88
104
  ### Install
89
105
 
@@ -209,7 +225,7 @@ Full API: [API.md](./API.md) §9.
209
225
 
210
226
  ### LangGraph boundary
211
227
 
212
- LangGraph support is expected to ride through this same `@agent-inspect/langchain` callback boundary first. v1.8 adds executable no-network fixtures before claiming broader LangGraph support. A dedicated LangGraph package remains deferred until fixtures prove that LangGraph exposes important lifecycle data unavailable through LangChain callbacks.
228
+ LangGraph support rides through this same `@agent-inspect/langchain` callback boundary first. The v2.3 fixtures cover graph/node identity, subgraphs, checkpoint/session IDs, stream modes, handoffs, and parallel branch hints without adding a separate package. A dedicated LangGraph package remains deferred until fixtures prove that LangGraph exposes important lifecycle data unavailable through LangChain callbacks.
213
229
 
214
230
  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.
215
231
 
@@ -236,7 +252,7 @@ Requires an interactive terminal. See [API.md](./API.md) §10.
236
252
 
237
253
  ## Vitest (`@agent-inspect/vitest`)
238
254
 
239
- **Status:** experimental workspace package, private/unpublished.
255
+ **Status:** experimental reporter package — optional package published in the aligned v2.2.0 package set.
240
256
 
241
257
  ```bash
242
258
  npm install agent-inspect @agent-inspect/vitest vitest
@@ -285,7 +301,7 @@ Full API: [API.md](./API.md) §12.
285
301
 
286
302
  ## Jest (`@agent-inspect/jest`)
287
303
 
288
- **Status:** experimental workspace package, private/unpublished.
304
+ **Status:** experimental reporter package — optional package published in the aligned v2.2.0 package set.
289
305
 
290
306
  ```bash
291
307
  npm install agent-inspect @agent-inspect/jest jest
@@ -328,7 +344,7 @@ Full API: [API.md](./API.md) §13.
328
344
 
329
345
  ## OpenAI Agents JS (`@agent-inspect/openai-agents`)
330
346
 
331
- **Status:** experimental adapter — optional package published in the aligned v1.8.0 package set.
347
+ **Status:** experimental adapter — optional package published in the aligned v2.2.0 package set.
332
348
 
333
349
  The safe integration boundary is documented in [OPENAI-AGENTS-JS-TRACING.md](./proposals/OPENAI-AGENTS-JS-TRACING.md). Install the AgentInspect processor by replacing processors:
334
350
 
@@ -348,14 +364,15 @@ Do not use `addTraceProcessor()` as the default AgentInspect path; that preserve
348
364
 
349
365
  Integration modes:
350
366
 
351
- - **Local-only replacement:** `setTraceProcessors([agentInspectProcessor(...)])` replaces existing processors for the current process. This is the documented safe default when you want AgentInspect to own local trace output.
352
- - **Additional processor:** `addTraceProcessor(agentInspectProcessor(...))` is an advanced, user-owned choice. It can preserve existing/default processors and any backend export behavior they already perform.
367
+ - **Local-only replacement:** `setTraceProcessors([agentInspectProcessor(...)])` replaces existing processors for the current process. This is the documented safe default when you want AgentInspect to own local trace output and avoid preserving the SDK default exporter.
368
+ - **Additional processor:** `addTraceProcessor(agentInspectProcessor(...))` is an advanced, user-owned choice. It can preserve existing/default processors and any backend export behavior they already perform; use it only when that is intentional.
353
369
 
354
370
  - **No auto-install** — importing or constructing `agentInspectProcessor()` never calls `setTraceProcessors()` or `addTraceProcessor()`.
355
371
  - **No upload behavior** — the processor writes only to an explicit local writer or `traceDir`.
356
372
  - **Metadata-only by default** — records trace/span IDs, parentage, names, timing, status, errors, safe model/tool names, token counts, and bounded summaries.
357
373
  - **No raw payload capture by default** — prompts, messages, generated text, function inputs/outputs, arbitrary custom data, trace exporter credentials, headers, request bodies, response bodies, and hosted tool payloads are not persisted.
358
374
  - **Preview capture is not enabled yet** — `capture: "preview"`, `redactionProfile`, and `maxPreviewChars` are diagnosed through `getDiagnostics()` and do not persist raw previews.
375
+ - **Fixture-backed lifecycle coverage** — local tests and the recipe cover agent, generation, function tool, handoff, guardrail, response, MCP tools, custom, transcription, and speech span shapes without provider calls.
359
376
 
360
377
  Full API: [API.md](./API.md) §14.
361
378
 
@@ -363,11 +380,85 @@ Runnable local recipe: [openai-agents-local-tracing](../examples/recipes/openai-
363
380
 
364
381
  ---
365
382
 
383
+ ## Demand-gated framework decisions
384
+
385
+ ### Mastra
386
+
387
+ **v2.3 decision:** no official package, recipe, or conformance fixture.
388
+
389
+ The v2.3 evidence review found no open adapter request and no verified extension point in this repository that would produce useful local AgentInspect traces without hidden framework patching or new root/core dependencies. A future Mastra path must first prove:
390
+
391
+ - explicit user demand, such as an issue, design-partner request, or retained external recipe;
392
+ - a stable, framework-native callback/export hook;
393
+ - metadata-only local trace output with no hosted upload or provider calls by default;
394
+ - no dependency leakage into `agent-inspect` root or `@agent-inspect/core`;
395
+ - no raw prompt, output, tool payload, header, or request/response capture by default.
396
+
397
+ Until those are true, Mastra stays outside the official adapter set rather than shipping a shallow package.
398
+
399
+ ### NestJS
400
+
401
+ **v2.3 decision:** no official framework adapter package.
402
+
403
+ NestJS remains covered through structured-log ingestion, not app bootstrap wrapping. The supported recipe is [examples/recipes/nestjs-json-logging](../examples/recipes/nestjs-json-logging), which maps Nest-shaped JSON lines into local execution trees without importing `@nestjs/*`, starting an HTTP server, or changing application behavior.
404
+
405
+ A future Nest helper remains demand-gated and must be narrower than a framework adapter. Acceptable evidence would be a repeated need to reduce logging/harness setup friction while preserving explicit opt-in, local-only output, and zero root/core Nest dependency. Broad interceptors, automatic module scanning, monkey-patching, request body capture, or default telemetry upload remain out of scope.
406
+
407
+ ---
408
+
409
+ ## MCP client telemetry (`@agent-inspect/mcp`)
410
+
411
+ **Status:** experimental optional package — v2.4.0 train.
412
+
413
+ `@agent-inspect/mcp` traces **MCP client** `tools/list` and `tools/call` as local AgentInspect tool steps. It records server identity (name + URL hash), tool name, bounded argument/result summaries, duration, errors, and optional session metadata (`sessionId`, `toolCallId`, `mcpToolCallId`).
414
+
415
+ ### Install
416
+
417
+ ```bash
418
+ npm install agent-inspect @agent-inspect/mcp
419
+ ```
420
+
421
+ ### Wrap a client
422
+
423
+ ```ts
424
+ import { inspectRun } from "agent-inspect";
425
+ import { wrapMcpClient } from "@agent-inspect/mcp";
426
+
427
+ const traced = wrapMcpClient(mcpClient, {
428
+ serverName: "docs-server",
429
+ serverUrl: process.env.MCP_SERVER_URL,
430
+ sessionId: "sess-123",
431
+ });
432
+
433
+ await inspectRun("support-agent", async () => {
434
+ await traced.listTools?.();
435
+ await traced.callTool({ name: "search", arguments: { query: "refund policy" } });
436
+ });
437
+ ```
438
+
439
+ `wrapMcpClient` accepts any object matching the documented `McpClientLike` shape. It does **not** require `@modelcontextprotocol/sdk` at runtime.
440
+
441
+ ### Boundaries (v2.4)
442
+
443
+ | In scope | Out of scope |
444
+ | -------- | ------------ |
445
+ | Client-side `tools/list` and `tools/call` wrapping | MCP **server** implementation |
446
+ | Bounded summaries on tool step metadata | Gateway, proxy, or hosted MCP broker |
447
+ | `source.type: mcp-client` on tool steps | Invoking tools on behalf of the user from AgentInspect |
448
+ | Session metadata attachment when provided | Default trace upload |
449
+
450
+ Recipe: [examples/recipes/mcp-client-tracing](../examples/recipes/mcp-client-tracing/).
451
+
452
+ Session navigation for multi-run workflows uses `agent-inspect sessions` / `session` and optional `search --session` / `check --session` — see [CLI.md](./CLI.md) and [SESSIONS-AND-WORKFLOW-CAUSALITY.md](./proposals/SESSIONS-AND-WORKFLOW-CAUSALITY.md).
453
+
454
+ ---
455
+
366
456
  ## Future adapters (not shipped)
367
457
 
368
458
  Direction only — see [ROADMAP.md](../ROADMAP.md):
369
459
 
370
- - **NestJS / logging bridges** — deeper recipes or helper patterns beyond [LOGGING-PLAYBOOK.md](./LOGGING-PLAYBOOK.md)
460
+ - **NestJS helper patterns** — only if demand proves a narrow harness/bootstrap helper is worth maintaining beyond [LOGGING-PLAYBOOK.md](./LOGGING-PLAYBOOK.md) and the current NestJS logging recipe.
461
+ - **Mastra** — deferred until demand and extension-point evidence justify a narrow explicit integration.
371
462
 
372
463
  No automatic universal instrumentation. Integrations remain explicit and opt-in.
373
464
 
package/docs/CLI.md CHANGED
@@ -38,6 +38,8 @@ Core commands:
38
38
  - `timeline` — chronological view of one run (local JSONL)
39
39
  - `stats` — local aggregate stats over a trace directory
40
40
  - `search` — deterministic local search over traces
41
+ - `sessions` — list workflow sessions from trace metadata
42
+ - `session` — inspect one session (handoffs, retries, optional timeline)
41
43
  - `what` — concise summary of a single run (local JSONL)
42
44
  - `report` — markdown or HTML inspection report for a single run
43
45
  - `explain` — deterministic local facts/inferences for a trace, with dry-run payloads
@@ -305,6 +307,9 @@ Options:
305
307
  - `--max-duration-ms <number>`: add `run.duration`
306
308
  - `--required-tool <name>` / `--forbidden-tool <name>`: add `tool.usage`
307
309
  - `--allowed-model <model>` / `--max-total-tokens <number>`: add `llm.usage`
310
+ - `--session <id>`: check all runs in a workflow session (uses `--dir`; target may be `.`)
311
+ - `--group <id>`: check all runs sharing a `groupId` metadata value
312
+ - `--correlate-group`: when using `--session`, also match synthetic `group:` session keys
308
313
 
309
314
  By default, `check` runs `run.status`. Additional built-in rules can be selected with `--rule` or config when their options are available.
310
315
 
@@ -329,6 +334,7 @@ Examples:
329
334
  npx agent-inspect check fixtures/traces-v0.2/manual-basic.jsonl --json
330
335
  npx agent-inspect check minimal-success --dir fixtures/traces --rule run.status
331
336
  npx agent-inspect check trace.jsonl --max-duration-ms 30000 --required-tool search_docs --json
337
+ npx agent-inspect check . --dir ./.agent-inspect --session sess-handoff-001 --json
332
338
  ```
333
339
 
334
340
  Recipe: [examples/recipes/deterministic-ci-checks](../examples/recipes/deterministic-ci-checks/README.md)
@@ -634,6 +640,8 @@ Options:
634
640
  - `--tool <query>` — substring on tool step name or `metadata.toolName`
635
641
  - `--duration <expr>` — e.g. `>5s`, `>=500ms`
636
642
  - `--limit <number>` — default 50
643
+ - `--session <id>` — limit to runs in one workflow session
644
+ - `--correlate-group` — when using `--session`, also match synthetic `group:` keys
637
645
  - `--json`
638
646
 
639
647
  Examples:
@@ -642,11 +650,56 @@ Examples:
642
650
  npx agent-inspect search --status error --dir ./.agent-inspect
643
651
  npx agent-inspect search --kind tool --name search
644
652
  npx agent-inspect search --duration ">100ms" --json
653
+ npx agent-inspect search --session sess-retry-001 --dir ./.agent-inspect
645
654
  ```
646
655
 
647
656
  ![Search traces by status error](../assets/demos/search.gif)
648
657
 
649
- ### 6.19 `what`
658
+ ### 6.19 `sessions`
659
+
660
+ List workflow sessions grouped from local trace metadata (`sessionId`, optional `groupId` correlation). Read-only; no network.
661
+
662
+ ```bash
663
+ agent-inspect sessions [options]
664
+ ```
665
+
666
+ Options:
667
+
668
+ - `--dir <path>`
669
+ - `--correlate-group` — treat shared `groupId` as a synthetic session when `sessionId` is absent
670
+ - `--json` — `SessionIndex` JSON (`sessions`, `unscopedRunIds`, `warnings`)
671
+
672
+ Example:
673
+
674
+ ```bash
675
+ npx agent-inspect sessions --dir ./.agent-inspect
676
+ npx agent-inspect sessions --json
677
+ ```
678
+
679
+ ### 6.20 `session`
680
+
681
+ Inspect one workflow session: runs, handoffs, retries, and optional per-run timelines. Uses the same session index as `sessions`.
682
+
683
+ ```bash
684
+ agent-inspect session <session-id> [options]
685
+ ```
686
+
687
+ Options:
688
+
689
+ - `--dir <path>`
690
+ - `--timeline` — include per-run timelines (human or JSON `timelines`)
691
+ - `--critical-path` — include critical path section
692
+ - `--diagnostics` — include ambiguity warnings for the session
693
+ - `--json` — structured session view
694
+
695
+ Example:
696
+
697
+ ```bash
698
+ npx agent-inspect session sess-handoff-001 --timeline
699
+ npx agent-inspect session sess-retry-001 --critical-path --json
700
+ ```
701
+
702
+ ### 6.21 `what`
650
703
 
651
704
  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).
652
705
 
package/docs/SCHEMA.md CHANGED
@@ -131,6 +131,7 @@ Unknown status must **not** be treated as success.
131
131
 
132
132
  - Runs may include `metadata` on `run_started`.
133
133
  - **Correlation metadata (v1.3.0+):** optional `correlationId`, `requestId`, `decisionId`, and `groupId` on `run_started.metadata` when passed via `inspectRun` / `maybeInspectRun` options. Event names remain unchanged (`run_started`, `step_started`, `step_completed`, `run_completed`). `stats --correlation-id` and `--group-id` filter by these fields; `list` / `view` do not filter by correlation yet.
134
+ - **Session and workflow metadata (v2.4.0+, additive):** optional fields for multi-run causality — see [SESSIONS-AND-WORKFLOW-CAUSALITY.md](./proposals/SESSIONS-AND-WORKFLOW-CAUSALITY.md). Recommended placement: `run_started.metadata` (manual v0.1) or persisted `attributes` (v0.2/v1.0). Common keys: `sessionId`, `conversationId`, `parentGroupId`, `attempt`, `retryOf`, `handoffFrom`, `handoffTo`, `subAgentId`, `subAgentName`, `jobId`, `queueName`, `workflowName`, `workflowStep`, `toolCallId`, `mcpToolCallId`, `linkedStepId`. All optional; missing keys mean unknown. Readers must not infer handoff/retry links from timestamps alone. Existing traces without these fields remain fully readable.
134
135
  - Steps may include `metadata` on `step_started`.
135
136
  - Manual traces intentionally avoid full prompt/output capture by default.
136
137
  - **Redaction (default on):** before disk, `inspectRun` / `step` redact sensitive keys using the shared `Redactor` defaults (`authorization`, `cookie`, `token`, `apiKey`, `password`, `secret`, `email`). Opt out with `redact: false`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-inspect",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Local-first execution-tree debugger for TypeScript AI agents",
@@ -178,7 +178,7 @@
178
178
  },
179
179
  "scripts": {
180
180
  "clean": "pnpm -r exec -- rm -rf dist",
181
- "build": "pnpm exec tsup --config tsup.core.config.ts && pnpm exec tsup --config tsup.cli.config.ts && pnpm exec tsup --config tsup.langchain.config.ts && pnpm exec tsup --config tsup.tui.config.ts && pnpm exec tsup --config tsup.ai-sdk.config.ts && pnpm exec tsup --config tsup.vitest.config.ts && pnpm exec tsup --config tsup.jest.config.ts && pnpm exec tsup --config tsup.openai-agents.config.ts && pnpm exec tsup --config tsup.harness.config.ts && pnpm exec tsup --config tsup.redact.config.ts && pnpm exec tsup --config tsup.eval.config.ts",
181
+ "build": "pnpm exec tsup --config tsup.core.config.ts && pnpm exec tsup --config tsup.cli.config.ts && pnpm exec tsup --config tsup.langchain.config.ts && pnpm exec tsup --config tsup.tui.config.ts && pnpm exec tsup --config tsup.ai-sdk.config.ts && pnpm exec tsup --config tsup.vitest.config.ts && pnpm exec tsup --config tsup.jest.config.ts && pnpm exec tsup --config tsup.openai-agents.config.ts && pnpm exec tsup --config tsup.harness.config.ts && pnpm exec tsup --config tsup.redact.config.ts && pnpm exec tsup --config tsup.eval.config.ts && pnpm exec tsup --config tsup.mcp.config.ts",
182
182
  "typecheck": "tsc --noEmit",
183
183
  "test": "vitest run",
184
184
  "test:watch": "vitest",