@agentsignalnet/claude-plugin 0.2.106 → 0.2.107

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.106",
4
+ "version": "0.2.107",
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.106",
3
+ "version": "0.2.107",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -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 pushUrl = (process.env.AGENTSIGNAL_PUSH_URL ?? '').replace(/\/+$/, '');
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(`${pushUrl}/v1/wake`, {
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}`);