agent-inspect 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/README.md +12 -4
- package/docs/API.md +124 -9
- package/docs/ARCHITECTURE.md +4 -0
- package/docs/CLI.md +41 -12
- package/docs/KNOWN-ISSUES.md +8 -1
- package/docs/LIMITATIONS.md +11 -2
- package/docs/SCHEMA.md +16 -6
- package/package.json +21 -1
- package/packages/cli/dist/index.cjs +2449 -157
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +2450 -158
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/core/dist/advanced.cjs +839 -18
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.d.cts +98 -3
- package/packages/core/dist/advanced.d.ts +98 -3
- package/packages/core/dist/advanced.mjs +7 -4
- package/packages/core/dist/chunk-57S5D6HR.mjs +655 -0
- package/packages/core/dist/chunk-57S5D6HR.mjs.map +1 -0
- package/packages/core/dist/chunk-6QSLZCBJ.mjs +743 -0
- package/packages/core/dist/chunk-6QSLZCBJ.mjs.map +1 -0
- package/packages/core/dist/chunk-6SZPTECC.mjs +342 -0
- package/packages/core/dist/chunk-6SZPTECC.mjs.map +1 -0
- package/packages/core/dist/{chunk-QX3ZMPUF.mjs → chunk-74XZ6N7Q.mjs} +13 -55
- package/packages/core/dist/chunk-74XZ6N7Q.mjs.map +1 -0
- package/packages/core/dist/{chunk-QPAU2TPA.mjs → chunk-HR7G62IE.mjs} +4 -4
- package/packages/core/dist/{chunk-QPAU2TPA.mjs.map → chunk-HR7G62IE.mjs.map} +1 -1
- package/packages/core/dist/chunk-S4YWKV4G.mjs +48 -0
- package/packages/core/dist/chunk-S4YWKV4G.mjs.map +1 -0
- package/packages/core/dist/chunk-TFLPUZ56.mjs +1571 -0
- package/packages/core/dist/chunk-TFLPUZ56.mjs.map +1 -0
- package/packages/core/dist/{chunk-Q6EPNB3V.mjs → chunk-TZISEVLQ.mjs} +34 -183
- package/packages/core/dist/chunk-TZISEVLQ.mjs.map +1 -0
- package/packages/core/dist/chunk-U2BGPESY.mjs +150 -0
- package/packages/core/dist/chunk-U2BGPESY.mjs.map +1 -0
- package/packages/core/dist/chunk-VTIB5MDK.mjs +304 -0
- package/packages/core/dist/chunk-VTIB5MDK.mjs.map +1 -0
- package/packages/core/dist/{chunk-5EMIZZXD.mjs → chunk-Y56BPA3B.mjs} +87 -4
- package/packages/core/dist/chunk-Y56BPA3B.mjs.map +1 -0
- package/packages/core/dist/diff.d.cts +3 -2
- package/packages/core/dist/diff.d.ts +3 -2
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.d.cts +3 -2
- package/packages/core/dist/exporters.d.ts +3 -2
- package/packages/core/dist/exporters.mjs +2 -2
- package/packages/core/dist/index.cjs +2975 -229
- package/packages/core/dist/index.cjs.map +1 -1
- package/packages/core/dist/index.d.cts +27 -6
- package/packages/core/dist/index.d.ts +27 -6
- package/packages/core/dist/index.mjs +113 -60
- package/packages/core/dist/index.mjs.map +1 -1
- package/packages/core/dist/{log-config-BzGmDYum.d.cts → inspect-event-Des4JDHo.d.cts} +1 -31
- package/packages/core/dist/{log-config-BzGmDYum.d.ts → inspect-event-Des4JDHo.d.ts} +1 -31
- package/packages/core/dist/log-config-BnH8Ykcb.d.cts +33 -0
- package/packages/core/dist/log-config-C1GcJPIM.d.ts +33 -0
- package/packages/core/dist/logs.d.cts +3 -2
- package/packages/core/dist/logs.d.ts +3 -2
- package/packages/core/dist/logs.mjs +3 -3
- package/packages/core/dist/persisted-inspect-event-0kaRADsp.d.cts +56 -0
- package/packages/core/dist/persisted-inspect-event-DiFto0K2.d.ts +56 -0
- package/packages/core/dist/persisted.cjs +38 -40
- package/packages/core/dist/persisted.cjs.map +1 -1
- package/packages/core/dist/persisted.d.cts +6 -55
- package/packages/core/dist/persisted.d.ts +6 -55
- package/packages/core/dist/persisted.mjs +4 -2
- package/packages/core/dist/readers.cjs +2590 -0
- package/packages/core/dist/readers.cjs.map +1 -0
- package/packages/core/dist/readers.d.cts +80 -0
- package/packages/core/dist/readers.d.ts +80 -0
- package/packages/core/dist/readers.mjs +9 -0
- package/packages/core/dist/readers.mjs.map +1 -0
- package/packages/core/dist/{types-CNbheSdk.d.cts → types-DB8jB6Jg.d.cts} +7 -1
- package/packages/core/dist/{types-Bkt7LS01.d.ts → types-tSix7tfv.d.ts} +7 -1
- package/packages/core/dist/writers.cjs +997 -0
- package/packages/core/dist/writers.cjs.map +1 -0
- package/packages/core/dist/writers.d.cts +62 -0
- package/packages/core/dist/writers.d.ts +62 -0
- package/packages/core/dist/writers.mjs +9 -0
- package/packages/core/dist/writers.mjs.map +1 -0
- package/packages/core/dist/chunk-5EMIZZXD.mjs.map +0 -1
- package/packages/core/dist/chunk-Q6EPNB3V.mjs.map +0 -1
- package/packages/core/dist/chunk-QX3ZMPUF.mjs.map +0 -1
- package/packages/core/dist/chunk-XDBND27A.mjs +0 -975
- package/packages/core/dist/chunk-XDBND27A.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.6.0
|
|
4
|
+
|
|
5
|
+
Released **2026-06-25**.
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added experimental `agent-inspect/writers` subpath with `TraceWriter`, `fileWriter`, `bufferedFileWriter`, `compositeWriter`, `memoryWriter`, and `nullWriter` as the first v1.6 runtime foundation slice.
|
|
10
|
+
- Added experimental `createInspectorRuntime()` as the low-level instance-scoped runtime foundation.
|
|
11
|
+
- Added experimental `createInspector()` public instance API for isolated local tracing with explicit writers.
|
|
12
|
+
- Added experimental `agent-inspect/readers` subpath with the `TraceReader` contract, deterministic format detection, `readTrace()`, and `openTrace()` for future local ingestion readers.
|
|
13
|
+
- Added the default AgentInspect JSONL reader behind `readTrace()` / `openTrace()` for v0.1, v0.2, and mixed local trace files.
|
|
14
|
+
- Added local OpenInference JSON and OTLP JSON readers behind `agent-inspect/readers`.
|
|
15
|
+
- Added `agent-inspect open` for local AgentInspect JSONL, OpenInference JSON, OTLP JSON, directory, and stdin ingestion through the canonical reader pipeline.
|
|
16
|
+
- Added deterministic runtime/universal-ingestion recipe coverage for memory writer, buffered writer, `createInspector()`, explicit formats, stdin, and safe shutdown.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Shared inspection commands now route AgentInspect JSONL loading through the canonical reader pipeline where compatible.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- Corrects the published CLI version path so `agent-inspect --version` reports the public package version.
|
|
25
|
+
- Makes `list`, `stats`, and `search` use the canonical dual-format read path for v0.1 and v0.2 trace files.
|
|
26
|
+
- Applies `report --redaction-profile share|strict` to the complete report, not only the execution tree section.
|
|
27
|
+
- Preserves mixed v0.1/v0.2 source ordering during normalization.
|
|
28
|
+
- Preserves error stack fidelity when converting persisted v0.2 events; `error.name` is no longer mapped to v0.1 `stack`.
|
|
29
|
+
- Preserves supported token usage fields across converters and inspection summaries: `input`, `output`, `total`, and `cached`.
|
|
30
|
+
|
|
31
|
+
### Notes
|
|
32
|
+
|
|
33
|
+
- Manual trace writing remains `schemaVersion: "0.1"`.
|
|
34
|
+
- v0.2 remains an experimental persisted-event foundation and dual-read input format, not the default writer.
|
|
35
|
+
- No provider pricing, token counting, cost engine, vendor upload, hosted ingestion, replay, or default telemetry behavior is included.
|
|
36
|
+
- This release includes corrective work accumulated after v1.5.0 plus the v1.6.0 runtime/reader foundation.
|
|
37
|
+
|
|
3
38
|
## 1.5.0
|
|
4
39
|
|
|
5
40
|
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.
|
|
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.
|
|
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.
|
|
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,12 @@ 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
|
+
|
|
209
213
|
**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
214
|
|
|
215
|
+
**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).
|
|
216
|
+
|
|
211
217
|
**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
218
|
|
|
213
219
|
**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 +289,8 @@ The TUI is available as a separate optional package; its programmatic API is exp
|
|
|
283
289
|
| [examples/recipes/retry-fallback](examples/recipes/retry-fallback) | Fallback pattern |
|
|
284
290
|
| [examples/recipes/parallel-tools](examples/recipes/parallel-tools) | Parallel tools |
|
|
285
291
|
| [examples/recipes/github-actions-artifact](examples/recipes/github-actions-artifact) | CI trace artifacts |
|
|
292
|
+
| [examples/recipes/what-report-inspect](examples/recipes/what-report-inspect/) | `what` + `report` inspection |
|
|
293
|
+
| [examples/recipes/runtime-and-ingestion](examples/recipes/runtime-and-ingestion/) | v1.6 runtime writers + universal ingestion |
|
|
286
294
|
|
|
287
295
|
**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
296
|
|
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
|
-
**
|
|
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:
|
|
@@ -172,11 +174,11 @@ Related types: `PersistedInspectEvent`, `PersistedEventSourceType`, `PersistedEv
|
|
|
172
174
|
|
|
173
175
|
- Manual trace **writing** remains `schemaVersion: "0.1"`.
|
|
174
176
|
- v0.2 is **not written by default**; use converters and `fixtures/traces-v0.2/` samples for validation.
|
|
175
|
-
-
|
|
177
|
+
- 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
178
|
|
|
177
|
-
## 12. Local observability helpers (v1.4.0)
|
|
179
|
+
## 12. Local observability helpers (v1.4.0+)
|
|
178
180
|
|
|
179
|
-
Read-only helpers for timeline, stats, and search over manual
|
|
181
|
+
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
182
|
|
|
181
183
|
- **`buildRunTimeline`**, **`renderTimeline`** — chronological run view; types `RunTimeline`, `TimelineEntry`
|
|
182
184
|
- **`buildTraceStats`**, **`renderTraceStats`** — directory aggregates; type `TraceStats`
|
|
@@ -184,23 +186,137 @@ Read-only helpers for timeline, stats, and search over manual `TraceEvent` JSONL
|
|
|
184
186
|
|
|
185
187
|
CLI wrappers: `agent-inspect timeline`, `stats`, `search` — see [CLI.md](./CLI.md).
|
|
186
188
|
|
|
187
|
-
## 13.
|
|
189
|
+
## 13. Report and what helpers (v1.5.0+)
|
|
190
|
+
|
|
191
|
+
Read-only helpers for concise inspection summaries and local reports:
|
|
192
|
+
|
|
193
|
+
- **`buildRunWhatSummary`**, **`renderRunWhat`** — summarize status, duration, step counts, correlation metadata, slowest step, errors, and supplied token usage.
|
|
194
|
+
- **`buildRunReport`** — render Markdown or HTML reports from local trace events.
|
|
195
|
+
|
|
196
|
+
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.
|
|
197
|
+
|
|
198
|
+
## 14. Experimental trace writers (v1.6)
|
|
199
|
+
|
|
200
|
+
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.
|
|
201
|
+
|
|
202
|
+
Import from `agent-inspect/writers`:
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
import {
|
|
206
|
+
bufferedFileWriter,
|
|
207
|
+
compositeWriter,
|
|
208
|
+
fileWriter,
|
|
209
|
+
memoryWriter,
|
|
210
|
+
nullWriter,
|
|
211
|
+
} from "agent-inspect/writers";
|
|
212
|
+
import type {
|
|
213
|
+
BufferedFileWriterOptions,
|
|
214
|
+
CompositeTraceWriterOptions,
|
|
215
|
+
FileTraceWriterOptions,
|
|
216
|
+
TraceWriter,
|
|
217
|
+
TraceWriterStats,
|
|
218
|
+
} from "agent-inspect/writers";
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
- **`TraceWriter`**: async `write(event)`, optional `flush()`, optional `close()`, optional `getStats()`.
|
|
222
|
+
- **`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.
|
|
223
|
+
- **`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.
|
|
224
|
+
- **`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.
|
|
225
|
+
- **`memoryWriter()`**: stores cloned `PersistedInspectEvent` rows in memory for tests, adapter fixtures, and eval harnesses.
|
|
226
|
+
- **`nullWriter()`**: accepts events without retaining them for disabled mode, overhead comparisons, and no-output tests.
|
|
227
|
+
|
|
228
|
+
No network writer or vendor sink exists in this package.
|
|
229
|
+
|
|
230
|
+
## 15. Experimental inspector API/runtime (v1.6)
|
|
231
|
+
|
|
232
|
+
`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.
|
|
233
|
+
|
|
234
|
+
Import from `agent-inspect/advanced`:
|
|
235
|
+
|
|
236
|
+
```ts
|
|
237
|
+
import { createInspector } from "agent-inspect/advanced";
|
|
238
|
+
import { memoryWriter } from "agent-inspect/writers";
|
|
239
|
+
|
|
240
|
+
const writer = memoryWriter();
|
|
241
|
+
const inspector = createInspector({
|
|
242
|
+
writer,
|
|
243
|
+
capture: { onSuccess: "metadata-only", onError: "metadata-only" },
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
await inspector.run("support-agent", async () => {
|
|
247
|
+
await inspector.step("plan", async () => "ok");
|
|
248
|
+
await inspector.tool("retrieve-policy", async () => "policy");
|
|
249
|
+
return inspector.llm("fixture-model", async () => "done");
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
await inspector.flush();
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Public methods:
|
|
256
|
+
|
|
257
|
+
- **`run(name, fn, options?)`**: starts an isolated run context and writes run lifecycle events.
|
|
258
|
+
- **`step(name, fn, options?)`**: writes nested step lifecycle events when called inside the same inspector's run context; outside a context it passes through.
|
|
259
|
+
- **`tool(name, fn, options?)`** / **`llm(name, fn, options?)`**: convenience wrappers that set `type` and metadata.
|
|
260
|
+
- **`observe(name, fn, options?)`**: returns an async wrapper that records the function call as an inspector step.
|
|
261
|
+
- **`getDiagnostics()`**: returns instrumentation error counts and writer stats without requiring direct runtime access.
|
|
262
|
+
- **`flush()`** / **`close()`**: delegate to the configured writer through the runtime.
|
|
263
|
+
|
|
264
|
+
`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.
|
|
265
|
+
|
|
266
|
+
`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 })`.
|
|
267
|
+
|
|
268
|
+
`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`.
|
|
269
|
+
|
|
270
|
+
These APIs are experimental during v1.x. They do not add a default network writer or vendor sink.
|
|
271
|
+
|
|
272
|
+
## 16. Experimental trace readers (v1.6)
|
|
273
|
+
|
|
274
|
+
`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.
|
|
275
|
+
|
|
276
|
+
Import from `agent-inspect/readers`:
|
|
277
|
+
|
|
278
|
+
```ts
|
|
279
|
+
import {
|
|
280
|
+
DEFAULT_TRACE_READERS,
|
|
281
|
+
agentInspectJsonlReader,
|
|
282
|
+
detectTraceFormat,
|
|
283
|
+
openInferenceJsonReader,
|
|
284
|
+
openTrace,
|
|
285
|
+
otlpJsonReader,
|
|
286
|
+
readTrace,
|
|
287
|
+
} from "agent-inspect/readers";
|
|
288
|
+
import type { TraceReader } from "agent-inspect/readers";
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
- **`TraceInput`**: file, directory, string, buffer, or stdin input descriptor.
|
|
292
|
+
- **`TraceReader`**: experimental reader interface with `format`, `detect(input)`, and `read(input)`.
|
|
293
|
+
- **`detectTraceFormat(input, { readers?, format? })`**: deterministic, conservative format detection. Explicit `format` acts as an override only when a matching reader is registered.
|
|
294
|
+
- **`readTrace(input, { readers?, format? })`**: detects a reader and returns `TraceReadResult`; unsupported or ambiguous input throws `TraceReadError`.
|
|
295
|
+
- **`openTrace(input, options?)`**: alias for `readTrace()` and the API path used by the universal `agent-inspect open` command.
|
|
296
|
+
- **`agentInspectJsonlReader`**: built-in local AgentInspect JSONL reader for v0.1, v0.2, and mixed files/directories.
|
|
297
|
+
- **`openInferenceJsonReader`**: local OpenInference JSON compatibility reader. Prompt/output-like attributes are summarized and bounded rather than stored as raw content.
|
|
298
|
+
- **`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.
|
|
299
|
+
- **`DEFAULT_TRACE_READERS`**: ordered built-in reader registry used when no custom `readers` array is supplied.
|
|
300
|
+
|
|
301
|
+
The reader contract does not silently accept arbitrary JSON and does not add OTel SDK, database, hosted ingestion, or network upload dependencies.
|
|
302
|
+
|
|
303
|
+
## 17. Deprecated APIs
|
|
188
304
|
|
|
189
305
|
No deprecated APIs are declared as of 1.4.0.
|
|
190
306
|
|
|
191
|
-
##
|
|
307
|
+
## 18. Removal / deprecation policy
|
|
192
308
|
|
|
193
309
|
- Stable APIs are not removed in v1.x.
|
|
194
310
|
- 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
311
|
|
|
196
|
-
##
|
|
312
|
+
## 19. Backward compatibility policy
|
|
197
313
|
|
|
198
314
|
- Manual trace JSONL (`schemaVersion: "0.1"`) remains readable.
|
|
199
315
|
- Additive schema changes are allowed in minor versions.
|
|
200
316
|
- Breaking changes require a major version.
|
|
201
317
|
- Unknown fields should be ignored where safe.
|
|
202
318
|
|
|
203
|
-
##
|
|
319
|
+
## 20. Examples
|
|
204
320
|
|
|
205
321
|
### Minimal manual trace
|
|
206
322
|
|
|
@@ -214,4 +330,3 @@ await inspectRun("demo-agent", async () => {
|
|
|
214
330
|
return { plan, hits, answer };
|
|
215
331
|
});
|
|
216
332
|
```
|
|
217
|
-
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -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 `
|
|
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.
|
|
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
|

|
|
274
304
|
|
|
275
|
-
### 6.
|
|
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.
|
|
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
|

|
|
324
354
|
|
|
325
|
-
### 6.
|
|
355
|
+
### 6.12 `what`
|
|
326
356
|
|
|
327
|
-
Concise human-readable summary of one
|
|
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.
|
|
384
|
+
### 6.13 `report`
|
|
355
385
|
|
|
356
|
-
Generate a local inspection report combining **what happened**, **timeline**, and **execution tree** sections.
|
|
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>` —
|
|
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
|
-
|
package/docs/KNOWN-ISSUES.md
CHANGED
|
@@ -12,6 +12,13 @@ AgentInspect is **local-first** and **CLI-first**. These behaviors are intention
|
|
|
12
12
|
- **OpenInference** and **OTLP JSON** exports are **compatibility-oriented** and **experimental**. Validate against your target collector or backend before relying on them.
|
|
13
13
|
- Exports generate **strings/files locally** only—there is **no** automatic upload.
|
|
14
14
|
|
|
15
|
+
## Readers and `open`
|
|
16
|
+
|
|
17
|
+
- **OpenInference** and **OTLP JSON** readers are **compatibility-oriented** and **experimental**. They normalize local JSON payloads into AgentInspect inspection trees and may warn on unsupported semantic fields.
|
|
18
|
+
- `agent-inspect open` requires `--run <run-id>` when input contains multiple runs. It does not pick an arbitrary run silently.
|
|
19
|
+
- Format detection is conservative. Use `--format agent-inspect-jsonl`, `--format openinference-json`, or `--format otlp-json` for known local inputs.
|
|
20
|
+
- Standards JSON readers summarize bounded prompt/output-like attributes; they do not make raw prompt/output capture a default AgentInspect behavior.
|
|
21
|
+
|
|
15
22
|
## Integrations
|
|
16
23
|
|
|
17
24
|
- **Vendor sinks** (hosted dashboards, Langfuse/Braintrust/New Relic/Datadog native uploads, OTLP gRPC streaming, etc.) are **not implemented** in the core packages described here.
|
|
@@ -31,7 +38,7 @@ AgentInspect is **local-first** and **CLI-first**. These behaviors are intention
|
|
|
31
38
|
|
|
32
39
|
## Cost / tokens
|
|
33
40
|
|
|
34
|
-
- **Token counting** and **cost calculation** are **not** core features.
|
|
41
|
+
- **Token counting** and **cost calculation** are **not** core features. Token usage fields (`input`, `output`, `total`, `cached`) are displayed only when supplied by user code, fixtures, or adapters.
|
|
35
42
|
|
|
36
43
|
## Confidence labels
|
|
37
44
|
|
package/docs/LIMITATIONS.md
CHANGED
|
@@ -16,8 +16,16 @@ This document states what AgentInspect **does not** provide today. It complement
|
|
|
16
16
|
## Persisted event model (v1.2.0 foundation)
|
|
17
17
|
|
|
18
18
|
- **v0.2 is not the default persisted trace file format.** `inspectRun()` / `step()` still write `schemaVersion: "0.1"` JSONL.
|
|
19
|
-
- **
|
|
20
|
-
- **
|
|
19
|
+
- **Dual-format inspection is a read path, not a write migration.** `list`, `view`, `timeline`, `stats`, `search`, `diff`, `export`, `what`, and `report` read v0.1/v0.2 trace files through normalization where applicable. `logs` and `tail` remain structured-log ingestion commands, not v0.2 writers.
|
|
20
|
+
- **Default write path remains v0.1.** v0.2 fixtures and converters are available for adapters and migration testing, but AgentInspect does not automatically rewrite traces.
|
|
21
|
+
|
|
22
|
+
## Runtime writers and universal readers (v1.6)
|
|
23
|
+
|
|
24
|
+
- **Experimental APIs:** `agent-inspect/writers`, `agent-inspect/readers`, and `createInspector()` are available for local adoption, but their experimental contracts may be refined in v1.x.
|
|
25
|
+
- **Explicit writer ownership:** `createInspector()` does not print terminal lifecycle output or implicitly choose a disk writer. Use `fileWriter()` / `bufferedFileWriter()` / custom writers when persistence is desired.
|
|
26
|
+
- **No standards upload:** OpenInference and OTLP JSON support is local read/export compatibility only. There is no OTLP gRPC/HTTP streaming sink, collector client, or hosted ingestion behavior.
|
|
27
|
+
- **Conservative detection:** `agent-inspect open` does not silently accept arbitrary JSON. Unsupported or ambiguous inputs produce errors/warnings rather than guessed traces.
|
|
28
|
+
- **Large inputs:** reader inputs are bounded and read into local memory. This is not a database index or production log warehouse.
|
|
21
29
|
|
|
22
30
|
## LangChain streaming (v1.3.0)
|
|
23
31
|
|
|
@@ -47,6 +55,7 @@ This document states what AgentInspect **does not** provide today. It complement
|
|
|
47
55
|
## Economics
|
|
48
56
|
|
|
49
57
|
- **No cost engine**: no pricing tables, invoice-grade usage, or provider billing reconciliation.
|
|
58
|
+
- **Token usage is supplied metadata only**: AgentInspect may display `input`, `output`, `total`, and `cached` counts when callers/adapters provide them; core does not count tokens or infer provider billing.
|
|
50
59
|
|
|
51
60
|
## Local observability commands (v1.4.0)
|
|
52
61
|
|
package/docs/SCHEMA.md
CHANGED
|
@@ -210,8 +210,9 @@ v1.2.0 introduces a **source-agnostic persisted event model** as an experimental
|
|
|
210
210
|
| ----- | ---- |
|
|
211
211
|
| Default write format | Manual traces still use **`schemaVersion: "0.1"`** (`run_started`, `step_started`, `step_completed`, `run_completed`). |
|
|
212
212
|
| v0.2 role | Unified persisted shape for manual traces, log-derived events, adapter events, and future AI SDK / OTel mappings. |
|
|
213
|
-
| v0.2 file writing | **Not enabled by default**
|
|
214
|
-
| v0.1 compatibility | v0.2 does **not** replace v0.1 in
|
|
213
|
+
| v0.2 file writing | **Not enabled by default** — converters and fixtures only unless a caller writes v0.2 data explicitly. |
|
|
214
|
+
| v0.1 compatibility | v0.2 does **not** replace v0.1 in v1.x; existing `0.1` files remain canonical for manual writing and continue to be readable. |
|
|
215
|
+
| v0.2 read path | Inspection read paths normalize v0.1 and v0.2 JSONL for local CLI/API use. |
|
|
215
216
|
| Failures | Still **no** `step_failed`; use `status: "error"` on the persisted event. |
|
|
216
217
|
|
|
217
218
|
Canonical samples: `fixtures/traces-v0.2/*.jsonl` (validated by `pnpm fixtures:check`).
|
|
@@ -235,13 +236,22 @@ Canonical samples: `fixtures/traces-v0.2/*.jsonl` (validated by `pnpm fixtures:c
|
|
|
235
236
|
| `attributes` | no | Shallow metadata bag (redaction-ready) |
|
|
236
237
|
| `inputSummary` / `outputSummary` | no | Truncated previews when explicitly captured |
|
|
237
238
|
| `error` | no | `{ name?, message, code? }` when `status: "error"` |
|
|
238
|
-
| `tokenUsage` | no | `{ input?, output?, total? }` when known |
|
|
239
|
+
| `tokenUsage` | no | `{ input?, output?, total?, cached? }` when supplied/known |
|
|
239
240
|
| `trace` | no | Optional `{ traceId?, spanId?, parentSpanId? }` for future OTel alignment |
|
|
240
241
|
|
|
241
242
|
Programmatic helpers: see [API.md](./API.md) §11 (experimental persisted-event foundation).
|
|
242
243
|
|
|
243
|
-
## 15.
|
|
244
|
+
## 15. v1.6 local reader/writer compatibility
|
|
244
245
|
|
|
245
|
-
|
|
246
|
-
|
|
246
|
+
v1.6 adds experimental writer and reader surfaces without changing the stable manual trace schema:
|
|
247
|
+
|
|
248
|
+
- `inspectRun()` / `step()` continue to write `schemaVersion: "0.1"` JSONL by default.
|
|
249
|
+
- `createInspector()` can write explicit v0.2 `PersistedInspectEvent` rows when configured with a writer such as `fileWriter()` or `bufferedFileWriter()`.
|
|
250
|
+
- `agent-inspect/readers` and `agent-inspect open` read local AgentInspect JSONL, OpenInference JSON, and OTLP JSON inputs through compatibility adapters.
|
|
251
|
+
- OpenInference and OTLP JSON inputs are **not** a third AgentInspect persisted schema. They are local read formats normalized into inspection trees with warnings and unsupported-field reporting.
|
|
252
|
+
- Reader and writer APIs perform no network upload and do not mutate source files.
|
|
247
253
|
|
|
254
|
+
## 16. Migration notes
|
|
255
|
+
|
|
256
|
+
- Minor releases may add optional fields/events, but must keep existing v0.1 traces readable.
|
|
257
|
+
- v0.1 → v0.2 write migration guides are future work. v1.x inspection readers are dual-format; the default manual writer remains v0.1.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-inspect",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Local-first execution-tree debugger for TypeScript AI agents",
|
|
@@ -75,6 +75,26 @@
|
|
|
75
75
|
"types": "./packages/core/dist/diff.d.cts",
|
|
76
76
|
"default": "./packages/core/dist/diff.cjs"
|
|
77
77
|
}
|
|
78
|
+
},
|
|
79
|
+
"./writers": {
|
|
80
|
+
"import": {
|
|
81
|
+
"types": "./packages/core/dist/writers.d.ts",
|
|
82
|
+
"default": "./packages/core/dist/writers.mjs"
|
|
83
|
+
},
|
|
84
|
+
"require": {
|
|
85
|
+
"types": "./packages/core/dist/writers.d.cts",
|
|
86
|
+
"default": "./packages/core/dist/writers.cjs"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"./readers": {
|
|
90
|
+
"import": {
|
|
91
|
+
"types": "./packages/core/dist/readers.d.ts",
|
|
92
|
+
"default": "./packages/core/dist/readers.mjs"
|
|
93
|
+
},
|
|
94
|
+
"require": {
|
|
95
|
+
"types": "./packages/core/dist/readers.d.cts",
|
|
96
|
+
"default": "./packages/core/dist/readers.cjs"
|
|
97
|
+
}
|
|
78
98
|
}
|
|
79
99
|
},
|
|
80
100
|
"bin": {
|