agent-inspect 1.0.0 → 1.0.1

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/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.1",
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",