@popovych.co/witness 0.24.2 → 0.26.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/NOTICE.md +1 -1
- package/README.md +26 -9
- package/dist/allowlist.js +77 -0
- package/dist/arbiter.js +12 -22
- package/dist/autonomy.js +5 -3
- package/dist/awake.js +73 -10
- package/dist/battery.js +16 -31
- package/dist/cli.js +7 -3
- package/dist/criteria.js +5 -5
- package/dist/delta.js +17 -2
- package/dist/drive-presence.js +10 -2
- package/dist/drive-report.js +14 -70
- package/dist/drive.js +240 -36
- package/dist/gate.js +40 -49
- package/dist/gitio.js +5 -1
- package/dist/harness.js +12 -10
- package/dist/install.js +15 -0
- package/dist/live.js +143 -0
- package/dist/migration.js +1 -1
- package/dist/model.js +32 -65
- package/dist/needs-you.js +113 -0
- package/dist/needs.js +1 -1
- package/dist/notify.js +54 -17
- package/dist/pin.js +1 -1
- package/dist/progress.js +23 -0
- package/dist/recommend.js +3 -16
- package/dist/reviewer.js +5 -5
- package/dist/rounds.js +14 -8
- package/dist/runner.js +5 -2
- package/dist/session-clock.js +65 -0
- package/dist/settings.js +2 -1
- package/dist/settle.js +13 -7
- package/dist/spawn.js +8 -3
- package/dist/stamp.js +1 -1
- package/dist/toon.js +12 -0
- package/dist/verbs/check.js +7 -23
- package/dist/verbs/dashboard.js +8 -16
- package/dist/verbs/init.js +1 -1
- package/dist/verbs/migrate.js +1 -1
- 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/verdict.js +12 -6
- package/dist/worktree.js +3 -2
- package/package.json +1 -3
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/commands/witness.md +17 -6
- 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/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.
|
|
@@ -265,7 +264,7 @@ are declared in machine config, not env:
|
|
|
265
264
|
reviewerExtensions:
|
|
266
265
|
- /Users/you/.pi/agent/npm/node_modules/pi-claude-oauth-adapter
|
|
267
266
|
opener: xdg-open # optional; nonstandard desktops only
|
|
268
|
-
notify: /usr/local/bin/ping-me # optional;
|
|
267
|
+
notify: /usr/local/bin/ping-me # optional; each notification's text is its one argument · default: the platform notifier
|
|
269
268
|
```
|
|
270
269
|
|
|
271
270
|
Repo facts live in `witness.config.yaml` (committed); machine facts live in
|
|
@@ -285,6 +284,9 @@ the wrong file refuses. There are no `WITNESS_*` env vars for configuration.
|
|
|
285
284
|
| `check` | schema, graph, invariants, needs, trailer audit, probes |
|
|
286
285
|
| `index` | id · summary · status · depends across the canon, then each spec's plans |
|
|
287
286
|
| `satisfy <id> --need <id\|n\|text>` | journal a manual need as met — the spec is never rewritten |
|
|
287
|
+
| `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 |
|
|
288
|
+
| `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 |
|
|
289
|
+
| `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
290
|
| `log <id>` | render a journal stream |
|
|
289
291
|
| `gate <decompose\|plan\|implement\|ship\|design> <id>` | run the reviewer gate; journals the round, stamps on pass |
|
|
290
292
|
| `decide <gate> <id> --approve\|--revise [--pin <policy>]` | record the human decision on a stopped gate; `--pin` adds a standing content policy |
|
|
@@ -301,9 +303,8 @@ the wrong file refuses. There are no `WITNESS_*` env vars for configuration.
|
|
|
301
303
|
| `rename <old> <new>` | id rename across canon, refs, journal |
|
|
302
304
|
| `clean` | reap stale worktrees |
|
|
303
305
|
| `sync` | pull --rebase + push state commits |
|
|
304
|
-
| `calibrate <model>` | run the reviewer calibration battery |
|
|
305
306
|
| `recover [--complete\|--rollback]` | resolve a crashed write transaction |
|
|
306
|
-
| `status` | orientation: flows, blocked docs, reconcile rows, pending gates
|
|
307
|
+
| `status` | orientation: flows, blocked docs, reconcile rows, pending gates |
|
|
307
308
|
| *(no verb)* | the same screen as `status` |
|
|
308
309
|
|
|
309
310
|
## Exit codes
|
|
@@ -316,7 +317,7 @@ the wrong file refuses. There are no `WITNESS_*` env vars for configuration.
|
|
|
316
317
|
- **The journal is history** — `.witness/journal/<id>.jsonl`, append-only, committed, never compacted.
|
|
317
318
|
- **Every state commit carries `Witness-State: 1`** — `witness check` audits that spec/plan diffs appear only in trailer-bearing commits.
|
|
318
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.
|
|
319
|
-
- Local, never committed: `.witness/{lock,txn.json,allow.json,
|
|
320
|
+
- Local, never committed: `.witness/{lock,txn.json,allow.json,drafts/}`.
|
|
320
321
|
|
|
321
322
|
## Development
|
|
322
323
|
|
|
@@ -359,10 +360,26 @@ Operator notes, non-load-bearing — the design depends on none of them:
|
|
|
359
360
|
`drive.caps.spawns` (24). A measured slice on a large window can run past an hour, and on a
|
|
360
361
|
200k window every slice is one step, so a plan takes more sessions; raise either if drive
|
|
361
362
|
times out or caps a plan that is still moving.
|
|
363
|
+
- **Being told, and the waiting chat.** Under autonomy, drive notifies the moment something new
|
|
364
|
+
needs you — a trust grant, a need, a decision, a look, a merge, a stuck target — once per item,
|
|
365
|
+
a burst as one notification, plus once when the run ends. macOS uses `osascript`, Linux
|
|
366
|
+
`notify-send`, Windows a toast through Windows PowerShell 5.1 (no install, no registration);
|
|
367
|
+
`notify:` in `.witness/config.local.yaml` replaces all three. When everything left waits on you,
|
|
368
|
+
drive pauses rather than exits, lets the machine sleep, resumes the moment your act lands, and
|
|
369
|
+
gives up after 12 h with its report. The `/witness` chat sleeps beside it and is woken: on
|
|
370
|
+
Claude Code by `witness wait` in the background, on Pi by witness's add-on (`witness init --agent
|
|
371
|
+
pi` installs it). The chat never restarts a drive that stopped — it says so and waits for your
|
|
372
|
+
"go". After a fix witness cannot see (code, a tool, an account), `witness retry <target>` tells
|
|
373
|
+
drive to try a stuck or capped target again.
|
|
362
374
|
- **Keep the host awake.** A suspend longer than an hour mid-run expires the prompt
|
|
363
|
-
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
|
|
364
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 —
|
|
365
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>`.
|
|
366
383
|
- **`CLAUDE_CODE_AUTO_COMPACT_WINDOW`** (set at CLI launch) lowers the harness's
|
|
367
384
|
auto-compaction threshold, as belt-and-suspenders under the fill relay. Compaction
|
|
368
385
|
stays the harness's continuity mechanism, never witness's; the variable is documented
|
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/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
|
}
|
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,79 @@
|
|
|
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.
|
|
48
|
+
export function lostWhy(platform, file, code, signal) {
|
|
49
|
+
if (signal !== null || code === null || code === 0)
|
|
50
|
+
return undefined;
|
|
51
|
+
if (platform === 'win32' && code === CTRL_C_EXIT)
|
|
52
|
+
return undefined;
|
|
53
|
+
return `${nameOf(file)} exited ${code}`;
|
|
54
|
+
}
|
|
55
|
+
export function keepAwake(env, platform, pid, onLost = () => { }) {
|
|
56
|
+
const a = awakeArgv(env, platform, pid);
|
|
57
|
+
if (a === undefined)
|
|
6
58
|
return { stop: () => { } };
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
59
|
+
let done = false; // stopped, or already reported lost
|
|
60
|
+
const lost = (why) => {
|
|
61
|
+
if (done || why === undefined)
|
|
62
|
+
return;
|
|
63
|
+
done = true;
|
|
64
|
+
onLost(why);
|
|
65
|
+
};
|
|
66
|
+
const child = spawn(a.file, a.args, { stdio: 'ignore', ...(a.env ? { env: { ...env, ...a.env } } : {}) });
|
|
67
|
+
// A helper that cannot hold the host costs the guard, never the run — but it says so.
|
|
68
|
+
child.on('error', (e) => lost(`${nameOf(a.file)} failed to start (${e.code ?? e.message})`));
|
|
69
|
+
child.on('exit', (code, signal) => lost(lostWhy(platform, a.file, code, signal)));
|
|
10
70
|
child.unref();
|
|
11
71
|
return {
|
|
12
|
-
|
|
13
|
-
stop: () => {
|
|
14
|
-
|
|
72
|
+
shown: a.shown,
|
|
73
|
+
stop: () => {
|
|
74
|
+
done = true;
|
|
75
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
76
|
+
child.kill('SIGTERM');
|
|
77
|
+
},
|
|
15
78
|
};
|
|
16
79
|
}
|
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
|
@@ -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,11 +50,12 @@ 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'),
|
|
54
58
|
trust: () => import('./verbs/trust.js'),
|
|
55
|
-
calibrate: () => import('./verbs/calibrate.js'),
|
|
56
59
|
// Row 116's valve. Exempt from the floor gate in `main`, because a repository that
|
|
57
60
|
// refuses every verb must still be able to run the one that unrefuses it.
|
|
58
61
|
floor: () => import('./verbs/floor.js'),
|
|
@@ -63,7 +66,6 @@ const VERB_USAGE = {
|
|
|
63
66
|
abandon: 'witness abandon <plan-id | effort-slug…>',
|
|
64
67
|
adopt: 'witness adopt <specs/... | plans/...>.md',
|
|
65
68
|
ask: 'witness ask <text> | --withdraw <id> [--note <why>]',
|
|
66
|
-
calibrate: 'witness calibrate <exact-model-id> [--suite all|reviewers|skills] [--only <name>] [--samples <n>] [--publish]',
|
|
67
69
|
check: 'witness check',
|
|
68
70
|
clean: 'witness clean',
|
|
69
71
|
draft: 'witness draft <ask-<id>|amend-<effort>|design-<spec-id>> [--file <json>]',
|
|
@@ -83,6 +85,7 @@ const VERB_USAGE = {
|
|
|
83
85
|
recap: 'witness recap --file <recap.json> [--ask <id>] [--amend]',
|
|
84
86
|
recover: 'witness recover [--complete | --rollback]',
|
|
85
87
|
rename: 'witness rename <old-id> <new-id>',
|
|
88
|
+
retry: 'witness retry <target>',
|
|
86
89
|
satisfy: 'witness satisfy <doc-id> --need <id | index | text>',
|
|
87
90
|
dismiss: 'witness dismiss <artifact> --deferral <id|index> --cause <superseded|lens-retired|judged-wrong> --note "<why>"',
|
|
88
91
|
ship: 'witness ship <plan-id> [--manual]',
|
|
@@ -90,9 +93,10 @@ const VERB_USAGE = {
|
|
|
90
93
|
status: 'witness status — flows · blocked docs · reconcile rows · pending gates (bare `witness` is the same screen)',
|
|
91
94
|
'step-close': 'witness step-close <plan-id> --step <id>',
|
|
92
95
|
sync: 'witness sync',
|
|
93
|
-
trust:
|
|
96
|
+
trust: "witness trust [<artifact-id>] [--cmd '<exact command>']… [--yes]",
|
|
94
97
|
'test-evidence': 'witness test-evidence <plan-id> --phase red|green [--step <id>]',
|
|
95
98
|
'verify-red': 'witness verify-red <plan-id> [--base <ref>] [--step <id>]',
|
|
99
|
+
wait: 'witness wait [--since <token>] — blocks until something new needs you · the chat runs it under autonomy',
|
|
96
100
|
};
|
|
97
101
|
// Row 116 moved the body to version.ts, which journal.ts can import without closing a
|
|
98
102
|
// 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/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-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}`;
|