@tonyclaw/agent-inspector 2.0.14 → 2.0.16
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/.output/cli.js +107 -11
- package/.output/nitro.json +1 -1
- package/.output/public/assets/{CompareDrawer-BR_kCD7Q.js → CompareDrawer-DPs4UHwd.js} +1 -1
- package/.output/public/assets/{ProxyViewerContainer-vc50msJj.js → ProxyViewerContainer-B1KylMPs.js} +32 -32
- package/.output/public/assets/{ReplayDialog-DsAYQBHZ.js → ReplayDialog-8ISC28XF.js} +1 -1
- package/.output/public/assets/{RequestAnatomy-B4uqyUt8.js → RequestAnatomy-BhbsgfBO.js} +1 -1
- package/.output/public/assets/{ResponseView-C1vQL-fM.js → ResponseView-CyM7JXeA.js} +1 -1
- package/.output/public/assets/{StreamingChunkSequence-BECMV-xf.js → StreamingChunkSequence-BaX0x38n.js} +1 -1
- package/.output/public/assets/_sessionId-CShO0OrR.js +1 -0
- package/.output/public/assets/index-BkdYiTpV.js +1 -0
- package/.output/public/assets/{main-D6wegveF.js → main-B2t-3SYj.js} +2 -2
- package/.output/server/{_sessionId-CeHY-3xa.mjs → _sessionId-CEbZTs68.mjs} +2 -2
- package/.output/server/_ssr/{CompareDrawer-blWGaGiT.mjs → CompareDrawer-CEo48Wsu.mjs} +2 -2
- package/.output/server/_ssr/{ProxyViewerContainer-Dt_9BuM9.mjs → ProxyViewerContainer-5ekIK_jx.mjs} +64 -22
- package/.output/server/_ssr/{ReplayDialog-mzsq7AjW.mjs → ReplayDialog-C0nEvbYo.mjs} +3 -3
- package/.output/server/_ssr/{RequestAnatomy-CDAcXMBK.mjs → RequestAnatomy-CT55prmM.mjs} +2 -2
- package/.output/server/_ssr/{ResponseView-B__xXCsZ.mjs → ResponseView-DBZSBCOD.mjs} +2 -2
- package/.output/server/_ssr/{StreamingChunkSequence-BnJkTdXF.mjs → StreamingChunkSequence-BuVT7Oke.mjs} +2 -2
- package/.output/server/_ssr/{index-B2-uF9XT.mjs → index-Cw_zJVQv.mjs} +2 -2
- package/.output/server/_ssr/index.mjs +2 -2
- package/.output/server/_ssr/{router-BpEBhA7S.mjs → router-DxjqHipT.mjs} +89 -46
- package/.output/server/{_tanstack-start-manifest_v-CHekFSzj.mjs → _tanstack-start-manifest_v-xeOo5gW5.mjs} +1 -1
- package/.output/server/index.mjs +59 -59
- package/README.md +31 -1
- package/package.json +1 -1
- package/src/cli/templates/codex-skill-onboard.ts +8 -4
- package/src/cli/templates/skill-onboard.ts +15 -7
- package/src/cli.ts +91 -0
- package/src/components/OnboardingBanner.tsx +32 -9
- package/src/components/ProxyViewer.tsx +32 -24
- package/src/components/ProxyViewerContainer.tsx +2 -1
- package/src/components/providers/SettingsDialog.tsx +10 -0
- package/src/lib/runtimeConfig.ts +4 -0
- package/src/lib/useOnboarding.ts +9 -1
- package/src/lib/useStripConfig.ts +10 -2
- package/src/proxy/config.ts +33 -3
- package/src/proxy/handler.ts +30 -13
- package/src/proxy/logFinalizer.ts +4 -2
- package/src/routes/api/providers.$providerId.test.log.ts +17 -7
- package/.output/public/assets/_sessionId-3bjQPmHl.js +0 -1
- package/.output/public/assets/index-_7blCOK0.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const tsrStartManifest = () => ({ "routes": { "__root__": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/__root.tsx", "children": ["/", "/api/config", "/api/health", "/api/logs", "/api/mcp", "/api/models", "/api/providers", "/api/sessions", "/proxy/$", "/session/$sessionId", "/api/knowledge/candidates", "/api/knowledge/project-context", "/api/knowledge/search", "/api/knowledge/sessions/$sessionId/candidates"], "preloads": ["/assets/main-
|
|
1
|
+
const tsrStartManifest = () => ({ "routes": { "__root__": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/__root.tsx", "children": ["/", "/api/config", "/api/health", "/api/logs", "/api/mcp", "/api/models", "/api/providers", "/api/sessions", "/proxy/$", "/session/$sessionId", "/api/knowledge/candidates", "/api/knowledge/project-context", "/api/knowledge/search", "/api/knowledge/sessions/$sessionId/candidates"], "preloads": ["/assets/main-B2t-3SYj.js"], "assets": [] }, "/": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/index.tsx", "assets": [], "preloads": ["/assets/index-BkdYiTpV.js", "/assets/ProxyViewerContainer-B1KylMPs.js"] }, "/api/config": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/config.ts", "children": ["/api/config/paths"] }, "/api/health": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/health.ts" }, "/api/logs": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/logs.ts", "children": ["/api/logs/$id", "/api/logs/stream"] }, "/api/mcp": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/mcp.ts" }, "/api/models": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/models.ts" }, "/api/providers": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/providers.ts", "children": ["/api/providers/$providerId", "/api/providers/export", "/api/providers/import", "/api/providers/scan"] }, "/api/sessions": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/sessions.ts" }, "/proxy/$": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/proxy/$.ts" }, "/session/$sessionId": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/session/$sessionId.tsx", "assets": [], "preloads": ["/assets/_sessionId-CShO0OrR.js", "/assets/ProxyViewerContainer-B1KylMPs.js"] }, "/api/config/paths": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/config.paths.ts" }, "/api/knowledge/candidates": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/knowledge.candidates.ts", "children": ["/api/knowledge/candidates/$candidateId"] }, "/api/knowledge/project-context": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/knowledge.project-context.ts" }, "/api/knowledge/search": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/knowledge.search.ts" }, "/api/logs/$id": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/logs.$id.ts", "children": ["/api/logs/$id/chunks", "/api/logs/$id/replay"] }, "/api/logs/stream": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/logs.stream.ts" }, "/api/providers/$providerId": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/providers.$providerId.ts", "children": ["/api/providers/$providerId/model-metadata", "/api/providers/$providerId/test"] }, "/api/providers/export": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/providers.export.ts" }, "/api/providers/import": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/providers.import.ts" }, "/api/providers/scan": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/providers.scan.ts" }, "/api/knowledge/candidates/$candidateId": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/knowledge.candidates.$candidateId.ts", "children": ["/api/knowledge/candidates/$candidateId/promote"] }, "/api/logs/$id/chunks": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/logs.$id.chunks.ts" }, "/api/logs/$id/replay": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/logs.$id.replay.ts" }, "/api/providers/$providerId/model-metadata": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/providers.$providerId.model-metadata.ts" }, "/api/providers/$providerId/test": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/providers.$providerId.test.ts", "children": ["/api/providers/$providerId/test/log"] }, "/api/knowledge/candidates/$candidateId/promote": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/knowledge.candidates.$candidateId.promote.ts" }, "/api/knowledge/sessions/$sessionId/candidates": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/knowledge.sessions.$sessionId.candidates.ts" }, "/api/providers/$providerId/test/log": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/providers.$providerId.test.log.ts" } }, "clientEntry": "/assets/main-B2t-3SYj.js" });
|
|
2
2
|
export {
|
|
3
3
|
tsrStartManifest
|
|
4
4
|
};
|
package/.output/server/index.mjs
CHANGED
|
@@ -35,103 +35,103 @@ const headers = ((m) => function headersRouteRule(event) {
|
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
const assets = {
|
|
38
|
-
"/assets/CompareDrawer-
|
|
38
|
+
"/assets/CompareDrawer-DPs4UHwd.js": {
|
|
39
39
|
"type": "text/javascript; charset=utf-8",
|
|
40
|
-
"etag": '"49fe-
|
|
41
|
-
"mtime": "2026-06-
|
|
40
|
+
"etag": '"49fe-juuwKqSVn4vg8/mxHy0rBBfuaz0"',
|
|
41
|
+
"mtime": "2026-06-27T02:00:30.203Z",
|
|
42
42
|
"size": 18942,
|
|
43
|
-
"path": "../public/assets/CompareDrawer-
|
|
43
|
+
"path": "../public/assets/CompareDrawer-DPs4UHwd.js"
|
|
44
44
|
},
|
|
45
|
-
"/assets/index-
|
|
45
|
+
"/assets/index-BkdYiTpV.js": {
|
|
46
46
|
"type": "text/javascript; charset=utf-8",
|
|
47
|
-
"etag": '"74-
|
|
48
|
-
"mtime": "2026-06-
|
|
47
|
+
"etag": '"74-95mLx/6mpmji+KzspWJRgr0j2HE"',
|
|
48
|
+
"mtime": "2026-06-27T02:00:30.203Z",
|
|
49
49
|
"size": 116,
|
|
50
|
-
"path": "../public/assets/index-
|
|
50
|
+
"path": "../public/assets/index-BkdYiTpV.js"
|
|
51
51
|
},
|
|
52
|
-
"/assets/
|
|
53
|
-
"type": "
|
|
54
|
-
"etag": '"
|
|
55
|
-
"mtime": "2026-06-
|
|
56
|
-
"size":
|
|
57
|
-
"path": "../public/assets/
|
|
52
|
+
"/assets/alibaba-TTwafVwX.svg": {
|
|
53
|
+
"type": "image/svg+xml",
|
|
54
|
+
"etag": '"171b-6dyV5K8QjiaY35sN9qNprh9zDIs"',
|
|
55
|
+
"mtime": "2026-06-27T02:00:30.202Z",
|
|
56
|
+
"size": 5915,
|
|
57
|
+
"path": "../public/assets/alibaba-TTwafVwX.svg"
|
|
58
|
+
},
|
|
59
|
+
"/assets/minimax-BPMzvuL-.jpeg": {
|
|
60
|
+
"type": "image/jpeg",
|
|
61
|
+
"etag": '"1b06-IwivU89ko5UTMUM1/t7hn4sQK9A"',
|
|
62
|
+
"mtime": "2026-06-27T02:00:30.203Z",
|
|
63
|
+
"size": 6918,
|
|
64
|
+
"path": "../public/assets/minimax-BPMzvuL-.jpeg"
|
|
58
65
|
},
|
|
59
66
|
"/assets/index-D_nZj9Vt.css": {
|
|
60
67
|
"type": "text/css; charset=utf-8",
|
|
61
68
|
"etag": '"1a275-7T1iSNG2p6BSsqLwdpfky+9evLw"',
|
|
62
|
-
"mtime": "2026-06-
|
|
69
|
+
"mtime": "2026-06-27T02:00:30.203Z",
|
|
63
70
|
"size": 107125,
|
|
64
71
|
"path": "../public/assets/index-D_nZj9Vt.css"
|
|
65
72
|
},
|
|
66
|
-
"/assets/
|
|
67
|
-
"type": "
|
|
68
|
-
"etag": '"
|
|
69
|
-
"mtime": "2026-06-
|
|
70
|
-
"size":
|
|
71
|
-
"path": "../public/assets/
|
|
73
|
+
"/assets/ReplayDialog-8ISC28XF.js": {
|
|
74
|
+
"type": "text/javascript; charset=utf-8",
|
|
75
|
+
"etag": '"2361-7pKZf9oNiHpnogtvILlZkhLSrZs"',
|
|
76
|
+
"mtime": "2026-06-27T02:00:30.203Z",
|
|
77
|
+
"size": 9057,
|
|
78
|
+
"path": "../public/assets/ReplayDialog-8ISC28XF.js"
|
|
72
79
|
},
|
|
73
|
-
"/assets/RequestAnatomy-
|
|
80
|
+
"/assets/RequestAnatomy-BhbsgfBO.js": {
|
|
74
81
|
"type": "text/javascript; charset=utf-8",
|
|
75
|
-
"etag": '"4485-
|
|
76
|
-
"mtime": "2026-06-
|
|
82
|
+
"etag": '"4485-4Urj/0VSY4KkQLnUk4c+RLhwDb4"',
|
|
83
|
+
"mtime": "2026-06-27T02:00:30.203Z",
|
|
77
84
|
"size": 17541,
|
|
78
|
-
"path": "../public/assets/RequestAnatomy-
|
|
85
|
+
"path": "../public/assets/RequestAnatomy-BhbsgfBO.js"
|
|
79
86
|
},
|
|
80
|
-
"/assets/
|
|
87
|
+
"/assets/ResponseView-CyM7JXeA.js": {
|
|
81
88
|
"type": "text/javascript; charset=utf-8",
|
|
82
|
-
"etag": '"
|
|
83
|
-
"mtime": "2026-06-
|
|
84
|
-
"size":
|
|
85
|
-
"path": "../public/assets/
|
|
89
|
+
"etag": '"30cd-UFEnNJc8VomMOrzXynlO8nTuVzo"',
|
|
90
|
+
"mtime": "2026-06-27T02:00:30.203Z",
|
|
91
|
+
"size": 12493,
|
|
92
|
+
"path": "../public/assets/ResponseView-CyM7JXeA.js"
|
|
86
93
|
},
|
|
87
|
-
"/assets/
|
|
94
|
+
"/assets/StreamingChunkSequence-BaX0x38n.js": {
|
|
88
95
|
"type": "text/javascript; charset=utf-8",
|
|
89
|
-
"etag": '"
|
|
90
|
-
"mtime": "2026-06-
|
|
91
|
-
"size":
|
|
92
|
-
"path": "../public/assets/
|
|
96
|
+
"etag": '"d5b-H/I8iDw6s0pMrSJmzT6dZsygy7E"',
|
|
97
|
+
"mtime": "2026-06-27T02:00:30.203Z",
|
|
98
|
+
"size": 3419,
|
|
99
|
+
"path": "../public/assets/StreamingChunkSequence-BaX0x38n.js"
|
|
93
100
|
},
|
|
94
101
|
"/assets/zhipuai-BPNAnxo-.svg": {
|
|
95
102
|
"type": "image/svg+xml",
|
|
96
103
|
"etag": '"2bf8-hNaLCTi89nOFCsIIfWpP/jrfo0s"',
|
|
97
|
-
"mtime": "2026-06-
|
|
104
|
+
"mtime": "2026-06-27T02:00:30.203Z",
|
|
98
105
|
"size": 11256,
|
|
99
106
|
"path": "../public/assets/zhipuai-BPNAnxo-.svg"
|
|
100
107
|
},
|
|
101
|
-
"/assets/_sessionId-
|
|
108
|
+
"/assets/_sessionId-CShO0OrR.js": {
|
|
102
109
|
"type": "text/javascript; charset=utf-8",
|
|
103
|
-
"etag": '"d2-
|
|
104
|
-
"mtime": "2026-06-
|
|
110
|
+
"etag": '"d2-K80UxD/MymZ3TEMPLBomJfQN7CU"',
|
|
111
|
+
"mtime": "2026-06-27T02:00:30.203Z",
|
|
105
112
|
"size": 210,
|
|
106
|
-
"path": "../public/assets/_sessionId-
|
|
107
|
-
},
|
|
108
|
-
"/assets/ResponseView-C1vQL-fM.js": {
|
|
109
|
-
"type": "text/javascript; charset=utf-8",
|
|
110
|
-
"etag": '"30cd-nQBYXVNim5cyoGVYNnBURUkaZhE"',
|
|
111
|
-
"mtime": "2026-06-27T01:00:07.211Z",
|
|
112
|
-
"size": 12493,
|
|
113
|
-
"path": "../public/assets/ResponseView-C1vQL-fM.js"
|
|
113
|
+
"path": "../public/assets/_sessionId-CShO0OrR.js"
|
|
114
114
|
},
|
|
115
115
|
"/assets/qwen-CONDcHqt.png": {
|
|
116
116
|
"type": "image/png",
|
|
117
117
|
"etag": '"572c3-cdJAPaHdOvFCGzuaQjagdgOu6XE"',
|
|
118
|
-
"mtime": "2026-06-
|
|
118
|
+
"mtime": "2026-06-27T02:00:30.203Z",
|
|
119
119
|
"size": 357059,
|
|
120
120
|
"path": "../public/assets/qwen-CONDcHqt.png"
|
|
121
121
|
},
|
|
122
|
-
"/assets/
|
|
123
|
-
"type": "
|
|
124
|
-
"etag": '"
|
|
125
|
-
"mtime": "2026-06-
|
|
126
|
-
"size":
|
|
127
|
-
"path": "../public/assets/
|
|
122
|
+
"/assets/main-B2t-3SYj.js": {
|
|
123
|
+
"type": "text/javascript; charset=utf-8",
|
|
124
|
+
"etag": '"51726-Ul/gmLn0c+fZ++xIS/dA5sr6Iz8"',
|
|
125
|
+
"mtime": "2026-06-27T02:00:30.203Z",
|
|
126
|
+
"size": 333606,
|
|
127
|
+
"path": "../public/assets/main-B2t-3SYj.js"
|
|
128
128
|
},
|
|
129
|
-
"/assets/ProxyViewerContainer-
|
|
129
|
+
"/assets/ProxyViewerContainer-B1KylMPs.js": {
|
|
130
130
|
"type": "text/javascript; charset=utf-8",
|
|
131
|
-
"etag": '"
|
|
132
|
-
"mtime": "2026-06-
|
|
133
|
-
"size":
|
|
134
|
-
"path": "../public/assets/ProxyViewerContainer-
|
|
131
|
+
"etag": '"aa428-Xk8wdnw0jCK7Acfwjq6ObVCPbmA"',
|
|
132
|
+
"mtime": "2026-06-27T02:00:30.203Z",
|
|
133
|
+
"size": 697384,
|
|
134
|
+
"path": "../public/assets/ProxyViewerContainer-B1KylMPs.js"
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
137
|
function readAsset(id) {
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ The npm package and CLI remain `agent-inspector`; the platform name is Agent Ins
|
|
|
7
7
|
## What It Does
|
|
8
8
|
|
|
9
9
|
- Runs a local transparent proxy for Anthropic and OpenAI-compatible APIs.
|
|
10
|
-
- Captures model requests, responses,
|
|
10
|
+
- Captures model requests, responses, tool definitions, token usage, and errors.
|
|
11
11
|
- Provides a web UI for browsing sessions and logs in real time.
|
|
12
12
|
- Includes a Chrome companion extension for quick capture status and log navigation.
|
|
13
13
|
- Generates reviewable knowledge candidates from agent sessions.
|
|
@@ -71,6 +71,36 @@ ANTHROPIC_BASE_URL=http://localhost:25947/proxy <tool>
|
|
|
71
71
|
|
|
72
72
|
The web UI runs at http://localhost:25947.
|
|
73
73
|
|
|
74
|
+
## Capture Modes
|
|
75
|
+
|
|
76
|
+
Agent Inspector starts in `simple` capture mode by default:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
agent-inspector
|
|
80
|
+
agent-inspector --mode simple
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Simple mode keeps the proxy lightweight for everyday use. It records the data
|
|
84
|
+
needed for the session timeline, request/response views, token usage, provider
|
|
85
|
+
routing, errors, and knowledge workflows, but it does not retain raw request
|
|
86
|
+
headers, upstream headers, or detailed streaming chunk artifacts.
|
|
87
|
+
|
|
88
|
+
Use `full` mode when you need protocol-level diagnostics:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
agent-inspector --mode full
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Full mode captures the additional raw details used by the `Raw Headers`,
|
|
95
|
+
`Headers`, and `Raw Response` views. It is useful for provider debugging,
|
|
96
|
+
header transformation checks, and SSE stream inspection, but it uses more CPU,
|
|
97
|
+
memory, and disk.
|
|
98
|
+
|
|
99
|
+
The mode is decided at process start. To change modes, restart the server. You
|
|
100
|
+
can also set `AGENT_INSPECTOR_MODE=full` or
|
|
101
|
+
`AGENT_INSPECTOR_CAPTURE_MODE=full`; the CLI flag takes precedence over the
|
|
102
|
+
environment.
|
|
103
|
+
|
|
74
104
|
## Jenkins Release Webhook
|
|
75
105
|
|
|
76
106
|
The `agent-inspector-release` Jenkins pipeline can be triggered from GitCode by
|
package/package.json
CHANGED
|
@@ -47,6 +47,8 @@ Codex user-level configuration lives in \`~/.codex/config.toml\`. Codex supports
|
|
|
47
47
|
|
|
48
48
|
Keep this setup local and explicit. Agent Inspector MCP tools can read captured requests and provider configuration, so only wire it into trusted local Codex environments.
|
|
49
49
|
|
|
50
|
+
Agent Inspector starts in **Simple mode** by default. Keep Simple mode for everyday capture: requests, responses, tools, timing, and token usage stay available without retaining heavier raw headers, raw response, or detailed SSE chunk artifacts. Use **Full mode** only when the user is debugging provider headers, raw response payloads, or SSE stream details.
|
|
51
|
+
|
|
50
52
|
---
|
|
51
53
|
|
|
52
54
|
## Phase 0: Preflight
|
|
@@ -77,19 +79,21 @@ Do not read \`~/.codex/auth.json\`, token files, or unrelated Codex state files.
|
|
|
77
79
|
|
|
78
80
|
## Phase 1: Start Agent Inspector
|
|
79
81
|
|
|
80
|
-
Start or reuse Agent Inspector before wiring MCP. Prefer the installed binary so Windows users get the branded runtime in Task Manager.
|
|
82
|
+
Start or reuse Agent Inspector before wiring MCP. Prefer the installed binary so Windows users get the branded runtime in Task Manager. Start onboarding in Simple mode; if the user needs raw headers, raw response, or SSE chunks later, restart with \`agent-inspector --mode full\`.
|
|
81
83
|
|
|
82
84
|
\`\`\`powershell
|
|
83
|
-
agent-inspector --background --no-open
|
|
85
|
+
agent-inspector --mode simple --background --no-open
|
|
84
86
|
Invoke-RestMethod -Uri "http://localhost:${port}/api/health" -TimeoutSec 3
|
|
87
|
+
Invoke-RestMethod -Uri "http://localhost:${port}/api/config" -TimeoutSec 3 | Select-Object captureMode
|
|
85
88
|
\`\`\`
|
|
86
89
|
|
|
87
90
|
\`\`\`bash
|
|
88
|
-
agent-inspector --background --no-open
|
|
91
|
+
agent-inspector --mode simple --background --no-open
|
|
89
92
|
curl -fsS "http://localhost:${port}/api/health"
|
|
93
|
+
curl -fsS "http://localhost:${port}/api/config" | grep -o '"captureMode":"[^"]*"'
|
|
90
94
|
\`\`\`
|
|
91
95
|
|
|
92
|
-
If the health check fails, show only the relevant error and ask whether to diagnose startup before editing Codex config.
|
|
96
|
+
If the health check fails, show only the relevant error and ask whether to diagnose startup before editing Codex config. If the active capture mode is not \`simple\`, explain that an existing process is already running and offer to restart with \`agent-inspector --mode simple --force-restart\`.
|
|
93
97
|
|
|
94
98
|
---
|
|
95
99
|
|
|
@@ -226,11 +226,13 @@ if ($null) { Write-Host 'claude-code: present' } else { Write-Host 'claude-code:
|
|
|
226
226
|
\`\`\`
|
|
227
227
|
## Welcome to Agent Inspector!
|
|
228
228
|
|
|
229
|
-
Agent Inspector is an agent observability and knowledge-capture platform for AI coding tools. The \`agent-inspector\` CLI runs a transparent local proxy + Web UI, so you can see
|
|
229
|
+
Agent Inspector is an agent observability and knowledge-capture platform for AI coding tools. The \`agent-inspector\` CLI runs a transparent local proxy + Web UI, so you can see model requests and responses, system prompts, tool definitions, message history, timing, and token counts captured live in a browser tab.
|
|
230
|
+
|
|
231
|
+
Agent Inspector starts in **Simple mode** by default. Simple mode is the right habit for everyday use: it keeps requests, responses, tools, timing, and token usage while avoiding heavier raw headers, raw response, and detailed SSE chunk artifacts. Use **Full mode** only when the user is debugging provider headers, raw response payloads, or SSE stream details.
|
|
230
232
|
|
|
231
233
|
**What we'll do in the next ~10 minutes:**
|
|
232
234
|
1. Add your first LLM provider (Anthropic or OpenAI key)
|
|
233
|
-
2. Start the proxy
|
|
235
|
+
2. Start the proxy in Simple mode
|
|
234
236
|
3. Wire your AI tool to use it
|
|
235
237
|
4. Capture a first request end-to-end
|
|
236
238
|
5. Tour the key UI affordances
|
|
@@ -346,7 +348,7 @@ $json | Set-Content -Path $file -Encoding UTF8
|
|
|
346
348
|
|
|
347
349
|
## Phase 3: Start proxy
|
|
348
350
|
|
|
349
|
-
**EXPLAIN:** "Time to start the proxy. It binds to port ${port} by default, reuses an already-running healthy agent-inspector, and prints the URL. Use \`--force-restart\` only when you intentionally want to replace the existing process."
|
|
351
|
+
**EXPLAIN:** "Time to start the proxy. It binds to port ${port} by default, starts in Simple mode for lower overhead, reuses an already-running healthy agent-inspector, and prints the URL. Use \`--force-restart\` only when you intentionally want to replace the existing process. If the user is diagnosing raw headers, raw response, or SSE chunks, restart with \`agent-inspector --mode full\`."
|
|
350
352
|
|
|
351
353
|
**DO:** Skip this phase entirely if the Phase 0 health check already reported \`PROXY: up\` and the user opted to skip done phases.
|
|
352
354
|
|
|
@@ -354,7 +356,7 @@ $json | Set-Content -Path $file -Encoding UTF8
|
|
|
354
356
|
|
|
355
357
|
\`\`\`bash
|
|
356
358
|
# Unix / macOS / WSL
|
|
357
|
-
agent-inspector --background --no-open > /tmp/agent-inspector.log 2>&1
|
|
359
|
+
agent-inspector --mode simple --background --no-open > /tmp/agent-inspector.log 2>&1
|
|
358
360
|
\`\`\`
|
|
359
361
|
|
|
360
362
|
\`\`\`powershell
|
|
@@ -367,14 +369,14 @@ $err = Join-Path $env:TEMP 'agent-inspector.err.log'
|
|
|
367
369
|
$found = Get-Command agent-inspector -ErrorAction SilentlyContinue
|
|
368
370
|
if ($found) {
|
|
369
371
|
$shim = $found.Source
|
|
370
|
-
$args = '--background','--no-open'
|
|
372
|
+
$args = '--mode','simple','--background','--no-open'
|
|
371
373
|
} elseif (Test-Path (Join-Path $env:APPDATA 'npm/agent-inspector.cmd')) {
|
|
372
374
|
$shim = Join-Path $env:APPDATA 'npm/agent-inspector.cmd'
|
|
373
|
-
$args = '--background','--no-open'
|
|
375
|
+
$args = '--mode','simple','--background','--no-open'
|
|
374
376
|
} else {
|
|
375
377
|
# bin not on PATH and not at the default npm prefix — let cmd resolve it
|
|
376
378
|
$shim = 'cmd.exe'
|
|
377
|
-
$args = '/c','agent-inspector','--background','--no-open'
|
|
379
|
+
$args = '/c','agent-inspector','--mode','simple','--background','--no-open'
|
|
378
380
|
}
|
|
379
381
|
Start-Process -FilePath $shim -ArgumentList $args -RedirectStandardOutput $log -RedirectStandardError $err -WindowStyle Hidden
|
|
380
382
|
\`\`\`
|
|
@@ -394,6 +396,12 @@ done
|
|
|
394
396
|
curl -sS "http://localhost:${port}/api/health"
|
|
395
397
|
\`\`\`
|
|
396
398
|
|
|
399
|
+
**DO:** Read \`/api/config\` and tell the user which capture mode is active. If it is not \`simple\` during onboarding, explain that an existing process is already running and offer to restart with \`agent-inspector --mode simple --force-restart\`.
|
|
400
|
+
|
|
401
|
+
\`\`\`bash
|
|
402
|
+
curl -sS "http://localhost:${port}/api/config" | grep -o '"captureMode":"[^"]*"'
|
|
403
|
+
\`\`\`
|
|
404
|
+
|
|
397
405
|
> **PAUSE** — if the health check fails, show the user the log file (\`/tmp/agent-inspector.log\` or \`%TEMP%\\agent-inspector.log\`) and diagnose. Common issues: another process on the port, firewall, missing providers. Use \`AskUserQuestion\` with header \`Proxy up?\` and options \`["Yes, proxy is up", "No, I see an error in the log"]\`. Wait for the answer.
|
|
398
406
|
|
|
399
407
|
---
|
package/src/cli.ts
CHANGED
|
@@ -11,6 +11,9 @@ const __dirname = dirname(__filename);
|
|
|
11
11
|
const DEFAULT_PORT = 25947;
|
|
12
12
|
const LOCAL_PROBE_TIMEOUT_MS = 2000;
|
|
13
13
|
const BRANDED_WINDOWS_RUNTIME_EXE = "agent-inspector.exe";
|
|
14
|
+
const DEFAULT_CAPTURE_MODE = "simple";
|
|
15
|
+
|
|
16
|
+
type CaptureMode = "simple" | "full";
|
|
14
17
|
|
|
15
18
|
process.title = "Agent Inspector";
|
|
16
19
|
|
|
@@ -56,6 +59,24 @@ async function isInspectorHealthy(port: number): Promise<boolean> {
|
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
61
|
|
|
62
|
+
async function getRunningCaptureMode(port: number): Promise<CaptureMode | null> {
|
|
63
|
+
const controller = new AbortController();
|
|
64
|
+
const timeout = setTimeout(() => controller.abort(), LOCAL_PROBE_TIMEOUT_MS);
|
|
65
|
+
try {
|
|
66
|
+
const response = await fetch(`http://127.0.0.1:${port}/api/config`, {
|
|
67
|
+
cache: "no-store",
|
|
68
|
+
signal: controller.signal,
|
|
69
|
+
});
|
|
70
|
+
if (!response.ok) return null;
|
|
71
|
+
const raw: unknown = await response.json();
|
|
72
|
+
return readCaptureMode(raw);
|
|
73
|
+
} catch {
|
|
74
|
+
return null;
|
|
75
|
+
} finally {
|
|
76
|
+
clearTimeout(timeout);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
59
80
|
function isPortAcceptingConnections(port: number): Promise<boolean> {
|
|
60
81
|
return new Promise((resolve) => {
|
|
61
82
|
const socket = createConnection({ host: "127.0.0.1", port });
|
|
@@ -138,9 +159,31 @@ function resolveServerCommand(outputDir: string, serverPath: string): ServerComm
|
|
|
138
159
|
: { command: process.execPath, args: [serverPath] };
|
|
139
160
|
}
|
|
140
161
|
|
|
162
|
+
function parseCaptureMode(value: string | undefined): CaptureMode | null {
|
|
163
|
+
switch (value) {
|
|
164
|
+
case undefined:
|
|
165
|
+
return null;
|
|
166
|
+
case "simple":
|
|
167
|
+
return "simple";
|
|
168
|
+
case "full":
|
|
169
|
+
return "full";
|
|
170
|
+
default:
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function readCaptureMode(raw: unknown): CaptureMode | null {
|
|
176
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
|
|
177
|
+
const descriptor = Object.getOwnPropertyDescriptor(raw, "captureMode");
|
|
178
|
+
const value: unknown = descriptor?.value;
|
|
179
|
+
return typeof value === "string" ? parseCaptureMode(value) : null;
|
|
180
|
+
}
|
|
181
|
+
|
|
141
182
|
async function runStart(args: string[]): Promise<void> {
|
|
142
183
|
const envPort = process.env["PORT"];
|
|
143
184
|
const portDefault = envPort !== undefined ? Number(envPort) : DEFAULT_PORT;
|
|
185
|
+
const envMode =
|
|
186
|
+
process.env["AGENT_INSPECTOR_CAPTURE_MODE"] ?? process.env["AGENT_INSPECTOR_MODE"];
|
|
144
187
|
|
|
145
188
|
let port = portDefault;
|
|
146
189
|
let open = true;
|
|
@@ -149,9 +192,34 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
149
192
|
let forceRestart = false;
|
|
150
193
|
let configDir: string | undefined;
|
|
151
194
|
let providersJson: string | undefined;
|
|
195
|
+
let captureMode = DEFAULT_CAPTURE_MODE;
|
|
196
|
+
let captureModeWasSpecified = false;
|
|
197
|
+
|
|
198
|
+
if (envMode !== undefined && envMode !== "") {
|
|
199
|
+
const parsedMode = parseCaptureMode(envMode);
|
|
200
|
+
if (parsedMode === null) {
|
|
201
|
+
console.error(`Invalid capture mode: ${envMode}. Use simple or full.`);
|
|
202
|
+
process.exitCode = 1;
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
captureMode = parsedMode;
|
|
206
|
+
captureModeWasSpecified = true;
|
|
207
|
+
}
|
|
152
208
|
|
|
153
209
|
for (let i = 0; i < args.length; i++) {
|
|
154
210
|
const arg = args[i] ?? "";
|
|
211
|
+
if (arg.startsWith("--mode=") || arg.startsWith("--capture-mode=")) {
|
|
212
|
+
const value = arg.slice(arg.indexOf("=") + 1);
|
|
213
|
+
const parsedMode = parseCaptureMode(value);
|
|
214
|
+
if (parsedMode === null) {
|
|
215
|
+
console.error(`Invalid capture mode: ${value}. Use simple or full.`);
|
|
216
|
+
process.exitCode = 1;
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
captureMode = parsedMode;
|
|
220
|
+
captureModeWasSpecified = true;
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
155
223
|
switch (arg) {
|
|
156
224
|
case "--port":
|
|
157
225
|
case "-p":
|
|
@@ -181,6 +249,20 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
181
249
|
providersJson = args[i + 1];
|
|
182
250
|
i++;
|
|
183
251
|
break;
|
|
252
|
+
case "--mode":
|
|
253
|
+
case "--capture-mode": {
|
|
254
|
+
const value = args[i + 1];
|
|
255
|
+
const parsedMode = parseCaptureMode(value);
|
|
256
|
+
if (parsedMode === null) {
|
|
257
|
+
console.error(`Invalid capture mode: ${String(value)}. Use simple or full.`);
|
|
258
|
+
process.exitCode = 1;
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
captureMode = parsedMode;
|
|
262
|
+
captureModeWasSpecified = true;
|
|
263
|
+
i++;
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
184
266
|
default:
|
|
185
267
|
break;
|
|
186
268
|
}
|
|
@@ -270,6 +352,13 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
270
352
|
|
|
271
353
|
if (!forceRestart && (await isInspectorHealthy(port))) {
|
|
272
354
|
console.log(`agent-inspector is already running at ${url}`);
|
|
355
|
+
if (captureModeWasSpecified) {
|
|
356
|
+
const runningMode = await getRunningCaptureMode(port);
|
|
357
|
+
if (runningMode !== null && runningMode !== captureMode) {
|
|
358
|
+
console.log(`Existing instance capture mode is ${runningMode}; requested ${captureMode}.`);
|
|
359
|
+
console.log(`Use --force-restart to restart with ${captureMode} mode.`);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
273
362
|
console.log(`Use --force-restart to restart the existing instance.`);
|
|
274
363
|
if (open && openWasSpecified) {
|
|
275
364
|
openBrowser(url);
|
|
@@ -289,6 +378,7 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
289
378
|
}
|
|
290
379
|
|
|
291
380
|
console.log(`Server running at ${url}`);
|
|
381
|
+
console.log(` Capture mode: ${captureMode}`);
|
|
292
382
|
console.log(` Proxy: ${url}/proxy`);
|
|
293
383
|
console.log(``);
|
|
294
384
|
console.log(`Route AI coding tools through the proxy:`);
|
|
@@ -339,6 +429,7 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
339
429
|
if (providersJson !== undefined) {
|
|
340
430
|
serverEnv["AGENT_INSPECTOR_PROVIDERS_JSON"] = providersJson;
|
|
341
431
|
}
|
|
432
|
+
serverEnv["AGENT_INSPECTOR_CAPTURE_MODE"] = captureMode;
|
|
342
433
|
const serverProcess = spawn(serverCommand.command, serverCommand.args, {
|
|
343
434
|
stdio: background ? ["ignore", "ignore", "ignore"] : "inherit",
|
|
344
435
|
detached: background,
|
|
@@ -7,10 +7,12 @@ import { useOnboarding } from "../lib/useOnboarding";
|
|
|
7
7
|
* dismissal through the server runtime config.
|
|
8
8
|
*/
|
|
9
9
|
export function OnboardingBanner(): JSX.Element | null {
|
|
10
|
-
const { hasSeenOnboarding, isLoading, markSeen } = useOnboarding();
|
|
10
|
+
const { hasSeenOnboarding, captureMode, isLoading, markSeen } = useOnboarding();
|
|
11
11
|
|
|
12
12
|
if (isLoading || hasSeenOnboarding) return null;
|
|
13
13
|
|
|
14
|
+
const isFullMode = captureMode === "full";
|
|
15
|
+
|
|
14
16
|
return (
|
|
15
17
|
<div
|
|
16
18
|
role="note"
|
|
@@ -19,17 +21,38 @@ export function OnboardingBanner(): JSX.Element | null {
|
|
|
19
21
|
>
|
|
20
22
|
<div className="min-w-0 flex-1">
|
|
21
23
|
<div className="mb-1 font-medium text-amber-600 dark:text-amber-400">
|
|
22
|
-
|
|
24
|
+
{isFullMode
|
|
25
|
+
? "Agent Inspector is ready in Full mode"
|
|
26
|
+
: "Agent Inspector is ready in Simple mode"}
|
|
23
27
|
</div>
|
|
24
28
|
<ul className="space-y-0.5 text-xs leading-relaxed text-muted-foreground">
|
|
29
|
+
{isFullMode ? (
|
|
30
|
+
<>
|
|
31
|
+
<li>
|
|
32
|
+
<strong>Full mode</strong>: raw headers, raw response, and SSE chunks are captured
|
|
33
|
+
for diagnostics.
|
|
34
|
+
</li>
|
|
35
|
+
<li>
|
|
36
|
+
<strong>Daily work</strong>: restart with <code>agent-inspector --mode simple</code>{" "}
|
|
37
|
+
to reduce capture overhead.
|
|
38
|
+
</li>
|
|
39
|
+
</>
|
|
40
|
+
) : (
|
|
41
|
+
<>
|
|
42
|
+
<li>
|
|
43
|
+
<strong>Simple mode</strong>: lightweight capture for requests, responses, tools,
|
|
44
|
+
timing, and token usage.
|
|
45
|
+
</li>
|
|
46
|
+
<li>
|
|
47
|
+
<strong>Need diagnostics?</strong> Restart with{" "}
|
|
48
|
+
<code>agent-inspector --mode full</code> for raw headers, raw response, and SSE
|
|
49
|
+
chunks.
|
|
50
|
+
</li>
|
|
51
|
+
</>
|
|
52
|
+
)}
|
|
25
53
|
<li>
|
|
26
|
-
<strong>
|
|
27
|
-
|
|
28
|
-
<li>
|
|
29
|
-
<strong>Replay</strong>: resend captured requests and compare provider behavior.
|
|
30
|
-
</li>
|
|
31
|
-
<li>
|
|
32
|
-
<strong>Memory</strong>: create reviewable candidates before promotion to OpenClaw.
|
|
54
|
+
<strong>Replay and Memory</strong>: available in both modes for provider checks and
|
|
55
|
+
reviewable knowledge candidates.
|
|
33
56
|
</li>
|
|
34
57
|
</ul>
|
|
35
58
|
</div>
|