@tonyclaw/agent-inspector 2.0.26 → 2.0.27

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.
Files changed (40) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{CompareDrawer-DBTFzxG5.js → CompareDrawer-B_p6vmMQ.js} +1 -1
  3. package/.output/public/assets/{ProxyViewerContainer-ivZk8MgE.js → ProxyViewerContainer-DItqh1EO.js} +4 -4
  4. package/.output/public/assets/{ReplayDialog-syW2hDNE.js → ReplayDialog-BmprJ6D3.js} +1 -1
  5. package/.output/public/assets/{RequestAnatomy-BkuRtY9o.js → RequestAnatomy-DqO0_SVJ.js} +1 -1
  6. package/.output/public/assets/{ResponseView-BwyvEvoE.js → ResponseView-FZbPNdHa.js} +1 -1
  7. package/.output/public/assets/{StreamingChunkSequence-BY4MbPKg.js → StreamingChunkSequence-BZPzfJWj.js} +1 -1
  8. package/.output/public/assets/_sessionId-y2ATIp51.js +1 -0
  9. package/.output/public/assets/index-CQT4higx.js +1 -0
  10. package/.output/public/assets/{main-DKRDRBdd.js → main-CzItFZlM.js} +2 -2
  11. package/.output/server/_libs/modelcontextprotocol__server.mjs +228 -0
  12. package/.output/server/{_sessionId-VDd4N_1B.mjs → _sessionId-DZH8SrEZ.mjs} +3 -3
  13. package/.output/server/_ssr/{CompareDrawer-BQZlxsOC.mjs → CompareDrawer-L0aE1UV1.mjs} +2 -2
  14. package/.output/server/_ssr/{ProxyViewerContainer-njY2oQCc.mjs → ProxyViewerContainer-B62RB9ER.mjs} +7 -7
  15. package/.output/server/_ssr/{ReplayDialog-B8lkdAIh.mjs → ReplayDialog-FVWnpx2C.mjs} +3 -3
  16. package/.output/server/_ssr/{RequestAnatomy-CwOTfdwS.mjs → RequestAnatomy-DIyqW-Ny.mjs} +2 -2
  17. package/.output/server/_ssr/{ResponseView-3Iz_mZpd.mjs → ResponseView-BX4mxEZ5.mjs} +2 -2
  18. package/.output/server/_ssr/{StreamingChunkSequence-hmJcQNW5.mjs → StreamingChunkSequence-Cs3nzOor.mjs} +2 -2
  19. package/.output/server/_ssr/{index-UuTKM4aC.mjs → index-Dik2Mc3h.mjs} +2 -2
  20. package/.output/server/_ssr/index.mjs +2 -2
  21. package/.output/server/_ssr/{router-C7InHrxE.mjs → router-DCPg8ykx.mjs} +1816 -151
  22. package/.output/server/_tanstack-start-manifest_v-BaoL3JCh.mjs +4 -0
  23. package/.output/server/index.mjs +57 -57
  24. package/README.md +55 -1
  25. package/package.json +1 -1
  26. package/src/lib/runContract.ts +162 -0
  27. package/src/mcp/server.ts +554 -2
  28. package/src/mcp/toolHandlers.ts +154 -0
  29. package/src/proxy/evidenceAnalysis.ts +522 -0
  30. package/src/proxy/evidenceExporter.ts +215 -0
  31. package/src/proxy/logSearch.ts +118 -0
  32. package/src/proxy/runFailures.ts +100 -0
  33. package/src/proxy/runStore.ts +159 -0
  34. package/src/routes/api/logs.ts +16 -0
  35. package/src/routes/api/runs.$runId.evidence.ts +62 -0
  36. package/src/routes/api/runs.$runId.ts +50 -0
  37. package/src/routes/api/runs.ts +58 -0
  38. package/.output/public/assets/_sessionId-XlPUgIIb.js +0 -1
  39. package/.output/public/assets/index-By11a28-.js +0 -1
  40. package/.output/server/_tanstack-start-manifest_v-B6yfnMHA.mjs +0 -4
@@ -0,0 +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/runs", "/api/sessions", "/proxy/$", "/session/$sessionId", "/api/knowledge/candidates", "/api/knowledge/project-context", "/api/knowledge/search", "/api/knowledge/sessions/$sessionId/candidates"], "preloads": ["/assets/main-CzItFZlM.js"], "assets": [] }, "/": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/index.tsx", "assets": [], "preloads": ["/assets/index-CQT4higx.js", "/assets/ProxyViewerContainer-DItqh1EO.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/runs": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/runs.ts", "children": ["/api/runs/$runId"] }, "/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-y2ATIp51.js", "/assets/ProxyViewerContainer-DItqh1EO.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/runs/$runId": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/runs.$runId.ts", "children": ["/api/runs/$runId/evidence"] }, "/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/runs/$runId/evidence": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/runs.$runId.evidence.ts" }, "/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-CzItFZlM.js" });
2
+ export {
3
+ tsrStartManifest
4
+ };
@@ -35,103 +35,103 @@ const headers = ((m) => function headersRouteRule(event) {
35
35
  }
36
36
  });
37
37
  const assets = {
38
+ "/assets/index-CQT4higx.js": {
39
+ "type": "text/javascript; charset=utf-8",
40
+ "etag": '"74-gWIAXMUZANjNHlWTIO5NeVHxrXg"',
41
+ "mtime": "2026-06-30T01:22:22.129Z",
42
+ "size": 116,
43
+ "path": "../public/assets/index-CQT4higx.js"
44
+ },
45
+ "/assets/CompareDrawer-B_p6vmMQ.js": {
46
+ "type": "text/javascript; charset=utf-8",
47
+ "etag": '"49fe-MtnQEnhved8xLSD42VJ6I1PWK+E"',
48
+ "mtime": "2026-06-30T01:22:22.129Z",
49
+ "size": 18942,
50
+ "path": "../public/assets/CompareDrawer-B_p6vmMQ.js"
51
+ },
38
52
  "/assets/alibaba-TTwafVwX.svg": {
39
53
  "type": "image/svg+xml",
40
54
  "etag": '"171b-6dyV5K8QjiaY35sN9qNprh9zDIs"',
41
- "mtime": "2026-06-30T00:03:39.766Z",
55
+ "mtime": "2026-06-30T01:22:22.129Z",
42
56
  "size": 5915,
43
57
  "path": "../public/assets/alibaba-TTwafVwX.svg"
44
58
  },
45
- "/assets/CompareDrawer-DBTFzxG5.js": {
46
- "type": "text/javascript; charset=utf-8",
47
- "etag": '"49fe-0/x6kUv/QAjBzcBGGqiJEK7CrGo"',
48
- "mtime": "2026-06-30T00:03:39.766Z",
49
- "size": 18942,
50
- "path": "../public/assets/CompareDrawer-DBTFzxG5.js"
51
- },
52
- "/assets/ReplayDialog-syW2hDNE.js": {
53
- "type": "text/javascript; charset=utf-8",
54
- "etag": '"318c-NQmbQD7SPA/gh+gt24ulUI098ko"',
55
- "mtime": "2026-06-30T00:03:39.766Z",
56
- "size": 12684,
57
- "path": "../public/assets/ReplayDialog-syW2hDNE.js"
58
- },
59
- "/assets/index-By11a28-.js": {
60
- "type": "text/javascript; charset=utf-8",
61
- "etag": '"74-wKECK+LXurWi55O6mYvJFEu73U4"',
62
- "mtime": "2026-06-30T00:03:39.766Z",
63
- "size": 116,
64
- "path": "../public/assets/index-By11a28-.js"
65
- },
66
59
  "/assets/index-DsiKfWCp.css": {
67
60
  "type": "text/css; charset=utf-8",
68
61
  "etag": '"1a3d5-pnLJEAiyUUKlRw5OUnvwf1dCQeI"',
69
- "mtime": "2026-06-30T00:03:39.766Z",
62
+ "mtime": "2026-06-30T01:22:22.129Z",
70
63
  "size": 107477,
71
64
  "path": "../public/assets/index-DsiKfWCp.css"
72
65
  },
73
- "/assets/main-DKRDRBdd.js": {
66
+ "/assets/minimax-BPMzvuL-.jpeg": {
67
+ "type": "image/jpeg",
68
+ "etag": '"1b06-IwivU89ko5UTMUM1/t7hn4sQK9A"',
69
+ "mtime": "2026-06-30T01:22:22.129Z",
70
+ "size": 6918,
71
+ "path": "../public/assets/minimax-BPMzvuL-.jpeg"
72
+ },
73
+ "/assets/ReplayDialog-BmprJ6D3.js": {
74
74
  "type": "text/javascript; charset=utf-8",
75
- "etag": '"51726-1JXlqBObsVCWwZtRttZD0+8rmmo"',
76
- "mtime": "2026-06-30T00:03:39.766Z",
77
- "size": 333606,
78
- "path": "../public/assets/main-DKRDRBdd.js"
75
+ "etag": '"318c-AmdKZr32QndralPtdyOHXT6ma8g"',
76
+ "mtime": "2026-06-30T01:22:22.129Z",
77
+ "size": 12684,
78
+ "path": "../public/assets/ReplayDialog-BmprJ6D3.js"
79
79
  },
80
- "/assets/RequestAnatomy-BkuRtY9o.js": {
80
+ "/assets/RequestAnatomy-DqO0_SVJ.js": {
81
81
  "type": "text/javascript; charset=utf-8",
82
- "etag": '"4485-ei5S3iwPLFX3XUKIwoNDXt6pfeg"',
83
- "mtime": "2026-06-30T00:03:39.766Z",
82
+ "etag": '"4485-Dn6zXY3u3Xh6+Mf8Wqy0LovvrJc"',
83
+ "mtime": "2026-06-30T01:22:22.129Z",
84
84
  "size": 17541,
85
- "path": "../public/assets/RequestAnatomy-BkuRtY9o.js"
85
+ "path": "../public/assets/RequestAnatomy-DqO0_SVJ.js"
86
86
  },
87
- "/assets/ResponseView-BwyvEvoE.js": {
87
+ "/assets/ResponseView-FZbPNdHa.js": {
88
88
  "type": "text/javascript; charset=utf-8",
89
- "etag": '"30d0-NcNgH32g8TreiCI4JgpE13I81fo"',
90
- "mtime": "2026-06-30T00:03:39.766Z",
89
+ "etag": '"30d0-Vy37cZ6aojvHWlD+tTR85FfRRSM"',
90
+ "mtime": "2026-06-30T01:22:22.131Z",
91
91
  "size": 12496,
92
- "path": "../public/assets/ResponseView-BwyvEvoE.js"
92
+ "path": "../public/assets/ResponseView-FZbPNdHa.js"
93
93
  },
94
- "/assets/StreamingChunkSequence-BY4MbPKg.js": {
94
+ "/assets/StreamingChunkSequence-BZPzfJWj.js": {
95
95
  "type": "text/javascript; charset=utf-8",
96
- "etag": '"d57-HwRjNFQZ5p5h2qA6wui4VPdas/g"',
97
- "mtime": "2026-06-30T00:03:39.766Z",
96
+ "etag": '"d57-pfsl61xCHzpslTaweknYjZ2A3D4"',
97
+ "mtime": "2026-06-30T01:22:22.131Z",
98
98
  "size": 3415,
99
- "path": "../public/assets/StreamingChunkSequence-BY4MbPKg.js"
100
- },
101
- "/assets/minimax-BPMzvuL-.jpeg": {
102
- "type": "image/jpeg",
103
- "etag": '"1b06-IwivU89ko5UTMUM1/t7hn4sQK9A"',
104
- "mtime": "2026-06-30T00:03:39.765Z",
105
- "size": 6918,
106
- "path": "../public/assets/minimax-BPMzvuL-.jpeg"
99
+ "path": "../public/assets/StreamingChunkSequence-BZPzfJWj.js"
107
100
  },
108
101
  "/assets/zhipuai-BPNAnxo-.svg": {
109
102
  "type": "image/svg+xml",
110
103
  "etag": '"2bf8-hNaLCTi89nOFCsIIfWpP/jrfo0s"',
111
- "mtime": "2026-06-30T00:03:39.766Z",
104
+ "mtime": "2026-06-30T01:22:22.129Z",
112
105
  "size": 11256,
113
106
  "path": "../public/assets/zhipuai-BPNAnxo-.svg"
114
107
  },
115
- "/assets/_sessionId-XlPUgIIb.js": {
108
+ "/assets/_sessionId-y2ATIp51.js": {
116
109
  "type": "text/javascript; charset=utf-8",
117
- "etag": '"d2-MoOX/bvv9993P6qEc8POysKqaj0"',
118
- "mtime": "2026-06-30T00:03:39.766Z",
110
+ "etag": '"d2-Pjbf+xPeCq/pZGai1EzjS0QCV6Q"',
111
+ "mtime": "2026-06-30T01:22:22.129Z",
119
112
  "size": 210,
120
- "path": "../public/assets/_sessionId-XlPUgIIb.js"
113
+ "path": "../public/assets/_sessionId-y2ATIp51.js"
114
+ },
115
+ "/assets/main-CzItFZlM.js": {
116
+ "type": "text/javascript; charset=utf-8",
117
+ "etag": '"51726-MNggoHWYk07f7qXrHiC/ZapXa7o"',
118
+ "mtime": "2026-06-30T01:22:22.129Z",
119
+ "size": 333606,
120
+ "path": "../public/assets/main-CzItFZlM.js"
121
121
  },
122
122
  "/assets/qwen-CONDcHqt.png": {
123
123
  "type": "image/png",
124
124
  "etag": '"572c3-cdJAPaHdOvFCGzuaQjagdgOu6XE"',
125
- "mtime": "2026-06-30T00:03:39.766Z",
125
+ "mtime": "2026-06-30T01:22:22.129Z",
126
126
  "size": 357059,
127
127
  "path": "../public/assets/qwen-CONDcHqt.png"
128
128
  },
129
- "/assets/ProxyViewerContainer-ivZk8MgE.js": {
129
+ "/assets/ProxyViewerContainer-DItqh1EO.js": {
130
130
  "type": "text/javascript; charset=utf-8",
131
- "etag": '"af111-IykBkxC0TII63qeShJvyrJajFT0"',
132
- "mtime": "2026-06-30T00:03:39.766Z",
131
+ "etag": '"af111-hYBEti7PXxO28eHLSM5rHWrM0Vg"',
132
+ "mtime": "2026-06-30T01:22:22.131Z",
133
133
  "size": 717073,
134
- "path": "../public/assets/ProxyViewerContainer-ivZk8MgE.js"
134
+ "path": "../public/assets/ProxyViewerContainer-DItqh1EO.js"
135
135
  }
136
136
  };
137
137
  function readAsset(id) {
package/README.md CHANGED
@@ -9,6 +9,7 @@ The npm package and CLI remain `agent-inspector`; the platform name is Agent Ins
9
9
  - Runs a local transparent proxy for Anthropic and OpenAI-compatible APIs.
10
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
+ - Exposes sessions, logs, runs, and evidence packs through MCP Tools, Resources, and Prompts.
12
13
  - Includes a Chrome companion extension for quick capture status and log navigation.
13
14
  - Generates reviewable knowledge candidates from agent sessions.
14
15
  - Bridges approved knowledge to OpenClaw while keeping OpenClaw hidden behind the Inspector surface.
@@ -107,7 +108,7 @@ The web UI runs at http://localhost:25947.
107
108
 
108
109
  - [Installation](docs/Installation.md): install and runtime notes.
109
110
  - [Usage](docs/Usage.md): daily capture, browsing, replay, and export workflows.
110
- - [MCP Server](docs/MCP-Server.md): MCP setup and tool usage for coding agents.
111
+ - [MCP Server](docs/MCP-Server.md): MCP setup plus tools, resources, prompts, and evidence usage for coding agents.
111
112
  - [Troubleshooting](docs/TROUBLESHOOTING.md): port, provider, MCP, Replay, Jenkins, and GitCode fixes.
112
113
  - [Jenkins + GitCode WebHook](docs/JENKINS_GITCODE_WEBHOOK_TUNNEL.md): team CI and tunnel setup.
113
114
  - [Local Release Helper](docs/LOCAL_RELEASE.md): local maintainer release helper.
@@ -142,9 +143,62 @@ can also set `AGENT_INSPECTOR_MODE=full` or
142
143
  `AGENT_INSPECTOR_CAPTURE_MODE=full`; the CLI flag takes precedence over the
143
144
  environment.
144
145
 
146
+ ## MCP Evidence Workflows
147
+
148
+ Agent Inspector exposes MCP at:
149
+
150
+ ```text
151
+ http://localhost:25947/api/mcp
152
+ ```
153
+
154
+ Coding agents can use the MCP surface in three ways:
155
+
156
+ - Tools: perform actions such as listing logs, reading bounded log details, testing providers,
157
+ creating evaluation runs, and exporting evidence packs.
158
+ - Resources: read stable evidence URIs without invoking a tool call.
159
+ - Prompts: start common analysis/reporting tasks from reusable templates.
160
+
161
+ The evaluation-oriented run flow is:
162
+
163
+ 1. Call `inspector_create_run` before a task starts to declare a stable `runId` and optional
164
+ `sessionId`.
165
+ 2. Call `inspector_update_run` as the task moves through `running`, `failed`, `completed`, or
166
+ `cancelled`; metadata keys are merged so CI can add build numbers, branch names, or case ids.
167
+ 3. Let the coding agent run through the proxy as usual.
168
+ 4. If something fails, call `inspector_get_recent_failures` or read
169
+ `inspector://failures/recent`, then use `inspector_search_logs` to locate suspicious log ids.
170
+ 5. Call `inspector_get_run` to inspect the declared run.
171
+ 6. Call `inspector_export_evidence` to write JSON, Markdown, and HTML artifacts under:
172
+
173
+ ```text
174
+ <dataDir>/evidence/<runId>/evidence.json
175
+ <dataDir>/evidence/<runId>/evidence.md
176
+ <dataDir>/evidence/<runId>/evidence.html
177
+ ```
178
+
179
+ Useful MCP resource URIs:
180
+
181
+ | Resource | Purpose |
182
+ | --- | --- |
183
+ | `inspector://sessions` | List known session ids. |
184
+ | `inspector://sessions/{sessionId}` | Read a compact session summary with Inspector links, counts, models, providers, token totals, and recent logs. |
185
+ | `inspector://logs/{id}` | Read bounded log details for one captured request. Large bodies are capped for agent safety. |
186
+ | `inspector://runs` | List declared evaluation runs. |
187
+ | `inspector://failures/recent` | Read recent failed/cancelled runs and non-success evidence classifications. |
188
+ | `inspector://runs/{runId}` | Read one declared run and its evidence paths. |
189
+ | `inspector://evidence/{runId}` | Read the exported Markdown evidence pack for a run. |
190
+
191
+ Built-in prompt templates help turn captured evidence into user-facing output:
192
+
193
+ - `inspector_analyze_session_failure`: explain why a session failed and cite log evidence.
194
+ - `inspector_triage_recent_failures`: prioritize recent failed runs and suggest next actions.
195
+ - `inspector_generate_jenkins_report`: produce a Jenkins-ready Markdown report for a run.
196
+ - `inspector_extract_repro_steps`: extract concise reproduction steps from a session.
197
+
145
198
  ## Jenkins And GitCode
146
199
 
147
200
  Team CI, GitCode WebHook setup, Cloudflare Tunnel notes, local push fallback, and the verified PR workflow live in [Jenkins + GitCode WebHook](docs/JENKINS_GITCODE_WEBHOOK_TUNNEL.md). Keep real Jenkins notify tokens, GitCode access tokens, and tunnel URLs out of the repository.
201
+
148
202
  ## Project Direction
149
203
 
150
204
  Agent Inspector should stay close to the proven inspector codebase while growing into an agent knowledge layer. The memory flow has four layers:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonyclaw/agent-inspector",
3
- "version": "2.0.26",
3
+ "version": "2.0.27",
4
4
  "type": "module",
5
5
  "description": "Agent observability and knowledge capture layer for AI coding tools.",
6
6
  "license": "MIT",
@@ -0,0 +1,162 @@
1
+ import { z } from "zod";
2
+ import { JsonValueSchema } from "../proxy/schemas";
3
+ import { SessionInfoSchema } from "./sessionInfoContract";
4
+
5
+ export const InspectorRunStatusSchema = z.enum([
6
+ "created",
7
+ "running",
8
+ "completed",
9
+ "failed",
10
+ "cancelled",
11
+ ]);
12
+
13
+ export const InspectorRunEvidenceSchema = z.object({
14
+ jsonPath: z.string(),
15
+ markdownPath: z.string(),
16
+ htmlPath: z.string(),
17
+ exportedAt: z.string(),
18
+ });
19
+
20
+ export const RunTimelineEventKindSchema = z.enum([
21
+ "run-created",
22
+ "session-started",
23
+ "request",
24
+ "session-finished",
25
+ "evidence-exported",
26
+ ]);
27
+
28
+ export const RunTimelineEventSeveritySchema = z.enum(["info", "success", "warning", "error"]);
29
+
30
+ export const RunTimelineEventSchema = z.object({
31
+ timestamp: z.string(),
32
+ kind: RunTimelineEventKindSchema,
33
+ severity: RunTimelineEventSeveritySchema,
34
+ title: z.string(),
35
+ details: z.string(),
36
+ logId: z.number().int().positive().nullable(),
37
+ status: z.number().nullable(),
38
+ model: z.string().nullable(),
39
+ provider: z.string().nullable(),
40
+ latencyMs: z.number().nullable(),
41
+ isStreaming: z.boolean().nullable(),
42
+ });
43
+
44
+ export const FailureCategorySchema = z.enum([
45
+ "none",
46
+ "active",
47
+ "provider-timeout",
48
+ "provider-http-error",
49
+ "provider-auth-error",
50
+ "provider-rate-limit",
51
+ "network-or-container",
52
+ "streaming-mismatch",
53
+ "context-pressure",
54
+ "runtime-task-error",
55
+ "model-output-error",
56
+ "unknown-failure",
57
+ "no-session-data",
58
+ ]);
59
+
60
+ export const FailureClassificationSchema = z.object({
61
+ outcome: z.enum(["success", "failure", "active", "unknown"]),
62
+ severity: z.enum(["none", "low", "medium", "high"]),
63
+ category: FailureCategorySchema,
64
+ summary: z.string(),
65
+ evidenceLogIds: z.array(z.number().int().positive()),
66
+ hints: z.array(z.string()),
67
+ });
68
+
69
+ export const JenkinsReportSchema = z.object({
70
+ status: z.enum(["PASS", "FAIL", "RUNNING", "UNKNOWN"]),
71
+ summary: z.string(),
72
+ markdown: z.string(),
73
+ });
74
+
75
+ export const InspectorRunSchema = z.object({
76
+ id: z.string(),
77
+ sessionId: z.string(),
78
+ title: z.string(),
79
+ task: z.string().nullable(),
80
+ project: z.string().nullable(),
81
+ agent: z.string().nullable(),
82
+ status: InspectorRunStatusSchema,
83
+ tags: z.array(z.string()),
84
+ metadata: z.record(z.string(), JsonValueSchema),
85
+ evidence: InspectorRunEvidenceSchema.nullable(),
86
+ createdAt: z.string(),
87
+ updatedAt: z.string(),
88
+ });
89
+
90
+ export const CreateInspectorRunInputSchema = z
91
+ .object({
92
+ runId: z.string().min(1).optional(),
93
+ sessionId: z.string().min(1).optional(),
94
+ title: z.string().min(1).optional(),
95
+ task: z.string().nullable().optional(),
96
+ project: z.string().nullable().optional(),
97
+ agent: z.string().nullable().optional(),
98
+ status: InspectorRunStatusSchema.optional(),
99
+ tags: z.array(z.string()).optional(),
100
+ metadata: z.record(z.string(), JsonValueSchema).optional(),
101
+ })
102
+ .optional();
103
+
104
+ export const UpdateInspectorRunInputSchema = z.object({
105
+ sessionId: z.string().min(1).optional(),
106
+ title: z.string().min(1).optional(),
107
+ task: z.string().nullable().optional(),
108
+ project: z.string().nullable().optional(),
109
+ agent: z.string().nullable().optional(),
110
+ status: InspectorRunStatusSchema.optional(),
111
+ tags: z.array(z.string()).optional(),
112
+ metadata: z.record(z.string(), JsonValueSchema).optional(),
113
+ });
114
+
115
+ export const EvidenceExportOptionsSchema = z
116
+ .object({
117
+ includeHistory: z.boolean().optional(),
118
+ latestLogLimit: z.number().int().positive().max(50).optional(),
119
+ })
120
+ .optional();
121
+
122
+ export const EvidenceExportResultSchema = z.object({
123
+ run: InspectorRunSchema,
124
+ evidence: InspectorRunEvidenceSchema,
125
+ session: SessionInfoSchema.nullable(),
126
+ timeline: z.array(RunTimelineEventSchema),
127
+ classification: FailureClassificationSchema,
128
+ jenkinsReport: JenkinsReportSchema,
129
+ });
130
+
131
+ export const RecentFailureSchema = z.object({
132
+ run: InspectorRunSchema,
133
+ classification: FailureClassificationSchema,
134
+ evidence: InspectorRunEvidenceSchema.nullable(),
135
+ jenkinsReport: JenkinsReportSchema.nullable(),
136
+ sessionId: z.string(),
137
+ inspectorUrl: z.string().nullable(),
138
+ evidenceMarkdownPath: z.string().nullable(),
139
+ updatedAt: z.string(),
140
+ });
141
+
142
+ export const RecentFailuresResponseSchema = z.object({
143
+ failures: z.array(RecentFailureSchema),
144
+ total: z.number().int().nonnegative(),
145
+ limit: z.number().int().positive(),
146
+ });
147
+
148
+ export type InspectorRunStatus = z.infer<typeof InspectorRunStatusSchema>;
149
+ export type InspectorRunEvidence = z.infer<typeof InspectorRunEvidenceSchema>;
150
+ export type RunTimelineEventKind = z.infer<typeof RunTimelineEventKindSchema>;
151
+ export type RunTimelineEventSeverity = z.infer<typeof RunTimelineEventSeveritySchema>;
152
+ export type RunTimelineEvent = z.infer<typeof RunTimelineEventSchema>;
153
+ export type FailureCategory = z.infer<typeof FailureCategorySchema>;
154
+ export type FailureClassification = z.infer<typeof FailureClassificationSchema>;
155
+ export type JenkinsReport = z.infer<typeof JenkinsReportSchema>;
156
+ export type InspectorRun = z.infer<typeof InspectorRunSchema>;
157
+ export type CreateInspectorRunInput = z.infer<typeof CreateInspectorRunInputSchema>;
158
+ export type UpdateInspectorRunInput = z.infer<typeof UpdateInspectorRunInputSchema>;
159
+ export type EvidenceExportOptions = z.infer<typeof EvidenceExportOptionsSchema>;
160
+ export type EvidenceExportResult = z.infer<typeof EvidenceExportResultSchema>;
161
+ export type RecentFailure = z.infer<typeof RecentFailureSchema>;
162
+ export type RecentFailuresResponse = z.infer<typeof RecentFailuresResponseSchema>;