@agentsignalnet/claude-plugin 0.2.106 → 0.2.108
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.
- package/.claude-plugin/plugin.json +1 -1
- package/.mcp.json +1 -1
- package/package.json +1 -1
- package/scripts/inbox-daemon.mjs +45 -3
package/.mcp.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"mcpServers": {
|
|
3
3
|
"agentsignal": {
|
|
4
4
|
"command": "npx",
|
|
5
|
-
"args": ["-y", "@agentsignalnet/mcp@0.2.
|
|
5
|
+
"args": ["-y", "@agentsignalnet/mcp@0.2.63"],
|
|
6
6
|
"env": {
|
|
7
7
|
"AGENTSIGNAL_API_KEY": "${user_config.api_key}",
|
|
8
8
|
"AGENTSIGNAL_JOIN_TOKEN": "${user_config.join_token}",
|
package/package.json
CHANGED
package/scripts/inbox-daemon.mjs
CHANGED
|
@@ -106,7 +106,38 @@ let longPoll = true;
|
|
|
106
106
|
* front of delivery -- if it is missing, down, or unreachable from this
|
|
107
107
|
* network, the worst case is the behaviour of the version before it existed.
|
|
108
108
|
*/
|
|
109
|
-
const
|
|
109
|
+
const pushOverride = (process.env.AGENTSIGNAL_PUSH_URL ?? '').replace(/\/+$/, '');
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Where the doorbell is, ASKED FOR rather than configured.
|
|
113
|
+
*
|
|
114
|
+
* The API answers this on /v1/devices/me, so moving the doorbell or switching
|
|
115
|
+
* it off is a Worker secret rather than a plugin release -- unset it there and
|
|
116
|
+
* every watcher falls back to polling on its next reconnect, with nothing to
|
|
117
|
+
* install. A version that had to be told at install time could only learn a
|
|
118
|
+
* new address by being reinstalled, which is the wrong shape for a thing that
|
|
119
|
+
* is deliberately allowed to be absent.
|
|
120
|
+
*
|
|
121
|
+
* Asked on every reconnect, not once: a doorbell turned on this afternoon
|
|
122
|
+
* should be found by a watcher that started this morning.
|
|
123
|
+
*
|
|
124
|
+
* The environment variable stays as an override, for tests and for pointing a
|
|
125
|
+
* watcher at a doorbell of your own.
|
|
126
|
+
*/
|
|
127
|
+
async function findDoorbell(identity) {
|
|
128
|
+
if (pushOverride) return pushOverride;
|
|
129
|
+
try {
|
|
130
|
+
const response = await fetch(`${baseUrl}/v1/devices/me`, {
|
|
131
|
+
headers: { Authorization: `Device ${identity.secret}` },
|
|
132
|
+
signal: AbortSignal.timeout(10_000),
|
|
133
|
+
});
|
|
134
|
+
if (!response.ok) return '';
|
|
135
|
+
const body = await response.json();
|
|
136
|
+
return typeof body.push_url === 'string' ? body.push_url.replace(/\/+$/, '') : '';
|
|
137
|
+
} catch {
|
|
138
|
+
return '';
|
|
139
|
+
}
|
|
140
|
+
}
|
|
110
141
|
|
|
111
142
|
/**
|
|
112
143
|
* How long the poll rests when a doorbell is doing the waiting.
|
|
@@ -577,7 +608,6 @@ async function considerResponding(watched) {
|
|
|
577
608
|
* screenful of identical lines to scroll past in the morning.
|
|
578
609
|
*/
|
|
579
610
|
function keepDoorbell(identity) {
|
|
580
|
-
if (!pushUrl) return;
|
|
581
611
|
const who = identity.handle ? `${identity.handle}: ` : '';
|
|
582
612
|
let complained = false;
|
|
583
613
|
|
|
@@ -586,9 +616,21 @@ function keepDoorbell(identity) {
|
|
|
586
616
|
// down: a reconnect loop that outlives its reason is a leak.
|
|
587
617
|
if (rejected.has(identity.secret)) return;
|
|
588
618
|
|
|
619
|
+
const where = await findDoorbell(identity);
|
|
620
|
+
if (!where) {
|
|
621
|
+
// No doorbell configured for this deployment, which is a supported state
|
|
622
|
+
// and not worth saying twice. Ask again later in case one appears.
|
|
623
|
+
if (!complained) {
|
|
624
|
+
say(`${who}no doorbell offered; messages will arrive on the poll`);
|
|
625
|
+
complained = true;
|
|
626
|
+
}
|
|
627
|
+
setTimeout(connect, 300_000);
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
|
|
589
631
|
let response;
|
|
590
632
|
try {
|
|
591
|
-
response = await fetch(`${
|
|
633
|
+
response = await fetch(`${where}/v1/wake`, {
|
|
592
634
|
headers: { Authorization: `Device ${identity.secret}`, Accept: 'text/event-stream' },
|
|
593
635
|
});
|
|
594
636
|
if (!response.ok || !response.body) throw new Error(`${response.status}`);
|