agentop 0.1.0 → 0.1.2
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 +8 -1
- package/bin/agentop.js +10 -2
- package/lib/demo.js +106 -0
- package/lib/ui.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ which projects have agents working, what model they're on, which git branch
|
|
|
12
12
|
they're on, and what each one is doing *right now* (running a tool, thinking,
|
|
13
13
|
or waiting for you).
|
|
14
14
|
|
|
15
|
-

|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
@@ -29,6 +29,12 @@ npm install -g agentop
|
|
|
29
29
|
agentop
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
Want to see it without any agents running? Try the demo:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npx agentop --demo
|
|
36
|
+
```
|
|
37
|
+
|
|
32
38
|
### Live keys
|
|
33
39
|
|
|
34
40
|
| Key | Action |
|
|
@@ -46,6 +52,7 @@ agentop
|
|
|
46
52
|
-r, --reverse Reverse sort order
|
|
47
53
|
-n, --once Print a single snapshot and exit (no live UI)
|
|
48
54
|
--json Print agents as JSON and exit
|
|
55
|
+
--demo Show fabricated sample agents (no real data)
|
|
49
56
|
--no-color Disable ANSI colors
|
|
50
57
|
-h, --help Show help
|
|
51
58
|
-v, --version Show version
|
package/bin/agentop.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
const { collectAgents } = require('../lib/collect');
|
|
5
|
+
const { demoAgents } = require('../lib/demo');
|
|
5
6
|
const { buildFrame, sortAgents, SORTS } = require('../lib/render');
|
|
6
7
|
const { runLive } = require('../lib/ui');
|
|
7
8
|
const c = require('../lib/colors');
|
|
@@ -14,6 +15,7 @@ function parseArgs(argv) {
|
|
|
14
15
|
reverse: false,
|
|
15
16
|
once: false,
|
|
16
17
|
json: false,
|
|
18
|
+
demo: false,
|
|
17
19
|
color: undefined,
|
|
18
20
|
};
|
|
19
21
|
const args = argv.slice(2);
|
|
@@ -59,6 +61,9 @@ function parseArgs(argv) {
|
|
|
59
61
|
case '--reverse':
|
|
60
62
|
opts.reverse = true;
|
|
61
63
|
break;
|
|
64
|
+
case '--demo':
|
|
65
|
+
opts.demo = true;
|
|
66
|
+
break;
|
|
62
67
|
default:
|
|
63
68
|
fail(`unknown option: ${a}`);
|
|
64
69
|
}
|
|
@@ -84,6 +89,8 @@ OPTIONS
|
|
|
84
89
|
-r, --reverse Reverse sort order
|
|
85
90
|
-n, --once Print a single snapshot and exit (no live UI)
|
|
86
91
|
--json Print agents as JSON and exit
|
|
92
|
+
--demo Show fabricated sample agents (no real data) — handy
|
|
93
|
+
for previews, screenshots, and demos
|
|
87
94
|
--no-color Disable ANSI colors
|
|
88
95
|
-h, --help Show this help
|
|
89
96
|
-v, --version Show version
|
|
@@ -104,15 +111,16 @@ WHAT IT SHOWS
|
|
|
104
111
|
function main() {
|
|
105
112
|
const opts = parseArgs(process.argv);
|
|
106
113
|
if (opts.color === false) c.setEnabled(false);
|
|
114
|
+
const collect = opts.demo ? demoAgents : collectAgents;
|
|
107
115
|
|
|
108
116
|
if (opts.json) {
|
|
109
|
-
const agents = sortAgents(
|
|
117
|
+
const agents = sortAgents(collect(), opts.sort, opts.reverse);
|
|
110
118
|
process.stdout.write(JSON.stringify(agents, null, 2) + '\n');
|
|
111
119
|
return;
|
|
112
120
|
}
|
|
113
121
|
|
|
114
122
|
if (opts.once || !process.stdout.isTTY) {
|
|
115
|
-
const agents = sortAgents(
|
|
123
|
+
const agents = sortAgents(collect(), opts.sort, opts.reverse);
|
|
116
124
|
const frame = buildFrame(agents, {
|
|
117
125
|
width: process.stdout.columns || 100,
|
|
118
126
|
height: Math.max(agents.length + 6, 10),
|
package/lib/demo.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Fabricated agents for `agentop --demo` — privacy-safe, reproducible sample
|
|
4
|
+
// data for screenshots, demo GIFs, and previewing the UI without running any
|
|
5
|
+
// real Claude sessions. States cycle over time so the live view looks alive.
|
|
6
|
+
|
|
7
|
+
const FIXTURES = [
|
|
8
|
+
{
|
|
9
|
+
pid: 50121,
|
|
10
|
+
project: 'api-gateway',
|
|
11
|
+
branch: 'main',
|
|
12
|
+
model: 'claude-opus-4-8',
|
|
13
|
+
baseCpu: 22.4,
|
|
14
|
+
rssKb: 612000,
|
|
15
|
+
uptimeSec: 4460,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
pid: 50488,
|
|
19
|
+
project: 'web-frontend',
|
|
20
|
+
branch: 'feat/checkout',
|
|
21
|
+
model: 'claude-sonnet-4-6',
|
|
22
|
+
baseCpu: 14.1,
|
|
23
|
+
rssKb: 548000,
|
|
24
|
+
uptimeSec: 1820,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
pid: 50733,
|
|
28
|
+
project: 'billing-service',
|
|
29
|
+
branch: 'main',
|
|
30
|
+
model: 'claude-opus-4-8',
|
|
31
|
+
baseCpu: 9.7,
|
|
32
|
+
rssKb: 503000,
|
|
33
|
+
uptimeSec: 7321,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
pid: 51002,
|
|
37
|
+
project: 'ml-pipeline',
|
|
38
|
+
branch: 'exp/embeddings',
|
|
39
|
+
model: 'claude-opus-4-8',
|
|
40
|
+
baseCpu: 31.8,
|
|
41
|
+
rssKb: 731000,
|
|
42
|
+
uptimeSec: 980,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
pid: 51140,
|
|
46
|
+
project: 'mobile-app',
|
|
47
|
+
branch: 'release/2.3',
|
|
48
|
+
model: 'claude-haiku-4-5',
|
|
49
|
+
baseCpu: 2.1,
|
|
50
|
+
rssKb: 421000,
|
|
51
|
+
uptimeSec: 15400,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
pid: 51399,
|
|
55
|
+
project: 'infra-terraform',
|
|
56
|
+
branch: 'main',
|
|
57
|
+
model: 'claude-sonnet-4-6',
|
|
58
|
+
baseCpu: 0.3,
|
|
59
|
+
rssKb: 388000,
|
|
60
|
+
uptimeSec: 22030,
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
// Each rotation step: [rawState, detail, idleSec]. classifyState (in render via
|
|
65
|
+
// the precomputed `state`) maps these to colors; we set `state` directly here.
|
|
66
|
+
const CYCLE = [
|
|
67
|
+
{ rawState: 'tool', detail: 'Bash', idleSec: 1, state: 'working' },
|
|
68
|
+
{ rawState: 'tool', detail: 'Edit', idleSec: 2, state: 'working' },
|
|
69
|
+
{ rawState: 'thinking', detail: '', idleSec: 3, state: 'thinking' },
|
|
70
|
+
{ rawState: 'tool', detail: 'Grep', idleSec: 1, state: 'working' },
|
|
71
|
+
{ rawState: 'replied', detail: 'done — opened PR #214', idleSec: 12, state: 'replied' },
|
|
72
|
+
{ rawState: 'tool', detail: 'WebSearch', idleSec: 1, state: 'working' },
|
|
73
|
+
{ rawState: 'replied', detail: 'awaiting input', idleSec: 95, state: 'waiting' },
|
|
74
|
+
{ rawState: 'idle', detail: '', idleSec: 740, state: 'idle' },
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
// Build the demo agent list for a given timestamp (ms). Pass a fixed value for
|
|
78
|
+
// deterministic output (tests); omit for a live, animated view.
|
|
79
|
+
function demoAgents(nowMs = Date.now()) {
|
|
80
|
+
const tick = Math.floor(nowMs / 1000);
|
|
81
|
+
return FIXTURES.map((f, i) => {
|
|
82
|
+
const phase = CYCLE[(tick + i * 2) % CYCLE.length];
|
|
83
|
+
const cpuJitter =
|
|
84
|
+
phase.state === 'idle' || phase.state === 'waiting' ? 0 : ((tick + i) % 5) - 2;
|
|
85
|
+
return {
|
|
86
|
+
pid: f.pid,
|
|
87
|
+
cpu: Math.max(0, +(f.baseCpu + cpuJitter).toFixed(1)),
|
|
88
|
+
rssKb: f.rssKb,
|
|
89
|
+
uptimeSec: f.uptimeSec + (tick % 60),
|
|
90
|
+
cwd: `/Users/dev/${f.project}`,
|
|
91
|
+
project: f.project,
|
|
92
|
+
args: 'claude',
|
|
93
|
+
model: f.model,
|
|
94
|
+
version: '2.1.168',
|
|
95
|
+
gitBranch: f.branch,
|
|
96
|
+
sessionId: null,
|
|
97
|
+
lastPrompt: null,
|
|
98
|
+
rawState: phase.rawState,
|
|
99
|
+
detail: phase.detail,
|
|
100
|
+
idleSec: phase.idleSec,
|
|
101
|
+
state: phase.state,
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
module.exports = { demoAgents };
|
package/lib/ui.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { collectAgents } = require('./collect');
|
|
4
|
+
const { demoAgents } = require('./demo');
|
|
4
5
|
const { buildFrame, sortAgents, SORTS } = require('./render');
|
|
5
6
|
|
|
6
7
|
const ALT_ON = '\x1b[?1049h';
|
|
@@ -20,6 +21,7 @@ function runLive(opts) {
|
|
|
20
21
|
sort: opts.sort,
|
|
21
22
|
reverse: opts.reverse,
|
|
22
23
|
};
|
|
24
|
+
const collect = opts.demo ? demoAgents : collectAgents;
|
|
23
25
|
|
|
24
26
|
const out = process.stdout;
|
|
25
27
|
out.write(ALT_ON + HIDE_CURSOR);
|
|
@@ -43,7 +45,7 @@ function runLive(opts) {
|
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
function draw() {
|
|
46
|
-
const agents = sortAgents(
|
|
48
|
+
const agents = sortAgents(collect(), state.sort, state.reverse);
|
|
47
49
|
const frame = buildFrame(agents, {
|
|
48
50
|
width: out.columns,
|
|
49
51
|
height: out.rows,
|