@agentsignalnet/claude-plugin 0.2.60 → 0.2.61

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.60",
4
+ "version": "0.2.61",
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.60",
3
+ "version": "0.2.61",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1543,6 +1543,12 @@ const PAGE = `<!doctype html>
1543
1543
  document.getElementById('dot').style.background = '#3fb950';
1544
1544
  SELF = data.self ?? SELF;
1545
1545
 
1546
+ // BEFORE the error check, for the same reason the server sends it anyway:
1547
+ // the channel you cannot read is the one where you most need the list of
1548
+ // the others. Returning first left the page knowing about two channels and
1549
+ // showing neither.
1550
+ renderChannels(data.channels);
1551
+
1546
1552
  if (data.error) {
1547
1553
  document.getElementById('log').className = 'empty';
1548
1554
  document.getElementById('log').textContent = data.error;
@@ -1551,7 +1557,6 @@ const PAGE = `<!doctype html>
1551
1557
 
1552
1558
  document.getElementById('channel').textContent =
1553
1559
  data.channel ? data.channel.name + ' · ' + data.channel.ref : '';
1554
- renderChannels(data.channels);
1555
1560
  document.getElementById('count').textContent = data.messages.length;
1556
1561
 
1557
1562
  const log = document.getElementById('log');
@@ -3209,19 +3214,37 @@ const server = createServer(async (req, res) => {
3209
3214
  body.messages = writeHistory(on.ref ?? channelRef, [...byId.values()], settings().history_days);
3210
3215
  // Every channel this viewer can open, so the page can offer them. The
3211
3216
  // key never leaves this process -- only the ref and the name.
3212
- body.channels = channels.map((c) => ({
3213
- ref: c.ref,
3214
- name: c.name ?? c.via,
3215
- via: c.via,
3216
- account: c.account ?? null,
3217
- company: c.company ?? null,
3218
- active: c === on,
3219
- }));
3217
+
3220
3218
  // What this call actually cost, so the page can say so rather than
3221
3219
  // implying every refresh is free or that every refresh is billed.
3222
3220
  body.fetched = fresh.length;
3223
3221
  }
3224
3222
 
3223
+ /**
3224
+ * THE RAIL IS SENT EVEN WHEN THE READ FAILED.
3225
+ *
3226
+ * This used to live inside the success branch, so any channel whose poll
3227
+ * errored took the whole rail down with it -- no channels, no agents,
3228
+ * nothing to click. Which is precisely backwards: a channel you cannot
3229
+ * read is the moment you most need the list, because the other one in it
3230
+ * probably works and switching is the fix.
3231
+ *
3232
+ * Found by pointing the viewer at two accounts with no credit. Reading a
3233
+ * log costs a delivery, both polls came back 402, and a page that knew
3234
+ * about two channels rendered neither.
3235
+ *
3236
+ * The key never leaves this process -- only the ref, the name and whose
3237
+ * it is.
3238
+ */
3239
+ body.channels = channels.map((c) => ({
3240
+ ref: c.ref,
3241
+ name: c.name ?? c.via,
3242
+ via: c.via,
3243
+ account: c.account ?? null,
3244
+ company: c.company ?? null,
3245
+ active: c === on,
3246
+ }));
3247
+
3225
3248
  const agent = url.searchParams.get('agent');
3226
3249
 
3227
3250
  // Filtered here rather than in the page, so the browser never holds
@@ -3307,15 +3330,28 @@ resolveSelf();
3307
3330
  * is better than being quietly shown one channel and told nothing.
3308
3331
  */
3309
3332
  async function nameChannels() {
3310
- const now = new Date().toISOString();
3311
3333
  await Promise.all(
3312
- // SKIP THE FIRST. It is the one the page opens on, so its first poll names
3313
- // it for free -- asking here as well is a second request for an answer
3314
- // already on its way, and it breaks the property that a viewer watching
3315
- // one channel makes exactly one call to fetch and one to keep up.
3316
- channels.slice(1).map(async (c) => {
3334
+ /**
3335
+ * ALL OF THEM, including the one the page opens on.
3336
+ *
3337
+ * It used to skip the first, because its own poll named it and asking
3338
+ * twice cost a delivery. That reasoning went with the endpoint: the
3339
+ * directory is free, and the poll does NOT always answer -- an account
3340
+ * with no credit gets a 402 for its log, so the channel it is looking at
3341
+ * stayed labelled by whichever key opened it while every other channel
3342
+ * was named properly.
3343
+ */
3344
+ channels.map(async (c) => {
3317
3345
  if (c.name && c.account) return;
3318
- const body = await upstream(`/v1/messages?limit=1&since=${encodeURIComponent(now)}`, c.key);
3346
+ /**
3347
+ * THE DIRECTORY, not the log.
3348
+ *
3349
+ * Reading messages costs a delivery. Naming the rail should not, and for
3350
+ * an account holding no credit it could not: the call 402s and the
3351
+ * channel stays labelled by whichever server's key opened it. The
3352
+ * directory answers the same two questions for nothing.
3353
+ */
3354
+ const body = await upstream('/v1/recipients', c.key);
3319
3355
  if (body?.channel?.name) {
3320
3356
  c.name = body.channel.name;
3321
3357
  c.ref = body.channel.ref ?? c.ref;