@popovych.co/witness 0.26.2 → 0.28.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.
Files changed (46) hide show
  1. package/README.md +9 -4
  2. package/dist/battery.js +2 -1
  3. package/dist/cli.js +22 -2
  4. package/dist/contain.js +132 -0
  5. package/dist/deferral.js +5 -4
  6. package/dist/design.js +534 -1
  7. package/dist/drift.js +2 -1
  8. package/dist/drive-presence.js +5 -0
  9. package/dist/drive.js +24 -8
  10. package/dist/gate.js +155 -46
  11. package/dist/gates/decompose.js +1 -0
  12. package/dist/gates/design.js +6 -9
  13. package/dist/gates/implement.js +3 -0
  14. package/dist/gates/plan.js +1 -0
  15. package/dist/gates/ship.js +1 -0
  16. package/dist/harness.js +13 -4
  17. package/dist/review.js +74 -0
  18. package/dist/reviewer.js +12 -3
  19. package/dist/rounds.js +7 -2
  20. package/dist/runner-lock.js +12 -0
  21. package/dist/runner.js +40 -5
  22. package/dist/spawn.js +1 -1
  23. package/dist/verbs/next.js +1 -1
  24. package/dist/verbs/read.js +5 -1
  25. package/dist/verbs/review.js +127 -0
  26. package/dist/verbs/turn.js +46 -0
  27. package/package.json +1 -1
  28. package/plugin/.claude-plugin/plugin.json +1 -1
  29. package/plugin/commands/witness.md +4 -2
  30. package/plugin/hooks/session-dashboard.sh +3 -1
  31. package/plugin/skills/witness-brainstorm/SKILL.md +1 -1
  32. package/plugin/skills/witness-decompose/SKILL.md +1 -1
  33. package/plugin/skills/witness-design/SKILL.md +20 -5
  34. package/plugin/skills/witness-implement/SKILL.md +5 -3
  35. package/plugin/skills/witness-plan/SKILL.md +2 -2
  36. package/plugin/skills/witness-ship/SKILL.md +4 -2
  37. package/prompts/arbiter.md +1 -1
  38. package/prompts/code-reviewer.md +4 -2
  39. package/prompts/design-critic.md +8 -4
  40. package/prompts/design-reviewer.md +4 -2
  41. package/prompts/drift-reviewer.md +5 -3
  42. package/prompts/plan-critic.md +5 -3
  43. package/prompts/pr-test.md +4 -2
  44. package/prompts/silent-failure-hunter.md +4 -2
  45. package/prompts/slicing-critic.md +5 -3
  46. package/prompts/type-design.md +4 -2
package/README.md CHANGED
@@ -239,8 +239,11 @@ plain-words question per turn with up to three ranked answers, the repo explored
239
239
  draft after every settled answer, so a dead session resumes. Design shows up to three rendered,
240
240
  checked directions on one page before it asks which.
241
241
 
242
- **`drive`.** `drive.parallelSuites: false` makes test runs in two worktrees take turns, because
243
- suites that boot servers or browsers collide. A target that reaches any `drive.caps.*` bound is
242
+ **`drive`.** `drive.parallelSuites: false` makes test runs in two worktrees take turns — witness's
243
+ own and every `witness turn`, which is how a session runs its tests — because suites that boot
244
+ servers or browsers collide. On Windows each session, test run and gate reviewer runs in a job
245
+ object, so whatever it starts — detached, or orphaned by an installer that exited — ends with it;
246
+ elsewhere a session's process group does. A target that reaches any `drive.caps.*` bound is
244
247
  parked.
245
248
 
246
249
  ### Upgrading
@@ -255,7 +258,7 @@ an older file keeps working: witness reads it as `migrate` would, changes nothin
255
258
  There is no `provider:` key. `witness gate` spawns the DECLARED harness's headless
256
259
  mode for every reviewer (Decisions 88, 105): claude-code renders bare Anthropic ids, pi
257
260
  renders `provider/model[:thinking]` with the provider witness knows it needs. The pi
258
- reviewer runs hermetic (`--no-extensions --no-skills --no-context-files`); machine
261
+ reviewer runs hermetic (`--no-extensions --no-skills --no-context-files`); claude's runs with `--safe-mode` (no hooks, `CLAUDE.md`, plugins or MCP servers) and saves no session; every reviewer gets no tools, or read-only file tools where it must open files, and witness refuses any verb but read, index, log and diff inside one; machine
259
262
  extensions it must keep — e.g. an OAuth adapter that supplies your Anthropic auth —
260
263
  are declared in machine config, not env:
261
264
 
@@ -280,7 +283,7 @@ the wrong file refuses. There are no `WITNESS_*` env vars for configuration.
280
283
  | `draft <key> [--file <json>]` | a grill's or design session's local draft — saved after every settled answer, read back to resume; never committed or journaled |
281
284
  | `write <id> --effort <e> --meta <json> --body <md>` | validated manifest → spec/plan on disk + journal entry; a spec's `covers` and `carries` map it to the recap's goals and decisions |
282
285
  | `diff <spec-id>` | delta since the last realized state (plan pin → empty), and the decisions that moved since that plan |
283
- | `read <id> [--design] [--outline] [--lines <a>-<b>] [--decisions]` | print a spec/plan/design from the primary root — the read route, since a worktree carries no canon copy; `--outline` names each anchor's line range for fat artifacts; `--decisions` prints the decisions a spec carries with its effort's constraints and non-goals, or an effort's whole recap |
286
+ | `read <id> [--design] [--outline] [--lines <a>-<b>] [--decisions]` | print a spec/plan/design from the primary root — the read route, since a worktree carries no canon copy; `--outline` names each anchor's line range for fat artifacts, and for a look its controls and hidden states; `--decisions` prints the decisions a spec carries with its effort's constraints and non-goals, or an effort's whole recap |
284
287
  | `check` | schema, graph, invariants, needs, trailer audit, probes |
285
288
  | `index` | id · summary · status · depends across the canon, then each spec's plans |
286
289
  | `satisfy <id> --need <id\|n\|text>` | journal a manual need as met — the spec is never rewritten |
@@ -291,11 +294,13 @@ the wrong file refuses. There are no `WITNESS_*` env vars for configuration.
291
294
  | `gate <decompose\|plan\|implement\|ship\|design> <id>` | run the reviewer gate; journals the round, stamps on pass |
292
295
  | `decide <gate> <id> --approve\|--revise [--pin <policy>]` | record the human decision on a stopped gate; `--pin` adds a standing content policy |
293
296
  | `design <spec-id> --file <html>\|--open\|--reconfirm\|--preview <html>` | register/show a `ui` spec's approved look; `--preview` opens a page and records nothing |
297
+ | `review design <spec-id> [--file <html>]` | the design gate's reviewers on a look — the registered one, or a page not yet registered — asking the gate's full-review question; journals nothing, decides nothing, and replays the gate's answer when the gate already judged the same bytes in full |
294
298
  | `start <plan-id>` | create/re-attach the plan's worktree (`.witness/worktrees/<id>`) — code only: the canon dirs are excluded from it, so a plan cannot go stale in there |
295
299
  | `next` | the one next action across every effort |
296
300
  | `drive [--flow <plan-id>] [--max-spawns <n>] [--manual] [--detach]` | runs every session itself · under autonomy it needs no terminal and reports when nothing else can move. Up to `drive.parallel` targets at once, one session per target; usage limits are waited out; a target past a cap is parked. `--detach` (autonomy only) runs it in the background into `.witness/drive.log` — each session's start, every command and file its agent touches, every act it journals for its flow, a `still running` line after 5 quiet minutes, and how it ended; drive's pi sessions are kept in pi's session store under `witness-drive/`; `--manual` runs serially and asks you at every stop. One drive per repo. A session drive spawned is refused — agents are what drive spawns, never what spawns drive |
297
301
  | `ship <plan-id> [--manual]` | lanes → ship gate → PR → CI watch → under autonomy: merge on green · `--manual` keeps that run's stop and merge for a human |
298
302
  | `test-evidence <plan-id> --phase red\|green [--step <id>]` / `verify-red <plan-id> [--base <ref>] [--step <id>]` | journal red/green criteria evidence from a worktree; `--step` names the plan step the cycle closes — required before the plan's first implement gate (on a plan with a criteria step), left off for a fix round after it. A green that closes a step prints `context:`, `steps:` and `slice:` |
303
+ | `turn -- <command> [args…]` | run one command in the repo's test turn — it waits while another worktree's test run holds it, unless `drive.parallelSuites: true` — and on Windows inside a job object, so whatever it starts ends with it; exits with the command's code · the implement and ship skills run every test a session runs itself through it |
299
304
  | `step-close <plan-id> --step <id>` | close a scaffolding step, which has no red→green to witness; prints `context:`, `steps:` and `slice:` as a closing green does, and closing it again changes nothing |
300
305
  | `adopt <path>` | absolve a finished hand-edit into the journal |
301
306
  | `abandon <plan-id \| effort-slug…>` | wind a plan/effort down; reverts only specs that effort itself wrote — several efforts go as one act, so a split or an amendment they share goes back together |
package/dist/battery.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SESSION_DEFAULT } from './model.js';
2
2
  import { ok, refuse } from './refusal.js';
3
- import { invokeReviewerAsync, parseVerdictText } from './reviewer.js';
3
+ import { invokeReviewerAsync, parseVerdictText, toolsFor } from './reviewer.js';
4
4
  import { parseVerdict, verdictViolations } from './verdict.js';
5
5
  // Row 169, amended by row 212: every lens is asked on the stage's one model, and a lens that
6
6
  // cannot be invoked refuses at once — there is no stand-in to fall back to.
@@ -10,6 +10,7 @@ async function runLens(ctx, harness, model, lens, opts) {
10
10
  for (let attempt = 0;; attempt++) {
11
11
  const r = await invokeReviewerAsync(ctx, harness, {
12
12
  ...opts, prompt, model: model === SESSION_DEFAULT ? undefined : model, lens: lens.name,
13
+ tools: toolsFor(lens.reviewed), // row 217: read-only file tools only for content named by path
13
14
  });
14
15
  if (!r.ok)
15
16
  return refuse(r.violations);
package/dist/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { configPath } from './config.js';
3
3
  import { journalStamp } from './context.js';
4
+ import { isReviewer } from './drive-presence.js';
4
5
  import { stateFloor } from './floor.js';
5
6
  import { primaryRoot } from './gitio.js';
6
7
  import { withJournalCtx } from './journal.js';
@@ -31,6 +32,8 @@ const VERBS = {
31
32
  dismiss: () => import('./verbs/dismiss.js'),
32
33
  log: () => import('./verbs/log.js'),
33
34
  'test-evidence': () => import('./verbs/evidence.js'),
35
+ // Row 218. A session's own test run, in the repo's test turn and, on Windows, a job.
36
+ turn: () => import('./verbs/turn.js'),
34
37
  'verify-red': () => import('./verbs/evidence.js').then((m) => ({ run: m.runVerifyRed })),
35
38
  'dispatch-report': () => import('./verbs/dispatch.js'),
36
39
  // Row 191 §4.3. The close of a scaffolding step, the one plan step with no evidence to witness.
@@ -39,6 +42,8 @@ const VERBS = {
39
42
  gate: () => import('./verbs/gate.js'),
40
43
  decide: () => import('./verbs/decide.js'),
41
44
  design: () => import('./verbs/design.js'),
45
+ // Row 215. The design gate's reviewers on demand: the gate's question, journaled nowhere.
46
+ review: () => import('./verbs/review.js'),
42
47
  start: () => import('./verbs/start.js'),
43
48
  // The orientation screen has a name (D101). Bare `witness` stays as its alias, but
44
49
  // an unnamed command cannot be referenced — commands/witness.md instructs the
@@ -86,6 +91,7 @@ const VERB_USAGE = {
86
91
  recover: 'witness recover [--complete | --rollback]',
87
92
  rename: 'witness rename <old-id> <new-id>',
88
93
  retry: 'witness retry <target>',
94
+ review: 'witness review design <spec-id> [--file <html>]',
89
95
  satisfy: 'witness satisfy <doc-id> --need <id | index | text>',
90
96
  dismiss: 'witness dismiss <artifact> --deferral <id|index> --cause <superseded|lens-retired|judged-wrong> --note "<why>"',
91
97
  ship: 'witness ship <plan-id> [--manual]',
@@ -95,9 +101,12 @@ const VERB_USAGE = {
95
101
  sync: 'witness sync',
96
102
  trust: "witness trust [<artifact-id>] [--cmd '<exact command>']… [--yes]",
97
103
  'test-evidence': 'witness test-evidence <plan-id> --phase red|green [--step <id>]',
104
+ turn: 'witness turn -- <command> [args…]',
98
105
  'verify-red': 'witness verify-red <plan-id> [--base <ref>] [--step <id>]',
99
106
  wait: 'witness wait [--since <token>] — blocks until something new needs you · the chat runs it under autonomy',
100
107
  };
108
+ // Row 217. The verbs a reviewer may run: each only reads.
109
+ const REVIEWER_VERBS = new Set(['read', 'index', 'log', 'diff']);
101
110
  // Row 116 moved the body to version.ts, which journal.ts can import without closing a
102
111
  // cycle. Re-exported here because eleven call sites already ask the CLI shell for it and
103
112
  // the question they are asking has not changed.
@@ -143,8 +152,19 @@ export async function main(ctx, argv) {
143
152
  // repository that refuses every verb must still be able to run the one that unrefuses it.
144
153
  // An explicit help request is information, and refusing to print a usage line teaches
145
154
  // the human nothing they can act on.
155
+ //
156
+ // Row 218. Only what precedes a `--` is witness's: after it the arguments are a command's,
157
+ // and `witness turn -- vitest --help` runs vitest's help, not turn's usage line.
158
+ const own = rest.includes('--') ? rest.slice(0, rest.indexOf('--')) : rest;
146
159
  const helpRequested = verb === 'help' || verb === '--help'
147
- || rest.includes('--help') || rest.includes('-h');
160
+ || own.includes('--help') || own.includes('-h');
161
+ // Row 217. A reviewer reads; it never acts. Its tools are already gone (the spawn flags); this tripwire
162
+ // refuses what a harness that ignored them could still run. Checked directly: a reviewer spawned inside
163
+ // a drive session carries both markers, and `sessionMarker` names the drive's first.
164
+ if (isReviewer(ctx.env) && !helpRequested && !REVIEWER_VERBS.has(verb ?? '')) {
165
+ renderRefusal([v('witness', 'reviewer-cannot', `${verb ?? '(no verb)'} under WITNESS_REVIEWER`, 'nothing — a reviewer reads and never acts; it may run witness read, index, log or diff')]).forEach((l) => ctx.err(l));
166
+ return EXIT.REFUSED;
167
+ }
148
168
  if (!helpRequested && verb !== 'floor') {
149
169
  const gateRoot = primaryRoot(ctx.cwd);
150
170
  if (gateRoot.ok) {
@@ -171,7 +191,7 @@ export async function main(ctx, argv) {
171
191
  return EXIT.OK;
172
192
  }
173
193
  const load = VERBS[verb];
174
- if (load && (rest.includes('--help') || rest.includes('-h'))) {
194
+ if (load && (own.includes('--help') || own.includes('-h'))) {
175
195
  ctx.out(`usage: ${VERB_USAGE[verb] ?? `witness ${verb} [flags]`}`);
176
196
  return EXIT.OK;
177
197
  }
@@ -0,0 +1,132 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { crtQuote, envGet, spawnSync, system32 } from './spawn.js';
3
+ // Row 218. On Windows witness stopped what it started by ancestry — `taskkill /T` walks parent-pid
4
+ // links, libuv's own job holds only a direct child (every grandchild may break away silently, and
5
+ // a detached child is never assigned) — and a test suite's app leaves that ancestry: started
6
+ // detached by a starter that already exited, or by an installer that exits, it is linked to
7
+ // nothing, so it outlived every stop and every run that ended normally.
8
+ //
9
+ // The answer is a job object the host enters BEFORE it starts the command, so everything the
10
+ // command starts is born in it and dies when its last handle closes: when the host exits after
11
+ // the command, or when the host itself is killed — by a stop, or with its parent's libuv job.
12
+ // Assigning after spawn would race the shim, which starts the agent within milliseconds; a native
13
+ // addon or a compiled helper on disk would add what row 211's System32 PowerShell + `Add-Type`
14
+ // already gives. The limits are KILL_ON_JOB_CLOSE | BREAKAWAY_OK (0x2800), never silent breakaway
15
+ // (0x1000): a program that explicitly asks to leave still leaves, as it does today, and nothing
16
+ // else can — libuv's nested silent breakaway stops at this job (measured).
17
+ //
18
+ // A host that cannot enter a job costs containment, never the run: the probe runs once per
19
+ // process and a drive hands its answer down (`WITNESS_JOB_HOST`), so a machine where `Add-Type`
20
+ // is blocked (Constrained Language Mode) or `powershell.exe` is absent runs everything as before,
21
+ // and a job lost after a good probe prints `witness: no job (…)` and runs the command anyway.
22
+ export const JOB_HOST_ENV = 'WITNESS_JOB_HOST';
23
+ export const JOB_PROBE_EXIT = 86;
24
+ // One line of C#: the members Add-Type compiles into [Witness.Job].
25
+ const JOB_MEMBERS = [
26
+ '[StructLayout(LayoutKind.Sequential)] public struct Basic { public long PerProcessUserTimeLimit; public long PerJobUserTimeLimit; public uint LimitFlags;',
27
+ ' public UIntPtr MinimumWorkingSetSize; public UIntPtr MaximumWorkingSetSize; public uint ActiveProcessLimit; public UIntPtr Affinity;',
28
+ ' public uint PriorityClass; public uint SchedulingClass; }',
29
+ ' [StructLayout(LayoutKind.Sequential)] public struct Extended { public Basic Basic; public ulong ReadOps; public ulong WriteOps;',
30
+ ' public ulong OtherOps; public ulong ReadBytes; public ulong WriteBytes; public ulong OtherBytes; public UIntPtr ProcessMemoryLimit;',
31
+ ' public UIntPtr JobMemoryLimit; public UIntPtr PeakProcessMemoryUsed; public UIntPtr PeakJobMemoryUsed; }',
32
+ ' [DllImport("kernel32.dll", SetLastError = true)] public static extern IntPtr CreateJobObject(IntPtr attributes, string name);',
33
+ ' [DllImport("kernel32.dll", SetLastError = true)] public static extern bool SetInformationJobObject(IntPtr job, int infoClass, ref Extended info, uint length);',
34
+ ' [DllImport("kernel32.dll", SetLastError = true)] public static extern bool AssignProcessToJobObject(IntPtr job, IntPtr process);',
35
+ ' [DllImport("kernel32.dll")] public static extern IntPtr GetCurrentProcess();',
36
+ ].join('');
37
+ // The host. The command arrives only through the environment (row 211: never in the script's
38
+ // text) and leaves it before the command starts, with the caller's PSModulePath and PATHEXT,
39
+ // both of which PowerShell rewrites for itself at startup: PATHEXT gains `.CPL`, and where the
40
+ // caller had none it becomes `PathEXT=.CPL`, which left cmd.exe unable to find `node` (measured).
41
+ // Every other variable reaches the command as the caller set it. No `-ExecutionPolicy` on the host's command line:
42
+ // PowerShell would hand the command `PSExecutionPolicyPreference=Bypass`, and inline `-Command`
43
+ // text is not subject to execution policy anyway. Its own words are ASCII — Windows PowerShell
44
+ // writes a pipe in the OEM code page.
45
+ export const JOB_SCRIPT = [
46
+ "$ErrorActionPreference = 'Stop'",
47
+ '$held = $false',
48
+ 'try {',
49
+ ` Add-Type -Name Job -Namespace Witness -MemberDefinition '${JOB_MEMBERS}'`,
50
+ ' $j = [Witness.Job]::CreateJobObject([IntPtr]::Zero, $null)',
51
+ " if ($j -eq [IntPtr]::Zero) { throw 'CreateJobObject failed' }",
52
+ ' $e = New-Object Witness.Job+Extended',
53
+ ' $b = $e.Basic; $b.LimitFlags = 0x2800; $e.Basic = $b',
54
+ " if (-not [Witness.Job]::SetInformationJobObject($j, 9, [ref]$e, [Runtime.InteropServices.Marshal]::SizeOf($e))) { throw 'SetInformationJobObject failed' }",
55
+ " if (-not [Witness.Job]::AssignProcessToJobObject($j, [Witness.Job]::GetCurrentProcess())) { throw 'AssignProcessToJobObject failed' }",
56
+ ' $held = $true',
57
+ '} catch {',
58
+ " [Console]::Error.WriteLine('witness: no job (' + $_.Exception.Message + ')')",
59
+ '}',
60
+ `if ($env:WITNESS_JOB_PROBE) { if ($held) { exit 0 } else { exit ${JOB_PROBE_EXIT} } }`,
61
+ '$psi = New-Object System.Diagnostics.ProcessStartInfo',
62
+ '$psi.FileName = $env:WITNESS_JOB_FILE',
63
+ '$psi.Arguments = $env:WITNESS_JOB_ARGS',
64
+ '$psi.UseShellExecute = $false',
65
+ "if ($env:WITNESS_JOB_PSMODULEPATH) { $psi.EnvironmentVariables['PSModulePath'] = $env:WITNESS_JOB_PSMODULEPATH } else { $psi.EnvironmentVariables.Remove('PSModulePath') }",
66
+ "if ($env:WITNESS_JOB_PATHEXT) { $psi.EnvironmentVariables['PATHEXT'] = $env:WITNESS_JOB_PATHEXT } else { $psi.EnvironmentVariables.Remove('PATHEXT') }",
67
+ "foreach ($n in 'WITNESS_JOB_FILE', 'WITNESS_JOB_ARGS', 'WITNESS_JOB_PSMODULEPATH', 'WITNESS_JOB_PATHEXT') { $psi.EnvironmentVariables.Remove($n) }",
68
+ '$p = [System.Diagnostics.Process]::Start($psi)',
69
+ '$p.WaitForExit()',
70
+ 'exit $p.ExitCode',
71
+ ].join('\n');
72
+ const HOST_ARGS = ['-NoProfile', '-NonInteractive', '-Command', JOB_SCRIPT];
73
+ // libuv's quote_cmd_arg: an argument is quoted only when it is empty or holds a space, a tab
74
+ // or a quote, and then by the C runtime's rules.
75
+ export function winArg(arg) {
76
+ return arg === '' || /[ \t"]/.test(arg) ? crtQuote(arg) : arg;
77
+ }
78
+ // The command line after the program name, as libuv would have built it: verbatim for a batch
79
+ // run (resolveSpawn already quoted it for cmd.exe), libuv's quoting for an image.
80
+ export function jobTail(run) {
81
+ return run.windowsVerbatimArguments ? run.args.join(' ') : run.args.map(winArg).join(' ');
82
+ }
83
+ // `run`, started through the host — or `run` itself where there is no host.
84
+ export function contained(run, host) {
85
+ if (!host.ok)
86
+ return run;
87
+ return {
88
+ file: host.file,
89
+ args: [...HOST_ARGS],
90
+ env: {
91
+ ...run.env,
92
+ WITNESS_JOB_FILE: run.file,
93
+ WITNESS_JOB_ARGS: jobTail(run),
94
+ WITNESS_JOB_PSMODULEPATH: envGet(run.env, 'PSMODULEPATH') ?? '',
95
+ WITNESS_JOB_PATHEXT: envGet(run.env, 'PATHEXT') ?? '',
96
+ },
97
+ windowsVerbatimArguments: false,
98
+ };
99
+ }
100
+ let probed;
101
+ // Whether this process can start commands inside a job: a parent's answer as given, else this
102
+ // process's own probe, run once. Off win32 there are no job objects and nothing is probed.
103
+ export function jobHost(env, platform = process.platform) {
104
+ if (platform !== 'win32')
105
+ return { ok: false, why: `no job objects on ${platform}` };
106
+ const file = system32(env, 'WindowsPowerShell', 'v1.0', 'powershell.exe');
107
+ if (env[JOB_HOST_ENV] === 'job')
108
+ return { ok: true, file };
109
+ if (env[JOB_HOST_ENV] === 'none')
110
+ return { ok: false, why: 'the drive that started this run found none' };
111
+ if (probed !== undefined)
112
+ return probed;
113
+ if (!existsSync(file)) {
114
+ probed = { ok: false, why: `${file} not found` };
115
+ return probed;
116
+ }
117
+ const r = spawnSync(file, HOST_ARGS, {
118
+ env: { ...env, WITNESS_JOB_PROBE: '1' }, encoding: 'utf8', stdio: ['ignore', 'ignore', 'pipe'], timeout: 30_000,
119
+ });
120
+ probed = r.status === 0
121
+ ? { ok: true, file }
122
+ : { ok: false, why: ((r.stderr ?? '').split(/\r?\n/u)[0] ?? '').trim().slice(0, 200) || r.error?.message || `exit ${r.status}` };
123
+ return probed;
124
+ }
125
+ // Drive's opening line beside `keep-awake:` — what ends a session's work on this machine.
126
+ export function containmentLine(host, platform = process.platform) {
127
+ if (platform !== 'win32')
128
+ return 'containment: process groups — what a session starts ends with it, unless it leaves the group';
129
+ return host.ok
130
+ ? "containment: job objects — what drive's work starts ends with it"
131
+ : `containment: none — ${host.why} · a stopped session's tree is still stopped`;
132
+ }
package/dist/deferral.js CHANGED
@@ -26,8 +26,9 @@ export function openDeferrals(entries) {
26
26
  }
27
27
  return [...open.values()];
28
28
  }
29
- // Injected into every lens, exactly as `pinsBlock` is, and joined to `prompts_sha` so a new
30
- // obligation invalidates the verdict cache and the next round cannot judge without it.
29
+ // Injected into every lens that can read the debt (row 216), beside `pinsBlock`, and joined to
30
+ // `prompts_sha` so a new obligation invalidates the verdict cache and the next round cannot
31
+ // judge without it.
31
32
  // Deliberately the INVERSE of a pin: a pin tells reviewers not to re-litigate, this tells
32
33
  // them to report the thing if it is still there. Pins suppress findings; obligations
33
34
  // solicit them — which is what makes the discharge automatic and evidence-shaped.
@@ -50,8 +51,8 @@ export function deferralsBlock(open) {
50
51
  return '## Open deferrals (approved over findings — report these if they still hold)\n\n' +
51
52
  'This artifact was approved over the findings below rather than fixed. They are NOT settled ' +
52
53
  'policy and they are NOT pins. If a defect is still present, report it as a finding anchored ' +
53
- 'exactly as listed: that keeps its obligation open. Silence is read as fixed: an obligation ' +
54
- 'this round does not report is discharged.\n\n' +
54
+ 'exactly as listed: that keeps its obligation open. The gate reads silence as fixed: an ' +
55
+ 'obligation a gate round does not report is discharged.\n\n' +
55
56
  open.map(line).join('\n') + '\n\n';
56
57
  }
57
58
  // D122 + D166. A debt changes homes when the artifact holding it stops being the one the next