@agentsignalnet/claude-plugin 0.2.111 → 0.2.113

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.111",
4
+ "version": "0.2.113",
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentsignalnet/claude-plugin",
3
- "version": "0.2.111",
3
+ "version": "0.2.113",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1459,6 +1459,15 @@ const PAGE = `<!doctype html>
1459
1459
  const OPEN = new Set();
1460
1460
  /** The rendered agent tree per channel, so reopening one costs nothing. */
1461
1461
  const BRANCHES = new Map();
1462
+ /*
1463
+ A THIRD STATE, because two were not enough.
1464
+
1465
+ BRANCHES held HTML, and its two readings were "not set yet" (reading) and
1466
+ "set" (draw it, or say the channel is empty when it is ''). A read that
1467
+ FAILED had no way to be spelled, so it borrowed one of those and lied. A
1468
+ symbol cannot collide with any markup, so the three states stay distinct.
1469
+ */
1470
+ const UNREADABLE = Symbol('unreadable');
1462
1471
  /** Whether the channel being read has been opened for the first time yet. */
1463
1472
  let OPENED_ONCE = false;
1464
1473
 
@@ -1491,8 +1500,32 @@ const PAGE = `<!doctype html>
1491
1500
  try {
1492
1501
  list = await (await fetch(q('/agents' + (ref ? '?channel=' + encodeURIComponent(ref) : '')))).json();
1493
1502
  } catch {
1503
+ BRANCHES.set(ref ?? '', UNREADABLE);
1504
+ drawRail();
1505
+ return;
1506
+ }
1507
+
1508
+ /*
1509
+ THE SERVER SAYS WHY, AND THIS USED TO THROW IT AWAY.
1510
+
1511
+ /agents returns an object carrying "error" when the upstream call is
1512
+ refused -- a revoked key, a channel this key is no longer in, an API that
1513
+ cannot be reached -- and "recipients ?? []" turned all of that into
1514
+ nobody.
1515
+ Worse than a wrong count: the early return below meant BRANCHES was never
1516
+ set, so the rail sat on "reading…" indefinitely for a read that had
1517
+ already finished and failed.
1518
+
1519
+ An empty channel and an unreadable one are opposite facts and the rail
1520
+ now draws them differently.
1521
+ */
1522
+ if (list && list.error) {
1523
+ BRANCHES.set(ref ?? '', UNREADABLE);
1524
+ if (active) ROSTER = [];
1525
+ drawRail();
1494
1526
  return;
1495
1527
  }
1528
+
1496
1529
  if (active) ROSTER = list.recipients ?? [];
1497
1530
  // People are listed too, and a person has no chat to open -- nothing is
1498
1531
  // sent FROM a phone. Agents only.
@@ -1759,10 +1792,15 @@ const PAGE = `<!doctype html>
1759
1792
  const body =
1760
1793
  branch === undefined
1761
1794
  ? '<p class="none">reading…</p>'
1762
- // A channel really can have no agents yet -- a company that has just
1763
- // been created. Without this the expanded channel is blank, which
1764
- // reads as still loading rather than as an answer.
1765
- : branch || '<p class="none">no agents yet</p>';
1795
+ : branch === UNREADABLE
1796
+ // NOT "no agents yet". The read failed, and saying a channel is
1797
+ // empty because we could not look at it is the one answer that
1798
+ // sends somebody looking for the wrong problem.
1799
+ ? '<p class="none">could not read this channel</p>'
1800
+ // A channel really can have no agents yet -- a company that has just
1801
+ // been created. Without this the expanded channel is blank, which
1802
+ // reads as still loading rather than as an answer.
1803
+ : branch || '<p class="none">no agents yet</p>';
1766
1804
  return '<div class="chan">' + head + '<div class="chan-body">' + body + '</div></div>';
1767
1805
  }).join('');
1768
1806
 
@@ -3253,9 +3291,45 @@ const server = createServer(async (req, res) => {
3253
3291
  onboardingOn && inScope(onboardingOn)
3254
3292
  ? await upstream('/v1/agents', onboardingOn.key)
3255
3293
  : { error: 'unscoped' };
3256
- const others = roster.error
3294
+ /*
3295
+ A ROSTER THAT COULD NOT BE READ IS NOT AN EMPTY ONE.
3296
+
3297
+ This was `roster.error ? []`, and every step below then reported on a
3298
+ channel it had never seen. Two of them said something false rather than
3299
+ nothing: "Have somebody to reach" printed "nobody else in this channel
3300
+ yet", and "Say what each agent does" printed "all described" -- because
3301
+ zero agents means zero undescribed ones, so a failed read came out as a
3302
+ clean bill of health.
3303
+
3304
+ Observed on 2026-08-23: a dashboard holding a key for a channel the
3305
+ session had since left showed 0 people, with no way to tell that from a
3306
+ channel that really is empty. The key is in the keychain, so the channel
3307
+ is listed at startup and looks watched.
3308
+
3309
+ `rosterFailed` carries the reason through, and every step that leans on
3310
+ the roster is now NOT DONE while it is set -- unknown must not read as
3311
+ complete, which is the direction this failed in.
3312
+ */
3313
+ /*
3314
+ TWO REASONS THE ROSTER IS ABSENT, AND ONLY ONE IS A FAILURE.
3315
+
3316
+ `unscoped` is this file refusing to read on purpose, because the company
3317
+ question is still open and reading would put one company's counts under
3318
+ another's name. Nothing went wrong and there is nothing to report; the
3319
+ steps stay not-done and say what they always said.
3320
+
3321
+ Anything else came from upstream -- a revoked key, a channel this key is
3322
+ no longer in, an API that cannot be reached -- and that is the case this
3323
+ whole block exists for. Conflating the two was caught by
3324
+ a-dashboard-shows-one-companys-people, which asserts the wording of the
3325
+ open-question state.
3326
+ */
3327
+ const rosterFailed =
3328
+ roster.error && roster.error !== 'unscoped' ? String(roster.error) : null;
3329
+ const others = rosterFailed
3257
3330
  ? []
3258
3331
  : (roster.recipients ?? []).filter((r) => r.key !== (self && self.key));
3332
+ const unread = rosterFailed ? `could not read this channel — ${rosterFailed}` : null;
3259
3333
  const current = settings();
3260
3334
 
3261
3335
  res.writeHead(200, { 'Content-Type': 'application/json' });
@@ -3282,19 +3356,21 @@ const server = createServer(async (req, res) => {
3282
3356
  // Derived from the roster, because the description is what other
3283
3357
  // agents read when deciding who to hand work to. An agent with no
3284
3358
  // description is reachable and unchoosable.
3285
- done: others.length > 0 && others.every((r) => !r.is_agent || r.description),
3286
- detail: (() => {
3287
- const bare = others.filter((r) => r.is_agent && !r.description);
3288
- return bare.length ? `${bare.length} with no description` : 'all described';
3289
- })(),
3359
+ done: !rosterFailed && others.length > 0 && others.every((r) => !r.is_agent || r.description),
3360
+ detail:
3361
+ unread ??
3362
+ (() => {
3363
+ const bare = others.filter((r) => r.is_agent && !r.description);
3364
+ return bare.length ? `${bare.length} with no description` : 'all described';
3365
+ })(),
3290
3366
  },
3291
3367
  {
3292
3368
  id: 'reach',
3293
3369
  title: 'Have somebody to reach',
3294
- done: others.length > 0,
3295
- detail: others.length
3296
- ? `${others.length} reachable`
3297
- : 'nobody else in this channel yet',
3370
+ done: !rosterFailed && others.length > 0,
3371
+ detail:
3372
+ unread ??
3373
+ (others.length ? `${others.length} reachable` : 'nobody else in this channel yet'),
3298
3374
  },
3299
3375
  {
3300
3376
  id: 'limits',
@@ -298,7 +298,16 @@ if (mode === 'watch') {
298
298
  silent.
299
299
  */
300
300
  const sessionKey = (process.env.CLAUDE_CODE_HOST_SESSION_ID ?? '').replace(/[^A-Za-z0-9_-]/g, '_');
301
- const watchFile = sessionKey
301
+ /*
302
+ `let`, because losing the lease must DEGRADE rather than throw.
303
+
304
+ It is an optimisation -- it stops sixty-seven pollers becoming sixty-seven
305
+ node runtimes -- and the watcher's actual job is to notice messages. So
306
+ every failure below sets this to null and carries on WITHOUT single-flight,
307
+ which is exactly what this file did before the lease existed. Wasteful
308
+ beats absent, and a brake fails closed while an optimisation must not.
309
+ */
310
+ let watchFile = sessionKey
302
311
  ? join(lockDir(), 'watching', `${sessionKey}.json`)
303
312
  : null;
304
313
 
@@ -324,30 +333,57 @@ if (mode === 'watch') {
324
333
  const until = () => Date.now() + WATCH_SECONDS * 1000;
325
334
 
326
335
  if (watchFile) {
327
- mkdirSync(dirname(watchFile), { recursive: true });
328
- const held = readWatcher();
336
+ /*
337
+ A DISK THAT CANNOT BE WRITTEN TO MUST NOT COST THE WATCHER.
338
+
339
+ This block was unguarded, and on 2026-08-23 a full disk crashed the hook
340
+ here twice -- ENOSPC out of `writeAtomic`, once on the rename and once on
341
+ the open, both in hook.log with a stack trace and nothing watching
342
+ afterwards. Before the lease existed, `watch` on a quiet channel wrote
343
+ nothing at all, so this file had made a previously read-only path into a
344
+ write on EVERY tool call, and then let that write be fatal.
345
+
346
+ The trade is deliberate. Failing here means no single-flight, so the old
347
+ one-poller-per-tool-call behaviour comes back and the machine is
348
+ wasteful. Failing the other way means no watcher, and an urgent message
349
+ that never interrupts anybody. Waste is recoverable; a message nobody
350
+ saw is not.
351
+
352
+ Losing the lease mid-run is covered too: the poll loop treats a lease it
353
+ cannot read as "no longer mine" and stands down, which is right when
354
+ another watcher took over and wrong when the disk simply filled. So the
355
+ claim is what decides -- once it fails, single-flight is off for this
356
+ process and the loop stops consulting a file it knows it never wrote.
357
+ */
358
+ try {
359
+ mkdirSync(dirname(watchFile), { recursive: true });
360
+ const held = readWatcher();
329
361
 
330
- if (held && held.pid !== process.pid && alive(held.pid)) {
331
- // Somebody is already watching for this session. Push their deadline out
332
- // to cover the tool call that just finished, and stop.
333
- writeAtomic(watchFile, { pid: held.pid, until: until() });
334
- process.exit(0);
335
- }
362
+ if (held && held.pid !== process.pid && alive(held.pid)) {
363
+ // Somebody is already watching for this session. Push their deadline out
364
+ // to cover the tool call that just finished, and stop.
365
+ writeAtomic(watchFile, { pid: held.pid, until: until() });
366
+ process.exit(0);
367
+ }
336
368
 
337
- // Nobody, or a pid that died with its file still on disk -- a watcher lost
338
- // to SIGKILL or a reboot leaves exactly that, and it is not an error.
339
- writeAtomic(watchFile, { pid: process.pid, until: until() });
340
-
341
- // Runs on process.exit() too, so the wake path below cleans up as well.
342
- process.on('exit', () => {
343
- if (readWatcher()?.pid === process.pid) {
344
- try {
345
- unlinkSync(watchFile);
346
- } catch {
347
- /* somebody else tidied it, or took over */
369
+ // Nobody, or a pid that died with its file still on disk -- a watcher lost
370
+ // to SIGKILL or a reboot leaves exactly that, and it is not an error.
371
+ writeAtomic(watchFile, { pid: process.pid, until: until() });
372
+
373
+ // Runs on process.exit() too, so the wake path below cleans up as well.
374
+ process.on('exit', () => {
375
+ if (readWatcher()?.pid === process.pid) {
376
+ try {
377
+ unlinkSync(watchFile);
378
+ } catch {
379
+ /* somebody else tidied it, or took over */
380
+ }
348
381
  }
349
- }
350
- });
382
+ });
383
+ } catch {
384
+ // No lease, so no single-flight -- and this process still watches.
385
+ watchFile = null;
386
+ }
351
387
  }
352
388
 
353
389
  // Exit 2 is the wake. Anything else is silence.