agent-inspect 1.4.0 → 1.5.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 (81) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +26 -6
  3. package/docs/ADAPTERS.md +6 -0
  4. package/docs/API.md +9 -1
  5. package/docs/CLI.md +64 -0
  6. package/docs/DIFF.md +8 -0
  7. package/docs/EXPORTS.md +13 -0
  8. package/docs/GETTING-STARTED.md +19 -1
  9. package/docs/LIMITATIONS.md +3 -1
  10. package/docs/LOGS.md +22 -0
  11. package/docs/SCHEMA.md +3 -1
  12. package/docs/SCREENSHOTS.md +190 -9
  13. package/package.json +51 -1
  14. package/packages/cli/dist/index.cjs +2880 -2037
  15. package/packages/cli/dist/index.cjs.map +1 -1
  16. package/packages/cli/dist/index.mjs +2880 -2037
  17. package/packages/cli/dist/index.mjs.map +1 -1
  18. package/packages/core/dist/advanced.cjs +1437 -0
  19. package/packages/core/dist/advanced.cjs.map +1 -0
  20. package/packages/core/dist/advanced.d.cts +159 -0
  21. package/packages/core/dist/advanced.d.ts +159 -0
  22. package/packages/core/dist/advanced.mjs +8 -0
  23. package/packages/core/dist/advanced.mjs.map +1 -0
  24. package/packages/core/dist/chunk-5EMIZZXD.mjs +907 -0
  25. package/packages/core/dist/chunk-5EMIZZXD.mjs.map +1 -0
  26. package/packages/core/dist/chunk-7TGZLWEE.mjs +35 -0
  27. package/packages/core/dist/chunk-7TGZLWEE.mjs.map +1 -0
  28. package/packages/core/dist/chunk-BT7CATSD.mjs +497 -0
  29. package/packages/core/dist/chunk-BT7CATSD.mjs.map +1 -0
  30. package/packages/core/dist/chunk-E5F2LQCX.mjs +83 -0
  31. package/packages/core/dist/chunk-E5F2LQCX.mjs.map +1 -0
  32. package/packages/core/dist/chunk-EDTQHZPM.mjs +88 -0
  33. package/packages/core/dist/chunk-EDTQHZPM.mjs.map +1 -0
  34. package/packages/core/dist/chunk-HY7H3CQM.mjs +127 -0
  35. package/packages/core/dist/chunk-HY7H3CQM.mjs.map +1 -0
  36. package/packages/core/dist/chunk-Q6EPNB3V.mjs +539 -0
  37. package/packages/core/dist/chunk-Q6EPNB3V.mjs.map +1 -0
  38. package/packages/core/dist/chunk-QPAU2TPA.mjs +785 -0
  39. package/packages/core/dist/chunk-QPAU2TPA.mjs.map +1 -0
  40. package/packages/core/dist/chunk-QX3ZMPUF.mjs +451 -0
  41. package/packages/core/dist/chunk-QX3ZMPUF.mjs.map +1 -0
  42. package/packages/core/dist/chunk-VU6O5QAH.mjs +99 -0
  43. package/packages/core/dist/chunk-VU6O5QAH.mjs.map +1 -0
  44. package/packages/core/dist/chunk-XDBND27A.mjs +975 -0
  45. package/packages/core/dist/chunk-XDBND27A.mjs.map +1 -0
  46. package/packages/core/dist/chunk-YWAOOXLR.mjs +475 -0
  47. package/packages/core/dist/chunk-YWAOOXLR.mjs.map +1 -0
  48. package/packages/core/dist/diff.cjs +993 -0
  49. package/packages/core/dist/diff.cjs.map +1 -0
  50. package/packages/core/dist/diff.d.cts +81 -0
  51. package/packages/core/dist/diff.d.ts +81 -0
  52. package/packages/core/dist/diff.mjs +5 -0
  53. package/packages/core/dist/diff.mjs.map +1 -0
  54. package/packages/core/dist/exporters.cjs +1228 -0
  55. package/packages/core/dist/exporters.cjs.map +1 -0
  56. package/packages/core/dist/exporters.d.cts +113 -0
  57. package/packages/core/dist/exporters.d.ts +113 -0
  58. package/packages/core/dist/exporters.mjs +6 -0
  59. package/packages/core/dist/exporters.mjs.map +1 -0
  60. package/packages/core/dist/index.cjs +2844 -2266
  61. package/packages/core/dist/index.cjs.map +1 -1
  62. package/packages/core/dist/index.d.cts +92 -908
  63. package/packages/core/dist/index.d.ts +92 -908
  64. package/packages/core/dist/index.mjs +997 -5405
  65. package/packages/core/dist/index.mjs.map +1 -1
  66. package/packages/core/dist/log-config-BzGmDYum.d.cts +71 -0
  67. package/packages/core/dist/log-config-BzGmDYum.d.ts +71 -0
  68. package/packages/core/dist/logs.cjs +1007 -0
  69. package/packages/core/dist/logs.cjs.map +1 -0
  70. package/packages/core/dist/logs.d.cts +137 -0
  71. package/packages/core/dist/logs.d.ts +137 -0
  72. package/packages/core/dist/logs.mjs +6 -0
  73. package/packages/core/dist/logs.mjs.map +1 -0
  74. package/packages/core/dist/persisted.cjs +1057 -0
  75. package/packages/core/dist/persisted.cjs.map +1 -0
  76. package/packages/core/dist/persisted.d.cts +160 -0
  77. package/packages/core/dist/persisted.d.ts +160 -0
  78. package/packages/core/dist/persisted.mjs +5 -0
  79. package/packages/core/dist/persisted.mjs.map +1 -0
  80. package/packages/core/dist/types-Bkt7LS01.d.ts +226 -0
  81. package/packages/core/dist/types-CNbheSdk.d.cts +226 -0
package/CHANGELOG.md CHANGED
@@ -1,7 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.0
4
+
5
+ Released **2026-06-24**.
6
+
7
+ ### Added
8
+
9
+ - Added non-breaking package subpath exports: `agent-inspect/advanced`, `/persisted`, `/logs`, `/exporters`, `/diff` (root `"."` export unchanged).
10
+ - Added `agent-inspect what <runId>` — concise local run summary (`--json`, `--no-correlation`).
11
+ - Added `agent-inspect report <runId>` — markdown/HTML inspection report (`what` + timeline + execution tree).
12
+ - Added core helpers: `buildRunWhatSummary`, `renderRunWhat`, `buildRunReport`.
13
+ - Added canonical dual-format read path: `parseTraceJsonl`, `persistedInspectEventToTraceEvents`; `readTraceEvents` accepts v0.1 and v0.2 JSONL.
14
+ - Added [TRACE-VOCABULARY-V1.5.md](docs/proposals/TRACE-VOCABULARY-V1.5.md) RFC and `fixtures/traces-v0.2/llm-tokens-and-streaming.jsonl`.
15
+ - Added [what-report-inspect recipe](examples/recipes/what-report-inspect/) and CI artifact updates for `what`/`report`.
16
+
17
+ ### Changed
18
+
19
+ - Inspection CLI commands (`view`, `timeline`, `stats`, `search`, `diff`, `export`, `what`, `report`) use shared dual-format read path (v0.1 + v0.2).
20
+
21
+ ### Notes
22
+
23
+ - Manual trace writing remains `schemaVersion: "0.1"`.
24
+ - v0.2 read is normalization for inspection — not a write-path switch.
25
+ - Token fields in reports are user-supplied metadata only; core does not count tokens.
26
+ - No vendor upload, hosted dashboard, or cost engine.
27
+ - Linked release aligns `@agent-inspect/tui` with `agent-inspect` and `@agent-inspect/langchain` (all **1.5.0**).
28
+
3
29
  ## 1.4.0
4
30
 
31
+ Released **2026-06-12**.
32
+
5
33
  ### Added
6
34
 
7
35
  - Added `docs/CI-ARTIFACTS.md` and `examples/recipes/github-actions-artifact/` for CI trace artifact workflows.
package/README.md CHANGED
@@ -10,6 +10,8 @@ The tool starts with **manual traces** and **existing structured logs**, and ext
10
10
 
11
11
  **No account. No cloud upload. No dashboard required.**
12
12
 
13
+ **Visual demos:** [docs/SCREENSHOTS.md](docs/SCREENSHOTS.md) — curated terminal recordings (synthetic fixtures only).
14
+
13
15
  ## Why agent-inspect exists
14
16
 
15
17
  AI agents are no longer single function calls. They plan, call tools, invoke LLMs, branch, retry, fail, and run work in parallel. **Console logs are flat**; reconstructing causality from a wall of lines is slow and error-prone.
@@ -20,7 +22,7 @@ agent-inspect gives those runs **structure**: an **execution tree** you can read
20
22
 
21
23
  ## Install
22
24
 
23
- Current npm release: **1.3.0** (`agent-inspect`, `@agent-inspect/langchain`; `@agent-inspect/tui` is **1.2.1** patch-only alignment release).
25
+ Current npm release: **1.5.0** (`agent-inspect`, `@agent-inspect/langchain`, `@agent-inspect/tui` — all aligned).
24
26
 
25
27
  ```bash
26
28
  npm install agent-inspect
@@ -109,13 +111,13 @@ await maybeInspectRun("eval-case-42", async () => runAgent());
109
111
  AGENT_INSPECT=1 node eval-runner.mjs
110
112
  ```
111
113
 
112
- ## What you can do today (v1.3.0)
114
+ ## What you can do today (v1.5.0)
113
115
 
114
116
  - **Trace manually** with `inspectRun`, `step`, `step.llm`, `step.tool`, and `observe` — local JSONL under `.agent-inspect/` by default.
115
117
  - **Toggle tracing** with `maybeInspectRun` and `AGENT_INSPECT=1` in eval harnesses or CI.
116
118
  - **Correlate runs** with optional `correlationId`, `requestId`, `decisionId`, and `groupId` on `run_started` metadata.
117
119
  - **Redact before disk** with default key-based redaction, or choose `redactionProfile`: `local`, `share`, or `strict`.
118
- - **Inspect from the CLI** — `list`, `view`, `clean`, `logs`, `tail`, `export`, `diff`, `timeline`, `stats`, `search`.
120
+ - **Inspect from the CLI** — `list`, `view`, `clean`, `logs`, `tail`, `export`, `diff`, `timeline`, `stats`, `search`, `what`, `report`.
119
121
  - **Export share-safe copies** — `export --redaction-profile share` (or `strict`) writes local Markdown/HTML/OpenInference/OTLP JSON only.
120
122
  - **Parse structured logs** you already emit (JSON first-class; log4js best-effort).
121
123
  - **Optional LangChain adapter** — metadata-only by default; optional `persist: true` and `stream: true` streaming metadata (no full token capture by default).
@@ -128,6 +130,10 @@ Nothing uploads traces by default. Review exports before sharing — see [safe t
128
130
 
129
131
  Each run produces a **JSONL** trace: `run_started` / `run_completed`, `step_started` / `step_completed`, with **nested steps**, **tool/LLM** types where you use `step.tool` / `step.llm`, and **durations** on completed steps. Failures are recorded on `step_completed` with `status: "error"` (there is no separate `step_failed` event). See [docs/SCHEMA.md](docs/SCHEMA.md).
130
132
 
133
+ ![Nested execution tree from a local JSONL trace](https://raw.githubusercontent.com/rajudandigam/agent-inspect/main/docs/assets/demos/execution-tree.gif)
134
+
135
+ *Synthetic demo — [examples/02-nested-steps](examples/02-nested-steps/README.md). More visuals: [SCREENSHOTS.md](docs/SCREENSHOTS.md).*
136
+
131
137
  ## Works with structured logs you already have
132
138
 
133
139
  Many production systems already emit **line-delimited JSON** or text logs with embedded JSON (e.g. via **pino**, **winston**, **log4js**, **NestJS** loggers, job runners, or custom event streams). agent-inspect can turn those into **local grouped timelines/trees** without wrapping every function.
@@ -152,6 +158,8 @@ npx agent-inspect logs ./agent.log --config agent-inspect.logs.json
152
158
  - **Flat timeline by default**; nesting when parent relationships are explicit or configured.
153
159
  - **Confidence labels** (`explicit`, `correlated`, `heuristic`, `unknown`) describe how attribution was inferred.
154
160
 
161
+ **Visual:** JSON log → tree recording is [documented in SCREENSHOTS.md](docs/SCREENSHOTS.md#json-logs--tree) (re-record pending; command above is the canonical flow).
162
+
155
163
  More detail: [docs/LOGS.md](docs/LOGS.md) · [docs/LOG-TO-TREE-QUICKSTART.md](docs/LOG-TO-TREE-QUICKSTART.md) · [docs/LOGGING-PLAYBOOK.md](docs/LOGGING-PLAYBOOK.md) (pino, log4js, NestJS).
156
164
 
157
165
  ## CLI at a glance
@@ -168,6 +176,12 @@ More detail: [docs/LOGS.md](docs/LOGS.md) · [docs/LOG-TO-TREE-QUICKSTART.md](do
168
176
  | `timeline` | Chronological view of one run |
169
177
  | `stats` | Local aggregates over a trace directory |
170
178
  | `search` | Deterministic search over local traces |
179
+ | `what` | Concise summary of one run |
180
+ | `report` | Markdown/HTML inspection report (what + timeline + tree) |
181
+
182
+ ![Timeline with slow-step focus for one run](https://raw.githubusercontent.com/rajudandigam/agent-inspect/main/docs/assets/demos/timeline.gif)
183
+
184
+ *Synthetic demo — `agent-inspect timeline` on [fixtures/traces](fixtures/traces). Gallery: [SCREENSHOTS.md](docs/SCREENSHOTS.md).*
171
185
 
172
186
  Full flags and behavior: [docs/CLI.md](docs/CLI.md).
173
187
 
@@ -182,16 +196,20 @@ Full flags and behavior: [docs/CLI.md](docs/CLI.md).
182
196
 
183
197
  ## Stable foundation (AgentInspect 1.x)
184
198
 
185
- **agent-inspect 1.x** (current: **1.3.0**) is the **local-first trace workbench** for TypeScript AI agents:
199
+ **agent-inspect 1.x** (current: **1.5.0**) is the **local-first trace workbench** for TypeScript AI agents:
186
200
 
187
201
  - Instrument runs with `inspectRun` and `step`
188
202
  - Write **local JSONL traces** (`schemaVersion: "0.1"` — compatibility retained)
189
- - Inspect with **`list`**, **`view`**, **`clean`**, **`logs`**, **`tail`**, **`export`**, **`diff`**
203
+ - Inspect with **`list`**, **`view`**, **`clean`**, **`logs`**, **`tail`**, **`export`**, **`diff`**, **`timeline`**, **`stats`**, **`search`**
190
204
 
191
205
  **Stable APIs:** `inspectRun()`, `maybeInspectRun()`, `step()`, `step.llm()`, `step.tool()`, `observe()`, `getCurrentCorrelationMetadata()`.
192
206
 
193
207
  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).
194
208
 
209
+ **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
+
211
+ **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
+
195
213
  **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).
196
214
 
197
215
  **Also in 1.x** (local-first extensions):
@@ -264,6 +282,7 @@ The TUI is available as a separate optional package; its programmatic API is exp
264
282
  | [examples/recipes/nestjs-json-logging](examples/recipes/nestjs-json-logging) | NestJS JSON logs |
265
283
  | [examples/recipes/retry-fallback](examples/recipes/retry-fallback) | Fallback pattern |
266
284
  | [examples/recipes/parallel-tools](examples/recipes/parallel-tools) | Parallel tools |
285
+ | [examples/recipes/github-actions-artifact](examples/recipes/github-actions-artifact) | CI trace artifacts |
267
286
 
268
287
  **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).
269
288
 
@@ -290,7 +309,8 @@ For a detailed comparison, see [Compare with other tools](docs/COMPARE.md).
290
309
  | [Install smoke test](docs/INSTALL-SMOKE-TEST.md) | [CLI](docs/CLI.md) | [Security](SECURITY.md) |
291
310
  | [Log-to-tree quickstart](docs/LOG-TO-TREE-QUICKSTART.md) | [Schema](docs/SCHEMA.md) | [Limitations](docs/LIMITATIONS.md) |
292
311
  | [Logging playbook](docs/LOGGING-PLAYBOOK.md) | [Exports](docs/EXPORTS.md) | [Known issues](docs/KNOWN-ISSUES.md) |
293
- | [Examples](examples/README.md) | [Adapters](docs/ADAPTERS.md) | [Compare with other tools](docs/COMPARE.md) |
312
+ | [CI artifacts](docs/CI-ARTIFACTS.md) | [Adapters](docs/ADAPTERS.md) | [Compare with other tools](docs/COMPARE.md) |
313
+ | [Visual demos](docs/SCREENSHOTS.md) | [Examples](examples/README.md) | |
294
314
 
295
315
  Also: [Architecture](docs/ARCHITECTURE.md) · [Logs & tail](docs/LOGS.md) · [Diff](docs/DIFF.md) · [Changelog](CHANGELOG.md) · [Roadmap](ROADMAP.md) · [Contributing](CONTRIBUTING.md) · [Good first issues](GOOD-FIRST-ISSUES.md)
296
316
 
package/docs/ADAPTERS.md CHANGED
@@ -51,6 +51,10 @@ npx agent-inspect view <run-id> --dir ./.agent-inspect
51
51
  npx agent-inspect export <run-id> --format markdown --redaction-profile share
52
52
  ```
53
53
 
54
+ ![LangChain callback with persist true writing inspectable JSONL](../assets/demos/langchain-persistence.gif)
55
+
56
+ *Synthetic demo — [examples/08-langchain-adapter](../../examples/08-langchain-adapter/README.md).*
57
+
54
58
  **Persistence model (Strategy A):**
55
59
 
56
60
  1. **Standalone session** — one AgentInspect run per callback instance until the root LangChain run completes.
@@ -121,6 +125,8 @@ npm install agent-inspect @agent-inspect/tui
121
125
  npx agent-inspect view <run-id> --tui
122
126
  ```
123
127
 
128
+ ![Optional Ink TUI viewer for a local trace](../assets/demos/tui-viewer.gif)
129
+
124
130
  Requires an interactive terminal. See [API.md](./API.md) §10.
125
131
 
126
132
  ---
package/docs/API.md CHANGED
@@ -9,6 +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).
13
+
14
+ ```ts
15
+ import { inspectRun, step } from "agent-inspect";
16
+ import { parseLogsToTrees } from "agent-inspect/logs";
17
+ import { exportMarkdown } from "agent-inspect/exporters";
18
+ ```
19
+
12
20
  Notes:
13
21
 
14
22
  - The core guarantee of v1.x is **stable local debugging**: manual tracing + CLI inspection.
@@ -31,7 +39,7 @@ import { inspectRun, maybeInspectRun, step, observe } from "agent-inspect";
31
39
  - **`maxMetadataValueLength`**: max string length for metadata values (default `2000`).
32
40
  - **`maxPreviewLength`**: max string length for preview-like keys containing `preview` (default `500`).
33
41
  - **`maxEventBytes`**: max UTF-8 bytes per serialized JSONL event (default `65536`). Oversized events are truncated; instrumentation never throws into user code.
34
- - **Correlation metadata (v1.3.0+):** optional `correlationId`, `requestId`, `decisionId`, and `groupId` strings. When set, they are written on `run_started.metadata` (not on every step). Top-level correlation options override the same keys in `options.metadata`. Useful for eval cases, CI job IDs, request tracing, and future stats/cohort views. They are **metadata only** — they do not replace `runId`. Treat sensitive IDs as trace data before sharing exports.
42
+ - **Correlation metadata (v1.3.0+):** optional `correlationId`, `requestId`, `decisionId`, and `groupId` strings. When set, they are written on `run_started.metadata` (not on every step). Top-level correlation options override the same keys in `options.metadata`. Useful for eval cases, CI job IDs, request tracing, and `stats --correlation-id` / `--group-id`. They are **metadata only** — they do not replace `runId`. Treat sensitive IDs as trace data before sharing exports.
35
43
  - **`maybeInspectRun(name, fn, options?)`**: same as `inspectRun` when tracing is enabled; otherwise passthrough. Enablement: explicit **`options.enabled`** wins; when omitted, reads **`AGENT_INSPECT`** (`1`, `true`, `yes`, `on`, `enabled` — case-insensitive). Unset or other values disable tracing. Use in eval harnesses, CI, or jobs where tracing should be toggled by environment.
36
44
  - **`isAgentInspectEnabled(value?)`**: returns whether a string (or `process.env.AGENT_INSPECT`) matches an enable token.
37
45
  - **`step(name, fn, options?)`**: traces a named unit of work inside `inspectRun` (`step_started` / `step_completed`). Step `metadata` inherits the parent run's redaction and size-bound settings.
package/docs/CLI.md CHANGED
@@ -29,6 +29,8 @@ Core commands:
29
29
  - `timeline` — chronological view of one run (local JSONL)
30
30
  - `stats` — local aggregate stats over a trace directory
31
31
  - `search` — deterministic local search over traces
32
+ - `what` — concise summary of a single run (local JSONL)
33
+ - `report` — markdown or HTML inspection report for a single run
32
34
 
33
35
  ## 2. Environment variables
34
36
 
@@ -268,6 +270,8 @@ Options:
268
270
  - `--json` — structured `RunTimeline` JSON
269
271
  - `--focus slow` — show only the slowest steps by duration (top N)
270
272
 
273
+ ![Timeline with slow-step focus](../assets/demos/timeline.gif)
274
+
271
275
  ### 6.9 `stats`
272
276
 
273
277
  Local aggregate statistics over trace files in a directory. Read-only.
@@ -284,6 +288,10 @@ Options:
284
288
  - `--group-id <id>` — filter by `run_started.metadata.groupId`
285
289
  - `--json`
286
290
 
291
+ ![Directory-level stats over local traces](../assets/demos/stats.gif)
292
+
293
+ Use `--correlation-id` or `--group-id` to filter runs by `run_started` metadata (see [API.md](./API.md)).
294
+
287
295
  ### 6.10 `search`
288
296
 
289
297
  Deterministic search over local traces (substring / exact filters). No semantic search.
@@ -312,6 +320,62 @@ npx agent-inspect search --kind tool --name search
312
320
  npx agent-inspect search --duration ">100ms" --json
313
321
  ```
314
322
 
323
+ ![Search traces by status error](../assets/demos/search.gif)
324
+
325
+ ### 6.11 `what`
326
+
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).
328
+
329
+ ```bash
330
+ agent-inspect what <run-id> [options]
331
+ ```
332
+
333
+ Options:
334
+
335
+ - `--dir <path>`
336
+ - `--json` — structured `RunWhatSummary` JSON
337
+ - `--no-correlation` — omit correlation ids from human output
338
+
339
+ Example:
340
+
341
+ ```bash
342
+ npx agent-inspect what minimal-success --dir fixtures/traces
343
+ ```
344
+
345
+ Sample output:
346
+
347
+ ```
348
+ What: minimal-success
349
+ Status: success · Duration: 120ms · Steps: 1 (1 logic)
350
+ Outcome: Completed successfully.
351
+ Slowest: plan (100ms, logic)
352
+ ```
353
+
354
+ ### 6.12 `report`
355
+
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).
357
+
358
+ ```bash
359
+ agent-inspect report <run-id> [options]
360
+ ```
361
+
362
+ Options:
363
+
364
+ - `--dir <path>`
365
+ - `--format <markdown|html>` — default `markdown`
366
+ - `-o, --output <path>` — write to file
367
+ - `--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
370
+ - `--no-correlation` — omit correlation ids from what section
371
+ - `--redaction-profile <local|share|strict>` — tree section redaction (default `local`)
372
+
373
+ Example:
374
+
375
+ ```bash
376
+ npx agent-inspect report minimal-success --dir fixtures/traces --format html -o report.html
377
+ ```
378
+
315
379
  ## 7. Optional TUI behavior
316
380
 
317
381
  `view --tui` delegates to `@agent-inspect/tui` and requires an interactive terminal. If the package is not installed, the CLI prints a short install hint.
package/docs/DIFF.md CHANGED
@@ -10,6 +10,14 @@ Notes:
10
10
  - `diff` is read-only and does **not** rerun agents; “differences” do not necessarily imply failure (command errors do).
11
11
  - `diff` reads local trace files only. It is useful for local debugging, but it is not production APM or hosted observability.
12
12
 
13
+ ![Diff comparing a success run and an error run](assets/demos/diff-runs.gif)
14
+
15
+ ```bash
16
+ agent-inspect diff minimal-success minimal-error --dir fixtures/traces
17
+ ```
18
+
19
+ More visuals: [SCREENSHOTS.md](./SCREENSHOTS.md).
20
+
13
21
  ## CLI examples
14
22
 
15
23
  The examples below use the checked-in fixture traces, so they are safe to copy and run locally:
package/docs/EXPORTS.md CHANGED
@@ -23,6 +23,19 @@ Full flags: [CLI.md](./CLI.md) §6.6.
23
23
 
24
24
  All formats are **compatibility-oriented** for local inspection and handoff — not guaranteed to match every vendor schema version.
25
25
 
26
+ ### Markdown export
27
+
28
+ ![Export a run to Markdown locally](assets/demos/markdown-export.gif)
29
+
30
+ ```bash
31
+ agent-inspect export minimal-success --dir fixtures/traces --format markdown
32
+ ```
33
+
34
+ ### HTML, OpenInference, OTLP
35
+
36
+ - **HTML:** export writes a local file; a rendered-report visual is pending re-record ([RECORDING.md](./assets/demos/RECORDING.md)). Use `agent-inspect export <run-id> --format html -o report.html` and open the file locally.
37
+ - **OpenInference / OTLP JSON:** compatibility-oriented shapes for local handoff — validate with `--validate` before sharing. No dedicated GIF; see format tables below.
38
+
26
39
  ## Common options
27
40
 
28
41
  | Flag | Notes |
@@ -2,6 +2,8 @@
2
2
 
3
3
  AgentInspect is a **local-first execution-tree debugger** for TypeScript AI agents. It helps you produce and inspect an execution tree of steps, safely and deterministically, without uploading data anywhere.
4
4
 
5
+ **Visual demos:** [SCREENSHOTS.md](./SCREENSHOTS.md)
6
+
5
7
  ## 1. Install
6
8
 
7
9
  ```bash
@@ -58,6 +60,10 @@ await maybeInspectRun("eval-case-42", async () => {
58
60
  AGENT_INSPECT=1 node eval-runner.mjs
59
61
  ```
60
62
 
63
+ ![Env-gated tracing with maybeInspectRun](../assets/demos/env-gated-tracing.gif)
64
+
65
+ *When `AGENT_INSPECT` is unset, no trace files are written.*
66
+
61
67
  Enable tokens: `1`, `true`, `yes`, `on`, `enabled` (case-insensitive). Explicit `enabled: true | false` in options overrides the env var.
62
68
 
63
69
  ### Correlation metadata (v1.3.0+)
@@ -136,7 +142,19 @@ agent-inspect export minimal-success --dir fixtures/traces \
136
142
 
137
143
  Exports are **local-only** and do not upload anywhere. Review output before sharing — see [SAFE-TRACE-SHARING.md](./SAFE-TRACE-SHARING.md).
138
144
 
139
- ## 8. Diff two runs
145
+ ## 8. Local observability (v1.4.0+)
146
+
147
+ After traces exist under a directory:
148
+
149
+ ```bash
150
+ agent-inspect timeline <run-id> --dir ./.agent-inspect
151
+ agent-inspect stats --dir ./.agent-inspect --since 7d
152
+ agent-inspect search --dir ./.agent-inspect --status error --limit 10
153
+ ```
154
+
155
+ For CI artifact workflows, see [CI-ARTIFACTS.md](./CI-ARTIFACTS.md) and [github-actions-artifact recipe](../examples/recipes/github-actions-artifact/).
156
+
157
+ ## 9. Diff two runs
140
158
 
141
159
  ```bash
142
160
  agent-inspect diff minimal-success minimal-error --dir fixtures/traces
@@ -17,7 +17,7 @@ This document states what AgentInspect **does not** provide today. It complement
17
17
 
18
18
  - **v0.2 is not the default persisted trace file format.** `inspectRun()` / `step()` still write `schemaVersion: "0.1"` JSONL.
19
19
  - **CLI commands** (`list`, `view`, `export`, `diff`, `logs`, `tail`) still primarily operate on current v0.1 trace and log paths.
20
- - **v0.2 read/write integration** (dual-format storage, CLI consumption) is future work v1.2.0 ships in-memory converters and canonical fixtures only.
20
+ - **v0.2 read integration** inspection CLI reads v0.2 JSONL via dual-format normalization (v1.5.0). Default **write** path remains v0.1; `list` metadata for v0.2-only files may be limited.
21
21
 
22
22
  ## LangChain streaming (v1.3.0)
23
23
 
@@ -54,6 +54,8 @@ This document states what AgentInspect **does not** provide today. It complement
54
54
  - **`search`** is deterministic exact/contains matching only — no semantic or fuzzy search.
55
55
  - **`stats`** is local file aggregation — not production fleet analytics.
56
56
 
57
+ Visual demos: [SCREENSHOTS.md](./SCREENSHOTS.md) · [CLI.md](./CLI.md)
58
+
57
59
  ## Scale
58
60
 
59
61
  - Designed for **developer machines** and **inner-loop debugging**, not petabyte log warehouses.
package/docs/LOGS.md CHANGED
@@ -7,8 +7,30 @@ AgentInspect can parse **existing logs** (line-delimited JSON, and best-effort l
7
7
  - **Production-shaped playbook**: `docs/LOGGING-PLAYBOOK.md` (pino, log4js, NestJS recipes)
8
8
  - **Field mapping and redaction**: `docs/API.md` (log ingest APIs) and `docs/SCHEMA.md`
9
9
  - **Safety constraints**: JSON logs first-class; log4js best-effort; no `eval`; no JavaScript object-literal parsing as a log interchange format (see `SECURITY.md`)
10
+ - **Visual demos**: [SCREENSHOTS.md](./SCREENSHOTS.md#use-existing-logs)
10
11
 
11
12
  Notes:
12
13
  - Log parsing APIs are documented as **experimental** in `docs/API.md`.
13
14
  - Log-derived events include **confidence labels**; AgentInspect is conservative about inferring parent/child structure.
14
15
 
16
+ ### JSON logs → tree (visual pending)
17
+
18
+ Animated demo is **pending re-record** — a staging capture showed tool/LLM summary counts that did not match displayed events. Use the canonical command below; see [assets/demos/RECORDING.md](./assets/demos/RECORDING.md).
19
+
20
+ ```bash
21
+ agent-inspect logs fixtures/logs/minimal-success.json.log \
22
+ --format json \
23
+ --run-id-key runId \
24
+ --event-key event \
25
+ --timestamp-key timestamp
26
+ ```
27
+
28
+ Run: [examples/06-log-to-tree](../examples/06-log-to-tree/README.md)
29
+
30
+ ### Live tail (visual pending)
31
+
32
+ `agent-inspect tail` updates a local tree as new log lines arrive. Recording guide: [RECORDING.md](./assets/demos/RECORDING.md).
33
+
34
+ ### log4js (best-effort)
35
+
36
+ See [examples/recipes/log4js-json-layout](../examples/recipes/log4js-json-layout/README.md). Visual pending re-record.
package/docs/SCHEMA.md CHANGED
@@ -129,7 +129,7 @@ Unknown status must **not** be treated as success.
129
129
  ## 6. Metadata policy
130
130
 
131
131
  - Runs may include `metadata` on `run_started`.
132
- - **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`). CLI list/view does not filter by correlation fields yet.
132
+ - **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.
133
133
  - Steps may include `metadata` on `step_started`.
134
134
  - Manual traces intentionally avoid full prompt/output capture by default.
135
135
  - **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`.
@@ -142,6 +142,8 @@ Unknown status must **not** be treated as success.
142
142
  - Readers should ignore unknown fields where safe.
143
143
  - Breaking schema changes require a major version.
144
144
 
145
+ **v1.5 vocabulary (kinds, token metadata, streaming attributes):** [TRACE-VOCABULARY-V1.5.md](./proposals/TRACE-VOCABULARY-V1.5.md)
146
+
145
147
  ## 8. Malformed lines
146
148
 
147
149
  Manual trace reading:
@@ -1,14 +1,195 @@
1
- ## Screenshots / GIFs (planned)
1
+ # Visual demos
2
2
 
3
- This repo does not currently include screenshots or recorded GIFs in the npm package.
3
+ Curated terminal recordings for AgentInspect **1.4.0**. They show what the local trace workbench captures and how to inspect it — without a hosted dashboard or vendor upload.
4
4
 
5
- Recommended captures to add (when convenient):
5
+ **Synthetic output only:** demos use committed [fixtures](../fixtures/README.md), [examples](../examples/README.md), and recipes. No external LLM calls or API keys.
6
6
 
7
- - [ ] Basic trace tree (`inspectRun` + `step`)
8
- - [ ] Failed tool call / failed step rendering
9
- - [ ] `agent-inspect logs` output (JSON logs)
10
- - [ ] `agent-inspect diff` output
11
- - [ ] Optional TUI (`agent-inspect view <run-id> --tui`)
7
+ **npm note:** GIFs live in `docs/assets/demos/` for GitHub documentation. They are **not** shipped in the `agent-inspect` npm tarball.
12
8
 
13
- <!-- Add screenshots after running `examples/00-quickstart-demo` locally. -->
9
+ **Re-record guide:** [assets/demos/RECORDING.md](assets/demos/RECORDING.md)
10
+ **Maintainer audit:** [implementation/VISUAL-DEMO-AUDIT.md](implementation/VISUAL-DEMO-AUDIT.md)
14
11
 
12
+ ---
13
+
14
+ ## Start tracing
15
+
16
+ Manual `inspectRun` / `step` traces written as local JSONL.
17
+
18
+ ### Quickstart (install → trace → view)
19
+
20
+ ![Quickstart: install, run a traced script, list and view the run](assets/demos/quickstart.gif)
21
+
22
+ Run: [examples/00-quickstart-demo](../examples/00-quickstart-demo/README.md)
23
+ Also: [GETTING-STARTED.md](GETTING-STARTED.md)
24
+
25
+ ### Nested execution tree
26
+
27
+ ![Nested steps rendered as an execution tree in the terminal](assets/demos/execution-tree.gif)
28
+
29
+ Run: [examples/02-nested-steps](../examples/02-nested-steps/README.md)
30
+ Command: `agent-inspect view <run-id> --dir <trace-dir>`
31
+
32
+ ### Parallel sibling steps
33
+
34
+ ![Parallel tool steps under one parent in the execution tree](assets/demos/parallel-execution.gif)
35
+
36
+ Run: [examples/03-parallel-steps](../examples/03-parallel-steps/README.md)
37
+
38
+ ### Error handling
39
+
40
+ ![Failed step recorded on step_completed with status error](assets/demos/error-handling.gif)
41
+
42
+ Run: [examples/04-error-handling](../examples/04-error-handling/README.md)
43
+
44
+ ### `observe()` wrapper
45
+
46
+ ![observe() wrapper tracing an agent-like object](assets/demos/observe-wrapper.gif)
47
+
48
+ Run: [examples/05-observe-wrapper](../examples/05-observe-wrapper/README.md) · API: [API.md](API.md)
49
+
50
+ ### Env-gated tracing (`maybeInspectRun`)
51
+
52
+ ![AGENT_INSPECT=1 toggles tracing; unset leaves no trace files](assets/demos/env-gated-tracing.gif)
53
+
54
+ Docs: [GETTING-STARTED.md](GETTING-STARTED.md) · [API.md](API.md) (`maybeInspectRun`)
55
+
56
+ ---
57
+
58
+ ## Use existing logs
59
+
60
+ Turn structured logs you already emit into a **local** grouped timeline or tree.
61
+
62
+ ### JSON logs → tree
63
+
64
+ **Status:** animated demo pending re-record (staging asset had summary-count mismatch).
65
+ **Command:**
66
+
67
+ ```bash
68
+ agent-inspect logs ./your.json.log \
69
+ --format json \
70
+ --run-id-key runId \
71
+ --event-key event \
72
+ --timestamp-key timestamp
73
+ ```
74
+
75
+ Run: [examples/06-log-to-tree](../examples/06-log-to-tree/README.md) · [LOGS.md](LOGS.md) · [LOG-TO-TREE-QUICKSTART.md](LOG-TO-TREE-QUICKSTART.md)
76
+
77
+ ### Live tail
78
+
79
+ **Status:** animated demo pending re-record.
80
+ **Command:** `agent-inspect tail <log-file> [mapping flags]` — see [LOGS.md](LOGS.md).
81
+
82
+ ### log4js (best-effort)
83
+
84
+ **Status:** pending re-record. Documented in [LOGS.md](LOGS.md); recipe: [log4js-json-layout](../examples/recipes/log4js-json-layout/README.md).
85
+
86
+ ---
87
+
88
+ ## Inspect and compare
89
+
90
+ Read-only CLI over local JSONL traces.
91
+
92
+ ### Chronological timeline (`--focus slow`)
93
+
94
+ ![Timeline with slow-step focus highlighting longest steps](assets/demos/timeline.gif)
95
+
96
+ ```bash
97
+ agent-inspect timeline <run-id> --dir fixtures/traces --focus slow
98
+ ```
99
+
100
+ Docs: [CLI.md](CLI.md) § timeline
101
+
102
+ ### Local stats
103
+
104
+ ![Aggregate stats over a trace directory](assets/demos/stats.gif)
105
+
106
+ ```bash
107
+ agent-inspect stats --dir fixtures/traces
108
+ ```
109
+
110
+ Filter by correlation: `agent-inspect stats --correlation-id <id>` or `--group-id <id>`.
111
+ Docs: [CLI.md](CLI.md) § stats
112
+
113
+ ### Deterministic search
114
+
115
+ ![Search traces by status error](assets/demos/search.gif)
116
+
117
+ ```bash
118
+ agent-inspect search --dir fixtures/traces --status error --limit 5
119
+ ```
120
+
121
+ Docs: [CLI.md](CLI.md) § search
122
+
123
+ ### Diff two runs
124
+
125
+ ![Diff comparing success and error runs](assets/demos/diff-runs.gif)
126
+
127
+ ```bash
128
+ agent-inspect diff minimal-success minimal-error --dir fixtures/traces
129
+ ```
130
+
131
+ Docs: [DIFF.md](DIFF.md)
132
+
133
+ ### Markdown export
134
+
135
+ ![Export a run to Markdown locally](assets/demos/markdown-export.gif)
136
+
137
+ ```bash
138
+ agent-inspect export minimal-success --dir fixtures/traces --format markdown
139
+ ```
140
+
141
+ Docs: [EXPORTS.md](EXPORTS.md)
142
+
143
+ ### HTML / OpenInference / OTLP
144
+
145
+ - **HTML:** rendered-report visual pending re-record; export command in [EXPORTS.md](EXPORTS.md).
146
+ - **OpenInference / OTLP JSON:** compatibility-oriented local formats — see prose and `--validate` in [EXPORTS.md](EXPORTS.md), not dedicated GIFs.
147
+
148
+ ---
149
+
150
+ ## Integrations and optional UI
151
+
152
+ ### LangChain persistence
153
+
154
+ ![LangChain callback with persist true writing inspectable JSONL](assets/demos/langchain-persistence.gif)
155
+
156
+ Run: [examples/08-langchain-adapter](../examples/08-langchain-adapter/README.md) · [ADAPTERS.md](ADAPTERS.md)
157
+
158
+ Streaming metadata (`stream: true`) demo pending re-record until `chunkCount` / `streamDurationMs` are non-null.
159
+
160
+ ### Optional TUI (`@agent-inspect/tui`)
161
+
162
+ ![Optional Ink TUI viewer for a local trace](assets/demos/tui-viewer.gif)
163
+
164
+ Requires optional package: `pnpm add @agent-inspect/tui`
165
+ Command: `agent-inspect view <run-id> --tui`
166
+ Docs: [ADAPTERS.md](ADAPTERS.md)
167
+
168
+ ---
169
+
170
+ ## Safety and sharing
171
+
172
+ ### Default metadata redaction
173
+
174
+ ![Sensitive metadata keys redacted before disk](assets/demos/redaction.gif)
175
+
176
+ Profiles (`local` / `share` / `strict`) and export redaction: [SAFE-TRACE-SHARING.md](SAFE-TRACE-SHARING.md)
177
+
178
+ ### Event size bounds
179
+
180
+ Described in [LIMITATIONS.md](LIMITATIONS.md) — no GIF (static explanation preferred).
181
+
182
+ ### Correlation metadata
183
+
184
+ Described in [API.md](API.md) — optional `correlationId`, `requestId`, `decisionId`, `groupId` on `run_started`.
185
+
186
+ ---
187
+
188
+ ## Planned checklist (completed items)
189
+
190
+ - [x] Basic trace tree (`inspectRun` + `step`)
191
+ - [x] Failed step rendering
192
+ - [x] `agent-inspect logs` output (JSON) — **re-record pending**
193
+ - [x] `agent-inspect diff` output
194
+ - [x] Optional TUI (`view --tui`)
195
+ - [x] `timeline`, `stats`, `search` (v1.4.0)