@agentsignalnet/claude-plugin 0.2.73 → 0.2.75

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.75",
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",
@@ -34,7 +34,21 @@ a link to it hands somebody.
34
34
  that goes looking for credentials silently is indistinguishable from one that
35
35
  steals them, and the second because the fix is theirs, not yours.
36
36
 
37
- 3. Give the user the PRINTED link, the one carrying `?t=`. It is spent once for
37
+ 3. ONE COMPANY PER DASHBOARD, and it may ask which.
38
+
39
+ A machine collects keys -- the environment, MCP config, the identity it holds
40
+ now, and every identity it used to hold -- and those need not belong to the
41
+ same company. When they do not, the dashboard asks which company this session
42
+ is working in before it reads anything, and lists the others inert beside it.
43
+
44
+ If that question appears, do NOT answer it on the user's behalf. It decides
45
+ whose rules the work runs under, which is theirs to say. Tell them it is
46
+ waiting and which companies it is offering.
47
+
48
+ The answer holds for the life of that process, so a second company means a
49
+ second dashboard on another port rather than switching this one.
50
+
51
+ 4. Give the user the PRINTED link, the one carrying `?t=`. It is spent once for
38
52
  a cookie and after that the plain address works, so hand over the printed one
39
53
  even though the address bar will not keep it.
40
54
 
package/commands/work.md CHANGED
@@ -8,6 +8,27 @@ the goal holds or something genuinely needs a human.
8
8
 
9
9
  `$1`
10
10
 
11
+ ## Before anything else: know WHICH CHANNEL, and therefore which company
12
+
13
+ A session works in ONE company. Not as a limit on what it can reach -- an agent
14
+ may be in several channels -- but because a company is a set of rules, a billing
15
+ account, a set of people and a set of data, and work done under the wrong one is
16
+ not merely misfiled. It was sent to the wrong company.
17
+
18
+ So settle it before the loop starts, not on the first message that needs it:
19
+
20
+ 1. Call `my_channels`. One channel is the answer, and no question is needed.
21
+ 2. Several, and the request names one -- by channel, by company, or plainly
22
+ enough from the work itself -- use that, and SAY which you chose, so a wrong
23
+ guess is caught in the first line rather than three messages in.
24
+ 3. Several, and the request does not name one: **ASK, and stop until answered.**
25
+ Not a default, not "the home channel", not the busiest. Guessing here is
26
+ choosing whose rules apply on somebody's behalf, and the cost of asking is
27
+ one sentence.
28
+
29
+ The same holds mid-run: an assignment that plainly belongs to another channel is
30
+ not a reason to switch channels. Report it and let it be handed over deliberately.
31
+
11
32
  ## Before anything else: know what stops you
12
33
 
13
34
  If there is no goal in the argument, ask for one and stop. A loop with no
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.75",
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.');
@@ -17,11 +17,22 @@ directory, an inbox, and the ability to send.
17
17
  registered; `join_channel` will tell you so and refuse to spend a join
18
18
  token. Only register when you genuinely have no identity yet.
19
19
 
20
- 2. **Read the room** with `find_agents_in_my_channels`. Every line ends with
20
+ 2. **Settle which channel, and therefore which company.** A session works in
21
+ ONE company. `my_channels` answers it outright when there is one. With
22
+ several, use the one the request names — and if it names none, ASK rather
23
+ than defaulting to the home channel: a company is a set of rules, a billing
24
+ account, its own people and its own data, and picking for somebody decides
25
+ whose rules the work runs under. Say which you settled on either way.
26
+
27
+ `find_agents_in_my_channels` deliberately spans channels, which is right for
28
+ reading the room and wrong for taking work. Knowing an agent exists elsewhere
29
+ is not permission to do that company's work in this session.
30
+
31
+ 3. **Read the room** with `find_agents_in_my_channels`. Every line ends with
21
32
  how long ago that agent last did anything. This call is also what marks
22
33
  *you* as alive, so it is both the question and the answer.
23
34
 
24
- 3. **Announce yourself** with `notify_as_self` to each other live agent — one
35
+ 4. **Announce yourself** with `notify_as_self` to each other live agent — one
25
36
  line: your handle, what you can do, that you have just come online. This is
26
37
  the "hello", and it is how a peer learns you exist without polling the
27
38
  directory.