@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/dist/verbs/check.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { readdirSync, existsSync
|
|
1
|
+
import { readdirSync, existsSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { adoptedCommits } from '../adopt.js';
|
|
4
4
|
import { EXIT, version } from '../cli.js';
|
|
5
5
|
import { pctOf, readFill, windowLabel } from '../context.js';
|
|
6
|
-
import {
|
|
7
|
-
import { CONTEXT_INSTALL,
|
|
6
|
+
import { HARNESSES, judgeLine, loadHarness, resolveDriver, resolveJudge, resolveSkills, skillPins, } from '../harness.js';
|
|
7
|
+
import { CONTEXT_INSTALL, payloadStale } from '../install.js';
|
|
8
8
|
import { latestPublished } from '../registry.js';
|
|
9
9
|
import { NPX_LATEST, compareTriple } from '../version.js';
|
|
10
10
|
import { probe } from '../probe.js';
|
|
@@ -19,7 +19,6 @@ import { basisMoved, planBasis, specBasis } from '../basis.js';
|
|
|
19
19
|
import { contentAtSha } from '../history.js';
|
|
20
20
|
import { effortStreams, readStream } from '../journal.js';
|
|
21
21
|
import { sourceTags } from '../matcher.js';
|
|
22
|
-
import { modelFloorLines } from '../model.js';
|
|
23
22
|
import { evaluateNeeds } from '../needs.js';
|
|
24
23
|
import { renderRefusal } from '../refusal.js';
|
|
25
24
|
import { pendingDecision } from '../rounds.js';
|
|
@@ -387,14 +386,7 @@ export async function run(ctx, argv = []) {
|
|
|
387
386
|
// root keeps its bare relative path; a worktree is named, or four checkouts of one
|
|
388
387
|
// repository all report `.claude/commands/witness.md` and the human cannot tell
|
|
389
388
|
// which of them is the rotten one.
|
|
390
|
-
const stale =
|
|
391
|
-
.filter((p) => {
|
|
392
|
-
const src = join(packageRoot(), p.from);
|
|
393
|
-
if (!existsSync(src) || !existsSync(join(home, p.to)))
|
|
394
|
-
return false;
|
|
395
|
-
return readFileSync(join(home, p.to), 'utf8') !== readFileSync(src, 'utf8');
|
|
396
|
-
})
|
|
397
|
-
.map((p) => (home === root ? p.to : `${home}: ${p.to}`)));
|
|
389
|
+
const stale = payloadStale(root, harness);
|
|
398
390
|
if (stale.length > 0) {
|
|
399
391
|
findings.push(f('warn', 'harness', `${name}: payload`, 'payload-stale', `${stale.join(' · ')} differ from what ${version()} ships — run ${NPX_LATEST} init --agent ${name}`));
|
|
400
392
|
}
|
|
@@ -437,18 +429,10 @@ export async function run(ctx, argv = []) {
|
|
|
437
429
|
// Every run, stated: a session without the reading is not broken canon, it runs on the step
|
|
438
430
|
// budget (§4.7), and the line is how the human learns which one this session is on.
|
|
439
431
|
ctx.out(kv('adapter', adapterLine(ctx.env, cfg.ok ? cfg.value.harness : undefined)));
|
|
440
|
-
// Judge first
|
|
441
|
-
//
|
|
442
|
-
//
|
|
443
|
-
// the findings table nor the exit code, which is a contract about canon validity (101).
|
|
444
|
-
// The calibration state reads the same here as on `status` (D98a) — one renderer, so
|
|
445
|
-
// the fact the gate run no longer repeats still reaches both orientation surfaces.
|
|
432
|
+
// Judge first: the line answers which reviewers this repo spawns. A stated line, never a
|
|
433
|
+
// finding — it touches neither the findings table nor the exit code, which is a contract
|
|
434
|
+
// about canon validity (101).
|
|
446
435
|
ctx.out(kv('judge', judgeLine(judgeR)));
|
|
447
|
-
if (cfg.ok) {
|
|
448
|
-
for (const line of modelFloorLines(root, cfg.value, judgeR.ok ? judgeR.value.harness.name : DEFAULT_HARNESS)) {
|
|
449
|
-
ctx.out(kv('model-floor', line));
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
436
|
ctx.out(kv('checks', `${canon.docs.length} docs · ${auditStateCommits(root).length} commits audited · ${errors.length} errors`));
|
|
453
437
|
return errors.length ? EXIT.FINDINGS : EXIT.OK;
|
|
454
438
|
}
|
package/dist/verbs/dashboard.js
CHANGED
|
@@ -6,9 +6,8 @@ import { departedStreams } from '../departure.js';
|
|
|
6
6
|
import { designArtifactCurrent, designPending } from '../design.js';
|
|
7
7
|
import { reconcileRows } from '../drift.js';
|
|
8
8
|
import { divergence, primaryRoot } from '../gitio.js';
|
|
9
|
-
import {
|
|
9
|
+
import { judgeLine, resolveJudge } from '../harness.js';
|
|
10
10
|
import { effortAbandoned, effortStreams, latestRecap, readStream } from '../journal.js';
|
|
11
|
-
import { modelFloorLines } from '../model.js';
|
|
12
11
|
import { unmetNeeds } from '../needs.js';
|
|
13
12
|
import { computeNext, flowAction, parkedGates } from './next.js';
|
|
14
13
|
import { renderRefusal } from '../refusal.js';
|
|
@@ -218,24 +217,17 @@ export async function run(ctx, _argv) {
|
|
|
218
217
|
const root = rootRes.value;
|
|
219
218
|
const cfg = loadConfig(root);
|
|
220
219
|
ctx.out(kv('witness', `${version()} · schema: ${cfg.ok ? cfg.value.schema : '?'}`));
|
|
221
|
-
// Row 105's judgment lane, not its session lane:
|
|
222
|
-
//
|
|
223
|
-
//
|
|
224
|
-
//
|
|
225
|
-
//
|
|
226
|
-
// finding, so both lines degrade to claude-code and say so.
|
|
220
|
+
// Row 105's judgment lane, not its session lane: the judge line is the one `check` prints,
|
|
221
|
+
// and a judge resolved on a different ladder would have `status` and `check` disagreeing
|
|
222
|
+
// about which reviewers the same repo spawns. `status` renders no handoff, so it has no
|
|
223
|
+
// driver. A broken harness config must not brick the dashboard — `check` reports that as
|
|
224
|
+
// a finding, so the line degrades to claude-code and says so.
|
|
227
225
|
//
|
|
228
226
|
// Resolved ABOVE the config guard because the flows table below needs it too, and
|
|
229
227
|
// resolving it twice is how one screen's two answers drift apart.
|
|
230
228
|
const judgeR = resolveJudge(ctx.env, cfg.ok ? cfg.value.harness : undefined);
|
|
231
229
|
if (cfg.ok) {
|
|
232
230
|
ctx.out(kv('judge', judgeLine(judgeR)));
|
|
233
|
-
// One line per distinct warning, labelled with the gates it applies to — per-gate
|
|
234
|
-
// model pins can put each gate in a different calibration state. Shared with
|
|
235
|
-
// `check` (D98a): the calibration fact must read the same on both surfaces.
|
|
236
|
-
for (const line of modelFloorLines(root, cfg.value, judgeR.ok ? judgeR.value.harness.name : DEFAULT_HARNESS)) {
|
|
237
|
-
ctx.out(kv('model-floor', line));
|
|
238
|
-
}
|
|
239
231
|
}
|
|
240
232
|
const txn = pendingTxn(root);
|
|
241
233
|
if (txn)
|
|
@@ -316,13 +308,13 @@ export async function run(ctx, _argv) {
|
|
|
316
308
|
// re-derived shorthand (flowAction's own contract) — so the judge is passed here
|
|
317
309
|
// too, even though the flows table has no note column and nothing changes on
|
|
318
310
|
// screen. Diverging the arguments is how the shorthand creeps back in.
|
|
319
|
-
const action = flowAction(root, cfg.value, d, judgeR.ok ? judgeR.value.harness.name : undefined);
|
|
311
|
+
const action = flowAction(root, cfg.value, d, judgeR.ok ? judgeR.value.harness.name : undefined, ctx.env);
|
|
320
312
|
if (!action)
|
|
321
313
|
return [];
|
|
322
314
|
const id = String(d.meta.id);
|
|
323
315
|
return [{
|
|
324
316
|
id,
|
|
325
|
-
stage: action.stage ?? 'gate',
|
|
317
|
+
stage: action.stage ?? (action.trust !== undefined ? 'trust' : 'gate'),
|
|
326
318
|
next: action.line,
|
|
327
319
|
worktree: existsSync(worktreePath(root, id)) ? 'present' : 'missing',
|
|
328
320
|
pr: d.meta.pr ?? '—',
|
package/dist/verbs/init.js
CHANGED
|
@@ -20,10 +20,10 @@ const GITIGNORE_BLOCK = `# witness local (never committed)
|
|
|
20
20
|
.witness/drive.log
|
|
21
21
|
.witness/txn.json
|
|
22
22
|
.witness/allow.json
|
|
23
|
-
.witness/calibration.local.yaml
|
|
24
23
|
.witness/config.local.yaml
|
|
25
24
|
.witness/screens/
|
|
26
25
|
.witness/drafts/
|
|
26
|
+
.witness/live/
|
|
27
27
|
`;
|
|
28
28
|
const PRINCIPLES_BODY = `# Principles
|
|
29
29
|
|
package/dist/verbs/migrate.js
CHANGED
|
@@ -23,7 +23,7 @@ function filledWhy(path) {
|
|
|
23
23
|
if (path === 'harness')
|
|
24
24
|
return "was undeclared · the open session's harness judged";
|
|
25
25
|
if (path.endsWith('.model'))
|
|
26
|
-
return 'was unpinned · the
|
|
26
|
+
return 'was unpinned · the harness default model answered';
|
|
27
27
|
if (path === 'criteria.runner')
|
|
28
28
|
return 'was unset · criteria could not run';
|
|
29
29
|
return `was unset · ship reported ${path === 'ship.test' ? 'tests' : 'lint'} not configured`;
|
package/dist/verbs/next.js
CHANGED
|
@@ -17,6 +17,10 @@ import { changedFiles, diffBase, evidenceForDiff, isTestPath } from '../evidence
|
|
|
17
17
|
import { greenOwedOn, greenOwedStep, hasCriteriaStep, implementGated, lastRedVacuous, redCycleClosed, redInFlight, stepProgress, stepsLine, } from '../steps.js';
|
|
18
18
|
import { SESSION_DEFAULT, stagePin } from '../model.js';
|
|
19
19
|
import { handoffLine, relayLine, resolveDriver, resolveJudge } from '../harness.js';
|
|
20
|
+
import { payloadStale } from '../install.js';
|
|
21
|
+
import { NPX_LATEST } from '../version.js';
|
|
22
|
+
import { liveDrive } from '../live.js';
|
|
23
|
+
import { HELD_KINDS, needsYou, needsYouToken } from '../needs-you.js';
|
|
20
24
|
import { atHome, worktreeFlow, worktreePath } from '../worktree.js';
|
|
21
25
|
import { lazyStamp } from '../stamp.js';
|
|
22
26
|
import { ok, refuse, renderRefusal, v } from '../refusal.js';
|
|
@@ -24,7 +28,8 @@ import { cmd, kv, rows } from '../toon.js';
|
|
|
24
28
|
import { openDeferrals } from '../deferral.js';
|
|
25
29
|
import { renderDecision } from '../recommend.js';
|
|
26
30
|
import { recoverChoice } from './recover.js';
|
|
27
|
-
import { autonomyLines, policyFor, unmetNeedLine } from '../autonomy.js';
|
|
31
|
+
import { autonomyLines, keptStopLine, policyFor, unmetNeedLine } from '../autonomy.js';
|
|
32
|
+
import { grantOf, shownCmd, trustOwed } from '../allowlist.js';
|
|
28
33
|
import { ROUND_BOUND, boundReached, lastGateRun, liveExits, openReopen, pendingDecision, reopenCommand } from '../rounds.js';
|
|
29
34
|
import { driveChild, driveHolder, watchLine } from '../drive-presence.js';
|
|
30
35
|
import { reportHandover, reportOpening } from '../slice.js';
|
|
@@ -278,11 +283,31 @@ function decomposeOwed(root, canon, e, specs, plans) {
|
|
|
278
283
|
return !specsApproved && !gateSettled(e.entries, 'decompose', effortReviewedSha(root, canon, e.slug).sha) &&
|
|
279
284
|
!gateParked(e.entries, 'decompose');
|
|
280
285
|
}
|
|
286
|
+
// Row 205. The trust act: the human names, in the chat, each command to trust. The listing
|
|
287
|
+
// form of the verb, which grants nothing, so a routed line run verbatim cannot over-grant.
|
|
288
|
+
export function trustAction(target, owed) {
|
|
289
|
+
return {
|
|
290
|
+
line: `witness trust ${target}`, target, trust: owed,
|
|
291
|
+
note: `not trusted on this machine — ${owed.map(shownCmd).join(' · ')} · the human names each to trust it`,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
// An action whose verb runs a config command this machine does not trust is the trust act.
|
|
295
|
+
function withTrust(root, env, cfg, canon, a) {
|
|
296
|
+
if (a.target === undefined)
|
|
297
|
+
return a;
|
|
298
|
+
const owed = trustOwed(root, env, cfg, canon, a);
|
|
299
|
+
return owed.length > 0 ? trustAction(a.target, owed) : a;
|
|
300
|
+
}
|
|
281
301
|
// The action for ONE flow. A flow is a plan with status `in-progress`: it begins at
|
|
282
302
|
// `witness start` and ends at the merge stamp. Anything else returns undefined and is
|
|
283
303
|
// not a flow. Exported because `--flow` and the dashboard must answer with the SAME
|
|
284
|
-
// derivation next uses, never a re-derived shorthand
|
|
285
|
-
|
|
304
|
+
// derivation next uses, never a re-derived shorthand — the trust check included (row 205),
|
|
305
|
+
// so `--flow`, a worktree's `next` and the ladder agree.
|
|
306
|
+
export function flowAction(root, cfg, plan, judge, env) {
|
|
307
|
+
const a = flowStep(root, cfg, plan, judge);
|
|
308
|
+
return a && withTrust(root, env, cfg, { docs: [plan] }, a);
|
|
309
|
+
}
|
|
310
|
+
function flowStep(root, cfg, plan, judge) {
|
|
286
311
|
const id = String(plan.meta.id);
|
|
287
312
|
if (String(plan.meta.status) !== 'in-progress')
|
|
288
313
|
return undefined;
|
|
@@ -686,7 +711,7 @@ export function computeNext(root, ctx, canon, cfg, opts = {}) {
|
|
|
686
711
|
const flows = plans
|
|
687
712
|
.filter((plan) => admits(String(plan.meta.id)))
|
|
688
713
|
.filter((plan) => !flowBlocked(root, plan, readStream(root, String(plan.meta.id))))
|
|
689
|
-
.map((plan) => flowAction(root, cfg, plan, judge))
|
|
714
|
+
.map((plan) => flowAction(root, cfg, plan, judge, ctx.env))
|
|
690
715
|
.filter((a) => a !== undefined)
|
|
691
716
|
.sort((a, b) => flowRank(b) - flowRank(a) || String(a.target).localeCompare(String(b.target)));
|
|
692
717
|
if (flows.length > 0) {
|
|
@@ -919,10 +944,10 @@ export function computeNext(root, ctx, canon, cfg, opts = {}) {
|
|
|
919
944
|
};
|
|
920
945
|
const free = approved.find((p) => waitsOn(p).length === 0);
|
|
921
946
|
if (free !== undefined)
|
|
922
|
-
return { line: `witness start ${String(free.meta.id)}`, target: String(free.meta.id) };
|
|
947
|
+
return withTrust(root, ctx.env, cfg, canon, { line: `witness start ${String(free.meta.id)}`, target: String(free.meta.id) });
|
|
923
948
|
const first = approved[0];
|
|
924
949
|
const id = String(first.meta.id);
|
|
925
|
-
return { line: `witness start ${id}`, target: id, note: `${id} waits on an unmet need — ${waitsOn(first).join(' · ')}` };
|
|
950
|
+
return withTrust(root, ctx.env, cfg, canon, { line: `witness start ${id}`, target: id, note: `${id} waits on an unmet need — ${waitsOn(first).join(' · ')}` });
|
|
926
951
|
}
|
|
927
952
|
// Rule B — the ladder is exhausted. Same line as rule A (canon errors, the early
|
|
928
953
|
// return above) but a different state; the note is what tells them apart on screen
|
|
@@ -958,14 +983,14 @@ export function conversationDraft(root, action) {
|
|
|
958
983
|
// A stop that waits for the human: a decision the CLI could not settle, a conversation, or a
|
|
959
984
|
// start an unmet manual need blocks. Drive sets each aside, so none is work to launch it for.
|
|
960
985
|
function humanStop(canon, a) {
|
|
961
|
-
if (a.line.startsWith('witness decide ') || conversationStage(a))
|
|
986
|
+
if (a.line.startsWith('witness decide ') || a.line.startsWith('witness trust ') || conversationStage(a))
|
|
962
987
|
return true;
|
|
963
988
|
return a.line.startsWith('witness start ') &&
|
|
964
989
|
unmetNeeds(canon).some((u) => u.doc === a.target && u.blocks === 'start');
|
|
965
990
|
}
|
|
966
991
|
// The ladder with the human's stops set aside, the way drive's fill reads it. A target-less stop
|
|
967
992
|
// (an ask's grill) is held once, as drive holds `-`, so the machine work below it still counts.
|
|
968
|
-
function driveHasWork(root, ctx, canon, cfg, first) {
|
|
993
|
+
export function driveHasWork(root, ctx, canon, cfg, first) {
|
|
969
994
|
const held = new Set();
|
|
970
995
|
let targetless = false;
|
|
971
996
|
for (let a = first;;) {
|
|
@@ -983,17 +1008,17 @@ function driveHasWork(root, ctx, canon, cfg, first) {
|
|
|
983
1008
|
}
|
|
984
1009
|
}
|
|
985
1010
|
// Row 195. The ladder with drive's work set aside, the mirror of `driveHasWork`: the first
|
|
986
|
-
// item an autonomous chat keeps for the human — a conversation,
|
|
987
|
-
//
|
|
988
|
-
//
|
|
989
|
-
//
|
|
1011
|
+
// item an autonomous chat keeps for the human — a conversation, a decision they settle in the
|
|
1012
|
+
// chat, or a trust grant they name in it (row 205: a gate's kept trust grant too, no longer
|
|
1013
|
+
// answered in a terminal). Everything else is held aside, need-blocked starts included. A
|
|
1014
|
+
// target-less action that is no conversation (the recovery fork) is the ladder's own, and the
|
|
990
1015
|
// walk never passes it.
|
|
991
|
-
export function humanAction(root, ctx, canon, cfg, first
|
|
1016
|
+
export function humanAction(root, ctx, canon, cfg, first) {
|
|
992
1017
|
const held = new Set();
|
|
993
1018
|
for (let a = first;;) {
|
|
994
1019
|
if (conversationStage(a))
|
|
995
1020
|
return a;
|
|
996
|
-
if (a.line.startsWith('witness decide ')
|
|
1021
|
+
if (a.line.startsWith('witness decide ') || a.line.startsWith('witness trust '))
|
|
997
1022
|
return a;
|
|
998
1023
|
if (a.line === 'witness check' || a.target === undefined || held.has(a.target))
|
|
999
1024
|
return undefined;
|
|
@@ -1081,8 +1106,6 @@ export async function run(ctx, argv) {
|
|
|
1081
1106
|
const marked = driveChild(ctx.env);
|
|
1082
1107
|
const scope = marked ? (t) => t === marked.target : undefined;
|
|
1083
1108
|
let routed;
|
|
1084
|
-
// Row 195. Targets whose stop the human settles outside a chat: the trust grants left kept.
|
|
1085
|
-
const outside = new Set();
|
|
1086
1109
|
if (cfgR.value.autonomy) {
|
|
1087
1110
|
const { settleOwed, settledLine } = await import('../settle.js');
|
|
1088
1111
|
const reports = await settleOwed(ctx, root, cfgR.value, scope ? { scope } : {});
|
|
@@ -1095,8 +1118,6 @@ export async function run(ctx, argv) {
|
|
|
1095
1118
|
if (routed === undefined && r.settled.kind === 'routed') {
|
|
1096
1119
|
routed = { command: r.settled.line.replace(/^autonomy: re-run owed — /, ''), target: r.target };
|
|
1097
1120
|
}
|
|
1098
|
-
if (r.settled.kind === 'kept' && r.settled.stop === 'trust-grant')
|
|
1099
|
-
outside.add(r.target);
|
|
1100
1121
|
}
|
|
1101
1122
|
}
|
|
1102
1123
|
const { values } = parseArgs({ args: argv, options: { flow: { type: 'string' } }, allowPositionals: true });
|
|
@@ -1115,7 +1136,7 @@ export async function run(ctx, argv) {
|
|
|
1115
1136
|
renderRefusal(flowR.violations).forEach((l) => ctx.err(l));
|
|
1116
1137
|
return EXIT.REFUSED;
|
|
1117
1138
|
}
|
|
1118
|
-
action = flowAction(root, cfgR.value, flowR.value, judge) ?? { line: 'witness check', target: values.flow };
|
|
1139
|
+
action = flowAction(root, cfgR.value, flowR.value, judge, ctx.env) ?? { line: 'witness check', target: values.flow };
|
|
1119
1140
|
}
|
|
1120
1141
|
else if (scope) {
|
|
1121
1142
|
// The drive marker outranks the worktree's ambient flow: drive assigned this session
|
|
@@ -1126,7 +1147,7 @@ export async function run(ctx, argv) {
|
|
|
1126
1147
|
const inferred = worktreeFlow(ctx.cwd, root);
|
|
1127
1148
|
const ambient = inferred !== undefined ? findById(canon, inferred) : undefined;
|
|
1128
1149
|
const scoped = ambient && ambient.meta.type === 'plan'
|
|
1129
|
-
? flowAction(root, cfgR.value, ambient, judge)
|
|
1150
|
+
? flowAction(root, cfgR.value, ambient, judge, ctx.env)
|
|
1130
1151
|
: undefined;
|
|
1131
1152
|
if (scoped)
|
|
1132
1153
|
ambientFlow = inferred;
|
|
@@ -1145,7 +1166,7 @@ export async function run(ctx, argv) {
|
|
|
1145
1166
|
// scope: the walk reads the whole ladder, which would route past the flow the session is on.
|
|
1146
1167
|
const ladder = action;
|
|
1147
1168
|
const chat = cfgR.value.autonomy && marked === undefined && values.flow === undefined && ambientFlow === undefined;
|
|
1148
|
-
const human = chat ? humanAction(root, ctx, canon, cfgR.value, ladder
|
|
1169
|
+
const human = chat ? humanAction(root, ctx, canon, cfgR.value, ladder) : undefined;
|
|
1149
1170
|
// The ladder's own action already carries its deferral note; one the walk reached does not yet.
|
|
1150
1171
|
if (human !== undefined && human !== ladder)
|
|
1151
1172
|
action = withDeferralNote(root, canon, human);
|
|
@@ -1164,6 +1185,21 @@ export async function run(ctx, argv) {
|
|
|
1164
1185
|
// reason as the lines above.
|
|
1165
1186
|
if (chat)
|
|
1166
1187
|
needNotices(canon).forEach((l) => ctx.out(l));
|
|
1188
|
+
// Final review. What waits on the human that no `next:` routes — a target drive set aside as
|
|
1189
|
+
// stuck or capped, a merge, a parked gate — is said here, once per line with its command, so a
|
|
1190
|
+
// chat that starts beside a paused drive sees it rather than folding it into its wait token.
|
|
1191
|
+
const owed = chat ? needsYou(root, ctx, cfgR.value, canon, liveDrive(root, canon)?.asides ?? []) : [];
|
|
1192
|
+
for (const i of owed.filter((x) => HELD_KINDS.has(x.kind))) {
|
|
1193
|
+
const [head, ...more] = i.rows;
|
|
1194
|
+
ctx.out(cmd('waiting', [head.replace(/^wait: /, ''), ...more.map((r) => r.trim())].join(' · ')));
|
|
1195
|
+
}
|
|
1196
|
+
// Row 205. Under autonomy each untrusted command is a kept stop, one raw line each (D120),
|
|
1197
|
+
// with the grant that names it — paste-ready whatever quotes the command carries.
|
|
1198
|
+
if (cfgR.value.autonomy && action.trust !== undefined && action.target !== undefined) {
|
|
1199
|
+
for (const c of action.trust) {
|
|
1200
|
+
ctx.out(keptStopLine('trust-grant', `${shownCmd(c)} · ${grantOf(action.target, c)}`));
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1167
1203
|
reportOpening(ctx, root, cfgR.value);
|
|
1168
1204
|
ctx.out(kv('next', action.line));
|
|
1169
1205
|
if (action.stage)
|
|
@@ -1210,16 +1246,33 @@ export async function run(ctx, argv) {
|
|
|
1210
1246
|
// session's turn ends anyway: at a decision left for a human, with nothing owed, or with the run
|
|
1211
1247
|
// handed to drive and nothing kept for the human (row 195: a routed conversation keeps the
|
|
1212
1248
|
// guard). And never mid-red (`midRed`: a red in flight).
|
|
1213
|
-
const turnEnds = (toDrive && human === undefined) || action.line.startsWith('witness decide ') ||
|
|
1249
|
+
const turnEnds = (toDrive && human === undefined) || action.line.startsWith('witness decide ') ||
|
|
1250
|
+
action.line.startsWith('witness trust ') || action.line === 'witness check';
|
|
1214
1251
|
if (!elsewhere && !turnEnds && action.midRed !== true)
|
|
1215
1252
|
reportHandover(ctx, root, cfgR.value, { guard: true });
|
|
1216
1253
|
if (assigned !== undefined && values.flow === undefined && action.line === 'witness check' && action.note === NOTHING_OWED) {
|
|
1217
1254
|
ctx.out(kv('drive', `done — nothing more is owed for ${assigned}`));
|
|
1218
1255
|
}
|
|
1219
1256
|
// Last, so it never splits the routing unit, and raw, because both lines are commands (D120).
|
|
1220
|
-
|
|
1221
|
-
|
|
1257
|
+
// Row 204: `watch:` whenever a drive holds the lock — a paused one included, which has no
|
|
1258
|
+
// work of its own and waits on the human.
|
|
1259
|
+
const holder = cfgR.value.autonomy && marked === undefined ? driveHolder(root) : undefined;
|
|
1260
|
+
if (toDrive || holder !== undefined) {
|
|
1222
1261
|
ctx.out(holder !== undefined ? cmd('watch', watchLine(holder)) : cmd('launch', 'witness drive --detach'));
|
|
1223
1262
|
}
|
|
1263
|
+
// Row 204. With nothing routed for the human and drive running or launched, the chat sleeps
|
|
1264
|
+
// until something new needs the human: the token names the list it saw, and the mode is its
|
|
1265
|
+
// harness's way to be woken. A Pi add-on older than this CLI may not wake it, so that chat is
|
|
1266
|
+
// told and waits in the foreground.
|
|
1267
|
+
if (chat && human === undefined && (toDrive || holder !== undefined)) {
|
|
1268
|
+
const items = owed;
|
|
1269
|
+
let mode = harness.waitMode;
|
|
1270
|
+
if (harness.name === 'pi' && payloadStale(root, harness).length > 0) {
|
|
1271
|
+
ctx.out(kv('warn', `the witness Pi add-on is older than this CLI — this chat waits in the foreground · run ${NPX_LATEST} init --agent pi`));
|
|
1272
|
+
mode = 'foreground';
|
|
1273
|
+
}
|
|
1274
|
+
ctx.out(cmd('wait', `witness wait --since ${needsYouToken(items)}`));
|
|
1275
|
+
ctx.out(kv('wait-mode', mode));
|
|
1276
|
+
}
|
|
1224
1277
|
return EXIT.OK;
|
|
1225
1278
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { EXIT } from '../cli.js';
|
|
2
|
+
import { sessionMarker } from '../drive-presence.js';
|
|
3
|
+
import { appendEntry, effortStreams, entryLine, journalRel } from '../journal.js';
|
|
4
|
+
import { primaryRoot, stateCommit } from '../gitio.js';
|
|
5
|
+
import { acquireLock } from '../lock.js';
|
|
6
|
+
import { renderRefusal, v } from '../refusal.js';
|
|
7
|
+
import { findById, loadCanon } from '../scan.js';
|
|
8
|
+
import { kv } from '../toon.js';
|
|
9
|
+
import { crashPoint, guardTxn, withTxn } from '../txn.js';
|
|
10
|
+
// Row 207. Drive sets a target aside as stuck or capped when sessions stop moving it, and
|
|
11
|
+
// takes it back only when its record moves. A fix made outside witness — code, a tool, an
|
|
12
|
+
// account — leaves no record, so the human says so here: one entry on the target's own stream.
|
|
13
|
+
export async function run(ctx, argv) {
|
|
14
|
+
const id = argv[0];
|
|
15
|
+
if (!id || id.startsWith('-') || argv.length > 1) {
|
|
16
|
+
renderRefusal([v('usage', 'required', argv.join(' ') || 'missing target', 'witness retry <target>')]).forEach(ctx.err);
|
|
17
|
+
return EXIT.REFUSED;
|
|
18
|
+
}
|
|
19
|
+
// A session never un-sticks itself: the retry is the human's word that something changed.
|
|
20
|
+
const marker = sessionMarker(ctx.env);
|
|
21
|
+
if (marker !== undefined) {
|
|
22
|
+
renderRefusal([v('retry', 'retry-in-session', marker, 'the human retries from their own chat or terminal')]).forEach(ctx.err);
|
|
23
|
+
return EXIT.REFUSED;
|
|
24
|
+
}
|
|
25
|
+
const rootRes = primaryRoot(ctx.cwd);
|
|
26
|
+
if (!rootRes.ok) {
|
|
27
|
+
renderRefusal(rootRes.violations).forEach(ctx.err);
|
|
28
|
+
return EXIT.REFUSED;
|
|
29
|
+
}
|
|
30
|
+
const root = rootRes.value;
|
|
31
|
+
const blocked = guardTxn(ctx, root);
|
|
32
|
+
if (blocked !== undefined)
|
|
33
|
+
return blocked;
|
|
34
|
+
// A canon doc, or an effort: drive sets effort-level work aside too (a decompose owed).
|
|
35
|
+
if (!findById(loadCanon(root), id) && !effortStreams(root).includes(id)) {
|
|
36
|
+
renderRefusal([v('id', 'unknown-doc', id, 'a doc id from witness index, or an effort slug')]).forEach(ctx.err);
|
|
37
|
+
return EXIT.REFUSED;
|
|
38
|
+
}
|
|
39
|
+
const lock = acquireLock(root);
|
|
40
|
+
if (!lock.ok) {
|
|
41
|
+
renderRefusal(lock.violations).forEach(ctx.err);
|
|
42
|
+
return EXIT.BLOCKED;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const entry = { t: 'retry', artifact: id };
|
|
46
|
+
const stream = journalRel(id);
|
|
47
|
+
const res = withTxn(root, { op: `retry(${id})`, files: [stream], journal: { stream: id, line: entryLine(entry) } }, () => {
|
|
48
|
+
appendEntry(root, id, entry);
|
|
49
|
+
crashPoint(ctx.env, 'journal-append');
|
|
50
|
+
return stateCommit(root, [stream], `retry(${id})`);
|
|
51
|
+
});
|
|
52
|
+
if (!res.ok) {
|
|
53
|
+
renderRefusal(res.violations).forEach(ctx.err);
|
|
54
|
+
return EXIT.REFUSED;
|
|
55
|
+
}
|
|
56
|
+
ctx.out(kv('retried', id));
|
|
57
|
+
return EXIT.OK;
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
lock.value();
|
|
61
|
+
}
|
|
62
|
+
}
|
package/dist/verbs/trust.js
CHANGED
|
@@ -1,23 +1,58 @@
|
|
|
1
|
+
import { parseArgs } from 'node:util';
|
|
1
2
|
import { EXIT } from '../cli.js';
|
|
2
|
-
import { grantCommands, trustedCommands } from '../allowlist.js';
|
|
3
|
+
import { commandsRun, grantCommands, repoCommands, trustedCommands } from '../allowlist.js';
|
|
4
|
+
import { loadConfig } from '../config.js';
|
|
5
|
+
import { sessionMarker } from '../drive-presence.js';
|
|
3
6
|
import { primaryRoot, stateCommit } from '../gitio.js';
|
|
4
7
|
import { appendEntry, entryLine, journalRel } from '../journal.js';
|
|
5
8
|
import { renderRefusal, v } from '../refusal.js';
|
|
6
9
|
import { effortOf } from '../reviewed.js';
|
|
7
10
|
import { findById, loadCanon } from '../scan.js';
|
|
8
|
-
import { kv, rows } from '../toon.js';
|
|
11
|
+
import { cmd as cmdLine, hasControl, kv, rows, shellArg, visible } from '../toon.js';
|
|
9
12
|
import { guardTxn, withTxn } from '../txn.js';
|
|
13
|
+
const USAGE = "witness trust [<artifact-id>] [--cmd '<exact command>']… [--yes]";
|
|
10
14
|
// D154. The green-path half. Trust rides the decision surface wherever a stop exists
|
|
11
15
|
// (`decide --approve --trust-cmds`), but a green-path class never stops — and a headless
|
|
12
16
|
// gate that blocks every untrusted command with no verb to unblock it is the Aug 1
|
|
13
17
|
// false negative with a nicer message. This is that verb.
|
|
14
18
|
//
|
|
19
|
+
// Row 205 (issue #56). It lists every command the target's flow runs — the config commands,
|
|
20
|
+
// the spec's `cmd:` criteria for a plan, the target's `cmd:` needs — and grants only what the
|
|
21
|
+
// human names: `--cmd '<exact>'` per command, `--yes` for all of them only at a terminal, and
|
|
22
|
+
// nothing from inside a session drive spawned or a reviewer runs in (row 173's rule, extended
|
|
23
|
+
// from `decide` to the verb). A bare nod is never a grant (D143).
|
|
24
|
+
//
|
|
15
25
|
// The trust list resolves at the PRIMARY ROOT, like the runner config it governs: a branch
|
|
16
26
|
// checkout cannot re-point what the repository trusts or runs (D132's doctrine).
|
|
17
27
|
export async function run(ctx, argv) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
let parsed;
|
|
29
|
+
try {
|
|
30
|
+
parsed = parseArgs({
|
|
31
|
+
args: argv, allowPositionals: true,
|
|
32
|
+
options: { cmd: { type: 'string', multiple: true }, yes: { type: 'boolean' } },
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
renderRefusal([v('usage', 'bad-flag', e.message, USAGE)]).forEach((l) => ctx.err(l));
|
|
37
|
+
return EXIT.REFUSED;
|
|
38
|
+
}
|
|
39
|
+
const { values, positionals } = parsed;
|
|
40
|
+
const id = positionals[0];
|
|
41
|
+
const named = values.cmd ?? [];
|
|
42
|
+
const granting = named.length > 0 || values.yes === true;
|
|
43
|
+
if (positionals.length > 1 || (granting && id === undefined)) {
|
|
44
|
+
renderRefusal([v('usage', 'required', positionals.length > 1 ? positionals.join(' ') : 'no target', 'a grant names its target, which the act is journaled against: ' + USAGE)]).forEach((l) => ctx.err(l));
|
|
45
|
+
return EXIT.REFUSED;
|
|
46
|
+
}
|
|
47
|
+
const marker = sessionMarker(ctx.env);
|
|
48
|
+
if (granting && marker !== undefined) {
|
|
49
|
+
renderRefusal([v('trust', 'trust-in-session', marker, 'the human grants trust in their own chat or terminal')])
|
|
50
|
+
.forEach((l) => ctx.err(l));
|
|
51
|
+
return EXIT.REFUSED;
|
|
52
|
+
}
|
|
53
|
+
if (values.yes === true && !ctx.isTTY) {
|
|
54
|
+
renderRefusal([v('--yes', 'yes-needs-terminal', 'no terminal', `name each command: witness trust ${id} --cmd '<cmd>'`)])
|
|
55
|
+
.forEach((l) => ctx.err(l));
|
|
21
56
|
return EXIT.REFUSED;
|
|
22
57
|
}
|
|
23
58
|
const rootR = primaryRoot(ctx.cwd);
|
|
@@ -29,49 +64,94 @@ export async function run(ctx, argv) {
|
|
|
29
64
|
const blocked = guardTxn(ctx, root);
|
|
30
65
|
if (blocked !== undefined)
|
|
31
66
|
return blocked;
|
|
67
|
+
const cfgR = loadConfig(root);
|
|
68
|
+
if (!cfgR.ok) {
|
|
69
|
+
renderRefusal(cfgR.violations).forEach((l) => ctx.err(l));
|
|
70
|
+
return EXIT.REFUSED;
|
|
71
|
+
}
|
|
32
72
|
const canon = loadCanon(root);
|
|
73
|
+
const trusted = new Set(trustedCommands(root));
|
|
74
|
+
const status = (cmd) => trusted.has(cmd) ? 'trusted' : hasControl(cmd) ? 'unsafe' : 'untrusted';
|
|
75
|
+
// Every repo-authored field is shown escaped: a criterion's or a need's id rides in `source`.
|
|
76
|
+
const shown = (c) => ({
|
|
77
|
+
...c, cmd: visible(c.cmd), source: visible(c.source), ...(c.doc !== undefined ? { doc: visible(c.doc) } : {}), status: status(c.cmd),
|
|
78
|
+
});
|
|
79
|
+
// Nothing left to grant is not "all trusted" while an unsafe command stays blocked.
|
|
80
|
+
const settled = (cmds) => {
|
|
81
|
+
const unsafe = cmds.filter((c) => status(c) === 'unsafe').length;
|
|
82
|
+
if (unsafe === 0) {
|
|
83
|
+
ctx.out(kv('trust', 'every command is already trusted'));
|
|
84
|
+
return EXIT.OK;
|
|
85
|
+
}
|
|
86
|
+
ctx.out(kv('trust', `${unsafe} carry characters outside printable ASCII — never granted here · rewrite where it is written`));
|
|
87
|
+
return EXIT.FINDINGS;
|
|
88
|
+
};
|
|
89
|
+
if (id === undefined) {
|
|
90
|
+
const all = repoCommands(cfgR.value, canon);
|
|
91
|
+
rows('commands', ['cmd', 'source', 'doc', 'status'], all.map(shown)).forEach((l) => ctx.out(l));
|
|
92
|
+
const pending = [...new Set(all.map((c) => c.cmd).filter((c) => status(c) === 'untrusted'))];
|
|
93
|
+
if (pending.length === 0)
|
|
94
|
+
return settled(all.map((c) => c.cmd));
|
|
95
|
+
ctx.out(kv('trust', `${pending.length} untrusted — grant each from the target that runs it: witness trust <id> --cmd '<cmd>'`));
|
|
96
|
+
return EXIT.FINDINGS;
|
|
97
|
+
}
|
|
33
98
|
const doc = findById(canon, id);
|
|
34
99
|
if (!doc) {
|
|
35
100
|
renderRefusal([v('artifact', 'unknown-artifact', id, 'an existing canon doc id', 'witness index')])
|
|
36
101
|
.forEach((l) => ctx.err(l));
|
|
37
102
|
return EXIT.REFUSED;
|
|
38
103
|
}
|
|
39
|
-
const
|
|
40
|
-
const cmds = [...new Set(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
104
|
+
const listed = commandsRun(cfgR.value, canon, doc);
|
|
105
|
+
const cmds = [...new Set(listed.map((c) => c.cmd))];
|
|
106
|
+
const unsafe = named.find(hasControl);
|
|
107
|
+
if (unsafe !== undefined) {
|
|
108
|
+
renderRefusal([v('--cmd', 'control-characters', visible(unsafe), 'a command of printable ASCII — any other character can hide what it runs')]).forEach((l) => ctx.err(l));
|
|
109
|
+
return EXIT.REFUSED;
|
|
44
110
|
}
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
ctx.out(kv('trust', 'every cmd: criterion is already trusted'));
|
|
51
|
-
return EXIT.OK;
|
|
111
|
+
const unknown = named.filter((c) => !cmds.includes(c));
|
|
112
|
+
if (unknown.length > 0) {
|
|
113
|
+
renderRefusal([v('--cmd', 'unknown-command', unknown[0], `one of: ${cmds.map(visible).join(' · ') || '(nothing to trust)'}`)])
|
|
114
|
+
.forEach((l) => ctx.err(l));
|
|
115
|
+
return EXIT.REFUSED;
|
|
52
116
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (argv.includes('--yes')) {
|
|
57
|
-
granting.push(...pending);
|
|
117
|
+
if (cmds.length === 0) {
|
|
118
|
+
ctx.out(kv('trust', `${id} runs no command — nothing to trust`));
|
|
119
|
+
return EXIT.OK;
|
|
58
120
|
}
|
|
59
|
-
|
|
121
|
+
rows('commands', ['cmd', 'source', 'status'], listed.map(shown)).forEach((l) => ctx.out(l));
|
|
122
|
+
// An unsafe command is listed and never pending: no flag and no prompt grants it.
|
|
123
|
+
const pending = cmds.filter((c) => status(c) === 'untrusted');
|
|
124
|
+
if (pending.length === 0)
|
|
125
|
+
return settled(cmds);
|
|
126
|
+
// One command at a time, because a blanket yes is a different act from four considered ones:
|
|
127
|
+
// the named ones, all at a terminal's --yes, or the terminal's own per-command prompt.
|
|
128
|
+
const grant = [];
|
|
129
|
+
if (named.length > 0)
|
|
130
|
+
grant.push(...pending.filter((c) => named.includes(c)));
|
|
131
|
+
else if (values.yes === true)
|
|
132
|
+
grant.push(...pending);
|
|
133
|
+
else if (ctx.isTTY && marker === undefined) {
|
|
60
134
|
for (const cmd of pending) {
|
|
61
135
|
const answer = await ctx.ask(`trust: ${cmd}\ngrant? saves to .witness/allow.json (gitignored) [y/N]`);
|
|
62
136
|
if (answer.trim().toLowerCase().startsWith('y'))
|
|
63
|
-
|
|
137
|
+
grant.push(cmd);
|
|
64
138
|
}
|
|
65
139
|
}
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
140
|
+
if (grant.length === 0) {
|
|
141
|
+
if (named.length > 0) {
|
|
142
|
+
ctx.out(kv('trust', `already trusted: ${named.join(' · ')}`));
|
|
143
|
+
return EXIT.OK;
|
|
144
|
+
}
|
|
145
|
+
// Listing is the honest answer for a caller that granted nothing: exiting 0 would say the
|
|
146
|
+
// opposite. Each line pastes as one argument, whatever quotes the command carries.
|
|
147
|
+
ctx.out(kv('trust', `${pending.length} untrusted — the human names each to trust it`));
|
|
148
|
+
for (const c of pending)
|
|
149
|
+
ctx.out(cmdLine('run', `witness trust ${id} --cmd ${shellArg(c)}`));
|
|
70
150
|
return EXIT.FINDINGS;
|
|
71
151
|
}
|
|
72
|
-
grantCommands(root,
|
|
73
|
-
journalTrust(ctx, root, id,
|
|
74
|
-
ctx.out(kv('trusted',
|
|
152
|
+
grantCommands(root, grant);
|
|
153
|
+
journalTrust(ctx, root, id, grant);
|
|
154
|
+
ctx.out(kv('trusted', grant.join(' · ')));
|
|
75
155
|
return EXIT.OK;
|
|
76
156
|
}
|
|
77
157
|
// Journaled like every other human act. Best-effort on the txn, `journalRefusal`'s
|