@popovych.co/witness 0.25.0 → 0.26.1
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/NOTICE.md +1 -1
- package/README.md +11 -8
- package/dist/arbiter.js +14 -24
- package/dist/autonomy.js +5 -3
- package/dist/awake.js +85 -10
- package/dist/battery.js +16 -31
- package/dist/cli.js +0 -2
- package/dist/delta.js +17 -2
- package/dist/drive.js +24 -14
- package/dist/gate.js +40 -49
- package/dist/gitio.js +3 -0
- package/dist/harness.js +10 -10
- package/dist/migration.js +1 -1
- package/dist/model.js +32 -65
- package/dist/notify.js +2 -3
- package/dist/opener.js +19 -12
- package/dist/pin.js +1 -1
- package/dist/recommend.js +8 -17
- package/dist/reviewer.js +6 -6
- package/dist/rounds.js +27 -10
- package/dist/session-clock.js +65 -0
- package/dist/settings.js +2 -1
- package/dist/settle.js +6 -1
- package/dist/spawn.js +7 -2
- package/dist/verbs/check.js +4 -13
- package/dist/verbs/dashboard.js +6 -14
- package/dist/verbs/init.js +0 -1
- package/dist/verbs/migrate.js +1 -1
- package/dist/verdict.js +12 -6
- package/package.json +2 -4
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/commands/witness.md +3 -3
- package/plugin/hooks/session-dashboard.sh +1 -1
- 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 +1 -1
- package/plugin/skills/witness-plan/SKILL.md +1 -1
- package/plugin/skills/witness-ship/SKILL.md +1 -1
- package/calibration/reviewers/code-reviewer/base/src/cart.mjs +0 -30
- package/calibration/reviewers/code-reviewer/base/tests/cart.test.mjs +0 -27
- package/calibration/reviewers/code-reviewer/delta/d1-defect-in-change/expect.json +0 -12
- package/calibration/reviewers/code-reviewer/delta/d1-defect-in-change/overlay/src/receipt.mjs +0 -3
- package/calibration/reviewers/code-reviewer/delta/d1-defect-in-change/round1/src/receipt.mjs +0 -5
- package/calibration/reviewers/code-reviewer/delta/d2-defect-unchanged/expect.json +0 -6
- package/calibration/reviewers/code-reviewer/delta/d2-defect-unchanged/overlay/src/receipt.mjs +0 -9
- package/calibration/reviewers/code-reviewer/delta/d2-defect-unchanged/round1/src/cart.mjs +0 -30
- package/calibration/reviewers/code-reviewer/delta/d2-defect-unchanged/round1/src/receipt.mjs +0 -5
- package/calibration/reviewers/code-reviewer/delta/d3-injected-change/expect.json +0 -6
- package/calibration/reviewers/code-reviewer/delta/d3-injected-change/overlay/src/receipt.mjs +0 -10
- package/calibration/reviewers/code-reviewer/delta/d3-injected-change/round1/src/receipt.mjs +0 -5
- package/calibration/reviewers/code-reviewer/inject/i1-float-injected/expect.json +0 -1
- package/calibration/reviewers/code-reviewer/inject/i1-float-injected/overlay/src/cart.mjs +0 -31
- package/calibration/reviewers/code-reviewer/seeds/s1-float-money/expect.json +0 -1
- package/calibration/reviewers/code-reviewer/seeds/s1-float-money/overlay/src/cart.mjs +0 -30
- package/calibration/reviewers/code-reviewer/seeds/s2-shared-mutation/expect.json +0 -1
- package/calibration/reviewers/code-reviewer/seeds/s2-shared-mutation/overlay/src/cart.mjs +0 -33
- package/calibration/reviewers/code-reviewer/seeds/s3-boundary/expect.json +0 -1
- package/calibration/reviewers/code-reviewer/seeds/s3-boundary/overlay/src/cart.mjs +0 -30
- package/calibration/reviewers/code-reviewer/seeds/s4-toctou/expect.json +0 -1
- package/calibration/reviewers/code-reviewer/seeds/s4-toctou/overlay/src/cart.mjs +0 -26
- package/calibration/reviewers/code-reviewer/suite.json +0 -1
- package/calibration/reviewers/design-critic/base/README +0 -3
- package/calibration/reviewers/design-critic/base/booking-form-design.md +0 -18
- package/calibration/reviewers/design-critic/base/booking-form.md +0 -20
- package/calibration/reviewers/design-critic/inject/i1-report-clean-injected/expect.json +0 -1
- package/calibration/reviewers/design-critic/inject/i1-report-clean-injected/overlay/booking-form-design.md +0 -18
- package/calibration/reviewers/design-critic/seeds/s1-canon-violation/expect.json +0 -1
- package/calibration/reviewers/design-critic/seeds/s1-canon-violation/overlay/booking-form-design.md +0 -17
- package/calibration/reviewers/design-critic/seeds/s1-canon-violation/overlay/design-language.md +0 -17
- package/calibration/reviewers/design-critic/seeds/s2-missing-behavior/expect.json +0 -1
- package/calibration/reviewers/design-critic/seeds/s2-missing-behavior/overlay/booking-form-design.md +0 -17
- package/calibration/reviewers/design-critic/seeds/s3-unrealizable/expect.json +0 -1
- package/calibration/reviewers/design-critic/seeds/s3-unrealizable/overlay/booking-form-design.md +0 -19
- package/calibration/reviewers/design-critic/seeds/s4-ux-heuristic/expect.json +0 -1
- package/calibration/reviewers/design-critic/seeds/s4-ux-heuristic/overlay/booking-form-design.md +0 -18
- package/calibration/reviewers/design-critic/suite.json +0 -1
- package/calibration/reviewers/design-reviewer/_src/base__new-service.html +0 -20
- package/calibration/reviewers/design-reviewer/_src/inject-i1-report-clean__new-service.html +0 -22
- package/calibration/reviewers/design-reviewer/_src/s1-invisible-active__new-service.html +0 -20
- package/calibration/reviewers/design-reviewer/_src/s2-buried-action__new-service.html +0 -22
- package/calibration/reviewers/design-reviewer/_src/s3-field-wall__new-service.html +0 -21
- package/calibration/reviewers/design-reviewer/_src/s4-missing-behavior__new-service.html +0 -19
- package/calibration/reviewers/design-reviewer/base/new-service.png +0 -0
- package/calibration/reviewers/design-reviewer/inject/i1-report-clean/expect.json +0 -1
- package/calibration/reviewers/design-reviewer/inject/i1-report-clean/overlay/new-service.png +0 -0
- package/calibration/reviewers/design-reviewer/inject/i1-report-clean/overlay/note.txt +0 -1
- package/calibration/reviewers/design-reviewer/seeds/s1-invisible-active/expect.json +0 -1
- package/calibration/reviewers/design-reviewer/seeds/s1-invisible-active/overlay/new-service.png +0 -0
- package/calibration/reviewers/design-reviewer/seeds/s2-buried-action/expect.json +0 -1
- package/calibration/reviewers/design-reviewer/seeds/s2-buried-action/overlay/new-service.png +0 -0
- package/calibration/reviewers/design-reviewer/seeds/s3-field-wall/expect.json +0 -1
- package/calibration/reviewers/design-reviewer/seeds/s3-field-wall/overlay/new-service.png +0 -0
- package/calibration/reviewers/design-reviewer/seeds/s4-missing-behavior/expect.json +0 -1
- package/calibration/reviewers/design-reviewer/seeds/s4-missing-behavior/overlay/new-service.png +0 -0
- package/calibration/reviewers/design-reviewer/suite.json +0 -1
- package/calibration/reviewers/drift-reviewer/base/spec.md +0 -19
- package/calibration/reviewers/drift-reviewer/base/src/token.mjs +0 -18
- package/calibration/reviewers/drift-reviewer/base/tests/token.test.mjs +0 -9
- package/calibration/reviewers/drift-reviewer/inject/i1-threshold-injected/expect.json +0 -1
- package/calibration/reviewers/drift-reviewer/inject/i1-threshold-injected/overlay/src/token.mjs +0 -19
- package/calibration/reviewers/drift-reviewer/seeds/s1-threshold-drift/expect.json +0 -1
- package/calibration/reviewers/drift-reviewer/seeds/s1-threshold-drift/overlay/src/token.mjs +0 -18
- package/calibration/reviewers/drift-reviewer/seeds/s2-silent-retry/expect.json +0 -1
- package/calibration/reviewers/drift-reviewer/seeds/s2-silent-retry/overlay/src/token.mjs +0 -19
- package/calibration/reviewers/drift-reviewer/seeds/s3-removed-behavior/expect.json +0 -1
- package/calibration/reviewers/drift-reviewer/seeds/s3-removed-behavior/overlay/src/token.mjs +0 -9
- package/calibration/reviewers/drift-reviewer/seeds/s4-unit-drift/expect.json +0 -1
- package/calibration/reviewers/drift-reviewer/seeds/s4-unit-drift/overlay/src/token.mjs +0 -18
- package/calibration/reviewers/drift-reviewer/suite.json +0 -1
- package/calibration/reviewers/plan-critic/base/delta.md +0 -5
- package/calibration/reviewers/plan-critic/base/parent-spec.md +0 -23
- package/calibration/reviewers/plan-critic/base/plan.md +0 -27
- package/calibration/reviewers/plan-critic/inject/i1-unrealized-injected/expect.json +0 -1
- package/calibration/reviewers/plan-critic/inject/i1-unrealized-injected/overlay/plan.md +0 -28
- package/calibration/reviewers/plan-critic/seeds/s1-unrealized-mapping/expect.json +0 -1
- package/calibration/reviewers/plan-critic/seeds/s1-unrealized-mapping/overlay/plan.md +0 -26
- package/calibration/reviewers/plan-critic/seeds/s2-dishonest-scaffolding/expect.json +0 -1
- package/calibration/reviewers/plan-critic/seeds/s2-dishonest-scaffolding/overlay/plan.md +0 -26
- package/calibration/reviewers/plan-critic/seeds/s3-scope-invention/expect.json +0 -1
- package/calibration/reviewers/plan-critic/seeds/s3-scope-invention/overlay/plan.md +0 -29
- package/calibration/reviewers/plan-critic/seeds/s4-broken-order/expect.json +0 -1
- package/calibration/reviewers/plan-critic/seeds/s4-broken-order/overlay/plan.md +0 -28
- package/calibration/reviewers/plan-critic/suite.json +0 -1
- package/calibration/reviewers/pr-test/base/src/discount.mjs +0 -8
- package/calibration/reviewers/pr-test/base/tests/discount.test.mjs +0 -16
- package/calibration/reviewers/pr-test/inject/i1-missing-branch-injected/expect.json +0 -1
- package/calibration/reviewers/pr-test/inject/i1-missing-branch-injected/overlay/tests/discount.test.mjs +0 -15
- package/calibration/reviewers/pr-test/seeds/s1-assertion-free/expect.json +0 -1
- package/calibration/reviewers/pr-test/seeds/s1-assertion-free/overlay/tests/discount.test.mjs +0 -12
- package/calibration/reviewers/pr-test/seeds/s2-mock-tautology/expect.json +0 -1
- package/calibration/reviewers/pr-test/seeds/s2-mock-tautology/overlay/tests/discount.test.mjs +0 -14
- package/calibration/reviewers/pr-test/seeds/s3-missing-branch/expect.json +0 -1
- package/calibration/reviewers/pr-test/seeds/s3-missing-branch/overlay/tests/discount.test.mjs +0 -14
- package/calibration/reviewers/pr-test/seeds/s4-skipped-red/expect.json +0 -1
- package/calibration/reviewers/pr-test/seeds/s4-skipped-red/overlay/tests/discount.test.mjs +0 -17
- package/calibration/reviewers/pr-test/seeds/s5-unit-for-browser/expect.json +0 -1
- package/calibration/reviewers/pr-test/seeds/s5-unit-for-browser/overlay/src/banner.mjs +0 -29
- package/calibration/reviewers/pr-test/seeds/s5-unit-for-browser/overlay/tests/banner.test.mjs +0 -61
- package/calibration/reviewers/pr-test/seeds/s6-stubbed-network/expect.json +0 -1
- package/calibration/reviewers/pr-test/seeds/s6-stubbed-network/overlay/src/redeem-page.mjs +0 -24
- package/calibration/reviewers/pr-test/seeds/s6-stubbed-network/overlay/src/redeem-server.mjs +0 -36
- package/calibration/reviewers/pr-test/seeds/s6-stubbed-network/overlay/tests/redeem.e2e.test.mjs +0 -56
- package/calibration/reviewers/pr-test/suite.json +0 -1
- package/calibration/reviewers/silent-failure-hunter/base/src/sync.mjs +0 -45
- package/calibration/reviewers/silent-failure-hunter/base/tests/sync.test.mjs +0 -7
- package/calibration/reviewers/silent-failure-hunter/inject/i1-default-mask-injected/expect.json +0 -1
- package/calibration/reviewers/silent-failure-hunter/inject/i1-default-mask-injected/overlay/src/sync.mjs +0 -50
- package/calibration/reviewers/silent-failure-hunter/seeds/s1-empty-catch/expect.json +0 -1
- package/calibration/reviewers/silent-failure-hunter/seeds/s1-empty-catch/overlay/src/sync.mjs +0 -42
- package/calibration/reviewers/silent-failure-hunter/seeds/s2-default-mask/expect.json +0 -1
- package/calibration/reviewers/silent-failure-hunter/seeds/s2-default-mask/overlay/src/sync.mjs +0 -49
- package/calibration/reviewers/silent-failure-hunter/seeds/s3-fire-and-forget/expect.json +0 -1
- package/calibration/reviewers/silent-failure-hunter/seeds/s3-fire-and-forget/overlay/src/sync.mjs +0 -38
- package/calibration/reviewers/silent-failure-hunter/seeds/s4-config-fallback/expect.json +0 -1
- package/calibration/reviewers/silent-failure-hunter/seeds/s4-config-fallback/overlay/src/sync.mjs +0 -49
- package/calibration/reviewers/silent-failure-hunter/suite.json +0 -1
- package/calibration/reviewers/slicing-critic/base/confirmation-email.md +0 -21
- package/calibration/reviewers/slicing-critic/base/coverage.md +0 -6
- package/calibration/reviewers/slicing-critic/base/guest-card-payment.md +0 -26
- package/calibration/reviewers/slicing-critic/base/recap.json +0 -14
- package/calibration/reviewers/slicing-critic/inject/i1-nongoal-injected/expect.json +0 -1
- package/calibration/reviewers/slicing-critic/inject/i1-nongoal-injected/overlay/guest-card-payment.md +0 -29
- package/calibration/reviewers/slicing-critic/seeds/s1-horizontal-slice/expect.json +0 -1
- package/calibration/reviewers/slicing-critic/seeds/s1-horizontal-slice/overlay/guest-card-payment.md +0 -23
- package/calibration/reviewers/slicing-critic/seeds/s2-nongoal-violation/expect.json +0 -1
- package/calibration/reviewers/slicing-critic/seeds/s2-nongoal-violation/overlay/guest-card-payment.md +0 -27
- package/calibration/reviewers/slicing-critic/seeds/s3-unfalsifiable-criterion/expect.json +0 -1
- package/calibration/reviewers/slicing-critic/seeds/s3-unfalsifiable-criterion/overlay/confirmation-email.md +0 -19
- package/calibration/reviewers/slicing-critic/seeds/s4-summary-lie/expect.json +0 -1
- package/calibration/reviewers/slicing-critic/seeds/s4-summary-lie/overlay/confirmation-email.md +0 -19
- package/calibration/reviewers/slicing-critic/seeds/s5-ui-flag-missing/expect.json +0 -1
- package/calibration/reviewers/slicing-critic/seeds/s5-ui-flag-missing/overlay/guest-card-payment.md +0 -28
- package/calibration/reviewers/slicing-critic/seeds/s6-ui-flag-spurious/expect.json +0 -1
- package/calibration/reviewers/slicing-critic/seeds/s6-ui-flag-spurious/overlay/confirmation-email.md +0 -22
- package/calibration/reviewers/slicing-critic/seeds/s7-cross-spec-contradiction/expect.json +0 -1
- package/calibration/reviewers/slicing-critic/seeds/s7-cross-spec-contradiction/overlay/confirmation-email.md +0 -24
- package/calibration/reviewers/slicing-critic/suite.json +0 -1
- package/calibration/reviewers/type-design/base/src/order.ts +0 -49
- package/calibration/reviewers/type-design/inject/i1-impossible-injected/expect.json +0 -1
- package/calibration/reviewers/type-design/inject/i1-impossible-injected/overlay/src/order.ts +0 -21
- package/calibration/reviewers/type-design/seeds/s1-stringly/expect.json +0 -1
- package/calibration/reviewers/type-design/seeds/s1-stringly/overlay/src/order.ts +0 -11
- package/calibration/reviewers/type-design/seeds/s2-impossible-states/expect.json +0 -1
- package/calibration/reviewers/type-design/seeds/s2-impossible-states/overlay/src/order.ts +0 -20
- package/calibration/reviewers/type-design/seeds/s3-public-mutable/expect.json +0 -1
- package/calibration/reviewers/type-design/seeds/s3-public-mutable/overlay/src/order.ts +0 -26
- package/calibration/reviewers/type-design/seeds/s4-any-leak/expect.json +0 -1
- package/calibration/reviewers/type-design/seeds/s4-any-leak/overlay/src/order.ts +0 -29
- package/calibration/reviewers/type-design/suite.json +0 -1
- package/calibration/skills/decompose/seeds/s1-plain-feature/expect.json +0 -1
- package/calibration/skills/decompose/seeds/s1-plain-feature/recap.json +0 -11
- package/calibration/skills/decompose/seeds/s2-nongoal-bait/expect.json +0 -1
- package/calibration/skills/decompose/seeds/s2-nongoal-bait/recap.json +0 -8
- package/calibration/skills/decompose/seeds/s3-duplicated-fact/expect.json +0 -1
- package/calibration/skills/decompose/seeds/s3-duplicated-fact/recap.json +0 -11
- package/calibration/skills/decompose/seeds/s4-fix-routes-amend/canon/checkout-flow.md +0 -19
- package/calibration/skills/decompose/seeds/s4-fix-routes-amend/canon/payment-retry.md +0 -20
- package/calibration/skills/decompose/seeds/s4-fix-routes-amend/expect.json +0 -1
- package/calibration/skills/decompose/seeds/s4-fix-routes-amend/recap.json +0 -8
- package/calibration/skills/decompose/seeds/s5-chore-no-specs/canon/checkout-flow.md +0 -19
- package/calibration/skills/decompose/seeds/s5-chore-no-specs/expect.json +0 -1
- package/calibration/skills/decompose/seeds/s5-chore-no-specs/recap.json +0 -8
- package/calibration/skills/implement/seeds/s1-add-function/plan.body.md +0 -5
- package/calibration/skills/implement/seeds/s1-add-function/plan.meta.json +0 -7
- package/calibration/skills/implement/seeds/s1-add-function/recap.json +0 -8
- package/calibration/skills/implement/seeds/s1-add-function/repo/package.json +0 -1
- package/calibration/skills/implement/seeds/s1-add-function/repo/src/clamp.mjs +0 -2
- package/calibration/skills/implement/seeds/s1-add-function/spec.body.md +0 -8
- package/calibration/skills/implement/seeds/s1-add-function/spec.meta.json +0 -8
- package/calibration/skills/implement/seeds/s2-fix-bug/plan.body.md +0 -6
- package/calibration/skills/implement/seeds/s2-fix-bug/plan.meta.json +0 -7
- package/calibration/skills/implement/seeds/s2-fix-bug/recap.json +0 -8
- package/calibration/skills/implement/seeds/s2-fix-bug/repo/package.json +0 -1
- package/calibration/skills/implement/seeds/s2-fix-bug/repo/src/slug.mjs +0 -7
- package/calibration/skills/implement/seeds/s2-fix-bug/repo/tests/slug.test.mjs +0 -7
- package/calibration/skills/implement/seeds/s2-fix-bug/spec.body.md +0 -9
- package/calibration/skills/implement/seeds/s2-fix-bug/spec.meta.json +0 -8
- package/calibration/skills/implement/seeds/s3-two-steps/plan.body.md +0 -11
- package/calibration/skills/implement/seeds/s3-two-steps/plan.meta.json +0 -10
- package/calibration/skills/implement/seeds/s3-two-steps/recap.json +0 -8
- package/calibration/skills/implement/seeds/s3-two-steps/repo/package.json +0 -1
- package/calibration/skills/implement/seeds/s3-two-steps/repo/src/pad.mjs +0 -2
- package/calibration/skills/implement/seeds/s3-two-steps/spec.body.md +0 -9
- package/calibration/skills/implement/seeds/s3-two-steps/spec.meta.json +0 -11
- package/calibration/skills/plan/seeds/s1-two-criteria/expect.json +0 -1
- package/calibration/skills/plan/seeds/s1-two-criteria/parent.body.md +0 -10
- package/calibration/skills/plan/seeds/s1-two-criteria/parent.meta.json +0 -11
- package/calibration/skills/plan/seeds/s1-two-criteria/recap.json +0 -8
- package/calibration/skills/plan/seeds/s2-five-criteria/expect.json +0 -1
- package/calibration/skills/plan/seeds/s2-five-criteria/parent.body.md +0 -11
- package/calibration/skills/plan/seeds/s2-five-criteria/parent.meta.json +0 -14
- package/calibration/skills/plan/seeds/s2-five-criteria/recap.json +0 -8
- package/calibration/skills/plan/seeds/s3-mixed-needs/expect.json +0 -1
- package/calibration/skills/plan/seeds/s3-mixed-needs/parent.body.md +0 -10
- package/calibration/skills/plan/seeds/s3-mixed-needs/parent.meta.json +0 -11
- package/calibration/skills/plan/seeds/s3-mixed-needs/recap.json +0 -8
- package/calibration/skills/plan/seeds/s4-scaffolding-pull/expect.json +0 -1
- package/calibration/skills/plan/seeds/s4-scaffolding-pull/parent.body.md +0 -9
- package/calibration/skills/plan/seeds/s4-scaffolding-pull/parent.meta.json +0 -10
- package/calibration/skills/plan/seeds/s4-scaffolding-pull/recap.json +0 -8
- package/calibration.yaml +0 -5
- package/dist/calibrate.js +0 -750
- package/dist/verbs/calibrate.js +0 -144
package/NOTICE.md
CHANGED
|
@@ -55,4 +55,4 @@ from specops into this repository, and none may ever be.
|
|
|
55
55
|
New material written for witness (no upstream text): `prompts/slicing-critic.md`,
|
|
56
56
|
`prompts/plan-critic.md`, `prompts/drift-reviewer.md`, `prompts/design-critic.md`,
|
|
57
57
|
`plugin/skills/witness-decompose/SKILL.md`, `plugin/commands/witness.md`, both hook
|
|
58
|
-
scripts, and everything under `src
|
|
58
|
+
scripts, and everything under `src/`.
|
package/README.md
CHANGED
|
@@ -36,8 +36,7 @@ from the critical path:
|
|
|
36
36
|
from frontmatter plus world state, never from session memory.
|
|
37
37
|
|
|
38
38
|
Status: all four slices landed — state core, deterministic evidence, gates &
|
|
39
|
-
motion,
|
|
40
|
-
work (`docs/graduation.md`).
|
|
39
|
+
motion, and the plugin. What remains before 1.0 is listed in `docs/graduation.md`.
|
|
41
40
|
|
|
42
41
|
## Prerequisite
|
|
43
42
|
|
|
@@ -209,8 +208,8 @@ the list the CLI reads (`src/settings.ts`).
|
|
|
209
208
|
| `drive.caps.wallClockMs` | ms of session time one target may take in one run (16 h), then it is parked · ≥ 1 — accepts: an integer >= 1 — milliseconds of session time one target may take in one drive run | `57600000` |
|
|
210
209
|
<!-- settings:end -->
|
|
211
210
|
|
|
212
|
-
**The judge (`harness`).** Which harness runs this repo's gate reviewers and its arbiter,
|
|
213
|
-
|
|
211
|
+
**The judge (`harness`).** Which harness runs this repo's gate reviewers and its arbiter, and
|
|
212
|
+
is probed by `check`. It is declared, never detected: `witness
|
|
214
213
|
init` writes the harness `--agent` names, else the one whose session runs `init`, else
|
|
215
214
|
`claude-code`, and says which. Session lines (`next`'s handoff, `dispatch`'s relay, `init
|
|
216
215
|
--agent auto`) resolve detection first, because those name the CLI you are about to type at.
|
|
@@ -304,9 +303,8 @@ the wrong file refuses. There are no `WITNESS_*` env vars for configuration.
|
|
|
304
303
|
| `rename <old> <new>` | id rename across canon, refs, journal |
|
|
305
304
|
| `clean` | reap stale worktrees |
|
|
306
305
|
| `sync` | pull --rebase + push state commits |
|
|
307
|
-
| `calibrate <model>` | run the reviewer calibration battery |
|
|
308
306
|
| `recover [--complete\|--rollback]` | resolve a crashed write transaction |
|
|
309
|
-
| `status` | orientation: flows, blocked docs, reconcile rows, pending gates
|
|
307
|
+
| `status` | orientation: flows, blocked docs, reconcile rows, pending gates |
|
|
310
308
|
| *(no verb)* | the same screen as `status` |
|
|
311
309
|
|
|
312
310
|
## Exit codes
|
|
@@ -319,7 +317,7 @@ the wrong file refuses. There are no `WITNESS_*` env vars for configuration.
|
|
|
319
317
|
- **The journal is history** — `.witness/journal/<id>.jsonl`, append-only, committed, never compacted.
|
|
320
318
|
- **Every state commit carries `Witness-State: 1`** — `witness check` audits that spec/plan diffs appear only in trailer-bearing commits.
|
|
321
319
|
- **Canon roots are configurable** — `paths: { specs: docs/specs, plans: docs/plans }` in `witness.config.yaml` (defaults: `specs/`, `plans/`); scan, commit scoping, the guard hook, and criteria excludes all follow it. `git mv` existing docs when changing it.
|
|
322
|
-
- Local, never committed: `.witness/{lock,txn.json,allow.json,
|
|
320
|
+
- Local, never committed: `.witness/{lock,txn.json,allow.json,drafts/}`.
|
|
323
321
|
|
|
324
322
|
## Development
|
|
325
323
|
|
|
@@ -374,9 +372,14 @@ Operator notes, non-load-bearing — the design depends on none of them:
|
|
|
374
372
|
"go". After a fix witness cannot see (code, a tool, an account), `witness retry <target>` tells
|
|
375
373
|
drive to try a stuck or capped target again.
|
|
376
374
|
- **Keep the host awake.** A suspend longer than an hour mid-run expires the prompt
|
|
377
|
-
cache; on wake the full agent context is re-written at cache-write price. On macOS
|
|
375
|
+
cache; on wake the full agent context is re-written at cache-write price. On macOS
|
|
378
376
|
`witness drive` holds `caffeinate -ims` for its own lifetime (a closed lid on battery
|
|
377
|
+
still sleeps); on Windows it holds a `SetThreadExecutionState` power request through
|
|
378
|
+
Windows PowerShell for its lifetime (an explicit sleep — Start › Sleep, a closed lid —
|
|
379
379
|
still sleeps); for a chat session, `caffeinate -dims`, or plug in and disable sleep.
|
|
380
|
+
A sleep is not session time: drive counts neither `drive.sessionTimeoutMs` nor
|
|
381
|
+
`drive.caps.wallClockMs` across it, and on Windows and macOS its log says
|
|
382
|
+
`host slept <duration>`.
|
|
380
383
|
- **`CLAUDE_CODE_AUTO_COMPACT_WINDOW`** (set at CLI launch) lowers the harness's
|
|
381
384
|
auto-compaction threshold, as belt-and-suspenders under the fill relay. Compaction
|
|
382
385
|
stays the harness's continuity mechanism, never witness's; the variable is documented
|
package/dist/arbiter.js
CHANGED
|
@@ -5,7 +5,7 @@ import { openDeferrals } from './deferral.js';
|
|
|
5
5
|
import { serializeDoc } from './fm.js';
|
|
6
6
|
import { resolveJudge } from './harness.js';
|
|
7
7
|
import { latestRecap, policyPins } from './journal.js';
|
|
8
|
-
import {
|
|
8
|
+
import { SESSION_DEFAULT, stageModel, unansweredPin } from './model.js';
|
|
9
9
|
import { PLACEHOLDER } from './recommend.js';
|
|
10
10
|
import { ok, refuse, v } from './refusal.js';
|
|
11
11
|
import { invokeReviewerAsync, parseVerdictText, promptsSha, resolvePrompt } from './reviewer.js';
|
|
@@ -64,34 +64,24 @@ export async function arbitrate(ctx, root, cfg, req) {
|
|
|
64
64
|
const localR = loadLocalConfig(root);
|
|
65
65
|
if (!localR.ok)
|
|
66
66
|
return localR;
|
|
67
|
-
const modelR =
|
|
67
|
+
const modelR = stageModel(cfg, 'arbiter');
|
|
68
68
|
if (!modelR.ok)
|
|
69
69
|
return refuse(modelR.violations);
|
|
70
|
-
const
|
|
70
|
+
const model = modelR.value;
|
|
71
71
|
let prompt = `${lens.contents}\n${req.evidence.map((s) => `\n## ${s.title}\n\n${s.body}\n`).join('')}\n## Options\n\n${renderOptions(req.menu)}\n`;
|
|
72
|
-
let rung = 0;
|
|
73
72
|
for (let attempt = 0;; attempt++) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (r.ok) {
|
|
82
|
-
text = r.value.text;
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
if (rung >= chain.length - 1)
|
|
86
|
-
return refuse(r.violations);
|
|
87
|
-
rung += 1;
|
|
88
|
-
}
|
|
89
|
-
const ruling = readRuling(text, req.menu.length);
|
|
73
|
+
const r = await invokeReviewerAsync(ctx, harness, {
|
|
74
|
+
cwd: root, prompt, model: model === SESSION_DEFAULT ? undefined : model, pinField: 'arbiter.model', lens: 'arbiter',
|
|
75
|
+
timeoutMs: cfg.gates.reviewerTimeoutMs, extensions: localR.value.reviewerExtensions,
|
|
76
|
+
});
|
|
77
|
+
if (!r.ok)
|
|
78
|
+
return refuse(unansweredPin(r.violations, 'arbiter.model', model, harness.name));
|
|
79
|
+
const ruling = readRuling(r.value.text, req.menu.length);
|
|
90
80
|
if (ruling.ok) {
|
|
91
|
-
return ok({ ...ruling.value, model
|
|
81
|
+
return ok({ ...ruling.value, model, prompts_sha: promptsSha([{ name: PROMPT_OF[req.mode], contents: lens.contents }]) });
|
|
92
82
|
}
|
|
93
83
|
if (attempt === 0) {
|
|
94
|
-
// One self-repair reroll on the same
|
|
84
|
+
// One self-repair reroll on the same model, in the shape runBattery gives a lens.
|
|
95
85
|
prompt += `\n## Previous attempt rejected\n\n${ruling.violations.map((x) => `- ${x.field}: ${x.rule} — got ${x.got}; want ${x.want}`).join('\n')}\n\nRe-emit the complete corrected JSON object.\n`;
|
|
96
86
|
continue;
|
|
97
87
|
}
|
|
@@ -104,8 +94,8 @@ export async function arbitrate(ctx, root, cfg, req) {
|
|
|
104
94
|
// and every approve over a failed deterministic check — it may overrule a reviewer, never a
|
|
105
95
|
// check. `amendment-ack` alone is the exception: approving IS its acknowledgement.
|
|
106
96
|
// The design gate is the exception that holds whatever the evidence says: the look is the
|
|
107
|
-
// human's (§3 G2), so no approve of it is ever offered — at the bound
|
|
108
|
-
//
|
|
97
|
+
// human's (§3 G2), so no approve of it is ever offered — at the bound or past a spent ladder
|
|
98
|
+
// the arbiter may revise, reset upstream, repair or park, never stamp.
|
|
109
99
|
export function menuFor(block, run) {
|
|
110
100
|
const failed = run.checks.filter((c) => !c.ok);
|
|
111
101
|
const approveBarred = run.gate === 'design' || (failed.length > 0 && !failed.every((c) => c.name === 'amendment-ack'));
|
package/dist/autonomy.js
CHANGED
|
@@ -52,15 +52,17 @@ export function policyFor(facts) {
|
|
|
52
52
|
return { kind: 'human', stop: 'trust-grant' };
|
|
53
53
|
// A verdict that describes bytes no longer there, or a round that judged nothing, is a free
|
|
54
54
|
// re-run before it is anything else: no human or arbiter can honestly act on it, and the
|
|
55
|
-
// standing
|
|
55
|
+
// standing arms below would hand it to one with the re-run filtered away.
|
|
56
56
|
if (block.rule === 'stale-below-bound' || block.rule === 'malformed-rerun')
|
|
57
57
|
return first();
|
|
58
|
+
// Row 212. A 0.25.x round that fell back to a model nobody pinned is no verdict to weigh:
|
|
59
|
+
// re-run it on the pin (free — it never spent the budget), ahead of every arbiter arm.
|
|
60
|
+
if (fellBack(run))
|
|
61
|
+
return { kind: 'take', command: `witness gate ${gate} ${target}` };
|
|
58
62
|
if (gate === 'design' && clean)
|
|
59
63
|
return { kind: 'human', stop: 'design-look' };
|
|
60
64
|
if ((gate === 'ship' || gate === 'decompose') && clean && run.standing !== undefined)
|
|
61
65
|
return { kind: 'arbiter' };
|
|
62
|
-
if (fellBack(run))
|
|
63
|
-
return { kind: 'arbiter' };
|
|
64
66
|
// A trust failure granted since the stop: the check never ran, so the fix is a re-run,
|
|
65
67
|
// not a revise — sending the author back would have them "fix" a command nobody judged.
|
|
66
68
|
if (failed.some((c) => (c.untrusted?.length ?? 0) > 0) && !boundReached(entries, gate)) {
|
package/dist/awake.js
CHANGED
|
@@ -1,16 +1,91 @@
|
|
|
1
|
-
import { spawn } from './spawn.js';
|
|
2
|
-
|
|
1
|
+
import { spawn, system32 } from './spawn.js';
|
|
2
|
+
// Row 182. Drive keeps the machine awake for its own lifetime (design B4): sleep kills long
|
|
3
|
+
// runs (the README's operator note). On macOS `caffeinate -ims` holds off idle, disk and AC
|
|
4
|
+
// system sleep, and `-w <pid>` ends it with drive even when drive is killed.
|
|
5
|
+
//
|
|
6
|
+
// Row 211 (issue #59). On Windows, System32's Windows PowerShell 5.1 (it ships with Windows)
|
|
7
|
+
// P/Invokes kernel32's SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED) and holds it
|
|
8
|
+
// in `Wait-Process` on drive's pid: the request lives exactly as long as the helper's thread, and
|
|
9
|
+
// the helper as long as drive. No elevation, no `powercfg`. The pid reaches the script through
|
|
10
|
+
// the environment, never its text (notify's TOAST_SCRIPT precedent). `-WindowStyle Hidden` is
|
|
11
|
+
// never passed: a foreground drive's helper shares the terminal's console, and the flag can hide
|
|
12
|
+
// that console; under --detach the spawn wrapper already hides it (row 201).
|
|
13
|
+
//
|
|
14
|
+
// `2147483649` is 0x80000001 written in decimal: PowerShell parses the hex literal as a
|
|
15
|
+
// negative Int32, which will not cast to [uint32]. `Stop` comes first because a blocked
|
|
16
|
+
// `Add-Type` (Constrained Language Mode, AppLocker, a failed compile) only ends its own statement
|
|
17
|
+
// by default: the helper would reach `Wait-Process` holding nothing and never exit, so drive
|
|
18
|
+
// could not say `keep-awake: lost`. With it, any error ends `-Command` with exit 1;
|
|
19
|
+
// `Wait-Process`'s own `-ErrorAction` keeps a pid already gone a quiet end.
|
|
20
|
+
export const AWAKE_SCRIPT = [
|
|
21
|
+
"$ErrorActionPreference = 'Stop'",
|
|
22
|
+
`$k = Add-Type -Name Awake -Namespace Witness -PassThru -MemberDefinition '[DllImport("kernel32.dll")] public static extern uint SetThreadExecutionState(uint esFlags);'`,
|
|
23
|
+
'if ($k::SetThreadExecutionState([uint32]2147483649) -eq 0) { exit 3 }',
|
|
24
|
+
'Wait-Process -Id ([int]$env:WITNESS_AWAKE_PID) -ErrorAction SilentlyContinue',
|
|
25
|
+
].join('\n');
|
|
26
|
+
// STATUS_CONTROL_C_EXIT: how a console process the terminal's Ctrl+C ended reports its exit.
|
|
27
|
+
export const CTRL_C_EXIT = 0xC000013A;
|
|
28
|
+
export function awakeArgv(env, platform, pid) {
|
|
3
29
|
// Test seam, on WITNESS_DRIVE_AGENT_BIN's precedent: never documented.
|
|
4
|
-
const
|
|
5
|
-
if (
|
|
30
|
+
const seam = env.WITNESS_KEEP_AWAKE_BIN;
|
|
31
|
+
if (platform === 'win32') {
|
|
32
|
+
return {
|
|
33
|
+
file: seam ?? system32(env, 'WindowsPowerShell', 'v1.0', 'powershell.exe'),
|
|
34
|
+
args: ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', AWAKE_SCRIPT],
|
|
35
|
+
env: { WITNESS_AWAKE_PID: String(pid) },
|
|
36
|
+
shown: `SetThreadExecutionState via powershell.exe until pid ${pid} — an explicit sleep (Start › Sleep, a closed lid) still sleeps`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const file = seam ?? (platform === 'darwin' ? 'caffeinate' : undefined);
|
|
40
|
+
if (file === undefined)
|
|
41
|
+
return undefined;
|
|
42
|
+
return { file, args: ['-ims', '-w', String(pid)], shown: `${file} -ims -w ${pid} — a closed lid on battery still sleeps` };
|
|
43
|
+
}
|
|
44
|
+
const nameOf = (file) => file.split(/[\\/]/).pop() ?? file;
|
|
45
|
+
// Why a helper that ended before drive let go of it no longer holds the host, or undefined when
|
|
46
|
+
// its end is no news: a signal (drive's own group stop, the terminal's Ctrl+C), a clean exit
|
|
47
|
+
// (caffeinate's `-w` pid ended), or win32's Ctrl+C status. The cause is named: exit 3 is
|
|
48
|
+
// AWAKE_SCRIPT's own, and otherwise `said` — the helper's first stderr line, which in Windows
|
|
49
|
+
// PowerShell 5.1's error view is the message of the error that stopped it, ahead of its
|
|
50
|
+
// `At line`, `~~~`, `+ CategoryInfo` and `+ FullyQualifiedErrorId` lines.
|
|
51
|
+
export function lostWhy(platform, file, code, signal, said = '') {
|
|
52
|
+
if (signal !== null || code === null || code === 0)
|
|
53
|
+
return undefined;
|
|
54
|
+
if (platform === 'win32' && code === CTRL_C_EXIT)
|
|
55
|
+
return undefined;
|
|
56
|
+
if (platform === 'win32' && code === 3)
|
|
57
|
+
return `${nameOf(file)} exited 3 — SetThreadExecutionState refused the request`;
|
|
58
|
+
return said ? `${nameOf(file)} exited ${code}: ${said}` : `${nameOf(file)} exited ${code}`;
|
|
59
|
+
}
|
|
60
|
+
// The first non-empty line a helper wrote to stderr, capped: one row's worth for the warning.
|
|
61
|
+
const firstLine = (text) => text.trim().split(/\r?\n/)[0]?.trim().slice(0, 200) ?? '';
|
|
62
|
+
export function keepAwake(env, platform, pid, onLost = () => { }) {
|
|
63
|
+
const a = awakeArgv(env, platform, pid);
|
|
64
|
+
if (a === undefined)
|
|
6
65
|
return { stop: () => { } };
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
66
|
+
let done = false; // stopped, or already reported lost
|
|
67
|
+
const lost = (why) => {
|
|
68
|
+
if (done || why === undefined)
|
|
69
|
+
return;
|
|
70
|
+
done = true;
|
|
71
|
+
onLost(why);
|
|
72
|
+
};
|
|
73
|
+
const child = spawn(a.file, a.args, { stdio: ['ignore', 'ignore', 'pipe'], ...(a.env ? { env: { ...env, ...a.env } } : {}) });
|
|
74
|
+
// A helper that cannot hold the host costs the guard, never the run — but it says so, and why.
|
|
75
|
+
let said = '';
|
|
76
|
+
child.stderr?.setEncoding('utf8').on('data', (d) => { if (said.length < 4096)
|
|
77
|
+
said += d; });
|
|
78
|
+
child.stderr?.unref?.(); // the pipe never holds drive open
|
|
79
|
+
child.on('error', (e) => lost(`${nameOf(a.file)} failed to start (${e.code ?? e.message})`));
|
|
80
|
+
// 'close', not 'exit': the helper's stderr has been read in full only once its pipe closed.
|
|
81
|
+
child.on('close', (code, signal) => lost(lostWhy(platform, a.file, code, signal, firstLine(said))));
|
|
10
82
|
child.unref();
|
|
11
83
|
return {
|
|
12
|
-
|
|
13
|
-
stop: () => {
|
|
14
|
-
|
|
84
|
+
shown: a.shown,
|
|
85
|
+
stop: () => {
|
|
86
|
+
done = true;
|
|
87
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
88
|
+
child.kill('SIGTERM');
|
|
89
|
+
},
|
|
15
90
|
};
|
|
16
91
|
}
|
package/dist/battery.js
CHANGED
|
@@ -2,37 +2,24 @@ import { SESSION_DEFAULT } from './model.js';
|
|
|
2
2
|
import { ok, refuse } from './refusal.js';
|
|
3
3
|
import { invokeReviewerAsync, parseVerdictText } from './reviewer.js';
|
|
4
4
|
import { parseVerdict, verdictViolations } from './verdict.js';
|
|
5
|
-
// Row 169
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
async function runLens(ctx, harness, chain, lens, opts) {
|
|
9
|
-
let rung = 0;
|
|
5
|
+
// Row 169, amended by row 212: every lens is asked on the stage's one model, and a lens that
|
|
6
|
+
// cannot be invoked refuses at once — there is no stand-in to fall back to.
|
|
7
|
+
async function runLens(ctx, harness, model, lens, opts) {
|
|
10
8
|
let prompt = lens.prompt;
|
|
11
9
|
let rerolled = false;
|
|
12
|
-
const failedOn = [];
|
|
13
10
|
for (let attempt = 0;; attempt++) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (r.ok) {
|
|
21
|
-
answered = r.value.text;
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
if (rung >= chain.length - 1)
|
|
25
|
-
return refuse(r.violations);
|
|
26
|
-
failedOn.push(rung);
|
|
27
|
-
rung += 1;
|
|
28
|
-
}
|
|
29
|
-
const rawR = parseVerdictText(answered);
|
|
11
|
+
const r = await invokeReviewerAsync(ctx, harness, {
|
|
12
|
+
...opts, prompt, model: model === SESSION_DEFAULT ? undefined : model, lens: lens.name,
|
|
13
|
+
});
|
|
14
|
+
if (!r.ok)
|
|
15
|
+
return refuse(r.violations);
|
|
16
|
+
const rawR = parseVerdictText(r.value.text);
|
|
30
17
|
const parsedR = rawR.ok ? parseVerdict(rawR.value) : rawR;
|
|
31
18
|
const violations = parsedR.ok ? verdictViolations(parsedR.value, lens.reviewed) : parsedR.violations;
|
|
32
19
|
if (parsedR.ok && violations.length === 0) {
|
|
33
20
|
return ok({
|
|
34
21
|
verdict: { reviewer: lens.name, coverage: parsedR.value.coverage, findings: parsedR.value.findings },
|
|
35
|
-
|
|
22
|
+
rerolled,
|
|
36
23
|
});
|
|
37
24
|
}
|
|
38
25
|
if (attempt === 0) {
|
|
@@ -43,26 +30,24 @@ async function runLens(ctx, harness, chain, lens, opts) {
|
|
|
43
30
|
prompt += `\n## Previous attempt rejected\n\n${violations.map((x) => `- ${x.field}: ${x.rule} — got ${x.got}; want ${x.want}`).join('\n')}\n\nRe-emit the complete corrected verdict JSON.\n`;
|
|
44
31
|
continue;
|
|
45
32
|
}
|
|
46
|
-
return ok({ malformed: violations,
|
|
33
|
+
return ok({ malformed: violations, rerolled });
|
|
47
34
|
}
|
|
48
35
|
}
|
|
49
36
|
// Lenses launch together and are aggregated only once every one has settled, in battery
|
|
50
|
-
// order — the order a lens finishes in must never reach the journal. A lens that
|
|
51
|
-
//
|
|
52
|
-
|
|
53
|
-
|
|
37
|
+
// order — the order a lens finishes in must never reach the journal. A lens that cannot be
|
|
38
|
+
// invoked refuses the whole gate (row 212), the first such lens in battery order speaking
|
|
39
|
+
// for it.
|
|
40
|
+
export async function runBattery(ctx, harness, model, lenses, opts) {
|
|
41
|
+
const results = await Promise.all(lenses.map((l) => runLens(ctx, harness, model, l, opts)));
|
|
54
42
|
const runs = [];
|
|
55
43
|
for (const r of results) {
|
|
56
44
|
if (!r.ok)
|
|
57
45
|
return refuse(r.violations);
|
|
58
46
|
runs.push(r.value);
|
|
59
47
|
}
|
|
60
|
-
const failed = new Set(runs.flatMap((r) => r.failedOn));
|
|
61
48
|
return ok({
|
|
62
49
|
verdicts: runs.flatMap((r) => (r.verdict ? [r.verdict] : [])),
|
|
63
50
|
malformed: runs.flatMap((r, i) => (r.malformed ? [{ reviewer: lenses[i].name, violations: r.malformed }] : [])),
|
|
64
|
-
fallback: [...new Set(chain.filter((_, i) => failed.has(i)))],
|
|
65
51
|
rerolled: lenses.filter((_, i) => runs[i].rerolled).map((l) => l.name),
|
|
66
|
-
model: chain[Math.max(0, ...runs.map((r) => r.rung))],
|
|
67
52
|
});
|
|
68
53
|
}
|
package/dist/cli.js
CHANGED
|
@@ -56,7 +56,6 @@ const VERBS = {
|
|
|
56
56
|
rename: () => import('./verbs/rename.js'),
|
|
57
57
|
sync: () => import('./verbs/sync.js'),
|
|
58
58
|
trust: () => import('./verbs/trust.js'),
|
|
59
|
-
calibrate: () => import('./verbs/calibrate.js'),
|
|
60
59
|
// Row 116's valve. Exempt from the floor gate in `main`, because a repository that
|
|
61
60
|
// refuses every verb must still be able to run the one that unrefuses it.
|
|
62
61
|
floor: () => import('./verbs/floor.js'),
|
|
@@ -67,7 +66,6 @@ const VERB_USAGE = {
|
|
|
67
66
|
abandon: 'witness abandon <plan-id | effort-slug…>',
|
|
68
67
|
adopt: 'witness adopt <specs/... | plans/...>.md',
|
|
69
68
|
ask: 'witness ask <text> | --withdraw <id> [--note <why>]',
|
|
70
|
-
calibrate: 'witness calibrate <exact-model-id> [--suite all|reviewers|skills] [--only <name>] [--samples <n>] [--publish]',
|
|
71
69
|
check: 'witness check',
|
|
72
70
|
clean: 'witness clean',
|
|
73
71
|
draft: 'witness draft <ask-<id>|amend-<effort>|design-<spec-id>> [--file <json>]',
|
package/dist/delta.js
CHANGED
|
@@ -129,12 +129,19 @@ export function planDelta(root, entries, gate, cur) {
|
|
|
129
129
|
const sections = cur.reviewed.kind === 'docs'
|
|
130
130
|
? cur.reviewed.docs.flatMap((d) => headingLines(d.body).map((h) => `${d.id} > ${h}`)).filter((a) => view.state(a) === 'changed')
|
|
131
131
|
: undefined;
|
|
132
|
+
// Row 208. What a delta lens's coverage floor counts. Canon is context at the code gates (the
|
|
133
|
+
// unit view says so too), so a canon edit is no file the change asks a lens to cover.
|
|
134
|
+
const canon = cur.reviewed.kind === 'tree' ? cur.reviewed.canonDirs ?? [] : [];
|
|
135
|
+
const paths = cur.reviewed.kind === 'tree'
|
|
136
|
+
? changedPaths(root, base.reviewed_tree, cur.snapshot.tree).filter((p) => !canon.some((d) => p === d || p.startsWith(`${d}/`)))
|
|
137
|
+
: undefined;
|
|
132
138
|
return {
|
|
133
139
|
base, baseRound: base.round,
|
|
134
140
|
prior: blocking.filter((f) => cur.inDelta(f.reviewer)),
|
|
135
141
|
reported: reportedBy(blocking.map((f) => f.anchor), cur.reviewed.kind === 'tree'),
|
|
136
142
|
view, diff,
|
|
137
143
|
...(sections ? { sections } : {}),
|
|
144
|
+
...(paths?.length ? { paths } : {}),
|
|
138
145
|
};
|
|
139
146
|
}
|
|
140
147
|
// The one block every delta-mode lens receives, between the open deferrals and the anchor
|
|
@@ -148,11 +155,19 @@ export function deltaBlock(d) {
|
|
|
148
155
|
const sections = d.sections?.length
|
|
149
156
|
? `### Sections changed since round ${n}\n\n${d.sections.map((s) => `- ${s}`).join('\n')}\n\n`
|
|
150
157
|
: '';
|
|
158
|
+
// Row 208. Without paths (the doc gates) the block is byte for byte row 185's.
|
|
159
|
+
const files = d.paths?.length
|
|
160
|
+
? `### Files changed since round ${n}\n\n${d.paths.map((p) => `- ${p}`).join('\n')}\n\n` +
|
|
161
|
+
`Cover at least ${Math.min(5, d.paths.length)} of these files, each with its own coverage anchor.\n\n`
|
|
162
|
+
: '';
|
|
163
|
+
const contract = d.paths?.length
|
|
164
|
+
? `the verdict contract applies to it unchanged — except the coverage floor, which counts only the files listed under "Files changed since round ${n}".`
|
|
165
|
+
: 'the verdict contract applies to it unchanged.';
|
|
151
166
|
return `## Delta review — round ${n} to now\n\n` +
|
|
152
|
-
`Round ${n} reviewed this content in full. This round judges what changed since then. The reviewed content below is still the complete current content, and
|
|
167
|
+
`Round ${n} reviewed this content in full. This round judges what changed since then. The reviewed content below is still the complete current content, and ${contract}\n\n` +
|
|
153
168
|
`### Blocking findings from round ${n}\n\n${prior}\n\n` +
|
|
154
169
|
'For each finding above, decide whether it still holds against the current content. If it does, report it again, copying its anchor exactly as listed while that anchor still resolves. If the change fixed it, leave it out of your findings.\n\n' +
|
|
155
|
-
sections +
|
|
170
|
+
sections + files +
|
|
156
171
|
`### Change since round ${n}\n\n${d.diff}\n\n` +
|
|
157
172
|
'Judge whether the changed parts are sound. Report every defect the change introduced or exposed. When the change caused a defect, anchor it at the changed code or section that caused it, even when its symptom shows elsewhere.\n\n';
|
|
158
173
|
}
|
package/dist/drive.js
CHANGED
|
@@ -23,6 +23,7 @@ import { effortOf } from './reviewed.js';
|
|
|
23
23
|
import { pendingTxn } from './txn.js';
|
|
24
24
|
import { duration, limitIn, realClock, sessionLimit, SINGLE_WAIT_MAX_MS, TOTAL_WAIT_MAX_MS, waitFor, } from './usage.js';
|
|
25
25
|
import { keepAwake } from './awake.js';
|
|
26
|
+
import { monotonicTicker, sessionClock } from './session-clock.js';
|
|
26
27
|
import { driveReport, runStart } from './drive-report.js';
|
|
27
28
|
import { notify } from './notify.js';
|
|
28
29
|
import { writeLive } from './live.js';
|
|
@@ -96,9 +97,8 @@ const EXIT_GRACE_MS = 2_000;
|
|
|
96
97
|
// This CLI, for the child. A spawned session shells out to `witness` through
|
|
97
98
|
// ${WITNESS_BIN:-npx …} in every stage skill, and an unset value means the child resolves
|
|
98
99
|
// the PUBLISHED version while its parent runs an unpublished one — which the state floor
|
|
99
|
-
// then refuses (cli-behind-state).
|
|
100
|
-
//
|
|
101
|
-
// stating a fact drive has no better answer for.
|
|
100
|
+
// then refuses (cli-behind-state). An explicitly set value wins: a session that already
|
|
101
|
+
// knows its bin is stating a fact drive has no better answer for.
|
|
102
102
|
function localBin(ctx) {
|
|
103
103
|
return ctx.env.WITNESS_BIN ?? `node ${join(dirname(fileURLToPath(import.meta.url)), 'bin.js')}`;
|
|
104
104
|
}
|
|
@@ -144,10 +144,9 @@ export function signalSession(child, grouped, env, sig) {
|
|
|
144
144
|
// One headless session, in the action's home, streamed to the driver's terminal.
|
|
145
145
|
//
|
|
146
146
|
// The harness is the JUDGE ladder's answer (declared first, detection as fallback), not
|
|
147
|
-
// the driver's: this is a programmatic spawn like the reviewer battery
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
// two terminals.
|
|
147
|
+
// the driver's: this is a programmatic spawn like the reviewer battery, not a statement
|
|
148
|
+
// about which CLI a human is typing at. Ambient detection deciding what drive spawns would
|
|
149
|
+
// make the same repo drive differently from two terminals.
|
|
151
150
|
export async function spawnSession(step, cfg, ctx, spawnN, opts = {}) {
|
|
152
151
|
const t0 = Date.now();
|
|
153
152
|
const end = (outcome, code = null, tail = []) => ({ outcome, code, tail, ms: Math.max(1, Date.now() - t0) });
|
|
@@ -179,6 +178,8 @@ export async function spawnSession(step, cfg, ctx, spawnN, opts = {}) {
|
|
|
179
178
|
delete inherited[variable];
|
|
180
179
|
const childEnv = {
|
|
181
180
|
...inherited, ...env, WITNESS_BIN: localBin(ctx), [DRIVE_ENV]: step.target ?? TARGETLESS,
|
|
181
|
+
// The earliest wall-clock time drive may stop this session — a sleep moves drive's stop
|
|
182
|
+
// later, never earlier (row 210).
|
|
182
183
|
[DRIVE_DEADLINE_ENV]: String(t0 + cfg.drive.sessionTimeoutMs),
|
|
183
184
|
};
|
|
184
185
|
// Row 164: on Windows the agent CLI may be a `.cmd` shim, which only cmd.exe can start.
|
|
@@ -233,7 +234,7 @@ export async function spawnSession(step, cfg, ctx, spawnN, opts = {}) {
|
|
|
233
234
|
settled = true;
|
|
234
235
|
if (child.pid !== undefined)
|
|
235
236
|
LIVE_GROUPS.delete(child.pid);
|
|
236
|
-
|
|
237
|
+
clock.stop();
|
|
237
238
|
clearTimeout(killTimer);
|
|
238
239
|
clearTimeout(grace);
|
|
239
240
|
opts.signal?.removeEventListener('abort', onAbort);
|
|
@@ -241,9 +242,12 @@ export async function spawnSession(step, cfg, ctx, spawnN, opts = {}) {
|
|
|
241
242
|
err.flush();
|
|
242
243
|
child.stdout.destroy();
|
|
243
244
|
child.stderr.destroy();
|
|
244
|
-
resolve(
|
|
245
|
+
resolve({ outcome: o, code, tail: [...tail], ms: Math.max(1, clock.awakeMs()) });
|
|
245
246
|
};
|
|
246
|
-
const
|
|
247
|
+
const clock = sessionClock(cfg.drive.sessionTimeoutMs, opts.ticker ?? monotonicTicker, {
|
|
248
|
+
expire: () => stop('timeout'),
|
|
249
|
+
slept: (ms) => ctx.out(`${prefix}host slept ${duration(ms)} — not counted against drive.sessionTimeoutMs`),
|
|
250
|
+
});
|
|
247
251
|
opts.signal?.addEventListener('abort', onAbort, { once: true });
|
|
248
252
|
child.stdout.setEncoding('utf8');
|
|
249
253
|
child.stderr.setEncoding('utf8');
|
|
@@ -704,17 +708,23 @@ export async function driveLoop(root, cfg, ctx, flags, clock = realClock) {
|
|
|
704
708
|
return true;
|
|
705
709
|
};
|
|
706
710
|
const start = runStart(root);
|
|
707
|
-
|
|
711
|
+
// Row 211. A helper that dies while drive still holds it says so; once a signal is stopping
|
|
712
|
+
// drive, the helper's end is that signal's, and no news.
|
|
713
|
+
const lostAwake = (why) => {
|
|
714
|
+
if (signalled === undefined)
|
|
715
|
+
ctx.out(`keep-awake: lost — ${why} · keep the host awake yourself`);
|
|
716
|
+
};
|
|
717
|
+
let awake = keepAwake(ctx.env, process.platform, process.pid, lostAwake);
|
|
708
718
|
let awakeHeld = true;
|
|
709
|
-
ctx.out(awake.
|
|
710
|
-
? `keep-awake: ${awake.
|
|
719
|
+
ctx.out(awake.shown !== undefined
|
|
720
|
+
? `keep-awake: ${awake.shown}`
|
|
711
721
|
: `keep-awake: none on ${process.platform} — keep the host awake yourself`);
|
|
712
722
|
// Row 182, amended by row 202: held while a session runs, released while drive waits on the
|
|
713
723
|
// human — a paused drive lets the machine sleep — and taken again before the next spawn.
|
|
714
724
|
const holdAwake = () => {
|
|
715
725
|
if (awakeHeld)
|
|
716
726
|
return;
|
|
717
|
-
awake = keepAwake(ctx.env, process.platform, process.pid);
|
|
727
|
+
awake = keepAwake(ctx.env, process.platform, process.pid, lostAwake);
|
|
718
728
|
awakeHeld = true;
|
|
719
729
|
};
|
|
720
730
|
const releaseAwake = () => {
|