agentflow-dashboard 0.3.0 → 0.4.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/README.md +116 -297
- package/dist/{chunk-2FTN742J.js → chunk-25MUPUYY.js} +748 -72
- package/dist/cli.cjs +584 -56
- package/dist/cli.js +2 -147
- package/dist/index.cjs +740 -67
- package/dist/index.js +1 -1
- package/dist/public/dashboard.js +401 -25
- package/dist/public/debug.html +43 -0
- package/dist/public/index.html +215 -1
- package/dist/server.cjs +1875 -0
- package/dist/server.js +6 -0
- package/package.json +21 -5
- package/public/dashboard.js +401 -25
- package/public/debug.html +43 -0
- package/public/index.html +215 -1
package/README.md
CHANGED
|
@@ -1,15 +1,39 @@
|
|
|
1
|
-
# AgentFlow Dashboard
|
|
1
|
+
# AgentFlow Dashboard v0.4.0
|
|
2
2
|
|
|
3
|
-
Real-time monitoring dashboard for
|
|
3
|
+
Real-time monitoring dashboard for AI agent systems. Visualize execution graphs, session transcripts, and performance metrics from any agent framework.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
### Universal Agent Monitoring
|
|
8
|
+
- **Multi-Format Ingestion** - AgentFlow JSON traces, JSONL session logs (Claude Code compatible), structured log files, cron run logs
|
|
9
|
+
- **Auto-Discovery** - Recursively scans directories for trace files, watches for new files in real-time
|
|
10
|
+
- **Framework Agnostic** - Works with any agent system that produces JSON traces or JSONL session logs
|
|
11
|
+
|
|
12
|
+
### 7 Interactive Tabs
|
|
13
|
+
- **Timeline** - Waterfall execution timeline with duration bars and status icons
|
|
14
|
+
- **Transcript** - Full conversation view: user messages, assistant responses, thinking blocks, tool calls
|
|
15
|
+
- **Graph** - Interactive Cytoscape.js execution flow visualization
|
|
16
|
+
- **Metrics** - Success rates, token usage, duration stats, node breakdown
|
|
17
|
+
- **Heatmap** - Error distribution across recent traces
|
|
18
|
+
- **State Machine** - Execution state flow diagram with node counts
|
|
19
|
+
- **Summary** - Auto-generated text summary with recommendations
|
|
20
|
+
|
|
21
|
+
### Session Transcripts
|
|
22
|
+
- Chat-bubble UI for JSONL sessions
|
|
23
|
+
- User/assistant messages, tool calls with args and results
|
|
24
|
+
- Collapsible thinking blocks
|
|
25
|
+
- Token usage and cost per message
|
|
26
|
+
- Subagent spawn tracking
|
|
27
|
+
|
|
28
|
+
### Process Health
|
|
29
|
+
- Live process detection and categorization
|
|
30
|
+
- PID file and systemd unit monitoring
|
|
31
|
+
- Orphan process detection
|
|
32
|
+
- CPU/memory resource tracking
|
|
33
|
+
|
|
34
|
+
### Real-Time Updates
|
|
35
|
+
- WebSocket live trace broadcasting with auto-reconnect
|
|
36
|
+
- File watcher triggers instant sidebar updates on new/changed files
|
|
13
37
|
|
|
14
38
|
## Quick Start
|
|
15
39
|
|
|
@@ -17,350 +41,145 @@ Real-time monitoring dashboard for AgentFlow - Visualize agent execution graphs
|
|
|
17
41
|
# Install globally
|
|
18
42
|
npm install -g agentflow-dashboard
|
|
19
43
|
|
|
20
|
-
#
|
|
44
|
+
# Monitor a traces directory
|
|
21
45
|
agentflow-dashboard --traces ./traces --port 3000
|
|
22
46
|
|
|
47
|
+
# Watch multiple directories
|
|
48
|
+
agentflow-dashboard \
|
|
49
|
+
--traces ./traces \
|
|
50
|
+
--data-dir ./sessions \
|
|
51
|
+
--data-dir ./cron-runs \
|
|
52
|
+
--host 0.0.0.0
|
|
53
|
+
|
|
23
54
|
# Or run with npx
|
|
24
55
|
npx agentflow-dashboard --traces ./my-agent-traces
|
|
25
56
|
```
|
|
26
57
|
|
|
27
58
|
Open http://localhost:3000 to view the dashboard.
|
|
28
59
|
|
|
29
|
-
##
|
|
60
|
+
## CLI Options
|
|
30
61
|
|
|
31
|
-
```bash
|
|
32
|
-
npm install agentflow-dashboard
|
|
33
62
|
```
|
|
34
|
-
|
|
35
|
-
**Requirements:**
|
|
36
|
-
- Node.js 18+
|
|
37
|
-
- AgentFlow traces directory
|
|
38
|
-
|
|
39
|
-
## Usage
|
|
40
|
-
|
|
41
|
-
### Command Line Interface
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
63
|
agentflow-dashboard [options]
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
**Options:**
|
|
48
|
-
- `-p, --port <number>` - Server port (default: 3000)
|
|
49
|
-
- `-t, --traces <path>` - Traces directory (default: ./traces)
|
|
50
|
-
- `-h, --host <address>` - Host address (default: localhost)
|
|
51
|
-
- `--cors` - Enable CORS headers
|
|
52
|
-
- `--help` - Show help message
|
|
53
|
-
|
|
54
|
-
### Examples
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
# Basic usage
|
|
58
|
-
agentflow-dashboard
|
|
59
64
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
agentflow-dashboard --traces ./my-ai-agent/traces
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### Programmatic Usage
|
|
71
|
-
|
|
72
|
-
```typescript
|
|
73
|
-
import { DashboardServer } from 'agentflow-dashboard';
|
|
74
|
-
|
|
75
|
-
const dashboard = new DashboardServer({
|
|
76
|
-
port: 3000,
|
|
77
|
-
tracesDir: './traces',
|
|
78
|
-
host: 'localhost',
|
|
79
|
-
enableCors: false
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
await dashboard.start();
|
|
83
|
-
console.log('Dashboard started!');
|
|
65
|
+
Options:
|
|
66
|
+
-p, --port <number> Server port (default: 3000)
|
|
67
|
+
-t, --traces <path> Primary traces directory (default: ./traces)
|
|
68
|
+
-h, --host <address> Host address (default: localhost)
|
|
69
|
+
--data-dir <path> Extra data directory (repeatable)
|
|
70
|
+
--cors Enable CORS headers
|
|
71
|
+
--help Show help message
|
|
84
72
|
```
|
|
85
73
|
|
|
86
|
-
##
|
|
87
|
-
|
|
88
|
-
### Overview Page
|
|
89
|
-
|
|
90
|
-
The main dashboard shows:
|
|
74
|
+
## Supported File Formats
|
|
91
75
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
76
|
+
| Format | Extension | Description |
|
|
77
|
+
|--------|-----------|-------------|
|
|
78
|
+
| AgentFlow JSON | `.json` | Execution graph traces with nodes, edges, timing |
|
|
79
|
+
| JSONL Sessions | `.jsonl` | Claude Code / OpenClaw session transcripts |
|
|
80
|
+
| Cron Run Logs | `.jsonl` | Job execution logs (`ts`, `jobId`, `action`, `status`) |
|
|
81
|
+
| Structured Logs | `.log` | Python structlog, JSON logs, key=value logs |
|
|
82
|
+
| Session Index | `sessions.json` | Agent session metadata (auto-discovered) |
|
|
96
83
|
|
|
97
|
-
###
|
|
84
|
+
### JSONL Session Format
|
|
98
85
|
|
|
99
|
-
|
|
86
|
+
Compatible with Claude Code session format:
|
|
100
87
|
|
|
101
|
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
### Real-Time Updates
|
|
107
|
-
|
|
108
|
-
The dashboard automatically updates when:
|
|
109
|
-
|
|
110
|
-
- New trace files are created
|
|
111
|
-
- Existing traces are updated
|
|
112
|
-
- Agent performance changes
|
|
113
|
-
- System status changes
|
|
114
|
-
|
|
115
|
-
## Configuration
|
|
116
|
-
|
|
117
|
-
### Directory Structure
|
|
118
|
-
|
|
119
|
-
The dashboard expects this structure:
|
|
120
|
-
|
|
121
|
-
```
|
|
122
|
-
traces/
|
|
123
|
-
├── agent1-2024-01-15T10-30-00.json
|
|
124
|
-
├── agent1-2024-01-15T10-35-00.json
|
|
125
|
-
├── agent2-2024-01-15T10-32-00.json
|
|
126
|
-
└── ...
|
|
88
|
+
```jsonl
|
|
89
|
+
{"type":"session","id":"abc123","timestamp":"2026-03-19T10:00:00Z"}
|
|
90
|
+
{"type":"model_change","modelId":"claude-sonnet-4-20250514","provider":"anthropic"}
|
|
91
|
+
{"type":"message","message":{"role":"user","content":[{"type":"text","text":"Hello"}]}}
|
|
92
|
+
{"type":"message","message":{"role":"assistant","content":[{"type":"text","text":"Hi!"}],"usage":{"input":100,"output":50}}}
|
|
127
93
|
```
|
|
128
94
|
|
|
129
|
-
### Trace
|
|
130
|
-
|
|
131
|
-
Compatible with standard AgentFlow trace format:
|
|
95
|
+
### AgentFlow Trace Format
|
|
132
96
|
|
|
133
97
|
```json
|
|
134
98
|
{
|
|
99
|
+
"id": "node_001",
|
|
100
|
+
"rootNodeId": "node_001",
|
|
135
101
|
"agentId": "my-agent",
|
|
136
|
-
"trigger": "
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
|
|
102
|
+
"trigger": "cron",
|
|
103
|
+
"startTime": 1710800000000,
|
|
104
|
+
"endTime": 1710800060000,
|
|
105
|
+
"status": "completed",
|
|
106
|
+
"nodes": {
|
|
107
|
+
"node_001": { "id": "node_001", "type": "agent", "name": "my-agent", "children": ["node_002"] },
|
|
108
|
+
"node_002": { "id": "node_002", "type": "tool", "name": "search", "children": [] }
|
|
109
|
+
}
|
|
142
110
|
}
|
|
143
111
|
```
|
|
144
112
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
- `AGENTFLOW_DASHBOARD_PORT` - Default port
|
|
148
|
-
- `AGENTFLOW_DASHBOARD_HOST` - Default host
|
|
149
|
-
- `AGENTFLOW_TRACES_DIR` - Default traces directory
|
|
150
|
-
|
|
151
|
-
## API Endpoints
|
|
152
|
-
|
|
153
|
-
The dashboard exposes REST endpoints for integration:
|
|
154
|
-
|
|
155
|
-
### GET /api/traces
|
|
156
|
-
Get all trace files with metadata.
|
|
157
|
-
|
|
158
|
-
```bash
|
|
159
|
-
curl http://localhost:3000/api/traces
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### GET /api/traces/:filename
|
|
163
|
-
Get specific trace file content.
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
curl http://localhost:3000/api/traces/agent1-2024-01-15T10-30-00.json
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### GET /api/stats
|
|
170
|
-
Get global performance statistics.
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
curl http://localhost:3000/api/stats
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
### GET /api/stats/:agentId
|
|
177
|
-
Get statistics for specific agent.
|
|
113
|
+
## Programmatic Usage
|
|
178
114
|
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
```
|
|
115
|
+
```typescript
|
|
116
|
+
import { DashboardServer } from 'agentflow-dashboard';
|
|
182
117
|
|
|
183
|
-
|
|
184
|
-
|
|
118
|
+
const dashboard = new DashboardServer({
|
|
119
|
+
port: 3000,
|
|
120
|
+
tracesDir: './traces',
|
|
121
|
+
dataDirs: ['./sessions', './cron-runs'],
|
|
122
|
+
host: 'localhost',
|
|
123
|
+
enableCors: false,
|
|
124
|
+
});
|
|
185
125
|
|
|
186
|
-
|
|
187
|
-
curl http://localhost:3000/api/agents
|
|
126
|
+
await dashboard.start();
|
|
188
127
|
```
|
|
189
128
|
|
|
190
|
-
##
|
|
191
|
-
|
|
192
|
-
### Docker Deployment
|
|
193
|
-
|
|
194
|
-
```dockerfile
|
|
195
|
-
FROM node:18-alpine
|
|
196
|
-
|
|
197
|
-
RUN npm install -g agentflow-dashboard
|
|
129
|
+
## API Endpoints
|
|
198
130
|
|
|
199
|
-
|
|
131
|
+
| Method | Endpoint | Description |
|
|
132
|
+
|--------|----------|-------------|
|
|
133
|
+
| GET | `/api/traces` | List all traces with metadata |
|
|
134
|
+
| GET | `/api/traces/:filename` | Full trace detail (nodes, events, token usage) |
|
|
135
|
+
| GET | `/api/traces/:filename/events` | Session events and token usage |
|
|
136
|
+
| GET | `/api/agents` | All discovered agents with metrics |
|
|
137
|
+
| GET | `/api/stats` | Global performance statistics |
|
|
138
|
+
| GET | `/api/stats/:agentId` | Per-agent statistics |
|
|
139
|
+
| GET | `/api/process-health` | Running process audit |
|
|
140
|
+
| WS | `/` | Real-time trace updates |
|
|
200
141
|
|
|
201
|
-
|
|
202
|
-
```
|
|
142
|
+
## Architecture
|
|
203
143
|
|
|
204
|
-
```yaml
|
|
205
|
-
# docker-compose.yml
|
|
206
|
-
version: '3.8'
|
|
207
|
-
services:
|
|
208
|
-
agentflow-dashboard:
|
|
209
|
-
image: node:18-alpine
|
|
210
|
-
ports:
|
|
211
|
-
- "3000:3000"
|
|
212
|
-
volumes:
|
|
213
|
-
- ./traces:/traces
|
|
214
|
-
command: >
|
|
215
|
-
sh -c "npm install -g agentflow-dashboard &&
|
|
216
|
-
agentflow-dashboard --host 0.0.0.0 --traces /traces"
|
|
217
144
|
```
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
replicas: 1
|
|
228
|
-
selector:
|
|
229
|
-
matchLabels:
|
|
230
|
-
app: agentflow-dashboard
|
|
231
|
-
template:
|
|
232
|
-
metadata:
|
|
233
|
-
labels:
|
|
234
|
-
app: agentflow-dashboard
|
|
235
|
-
spec:
|
|
236
|
-
containers:
|
|
237
|
-
- name: dashboard
|
|
238
|
-
image: node:18-alpine
|
|
239
|
-
ports:
|
|
240
|
-
- containerPort: 3000
|
|
241
|
-
command:
|
|
242
|
-
- sh
|
|
243
|
-
- -c
|
|
244
|
-
- "npm install -g agentflow-dashboard && agentflow-dashboard --host 0.0.0.0"
|
|
245
|
-
volumeMounts:
|
|
246
|
-
- name: traces
|
|
247
|
-
mountPath: /traces
|
|
248
|
-
volumes:
|
|
249
|
-
- name: traces
|
|
250
|
-
persistentVolumeClaim:
|
|
251
|
-
claimName: agentflow-traces
|
|
145
|
+
Trace files (.json, .jsonl, .log)
|
|
146
|
+
│
|
|
147
|
+
▼
|
|
148
|
+
TraceWatcher ──▶ AgentStats ──▶ Express + WebSocket
|
|
149
|
+
(file watcher) (metrics) (REST API + live updates)
|
|
150
|
+
│
|
|
151
|
+
▼
|
|
152
|
+
Browser SPA
|
|
153
|
+
(dashboard.js)
|
|
252
154
|
```
|
|
253
155
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
```nginx
|
|
257
|
-
server {
|
|
258
|
-
listen 80;
|
|
259
|
-
server_name dashboard.example.com;
|
|
260
|
-
|
|
261
|
-
location / {
|
|
262
|
-
proxy_pass http://localhost:3000;
|
|
263
|
-
proxy_http_version 1.1;
|
|
264
|
-
proxy_set_header Upgrade $http_upgrade;
|
|
265
|
-
proxy_set_header Connection 'upgrade';
|
|
266
|
-
proxy_set_header Host $host;
|
|
267
|
-
proxy_set_header X-Real-IP $remote_addr;
|
|
268
|
-
proxy_cache_bypass $http_upgrade;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
```
|
|
156
|
+
## Deployment
|
|
272
157
|
|
|
273
|
-
### Systemd
|
|
158
|
+
### Systemd
|
|
274
159
|
|
|
275
160
|
```ini
|
|
276
|
-
# /etc/systemd/system/agentflow-dashboard.service
|
|
277
161
|
[Unit]
|
|
278
162
|
Description=AgentFlow Dashboard
|
|
279
163
|
After=network.target
|
|
280
164
|
|
|
281
165
|
[Service]
|
|
282
166
|
Type=simple
|
|
283
|
-
|
|
284
|
-
WorkingDirectory=/opt/agentflow
|
|
285
|
-
ExecStart=/usr/local/bin/agentflow-dashboard --traces /var/log/agentflow
|
|
167
|
+
ExecStart=/usr/local/bin/agentflow-dashboard --host 0.0.0.0 --traces /var/log/agentflow
|
|
286
168
|
Restart=always
|
|
287
|
-
Environment=NODE_ENV=production
|
|
288
169
|
|
|
289
170
|
[Install]
|
|
290
171
|
WantedBy=multi-user.target
|
|
291
172
|
```
|
|
292
173
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
### Large Trace Volumes
|
|
296
|
-
|
|
297
|
-
For high-volume agent systems:
|
|
298
|
-
|
|
299
|
-
```bash
|
|
300
|
-
# Increase Node.js memory limit
|
|
301
|
-
NODE_OPTIONS="--max-old-space-size=4096" agentflow-dashboard
|
|
302
|
-
|
|
303
|
-
# Use dedicated traces directory with log rotation
|
|
304
|
-
agentflow-dashboard --traces /var/log/agentflow/current
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
### Network Optimization
|
|
174
|
+
### Docker
|
|
308
175
|
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
enableCors: true,
|
|
315
|
-
// Custom update intervals can be configured
|
|
316
|
-
});
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
## Troubleshooting
|
|
320
|
-
|
|
321
|
-
### Common Issues
|
|
322
|
-
|
|
323
|
-
**Dashboard not loading traces:**
|
|
324
|
-
```bash
|
|
325
|
-
# Check traces directory permissions
|
|
326
|
-
ls -la ./traces
|
|
327
|
-
|
|
328
|
-
# Check trace file format
|
|
329
|
-
cat traces/agent-*.json | head -20
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
**WebSocket connection failures:**
|
|
333
|
-
```bash
|
|
334
|
-
# Check firewall settings
|
|
335
|
-
sudo ufw status
|
|
336
|
-
|
|
337
|
-
# Test WebSocket connectivity
|
|
338
|
-
curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" http://localhost:3000
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
**High memory usage:**
|
|
342
|
-
```bash
|
|
343
|
-
# Monitor dashboard process
|
|
344
|
-
top -p $(pgrep -f agentflow-dashboard)
|
|
345
|
-
|
|
346
|
-
# Clean old trace files
|
|
347
|
-
find ./traces -name "*.json" -mtime +7 -delete
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
### Debug Mode
|
|
351
|
-
|
|
352
|
-
```bash
|
|
353
|
-
# Enable debug logging
|
|
354
|
-
DEBUG=agentflow:* agentflow-dashboard --traces ./traces
|
|
355
|
-
|
|
356
|
-
# Check dashboard health
|
|
357
|
-
curl http://localhost:3000/api/stats
|
|
176
|
+
```dockerfile
|
|
177
|
+
FROM node:20-alpine
|
|
178
|
+
RUN npm install -g agentflow-dashboard
|
|
179
|
+
EXPOSE 3000
|
|
180
|
+
CMD ["agentflow-dashboard", "--host", "0.0.0.0", "--traces", "/traces"]
|
|
358
181
|
```
|
|
359
182
|
|
|
360
|
-
## Contributing
|
|
361
|
-
|
|
362
|
-
See [CONTRIBUTING.md](../../CONTRIBUTING.md) for development guidelines.
|
|
363
|
-
|
|
364
183
|
## License
|
|
365
184
|
|
|
366
|
-
MIT
|
|
185
|
+
MIT
|