agent-inspect 1.0.0 → 1.0.2

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.
@@ -0,0 +1,34 @@
1
+ # Known issues
2
+
3
+ AgentInspect is **local-first** and **CLI-first**. These behaviors are intentional constraints or best-effort areas—not silent guarantees.
4
+
5
+ ## Logs
6
+
7
+ - **log4js-style parsing** is **best-effort**: embedded JSON must be recoverable from the line; unusual layouts may lose fields or warn.
8
+ - **JavaScript object-style log payloads** (e.g. `{ msg: '...', meta: ... }` printed without JSON) are **not** a supported interchange format for ingestion.
9
+
10
+ ## Exports
11
+
12
+ - **OpenInference** and **OTLP JSON** exports are **compatibility-oriented** and **experimental**. Validate against your target collector or backend before relying on them.
13
+ - Exports generate **strings/files locally** only—there is **no** automatic upload.
14
+
15
+ ## Integrations
16
+
17
+ - **Vendor sinks** (hosted dashboards, Langfuse/Braintrust/New Relic/Datadog native uploads, OTLP gRPC streaming, etc.) are **not implemented** in the core packages described here.
18
+ - **LangChain adapter** captures **metadata-oriented** signals by default; it does not replace full framework observability.
19
+
20
+ ## UI / replay
21
+
22
+ - **Optional TUI** (`@agent-inspect/tui`) is separate from the default CLI and requires an interactive terminal where documented.
23
+ - **Live streaming tree inside the TUI** is not the same as **live tail** over logs; product scope varies by version—see roadmap docs.
24
+ - **Full replay / fork execution** of historical traces is **out of scope** for current MVP-style releases.
25
+
26
+ ## Cost / tokens
27
+
28
+ - **Token counting** and **cost calculation** are **not** core features.
29
+
30
+ ## Confidence labels
31
+
32
+ - Log-derived trees carry **confidence** (`explicit`, `correlated`, `heuristic`, `unknown`). Labels explain **how** relationships were inferred—they are not semantic proof.
33
+
34
+ When in doubt, treat AgentInspect as a **debugging aid**, not a compliance or billing system of record.
@@ -0,0 +1,32 @@
1
+ # Limitations
2
+
3
+ This document states what AgentInspect **does not** provide today. It complements [KNOWN-ISSUES.md](./KNOWN-ISSUES.md).
4
+
5
+ ## Product boundaries
6
+
7
+ - **No SaaS dashboard** or hosted multi-tenant product in the open-source core workflow.
8
+ - **No production APM replacement**: no sampling agents, no fleet-wide aggregation, no uptime SLAs.
9
+ - **No vendor upload pipeline**: no built-in Langfuse/Braintrust/New Relic/Datadog direct exporters as live sinks.
10
+ - **No automatic universal instrumentation** of every framework: integration is explicit (manual traces, log ingest, optional adapters).
11
+
12
+ ## Data fidelity
13
+
14
+ - **No full prompt/output capture by default** for manual traces (by design: safety and PII risk).
15
+ - **Log-derived runs** and **manual JSONL traces** may differ in fidelity (timestamps, nesting, confidence).
16
+ - **Confidence labels** qualify inferred relationships; they do not guarantee correctness.
17
+
18
+ ## Execution semantics
19
+
20
+ - **No replay / fork** of past runs from traces alone.
21
+ - **No time-travel debugging** across arbitrary runtime state.
22
+ - **No multi-run statistical evaluation** built into core.
23
+
24
+ ## Economics
25
+
26
+ - **No cost engine**: no pricing tables, invoice-grade usage, or provider billing reconciliation.
27
+
28
+ ## Scale
29
+
30
+ - Designed for **developer machines** and **inner-loop debugging**, not petabyte log warehouses.
31
+
32
+ For roadmap intent, see `docs-local/roadmap/VERSION-ROADMAP.md` and `docs-local/prd/v1.0-STABLE-LOCAL-INSPECTOR-PRD.md` (planning docs; not a promise of future features).
@@ -0,0 +1,54 @@
1
+ ## Log-to-tree quickstart
2
+
3
+ AgentInspect can inspect **structured logs** and render a local execution tree without requiring you to wrap every function in manual tracing.
4
+
5
+ ## Example JSON log lines
6
+
7
+ `agent.log` (JSONL):
8
+
9
+ ```json
10
+ {"timestamp":"2026-05-08T10:00:00.000Z","requestId":"req_123","event":"agent.started","message":"Agent started"}
11
+ {"timestamp":"2026-05-08T10:00:00.150Z","requestId":"req_123","event":"tool.search.started","tool":"searchDocs"}
12
+ {"timestamp":"2026-05-08T10:00:00.420Z","requestId":"req_123","event":"tool.search.completed","tool":"searchDocs","durationMs":270}
13
+ {"timestamp":"2026-05-08T10:00:00.500Z","requestId":"req_123","event":"llm.answer.started","model":"gpt-example"}
14
+ {"timestamp":"2026-05-08T10:00:01.100Z","requestId":"req_123","event":"llm.answer.completed","model":"gpt-example","durationMs":600}
15
+ {"timestamp":"2026-05-08T10:00:01.150Z","requestId":"req_123","event":"agent.completed","status":"ok"}
16
+ ```
17
+
18
+ ## Parse logs into trees
19
+
20
+ ```bash
21
+ npx agent-inspect logs ./agent.log \
22
+ --format json \
23
+ --run-id-key requestId \
24
+ --event-key event \
25
+ --timestamp-key timestamp
26
+ ```
27
+
28
+ Example output:
29
+
30
+ ```text
31
+ Run req_123
32
+ ├─ agent.started
33
+ ├─ tool.search.started
34
+ ├─ tool.search.completed (270ms)
35
+ ├─ llm.answer.started
36
+ ├─ llm.answer.completed (600ms)
37
+ └─ agent.completed (ok)
38
+ ```
39
+
40
+ ## Important notes
41
+
42
+ - **JSON logs are first-class**. (Line-delimited JSON is the recommended input.)
43
+ - **log4js text logs with embedded JSON are best-effort**.
44
+ - AgentInspect does **not** evaluate JavaScript object strings (`eval` is not used).
45
+ - **Flat timeline is the default** for log-derived events.
46
+ - Nesting is conservative: **explicit parent/config wins**, and inferred relationships are labeled.
47
+ - **Confidence labels** explain how relationships were inferred (`explicit`, `correlated`, `heuristic`, `unknown`).
48
+ - **Redaction** is applied where configured/defaulted for log-derived attributes and exports.
49
+
50
+ See also:
51
+ - `docs/CLI.md` (`logs`, `tail`)
52
+ - `docs/LOGS.md`
53
+ - `docs/SCHEMA.md` (log ingest config types + confidence)
54
+
package/docs/LOGS.md ADDED
@@ -0,0 +1,13 @@
1
+ ## Logs (structured log → tree)
2
+
3
+ AgentInspect can parse **existing logs** (line-delimited JSON, and best-effort log4js-style text with embedded JSON) into a local execution tree / grouped timeline.
4
+
5
+ - **CLI usage**: `docs/CLI.md` (`logs`, `tail`)
6
+ - **Quickstart**: `docs/LOG-TO-TREE-QUICKSTART.md`
7
+ - **Log ingest config (field mapping + redaction)**: `docs-local/architecture/LOG-INGEST-CONFIG.md`
8
+ - **Safety constraints** (no eval, no JS object parsing): `docs-local/architecture/ARCHITECTURE.md`
9
+
10
+ Notes:
11
+ - Log parsing APIs are documented as **experimental** in `docs/API.md`.
12
+ - Log-derived events include **confidence labels**; AgentInspect is conservative about inferring parent/child structure.
13
+
package/docs/SCHEMA.md ADDED
@@ -0,0 +1,199 @@
1
+ # Schema (AgentInspect 1.0)
2
+
3
+ This document describes the **persisted manual trace JSONL schema** and the **log-derived normalized model** used by AgentInspect.
4
+
5
+ ## 1. Overview
6
+
7
+ AgentInspect has two related (but distinct) data models:
8
+
9
+ 1. **Manual trace JSONL** (persisted): lines of `TraceEvent` written by `inspectRun()` / `step()`.
10
+ 2. **Log-derived normalized model** (in-memory): `InspectEvent` / `InspectRunTree` built from structured logs or adapters.
11
+
12
+ Important: log-derived trees are **normalized views**, not the same persisted JSONL schema.
13
+
14
+ ## 2. Manual trace JSONL schema
15
+
16
+ ### 2.1 File format
17
+
18
+ - One JSON object per line (JSONL)
19
+ - Lines may be skipped if invalid JSON or invalid event shape
20
+ - AgentInspect does **not** automatically rewrite old trace files
21
+
22
+ ### 2.2 Current schemaVersion
23
+
24
+ Manual trace events use:
25
+
26
+ - **`schemaVersion: "0.1"`**
27
+
28
+ Existing `0.1` traces remain readable in v1.0.
29
+
30
+ ### 2.3 TraceEvent union
31
+
32
+ The stable event names are:
33
+
34
+ - `run_started`
35
+ - `run_completed`
36
+ - `step_started`
37
+ - `step_completed`
38
+
39
+ There is **no** `step_failed` event. Failures are represented by `step_completed` with `status: "error"`.
40
+
41
+ ### 2.4 Common fields
42
+
43
+ Every trace line contains:
44
+
45
+ - `schemaVersion: "0.1"`
46
+ - `event: string`
47
+ - `timestamp: number` (ms since epoch)
48
+
49
+ ## 3. Event definitions
50
+
51
+ ### 3.1 `run_started`
52
+
53
+ ```ts
54
+ {
55
+ schemaVersion: "0.1",
56
+ event: "run_started",
57
+ timestamp: number,
58
+ runId: string,
59
+ name: string,
60
+ startTime: number,
61
+ metadata?: Record<string, unknown>
62
+ }
63
+ ```
64
+
65
+ ### 3.2 `run_completed`
66
+
67
+ ```ts
68
+ {
69
+ schemaVersion: "0.1",
70
+ event: "run_completed",
71
+ timestamp: number,
72
+ runId: string,
73
+ status: "success" | "error",
74
+ endTime: number,
75
+ durationMs: number,
76
+ error?: { message: string, stack?: string }
77
+ }
78
+ ```
79
+
80
+ ### 3.3 `step_started`
81
+
82
+ ```ts
83
+ {
84
+ schemaVersion: "0.1",
85
+ event: "step_started",
86
+ timestamp: number,
87
+ runId: string,
88
+ stepId: string,
89
+ parentId?: string,
90
+ name: string,
91
+ type: "run" | "llm" | "tool" | "decision" | "logic" | "state" | "custom",
92
+ startTime: number,
93
+ metadata?: Record<string, unknown>
94
+ }
95
+ ```
96
+
97
+ ### 3.4 `step_completed`
98
+
99
+ ```ts
100
+ {
101
+ schemaVersion: "0.1",
102
+ event: "step_completed",
103
+ timestamp: number,
104
+ runId: string,
105
+ stepId: string,
106
+ status: "success" | "error",
107
+ endTime: number,
108
+ durationMs: number,
109
+ error?: { message: string, stack?: string }
110
+ }
111
+ ```
112
+
113
+ ## 4. Error representation
114
+
115
+ - Errors are structured as `{ message, stack? }`.
116
+ - AgentInspect prints short human errors by default; verbose modes may include stack strings.
117
+
118
+ ## 5. Status representation
119
+
120
+ Manual trace statuses:
121
+
122
+ - Run: `status: "success" | "error"` on `run_completed`
123
+ - Step: `status: "success" | "error"` on `step_completed`
124
+
125
+ There is no `"unknown"` status in the persisted manual trace event itself; `"unknown"` can appear in **derived metadata** when status cannot be determined safely.
126
+
127
+ Unknown status must **not** be treated as success.
128
+
129
+ ## 6. Metadata policy
130
+
131
+ - Runs may include `metadata` on `run_started`.
132
+ - Steps may include `metadata` on `step_started`.
133
+ - Manual traces intentionally avoid full prompt/output capture by default.
134
+
135
+ ## 7. Additive fields and unknown fields
136
+
137
+ - Additive changes are allowed in minor versions.
138
+ - Readers should ignore unknown fields where safe.
139
+ - Breaking schema changes require a major version.
140
+
141
+ ## 8. Malformed lines
142
+
143
+ Manual trace reading:
144
+
145
+ - invalid JSON lines are skipped
146
+ - JSON objects that fail strict `TraceEvent` validation are skipped
147
+
148
+ ## 9. Backward compatibility
149
+
150
+ - v0.1 JSONL traces remain readable in v1.0.
151
+ - No automatic migrations or rewriting of old files.
152
+
153
+ ## 10. Breaking change policy
154
+
155
+ - Breaking changes require a major version.
156
+ - Stable v1.x policy: avoid removing stable fields/events; prefer additive extensions.
157
+
158
+ ## 11. Log-derived InspectEvent model
159
+
160
+ Log-derived events normalize into:
161
+
162
+ ```ts
163
+ interface InspectEvent {
164
+ eventId: string;
165
+ runId: string;
166
+ parentId?: string;
167
+ name: string;
168
+ kind: "RUN" | "AGENT" | "LLM" | "TOOL" | "CHAIN" | "RETRIEVER" | "DECISION" | "RESULT" | "ERROR" | "LOGIC" | "LOG";
169
+ timestamp: number;
170
+ status?: "running" | "ok" | "error";
171
+ durationMs?: number;
172
+ attributes?: Record<string, unknown>;
173
+ confidence: "explicit" | "correlated" | "heuristic" | "unknown";
174
+ source: { type: "manual" | "json-log" | "log4js" | "pino" | "winston" | "adapter"; file?: string; line?: number };
175
+ }
176
+ ```
177
+
178
+ ## 12. Confidence labels (required)
179
+
180
+ Log-derived trees must remain honest:
181
+
182
+ - `explicit`: parent relationship is directly known (parentId, adapter parent, etc.)
183
+ - `correlated`: grouped by run id / request id keys
184
+ - `heuristic`: inferred from patterns (used sparingly)
185
+ - `unknown`: missing key evidence (e.g. missing timestamp)
186
+
187
+ ## 13. Redaction considerations
188
+
189
+ Redaction is applied to log-derived attributes and to exports by default. **Manual trace metadata is user-controlled** and should be treated as potentially sensitive.
190
+
191
+ Always review any exported content (Markdown/HTML/OpenInference/OTLP JSON) before sharing, especially if you enable richer attribute inclusion.
192
+
193
+ See: `docs-local/architecture/REDACTION.md`.
194
+
195
+ ## 14. Migration notes
196
+
197
+ - Minor releases may add optional fields/events, but must keep existing v0.1 traces readable.
198
+ - 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.
199
+
@@ -0,0 +1,14 @@
1
+ ## Screenshots / GIFs (planned)
2
+
3
+ This repo does not currently include screenshots or recorded GIFs in the npm package.
4
+
5
+ Recommended captures to add (when convenient):
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`)
12
+
13
+ <!-- Add screenshots after running `examples/00-quickstart-demo` locally. -->
14
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-inspect",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Local-first execution-tree debugger for TypeScript AI agents",
@@ -12,6 +12,7 @@
12
12
  "url": "https://github.com/rajudandigam/agent-inspect/issues"
13
13
  },
14
14
  "homepage": "https://github.com/rajudandigam/agent-inspect#readme",
15
+ "packageManager": "pnpm@9.15.0",
15
16
  "main": "./packages/core/dist/index.cjs",
16
17
  "module": "./packages/core/dist/index.mjs",
17
18
  "types": "./packages/core/dist/index.d.ts",
@@ -29,7 +30,24 @@
29
30
  "packages/core/dist",
30
31
  "packages/cli/dist",
31
32
  "README.md",
32
- "LICENSE"
33
+ "LICENSE",
34
+ "SECURITY.md",
35
+ "CHANGELOG.md",
36
+ "docs/GETTING-STARTED.md",
37
+ "docs/API.md",
38
+ "docs/CLI.md",
39
+ "docs/SCHEMA.md",
40
+ "docs/LIMITATIONS.md",
41
+ "docs/KNOWN-ISSUES.md",
42
+ "docs/MIGRATION.md",
43
+ "docs/ARCHITECTURE.md",
44
+ "docs/LOGS.md",
45
+ "docs/EXPORTS.md",
46
+ "docs/DIFF.md",
47
+ "docs/ADAPTERS.md",
48
+ "docs/COMPARE.md",
49
+ "docs/LOG-TO-TREE-QUICKSTART.md",
50
+ "docs/SCREENSHOTS.md"
33
51
  ],
34
52
  "sideEffects": false,
35
53
  "keywords": [
@@ -45,21 +63,14 @@
45
63
  "publishConfig": {
46
64
  "access": "public"
47
65
  },
66
+ "engines": {
67
+ "node": ">=20"
68
+ },
48
69
  "dependencies": {
49
70
  "chalk": "^5.3.0",
50
71
  "nanoid": "^5.0.9",
51
72
  "commander": "^12.1.0"
52
73
  },
53
- "devDependencies": {
54
- "@changesets/cli": "^2.27.10",
55
- "@size-limit/preset-small-lib": "^11.1.6",
56
- "@types/node": "^22.10.2",
57
- "@vitest/coverage-v8": "^2.1.8",
58
- "size-limit": "^11.1.6",
59
- "tsup": "^8.3.5",
60
- "typescript": "^5.7.2",
61
- "vitest": "^2.1.8"
62
- },
63
74
  "scripts": {
64
75
  "clean": "pnpm -r exec -- rm -rf dist",
65
76
  "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",
@@ -70,6 +81,8 @@
70
81
  "size": "size-limit --config size-limit.config.mjs",
71
82
  "test:all": "pnpm run typecheck && pnpm run test && pnpm run build && pnpm run size",
72
83
  "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",
84
+ "prepublishOnly": "pnpm run prepublish:checks",
85
+ "prepack": "pnpm run clean && pnpm run build",
73
86
  "pack:dry-run": "pnpm run build && npm pack --dry-run",
74
87
  "pack:smoke": "pnpm run build && node scripts/package-smoke.mjs",
75
88
  "fixtures:check": "node scripts/validate-fixtures.mjs",
@@ -78,5 +91,15 @@
78
91
  "examples:check": "pnpm install && pnpm --filter agent-inspect-example-01-basic run start",
79
92
  "changeset": "changeset",
80
93
  "release": "changeset publish"
94
+ },
95
+ "devDependencies": {
96
+ "@changesets/cli": "^2.27.10",
97
+ "@size-limit/preset-small-lib": "^11.1.6",
98
+ "@types/node": "^22.10.2",
99
+ "@vitest/coverage-v8": "^2.1.8",
100
+ "size-limit": "^11.1.6",
101
+ "tsup": "^8.3.5",
102
+ "typescript": "^5.7.2",
103
+ "vitest": "^2.1.8"
81
104
  }
82
- }
105
+ }
@@ -4272,7 +4272,7 @@ function runCommand(action) {
4272
4272
  });
4273
4273
  }
4274
4274
  function createCliProgram() {
4275
- const program = new commander.Command("agent-inspect").description("Local-first execution-tree debugger for AI agents").version("0.1.0");
4275
+ const program = new commander.Command("agent-inspect").description("Local-first execution-tree debugger for AI agents").version("1.0.0");
4276
4276
  program.command("list").description("List recent AgentInspect runs").option("--dir <path>", "trace directory").option("--limit <number>", "max runs to show (default 20, max 100)").addOption(
4277
4277
  new commander.Option("--status <status>", "filter by run status").choices([
4278
4278
  "running",