agent-inspect 1.1.0 → 1.3.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.
@@ -32,3 +32,56 @@ AgentInspect is **local-first** and **CLI-first**. These behaviors are intention
32
32
  - Log-derived trees carry **confidence** (`explicit`, `correlated`, `heuristic`, `unknown`). Labels explain **how** relationships were inferred—they are not semantic proof.
33
33
 
34
34
  When in doubt, treat AgentInspect as a **debugging aid**, not a compliance or billing system of record.
35
+
36
+ ## Common install/runtime compatibility checks
37
+
38
+ Use these before filing a packaging bug. AgentInspect targets **Node.js ≥ 20**.
39
+
40
+ ### Quick self-check (clean temp project)
41
+
42
+ ```bash
43
+ mkdir /tmp/agent-inspect-check && cd /tmp/agent-inspect-check
44
+ npm init -y
45
+ npm install agent-inspect@latest
46
+ node -e "import('agent-inspect').then(m => console.log('esm', typeof m.inspectRun))"
47
+ node -e "const m=require('agent-inspect'); console.log('cjs', typeof m.inspectRun, typeof m.maybeInspectRun)"
48
+ npx agent-inspect --help
49
+ ```
50
+
51
+ From a **repo clone** (maintainers / contributors):
52
+
53
+ ```bash
54
+ pnpm install --frozen-lockfile
55
+ pnpm build
56
+ pnpm compat:smoke
57
+ ```
58
+
59
+ ### ESM import
60
+
61
+ - Consumer `package.json` should use `"type": "module"` (or `.mjs` entry files).
62
+ - Import: `import { inspectRun, step, maybeInspectRun } from "agent-inspect"`.
63
+ - TypeScript: `module` / `moduleResolution` `NodeNext` or `Node16` with matching `type` field.
64
+
65
+ ### CJS require
66
+
67
+ - Consumer `package.json` should use `"type": "commonjs"` (or `.cjs` entry files).
68
+ - Require: `const { inspectRun, step, maybeInspectRun } = require("agent-inspect")`.
69
+ - TypeScript: compile `.cts` with `module` / `moduleResolution` `Node16`.
70
+
71
+ **Note:** `chalk@5` and `nanoid@5` are ESM-only upstream. Published `agent-inspect` bundles them into CJS output so Jest 29 / `require()` consumers do not resolve ESM-only deps at runtime. If you still see `ERR_REQUIRE_ESM`, report Node version, bundler, and full stack trace.
72
+
73
+ ### Jest / ts-jest (CJS)
74
+
75
+ - Prefer `require("agent-inspect")` in CJS test files, or ensure your Jest config supports the package's export conditions.
76
+ - For tracing off in unit tests: `maybeInspectRun(name, fn, { enabled: false })` or unset `AGENT_INSPECT`.
77
+ - Fixture pattern: [test/consumer-fixtures/jest-cjs/](../../test/consumer-fixtures/jest-cjs/).
78
+ - Full Jest runner smoke in CI is a documented follow-up — root package does not ship Jest as a devDependency.
79
+
80
+ ### What to include in a bug report
81
+
82
+ - Node.js version (`node -v`)
83
+ - Package manager and lockfile type (npm / pnpm / yarn)
84
+ - ESM vs CJS vs TypeScript + ts-jest
85
+ - Minimal repro repo or snippet
86
+ - Full error stack (not only the top line)
87
+ - Whether `AGENT_INSPECT` is set in the environment
@@ -9,6 +9,22 @@ This document states what AgentInspect **does not** provide today. It complement
9
9
  - **No vendor upload pipeline**: no built-in Langfuse/Braintrust/New Relic/Datadog direct exporters as live sinks.
10
10
  - **No automatic universal instrumentation** of every framework: integration is explicit (manual traces, log ingest, optional adapters).
11
11
 
12
+ ## Correlation metadata (v1.3.0 chunk 1)
13
+
14
+ - **No CLI filter/query** by `correlationId`, `requestId`, `decisionId`, or `groupId` yet — fields are written to `run_started.metadata` and available via persisted converters; list/view/export filtering is future work.
15
+
16
+ ## Persisted event model (v1.2.0 foundation)
17
+
18
+ - **v0.2 is not the default persisted trace file format.** `inspectRun()` / `step()` still write `schemaVersion: "0.1"` JSONL.
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.
21
+
22
+ ## LangChain streaming (v1.3.0)
23
+
24
+ - **Metadata-focused only** — `stream: true` records chunk counts, timing, and optional bounded previews; it is **not** a replay/cassette system.
25
+ - **No full token stream storage by default** — even with `stream: true`, `capture: "metadata-only"` does not persist raw streamed text.
26
+ - **No per-token JSONL events** — streaming does not emit one trace line per token.
27
+
12
28
  ## Data fidelity
13
29
 
14
30
  - **No full prompt/output capture by default** for manual traces (by design: safety and PII risk).
@@ -17,6 +33,7 @@ This document states what AgentInspect **does not** provide today. It complement
17
33
 
18
34
  ## Trace safety bounds
19
35
 
36
+ - **Redaction profiles** (`local`, `share`, `strict`) are key-based presets — not compliance-grade PII detection. Review exports before sharing even with `--redaction-profile strict`.
20
37
  - **Default metadata redaction** covers common sensitive keys only (exact key match, case-insensitive). Custom secret field names are not redacted unless you add rules via `redact: { rules: [...] }`.
21
38
  - **Metadata truncation** applies to string values and nested structures; very large metadata may be replaced with a truncation marker when `maxEventBytes` is exceeded (default 64 KiB per JSONL line).
22
39
  - **Redaction is not encryption.** Local trace files remain readable on disk; treat `.agent-inspect-runs/` like any developer artifact that may contain operational data.
package/docs/SCHEMA.md CHANGED
@@ -129,6 +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
133
  - Steps may include `metadata` on `step_started`.
133
134
  - Manual traces intentionally avoid full prompt/output capture by default.
134
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`.
@@ -198,8 +199,46 @@ Always review any exported content (Markdown/HTML/OpenInference/OTLP JSON) befor
198
199
 
199
200
  See: `SECURITY.md` and `docs/API.md` (`InspectRunOptions.redact`, size bound options).
200
201
 
201
- ## 14. Migration notes
202
+ ## 14. Persisted InspectEvent schemaVersion "0.2" — experimental foundation
203
+
204
+ v1.2.0 introduces a **source-agnostic persisted event model** as an experimental foundation. It is **not** the default on-disk format.
205
+
206
+ | Topic | Rule |
207
+ | ----- | ---- |
208
+ | Default write format | Manual traces still use **`schemaVersion: "0.1"`** (`run_started`, `step_started`, `step_completed`, `run_completed`). |
209
+ | v0.2 role | Unified persisted shape for manual traces, log-derived events, adapter events, and future AI SDK / OTel mappings. |
210
+ | v0.2 file writing | **Not enabled by default** in v1.2.0 — converters and fixtures only. |
211
+ | v0.1 compatibility | v0.2 does **not** replace v0.1 in this release; existing `0.1` files remain canonical for CLI write/read today. |
212
+ | Failures | Still **no** `step_failed`; use `status: "error"` on the persisted event. |
213
+
214
+ Canonical samples: `fixtures/traces-v0.2/*.jsonl` (validated by `pnpm fixtures:check`).
215
+
216
+ ### 14.1 Field reference (compact)
217
+
218
+ | Field | Required | Notes |
219
+ | ----- | -------- | ----- |
220
+ | `schemaVersion` | yes | `"0.2"` |
221
+ | `eventId` | yes | Stable per-event identifier |
222
+ | `runId` | yes | Run grouping key |
223
+ | `parentId` | no | Explicit nesting only when present |
224
+ | `kind` | yes | `InspectKind` (`RUN`, `LLM`, `TOOL`, `LOGIC`, …) |
225
+ | `name` | yes | Human-readable step label |
226
+ | `status` | no | `running` \| `ok` \| `error` \| `unknown` |
227
+ | `timestamp` | yes | ISO-8601 string (event time) |
228
+ | `startedAt` / `endedAt` | no | ISO-8601 bounds when known |
229
+ | `durationMs` | no | Non-negative milliseconds when known |
230
+ | `confidence` | yes | `explicit` \| `correlated` \| `heuristic` \| `unknown` |
231
+ | `source` | yes | `{ type, name?, version? }` — `manual`, `json-log`, `log4js`, `adapter`, `ai-sdk`, `otel` |
232
+ | `attributes` | no | Shallow metadata bag (redaction-ready) |
233
+ | `inputSummary` / `outputSummary` | no | Truncated previews when explicitly captured |
234
+ | `error` | no | `{ name?, message, code? }` when `status: "error"` |
235
+ | `tokenUsage` | no | `{ input?, output?, total? }` when known |
236
+ | `trace` | no | Optional `{ traceId?, spanId?, parentSpanId? }` for future OTel alignment |
237
+
238
+ Programmatic helpers: see [API.md](./API.md) §15 (experimental persisted-event foundation).
239
+
240
+ ## 15. Migration notes
202
241
 
203
242
  - Minor releases may add optional fields/events, but must keep existing v0.1 traces readable.
204
- - Migration guides (v0.1 → v1.0) are out of scope for this pass, but this document is the canonical schema reference for that future guide.
243
+ - Migration guides (v0.1 → v0.2 file format) are future work; storage/CLI dual-read is not in the v1.2.0 foundation release.
205
244
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-inspect",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Local-first execution-tree debugger for TypeScript AI agents",
@@ -97,6 +97,7 @@
97
97
  "prepublish:checks": "pnpm run typecheck && pnpm run test && pnpm run test:coverage && pnpm run build && pnpm run fixtures:check && pnpm run recipes:check && pnpm run size && pnpm run pack:smoke",
98
98
  "pack:dry-run": "pnpm run build && npm pack --dry-run",
99
99
  "pack:smoke": "pnpm run build && node scripts/package-smoke.mjs",
100
+ "compat:smoke": "node scripts/compat-smoke.mjs",
100
101
  "fixtures:check": "node scripts/validate-fixtures.mjs",
101
102
  "recipes:check": "node scripts/validate-recipes.mjs",
102
103
  "perf:baseline": "node scripts/performance-baseline.mjs",