teamsmith 0.4.5 → 0.4.7
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/README.md +6 -6
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +37 -1
- package/skills/teamsmith/SKILL.md +32 -23
- package/skills/teamsmith/extension/team-bg.ts +12 -11
- package/skills/teamsmith/extension/team-inbox-watch.ts +149 -5
- package/skills/teamsmith/extension/team-notify.ts +20 -13
- package/skills/teamsmith/extension/team-remind.ts +189 -0
- package/skills/teamsmith/extension/team-reply.ts +4 -7
- package/skills/teamsmith/references/migration.md +101 -0
- package/skills/teamsmith/references/openspec.md +43 -27
- package/skills/teamsmith/references/protocol.md +28 -18
- package/skills/teamsmith/references/reminders.md +133 -98
- package/skills/teamsmith/references/troubleshooting.md +12 -7
- package/skills/teamsmith/references/workflows.md +85 -34
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +28 -5
- package/skills/teamsmith/scripts/lib/cmd-project.sh +100 -15
- package/skills/teamsmith/scripts/lib/cmd-remind.sh +135 -10
- package/skills/teamsmith/scripts/lib/cmd-review.sh +42 -4
- package/skills/teamsmith/scripts/lib/cmd-update.sh +90 -88
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +322 -159
- package/skills/teamsmith/scripts/lib/common.sh +156 -26
- package/skills/teamsmith/scripts/panel/panel.js +182 -182
- package/skills/teamsmith/scripts/panel/src/data.ts +113 -6
- package/skills/teamsmith/scripts/panel/src/layout.ts +26 -4
- package/skills/teamsmith/scripts/panel/src/main.tsx +103 -14
- package/skills/teamsmith/scripts/remind-capability.mjs +261 -0
- package/skills/teamsmith/scripts/remind-store.mjs +404 -17
- package/skills/teamsmith/scripts/remind-tick.mjs +105 -0
- package/skills/teamsmith/scripts/reminder-delivery.mjs +76 -0
- package/skills/teamsmith/scripts/reply-capture.mjs +8 -9
- package/skills/teamsmith/scripts/state-authority.mjs +334 -20
- package/skills/teamsmith/scripts/strings/commands.tsv +3 -3
- package/skills/teamsmith/scripts/strings/help.en.tsv +12 -12
- package/skills/teamsmith/scripts/strings/help.zh.tsv +12 -12
- package/skills/teamsmith/scripts/team +4 -3
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +13 -11
- package/skills/teamsmith/templates/DECISIONS.md.tmpl +2 -2
- package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +3 -3
- package/skills/teamsmith/templates/PROTOCOL.md.tmpl +19 -14
- package/skills/teamsmith/templates/memory-seed.md.tmpl +2 -2
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +36 -18
- package/skills/teamsmith/templates/report.md.tmpl +33 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +217 -33
- package/skills/teamsmith/tests/bg-ledger.sh +24 -10
- package/skills/teamsmith/tests/checkout-shape-probe.sh +7 -6
- package/skills/teamsmith/tests/death-cause.sh +5 -0
- package/skills/teamsmith/tests/fixtures/remind-adversarial-delay.ts +27 -0
- package/skills/teamsmith/tests/fixtures/remind-tool-provider.ts +65 -0
- package/skills/teamsmith/tests/help-surface.sh +14 -151
- package/skills/teamsmith/tests/isolation-ledger.sh +89 -0
- package/skills/teamsmith/tests/key-replies-ui.sh +53 -0
- package/skills/teamsmith/tests/key-replies.sh +307 -106
- package/skills/teamsmith/tests/lib/main-team-fingerprint.sh +17 -1
- package/skills/teamsmith/tests/lib/routes-pages.sh +243 -0
- package/skills/teamsmith/tests/live-capture-probe.sh +12 -2
- package/skills/teamsmith/tests/loop-inventory.tsv +1 -0
- package/skills/teamsmith/tests/panel-b3-stub.sh +9 -2
- package/skills/teamsmith/tests/pulse-nudge-key.sh +5 -0
- package/skills/teamsmith/tests/remind-adversarial-faults.mjs +163 -0
- package/skills/teamsmith/tests/remind-adversarial-faults.sh +26 -0
- package/skills/teamsmith/tests/remind-adversarial-real.sh +27 -0
- package/skills/teamsmith/tests/remind-cli.sh +108 -3
- package/skills/teamsmith/tests/remind-delivery-node.mjs +189 -0
- package/skills/teamsmith/tests/remind-delivery.sh +699 -0
- package/skills/teamsmith/tests/remind-lifecycle.sh +197 -0
- package/skills/teamsmith/tests/remind-pulse.sh +199 -0
- package/skills/teamsmith/tests/remind-recovery-real.sh +5 -0
- package/skills/teamsmith/tests/remind-recovery-unit.sh +118 -0
- package/skills/teamsmith/tests/remind-tool-node.mjs +159 -0
- package/skills/teamsmith/tests/remind-tool-real.mjs +754 -0
- package/skills/teamsmith/tests/remind-tool-real.sh +5 -0
- package/skills/teamsmith/tests/reply-capture-real.mjs +93 -2
- package/skills/teamsmith/tests/routes.sh +213 -293
- package/skills/teamsmith/tests/section-paths.tsv +14 -12
- package/skills/teamsmith/tests/smoke.sh +876 -130
- package/skills/teamsmith/tests/state-authority.sh +392 -28
- package/skills/teamsmith/tests/team-inbox-watch-harness.mjs +58 -8
- package/skills/teamsmith/tests/tmux-identity-leak.sh +12 -16
- package/skills/teamsmith-init/SKILL.md +5 -5
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/__pycache__/judge-second.cpython-313.pyc +0 -0
|
@@ -16,15 +16,21 @@
|
|
|
16
16
|
//
|
|
17
17
|
// A missing flock, a lock timeout, a corrupt/unsupported snapshot, a torn file or an identity mismatch
|
|
18
18
|
// is a visible error. There is no unlocked fallback and an unreadable snapshot is never replaced by an
|
|
19
|
-
// empty store.
|
|
20
|
-
//
|
|
19
|
+
// empty store. Task 1.3 moved every Standby reader/writer here: the snapshot's `standby` slot is the only
|
|
20
|
+
// truth, and the legacy `<state>/standby` marker is read once by the migration (see importLegacy) and then
|
|
21
|
+
// retired to `<state>/standby.migrated` -- the snapshot is published before the marker is retired, so a
|
|
22
|
+
// crash in between replays only the retirement (`migrated` makes the import exactly-once).
|
|
23
|
+
//
|
|
24
|
+
// Reads are pure: they never publish a snapshot and never take part in the migration (the panel and the
|
|
25
|
+
// monitor are display paths and must not write). Until the first write, a read answers from the legacy
|
|
26
|
+
// marker exactly as the old readers did, so an upgrading team is never mistaken for "not on standby".
|
|
21
27
|
|
|
22
28
|
import * as fs from 'node:fs';
|
|
23
29
|
import path from 'node:path';
|
|
24
30
|
import { randomUUID } from 'node:crypto';
|
|
25
31
|
import { spawn, spawnSync } from 'node:child_process';
|
|
26
32
|
import { fileURLToPath } from 'node:url';
|
|
27
|
-
import { REMIND_OPS, applyReminder, renderRemind, validateReminders } from './remind-store.mjs';
|
|
33
|
+
import { REMIND_OPS, applyReminder, peekReminders, renderRemind, validateReminders } from './remind-store.mjs';
|
|
28
34
|
|
|
29
35
|
const SELF = fileURLToPath(import.meta.url);
|
|
30
36
|
const SNAPSHOT_VERSION = 1;
|
|
@@ -34,9 +40,39 @@ const LOCK_WAIT_SECONDS = 5;
|
|
|
34
40
|
const LOCK_CONFLICT_EXIT = 75;
|
|
35
41
|
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
36
42
|
const SEQUENCE_KINDS = new Set(['reminder', 'batch', 'queue']);
|
|
43
|
+
// Standby operations. A read is answered from the snapshot and never publishes one; the other three are
|
|
44
|
+
// mutations and run the legacy import first, in the same locked transaction.
|
|
45
|
+
const STANDBY_OPS = new Set(['standby-read', 'standby-on', 'standby-off', 'standby-import']);
|
|
46
|
+
const STANDBY_READ_OPS = new Set(['read', 'standby-read']);
|
|
37
47
|
|
|
38
48
|
const fail = message => { throw new Error(message); };
|
|
39
49
|
|
|
50
|
+
// One resolver feeds `team paths`, `team doctor` and every real transaction. Returning an absolute
|
|
51
|
+
// executable also makes the spawn below use exactly the binary that the diagnostics displayed.
|
|
52
|
+
export function flockResolution(env = process.env) {
|
|
53
|
+
const pathValue = env.PATH ?? '/usr/bin:/bin';
|
|
54
|
+
let candidate = null;
|
|
55
|
+
for (const entry of pathValue.split(':')) {
|
|
56
|
+
const file = path.resolve(entry || '.', 'flock');
|
|
57
|
+
try {
|
|
58
|
+
const stat = fs.statSync(file);
|
|
59
|
+
candidate ??= file;
|
|
60
|
+
fs.accessSync(file, fs.constants.X_OK);
|
|
61
|
+
if (stat.isFile()) return { status: 'ok', runner: file, candidate: file, detail: '' };
|
|
62
|
+
} catch { /* remember the first unusable match and keep looking for a usable one */ }
|
|
63
|
+
}
|
|
64
|
+
return candidate
|
|
65
|
+
? { status: 'unusable', runner: '', candidate, detail: 'not an executable regular file' }
|
|
66
|
+
: { status: 'missing', runner: '', candidate: '', detail: 'no executable flock on PATH' };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function flockUnavailable(resolution) {
|
|
70
|
+
const repair = 'install util-linux (which provides flock), or put an executable flock on PATH; no unlocked fallback';
|
|
71
|
+
return resolution.status === 'unusable'
|
|
72
|
+
? `flock unavailable: ${resolution.candidate} is not an executable regular file; fix its permissions or ${repair}`
|
|
73
|
+
: `flock unavailable: no executable flock on PATH; ${repair}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
40
76
|
// The project a working directory belongs to -- the same git rule as common.sh's team_dir_roots, so a
|
|
41
77
|
// Node caller (Pulse, Pi) cannot be talked out of its own project by an inherited variable.
|
|
42
78
|
function projectOf(cwd) {
|
|
@@ -201,15 +237,94 @@ function initial(locator) {
|
|
|
201
237
|
project: { id: locator.projectId, mainRoot: locator.mainRoot, stateRoot: locator.stateRoot },
|
|
202
238
|
sequences: { reminder: 1, batch: 1, queue: 1 },
|
|
203
239
|
pruned: 0,
|
|
204
|
-
//
|
|
205
|
-
//
|
|
206
|
-
standby: { on: false, generation: 0, reason: null, since: null },
|
|
240
|
+
// `migrated` records that the legacy marker has been imported (or proven absent): an old snapshot
|
|
241
|
+
// without the key is unmigrated, and the next mutation imports the marker before it does anything.
|
|
242
|
+
standby: { on: false, generation: 0, reason: null, since: null, migrated: false },
|
|
243
|
+
pulse: null,
|
|
207
244
|
reminders: [],
|
|
208
245
|
batches: [],
|
|
209
246
|
audit: [],
|
|
210
247
|
};
|
|
211
248
|
}
|
|
212
249
|
|
|
250
|
+
// ---------------------------------------------------------------- 待命(PM 主动停工)
|
|
251
|
+
// The legacy marker is one line: `<timestamp> <reason>` (the old writer printed `-` when it had no reason).
|
|
252
|
+
// It is only consulted while the snapshot says `migrated: false`, i.e. before the import has run.
|
|
253
|
+
const legacyMarkerFile = state => path.join(state, 'standby');
|
|
254
|
+
|
|
255
|
+
function legacyMarker(state) {
|
|
256
|
+
const file = legacyMarkerFile(state);
|
|
257
|
+
let stat;
|
|
258
|
+
try { stat = fs.lstatSync(file); } catch (e) { if (e.code === 'ENOENT') return null; throw e; }
|
|
259
|
+
// A symlink or a directory here is not the old format: refuse it instead of importing a guess.
|
|
260
|
+
if (!stat.isFile()) fail(`legacy Standby marker is not a regular file: ${file}; move it aside and retry`);
|
|
261
|
+
const line = fs.readFileSync(file, 'utf8').split('\n', 1)[0];
|
|
262
|
+
const cut = line.indexOf(' ');
|
|
263
|
+
const since = cut === -1 ? line : line.slice(0, cut);
|
|
264
|
+
if (!since) fail(`legacy Standby marker is empty: ${file}; delete it if the team was not on standby`);
|
|
265
|
+
const reason = cut === -1 ? '-' : line.slice(cut + 1);
|
|
266
|
+
return { reason: reason === '' ? '-' : reason, since };
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Import once, inside the caller's transaction: the reason and the start time survive, and the generation
|
|
270
|
+
// is kept as it is -- the import is not a new on generation (a later `standby on` is). A marker that is
|
|
271
|
+
// still there after a completed import is leftover evidence, not truth: it is only retired, never adopted.
|
|
272
|
+
function importLegacy(snapshot, state) {
|
|
273
|
+
const marker = legacyMarker(state);
|
|
274
|
+
let imported = false;
|
|
275
|
+
if (!snapshot.standby.migrated) {
|
|
276
|
+
snapshot.standby = {
|
|
277
|
+
on: marker ? true : snapshot.standby.on,
|
|
278
|
+
generation: snapshot.standby.generation,
|
|
279
|
+
reason: marker ? marker.reason : snapshot.standby.reason,
|
|
280
|
+
since: marker ? marker.since : snapshot.standby.since,
|
|
281
|
+
migrated: true,
|
|
282
|
+
};
|
|
283
|
+
imported = Boolean(marker);
|
|
284
|
+
}
|
|
285
|
+
return { imported, marker: Boolean(marker) };
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// The snapshot is already durable when this runs, so a failure here cannot lose the state: the marker is
|
|
289
|
+
// inert from now on. Say so instead of reporting the whole write as failed (the caller would retry, and a
|
|
290
|
+
// retried `standby on` is a new generation).
|
|
291
|
+
function retireLegacy(state) {
|
|
292
|
+
const file = legacyMarkerFile(state);
|
|
293
|
+
if (!regular_exists(file)) return null;
|
|
294
|
+
let target = path.join(state, 'standby.migrated');
|
|
295
|
+
for (let n = 1; exists(target); n++) target = path.join(state, `standby.migrated.${n}`);
|
|
296
|
+
try {
|
|
297
|
+
fs.renameSync(file, target);
|
|
298
|
+
fsyncDir(state);
|
|
299
|
+
return target;
|
|
300
|
+
} catch (e) {
|
|
301
|
+
process.stderr.write(`state-authority: imported ${file} but could not retire it (${e.code ?? e.message}); ` +
|
|
302
|
+
'it is no longer read, remove it by hand\n');
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// What readers see. While the import has not run, the marker is still the record (an upgrading team must
|
|
308
|
+
// not read as "off"); afterwards only the snapshot counts, even if a stale marker is still on disk.
|
|
309
|
+
function standbyView(snapshot, state) {
|
|
310
|
+
if (snapshot.standby.migrated) return { ...snapshot.standby, legacy: false };
|
|
311
|
+
const marker = legacyMarker(state);
|
|
312
|
+
if (!marker) return { ...snapshot.standby, legacy: false };
|
|
313
|
+
return { on: true, generation: snapshot.standby.generation, reason: marker.reason, since: marker.since, legacy: true };
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function standbyResult(snapshot, state, extra) {
|
|
317
|
+
const view = standbyView(snapshot, state);
|
|
318
|
+
return {
|
|
319
|
+
ok: true, on: view.on, generation: view.generation, reason: view.reason, since: view.since,
|
|
320
|
+
migrated: Boolean(snapshot.standby.migrated), legacy: Boolean(view.legacy), ...extra,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function isoSeconds(ms) {
|
|
325
|
+
return new Date(ms).toISOString().replace(/\.\d{3}Z$/, 'Z');
|
|
326
|
+
}
|
|
327
|
+
|
|
213
328
|
function validate(snapshot, main, state) {
|
|
214
329
|
const where = snapshotFile(state);
|
|
215
330
|
if (!snapshot || typeof snapshot !== 'object' || Array.isArray(snapshot)) fail(`invalid state snapshot ${where}: not an object`);
|
|
@@ -230,6 +345,8 @@ function validate(snapshot, main, state) {
|
|
|
230
345
|
}
|
|
231
346
|
if (standby.reason !== null && typeof standby.reason !== 'string') fail(`invalid state snapshot ${where}: invalid Standby reason`);
|
|
232
347
|
if (standby.since !== null && typeof standby.since !== 'string') fail(`invalid state snapshot ${where}: invalid Standby timestamp`);
|
|
348
|
+
// Absent means "not imported yet" (a snapshot written by 1.1/1.2); anything but a boolean is corrupt.
|
|
349
|
+
if (standby.migrated !== undefined && typeof standby.migrated !== 'boolean') fail(`invalid state snapshot ${where}: invalid Standby migration flag`);
|
|
233
350
|
for (const key of ['reminders', 'batches', 'audit']) {
|
|
234
351
|
if (!Array.isArray(snapshot[key])) fail(`invalid state snapshot ${where}: ${key} is not an array`);
|
|
235
352
|
}
|
|
@@ -253,19 +370,43 @@ function summary(snapshot, created) {
|
|
|
253
370
|
stateRoot: snapshot.project.stateRoot,
|
|
254
371
|
sequences: { ...snapshot.sequences },
|
|
255
372
|
pruned: snapshot.pruned,
|
|
256
|
-
standby: { ...snapshot.standby },
|
|
373
|
+
standby: { ...snapshot.standby, migrated: Boolean(snapshot.standby.migrated) },
|
|
257
374
|
counts: { reminders: snapshot.reminders.length, batches: snapshot.batches.length, audit: snapshot.audit.length },
|
|
258
375
|
snapshot: snapshotFile(snapshot.project.stateRoot),
|
|
259
376
|
};
|
|
260
377
|
}
|
|
261
378
|
|
|
262
|
-
function apply(snapshot, request, nowMs) {
|
|
379
|
+
function apply(snapshot, request, nowMs, state) {
|
|
263
380
|
if (REMIND_OPS.has(request.op)) return applyReminder(snapshot, request, nowMs);
|
|
264
381
|
switch (request.op) {
|
|
265
382
|
case 'init':
|
|
266
383
|
return summary(snapshot, true);
|
|
267
384
|
case 'read':
|
|
268
385
|
return summary(snapshot, false);
|
|
386
|
+
case 'standby-read':
|
|
387
|
+
return standbyResult(snapshot, state);
|
|
388
|
+
case 'standby-import':
|
|
389
|
+
return standbyResult(snapshot, state);
|
|
390
|
+
case 'standby-on': {
|
|
391
|
+
// Every `on` is a new, never-reused generation (an already-on team that is told to stand down again
|
|
392
|
+
// gets one too): a wake binds a generation, and reusing one would let a stale binding turn off a
|
|
393
|
+
// newer stand-down.
|
|
394
|
+
snapshot.standby = {
|
|
395
|
+
on: true,
|
|
396
|
+
generation: snapshot.standby.generation + 1,
|
|
397
|
+
reason: typeof request.reason === 'string' ? request.reason : '-',
|
|
398
|
+
since: isoSeconds(nowMs),
|
|
399
|
+
migrated: true,
|
|
400
|
+
};
|
|
401
|
+
return standbyResult(snapshot, state);
|
|
402
|
+
}
|
|
403
|
+
case 'standby-off': {
|
|
404
|
+
// Already off is not an error and not a transition: nothing changes, so nothing is written.
|
|
405
|
+
if (snapshot.standby.on) {
|
|
406
|
+
snapshot.standby = { on: false, generation: snapshot.standby.generation, reason: null, since: isoSeconds(nowMs), migrated: true };
|
|
407
|
+
}
|
|
408
|
+
return standbyResult(snapshot, state);
|
|
409
|
+
}
|
|
269
410
|
case 'allocate': {
|
|
270
411
|
const kind = request.kind;
|
|
271
412
|
if (!SEQUENCE_KINDS.has(kind)) fail(`unknown state sequence kind: ${kind}`);
|
|
@@ -297,25 +438,37 @@ function transaction(main, state, request) {
|
|
|
297
438
|
if (request.op === 'read') fail(`state authority is not initialized: ${file}`);
|
|
298
439
|
snapshot = initial(locator);
|
|
299
440
|
validate(snapshot, main, state);
|
|
441
|
+
// A display path (panel banner, monitor, `standby status`) must not create anything: answer from the
|
|
442
|
+
// legacy marker -- or "off" -- and let the first write publish the snapshot.
|
|
443
|
+
if (STANDBY_READ_OPS.has(request.op)) return apply(snapshot, request, Date.now(), state);
|
|
300
444
|
}
|
|
301
445
|
const before = JSON.stringify(snapshot);
|
|
302
|
-
|
|
446
|
+
// Every mutation imports the legacy marker first, inside this same transaction, so no write can land on
|
|
447
|
+
// a half-upgraded team. Reads never import: they only *view* the marker (see standbyView).
|
|
448
|
+
const migration = STANDBY_READ_OPS.has(request.op) ? { imported: false, marker: false } : importLegacy(snapshot, state);
|
|
449
|
+
const result = apply(snapshot, request, Date.now(), state);
|
|
303
450
|
// A reminder result reports its own `created` (an idempotent key hit is created:false); every other
|
|
304
451
|
// operation keeps the authority-level meaning: was this the first snapshot?
|
|
305
|
-
if (!REMIND_OPS.has(request.op)) result.created = !hasSnapshot;
|
|
452
|
+
if (!REMIND_OPS.has(request.op) && !STANDBY_OPS.has(request.op)) result.created = !hasSnapshot;
|
|
306
453
|
const changed = JSON.stringify(snapshot) !== before;
|
|
307
454
|
// A first `init` does not mutate the object, but the fresh snapshot must still be published. A read
|
|
308
455
|
// (list/show, a refused cancel) never publishes one: reading an empty authority stays a read.
|
|
309
456
|
if (changed || (!hasSnapshot && request.op === 'init')) writeAtomic(file, snapshot);
|
|
457
|
+
// Publish first, retire second: the snapshot already records `migrated`, so a crash in between only
|
|
458
|
+
// replays the retirement instead of importing a second time.
|
|
459
|
+
const retired = migration.marker ? retireLegacy(state) : null;
|
|
460
|
+
if (request.op === 'standby-import') { result.imported = migration.imported; result.retired = retired; }
|
|
310
461
|
return result;
|
|
311
462
|
}
|
|
312
463
|
|
|
313
464
|
function flock(lock, args, input) {
|
|
314
465
|
return new Promise((resolve, reject) => {
|
|
315
466
|
const startedAt = Date.now();
|
|
316
|
-
const
|
|
467
|
+
const resolution = flockResolution();
|
|
468
|
+
if (!resolution.runner) { reject(new Error(flockUnavailable(resolution))); return; }
|
|
469
|
+
const child = spawn(resolution.runner, ['-x', '-w', String(LOCK_WAIT_SECONDS), '-E', String(LOCK_CONFLICT_EXIT), lock,
|
|
317
470
|
process.execPath, SELF, ...args],
|
|
318
|
-
{ stdio: [input === undefined ? 'ignore' : 'pipe', 'pipe', 'pipe'] });
|
|
471
|
+
{ stdio: [input === undefined ? 'ignore' : 'pipe', 'pipe', 'pipe'], env: { ...process.env, LC_ALL: 'C' } });
|
|
319
472
|
const out = [];
|
|
320
473
|
const err = [];
|
|
321
474
|
child.stdout.on('data', chunk => out.push(chunk));
|
|
@@ -325,6 +478,10 @@ function flock(lock, args, input) {
|
|
|
325
478
|
child.on('close', (code, signal) => {
|
|
326
479
|
const stderr = Buffer.concat(err).toString().trim();
|
|
327
480
|
if (code !== 0) {
|
|
481
|
+
if (/^flock:/m.test(stderr)) {
|
|
482
|
+
return reject(new Error(`exclusive flock failed at ${lock}: ${stderr}; ` +
|
|
483
|
+
'check that this filesystem supports exclusive locks; no state was written and there is no unlocked fallback'));
|
|
484
|
+
}
|
|
328
485
|
if (stderr) return reject(new Error(stderr));
|
|
329
486
|
// Only a conflict exit that actually used up the window is a timeout. Anything else (a helper
|
|
330
487
|
// killed or crashed mid-transaction) is reported as what it is, with its status.
|
|
@@ -339,6 +496,34 @@ function flock(lock, args, input) {
|
|
|
339
496
|
});
|
|
340
497
|
}
|
|
341
498
|
|
|
499
|
+
// A whole-snapshot read WITHOUT the lock (the caller's "is there anything to commit right now" probe).
|
|
500
|
+
// Renames are atomic, so an unlocked reader sees either the previous or the next snapshot, never half of
|
|
501
|
+
// one; nothing here writes, publishes or decides -- every decision still runs inside `request()`.
|
|
502
|
+
export async function peek(context) {
|
|
503
|
+
const main = authorityIdentity(context);
|
|
504
|
+
const want = canonical(context.stateRoot);
|
|
505
|
+
const pinned = readLocator(main);
|
|
506
|
+
if (!pinned) {
|
|
507
|
+
return { pinned: false, mainRoot: main, stateRoot: want, reminders: { due: [], queued: [], staleIntent: [] }, outstanding: null };
|
|
508
|
+
}
|
|
509
|
+
if (pinned.stateRoot !== want) {
|
|
510
|
+
fail(`canonical state-root mismatch: pinned ${pinned.stateRoot}, requested ${want}; ` +
|
|
511
|
+
'quiesce the writers and migrate the locator explicitly (never pick a second authority)');
|
|
512
|
+
}
|
|
513
|
+
const file = snapshotFile(pinned.stateRoot);
|
|
514
|
+
if (!snapshotPresence(file)) {
|
|
515
|
+
return { pinned: true, mainRoot: main, stateRoot: pinned.stateRoot, reminders: { due: [], queued: [], staleIntent: [] }, outstanding: null };
|
|
516
|
+
}
|
|
517
|
+
const snapshot = readJSON(file);
|
|
518
|
+
validate(snapshot, main, pinned.stateRoot);
|
|
519
|
+
const pending = snapshot.batches.find(batch => batch.phase === 'intent' || batch.phase === 'unknown') ?? null;
|
|
520
|
+
return {
|
|
521
|
+
pinned: true, mainRoot: main, stateRoot: pinned.stateRoot, projectId: snapshot.project.id,
|
|
522
|
+
reminders: peekReminders(snapshot, Date.now()),
|
|
523
|
+
outstanding: pending ? { id: pending.id, phase: pending.phase } : null,
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
|
|
342
527
|
async function resolveAuthority(context) {
|
|
343
528
|
const main = authorityIdentity(context);
|
|
344
529
|
const want = canonical(context.stateRoot);
|
|
@@ -353,6 +538,7 @@ async function resolveAuthority(context) {
|
|
|
353
538
|
|
|
354
539
|
// The single Node-facing entry point (the CLI below is a thin wrapper around it).
|
|
355
540
|
export async function request(context, requestData) {
|
|
541
|
+
if (requestData.op === 'standby-read') return readStandby(context);
|
|
356
542
|
const located = await resolveAuthority(context);
|
|
357
543
|
const state = located.stateRoot;
|
|
358
544
|
try { fs.mkdirSync(remindersDir(state), { recursive: true, mode: 0o700 }); }
|
|
@@ -360,6 +546,35 @@ export async function request(context, requestData) {
|
|
|
360
546
|
return flock(authorityLock(state), ['--transaction', located.mainRoot, state], JSON.stringify(requestData));
|
|
361
547
|
}
|
|
362
548
|
|
|
549
|
+
// A read must establish nothing: it never creates the locator and never publishes a snapshot. Two reasons:
|
|
550
|
+
// the panel and the monitor are display paths (they must not write), and a caller that merely names another
|
|
551
|
+
// TEAM_STATE_DIR must not capture the project's pin from under it. Which record answers the read is the
|
|
552
|
+
// same decision the migration makes: an unpinned project is still described by the legacy marker.
|
|
553
|
+
function unfiledStandby(state) {
|
|
554
|
+
const marker = legacyMarker(state);
|
|
555
|
+
return marker
|
|
556
|
+
? { ok: true, on: true, generation: 0, reason: marker.reason, since: marker.since, migrated: false, legacy: true }
|
|
557
|
+
: { ok: true, on: false, generation: 0, reason: null, since: null, migrated: false, legacy: false };
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
async function readStandby(context) {
|
|
561
|
+
const main = authorityIdentity(context);
|
|
562
|
+
const state = canonical(context.stateRoot);
|
|
563
|
+
const pinned = readLocator(main);
|
|
564
|
+
if (!pinned) {
|
|
565
|
+
if (snapshotPresence(snapshotFile(state))) {
|
|
566
|
+
fail(`state authority is not pinned for ${main} (${locatorFile(main)} is missing) but ${snapshotFile(state)} exists; ` +
|
|
567
|
+
'refusing to answer from an unpinned snapshot');
|
|
568
|
+
}
|
|
569
|
+
return unfiledStandby(state);
|
|
570
|
+
}
|
|
571
|
+
if (pinned.stateRoot !== state) {
|
|
572
|
+
fail(`canonical state-root mismatch: pinned ${pinned.stateRoot}, requested ${state}; ` +
|
|
573
|
+
'quiesce the writers and migrate the locator explicitly (never pick a second authority)');
|
|
574
|
+
}
|
|
575
|
+
return flock(authorityLock(state), ['--transaction', main, state], JSON.stringify({ op: 'standby-read' }));
|
|
576
|
+
}
|
|
577
|
+
|
|
363
578
|
export async function resolve(context) {
|
|
364
579
|
return resolveAuthority(context);
|
|
365
580
|
}
|
|
@@ -368,7 +583,9 @@ function parseCli(argv) {
|
|
|
368
583
|
const [main, state, op, ...rest] = argv;
|
|
369
584
|
if (!main || !state || !op) {
|
|
370
585
|
fail('usage: state-authority.mjs --cli <project-root> <state-root> ' +
|
|
371
|
-
'<resolve|init|read|allocate <kind>|
|
|
586
|
+
'<resolve|init|read|allocate <kind>|standby-read|standby-on|standby-off|standby-import|' +
|
|
587
|
+
'remind-add|remind-list|remind-show|remind-cancel|remind-admit|remind-intent|' +
|
|
588
|
+
'remind-observe|remind-fail|remind-resolve> ' +
|
|
372
589
|
'[--print <field>] [--json]');
|
|
373
590
|
}
|
|
374
591
|
let print = null;
|
|
@@ -393,9 +610,24 @@ function parseCli(argv) {
|
|
|
393
610
|
flags[name] = value;
|
|
394
611
|
continue;
|
|
395
612
|
}
|
|
613
|
+
// Standby takes exactly one flag (`--reason` on `standby-on`); anything else is refused by name, so a
|
|
614
|
+
// typo cannot pass for a successful stand-down.
|
|
615
|
+
if (STANDBY_OPS.has(op) && token.startsWith('--')) {
|
|
616
|
+
const name = token.slice(2);
|
|
617
|
+
if (name === 'json') { json = true; continue; }
|
|
618
|
+
if (op === 'standby-on' && name === 'reason') {
|
|
619
|
+
const value = rest.shift();
|
|
620
|
+
if (value === undefined) fail('--reason needs a value');
|
|
621
|
+
flags.reason = value;
|
|
622
|
+
continue;
|
|
623
|
+
}
|
|
624
|
+
fail(`${op} does not accept --${name}`);
|
|
625
|
+
}
|
|
396
626
|
args.push(token);
|
|
397
627
|
}
|
|
398
|
-
const requestData = REMIND_OPS.has(op) ? parseRemindFlags(op, flags)
|
|
628
|
+
const requestData = REMIND_OPS.has(op) ? parseRemindFlags(op, flags)
|
|
629
|
+
: STANDBY_OPS.has(op) ? (op === 'standby-on' ? { op, reason: flags.reason ?? '-' } : { op })
|
|
630
|
+
: { op };
|
|
399
631
|
if (op === 'allocate') {
|
|
400
632
|
requestData.kind = args.shift();
|
|
401
633
|
if (!requestData.kind) fail('allocate needs a sequence kind (reminder|batch|queue)');
|
|
@@ -405,15 +637,30 @@ function parseCli(argv) {
|
|
|
405
637
|
}
|
|
406
638
|
|
|
407
639
|
// Boolean reminder flags (everything else takes a value).
|
|
408
|
-
const REMIND_BOOL_FLAGS = { 'remind-list': new Set(['all']) };
|
|
640
|
+
const REMIND_BOOL_FLAGS = { 'remind-list': new Set(['all']), 'remind-resolve': new Set(['ack-unknown']) };
|
|
409
641
|
|
|
410
642
|
// Exactly the flags each reminder operation accepts: an unknown flag is refused here rather than silently
|
|
411
|
-
// ignored, so a typo cannot look like a successful create.
|
|
643
|
+
// ignored, so a typo cannot look like a successful create or a successful delivery step.
|
|
412
644
|
const REMIND_FLAGS = {
|
|
413
645
|
'remind-add': new Set(['at', 'after', 'key', 'task', 'source']),
|
|
414
646
|
'remind-list': new Set(['all']),
|
|
415
647
|
'remind-show': new Set(['id']),
|
|
416
648
|
'remind-cancel': new Set(['id']),
|
|
649
|
+
'remind-admit': new Set(['pulse-started']),
|
|
650
|
+
'remind-intent': new Set(['session', 'pid']),
|
|
651
|
+
'remind-observe': new Set(['id', 'nonce', 'session', 'members']),
|
|
652
|
+
'remind-fail': new Set(['id', 'nonce', 'reason']),
|
|
653
|
+
'remind-resolve': new Set(['id', 'ack-unknown']),
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
// The kebab-case command line is mapped to the transaction's field names in one place: the transaction
|
|
657
|
+
// never sees a flag it did not ask for, and a missing required field is refused by name.
|
|
658
|
+
const REMIND_FIELD = { 'pulse-started': 'pulseStartedAt', 'ack-unknown': 'ack' };
|
|
659
|
+
const REMIND_REQUIRED = {
|
|
660
|
+
'remind-intent': ['session'],
|
|
661
|
+
'remind-observe': ['id', 'nonce', 'session', 'members'],
|
|
662
|
+
'remind-fail': ['id', 'nonce'],
|
|
663
|
+
'remind-resolve': ['id'],
|
|
417
664
|
};
|
|
418
665
|
|
|
419
666
|
function parseRemindFlags(op, flags) {
|
|
@@ -421,9 +668,29 @@ function parseRemindFlags(op, flags) {
|
|
|
421
668
|
const request = { op };
|
|
422
669
|
for (const name of Object.keys(flags)) {
|
|
423
670
|
if (!allowed.has(name)) fail(`${op} does not accept --${name}`);
|
|
424
|
-
request[name] = flags[name];
|
|
671
|
+
request[REMIND_FIELD[name] ?? name] = flags[name];
|
|
672
|
+
}
|
|
673
|
+
if (op === 'remind-observe' && request.members !== undefined) {
|
|
674
|
+
try {
|
|
675
|
+
const parsed = JSON.parse(String(request.members));
|
|
676
|
+
request.members = Array.isArray(parsed)
|
|
677
|
+
? parsed.map(member => typeof member === 'string' ? member : String(member?.id ?? ''))
|
|
678
|
+
: null;
|
|
679
|
+
} catch { request.members = null; }
|
|
680
|
+
if (!request.members) fail('remind-observe --members must be a JSON array of the frozen Reminder ids');
|
|
681
|
+
}
|
|
682
|
+
for (const name of REMIND_REQUIRED[op] ?? []) {
|
|
683
|
+
const field = REMIND_FIELD[name] ?? name;
|
|
684
|
+
if (request[field] === undefined || request[field] === '' || request[field] === null) fail(`${op} needs --${name}`);
|
|
685
|
+
}
|
|
686
|
+
if (op === 'remind-intent' && request.pid !== undefined) {
|
|
687
|
+
const pid = Number(request.pid);
|
|
688
|
+
if (!Number.isSafeInteger(pid) || pid < 1) fail('remind-intent --pid must be a process id');
|
|
689
|
+
request.pid = pid;
|
|
690
|
+
}
|
|
691
|
+
if (op === 'remind-resolve' && request.ack !== true) {
|
|
692
|
+
fail('remind-resolve requires --ack-unknown: acknowledging an unknown batch closes it and burns its one automatic-off right');
|
|
425
693
|
}
|
|
426
|
-
if ((op === 'remind-show' || op === 'remind-cancel') && !request.id) fail(`${op} needs --id <reminder-id>`);
|
|
427
694
|
return request;
|
|
428
695
|
}
|
|
429
696
|
|
|
@@ -440,8 +707,50 @@ async function readMessageFromStdin() {
|
|
|
440
707
|
return { message: text };
|
|
441
708
|
}
|
|
442
709
|
|
|
710
|
+
// Standby is rendered here (not in the shell) so a reason keeps every byte it was given: the shell only
|
|
711
|
+
// prints these lines, and `--print <field>` stays the machine interface.
|
|
712
|
+
function renderStandby(op, result) {
|
|
713
|
+
const status = result.on
|
|
714
|
+
? `standby: on(自 ${result.since ?? '-'},原因:${result.reason ?? '-'})`
|
|
715
|
+
: 'standby: off';
|
|
716
|
+
if (op !== 'standby-import') {
|
|
717
|
+
// Until the import runs, the marker is still the record: say so once, where a human reads it.
|
|
718
|
+
return result.legacy ? `${status}\n(旧标记还没并入统一状态:跑 team standby migrate 完成迁移)` : status;
|
|
719
|
+
}
|
|
720
|
+
if (result.imported) {
|
|
721
|
+
return `${status}\n迁移:state/standby 已并入统一状态(原因与时间保留,代次仍是 ${result.generation}:迁移不加代);` +
|
|
722
|
+
`旧标记改名为 ${result.retired ?? '(改名失败,已不再被读取)'}`;
|
|
723
|
+
}
|
|
724
|
+
if (result.retired) return `${status}\n迁移:统一状态早已并入;这次清掉了残留的旧标记(改名为 ${result.retired})`;
|
|
725
|
+
return `${status}\n迁移:无需迁移(统一状态已记录待命${result.on ? '开启' : '关闭'})`;
|
|
726
|
+
}
|
|
727
|
+
|
|
443
728
|
async function main(argv) {
|
|
444
729
|
const [mode, ...rest] = argv;
|
|
730
|
+
if (mode === '--flock-check') {
|
|
731
|
+
const result = flockResolution();
|
|
732
|
+
const fields = [result.status, result.runner || result.candidate, result.detail]
|
|
733
|
+
.map(value => String(value).replace(/[\t\r\n]/g, ' '));
|
|
734
|
+
process.stdout.write(fields.join('\t') + '\n');
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
if (mode === '--flock-lock-check') {
|
|
738
|
+
const [mainRoot, stateRoot] = rest;
|
|
739
|
+
if (!mainRoot || !stateRoot) fail('usage: state-authority.mjs --flock-lock-check <project-root> <state-root>');
|
|
740
|
+
const main = authorityIdentity({ cwd: mainRoot, mainRoot, stateRoot });
|
|
741
|
+
const pinned = readLocator(main);
|
|
742
|
+
if (!pinned) fail(`state authority is not initialized for ${main}; there is no authority lock to probe`);
|
|
743
|
+
const located = agree(pinned, main, canonical(stateRoot));
|
|
744
|
+
const lock = authorityLock(located.stateRoot);
|
|
745
|
+
if (!regular_exists(lock)) fail(`authority lock does not exist yet: ${lock}`);
|
|
746
|
+
const result = await flock(lock, ['--lock-probe']);
|
|
747
|
+
process.stdout.write(JSON.stringify(result) + '\n');
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
if (mode === '--lock-probe') {
|
|
751
|
+
process.stdout.write(JSON.stringify({ ok: true }) + '\n');
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
445
754
|
if (mode === '--locator') {
|
|
446
755
|
const [main, requested] = rest;
|
|
447
756
|
verifyLockFile(locatorLock(main));
|
|
@@ -464,7 +773,8 @@ async function main(argv) {
|
|
|
464
773
|
if (requestData.op === 'remind-add') {
|
|
465
774
|
const message = await readMessageFromStdin();
|
|
466
775
|
if (message.error) {
|
|
467
|
-
|
|
776
|
+
const refusal = { ok: false, refusal: 'bad-message', reason: message.error };
|
|
777
|
+
process.stdout.write(json ? JSON.stringify(refusal, null, 2) + '\n' : renderRemind(requestData.op, refusal));
|
|
468
778
|
process.exitCode = 1;
|
|
469
779
|
return;
|
|
470
780
|
}
|
|
@@ -482,13 +792,17 @@ async function main(argv) {
|
|
|
482
792
|
if (!Object.hasOwn(result, print)) fail(`unknown output field: ${print}`);
|
|
483
793
|
if (result[print] === null || typeof result[print] === 'object') fail(`output field ${print} is not scalar`);
|
|
484
794
|
process.stdout.write(String(result[print]) + '\n');
|
|
795
|
+
} else if (STANDBY_OPS.has(requestData.op) && !json) {
|
|
796
|
+
process.stdout.write(renderStandby(requestData.op, result) + '\n');
|
|
485
797
|
} else {
|
|
486
798
|
process.stdout.write(JSON.stringify(result, null, 2) + '\n');
|
|
487
799
|
}
|
|
488
800
|
return;
|
|
489
801
|
}
|
|
490
802
|
fail('usage: state-authority.mjs --cli <project-root> <state-root> ' +
|
|
491
|
-
'<resolve|init|read|allocate <kind>|
|
|
803
|
+
'<resolve|init|read|allocate <kind>|standby-read|standby-on|standby-off|standby-import|' +
|
|
804
|
+
'remind-add|remind-list|remind-show|remind-cancel|remind-admit|remind-intent|' +
|
|
805
|
+
'remind-observe|remind-fail|remind-resolve> [--print <field>] [--json]');
|
|
492
806
|
}
|
|
493
807
|
|
|
494
808
|
if (process.argv[1] && path.resolve(process.argv[1]) === SELF) {
|
|
@@ -67,8 +67,8 @@ cmd reply seats reply list ;; reply show <slug> ;; reply post --from <sender> --
|
|
|
67
67
|
cmd pulse patrol pulse up|down|restart|status|logs [--print] --print up down restart status logs watchdog watchdog-status install-watchdog uninstall-watchdog pm pulse knock - starts-process none not-reversible:the window that was started is gone once it stops - pulse team pulse status
|
|
68
68
|
cmd monitor patrol monitor [--once] [--print|--json] [--width <N>] [--height <N>] [--interval <N>] [--events <K>] [--no-pulse] --once --print --json --width --height --interval --events --no-pulse - - pulse state writes-state none not-reversible:every run appends its own bookkeeping line - monitor team monitor --print --once
|
|
69
69
|
cmd watch patrol watch [--once] [--interval <N>] [--ui] --once --interval --ui - - pulse state writes-state none not-reversible:every tick appends to the patrol log - watch team watch --once
|
|
70
|
-
cmd standby patrol standby on [--reason <text>] ;; standby off ;; standby status --reason on off status - pm pulse state writes-state none not-reversible:the state it writes is a record of when it was set - standby team standby on --reason "waiting for the user"
|
|
71
|
-
cmd remind patrol remind add --after <duration> --message <text> [--key <id>] [--task <ref>] [--json] ;; remind add --at <date-time> --message-file <file> [--key <id>] [--task <ref>] [--json] ;; remind list [--all] [--json] ;; remind show <id> [--json] ;; remind cancel <id> [--json] --after --at --message --message-file --key --task --all --json add list show cancel - pm pulse state writes-state none not-reversible:a reminder is a record: cancel marks it cancelled and the history stays - remind team remind add --after 20m --message "check the build"
|
|
70
|
+
cmd standby patrol standby on [--reason <text>] ;; standby off ;; standby status ;; standby migrate --reason on off status migrate - pm pulse state writes-state none not-reversible:the state it writes is a record of when it was set - standby team standby on --reason "waiting for the user"
|
|
71
|
+
cmd remind patrol remind add --after <duration> --message <text> [--key <id>] [--task <ref>] [--json] ;; remind add --at <date-time> --message-file <file> [--key <id>] [--task <ref>] [--json] ;; remind list [--all] [--json] ;; remind show <id> [--json] ;; remind cancel <id> [--json] ;; remind resolve <batch-id> --ack-unknown [--json] --after --at --message --message-file --key --task --all --json --ack-unknown add list show cancel resolve - pm pulse state writes-state none not-reversible:a reminder is a record: cancel marks it cancelled and the history stays - remind team remind add --after 20m --message "check the build"
|
|
72
72
|
cmd up patrol up [--agents] [--fresh-pm] [--print] --agents --fresh-pm --print - - pm seat state starts-process none not-reversible:the PM session it starts keeps its own history - up team up
|
|
73
73
|
cmd resume patrol resume [--agent <a>] [--all] [--dry-run] --agent --all --dry-run - - seat pm state starts-process none not-reversible:a resumed seat continues in its own session - resume team resume --all
|
|
74
74
|
cmd meeting peers meeting open <slug> --with <peer> --topic <text> [--ttl <hours>] [--yes] ;; meeting say <slug> --intent <intent> <message> [--knock] ;; meeting read <slug> [--since <n>] [--peek] ;; meeting list [--all] ;; meeting inbox ;; meeting agree <slug> <option> [--note <text>] ;; meeting close <slug> --with --topic --ttl --yes --intent --knock --since --peek --all --note open say read list inbox agree close propose peer knock help - pm meetings writes-meetings needs-yes:TEAM_CONFIRM_WRITES not-reversible:the shared transcript is the record of what was said - meeting team meeting open rename --with other:pm --topic "rename the interface"
|
|
@@ -81,7 +81,7 @@ cmd merge finish merge - - - ledger - read-only none idempotent - merge team mer
|
|
|
81
81
|
cmd pr finish pr - - - ledger - read-only none idempotent - pr team pr
|
|
82
82
|
cmd gh finish gh - - - ledger - read-only none idempotent - gh team gh
|
|
83
83
|
cmd gl finish gl - - - ledger - read-only none idempotent - gl team gl
|
|
84
|
-
cmd mark-loaded versions mark-loaded
|
|
84
|
+
cmd mark-loaded versions mark-loaded - - - gate - read-only none idempotent - mark-loaded team mark-loaded
|
|
85
85
|
cmd version versions version [--check] --check - - gate - read-only none idempotent - version team version --check
|
|
86
86
|
cmd changelog versions changelog [--since <X>] --since - - - - read-only none idempotent - changelog team changelog
|
|
87
87
|
cmd reload versions reload [--done] --done - - gate state writes-state none not-reversible:every request leaves its own record - reload team reload
|
|
@@ -349,7 +349,7 @@ cmd.watch.arg.--once run a single tick and exit.
|
|
|
349
349
|
cmd.watch.arg.--interval repeat every this many seconds instead of running once.
|
|
350
350
|
cmd.watch.arg.--ui show the interactive panel instead of the text output.
|
|
351
351
|
cmd.standby.title tell the patrol that no one is needed
|
|
352
|
-
cmd.standby.what Records that the PM stands down: the patrol stops waking it, while everything that arrives is still written to the patrol log. A human turns it back on, so an agent cannot silently wake itself up again.
|
|
352
|
+
cmd.standby.what Records that the PM stands down: the patrol stops waking it, while everything that arrives is still written to the patrol log. A human turns it back on, so an agent cannot silently wake itself up again. `standby migrate` carries a stand-down recorded by an older version into the current record; running it twice changes nothing.
|
|
353
353
|
cmd.standby.when Use it when the work is blocked on a person, or when the backlog should wait for a human rather than for the PM.
|
|
354
354
|
cmd.standby.example team standby on --reason "waiting for the user to pick an interface"
|
|
355
355
|
cmd.standby.read the state directory and the patrol log
|
|
@@ -357,7 +357,7 @@ cmd.standby.write the state directory
|
|
|
357
357
|
cmd.standby.see `team pulse`, `team digest`
|
|
358
358
|
cmd.standby.arg.--reason why the PM is standing down; it is written down so the next session knows.
|
|
359
359
|
cmd.remind.title record a one-shot reminder for this project
|
|
360
|
-
cmd.remind.what Records a reminder for the project PM in the same versioned project state as the rest of teamsmith: its full text, when it is due and who created it. `list` prints what is waiting and when it is due, `show` prints one record in full, `cancel` stops a reminder that has not been frozen
|
|
360
|
+
cmd.remind.what Records a reminder for the project PM in the same versioned project state as the rest of teamsmith: its full text, when it is due and who created it. `list` prints what is waiting and when it is due, `show` prints one record in full, `cancel` stops a reminder that has not been frozen into a batch, and `resolve` acknowledges a whole batch whose delivery cannot be proven (it needs an explicit `--ack-unknown` and never resends). The patrol queues a reminder when it comes due and the PM session receives it as one complete message; Standby is left once, and only by an actual wake. Every status you see is derived from that one record on each read, never a second copy.
|
|
361
361
|
cmd.remind.when Use it to park something for a later time instead of holding a session open or retrying from memory.
|
|
362
362
|
cmd.remind.example team remind add --after 20m --message "check the build"
|
|
363
363
|
cmd.remind.read the project state snapshot and the state-root locator
|
|
@@ -371,6 +371,7 @@ cmd.remind.arg.--key a name for this logical reminder. While a live reminder hol
|
|
|
371
371
|
cmd.remind.arg.--task the task or brief this reminder belongs to, so the record says what it is about.
|
|
372
372
|
cmd.remind.arg.--all also print the reminders that already ended (the retained history), newest first.
|
|
373
373
|
cmd.remind.arg.--json print the record(s) as JSON instead of the table.
|
|
374
|
+
cmd.remind.arg.--ack-unknown acknowledge that this batch cannot be proven delivered: close every member, burn its one automatic Standby exit and do not resend. Without it `resolve` is refused.
|
|
374
375
|
cmd.up.title build the stage and start the PM
|
|
375
376
|
cmd.up.what Creates the project's session and windows if they are missing and starts the PM in its own window, continuing the project's previous conversation unless a fresh one is asked for. It starts the PM only; the seats are not touched.
|
|
376
377
|
cmd.up.when Use it after a restart, or when the session was lost and the team should keep working in the same project.
|
|
@@ -483,21 +484,20 @@ cmd.gl.example team gl
|
|
|
483
484
|
cmd.gl.read nothing
|
|
484
485
|
cmd.gl.write nothing
|
|
485
486
|
cmd.gl.see `team gh`, `team pr`
|
|
486
|
-
cmd.mark-loaded.title
|
|
487
|
-
cmd.mark-loaded.what
|
|
488
|
-
cmd.mark-loaded.when
|
|
489
|
-
cmd.mark-loaded.example team mark-loaded
|
|
490
|
-
cmd.mark-loaded.read
|
|
491
|
-
cmd.mark-loaded.write
|
|
492
|
-
cmd.mark-loaded.see `team version`, `team
|
|
493
|
-
cmd.mark-loaded.arg.--version record this version instead of the one found on disk.
|
|
487
|
+
cmd.mark-loaded.title the removed version record
|
|
488
|
+
cmd.mark-loaded.what This name used to write down which skill version the session had loaded. The record was only ever written by hand, so it went stale, and the staleness it reported was usually wrong. It is now refused, and the same question is answered from facts the tool already has.
|
|
489
|
+
cmd.mark-loaded.when Run it only to read the replacement: the PM process start time compared with the newest skill file mtime.
|
|
490
|
+
cmd.mark-loaded.example team mark-loaded
|
|
491
|
+
cmd.mark-loaded.read nothing
|
|
492
|
+
cmd.mark-loaded.write nothing
|
|
493
|
+
cmd.mark-loaded.see `team version --check`, `team doctor`
|
|
494
494
|
cmd.version.title which version is on disk, in the skill and in this session
|
|
495
495
|
cmd.version.what Prints the version of the installed skill, the version written in the skill file, the changelog's head and the version this session loaded. With the check argument it gives a verdict instead of a list.
|
|
496
496
|
cmd.version.when Use it when a command behaves differently from what this session's skill describes, or at the start of a long session.
|
|
497
497
|
cmd.version.example team version --check
|
|
498
498
|
cmd.version.read the installed skill, the changelog and the session record
|
|
499
499
|
cmd.version.write nothing
|
|
500
|
-
cmd.version.see `team changelog`, `team reload
|
|
500
|
+
cmd.version.see `team changelog`, `team reload`
|
|
501
501
|
cmd.version.arg.--check answer whether this session's skill is current instead of printing every version.
|
|
502
502
|
cmd.changelog.title what changed in the skill
|
|
503
503
|
cmd.changelog.what Prints the skill's change history, newest first, optionally only what came after a given version.
|
|
@@ -513,5 +513,5 @@ cmd.reload.when Use it after the skill was upgraded, when you want the current s
|
|
|
513
513
|
cmd.reload.example team reload
|
|
514
514
|
cmd.reload.read the reload request record
|
|
515
515
|
cmd.reload.write the reload request record
|
|
516
|
-
cmd.reload.see `team version
|
|
516
|
+
cmd.reload.see `team version`
|
|
517
517
|
cmd.reload.arg.--done mark the request as handled, after the reload really happened.
|