@agentsignalnet/claude-plugin 0.2.98 → 0.2.100
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
|
@@ -335,12 +335,42 @@ async function considerResponding(watched) {
|
|
|
335
335
|
for (const message of spool.messages ?? []) {
|
|
336
336
|
const verdict = mayRespond(message, { now, config, ledger, lockHeldBy, handled });
|
|
337
337
|
if (!verdict.ok) {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
338
|
+
/*
|
|
339
|
+
Only the interesting refusals, and each of them ONCE.
|
|
340
|
+
|
|
341
|
+
"within_grace" and "already_handled" were excluded from the start
|
|
342
|
+
because they are the system working and would drown the decisions
|
|
343
|
+
somebody actually needs to read. That list was not enough. Two of the
|
|
344
|
+
remaining reasons are PERMANENT -- a message with no spool stamp will
|
|
345
|
+
never grow one, and `already_answered` is true forever by design --
|
|
346
|
+
so they were re-recorded every cycle for as long as the message sat
|
|
347
|
+
there. Measured on the machine this was written on: 1,447 refusals in
|
|
348
|
+
two hours, twelve a minute, one delivery refused 291 times, and a
|
|
349
|
+
ledger growing about a megabyte and a half a day that is re-read on
|
|
350
|
+
every cycle.
|
|
351
|
+
|
|
352
|
+
Excluding them outright would trade a flood for a silence -- the
|
|
353
|
+
first refusal is exactly the line somebody needs when they ask why a
|
|
354
|
+
message was never answered. So it is recorded once per delivery and
|
|
355
|
+
reason, and repeats are dropped. A reason that CHANGES still gets its
|
|
356
|
+
own line, because that is a different fact about the world.
|
|
357
|
+
*/
|
|
358
|
+
const alreadySaid =
|
|
359
|
+
!['disabled', 'within_grace', 'already_handled'].includes(verdict.why) &&
|
|
360
|
+
ledger.some(
|
|
361
|
+
(e) =>
|
|
362
|
+
e.event === 'refused' &&
|
|
363
|
+
e.delivery_id === message.delivery_id &&
|
|
364
|
+
e.why === verdict.why,
|
|
365
|
+
);
|
|
366
|
+
|
|
367
|
+
if (!['disabled', 'within_grace', 'already_handled'].includes(verdict.why) && !alreadySaid) {
|
|
368
|
+
const entry = { event: 'refused', at: now, why: verdict.why,
|
|
369
|
+
delivery_id: message.delivery_id, peer: verdict.peer ?? null };
|
|
370
|
+
recordResponder(entry);
|
|
371
|
+
// Kept in the in-memory copy too, so a second message in this same
|
|
372
|
+
// pass cannot write the line this one just wrote.
|
|
373
|
+
ledger.push(entry);
|
|
344
374
|
say(`responder declined ${message.delivery_id}: ${verdict.why}`);
|
|
345
375
|
}
|
|
346
376
|
continue;
|
|
@@ -459,7 +489,42 @@ async function pollOne(identity) {
|
|
|
459
489
|
// mid-poll cannot lose a message between them.
|
|
460
490
|
const handled = new Set(readHandled(dir));
|
|
461
491
|
const outstanding = spool.messages.filter((m) => !handled.has(m.delivery_id));
|
|
462
|
-
|
|
492
|
+
const shrank = outstanding.length !== spool.messages.length;
|
|
493
|
+
|
|
494
|
+
/*
|
|
495
|
+
A MESSAGE WITH NO STAMP GETS ONE, rather than being refused forever.
|
|
496
|
+
|
|
497
|
+
`spooled_at` was added on 2026-08-20. Anything spooled before that has no
|
|
498
|
+
stamp, and `mayRespond` refuses an unstamped message because without one it
|
|
499
|
+
cannot tell whether the grace period has elapsed. That refusal is correct
|
|
500
|
+
and its consequence was not: the message can never become answerable, and
|
|
501
|
+
it never leaves either -- the spool only shrinks when a hook marks
|
|
502
|
+
something handled. Three of them were sitting on the machine this was
|
|
503
|
+
written on, refused 291 times each.
|
|
504
|
+
|
|
505
|
+
Stamping on first sight is the conservative repair. It does not claim to
|
|
506
|
+
know when the message arrived; it records when this daemon first saw it,
|
|
507
|
+
which is a lower bound on how long it has been waiting, and starts the
|
|
508
|
+
grace period from there. Written back to the spool, so a restart does not
|
|
509
|
+
reset it and a message cannot be held at arm's length forever by a daemon
|
|
510
|
+
that keeps starting.
|
|
511
|
+
*/
|
|
512
|
+
const now = new Date().toISOString();
|
|
513
|
+
let stamped = 0;
|
|
514
|
+
for (const message of outstanding) {
|
|
515
|
+
if (!message.spooled_at) {
|
|
516
|
+
message.spooled_at = now;
|
|
517
|
+
stamped += 1;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
if (stamped > 0) {
|
|
521
|
+
say(
|
|
522
|
+
`stamped ${stamped} message(s) that predate spooled_at; ` +
|
|
523
|
+
'their grace period starts now',
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
if (shrank || stamped > 0) {
|
|
463
528
|
spool.messages = outstanding;
|
|
464
529
|
writeSpool(spoolFile, spool);
|
|
465
530
|
}
|