agent-inspect 4.0.0 → 4.2.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 CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add sessions and activity as first-class local concepts (v4.2).
8
+
9
+ - Derive session status, timing, last error, and retry counts on enriched `SessionSummary` (builds on v2.4 vocabulary; no timestamp-only causality).
10
+ - Add `buildActivitySummary` for windowed activity feeds.
11
+ - Expand CLI: `sessions latest`, `activity`, `show`, `handoffs`, `errors` (bare `sessions` list and `session <id>` unchanged).
12
+ - Optional SQLite index acceleration for session loading with automatic scan fallback when the index is absent, stale, or corrupt.
13
+ - Docs: CLI reference update.
14
+
15
+ ## 4.1.0
16
+
17
+ ### Minor Changes
18
+
19
+ - Add the optional local trace index (v4.1).
20
+
21
+ - New optional package `@agent-inspect/index-sqlite`: a disposable, rebuildable SQLite index over AgentInspect JSONL traces for faster local queries. JSONL stays the source of truth, trace files are never mutated, deleting the index is always safe, and there is no network access. SQLite (`better-sqlite3`) lives only in this optional package — never in root/core.
22
+ - New `agent-inspect index sqlite` CLI subcommands (`build`, `rebuild`, `status`, `query`, `clean`) that load the optional package on demand and print an install hint when it is absent.
23
+ - Non-throwing read APIs (`queryRuns`, `indexStatus`, `isIndexStale`) with corruption/staleness recovery so callers can transparently fall back to a directory scan.
24
+ - Docs: `docs/INDEX.md` plus `docs/CLI.md` reference.
25
+
3
26
  ## 4.0.0
4
27
 
5
28
  ### Major Changes
package/docs/CLI.md CHANGED
@@ -30,6 +30,7 @@ Core commands:
30
30
  - `init` — scaffold local AgentInspect config and demo files (v3.1+)
31
31
  - `doctor` — diagnose local setup without network or installs (v3.1+)
32
32
  - `workspace` — manage a project-local trace workspace (`.agent-inspect/workspace.json`) (v4.0+)
33
+ - `index sqlite` — optional SQLite-backed trace index for faster queries (requires `@agent-inspect/index-sqlite`) (v4.1+)
33
34
  - `check` — run deterministic local trace checks with stable JSON and exit codes
34
35
  - `eval` — run deterministic local evals over existing traces
35
36
  - `redact` — redact a local JSON/JSONL file or trace copy
@@ -41,7 +42,7 @@ Core commands:
41
42
  - `timeline` — chronological view of one run (local JSONL)
42
43
  - `stats` — local aggregate stats over a trace directory
43
44
  - `search` — deterministic local search over traces
44
- - `sessions` — list workflow sessions from trace metadata
45
+ - `sessions` — list workflow sessions; v4.2+ subcommands: `latest`, `activity`, `show`, `handoffs`, `errors`
45
46
  - `session` — inspect one session (handoffs, retries, optional timeline)
46
47
  - `what` — concise summary of a single run (local JSONL)
47
48
  - `report` — markdown or HTML inspection report for a single run
@@ -680,23 +681,34 @@ npx agent-inspect search --session sess-retry-001 --dir ./.agent-inspect
680
681
 
681
682
  ### 6.19 `sessions`
682
683
 
683
- List workflow sessions grouped from local trace metadata (`sessionId`, optional `groupId` correlation). Read-only; no network.
684
+ Workflow sessions and activity from local trace metadata. v4.2 adds session status, activity summaries, and optional SQLite index acceleration (falls back to directory scan). Read-only; no network.
684
685
 
685
686
  ```bash
686
- agent-inspect sessions [options]
687
+ agent-inspect sessions [options] # list sessions (default)
688
+ agent-inspect sessions latest [--json]
689
+ agent-inspect sessions activity [--since 7d] [--json]
690
+ agent-inspect sessions show <session-id> [--timeline] [--json]
691
+ agent-inspect sessions handoffs [--session <id>] [--json]
692
+ agent-inspect sessions errors [--since 7d] [--json]
687
693
  ```
688
694
 
689
- Options:
695
+ Shared options:
690
696
 
691
697
  - `--dir <path>`
692
698
  - `--correlate-group` — treat shared `groupId` as a synthetic session when `sessionId` is absent
693
- - `--json``SessionIndex` JSON (`sessions`, `unscopedRunIds`, `warnings`)
699
+ - `--stale-after <duration>` mark sessions stale after inactivity (e.g. `24h`, `7d`)
700
+ - `--json` — deterministic JSON output
701
+
702
+ `activity` and `errors` accept `--since <duration>` (e.g. `7d`, `24h`). Session summaries include derived `status`, `lastActivity`, `lastError`, and `retryCount` without changing trace files.
694
703
 
695
704
  Example:
696
705
 
697
706
  ```bash
698
707
  npx agent-inspect sessions --dir ./.agent-inspect
699
- npx agent-inspect sessions --json
708
+ npx agent-inspect sessions latest --json
709
+ npx agent-inspect sessions activity --since 7d
710
+ npx agent-inspect sessions handoffs --session sess-handoff-001
711
+ npx agent-inspect sessions errors --since 30d --json
700
712
  ```
701
713
 
702
714
  ### 6.20 `session`
@@ -829,6 +841,25 @@ agent-inspect workspace path [--json]
829
841
 
830
842
  All subcommands accept `--json` for deterministic output.
831
843
 
844
+ ### 6.23 `index sqlite`
845
+
846
+ Optional SQLite-backed index that accelerates local queries over large trace directories. Added in v4.1. Requires the optional `@agent-inspect/index-sqlite` package; the core CLI does not depend on SQLite. The index is derived from JSONL and always safe to delete — JSONL remains the source of truth and trace files are never mutated. Local-only; no network. See [INDEX.md](INDEX.md) for the full model.
847
+
848
+ ```bash
849
+ agent-inspect index sqlite build [--dir <path>] [--max-runs <n>] [--json]
850
+ agent-inspect index sqlite rebuild [--dir <path>] [--max-runs <n>] [--json]
851
+ agent-inspect index sqlite status [--dir <path>] [--json]
852
+ agent-inspect index sqlite query [--dir <path>] [--status <s>] [--session <id>] [--name <q>] [--kind <k>] [--tool <q>] [--limit <n>] [--json]
853
+ agent-inspect index sqlite clean [--dir <path>] [--json]
854
+ ```
855
+
856
+ - `build` / `rebuild` — build or fully rebuild `trace-index.sqlite` from the trace directory. Rebuilds are idempotent; a corrupt prior index is discarded and rebuilt cleanly.
857
+ - `status` — report index health, run/step counts, build time, and staleness (stale when any trace is newer than the index).
858
+ - `query` — filter indexed runs by status, session, name, step kind, or tool. Exits non-zero with an install/build hint when no usable index is present.
859
+ - `clean` — delete the index database (and its WAL/SHM sidecars). Traces are never touched.
860
+
861
+ If `@agent-inspect/index-sqlite` is not installed, these subcommands print a short install hint and exit non-zero.
862
+
832
863
  ## 7. Optional TUI behavior
833
864
 
834
865
  `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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-inspect",
3
- "version": "4.0.0",
3
+ "version": "4.2.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Trace, check, and safely share TypeScript AI-agent runs locally — no account, no upload, metadata-only by default",
@@ -206,7 +206,7 @@
206
206
  },
207
207
  "scripts": {
208
208
  "clean": "pnpm -r exec -- rm -rf dist",
209
- "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 && pnpm exec tsup --config tsup.ai-sdk.config.ts && pnpm exec tsup --config tsup.vitest.config.ts && pnpm exec tsup --config tsup.jest.config.ts && pnpm exec tsup --config tsup.openai-agents.config.ts && pnpm exec tsup --config tsup.harness.config.ts && pnpm exec tsup --config tsup.redact.config.ts && pnpm exec tsup --config tsup.eval.config.ts && pnpm exec tsup --config tsup.mcp.config.ts && pnpm exec tsup --config tsup.guardrails.config.ts && pnpm exec tsup --config tsup.circuit.config.ts && pnpm exec tsup --config tsup.viewer.config.ts && pnpm exec tsup --config tsup.mcp-server.config.ts && pnpm exec tsup --config tsup.adapter-sdk.config.ts && pnpm exec tsup --config tsup.vscode.config.ts",
209
+ "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 && pnpm exec tsup --config tsup.ai-sdk.config.ts && pnpm exec tsup --config tsup.vitest.config.ts && pnpm exec tsup --config tsup.jest.config.ts && pnpm exec tsup --config tsup.openai-agents.config.ts && pnpm exec tsup --config tsup.harness.config.ts && pnpm exec tsup --config tsup.redact.config.ts && pnpm exec tsup --config tsup.eval.config.ts && pnpm exec tsup --config tsup.mcp.config.ts && pnpm exec tsup --config tsup.guardrails.config.ts && pnpm exec tsup --config tsup.circuit.config.ts && pnpm exec tsup --config tsup.viewer.config.ts && pnpm exec tsup --config tsup.mcp-server.config.ts && pnpm exec tsup --config tsup.adapter-sdk.config.ts && pnpm exec tsup --config tsup.vscode.config.ts && pnpm exec tsup --config tsup.index-sqlite.config.ts",
210
210
  "typecheck": "tsc --noEmit",
211
211
  "test": "vitest run",
212
212
  "test:watch": "vitest",