@popovych.co/witness 0.24.2 → 0.25.0
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 +15 -1
- package/dist/allowlist.js +77 -0
- package/dist/cli.js +7 -1
- package/dist/criteria.js +5 -5
- package/dist/drive-presence.js +10 -2
- package/dist/drive-report.js +14 -70
- package/dist/drive.js +218 -24
- package/dist/gitio.js +2 -1
- package/dist/harness.js +2 -0
- package/dist/install.js +15 -0
- package/dist/live.js +143 -0
- package/dist/needs-you.js +113 -0
- package/dist/needs.js +1 -1
- package/dist/notify.js +55 -17
- package/dist/progress.js +23 -0
- package/dist/runner.js +5 -2
- package/dist/settle.js +7 -6
- package/dist/spawn.js +1 -1
- package/dist/stamp.js +1 -1
- package/dist/toon.js +12 -0
- package/dist/verbs/check.js +3 -10
- package/dist/verbs/dashboard.js +2 -2
- package/dist/verbs/init.js +1 -0
- package/dist/verbs/next.js +77 -24
- package/dist/verbs/retry.js +62 -0
- package/dist/verbs/trust.js +111 -31
- package/dist/verbs/wait.js +134 -0
- package/dist/worktree.js +3 -2
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/commands/witness.md +15 -4
- package/plugin/hooks/context-core.mjs +100 -0
- package/plugin/hooks/session-dashboard.sh +1 -1
- package/plugin/hooks/witness-pi.ts +117 -2
- package/plugin/skills/witness-brainstorm/SKILL.md +1 -1
- package/plugin/skills/witness-decompose/SKILL.md +1 -1
- package/plugin/skills/witness-design/SKILL.md +1 -1
- package/plugin/skills/witness-implement/SKILL.md +2 -1
- package/plugin/skills/witness-plan/SKILL.md +1 -1
- package/plugin/skills/witness-ship/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -265,7 +265,7 @@ are declared in machine config, not env:
|
|
|
265
265
|
reviewerExtensions:
|
|
266
266
|
- /Users/you/.pi/agent/npm/node_modules/pi-claude-oauth-adapter
|
|
267
267
|
opener: xdg-open # optional; nonstandard desktops only
|
|
268
|
-
notify: /usr/local/bin/ping-me # optional;
|
|
268
|
+
notify: /usr/local/bin/ping-me # optional; each notification's text is its one argument · default: the platform notifier
|
|
269
269
|
```
|
|
270
270
|
|
|
271
271
|
Repo facts live in `witness.config.yaml` (committed); machine facts live in
|
|
@@ -285,6 +285,9 @@ the wrong file refuses. There are no `WITNESS_*` env vars for configuration.
|
|
|
285
285
|
| `check` | schema, graph, invariants, needs, trailer audit, probes |
|
|
286
286
|
| `index` | id · summary · status · depends across the canon, then each spec's plans |
|
|
287
287
|
| `satisfy <id> --need <id\|n\|text>` | journal a manual need as met — the spec is never rewritten |
|
|
288
|
+
| `trust [<id>] [--cmd '<exact command>']… [--yes]` | list every command a target's flow runs (the runner, `ship.test`, `ship.lint`, its spec's `cmd:` criteria, its `cmd:` needs) with its source; `--cmd` grants exactly the named command, `--yes` grants all only at a terminal; no session grants trust · with no id, everything the repo runs |
|
|
289
|
+
| `retry <target>` | ask drive to try a set-aside target again, after a fix that leaves no record of its own (code, a tool, an account); refused inside a session |
|
|
290
|
+
| `wait [--since <token>]` | under autonomy, block until something new needs you, drive stops with work left, a merge lands on GitHub, or a newer chat takes over — the `/witness` chat runs it; journals nothing |
|
|
288
291
|
| `log <id>` | render a journal stream |
|
|
289
292
|
| `gate <decompose\|plan\|implement\|ship\|design> <id>` | run the reviewer gate; journals the round, stamps on pass |
|
|
290
293
|
| `decide <gate> <id> --approve\|--revise [--pin <policy>]` | record the human decision on a stopped gate; `--pin` adds a standing content policy |
|
|
@@ -359,6 +362,17 @@ Operator notes, non-load-bearing — the design depends on none of them:
|
|
|
359
362
|
`drive.caps.spawns` (24). A measured slice on a large window can run past an hour, and on a
|
|
360
363
|
200k window every slice is one step, so a plan takes more sessions; raise either if drive
|
|
361
364
|
times out or caps a plan that is still moving.
|
|
365
|
+
- **Being told, and the waiting chat.** Under autonomy, drive notifies the moment something new
|
|
366
|
+
needs you — a trust grant, a need, a decision, a look, a merge, a stuck target — once per item,
|
|
367
|
+
a burst as one notification, plus once when the run ends. macOS uses `osascript`, Linux
|
|
368
|
+
`notify-send`, Windows a toast through Windows PowerShell 5.1 (no install, no registration);
|
|
369
|
+
`notify:` in `.witness/config.local.yaml` replaces all three. When everything left waits on you,
|
|
370
|
+
drive pauses rather than exits, lets the machine sleep, resumes the moment your act lands, and
|
|
371
|
+
gives up after 12 h with its report. The `/witness` chat sleeps beside it and is woken: on
|
|
372
|
+
Claude Code by `witness wait` in the background, on Pi by witness's add-on (`witness init --agent
|
|
373
|
+
pi` installs it). The chat never restarts a drive that stopped — it says so and waits for your
|
|
374
|
+
"go". After a fix witness cannot see (code, a tool, an account), `witness retry <target>` tells
|
|
375
|
+
drive to try a stuck or capped target again.
|
|
362
376
|
- **Keep the host awake.** A suspend longer than an hour mid-run expires the prompt
|
|
363
377
|
cache; on wake the full agent context is re-written at cache-write price. On macOS:
|
|
364
378
|
`witness drive` holds `caffeinate -ims` for its own lifetime (a closed lid on battery
|
package/dist/allowlist.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { heldCriteria } from './needs.js';
|
|
4
|
+
import { criteriaOwner } from './scan.js';
|
|
5
|
+
import { hasControl, shellArg, visible } from './toon.js';
|
|
4
6
|
const allowPath = (root) => join(root, '.witness', 'allow.json');
|
|
5
7
|
function load(root) {
|
|
6
8
|
if (!existsSync(allowPath(root)))
|
|
@@ -48,6 +50,81 @@ export function untrustedCmdsFor(root, doc) {
|
|
|
48
50
|
const trusted = new Set(load(root));
|
|
49
51
|
return [...new Set(cmds.filter((c) => !trusted.has(c)))];
|
|
50
52
|
}
|
|
53
|
+
// Security review. Every surface that asks the human to trust a command — `next`'s kept stop,
|
|
54
|
+
// drive's report, the chat — renders it here: escaped, beside its source, and with the grant
|
|
55
|
+
// that names it only when the verb would take it (printable ASCII, `witness trust`).
|
|
56
|
+
export const shownCmd = (c) => `${visible(c.cmd)} (${visible(c.source)})`;
|
|
57
|
+
export const grantOf = (target, c) => hasControl(c.cmd)
|
|
58
|
+
? 'never granted here — rewrite it in printable ASCII where it is written'
|
|
59
|
+
: `witness trust ${target} --cmd ${shellArg(c.cmd)}`;
|
|
60
|
+
// The filtered runner template, `ship.test`, `ship.lint`, each when set. Full-suite mode's
|
|
61
|
+
// runner IS `ship.test`, and a command listed twice is listed once, under its first source.
|
|
62
|
+
export function configCommands(cfg) {
|
|
63
|
+
const out = [];
|
|
64
|
+
const add = (cmd, source) => {
|
|
65
|
+
if (cmd !== undefined && cmd !== '' && !out.some((c) => c.cmd === cmd))
|
|
66
|
+
out.push({ cmd, source });
|
|
67
|
+
};
|
|
68
|
+
if (cfg.criteria.runner !== 'full-suite')
|
|
69
|
+
add(cfg.criteria.runner, 'criteria.runner');
|
|
70
|
+
add(cfg.ship.test, 'ship.test');
|
|
71
|
+
add(cfg.ship.lint, 'ship.lint');
|
|
72
|
+
return out;
|
|
73
|
+
}
|
|
74
|
+
const cmdCriteria = (doc) => (Array.isArray(doc.meta.criteria) ? doc.meta.criteria : [])
|
|
75
|
+
.filter((c) => typeof c.cmd === 'string')
|
|
76
|
+
.map((c) => ({ cmd: c.cmd, source: `cmd: ${String(c.id)}` }));
|
|
77
|
+
const cmdNeeds = (doc) => (Array.isArray(doc.meta.needs) ? doc.meta.needs : [])
|
|
78
|
+
.flatMap((n, i) => typeof n.cmd === 'string'
|
|
79
|
+
? [{ cmd: n.cmd, source: `need: ${typeof n.id === 'string' ? n.id : i + 1}` }] : []);
|
|
80
|
+
// Row 205. Every command a target's flow runs: the config commands, the `cmd:` criteria of the
|
|
81
|
+
// doc that owns its criteria (the spec, for a plan, which carries none of its own), and the
|
|
82
|
+
// target's own `cmd:` needs (`start` evaluates a plan's). Held criteria are listed too, so a
|
|
83
|
+
// human may trust one ahead of time.
|
|
84
|
+
export function commandsRun(cfg, canon, doc) {
|
|
85
|
+
const owner = criteriaOwner(canon, String(doc.meta.id)) ?? doc;
|
|
86
|
+
return [...configCommands(cfg), ...cmdCriteria(owner), ...cmdNeeds(doc)];
|
|
87
|
+
}
|
|
88
|
+
// A gate's trust-grant stop carries bare commands (its checks' `untrusted`); the report and the
|
|
89
|
+
// chat name each with its source, read from what the target's flow runs.
|
|
90
|
+
export function sourced(cfg, canon, target, cmds) {
|
|
91
|
+
const doc = canon.docs.find((d) => d.meta.id === target);
|
|
92
|
+
const known = doc !== undefined ? commandsRun(cfg, canon, doc) : configCommands(cfg);
|
|
93
|
+
return cmds.map((cmd) => ({ cmd, source: known.find((c) => c.cmd === cmd)?.source ?? 'gate' }));
|
|
94
|
+
}
|
|
95
|
+
// `witness trust` with no target: everything the repo runs, each doc's commands under its id.
|
|
96
|
+
export function repoCommands(cfg, canon) {
|
|
97
|
+
return [
|
|
98
|
+
...configCommands(cfg).map((c) => ({ ...c, doc: '-' })),
|
|
99
|
+
...canon.docs.flatMap((d) => [...cmdCriteria(d), ...cmdNeeds(d)].map((c) => ({ ...c, doc: String(d.meta.id) }))),
|
|
100
|
+
];
|
|
101
|
+
}
|
|
102
|
+
// Row 205 (issue #56, P5). The commands the routed action's verb runs that this machine does
|
|
103
|
+
// not trust yet, checked before any work: found only inside the session, a refusal journaled
|
|
104
|
+
// nothing, `next` routed the same line again and drive respawned it to the cap. Only the
|
|
105
|
+
// commands with no "no" path — the runner (the template, or ship.test in full-suite) for the
|
|
106
|
+
// evidence verbs and the implement gate; that plus ship.test and ship.lint for ship; a start's
|
|
107
|
+
// own cmd: needs. Never cmd: criteria (row 154): a plain approve leaves them blocked at a
|
|
108
|
+
// headless gate, so trust is never the toll, and a gate whose check failed on one reaches the
|
|
109
|
+
// settle pass's trust-grant stop instead.
|
|
110
|
+
export function trustOwed(root, env, cfg, canon, action) {
|
|
111
|
+
if (env.WITNESS_TRUST_CMDS === '1')
|
|
112
|
+
return [];
|
|
113
|
+
const config = configCommands(cfg);
|
|
114
|
+
const runner = config.filter((c) => c.source === (cfg.criteria.runner === 'full-suite' ? 'ship.test' : 'criteria.runner'));
|
|
115
|
+
const line = `${action.line} `;
|
|
116
|
+
const run = /^witness (test-evidence|verify-red|gate implement|check --drift) /.test(line) ? runner
|
|
117
|
+
: /^witness (ship|gate ship) /.test(line) ? [...runner, ...config.filter((c) => c.source === 'ship.test' || c.source === 'ship.lint')]
|
|
118
|
+
: /^witness start /.test(line) && action.target !== undefined
|
|
119
|
+
? (() => { const doc = canon.docs.find((d) => d.meta.id === action.target); return doc ? cmdNeeds(doc) : []; })()
|
|
120
|
+
: [];
|
|
121
|
+
const trusted = new Set(load(root));
|
|
122
|
+
const out = [];
|
|
123
|
+
for (const c of run)
|
|
124
|
+
if (!trusted.has(c.cmd) && !out.some((o) => o.cmd === c.cmd))
|
|
125
|
+
out.push(c);
|
|
126
|
+
return out;
|
|
127
|
+
}
|
|
51
128
|
export async function ensureTrusted(root, ctx, cmd) {
|
|
52
129
|
if (ctx.env.WITNESS_TRUST_CMDS === '1')
|
|
53
130
|
return 'trusted';
|
package/dist/cli.js
CHANGED
|
@@ -26,6 +26,8 @@ const VERBS = {
|
|
|
26
26
|
check: () => import('./verbs/check.js'),
|
|
27
27
|
index: () => import('./verbs/index-verb.js'),
|
|
28
28
|
satisfy: () => import('./verbs/satisfy.js'),
|
|
29
|
+
// Row 207. A journaled human act that asks drive to try a set-aside target again.
|
|
30
|
+
retry: () => import('./verbs/retry.js'),
|
|
29
31
|
dismiss: () => import('./verbs/dismiss.js'),
|
|
30
32
|
log: () => import('./verbs/log.js'),
|
|
31
33
|
'test-evidence': () => import('./verbs/evidence.js'),
|
|
@@ -48,6 +50,8 @@ const VERBS = {
|
|
|
48
50
|
// D145. The scheduler. `next` names the action; `drive` runs the sessions that perform
|
|
49
51
|
// it, stopping only where a human's judgment is the input.
|
|
50
52
|
drive: () => import('./verbs/drive.js'),
|
|
53
|
+
// Row 204. The chat's sleep: blocks until something new needs the human.
|
|
54
|
+
wait: () => import('./verbs/wait.js'),
|
|
51
55
|
abandon: () => import('./verbs/abandon.js'),
|
|
52
56
|
rename: () => import('./verbs/rename.js'),
|
|
53
57
|
sync: () => import('./verbs/sync.js'),
|
|
@@ -83,6 +87,7 @@ const VERB_USAGE = {
|
|
|
83
87
|
recap: 'witness recap --file <recap.json> [--ask <id>] [--amend]',
|
|
84
88
|
recover: 'witness recover [--complete | --rollback]',
|
|
85
89
|
rename: 'witness rename <old-id> <new-id>',
|
|
90
|
+
retry: 'witness retry <target>',
|
|
86
91
|
satisfy: 'witness satisfy <doc-id> --need <id | index | text>',
|
|
87
92
|
dismiss: 'witness dismiss <artifact> --deferral <id|index> --cause <superseded|lens-retired|judged-wrong> --note "<why>"',
|
|
88
93
|
ship: 'witness ship <plan-id> [--manual]',
|
|
@@ -90,9 +95,10 @@ const VERB_USAGE = {
|
|
|
90
95
|
status: 'witness status — flows · blocked docs · reconcile rows · pending gates (bare `witness` is the same screen)',
|
|
91
96
|
'step-close': 'witness step-close <plan-id> --step <id>',
|
|
92
97
|
sync: 'witness sync',
|
|
93
|
-
trust:
|
|
98
|
+
trust: "witness trust [<artifact-id>] [--cmd '<exact command>']… [--yes]",
|
|
94
99
|
'test-evidence': 'witness test-evidence <plan-id> --phase red|green [--step <id>]',
|
|
95
100
|
'verify-red': 'witness verify-red <plan-id> [--base <ref>] [--step <id>]',
|
|
101
|
+
wait: 'witness wait [--since <token>] — blocks until something new needs you · the chat runs it under autonomy',
|
|
96
102
|
};
|
|
97
103
|
// Row 116 moved the body to version.ts, which journal.ts can import without closing a
|
|
98
104
|
// cycle. Re-exported here because eleven call sites already ask the CLI shell for it and
|
package/dist/criteria.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ensureTrusted } from './allowlist.js';
|
|
1
|
+
import { ensureTrusted, grantOf } from './allowlist.js';
|
|
2
2
|
import { loadConfig } from './config.js';
|
|
3
3
|
import { matchesTag, sourceTags } from './matcher.js';
|
|
4
4
|
import { heldCriteria, satisfyCommand } from './needs.js';
|
|
@@ -89,12 +89,12 @@ export async function runCriteria(runRoot, ctx, doc, opts = {}) {
|
|
|
89
89
|
else if (typeof c.cmd === 'string') {
|
|
90
90
|
const trust = await ensureTrusted(trustRoot, ctx, c.cmd);
|
|
91
91
|
if (trust !== 'trusted') {
|
|
92
|
-
// D154. The block now names the verb that unblocks it
|
|
93
|
-
//
|
|
94
|
-
//
|
|
92
|
+
// D154. The block now names the verb that unblocks it, fully resolved — D147's
|
|
93
|
+
// runnability test, applied where the refusal is a detail string rather than a
|
|
94
|
+
// Violation. Row 205: the grant names the one command, as the human names it.
|
|
95
95
|
criteria.push({
|
|
96
96
|
id: cid, kind: 'cmd', ok: false,
|
|
97
|
-
detail: `untrusted-${trust} —
|
|
97
|
+
detail: `untrusted-${trust} — the human names it: ${grantOf(id, c)} · or WITNESS_TRUST_CMDS=1 for automation`,
|
|
98
98
|
untrusted: c.cmd,
|
|
99
99
|
});
|
|
100
100
|
continue;
|
package/dist/drive-presence.js
CHANGED
|
@@ -2,6 +2,7 @@ import { lstatSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { isAlive, pause, pidOf, releaseIfMine, takeStale } from './lock.js';
|
|
4
4
|
import { ok, refuse, v } from './refusal.js';
|
|
5
|
+
import { shellArg } from './toon.js';
|
|
5
6
|
// Row 180. What a process knows about the drive it runs under. Drive marks every child
|
|
6
7
|
// session with WITNESS_DRIVE=<target>: the marker is the recursion guard (a marked session's
|
|
7
8
|
// `witness drive` refuses) and the child's scope (its `next` answers for that target alone).
|
|
@@ -17,6 +18,15 @@ export function driveChild(env) {
|
|
|
17
18
|
return undefined;
|
|
18
19
|
return { target: marker === TARGETLESS ? undefined : marker };
|
|
19
20
|
}
|
|
21
|
+
// Rows 173 and 207. A session acts for the human only through the chat it answers to: one
|
|
22
|
+
// drive spawned, or a reviewer, never grants trust or un-sticks a target. Names the marker.
|
|
23
|
+
export function sessionMarker(env) {
|
|
24
|
+
if (driveChild(env) !== undefined)
|
|
25
|
+
return DRIVE_ENV;
|
|
26
|
+
if (env.WITNESS_REVIEWER !== undefined && env.WITNESS_REVIEWER !== '')
|
|
27
|
+
return 'WITNESS_REVIEWER';
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
20
30
|
// Row 180. One drive per repo: `.witness/drive.lock` names the live drive's pid and, for a
|
|
21
31
|
// background drive, its log — so a second drive, or `next` under autonomy, can say where to
|
|
22
32
|
// watch the one that runs and how to stop it.
|
|
@@ -95,8 +105,6 @@ export function acquireDriveLock(root, info, pid = process.pid) {
|
|
|
95
105
|
}
|
|
96
106
|
}
|
|
97
107
|
}
|
|
98
|
-
// A path is quoted only when it needs it, so the common line stays the one a human types.
|
|
99
|
-
const shellArg = (p) => /^[\w@%+=:,./-]+$/.test(p) ? p : `'${p.replaceAll("'", "'\\''")}'`;
|
|
100
108
|
// Row 201: `kill` is not a Windows command, and PowerShell's alias ends drive alone.
|
|
101
109
|
export function watchLine(h, platform = process.platform) {
|
|
102
110
|
const stop = platform === 'win32' ? `taskkill /PID ${h.pid} /T /F` : `kill ${h.pid}`;
|
package/dist/drive-report.js
CHANGED
|
@@ -1,84 +1,27 @@
|
|
|
1
1
|
import { basename } from 'node:path';
|
|
2
|
-
import { TARGETLESS } from './drive-presence.js';
|
|
3
|
-
import { handoffLine, resolveDriver } from './harness.js';
|
|
4
2
|
import { readStream, streamIds } from './journal.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { pendingTxn } from './txn.js';
|
|
8
|
-
import { owedDecisions, parkedGates } from './verbs/next.js';
|
|
9
|
-
import { recoverChoice } from './verbs/recover.js';
|
|
3
|
+
import { needsYou, WAIT_KINDS } from './needs-you.js';
|
|
4
|
+
import { loadCanon } from './scan.js';
|
|
10
5
|
export function runStart(root) {
|
|
11
6
|
return { lines: new Map(streamIds(root).map((s) => [s, readStream(root, s).length])) };
|
|
12
7
|
}
|
|
13
8
|
export function entriesSince(root, start) {
|
|
14
9
|
return streamIds(root).flatMap((stream) => readStream(root, stream).slice(start.lines.get(stream) ?? 0).map((entry) => ({ stream, entry })));
|
|
15
10
|
}
|
|
16
|
-
const prOf = (line) => /PR #(\d+)/.exec(line)?.[1];
|
|
17
11
|
// Every `run:` and `then:` line is raw: a command is never kv-escaped (D120).
|
|
18
12
|
export function driveReport(root, ctx, cfg, start, aside, run) {
|
|
19
13
|
const canon = loadCanon(root);
|
|
20
14
|
const since = entriesSince(root, start);
|
|
21
15
|
const merged = since.filter(({ entry }) => entry.t === 'status' && entry.cause === 'merge')
|
|
22
16
|
.map(({ entry }) => `merged: ${String(entry.artifact)} · PR #${String(entry.pr)}`);
|
|
23
|
-
// The waits, each target once, in the order a human answers them
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
for (const a of aside.filter((x) => x.kind === 'kept' && (x.stop === 'design-look' || x.stop === 'trust-grant'))) {
|
|
33
|
-
if (named.has(a.target))
|
|
34
|
-
continue;
|
|
35
|
-
wait(a.target, a.stop === 'design-look'
|
|
36
|
-
? [`wait: design look · ${a.target}`, ` run: witness design ${a.target} --open`, ` then: witness decide design ${a.target} --show`]
|
|
37
|
-
: [`wait: trust grant · ${a.target} · in a terminal · answer each prompt`, ` run: witness gate ${a.gate ?? '<gate>'} ${a.target}`]);
|
|
38
|
-
}
|
|
39
|
-
for (const u of unmetNeeds(canon)) {
|
|
40
|
-
const held = u.type === 'spec' && u.holds.length > 0;
|
|
41
|
-
wait(u.doc, [
|
|
42
|
-
held ? `wait: held criterion · ${u.doc} · ${u.text} holds ${u.holds.join(' · ')}` : `wait: unmet need · ${u.doc} · ${u.text}`,
|
|
43
|
-
` run: ${u.satisfy}`,
|
|
44
|
-
]);
|
|
45
|
-
}
|
|
46
|
-
for (const o of owedDecisions(root, canon)) {
|
|
47
|
-
if (named.has(o.target))
|
|
48
|
-
continue;
|
|
49
|
-
wait(o.target, [`wait: decision · ${o.gate} ${o.target}`, ` run: witness decide ${o.gate} ${o.target} --show`]);
|
|
50
|
-
}
|
|
51
|
-
const driver = resolveDriver(ctx.env, cfg.harness);
|
|
52
|
-
for (const a of aside.filter((x) => x.kind === 'conversation' || x.kind === 'merge')) {
|
|
53
|
-
if (named.has(a.target))
|
|
54
|
-
continue;
|
|
55
|
-
if (a.kind === 'conversation') {
|
|
56
|
-
// Row 196. A target-less conversation is a grill: of a queued ask, or — with nothing
|
|
57
|
-
// queued — of what to build next, which waits on nobody, so it is said and not counted.
|
|
58
|
-
const ask = a.target === TARGETLESS ? / --ask (\S+)/.exec(a.line)?.[1] : undefined;
|
|
59
|
-
if (a.target === TARGETLESS && ask === undefined) {
|
|
60
|
-
waits.push('nothing queued — /witness <what to build> in a chat');
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
const who = a.target === TARGETLESS ? `brainstorm · ask ${ask}` : a.target;
|
|
64
|
-
wait(a.target, [`wait: conversation · ${who}`,
|
|
65
|
-
...(driver.ok ? [` run: ${handoffLine(driver.value.harness, root, undefined)}`] : [])]);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
const pr = prOf(a.line) ?? (findById(canon, a.target)?.meta.pr !== undefined ? String(findById(canon, a.target).meta.pr) : undefined);
|
|
69
|
-
wait(a.target, [`wait: merge · ${a.target}${pr ? ` · PR #${pr}` : ''}`, ...(pr ? [` run: gh pr merge ${pr}`] : [])]);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const parked = parkedGates(root, canon).flatMap((p) => {
|
|
73
|
-
const stopped = readStream(root, p.target)
|
|
74
|
-
.filter((e) => e.t === 'human-decision' && e.gate === p.gate)
|
|
75
|
-
.map((e) => e).filter((d) => d.decision === 'stop').at(-1);
|
|
76
|
-
const why = stopped?.selected === 'policy' && stopped.note ? stopped.note : `parked at ${p.anchor}`;
|
|
77
|
-
return [`parked: ${p.target} · ${p.gate} round ${p.round} — ${why}`, ` run: ${p.reopen}`];
|
|
78
|
-
});
|
|
79
|
-
// A capped target the policy could not park carries no gate (drive.ts): it is stuck too.
|
|
80
|
-
const stuck = aside.filter((a) => a.kind === 'stuck' || (a.kind === 'capped' && a.gate === undefined))
|
|
81
|
-
.map((a) => `stuck: ${a.target} — ${a.why}`);
|
|
17
|
+
// Row 203. The waits, each target once, in the order a human answers them, then the parked
|
|
18
|
+
// gates and the stuck targets: one derivation, read by the notifier and `witness wait` too.
|
|
19
|
+
const items = needsYou(root, ctx, cfg, canon, aside);
|
|
20
|
+
const waiting = items.filter((i) => WAIT_KINDS.has(i.kind));
|
|
21
|
+
const waits = waiting.flatMap((i) => i.rows);
|
|
22
|
+
const parked = items.filter((i) => i.kind === 'parked').flatMap((i) => i.rows);
|
|
23
|
+
const stuckItems = items.filter((i) => i.kind === 'stuck' || i.kind === 'capped');
|
|
24
|
+
const stuck = stuckItems.flatMap((i) => i.rows);
|
|
82
25
|
const obligations = since.filter(({ entry }) => entry.t === 'deferral').map(({ entry }) => {
|
|
83
26
|
const d = entry;
|
|
84
27
|
return `obligation: ${d.id} · ${d.artifact} · ${d.anchor} — ${d.kind}`;
|
|
@@ -93,9 +36,10 @@ export function driveReport(root, ctx, cfg, start, aside, run) {
|
|
|
93
36
|
counts[d.selected ?? 'named'] += 1;
|
|
94
37
|
}
|
|
95
38
|
const m = merged.length;
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
const
|
|
39
|
+
// A crash is one wait whatever it names; a notice waits on nobody.
|
|
40
|
+
const w = new Set(waiting.filter((i) => i.notice !== true).map((i) => i.kind === 'pending-txn' ? '-txn' : i.target)).size;
|
|
41
|
+
const p = items.filter((i) => i.kind === 'parked').length;
|
|
42
|
+
const s = stuckItems.length;
|
|
99
43
|
const tally = `${m} merged · ${w} wait on you · ${p} parked · ${s} stuck`;
|
|
100
44
|
const lines = [
|
|
101
45
|
`drive: ${run.stopped !== undefined ? 'stopped' : 'done'} — ${tally}`,
|