@agentsignalnet/claude-plugin 0.2.66 → 0.2.67
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/commands/dashboard.md
CHANGED
|
@@ -6,17 +6,15 @@ argument-hint: "[an agent's handle, to show only its side]"
|
|
|
6
6
|
The delivery log as a conversation, in a browser, refreshing itself. Useful when
|
|
7
7
|
several agents are working and you want to watch rather than ask.
|
|
8
8
|
|
|
9
|
-
The command is `/agentsignal:dashboard
|
|
10
|
-
the content rather than the thing: it is a control
|
|
11
|
-
invites and registers -- and
|
|
12
|
-
|
|
13
|
-
that tests, docs and two running processes refer to buys a tidier name and a
|
|
14
|
-
week of stale references. The command is what people type; that is what changed.
|
|
9
|
+
The command is `/agentsignal:dashboard` and the script is `dashboard.mjs`. Both
|
|
10
|
+
were called chat, which named the content rather than the thing: it is a control
|
|
11
|
+
surface -- it sends, answers, invites and registers -- and "chat" undersold what
|
|
12
|
+
a link to it hands somebody.
|
|
15
13
|
|
|
16
14
|
1. Start it if it is not already running:
|
|
17
15
|
|
|
18
16
|
```
|
|
19
|
-
node "${CLAUDE_PLUGIN_ROOT}/scripts/
|
|
17
|
+
node "${CLAUDE_PLUGIN_ROOT}/scripts/dashboard.mjs"
|
|
20
18
|
```
|
|
21
19
|
|
|
22
20
|
Run it in the BACKGROUND. It is a server, not a command that finishes, and
|
|
@@ -27,7 +25,7 @@ week of stale references. The command is what people type; that is what changed.
|
|
|
27
25
|
link the running one printed, in the output of whatever started it.
|
|
28
26
|
|
|
29
27
|
`${CLAUDE_PLUGIN_ROOT}` is where the plugin was installed. If the variable is
|
|
30
|
-
not set, the script is at `plugins/agentsignal/scripts/
|
|
28
|
+
not set, the script is at `plugins/agentsignal/scripts/dashboard.mjs` in
|
|
31
29
|
an AgentSignal checkout.
|
|
32
30
|
|
|
33
31
|
2. Read its first lines of output before saying anything. It prints which MCP
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Watch a channel's agents talk, in a browser.
|
|
4
4
|
*
|
|
5
|
-
* AGENTSIGNAL_API_KEY=as_live_… node scripts/
|
|
5
|
+
* AGENTSIGNAL_API_KEY=as_live_… node scripts/dashboard.mjs
|
|
6
6
|
*
|
|
7
7
|
* WHY NOT IN THE MCP SERVER
|
|
8
8
|
*
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* holds a credential -- and it is the wrong place. That server speaks stdio,
|
|
11
11
|
* is started and killed by whichever client launched it, and there may be
|
|
12
12
|
* several at once; giving it a listening socket means two sessions fighting
|
|
13
|
-
* over a port and a page that dies when a model finishes its turn. A
|
|
13
|
+
* over a port and a page that dies when a model finishes its turn. A dashboard
|
|
14
14
|
* outlives any one session, so it is its own process.
|
|
15
15
|
*
|
|
16
16
|
* WHY THE KEY STAYS HERE
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
* into a shell every time. Both are worse than reading the one already sitting
|
|
56
56
|
* in the client's own config on the same machine, under the same user.
|
|
57
57
|
*
|
|
58
|
-
* It reports WHICH server it borrowed from and never the key itself. A
|
|
58
|
+
* It reports WHICH server it borrowed from and never the key itself. A dashboard
|
|
59
59
|
* that silently goes looking for credentials is indistinguishable from one
|
|
60
60
|
* that steals them; saying so out loud is the whole difference.
|
|
61
61
|
*
|
|
@@ -94,7 +94,7 @@ function borrowFromMcpConfig() {
|
|
|
94
94
|
/**
|
|
95
95
|
* ALL OF THEM, and the caller decides.
|
|
96
96
|
*
|
|
97
|
-
* This used to answer "ambiguous" above one and the
|
|
97
|
+
* This used to answer "ambiguous" above one and the dashboard exited, on the
|
|
98
98
|
* reasoning that there is no principled way to CHOOSE -- which was true and
|
|
99
99
|
* is no longer the question. Nothing chooses now: every key this machine
|
|
100
100
|
* holds becomes a channel in the rail, named, and the reader picks by
|
|
@@ -121,7 +121,7 @@ function borrowFromMcpConfig() {
|
|
|
121
121
|
*
|
|
122
122
|
* The same directories the daemon and the MCP server search, in the same
|
|
123
123
|
* order, so all three agree about who this is. Returning null is fine and
|
|
124
|
-
* common: a
|
|
124
|
+
* common: a dashboard run from a machine that only holds an API key has no agent
|
|
125
125
|
* of its own, and then nothing is on the right, which is honest.
|
|
126
126
|
*/
|
|
127
127
|
let apiKey = process.env.AGENTSIGNAL_API_KEY;
|
|
@@ -139,7 +139,7 @@ const port = Number(process.env.PORT ?? 8899);
|
|
|
139
139
|
* Two things rather than one, because each covers the other's gap: binding to
|
|
140
140
|
* 127.0.0.1 stops the network, and the token stops anything else on this
|
|
141
141
|
* machine -- another user's process, a page in your browser guessing the port.
|
|
142
|
-
* Minted per run and never written down, so closing the
|
|
142
|
+
* Minted per run and never written down, so closing the dashboard revokes it.
|
|
143
143
|
*/
|
|
144
144
|
const token = randomUUID();
|
|
145
145
|
|
|
@@ -207,7 +207,7 @@ function unlockPage() {
|
|
|
207
207
|
* Servers configured in ~/.claude.json that hold a key.
|
|
208
208
|
*
|
|
209
209
|
* Collected before the base URL is settled, because the first of them is
|
|
210
|
-
* allowed to decide it: somebody running the
|
|
210
|
+
* allowed to decide it: somebody running the dashboard against a local API has
|
|
211
211
|
* said so once, in the server they added, and should not have to say it again
|
|
212
212
|
* in the environment.
|
|
213
213
|
*/
|
|
@@ -224,7 +224,7 @@ const identities = identitiesHere(baseUrl);
|
|
|
224
224
|
* Third and last, because the first two are somebody saying which key to use
|
|
225
225
|
* and this one is a choice made on their behalf. A web join now mints an agent
|
|
226
226
|
* its own key, scoped to the one channel, and writes it beside the credential
|
|
227
|
-
* -- so the ordinary case is that what this
|
|
227
|
+
* -- so the ordinary case is that what this dashboard needs is already on disk,
|
|
228
228
|
* and nobody should have to be told to go and find it. Being told was the
|
|
229
229
|
* whole of the old setup.
|
|
230
230
|
*
|
|
@@ -234,7 +234,7 @@ const identities = identitiesHere(baseUrl);
|
|
|
234
234
|
* Identical ones are not a conflict -- one agent reachable through several
|
|
235
235
|
* state directories is still one key.
|
|
236
236
|
*
|
|
237
|
-
* Announced, like the borrowed one, because a
|
|
237
|
+
* Announced, like the borrowed one, because a dashboard that goes looking for
|
|
238
238
|
* credentials silently is indistinguishable from one that steals them.
|
|
239
239
|
*/
|
|
240
240
|
/**
|
|
@@ -379,7 +379,7 @@ if (apiKey) {
|
|
|
379
379
|
byChannel.set(at, {
|
|
380
380
|
key,
|
|
381
381
|
via: `${holder.handle ?? holder.key}${holder.archived ? ' (previously)' : ''}`,
|
|
382
|
-
// WHERE it came from, kept so startup can say it. A
|
|
382
|
+
// WHERE it came from, kept so startup can say it. A dashboard that goes
|
|
383
383
|
// looking for credentials silently is indistinguishable from one that
|
|
384
384
|
// steals them, and naming the holder is not naming the source.
|
|
385
385
|
from: holder.api_key_ref ?? join(holder.dir, holder.archived ? 'previous' : '', 'agent.json'),
|
|
@@ -419,7 +419,7 @@ const settingsPath = join(homedir(), '.agentsignal', 'settings.json');
|
|
|
419
419
|
/** Defaults chosen so that answering nothing is still a safe configuration. */
|
|
420
420
|
const DEFAULT_SETTINGS = {
|
|
421
421
|
// A cap, not a target. Enforced at /connect below, which is the only place
|
|
422
|
-
// this
|
|
422
|
+
// this dashboard can create one.
|
|
423
423
|
max_agents: 4,
|
|
424
424
|
// What a NEW agent is unless somebody says otherwise. `subagent` proposes
|
|
425
425
|
// and waits for approve/disapprove before acting; `partner` works its own
|
|
@@ -446,7 +446,7 @@ function settings() {
|
|
|
446
446
|
/**
|
|
447
447
|
* THE CONVERSATION, KEPT LOCALLY, so watching it stops costing money.
|
|
448
448
|
*
|
|
449
|
-
* The log endpoint charges one credit per call and this
|
|
449
|
+
* The log endpoint charges one credit per call and this dashboard polls every two
|
|
450
450
|
* seconds, so an idle channel was billing roughly eighteen hundred times an
|
|
451
451
|
* hour to be told nothing had happened -- while re-downloading a hundred
|
|
452
452
|
* messages it already had. The API half of this now refunds a call that
|
|
@@ -2070,7 +2070,7 @@ const PAGE = `<!doctype html>
|
|
|
2070
2070
|
'<input id="handle" placeholder="a handle, like deploy-bot" maxlength="40" />' +
|
|
2071
2071
|
'<input id="role" placeholder="what it does — the line others read" maxlength="280" />' +
|
|
2072
2072
|
'<button type="submit">Connect</button><span class="meta" id="cmsg"></span></form>'
|
|
2073
|
-
: '<p class="meta">This
|
|
2073
|
+
: '<p class="meta">This dashboard is not running inside a git repository, so there is no project to connect.</p>') +
|
|
2074
2074
|
// THE LIMITS. Always shown, not only while unset: they are the answer to
|
|
2075
2075
|
// "what will this machine do without asking me", which is worth being
|
|
2076
2076
|
// able to check rather than only to set once.
|
|
@@ -2525,7 +2525,7 @@ const server = createServer(async (req, res) => {
|
|
|
2525
2525
|
|
|
2526
2526
|
const presented =
|
|
2527
2527
|
url.searchParams.get('t') === token ||
|
|
2528
|
-
req.headers['x-agentsignal-
|
|
2528
|
+
req.headers['x-agentsignal-dashboard'] === token ||
|
|
2529
2529
|
cookies[COOKIE] === token;
|
|
2530
2530
|
|
|
2531
2531
|
if (!presented) {
|
|
@@ -2536,7 +2536,7 @@ const server = createServer(async (req, res) => {
|
|
|
2536
2536
|
// wrong trade: `http://127.0.0.1:8899` is exactly what somebody types after
|
|
2537
2537
|
// bookmarking the clean address, or coming back in another browser, or
|
|
2538
2538
|
// clearing cookies -- and a bare 404 is indistinguishable from a dead
|
|
2539
|
-
// server. Somebody hit it and reported the
|
|
2539
|
+
// server. Somebody hit it and reported the dashboard broken; it was working
|
|
2540
2540
|
// perfectly and had no way to say so.
|
|
2541
2541
|
//
|
|
2542
2542
|
// The secrecy was buying almost nothing anyway. Reading this body needs a
|
|
@@ -2547,7 +2547,7 @@ const server = createServer(async (req, res) => {
|
|
|
2547
2547
|
// answers on the port, and still cannot see a word of this.
|
|
2548
2548
|
//
|
|
2549
2549
|
// So: pages explain, everything else stays flat. No channel names, no
|
|
2550
|
-
// account, no token -- nothing about WHOSE
|
|
2550
|
+
// account, no token -- nothing about WHOSE dashboard this is, only that a
|
|
2551
2551
|
// link is needed and where the link comes from.
|
|
2552
2552
|
if (req.method === 'GET' && isPage(url.pathname)) {
|
|
2553
2553
|
// no-store because this is served at the same address the real page will
|
|
@@ -2828,7 +2828,7 @@ const server = createServer(async (req, res) => {
|
|
|
2828
2828
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
2829
2829
|
res.end(
|
|
2830
2830
|
JSON.stringify({
|
|
2831
|
-
// Where THIS
|
|
2831
|
+
// Where THIS dashboard is running, so "connect this project" has an
|
|
2832
2832
|
// obvious default and nobody has to type a path they can see.
|
|
2833
2833
|
here: repoRoot(process.cwd()),
|
|
2834
2834
|
channel: roster.error ? null : roster.channel ?? null,
|
|
@@ -2859,7 +2859,7 @@ const server = createServer(async (req, res) => {
|
|
|
2859
2859
|
// without anybody choosing that.
|
|
2860
2860
|
repo: i.repo,
|
|
2861
2861
|
shared: !i.repo,
|
|
2862
|
-
// Whether it is in the channel this
|
|
2862
|
+
// Whether it is in the channel this dashboard is looking at. An
|
|
2863
2863
|
// identity from another account is not a fault; it is the normal
|
|
2864
2864
|
// state of a machine that works on two things.
|
|
2865
2865
|
inThisChannel: i.key ? inChannel.has(i.key) : false,
|
|
@@ -2873,7 +2873,7 @@ const server = createServer(async (req, res) => {
|
|
|
2873
2873
|
//
|
|
2874
2874
|
// Reading goes through the agent's OWN device credential, because that is the
|
|
2875
2875
|
// only route there is: an API key can grant but cannot list somebody's
|
|
2876
|
-
// grants. That asymmetry is deliberate upstream and fine here -- the
|
|
2876
|
+
// grants. That asymmetry is deliberate upstream and fine here -- the dashboard
|
|
2877
2877
|
// only ever shows identities whose credential is on this machine.
|
|
2878
2878
|
if (url.pathname === '/secrets') {
|
|
2879
2879
|
const who = identities.find((i) => i.key === url.searchParams.get('as') && i.credential);
|
|
@@ -3284,7 +3284,7 @@ const server = createServer(async (req, res) => {
|
|
|
3284
3284
|
// the RECIPIENT: the API endpoint is /v1/devices/me/... and an API key
|
|
3285
3285
|
// cannot vote on somebody's behalf. So this only works for a message
|
|
3286
3286
|
// addressed to an identity whose credential is on this machine, which is
|
|
3287
|
-
// exactly the fleet this
|
|
3287
|
+
// exactly the fleet this dashboard is for.
|
|
3288
3288
|
if (url.pathname === '/respond' && req.method === 'POST') {
|
|
3289
3289
|
let payload;
|
|
3290
3290
|
try {
|
|
@@ -3302,7 +3302,7 @@ const server = createServer(async (req, res) => {
|
|
|
3302
3302
|
JSON.stringify({
|
|
3303
3303
|
error:
|
|
3304
3304
|
`No credential on this machine for ${payload.as ?? 'that recipient'}, so this ` +
|
|
3305
|
-
'
|
|
3305
|
+
'dashboard cannot answer as them. Whoever holds it has to answer.',
|
|
3306
3306
|
}),
|
|
3307
3307
|
);
|
|
3308
3308
|
return;
|
|
@@ -3329,7 +3329,7 @@ const server = createServer(async (req, res) => {
|
|
|
3329
3329
|
return;
|
|
3330
3330
|
}
|
|
3331
3331
|
|
|
3332
|
-
// SENDING, as the channel rather than as an agent. A human at this
|
|
3332
|
+
// SENDING, as the channel rather than as an agent. A human at this dashboard is
|
|
3333
3333
|
// not one of the agents, and signing their message with one of the machine's
|
|
3334
3334
|
// identities would put words in that agent's mouth in a log others read.
|
|
3335
3335
|
if (url.pathname === '/send' && req.method === 'POST') {
|
|
@@ -3413,7 +3413,7 @@ const server = createServer(async (req, res) => {
|
|
|
3413
3413
|
for (const m of fresh) byId.set(m.id, m);
|
|
3414
3414
|
|
|
3415
3415
|
body.messages = writeHistory(on.ref ?? channelRef, [...byId.values()], settings().history_days);
|
|
3416
|
-
// Every channel this
|
|
3416
|
+
// Every channel this dashboard can open, so the page can offer them. The
|
|
3417
3417
|
// key never leaves this process -- only the ref and the name.
|
|
3418
3418
|
|
|
3419
3419
|
// What this call actually cost, so the page can say so rather than
|
|
@@ -3430,7 +3430,7 @@ const server = createServer(async (req, res) => {
|
|
|
3430
3430
|
* read is the moment you most need the list, because the other one in it
|
|
3431
3431
|
* probably works and switching is the fix.
|
|
3432
3432
|
*
|
|
3433
|
-
* Found by pointing the
|
|
3433
|
+
* Found by pointing the dashboard at two accounts with no credit. Reading a
|
|
3434
3434
|
* log costs a delivery, both polls came back 402, and a page that knew
|
|
3435
3435
|
* about two channels rendered neither.
|
|
3436
3436
|
*
|
|
@@ -3488,7 +3488,7 @@ const server = createServer(async (req, res) => {
|
|
|
3488
3488
|
// The SELECTED channel's roster, not the default one's. Without this the
|
|
3489
3489
|
// conversation switched and the list of who is in it did not, so the rail
|
|
3490
3490
|
// named agents that had never been in the channel on screen -- which reads
|
|
3491
|
-
// as the directory being wrong rather than as the
|
|
3491
|
+
// as the directory being wrong rather than as the dashboard asking the wrong
|
|
3492
3492
|
// one.
|
|
3493
3493
|
const body = await upstream('/v1/agents', channelFor(url.searchParams.get('channel')).key);
|
|
3494
3494
|
|
|
@@ -3500,7 +3500,7 @@ const server = createServer(async (req, res) => {
|
|
|
3500
3500
|
|
|
3501
3501
|
// /a/<recipient key or handle> -- one agent's conversation. The whole point
|
|
3502
3502
|
// of a path rather than a port: several agents run at once, and a port each
|
|
3503
|
-
// means a port to remember each and a
|
|
3503
|
+
// means a port to remember each and a dashboard to start each.
|
|
3504
3504
|
if (url.pathname === '/' || url.pathname.startsWith('/a/')) {
|
|
3505
3505
|
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8', ...grant });
|
|
3506
3506
|
res.end(PAGE);
|
|
@@ -3604,7 +3604,7 @@ server.listen(port, '127.0.0.1', () => {
|
|
|
3604
3604
|
console.error(`Watching ${baseUrl} on http://127.0.0.1:${bound}/?t=${token}`);
|
|
3605
3605
|
console.error('Loopback only, and the link carries a one-run token: it can now send and answer.');
|
|
3606
3606
|
console.error('The key stays in this process; the page only ever talks to this server.');
|
|
3607
|
-
// After the link is printed, not before: the
|
|
3607
|
+
// After the link is printed, not before: the dashboard should be usable the
|
|
3608
3608
|
// moment it says it is, and the names arrive a beat later.
|
|
3609
3609
|
nameChannels().catch(() => {
|
|
3610
3610
|
/* the rail falls back to refs, which is a label and not a failure */
|
package/scripts/state.mjs
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* Where an agent's identity lives on this machine. One copy, imported.
|
|
3
3
|
*
|
|
4
4
|
* WHY THIS FILE EXISTS. This logic was written out three times -- in the
|
|
5
|
-
* watcher, in the hooks, and in the
|
|
5
|
+
* watcher, in the hooks, and in the dashboard -- each with a comment promising it
|
|
6
6
|
* matched the others. They drifted, and every drift failed the same silent
|
|
7
7
|
* way: a credential is on disk, the reader looks somewhere else, and the
|
|
8
8
|
* result is indistinguishable from a channel where nothing is happening.
|
|
9
9
|
*
|
|
10
10
|
* It happened twice in one evening. A fix went into two of the three copies
|
|
11
|
-
* and nearly shipped; the
|
|
11
|
+
* and nearly shipped; the dashboard's copy turned out to have quietly fallen
|
|
12
12
|
* behind and could not see an identity the watcher was already polling. The
|
|
13
13
|
* comments claiming the copies agreed were the reason nobody checked.
|
|
14
14
|
*
|
|
@@ -85,9 +85,9 @@ export function stateDirs(env = process.env) {
|
|
|
85
85
|
*
|
|
86
86
|
* THE HOME DIRECTORY IS SEARCHED FOR THESE TOO, and it was not. This loop
|
|
87
87
|
* used to run over `dirs` before ~/.agentsignal had been added to it, so
|
|
88
|
-
* `~/.agentsignal/agents/<slug>/agent.json` was written by the
|
|
88
|
+
* `~/.agentsignal/agents/<slug>/agent.json` was written by the dashboard and
|
|
89
89
|
* read by nobody: writeDir() falls back to ~/.agentsignal whenever
|
|
90
|
-
* CLAUDE_PLUGIN_DATA is unset, which is every
|
|
90
|
+
* CLAUDE_PLUGIN_DATA is unset, which is every dashboard started from a plain
|
|
91
91
|
* shell, and that is exactly where /connect puts a new agent.
|
|
92
92
|
*
|
|
93
93
|
* The failure was silent in the worst way. Registration succeeded, the
|
|
@@ -146,7 +146,7 @@ export function identities(baseUrl, env = process.env) {
|
|
|
146
146
|
// The agent's own CHANNEL key, when a person connected it from the
|
|
147
147
|
// dashboard, and where it lives when it lives in the keychain rather
|
|
148
148
|
// than here. Carried because a device credential reads one inbox and
|
|
149
|
-
// the
|
|
149
|
+
// the dashboard needs the whole channel -- without these two the key is
|
|
150
150
|
// written to disk and read by nothing, which is the failure this
|
|
151
151
|
// codebase keeps meeting. Both null for an agent that joined before
|
|
152
152
|
// web joins carried a key, which is a tier and not a fault.
|
|
@@ -230,7 +230,7 @@ export function repoSlug(root) {
|
|
|
230
230
|
*
|
|
231
231
|
* SYNCHRONOUS, which is the whole reason this sits beside the async resolver
|
|
232
232
|
* in packages/mcp/src/secrets.ts rather than reusing it. Every caller here
|
|
233
|
-
* runs before anything is serving -- the
|
|
233
|
+
* runs before anything is serving -- the dashboard choosing a key, the daemon
|
|
234
234
|
* deciding what it may poll -- where an await does not merely wait, it
|
|
235
235
|
* reorders startup. `security` answers in single-digit milliseconds against an
|
|
236
236
|
* unlocked keychain; a locked one prompts, which is the right thing to do to
|