@agentsignalnet/claude-plugin 0.2.103 → 0.2.104
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/package.json
CHANGED
package/scripts/inbox-daemon.mjs
CHANGED
|
@@ -95,6 +95,18 @@ let longPoll = true;
|
|
|
95
95
|
/** The shortest a cycle may take, so a busy inbox cannot spin this hot. */
|
|
96
96
|
const FLOOR_MS = 250;
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Output that means the session never ran, as opposed to ran and went wrong.
|
|
100
|
+
*
|
|
101
|
+
* Deliberately narrow. A responder that stops itself on the wrong signal is
|
|
102
|
+
* worse than one that retries a few times too often: these are all conditions
|
|
103
|
+
* a message cannot influence and a retry cannot clear.
|
|
104
|
+
*/
|
|
105
|
+
const CANNOT_START = /Failed to authenticate|not logged in|command not found|ENOENT|Invalid API key/i;
|
|
106
|
+
|
|
107
|
+
/** Why this machine cannot run a responder at all, once something proves it. */
|
|
108
|
+
let unavailable = null;
|
|
109
|
+
|
|
98
110
|
/**
|
|
99
111
|
* Where the identity lives -- ALL the places, matching the MCP server exactly.
|
|
100
112
|
*
|
|
@@ -331,6 +343,10 @@ async function tick() {
|
|
|
331
343
|
async function considerResponding(watched) {
|
|
332
344
|
const config = responderSettings();
|
|
333
345
|
|
|
346
|
+
// Set once a spawn proves this machine cannot start a session at all. Every
|
|
347
|
+
// later message would fail the same way and spend a slot doing it.
|
|
348
|
+
if (unavailable) return;
|
|
349
|
+
|
|
334
350
|
const now = Date.now();
|
|
335
351
|
const ledger = readLedger();
|
|
336
352
|
const lockHeldBy = heldBy();
|
|
@@ -462,6 +478,35 @@ async function considerResponding(watched) {
|
|
|
462
478
|
child.on('exit', (code) => {
|
|
463
479
|
releaseLock();
|
|
464
480
|
const why = tail.trim().split('\n').filter(Boolean).at(-1) ?? null;
|
|
481
|
+
|
|
482
|
+
/*
|
|
483
|
+
A SESSION THAT COULD NOT START IS NOT A MESSAGE THAT WAS ANSWERED
|
|
484
|
+
BADLY, and the difference decides whether trying again is sensible.
|
|
485
|
+
|
|
486
|
+
"Failed to authenticate: OAuth session expired and could not be
|
|
487
|
+
refreshed" is the same for every message and will be the same for the
|
|
488
|
+
next one. Without this, each arriving message spawns, dies in under a
|
|
489
|
+
second, and spends one of six hourly slots -- so a machine that
|
|
490
|
+
cannot start a session at all burns its whole budget every hour,
|
|
491
|
+
forever, on sessions that never ran.
|
|
492
|
+
|
|
493
|
+
Measured here: exit 1 in well under a second, with the daemon's own
|
|
494
|
+
arguments and the right working directory.
|
|
495
|
+
|
|
496
|
+
Held until the daemon restarts rather than for a timer, because what
|
|
497
|
+
fixes it is a person signing in -- and a restart is what happens the
|
|
498
|
+
next time they open a session, which is also when signing in becomes
|
|
499
|
+
possible. A timer would just resume the same doomed spawns.
|
|
500
|
+
*/
|
|
501
|
+
if (code !== 0 && why && CANNOT_START.test(why)) {
|
|
502
|
+
unavailable = why;
|
|
503
|
+
recordResponder({ event: 'unavailable', at: Date.now(), why: why.slice(0, 300) });
|
|
504
|
+
complain(
|
|
505
|
+
`the responder cannot start sessions on this machine: ${why.slice(0, 200)}. ` +
|
|
506
|
+
'Not trying again until this watcher restarts. If that is a sign-in ' +
|
|
507
|
+
'problem, running `claude` once and signing in is the fix.',
|
|
508
|
+
);
|
|
509
|
+
}
|
|
465
510
|
recordResponder({
|
|
466
511
|
event: 'finished', at: Date.now(),
|
|
467
512
|
delivery_id: message.delivery_id, exit_code: code,
|