@agentsignalnet/claude-plugin 0.2.96 → 0.2.97
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/package.json +1 -1
- package/scripts/dashboard.mjs +17 -8
- package/scripts/inbox-daemon.mjs +53 -2
- package/scripts/responder.mjs +148 -23
package/package.json
CHANGED
package/scripts/dashboard.mjs
CHANGED
|
@@ -675,7 +675,7 @@ const DEFAULT_SETTINGS = {
|
|
|
675
675
|
// off nothing happens
|
|
676
676
|
// answer may reply and notify. No shell, no files.
|
|
677
677
|
// act may also read, search, edit and run commands.
|
|
678
|
-
responder: '
|
|
678
|
+
responder: 'answer',
|
|
679
679
|
};
|
|
680
680
|
|
|
681
681
|
function settings() {
|
|
@@ -2590,16 +2590,22 @@ const PAGE = `<!doctype html>
|
|
|
2590
2590
|
// about what they are agreeing to, and this is the control on this
|
|
2591
2591
|
// page that can spend money on its own.
|
|
2592
2592
|
'<select id="lresp">' +
|
|
2593
|
-
|
|
2593
|
+
// No 'off'. It was removed on 2026-08-21: answering is the floor
|
|
2594
|
+
// now, and the only way to stop it is to remove the plugin. A stored
|
|
2595
|
+
// 'off' from before that resolves to 'answer' here for the same
|
|
2596
|
+
// reason it does in responder.mjs -- so this shows what is actually
|
|
2597
|
+
// happening rather than an option that no longer does anything.
|
|
2598
|
+
['answer', 'act']
|
|
2594
2599
|
.map(
|
|
2595
2600
|
(k) =>
|
|
2596
2601
|
'<option value="' +
|
|
2597
2602
|
k +
|
|
2598
2603
|
'"' +
|
|
2599
|
-
((LIMITS.responder
|
|
2604
|
+
((['answer', 'act'].includes(LIMITS.responder) ? LIMITS.responder : 'answer') === k
|
|
2605
|
+
? ' selected'
|
|
2606
|
+
: '') +
|
|
2600
2607
|
'>' +
|
|
2601
2608
|
{
|
|
2602
|
-
off: 'nobody answers when you are away',
|
|
2603
2609
|
answer: 'answer messages while you are away',
|
|
2604
2610
|
act: 'answer AND do the work while you are away',
|
|
2605
2611
|
}[k] +
|
|
@@ -3448,12 +3454,15 @@ const server = createServer(async (req, res) => {
|
|
|
3448
3454
|
happens" -- but a stored value nobody can explain is worse than an error,
|
|
3449
3455
|
so it does not silently become 'off' either.
|
|
3450
3456
|
*/
|
|
3451
|
-
const responder
|
|
3452
|
-
|
|
3453
|
-
|
|
3457
|
+
const stored = payload.responder === undefined ? current.responder : String(payload.responder);
|
|
3458
|
+
// A stored 'off' predates the setting being removed and is not an error to
|
|
3459
|
+
// report back at somebody -- it is a value this version no longer has, and
|
|
3460
|
+
// it becomes the floor rather than a 400 they cannot act on.
|
|
3461
|
+
const responder = ['answer', 'act'].includes(stored) ? stored : 'answer';
|
|
3462
|
+
if (payload.responder !== undefined && !['answer', 'act', 'off'].includes(String(payload.responder))) {
|
|
3454
3463
|
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
3455
3464
|
res.end(
|
|
3456
|
-
JSON.stringify({ error: 'Answering while away must be
|
|
3465
|
+
JSON.stringify({ error: 'Answering while away must be answer or act.' }),
|
|
3457
3466
|
);
|
|
3458
3467
|
return;
|
|
3459
3468
|
}
|
package/scripts/inbox-daemon.mjs
CHANGED
|
@@ -47,7 +47,7 @@ import { incumbent, livingWatchers, lockDir as sharedLockDir, apiBase } from './
|
|
|
47
47
|
// otherwise, so importing it costs nothing and changes nothing.
|
|
48
48
|
import {
|
|
49
49
|
settings as responderSettings, mayRespond, takeLock, releaseLock, heldBy,
|
|
50
|
-
record as recordResponder, readLedger, spawnResponder,
|
|
50
|
+
record as recordResponder, readLedger, spawnResponder, hadItSwitchedOff,
|
|
51
51
|
} from './responder.mjs';
|
|
52
52
|
|
|
53
53
|
const args = process.argv.slice(2);
|
|
@@ -317,7 +317,6 @@ async function tick() {
|
|
|
317
317
|
*/
|
|
318
318
|
async function considerResponding(watched) {
|
|
319
319
|
const config = responderSettings();
|
|
320
|
-
if (config.mode === 'off') return;
|
|
321
320
|
|
|
322
321
|
const now = Date.now();
|
|
323
322
|
const ledger = readLedger();
|
|
@@ -479,6 +478,27 @@ async function pollOne(identity) {
|
|
|
479
478
|
options: m.options,
|
|
480
479
|
created_at: m.created_at,
|
|
481
480
|
urgency: urgency(m.priority),
|
|
481
|
+
/*
|
|
482
|
+
WHO SENT IT, which this dropped on the floor until 2026-08-21.
|
|
483
|
+
|
|
484
|
+
The feed returns `from_key`, `from_handle` and `from_name`; the spool
|
|
485
|
+
record was a fixed field list that did not mention any of them. So the
|
|
486
|
+
responder's peer cooldown -- "one spawn per peer per ten minutes" --
|
|
487
|
+
read `null` for every message and skipped itself entirely, and the
|
|
488
|
+
prompt handed every session "From: another agent" no matter who wrote.
|
|
489
|
+
|
|
490
|
+
Nothing failed. A brake that never engages and a prompt missing a name
|
|
491
|
+
both look exactly like working software from outside, which is why this
|
|
492
|
+
survived twenty-one passing brake tests: they hand-build a message with
|
|
493
|
+
the field already in it.
|
|
494
|
+
|
|
495
|
+
Named `from_recipient_key` here because that is what the responder has
|
|
496
|
+
always read; it also accepts `from_key` now, for spools written before
|
|
497
|
+
this line existed.
|
|
498
|
+
*/
|
|
499
|
+
from_recipient_key: m.from_key ?? null,
|
|
500
|
+
from_handle: m.from_handle ?? null,
|
|
501
|
+
from_name: m.from_name ?? null,
|
|
482
502
|
/*
|
|
483
503
|
WHEN IT LANDED HERE, which is the only clock that can be trusted for
|
|
484
504
|
the measurement this exists for.
|
|
@@ -1117,6 +1137,37 @@ for (const signal of ['SIGTERM', 'SIGINT', 'SIGHUP']) {
|
|
|
1117
1137
|
});
|
|
1118
1138
|
}
|
|
1119
1139
|
|
|
1140
|
+
/**
|
|
1141
|
+
* SAY IT ONCE, to the machines whose decision this reverses.
|
|
1142
|
+
*
|
|
1143
|
+
* `off` was removed, so an install that had explicitly turned answering off is
|
|
1144
|
+
* about to start answering. Everybody else is getting a default; these people
|
|
1145
|
+
* made a choice and an update is undoing it, and the honest minimum is to say
|
|
1146
|
+
* so where they will find it rather than let them discover it from a reply
|
|
1147
|
+
* they did not write.
|
|
1148
|
+
*
|
|
1149
|
+
* Once, not every start: a warning that repeats forever is one people learn to
|
|
1150
|
+
* scroll past, and the marker is what makes "once" true across restarts.
|
|
1151
|
+
*/
|
|
1152
|
+
function announceTheChange() {
|
|
1153
|
+
const flag = join(lockRoot, 'responder-was-off-notice');
|
|
1154
|
+
if (!hadItSwitchedOff() || existsSync(flag)) return;
|
|
1155
|
+
say(
|
|
1156
|
+
'NOTE: answering while you are away used to be off on this machine, and ' +
|
|
1157
|
+
'that setting no longer exists. It is now ANSWERING -- it may read your ' +
|
|
1158
|
+
'inbox, reply and notify, and it may NOT run commands or touch files. ' +
|
|
1159
|
+
'The rate caps, peer cooldown and grace period still apply, and every ' +
|
|
1160
|
+
'decision is written to ~/.agentsignal/responder-ledger.jsonl. To stop ' +
|
|
1161
|
+
'it answering, remove the plugin: there is no longer a setting for it.',
|
|
1162
|
+
);
|
|
1163
|
+
try {
|
|
1164
|
+
writeFileSync(flag, new Date().toISOString(), { mode: 0o600 });
|
|
1165
|
+
} catch {
|
|
1166
|
+
/* said it anyway; worst case it is said again next start */
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
announceTheChange();
|
|
1170
|
+
|
|
1120
1171
|
sweepOldVersions();
|
|
1121
1172
|
|
|
1122
1173
|
const watching = identities();
|
package/scripts/responder.mjs
CHANGED
|
@@ -19,7 +19,11 @@
|
|
|
19
19
|
* day misfire at 4am, and that the person reading the log afterwards will be
|
|
20
20
|
* trying to work out what it did and why.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
22
|
+
* IT IS ON. Not off-unless-asked, which is what this said until 2026-08-21 --
|
|
23
|
+
* a setting nobody found was a feature nobody had. What survives of that
|
|
24
|
+
* caution is the FLOOR: the default may talk and may not touch the machine, so
|
|
25
|
+
* turning the corner from "answers for me" to "acts for me" is still a thing
|
|
26
|
+
* somebody has to choose.
|
|
23
27
|
*
|
|
24
28
|
* The setting lives in ~/.agentsignal/settings.json beside the other answers to
|
|
25
29
|
* "what will this machine do without asking me" -- the agent cap, what new
|
|
@@ -28,13 +32,22 @@
|
|
|
28
32
|
* somebody clicked rather than a line in a shell profile that outlives the
|
|
29
33
|
* decision and gets copied to the next machine.
|
|
30
34
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
35
|
+
* answer (default) may talk: read the inbox, reply, notify. No shell, no
|
|
36
|
+
* files. This is the floor -- there is no longer a setting that
|
|
37
|
+
* answers nothing.
|
|
33
38
|
* act may also do the work: read, search, edit, run commands.
|
|
34
39
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
40
|
+
* `off` WAS REMOVED on 2026-08-21. It had been the default and the kill
|
|
41
|
+
* switch, and both of those went with it: an install that had it off answers
|
|
42
|
+
* after the next update, and the way to stop a responder answering is now to
|
|
43
|
+
* remove the plugin -- which also stops the watcher and message delivery. That
|
|
44
|
+
* was decided knowingly; it is written here because the person reading this
|
|
45
|
+
* after a 4am misfire needs to know that muting it is not among their options.
|
|
46
|
+
*
|
|
47
|
+
* It must never become `act` because somebody updated the plugin: consenting to
|
|
48
|
+
* an agent that runs commands is not the kind of thing that arrives in a patch
|
|
49
|
+
* release. `answer` now does arrive that way, which is the trade that was made
|
|
50
|
+
* -- and the reason the announcement below exists rather than a silent flip.
|
|
38
51
|
*
|
|
39
52
|
* AGENTSIGNAL_RESPONDER still overrides the file, and is for tests and for
|
|
40
53
|
* running one deliberately from a script. It is not the way a person turns this
|
|
@@ -79,7 +92,7 @@ const LOCK = join(ROOT, 'responder.lock');
|
|
|
79
92
|
|
|
80
93
|
/** Defaults chosen to be boring. Every one can be overridden by env. */
|
|
81
94
|
export const DEFAULTS = {
|
|
82
|
-
mode: '
|
|
95
|
+
mode: 'answer',
|
|
83
96
|
gracePeriodMs: 45_000,
|
|
84
97
|
perHour: 6,
|
|
85
98
|
perDay: 30,
|
|
@@ -97,6 +110,22 @@ export function stored(path = join(ROOT, 'settings.json')) {
|
|
|
97
110
|
}
|
|
98
111
|
}
|
|
99
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Whether this machine had answering switched OFF before the setting existed.
|
|
115
|
+
*
|
|
116
|
+
* Worth a function of its own because it is the one group this change is
|
|
117
|
+
* unfair to. Everybody else gets a default; these people made a decision, and
|
|
118
|
+
* an update is about to reverse it. They are told once, plainly, in the log
|
|
119
|
+
* that is the only place a headless daemon can say anything.
|
|
120
|
+
*
|
|
121
|
+
* Reads the raw file rather than `settings()`, which now resolves 'off' to
|
|
122
|
+
* 'answer' and so cannot tell this apart from a fresh install.
|
|
123
|
+
*/
|
|
124
|
+
export function hadItSwitchedOff(file = undefined) {
|
|
125
|
+
const saved = stored(...(file ? [file] : []));
|
|
126
|
+
return typeof saved.responder === 'string' && saved.responder.trim().toLowerCase() === 'off';
|
|
127
|
+
}
|
|
128
|
+
|
|
100
129
|
export function settings(env = process.env, file = undefined) {
|
|
101
130
|
const saved = stored(...(file ? [file] : []));
|
|
102
131
|
const num = (name, key, fallback) => {
|
|
@@ -113,7 +142,17 @@ export function settings(env = process.env, file = undefined) {
|
|
|
113
142
|
.trim()
|
|
114
143
|
.toLowerCase();
|
|
115
144
|
return {
|
|
116
|
-
|
|
145
|
+
/*
|
|
146
|
+
TWO MODES. `off` was removed on 2026-08-21, deliberately and with the
|
|
147
|
+
consequences understood: every install answers now, including ones that
|
|
148
|
+
had it off, and stopping it means removing the plugin.
|
|
149
|
+
|
|
150
|
+
An unrecognised value -- including the literal 'off' left in an older
|
|
151
|
+
settings.json -- resolves to `answer` rather than to silence, because
|
|
152
|
+
silence is no longer a state this can be in. `answer` is the floor: it may
|
|
153
|
+
talk and it may not reach a shell or a file.
|
|
154
|
+
*/
|
|
155
|
+
mode: ['answer', 'act'].includes(mode) ? mode : 'answer',
|
|
117
156
|
gracePeriodMs: num('AGENTSIGNAL_RESPONDER_GRACE_MS', 'responder_grace_ms', DEFAULTS.gracePeriodMs),
|
|
118
157
|
perHour: num('AGENTSIGNAL_RESPONDER_PER_HOUR', 'responder_per_hour', DEFAULTS.perHour),
|
|
119
158
|
perDay: num('AGENTSIGNAL_RESPONDER_PER_DAY', 'responder_per_day', DEFAULTS.perDay),
|
|
@@ -171,8 +210,6 @@ export function mayRespond(message, world) {
|
|
|
171
210
|
now, config, ledger = [], lockHeldBy = null, handled = new Set(),
|
|
172
211
|
} = world;
|
|
173
212
|
|
|
174
|
-
if (config.mode === 'off') return { ok: false, why: 'disabled' };
|
|
175
|
-
|
|
176
213
|
if (message.from_responder) return { ok: false, why: 'chain_depth' };
|
|
177
214
|
|
|
178
215
|
if (handled.has(message.delivery_id)) return { ok: false, why: 'already_handled' };
|
|
@@ -186,6 +223,30 @@ export function mayRespond(message, world) {
|
|
|
186
223
|
}
|
|
187
224
|
|
|
188
225
|
const spawns = ledger.filter((e) => e.event === 'spawn');
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* ONE MESSAGE, ONE SESSION -- and this is the brake that was missing.
|
|
229
|
+
*
|
|
230
|
+
* `handled` is written by the hooks, when a LIVE session puts a message in
|
|
231
|
+
* front of a model. Nothing put a responder's own spawns in it, so a message
|
|
232
|
+
* the responder had already answered still looked untaken on the next cycle,
|
|
233
|
+
* and it answered it again. Measured, before this existed: three sessions
|
|
234
|
+
* for one message inside fifteen seconds, and it would have gone on until
|
|
235
|
+
* the hourly cap.
|
|
236
|
+
*
|
|
237
|
+
* The peer cooldown was supposed to make that impossible and could not: the
|
|
238
|
+
* sender never survived into the spool, so `peer` was null and that whole
|
|
239
|
+
* brake was skipped. Two independent faults, one visible symptom.
|
|
240
|
+
*
|
|
241
|
+
* The ledger is the right place to look because it is the responder's own
|
|
242
|
+
* record with exactly one writer -- adding a second writer to the hooks'
|
|
243
|
+
* file would break the invariant that keeps a message from being lost
|
|
244
|
+
* between them.
|
|
245
|
+
*/
|
|
246
|
+
if (spawns.some((e) => e.delivery_id === message.delivery_id)) {
|
|
247
|
+
return { ok: false, why: 'already_answered' };
|
|
248
|
+
}
|
|
249
|
+
|
|
189
250
|
const lastHour = spawns.filter((e) => now - e.at < 3_600_000).length;
|
|
190
251
|
if (lastHour >= config.perHour) {
|
|
191
252
|
return { ok: false, why: 'hourly_cap', cap: config.perHour };
|
|
@@ -195,7 +256,11 @@ export function mayRespond(message, world) {
|
|
|
195
256
|
return { ok: false, why: 'daily_cap', cap: config.perDay };
|
|
196
257
|
}
|
|
197
258
|
|
|
198
|
-
|
|
259
|
+
// `from_key` is what the server's feed actually calls it. The other two
|
|
260
|
+
// spellings are kept for spools written before this was noticed, and for the
|
|
261
|
+
// hand-built messages in the self-test below -- which is how a field the
|
|
262
|
+
// pipeline never produced went unnoticed in the first place.
|
|
263
|
+
const peer = message.from_recipient_key ?? message.from_key ?? message.from ?? null;
|
|
199
264
|
if (peer) {
|
|
200
265
|
const recent = spawns
|
|
201
266
|
.filter((e) => e.peer === peer)
|
|
@@ -245,14 +310,28 @@ export function promptFor(message, mode) {
|
|
|
245
310
|
return [
|
|
246
311
|
'You are answering one message on behalf of an agent whose human is away.',
|
|
247
312
|
'',
|
|
248
|
-
|
|
313
|
+
/*
|
|
314
|
+
THE ID, because respond_to_message requires one and this session was
|
|
315
|
+
spawned for exactly one message.
|
|
316
|
+
|
|
317
|
+
Its description says to take the id "from read_inbox", which is right for
|
|
318
|
+
an agent reading its own inbox and wrong here: this session already knows
|
|
319
|
+
which message it is answering, and making it go and look introduces the
|
|
320
|
+
one mistake that cannot be detected afterwards. With two messages waiting
|
|
321
|
+
it can answer the wrong one -- and the ledger would still say it answered
|
|
322
|
+
the message it took the lock for, while that message stays unanswered and
|
|
323
|
+
is now blocked by `already_answered` forever.
|
|
324
|
+
*/
|
|
325
|
+
`Delivery id, which is what you answer -- do not go looking for another: ${message.delivery_id}`,
|
|
326
|
+
`From: ${message.from_name ?? message.from_handle ?? message.from_recipient_key ?? message.from_key ?? 'another agent'}`,
|
|
249
327
|
`Title: ${message.title ?? '(none)'}`,
|
|
250
328
|
`Body: ${message.body ?? '(none)'}`,
|
|
251
329
|
message.options?.length
|
|
252
330
|
? `Options, one of which you must pick: ${JSON.stringify(message.options)}`
|
|
253
331
|
: '',
|
|
254
332
|
'',
|
|
255
|
-
'Answer with respond_to_message,
|
|
333
|
+
'Answer with respond_to_message, passing the delivery id above, choosing',
|
|
334
|
+
'one option and writing what you',
|
|
256
335
|
'actually found in the body. The option is what your answer means; the body',
|
|
257
336
|
'is what it says, and up to 4096 characters of it reach the sender.',
|
|
258
337
|
'',
|
|
@@ -290,7 +369,13 @@ export function spawnResponder(message, config, cwd = process.cwd()) {
|
|
|
290
369
|
// ---------------------------------------------------------------------------
|
|
291
370
|
if (process.argv[2] === '--self-test') {
|
|
292
371
|
const failures = [];
|
|
372
|
+
// Counted, not quoted. This printed a hardcoded "21 checks passed" -- a
|
|
373
|
+
// number that stayed 21 while checks were added, and would have stayed 21 if
|
|
374
|
+
// half of them were deleted. A test report that cannot count its own tests is
|
|
375
|
+
// the same kind of thing this whole file exists to avoid.
|
|
376
|
+
let total = 0;
|
|
293
377
|
const check = (what, passed) => {
|
|
378
|
+
total += 1;
|
|
294
379
|
if (!passed) failures.push(what);
|
|
295
380
|
};
|
|
296
381
|
const now = 1_000_000_000;
|
|
@@ -302,8 +387,13 @@ if (process.argv[2] === '--self-test') {
|
|
|
302
387
|
|
|
303
388
|
check('a clean message is allowed', mayRespond(msg, { now, config: base }).ok);
|
|
304
389
|
|
|
305
|
-
|
|
306
|
-
|
|
390
|
+
// There is no mode that refuses everything any more. What replaces that
|
|
391
|
+
// assertion is the FLOOR: whatever a settings file says, the worst case is a
|
|
392
|
+
// session that can talk and cannot touch the machine.
|
|
393
|
+
check('an unrecognised mode answers rather than acting',
|
|
394
|
+
settings({ AGENTSIGNAL_RESPONDER: 'off' }).mode === 'answer');
|
|
395
|
+
check('the floor cannot reach a shell',
|
|
396
|
+
!toolsFor(settings({ AGENTSIGNAL_RESPONDER: 'off' }).mode).includes('Bash'));
|
|
307
397
|
|
|
308
398
|
check('a responder-made message never spawns another',
|
|
309
399
|
mayRespond({ ...msg, from_responder: true }, { now, config: base }).why === 'chain_depth');
|
|
@@ -311,6 +401,29 @@ if (process.argv[2] === '--self-test') {
|
|
|
311
401
|
check('a message a live session took is left alone',
|
|
312
402
|
mayRespond(msg, { now, config: base, handled: new Set(['d1']) }).why === 'already_handled');
|
|
313
403
|
|
|
404
|
+
// The brake that was missing. `handled` only ever holds what the HOOKS put
|
|
405
|
+
// there, so without this the responder re-took its own work every cycle.
|
|
406
|
+
check('a message this responder already answered is not answered again',
|
|
407
|
+
mayRespond(msg, { now, config: base,
|
|
408
|
+
ledger: [{ event: 'spawn', at: now - 1000, delivery_id: 'd1' }] })
|
|
409
|
+
.why === 'already_answered');
|
|
410
|
+
|
|
411
|
+
// And it must not refuse a DIFFERENT message just because one was answered.
|
|
412
|
+
check('another message is still allowed after one was answered',
|
|
413
|
+
mayRespond({ ...msg, delivery_id: 'd2', from_recipient_key: 'u_other' },
|
|
414
|
+
{ now, config: base,
|
|
415
|
+
ledger: [{ event: 'spawn', at: now - 1000, delivery_id: 'd1', peer: 'u_peer' }] })
|
|
416
|
+
.ok === true);
|
|
417
|
+
|
|
418
|
+
// The sender the FEED actually sends, which is spelled differently from the
|
|
419
|
+
// one this file has always read. Getting this wrong disabled peer cooldown
|
|
420
|
+
// entirely and nothing went red.
|
|
421
|
+
check('the peer is found under the name the feed uses',
|
|
422
|
+
mayRespond({ ...msg, from_recipient_key: undefined, from_key: 'u_peer' },
|
|
423
|
+
{ now, config: base,
|
|
424
|
+
ledger: [{ event: 'spawn', at: now - 1000, peer: 'u_peer' }] })
|
|
425
|
+
.why === 'peer_cooldown');
|
|
426
|
+
|
|
314
427
|
check('inside the grace period it waits for a real session',
|
|
315
428
|
mayRespond({ ...msg, spooled_at: new Date(now - 10).toISOString() },
|
|
316
429
|
{ now, config: base }).why === 'within_grace');
|
|
@@ -354,26 +467,38 @@ if (process.argv[2] === '--self-test') {
|
|
|
354
467
|
check('and its numbers are read too', settings({}, file).perHour === 2);
|
|
355
468
|
|
|
356
469
|
fsx.writeFileSync(file, JSON.stringify({ responder: 'sure, why not' }));
|
|
357
|
-
check('a value that is not a mode is
|
|
470
|
+
check('a value that is not a mode is the floor, not act',
|
|
471
|
+
settings({}, file).mode === 'answer');
|
|
472
|
+
|
|
473
|
+
// The group this change is unfair to: they chose off, and the choice is
|
|
474
|
+
// gone. It must resolve to the floor, and it must still be RECOGNISABLE as
|
|
475
|
+
// a machine that had it off, or nothing can tell them.
|
|
476
|
+
fsx.writeFileSync(file, JSON.stringify({ responder: 'off' }));
|
|
477
|
+
check('a machine that had it off now answers', settings({}, file).mode === 'answer');
|
|
478
|
+
check('and is still identifiable as one that had it off', hadItSwitchedOff(file));
|
|
358
479
|
|
|
359
480
|
fsx.writeFileSync(file, JSON.stringify({ responder: 'act' }));
|
|
360
|
-
check('
|
|
361
|
-
|
|
481
|
+
check('a machine that chose act is not mistaken for one that had it off',
|
|
482
|
+
!hadItSwitchedOff(file));
|
|
362
483
|
|
|
363
484
|
fsx.writeFileSync(file, '{ not json');
|
|
364
|
-
check('an unreadable settings file is
|
|
365
|
-
settings({}, file).mode === '
|
|
485
|
+
check('an unreadable settings file is the floor rather than a crash',
|
|
486
|
+
settings({}, file).mode === 'answer');
|
|
366
487
|
}
|
|
367
488
|
|
|
368
489
|
check('answer mode cannot reach a shell', !toolsFor('answer').includes('Bash'));
|
|
369
490
|
check('act mode can', toolsFor('act').includes('Bash'));
|
|
370
|
-
check('an unknown mode is
|
|
371
|
-
|
|
491
|
+
check('an unknown mode is the floor, not act',
|
|
492
|
+
settings({ AGENTSIGNAL_RESPONDER: 'yes' }).mode === 'answer');
|
|
493
|
+
check('unset is the floor, not act', settings({}).mode === 'answer');
|
|
494
|
+
check('nothing resolves to act by accident',
|
|
495
|
+
['', 'off', 'yes', 'ACT '].filter((v) => settings({ AGENTSIGNAL_RESPONDER: v }).mode === 'act')
|
|
496
|
+
.length === 1);
|
|
372
497
|
|
|
373
498
|
if (failures.length) {
|
|
374
499
|
console.error('\nResponder self-test FAILED -- the brakes cannot be trusted:\n');
|
|
375
500
|
for (const f of failures) console.error(` x ${f}`);
|
|
376
501
|
process.exit(1);
|
|
377
502
|
}
|
|
378
|
-
console.log(`Responder self-test: ${
|
|
503
|
+
console.log(`Responder self-test: ${total} checks passed (every brake fails closed).`);
|
|
379
504
|
}
|