@agentsignalnet/claude-plugin 0.2.58 → 0.2.59

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.58",
4
+ "version": "0.2.59",
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.58",
3
+ "version": "0.2.59",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -68,7 +68,10 @@ function borrowFromMcpConfig() {
68
68
  try {
69
69
  config = JSON.parse(readFileSync(join(homedir(), '.claude.json'), 'utf8'));
70
70
  } catch {
71
- return null;
71
+ // An empty list, not null: every caller now treats this as "the servers
72
+ // that hold a key", and no file is none of them rather than an absence of
73
+ // an answer.
74
+ return [];
72
75
  }
73
76
 
74
77
  const found = [];
@@ -88,10 +91,24 @@ function borrowFromMcpConfig() {
88
91
  };
89
92
  walk(config);
90
93
 
91
- // More than one and there is no principled way to choose: they may be
92
- // different accounts, and picking wrong shows somebody else's conversation.
93
- if (found.length !== 1) return found.length > 1 ? { ambiguous: found.map((f) => f.name) } : null;
94
- return found[0];
94
+ /**
95
+ * ALL OF THEM, and the caller decides.
96
+ *
97
+ * This used to answer "ambiguous" above one and the viewer exited, on the
98
+ * reasoning that there is no principled way to CHOOSE -- which was true and
99
+ * is no longer the question. Nothing chooses now: every key this machine
100
+ * holds becomes a channel in the rail, named, and the reader picks by
101
+ * clicking. Refusing to start was only ever the right answer while showing
102
+ * one of them silently was the alternative.
103
+ *
104
+ * Two servers may be two ACCOUNTS rather than two channels of one, which is
105
+ * a real difference and not one that matters here: either way they are
106
+ * conversations this machine has the key for, and either way the rail says
107
+ * which is which. What DOES matter is the base URL, and the caller filters
108
+ * on it -- a key for a local API and a key for production are not two
109
+ * channels, they are two different APIs.
110
+ */
111
+ return found;
95
112
  }
96
113
 
97
114
  /**
@@ -126,21 +143,16 @@ const port = Number(process.env.PORT ?? 8899);
126
143
  */
127
144
  const token = randomUUID();
128
145
 
129
- if (!apiKey) {
130
- const borrowed = borrowFromMcpConfig();
131
- if (borrowed?.ambiguous) {
132
- console.error(
133
- `Several AgentSignal MCP servers hold a key (${borrowed.ambiguous.join(', ')}).\n` +
134
- 'They may be different accounts, so set AGENTSIGNAL_API_KEY to say which.',
135
- );
136
- process.exit(1);
137
- }
138
- if (borrowed) {
139
- apiKey = borrowed.key;
140
- baseUrl ??= borrowed.baseUrl;
141
- console.log(`Using the API key from MCP server "${borrowed.name}" in ~/.claude.json.`);
142
- }
143
- }
146
+ /**
147
+ * Servers configured in ~/.claude.json that hold a key.
148
+ *
149
+ * Collected before the base URL is settled, because the first of them is
150
+ * allowed to decide it: somebody running the viewer against a local API has
151
+ * said so once, in the server they added, and should not have to say it again
152
+ * in the environment.
153
+ */
154
+ const borrowed = apiKey ? [] : borrowFromMcpConfig();
155
+ if (borrowed.length) baseUrl ??= borrowed[0].baseUrl;
144
156
 
145
157
  baseUrl = (baseUrl ?? 'https://api.agentsignal.net').replace(/\/+$/, '');
146
158
 
@@ -266,6 +278,35 @@ if (apiKey) {
266
278
  * separately rather than silently merging it with something it may not be.
267
279
  */
268
280
  const byChannel = new Map();
281
+
282
+ /**
283
+ * CONFIGURED SERVERS FIRST, then identities.
284
+ *
285
+ * A key somebody put in a config is a key they chose; a key found in an
286
+ * identity file is one this machine minted for itself. When both open the
287
+ * same channel the chosen one wins, which is the same precedence the
288
+ * environment already gets over everything.
289
+ *
290
+ * Filtered on base URL, and this is the one place the difference bites: two
291
+ * servers may be two accounts, which is fine and shows as two channels, but
292
+ * a server pointed at a local API is not a channel of the production one.
293
+ * Mixing those would put a development conversation in the same rail as a
294
+ * real one, named identically, with no way to tell them apart.
295
+ */
296
+ for (const server of borrowed) {
297
+ const at = (server.baseUrl ?? baseUrl).replace(/\/+$/, '');
298
+ if (at !== baseUrl) continue;
299
+ const ref = channelOfKey(server.key);
300
+ if (byChannel.has(ref ?? server.key)) continue;
301
+ byChannel.set(ref ?? server.key, {
302
+ key: server.key,
303
+ via: `MCP server "${server.name}"`,
304
+ from: join(homedir(), '.claude.json'),
305
+ ref,
306
+ name: null,
307
+ });
308
+ }
309
+
269
310
  for (const holder of everyHolder()) {
270
311
  const key = keyOf(holder);
271
312
  if (!key) continue;