@agentsignalnet/claude-plugin 0.2.73 → 0.2.74

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.73",
4
+ "version": "0.2.74",
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.73",
3
+ "version": "0.2.74",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -128,6 +128,20 @@ let apiKey = process.env.AGENTSIGNAL_API_KEY;
128
128
  let baseUrl = process.env.AGENTSIGNAL_BASE_URL;
129
129
  const port = Number(process.env.PORT ?? 8899);
130
130
 
131
+ /**
132
+ * The port actually BOUND, which is not always the one asked for.
133
+ *
134
+ * PORT=0 means "any free one", which is how anything automated starts a server
135
+ * without picking a number and hoping. The banner already prints the bound one;
136
+ * the Origin check below did not, and compared the page's real origin against
137
+ * http://127.0.0.1:0 -- so on an assigned port every non-GET from the page was
138
+ * refused with a flat "No.". Readable, and unable to send, answer, invite or
139
+ * connect, with nothing saying why.
140
+ *
141
+ * Set in the listen callback, which runs before any request can arrive.
142
+ */
143
+ let bound = port;
144
+
131
145
  /**
132
146
  * A token in the URL, and loopback only.
133
147
  *
@@ -444,6 +458,17 @@ if (apiKey) {
444
458
  if (byChannel.has(at)) continue;
445
459
  byChannel.set(at, {
446
460
  key,
461
+ /*
462
+ WHO on this machine is a member of this channel, kept because minting an
463
+ invitation needs one. A join code carries who extended it -- that is
464
+ what fills in sponsored_by and lets a fleet work out who leads -- so the
465
+ API refuses to mint from an account key and refuses a member of some
466
+ other channel. Without this the dashboard had one notion of "me",
467
+ resolved once at startup against the default channel, and offered it as
468
+ the inviter for every channel: correct for the first and refused for all
469
+ the rest.
470
+ */
471
+ holder: holder.key ?? null,
447
472
  via: `${holder.handle ?? holder.key}${holder.archived ? ' (previously)' : ''}`,
448
473
  // WHERE it came from, kept so startup can say it. A dashboard that goes
449
474
  // looking for credentials silently is indistinguishable from one that
@@ -2781,7 +2806,7 @@ const server = createServer(async (req, res) => {
2781
2806
  * no Origin at all.
2782
2807
  */
2783
2808
  const origin = req.headers.origin;
2784
- if (req.method !== 'GET' && origin && origin !== `http://127.0.0.1:${port}` && origin !== `http://localhost:${port}`) {
2809
+ if (req.method !== 'GET' && origin && origin !== `http://127.0.0.1:${bound}` && origin !== `http://localhost:${bound}`) {
2785
2810
  res.writeHead(403, { 'Content-Type': 'text/plain; charset=utf-8' });
2786
2811
  res.end('No.');
2787
2812
  return;
@@ -3257,7 +3282,29 @@ const server = createServer(async (req, res) => {
3257
3282
  // what fills in `sponsored_by` and therefore what lets the fleet work out
3258
3283
  // who leads. A code minted with the account key would arrive sponsored by
3259
3284
  // nobody -- a root, silently.
3260
- const inviter = identities.find((i) => i.credential && i.key === (self && self.key));
3285
+ /*
3286
+ The member of THE CHANNEL BEING INVITED INTO, not the machine's idea of
3287
+ itself. `self` is resolved once at startup against the default channel, so
3288
+ using it here meant an invitation to any other channel was extended by
3289
+ somebody who is not in it -- which the API rightly refuses, with a message
3290
+ about the channel rather than about the inviter, so it read as a missing
3291
+ permission rather than as the wrong signature.
3292
+
3293
+ Falls back to `self` when the channel is not one of the known ones, which
3294
+ is the old behaviour for the only case it was ever right for.
3295
+ */
3296
+ const into = channelFor(payload.channel);
3297
+ const wanted = into?.holder ?? (self && self.key);
3298
+ /*
3299
+ Searched across every holder, not just the live ones. `identities` is what
3300
+ this machine currently IS; the channels it can open come from
3301
+ everyHolder(), which includes identities that were superseded and still
3302
+ hold a credential. The Sandbox channel is exactly that case -- it is
3303
+ opened by an identity this agent used to be -- so looking only at the live
3304
+ list found nobody and reported "connect this project first" about a
3305
+ project that was already connected.
3306
+ */
3307
+ const inviter = everyHolder().find((i) => i.credential && i.key === wanted);
3261
3308
  if (!inviter) {
3262
3309
  res.writeHead(400, { 'Content-Type': 'application/json' });
3263
3310
  res.end(
@@ -3873,7 +3920,7 @@ server.listen(port, '127.0.0.1', () => {
3873
3920
  // whenever PORT is 0 -- which is how anything automated starts a server
3874
3921
  // without picking a number and hoping -- and printing the request rather
3875
3922
  // than the result hands out a link to port 0, which connects to nothing.
3876
- const bound = server.address()?.port ?? port;
3923
+ bound = server.address()?.port ?? port;
3877
3924
  console.error(`Watching ${baseUrl} on http://127.0.0.1:${bound}/?t=${token}`);
3878
3925
  console.error('Loopback only, and the link carries a one-run token: it can now send and answer.');
3879
3926
  console.error('The key stays in this process; the page only ever talks to this server.');