agent-inspect 1.0.1 → 1.0.3
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 +14 -0
- package/README.md +161 -415
- package/docs/API.md +4 -2
- package/docs/CLI.md +1 -0
- package/docs/GETTING-STARTED.md +22 -0
- package/package.json +9 -4
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/core/dist/index.cjs +24 -0
- package/packages/core/dist/index.cjs.map +1 -1
- package/packages/core/dist/index.d.cts +20 -2
- package/packages/core/dist/index.d.ts +20 -2
- package/packages/core/dist/index.mjs +23 -1
- package/packages/core/dist/index.mjs.map +1 -1
- package/docs/MIGRATION.md +0 -109
package/docs/API.md
CHANGED
|
@@ -22,10 +22,12 @@ These are the recommended entry points for manual instrumentation. They are desi
|
|
|
22
22
|
Import from `agent-inspect`:
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
|
-
import { inspectRun, step, observe } from "agent-inspect";
|
|
25
|
+
import { inspectRun, maybeInspectRun, step, observe } from "agent-inspect";
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
- **`inspectRun(name, fn, options?)`**: wraps a workflow in a local JSONL trace (`run_started` / `run_completed`), prints terminal progress, and swallows instrumentation failures (user errors are re-thrown).
|
|
28
|
+
- **`inspectRun(name, fn, options?)`**: wraps a workflow in a local JSONL trace (`run_started` / `run_completed`), prints terminal progress, and swallows instrumentation failures (user errors are re-thrown). **Traces by default** when `enabled` is omitted or `true`. Pass **`enabled: false`** to run `fn` with no trace file, no execution context, and no terminal output.
|
|
29
|
+
- **`maybeInspectRun(name, fn, options?)`**: same as `inspectRun` when tracing is enabled; otherwise passthrough. Enablement: explicit **`options.enabled`** wins; when omitted, reads **`AGENT_INSPECT`** (`1`, `true`, `yes`, `on`, `enabled` — case-insensitive). Unset or other values disable tracing. Use in eval harnesses, CI, or jobs where tracing should be toggled by environment.
|
|
30
|
+
- **`isAgentInspectEnabled(value?)`**: returns whether a string (or `process.env.AGENT_INSPECT`) matches an enable token.
|
|
29
31
|
- **`step(name, fn, options?)`**: traces a named unit of work inside `inspectRun` (`step_started` / `step_completed`).
|
|
30
32
|
- **`step.llm(model, fn)`**: convenience wrapper (`type: "llm"`, `metadata.model`).
|
|
31
33
|
- **`step.tool(toolName, fn)`**: convenience wrapper (`type: "tool"`, `metadata.toolName`).
|
package/docs/CLI.md
CHANGED
|
@@ -31,6 +31,7 @@ Core commands:
|
|
|
31
31
|
|
|
32
32
|
- **`AGENT_INSPECT_TRACE_DIR`**: default directory for manual trace files (`.jsonl`) when not passed via `--dir` (or API options).
|
|
33
33
|
- **`AGENT_INSPECT_SILENT`**: when `true`, suppresses live terminal tree output during manual tracing (`inspectRun` / `step`). Trace files are still written.
|
|
34
|
+
- **`AGENT_INSPECT`**: enables manual tracing for **`maybeInspectRun`** when set to `1`, `true`, `yes`, `on`, or `enabled` (case-insensitive). Unset or any other value disables tracing. Does **not** change default **`inspectRun`** behavior (which always traces unless `enabled: false` is passed in code). No network upload — local JSONL only.
|
|
34
35
|
|
|
35
36
|
## 3. Exit code policy
|
|
36
37
|
|
package/docs/GETTING-STARTED.md
CHANGED
|
@@ -38,6 +38,28 @@ This writes a local JSONL trace with stable v1.0 event names:
|
|
|
38
38
|
- `run_started`, `run_completed`
|
|
39
39
|
- `step_started`, `step_completed`
|
|
40
40
|
|
|
41
|
+
### Always trace vs env-gated tracing
|
|
42
|
+
|
|
43
|
+
Use **`inspectRun`** when you always want a local trace (default behavior).
|
|
44
|
+
|
|
45
|
+
Use **`maybeInspectRun`** in eval harnesses, CI, or production-shaped jobs where tracing should be toggled by environment:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { maybeInspectRun } from "agent-inspect";
|
|
49
|
+
|
|
50
|
+
await maybeInspectRun("eval-case-42", async () => {
|
|
51
|
+
return runAgent();
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
AGENT_INSPECT=1 node eval-runner.mjs
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Enable tokens: `1`, `true`, `yes`, `on`, `enabled` (case-insensitive). Explicit `enabled: true | false` in options overrides the env var.
|
|
60
|
+
|
|
61
|
+
To skip tracing in code without env vars: `inspectRun(name, fn, { enabled: false })`.
|
|
62
|
+
|
|
41
63
|
## 3. View runs
|
|
42
64
|
|
|
43
65
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-inspect",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Local-first execution-tree debugger for TypeScript AI agents",
|
|
@@ -18,9 +18,14 @@
|
|
|
18
18
|
"types": "./packages/core/dist/index.d.ts",
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./packages/core/dist/index.d.ts",
|
|
23
|
+
"default": "./packages/core/dist/index.mjs"
|
|
24
|
+
},
|
|
25
|
+
"require": {
|
|
26
|
+
"types": "./packages/core/dist/index.d.cts",
|
|
27
|
+
"default": "./packages/core/dist/index.cjs"
|
|
28
|
+
}
|
|
24
29
|
}
|
|
25
30
|
},
|
|
26
31
|
"bin": {
|