@agentsignalnet/claude-plugin 0.2.89 → 0.2.91

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agentsignal",
3
3
  "displayName": "AgentSignal",
4
- "version": "0.2.89",
4
+ "version": "0.2.91",
5
5
  "description": "Page a human from inside Claude Code, or become an addressable agent that other agents can reach.",
6
6
  "author": {
7
7
  "name": "Data Group AI",
package/.mcp.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "mcpServers": {
3
3
  "agentsignal": {
4
4
  "command": "npx",
5
- "args": ["-y", "@agentsignalnet/mcp@0.2.60"],
5
+ "args": ["-y", "@agentsignalnet/mcp@0.2.61"],
6
6
  "env": {
7
7
  "AGENTSIGNAL_API_KEY": "${user_config.api_key}",
8
8
  "AGENTSIGNAL_JOIN_TOKEN": "${user_config.join_token}",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentsignalnet/claude-plugin",
3
- "version": "0.2.89",
3
+ "version": "0.2.91",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -667,6 +667,15 @@ const DEFAULT_SETTINGS = {
667
667
  // a machine does not accumulate a year of other people's messages nobody
668
668
  // decided to keep. 0 means keep nothing beyond what is on screen.
669
669
  history_days: 7,
670
+ // Whether this machine answers when no session is live. Off, and it must
671
+ // stay off through an update: this is the one setting here that spends money
672
+ // and acts while nobody is watching, so it can only become anything else by
673
+ // somebody choosing it on this page.
674
+ //
675
+ // off nothing happens
676
+ // answer may reply and notify. No shell, no files.
677
+ // act may also read, search, edit and run commands.
678
+ responder: 'off',
670
679
  };
671
680
 
672
681
  function settings() {
@@ -2576,6 +2585,28 @@ const PAGE = `<!doctype html>
2576
2585
  'value="' +
2577
2586
  esc(String(LIMITS.history_days)) +
2578
2587
  '" /> days of chat</label>' +
2588
+ // ANSWERING WHILE NOBODY IS HERE. Worded as what it does rather than
2589
+ // as a feature name, because "responder: act" tells somebody nothing
2590
+ // about what they are agreeing to, and this is the control on this
2591
+ // page that can spend money on its own.
2592
+ '<select id="lresp">' +
2593
+ ['off', 'answer', 'act']
2594
+ .map(
2595
+ (k) =>
2596
+ '<option value="' +
2597
+ k +
2598
+ '"' +
2599
+ ((LIMITS.responder ?? 'off') === k ? ' selected' : '') +
2600
+ '>' +
2601
+ {
2602
+ off: 'nobody answers when you are away',
2603
+ answer: 'answer messages while you are away',
2604
+ act: 'answer AND do the work while you are away',
2605
+ }[k] +
2606
+ '</option>',
2607
+ )
2608
+ .join('') +
2609
+ '</select>' +
2579
2610
  '<button type="submit">Save</button>' +
2580
2611
  '<span class="meta" id="lmsg"></span></form>' +
2581
2612
  '<div class="meta" id="storage">measuring…</div>'
@@ -2628,6 +2659,7 @@ const PAGE = `<!doctype html>
2628
2659
  max_agents: Number(document.getElementById('lmax').value),
2629
2660
  default_connection_type: document.getElementById('lkind').value,
2630
2661
  history_days: Number(document.getElementById('ldays').value),
2662
+ responder: document.getElementById('lresp').value,
2631
2663
  });
2632
2664
  if (result.error) {
2633
2665
  msg.textContent = result.error;
@@ -3403,7 +3435,35 @@ const server = createServer(async (req, res) => {
3403
3435
  return;
3404
3436
  }
3405
3437
 
3406
- const next = { max_agents: max, default_connection_type: kind, history_days: days };
3438
+ /*
3439
+ Optional in the payload like retention, and for the same reason: a caller
3440
+ changing only the agent cap must not blank this by omission. A first
3441
+ draft defaulted an absent value to 'off', which would have quietly turned
3442
+ answering off every time somebody saved a different field -- a setting
3443
+ that switches itself off is as untrustworthy as one that switches itself
3444
+ on.
3445
+
3446
+ REFUSED rather than coerced when it is present and wrong. The daemon
3447
+ reads this back, and the failure direction of a typo has to be "nothing
3448
+ happens" -- but a stored value nobody can explain is worse than an error,
3449
+ so it does not silently become 'off' either.
3450
+ */
3451
+ const responder =
3452
+ payload.responder === undefined ? current.responder ?? 'off' : String(payload.responder);
3453
+ if (!['off', 'answer', 'act'].includes(responder)) {
3454
+ res.writeHead(400, { 'Content-Type': 'application/json' });
3455
+ res.end(
3456
+ JSON.stringify({ error: 'Answering while away must be off, answer or act.' }),
3457
+ );
3458
+ return;
3459
+ }
3460
+
3461
+ const next = {
3462
+ max_agents: max,
3463
+ default_connection_type: kind,
3464
+ history_days: days,
3465
+ responder,
3466
+ };
3407
3467
  try {
3408
3468
  saveSettings(next);
3409
3469
  } catch (error) {
@@ -19,15 +19,27 @@
19
19
  * day misfire at 4am, and that the person reading the log afterwards will be
20
20
  * trying to work out what it did and why.
21
21
  *
22
- * SO: OFF UNLESS ASKED. AGENTSIGNAL_RESPONDER is unset by default and this does
23
- * nothing. It must never become true because somebody updated the plugin --
24
- * consenting to an autonomous agent is not the kind of thing that should arrive
25
- * in a patch release.
22
+ * SO: OFF UNLESS ASKED, and asked in the one place a person already goes.
23
+ *
24
+ * The setting lives in ~/.agentsignal/settings.json beside the other answers to
25
+ * "what will this machine do without asking me" -- the agent cap, what new
26
+ * agents are, how long chat is kept -- and the dashboard's This machine page
27
+ * writes it. Nobody has to export anything, and turning it on is a control
28
+ * somebody clicked rather than a line in a shell profile that outlives the
29
+ * decision and gets copied to the next machine.
26
30
  *
27
31
  * off (default) nothing happens
28
32
  * answer may talk: read the inbox, reply, notify. No shell, no files.
29
33
  * act may also do the work: read, search, edit, run commands.
30
34
  *
35
+ * It must never become anything but `off` because somebody updated the plugin.
36
+ * Consenting to an autonomous agent is not the kind of thing that arrives in a
37
+ * patch release.
38
+ *
39
+ * AGENTSIGNAL_RESPONDER still overrides the file, and is for tests and for
40
+ * running one deliberately from a script. It is not the way a person turns this
41
+ * on, and nothing tells them to.
42
+ *
31
43
  * THE BRAKES, and what each is actually for:
32
44
  *
33
45
  * single flight one responder per machine. Without it a burst of five
@@ -50,7 +62,10 @@
50
62
  * with its reason. A thing that runs unattended has to be legible afterwards or
51
63
  * it cannot be trusted, and "it seemed quiet" is not evidence.
52
64
  */
65
+ import { createRequire } from 'node:module';
53
66
  import { spawn } from 'node:child_process';
67
+
68
+ const require = createRequire(import.meta.url);
54
69
  import {
55
70
  appendFileSync, existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync,
56
71
  } from 'node:fs';
@@ -73,21 +88,37 @@ export const DEFAULTS = {
73
88
  staleLockMs: 20 * 60_000,
74
89
  };
75
90
 
76
- export function settings(env = process.env) {
77
- const num = (name, fallback) => {
91
+ /** What the dashboard's This machine page wrote, if anything. */
92
+ export function stored(path = join(ROOT, 'settings.json')) {
93
+ try {
94
+ return JSON.parse(readFileSync(path, 'utf8'));
95
+ } catch {
96
+ return {};
97
+ }
98
+ }
99
+
100
+ export function settings(env = process.env, file = undefined) {
101
+ const saved = stored(...(file ? [file] : []));
102
+ const num = (name, key, fallback) => {
78
103
  const raw = env[name];
79
- if (raw === undefined || raw.trim() === '') return fallback;
80
- const n = Number(raw);
81
- return Number.isFinite(n) && n >= 0 ? n : fallback;
104
+ if (raw !== undefined && raw.trim() !== '') {
105
+ const n = Number(raw);
106
+ if (Number.isFinite(n) && n >= 0) return n;
107
+ }
108
+ const v = saved[key];
109
+ return typeof v === 'number' && Number.isFinite(v) && v >= 0 ? v : fallback;
82
110
  };
83
- const mode = (env.AGENTSIGNAL_RESPONDER ?? DEFAULTS.mode).trim().toLowerCase();
111
+ const mode = (env.AGENTSIGNAL_RESPONDER ?? saved.responder ?? DEFAULTS.mode)
112
+ .toString()
113
+ .trim()
114
+ .toLowerCase();
84
115
  return {
85
116
  mode: ['off', 'answer', 'act'].includes(mode) ? mode : 'off',
86
- gracePeriodMs: num('AGENTSIGNAL_RESPONDER_GRACE_MS', DEFAULTS.gracePeriodMs),
87
- perHour: num('AGENTSIGNAL_RESPONDER_PER_HOUR', DEFAULTS.perHour),
88
- perDay: num('AGENTSIGNAL_RESPONDER_PER_DAY', DEFAULTS.perDay),
89
- peerCooldownMs: num('AGENTSIGNAL_RESPONDER_PEER_COOLDOWN_MS', DEFAULTS.peerCooldownMs),
90
- staleLockMs: num('AGENTSIGNAL_RESPONDER_STALE_LOCK_MS', DEFAULTS.staleLockMs),
117
+ gracePeriodMs: num('AGENTSIGNAL_RESPONDER_GRACE_MS', 'responder_grace_ms', DEFAULTS.gracePeriodMs),
118
+ perHour: num('AGENTSIGNAL_RESPONDER_PER_HOUR', 'responder_per_hour', DEFAULTS.perHour),
119
+ perDay: num('AGENTSIGNAL_RESPONDER_PER_DAY', 'responder_per_day', DEFAULTS.perDay),
120
+ peerCooldownMs: num('AGENTSIGNAL_RESPONDER_PEER_COOLDOWN_MS', 'responder_peer_cooldown_ms', DEFAULTS.peerCooldownMs),
121
+ staleLockMs: num('AGENTSIGNAL_RESPONDER_STALE_LOCK_MS', 'responder_stale_lock_ms', DEFAULTS.staleLockMs),
91
122
  };
92
123
  }
93
124
 
@@ -309,6 +340,31 @@ if (process.argv[2] === '--self-test') {
309
340
  { now, config: base,
310
341
  ledger: [{ event: 'spawn', at: now - 1000, peer: 'u_peer' }] }).ok);
311
342
 
343
+ // The settings file is the front door now, so it gets the same treatment as
344
+ // the brakes: prove it opens, prove it stays shut, and prove a typo in it
345
+ // fails to OFF rather than to something.
346
+ {
347
+ const os = require('node:os');
348
+ const fsx = require('node:fs');
349
+ const dir = fsx.mkdtempSync(join(os.tmpdir(), 'responder-settings-'));
350
+ const file = join(dir, 'settings.json');
351
+
352
+ fsx.writeFileSync(file, JSON.stringify({ responder: 'act', responder_per_hour: 2 }));
353
+ check('the machine settings file turns it on', settings({}, file).mode === 'act');
354
+ check('and its numbers are read too', settings({}, file).perHour === 2);
355
+
356
+ fsx.writeFileSync(file, JSON.stringify({ responder: 'sure, why not' }));
357
+ check('a value that is not a mode is OFF, not on', settings({}, file).mode === 'off');
358
+
359
+ fsx.writeFileSync(file, JSON.stringify({ responder: 'act' }));
360
+ check('env still overrides the file, for tests and scripts',
361
+ settings({ AGENTSIGNAL_RESPONDER: 'off' }, file).mode === 'off');
362
+
363
+ fsx.writeFileSync(file, '{ not json');
364
+ check('an unreadable settings file is OFF rather than a crash',
365
+ settings({}, file).mode === 'off');
366
+ }
367
+
312
368
  check('answer mode cannot reach a shell', !toolsFor('answer').includes('Bash'));
313
369
  check('act mode can', toolsFor('act').includes('Bash'));
314
370
  check('an unknown mode is off, not on', settings({ AGENTSIGNAL_RESPONDER: 'yes' }).mode === 'off');
@@ -319,5 +375,5 @@ if (process.argv[2] === '--self-test') {
319
375
  for (const f of failures) console.error(` x ${f}`);
320
376
  process.exit(1);
321
377
  }
322
- console.log(`Responder self-test: ${16} checks passed (every brake fails closed).`);
378
+ console.log(`Responder self-test: ${21} checks passed (every brake fails closed).`);
323
379
  }