@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
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { grantOf, shownCmd } from './allowlist.js';
|
|
3
|
+
import { TARGETLESS } from './drive-presence.js';
|
|
4
|
+
import { handoffLine, resolveDriver } from './harness.js';
|
|
5
|
+
import { readStream } from './journal.js';
|
|
6
|
+
import { unmetNeeds } from './needs.js';
|
|
7
|
+
import { findById } from './scan.js';
|
|
8
|
+
import { hasControl } from './toon.js';
|
|
9
|
+
import { pendingTxn } from './txn.js';
|
|
10
|
+
import { owedDecisions, parkedGates } from './verbs/next.js';
|
|
11
|
+
import { recoverChoice } from './verbs/recover.js';
|
|
12
|
+
export const WAIT_LABEL = {
|
|
13
|
+
'pending-txn': 'pending transaction', 'design-look': 'design look', 'trust-grant': 'trust grant', need: 'unmet need',
|
|
14
|
+
decision: 'decision', conversation: 'conversation', merge: 'merge', parked: 'parked', stuck: 'stuck', capped: 'capped',
|
|
15
|
+
};
|
|
16
|
+
// The kinds `next` never routes: the chat names each, with its command (final review).
|
|
17
|
+
export const HELD_KINDS = new Set(['merge', 'parked', 'stuck', 'capped']);
|
|
18
|
+
// The kinds the report counts as waits (each target once), in the order a human answers them.
|
|
19
|
+
export const WAIT_KINDS = new Set(['pending-txn', 'design-look', 'trust-grant', 'need', 'decision', 'conversation', 'merge']);
|
|
20
|
+
const prOf = (line) => /PR #(\d+)/.exec(line)?.[1];
|
|
21
|
+
// Row 205. One wait per command, each with its source and the grant that names it. A command
|
|
22
|
+
// the verb would not take (anything outside printable ASCII) gets a note, never a `run:`. An
|
|
23
|
+
// aside with no commands (one read from the live folder) names the listing form.
|
|
24
|
+
function trustRows(a) {
|
|
25
|
+
if (a.trust === undefined || a.trust.length === 0)
|
|
26
|
+
return [`wait: trust grant · ${a.target}`, ` run: witness trust ${a.target}`];
|
|
27
|
+
return a.trust.flatMap((c) => [
|
|
28
|
+
`wait: trust grant · ${a.target} · ${shownCmd(c)}`,
|
|
29
|
+
` ${hasControl(c.cmd) ? 'note' : 'run'}: ${grantOf(a.target, c)}`,
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
export function needsYou(root, ctx, cfg, canon, aside) {
|
|
33
|
+
const items = [];
|
|
34
|
+
const named = new Set();
|
|
35
|
+
const add = (kind, target, rows, key = `${kind}:${target}`) => {
|
|
36
|
+
named.add(target);
|
|
37
|
+
items.push({ kind, target, rows, key });
|
|
38
|
+
};
|
|
39
|
+
// A crash no session could recover blocks every write: it is named first (F4).
|
|
40
|
+
const txn = pendingTxn(root);
|
|
41
|
+
if (txn !== undefined) {
|
|
42
|
+
items.push({ kind: 'pending-txn', target: TARGETLESS, key: 'pending-txn:-',
|
|
43
|
+
rows: [`wait: pending transaction · ${txn.op}`, ` run: ${recoverChoice(root, txn).options[0].command}`] });
|
|
44
|
+
}
|
|
45
|
+
for (const a of aside.filter((x) => x.kind === 'kept' && (x.stop === 'design-look' || x.stop === 'trust-grant'))) {
|
|
46
|
+
if (named.has(a.target))
|
|
47
|
+
continue;
|
|
48
|
+
if (a.stop === 'design-look') {
|
|
49
|
+
add('design-look', a.target, [`wait: design look · ${a.target}`, ` run: witness design ${a.target} --open`, ` then: witness decide design ${a.target} --show`]);
|
|
50
|
+
}
|
|
51
|
+
else
|
|
52
|
+
add('trust-grant', a.target, trustRows(a));
|
|
53
|
+
}
|
|
54
|
+
for (const u of unmetNeeds(canon)) {
|
|
55
|
+
const held = u.type === 'spec' && u.holds.length > 0;
|
|
56
|
+
add('need', u.doc, [
|
|
57
|
+
held ? `wait: held criterion · ${u.doc} · ${u.text} holds ${u.holds.join(' · ')}` : `wait: unmet need · ${u.doc} · ${u.text}`,
|
|
58
|
+
` run: ${u.satisfy}`,
|
|
59
|
+
], `need:${u.doc}:${u.need}`);
|
|
60
|
+
}
|
|
61
|
+
for (const o of owedDecisions(root, canon)) {
|
|
62
|
+
if (named.has(o.target))
|
|
63
|
+
continue;
|
|
64
|
+
add('decision', o.target, [`wait: decision · ${o.gate} ${o.target}`, ` run: witness decide ${o.gate} ${o.target} --show`], `decision:${o.target}:${o.gate}`);
|
|
65
|
+
}
|
|
66
|
+
const driver = resolveDriver(ctx.env, cfg.harness);
|
|
67
|
+
for (const a of aside.filter((x) => x.kind === 'conversation' || x.kind === 'merge')) {
|
|
68
|
+
if (named.has(a.target))
|
|
69
|
+
continue;
|
|
70
|
+
if (a.kind === 'conversation') {
|
|
71
|
+
// Row 196. A target-less conversation is a grill: of a queued ask, or — with nothing
|
|
72
|
+
// queued — of what to build next, which waits on nobody, so it is said and not counted.
|
|
73
|
+
// An aside read from the live folder carries no line, and drive publishes one only for a
|
|
74
|
+
// queued ask.
|
|
75
|
+
const ask = a.target === TARGETLESS && a.line !== undefined ? / --ask (\S+)/.exec(a.line)?.[1] : undefined;
|
|
76
|
+
if (a.target === TARGETLESS && a.line !== undefined && ask === undefined) {
|
|
77
|
+
items.push({ kind: 'conversation', target: TARGETLESS, key: 'conversation:-', notice: true,
|
|
78
|
+
rows: ['nothing queued — /witness <what to build> in a chat'] });
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const who = a.target === TARGETLESS ? `brainstorm${ask !== undefined ? ` · ask ${ask}` : ''}` : a.target;
|
|
82
|
+
add('conversation', a.target, [`wait: conversation · ${who}`,
|
|
83
|
+
...(driver.ok ? [` run: ${handoffLine(driver.value.harness, root, undefined)}`] : [])]);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
const meta = findById(canon, a.target)?.meta.pr;
|
|
87
|
+
const pr = (a.line !== undefined ? prOf(a.line) : undefined) ?? (meta !== undefined ? String(meta) : undefined);
|
|
88
|
+
add('merge', a.target, [`wait: merge · ${a.target}${pr ? ` · PR #${pr}` : ''}`, ...(pr ? [` run: gh pr merge ${pr}`] : [])]);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
for (const p of parkedGates(root, canon)) {
|
|
92
|
+
const stopped = readStream(root, p.target)
|
|
93
|
+
.filter((e) => e.t === 'human-decision' && e.gate === p.gate)
|
|
94
|
+
.map((e) => e).filter((d) => d.decision === 'stop').at(-1);
|
|
95
|
+
const why = stopped?.selected === 'policy' && stopped.note ? stopped.note : `parked at ${p.anchor}`;
|
|
96
|
+
items.push({ kind: 'parked', target: p.target, key: `parked:${p.target}:${p.gate}`,
|
|
97
|
+
rows: [`parked: ${p.target} · ${p.gate} round ${p.round} — ${why}`, ` run: ${p.reopen}`] });
|
|
98
|
+
}
|
|
99
|
+
// A capped target the policy could not park carries no gate (drive.ts): it is stuck too. One
|
|
100
|
+
// the policy parked is the parked row above, read from the journal.
|
|
101
|
+
for (const a of aside.filter((x) => x.kind === 'stuck' || (x.kind === 'capped' && x.gate === undefined))) {
|
|
102
|
+
// Final review: the way back is named — a fix witness cannot see is the human's `retry`.
|
|
103
|
+
items.push({ kind: a.kind, target: a.target, key: `${a.kind}:${a.target}`,
|
|
104
|
+
rows: [`stuck: ${a.target} — ${a.why ?? `witness log ${a.target}`}`,
|
|
105
|
+
...(a.target !== TARGETLESS ? [` run: witness retry ${a.target}`] : [])] });
|
|
106
|
+
}
|
|
107
|
+
return items;
|
|
108
|
+
}
|
|
109
|
+
// The first 12 hex of a sha1 over the sorted keys of what is owed: order-free, text-free.
|
|
110
|
+
export function needsYouToken(items) {
|
|
111
|
+
const keys = [...new Set(items.filter((i) => i.notice !== true).map((i) => i.key))].sort();
|
|
112
|
+
return createHash('sha1').update(keys.join('\n')).digest('hex').slice(0, 12);
|
|
113
|
+
}
|
package/dist/needs.js
CHANGED
|
@@ -28,7 +28,7 @@ export async function evaluateNeeds(root, ctx, needs, doc) {
|
|
|
28
28
|
if (trust !== 'trusted') {
|
|
29
29
|
out.push({
|
|
30
30
|
label: n.cmd, kind: 'cmd', status: trust,
|
|
31
|
-
detail: trust === 'blocked' ? 'untrusted
|
|
31
|
+
detail: trust === 'blocked' ? 'untrusted on this machine — witness next names the grant to make' : 'trust declined',
|
|
32
32
|
});
|
|
33
33
|
continue;
|
|
34
34
|
}
|
package/dist/notify.js
CHANGED
|
@@ -1,31 +1,68 @@
|
|
|
1
1
|
import { resolves } from './opener.js';
|
|
2
|
-
import { spawnSync } from './spawn.js';
|
|
2
|
+
import { spawn, spawnSync, system32 } from './spawn.js';
|
|
3
3
|
// Row 184. The desktop notification an autonomous run ends with (design B6). A machine-local
|
|
4
|
-
// `notify:` command receives the
|
|
5
|
-
//
|
|
6
|
-
|
|
4
|
+
// `notify:` command receives the message as its one argument; otherwise the platform notifier.
|
|
5
|
+
// Row 203 (issue #56): Windows gets a toast by default, and drive notifies each new item.
|
|
6
|
+
// Windows PowerShell 5.1 ships with Windows (PowerShell 7 need not be installed), and its own
|
|
7
|
+
// AppUserModelID shows a toast with no registration. The text arrives through the environment
|
|
8
|
+
// and is never interpolated into the script, so a repo-derived message cannot become code.
|
|
9
|
+
export const TOAST_SCRIPT = [
|
|
10
|
+
'[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null',
|
|
11
|
+
'$xml = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText02)',
|
|
12
|
+
"$t = $xml.GetElementsByTagName('text')",
|
|
13
|
+
'$t.Item(0).AppendChild($xml.CreateTextNode($env:WITNESS_NOTIFY_TITLE)) > $null',
|
|
14
|
+
'$t.Item(1).AppendChild($xml.CreateTextNode($env:WITNESS_NOTIFY_TEXT)) > $null',
|
|
15
|
+
"$id = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\\WindowsPowerShell\\v1.0\\powershell.exe'",
|
|
16
|
+
'[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($id).Show([Windows.UI.Notifications.ToastNotification]::new($xml))',
|
|
17
|
+
].join('\n');
|
|
18
|
+
export function notifyArgv(platform, configured, title, message, env = process.env) {
|
|
7
19
|
if (configured !== undefined && configured !== '')
|
|
8
|
-
return [configured, message];
|
|
20
|
+
return { argv: [configured, message] };
|
|
9
21
|
const q = (s) => `"${s.replaceAll('\\', '\\\\').replaceAll('"', '\\"')}"`;
|
|
10
22
|
if (platform === 'darwin')
|
|
11
|
-
return ['osascript', '-e', `display notification ${q(message)} with title ${q(title)}`];
|
|
23
|
+
return { argv: ['osascript', '-e', `display notification ${q(message)} with title ${q(title)}`] };
|
|
12
24
|
if (platform === 'linux')
|
|
13
|
-
return ['notify-send', title, message];
|
|
25
|
+
return { argv: ['notify-send', title, message] };
|
|
26
|
+
if (platform === 'win32') {
|
|
27
|
+
// Row 201's doctrine: a System32 binary by its absolute path, never one PATH could shadow.
|
|
28
|
+
const ps = system32(env, 'WindowsPowerShell', 'v1.0', 'powershell.exe');
|
|
29
|
+
return {
|
|
30
|
+
argv: [ps, '-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', TOAST_SCRIPT],
|
|
31
|
+
env: { WITNESS_NOTIFY_TITLE: title, WITNESS_NOTIFY_TEXT: message },
|
|
32
|
+
};
|
|
33
|
+
}
|
|
14
34
|
return undefined;
|
|
15
35
|
}
|
|
16
|
-
// Probed first, on openArtifact's precedent
|
|
17
|
-
//
|
|
18
|
-
//
|
|
36
|
+
// Probed first, on openArtifact's precedent — except Windows' default, named by an absolute
|
|
37
|
+
// path the probe would only re-walk. The end-of-run notification runs to completion, bounded:
|
|
38
|
+
// drive is about to exit, and waiting a moment is what makes it land. A notification inside a
|
|
39
|
+
// run (`wait: false`) starts in the background and is never waited for: a synchronous call
|
|
40
|
+
// stalled every round by up to its timeout.
|
|
19
41
|
const NOTIFY_TIMEOUT_MS = 10_000;
|
|
20
|
-
export function notify(configured, title, message, platform = process.platform) {
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
42
|
+
export function notify(configured, title, message, platform = process.platform, opts = { wait: true }) {
|
|
43
|
+
const r = notifyArgv(platform, configured, title, message);
|
|
44
|
+
if (r === undefined)
|
|
23
45
|
return { outcome: 'none' };
|
|
24
|
-
const [cmd, ...args] = argv;
|
|
25
|
-
|
|
46
|
+
const [cmd, ...args] = r.argv;
|
|
47
|
+
const builtIn = platform === 'win32' && (configured === undefined || configured === '');
|
|
48
|
+
if (!builtIn && !resolves(cmd))
|
|
26
49
|
return { outcome: 'failed', command: cmd };
|
|
27
|
-
const
|
|
28
|
-
|
|
50
|
+
const env = r.env !== undefined ? { ...process.env, ...r.env } : process.env;
|
|
51
|
+
if (!opts.wait) {
|
|
52
|
+
try {
|
|
53
|
+
// Not detached: on Windows that opens a console of its own. Row 201: the spawn wrapper
|
|
54
|
+
// decides the window, hidden under a background drive.
|
|
55
|
+
const child = spawn(cmd, args, { stdio: 'ignore', env });
|
|
56
|
+
child.on('error', () => { }); // a notifier that fails is not drive's crash
|
|
57
|
+
child.unref();
|
|
58
|
+
return { outcome: 'started', command: cmd };
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return { outcome: 'failed', command: cmd };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const run = spawnSync(cmd, args, { stdio: 'ignore', timeout: NOTIFY_TIMEOUT_MS, env });
|
|
65
|
+
return run.error !== undefined && run.error.code !== 'ETIMEDOUT'
|
|
29
66
|
? { outcome: 'failed', command: cmd }
|
|
30
67
|
: { outcome: 'sent', command: cmd };
|
|
31
68
|
}
|
package/dist/pin.js
CHANGED
|
@@ -35,7 +35,7 @@ export function checkPin(field, raw) {
|
|
|
35
35
|
if (!parsed.ok)
|
|
36
36
|
return refuse(parsed.violations);
|
|
37
37
|
if (MODEL_ALIASES.includes(parsed.value.model)) {
|
|
38
|
-
return refuse([v(field, 'alias-refused', raw, 'an exact model id —
|
|
38
|
+
return refuse([v(field, 'alias-refused', raw, 'an exact model id — an alias re-points when its vendor ships a new model (Decision 55)')]);
|
|
39
39
|
}
|
|
40
40
|
return ok(raw);
|
|
41
41
|
}
|
package/dist/progress.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { vacuousEvidence } from './steps.js';
|
|
2
|
+
// Row 206. Every journal kind is either an act, which moves a flow, or bookkeeping, which
|
|
3
|
+
// does not. Drive's no-progress check and its take-back key both read this table: counted,
|
|
4
|
+
// the sync every implement session's `start` journals when the repo has a remote, and row
|
|
5
|
+
// 81's dispatch telemetry, read as progress, and a session that only failed was respawned to
|
|
6
|
+
// the cap (issue #56). A Record, so a new kind without a row fails the build rather than
|
|
7
|
+
// looping drive by default.
|
|
8
|
+
export const ENTRY_PROGRESS = {
|
|
9
|
+
recap: 'act', write: 'act', 'gate-run': 'act', 'human-decision': 'act', 'test-evidence': 'act',
|
|
10
|
+
adopt: 'act', status: 'act',
|
|
11
|
+
'design-write': 'act', 'design-reconfirm': 'act', 'design-stamp': 'act', 'design-shown': 'act',
|
|
12
|
+
trust: 'act',
|
|
13
|
+
deferral: 'act', 'deferral-moved': 'act', 'deferral-retyped': 'act', 'deferral-discharged': 'act', 'deferral-dismissed': 'act',
|
|
14
|
+
ask: 'act', 'ask-withdrawn': 'act', 'need-satisfied': 'act', 'step-close': 'act', retry: 'act',
|
|
15
|
+
// A refused write is the CLI saying no (F5). A sync is the merge stamp's or `start`'s
|
|
16
|
+
// automatic act on the human's behalf (D138). A dispatch report is telemetry (row 81). A
|
|
17
|
+
// drift check reads; a policy pin records the rule a decision ran under.
|
|
18
|
+
'write-refused': 'bookkeeping', sync: 'bookkeeping', dispatch: 'bookkeeping',
|
|
19
|
+
'drift-check': 'bookkeeping', 'policy-pin': 'bookkeeping',
|
|
20
|
+
};
|
|
21
|
+
// A vacuous red moves nothing either (row 191, final review I3). A kind this CLI does not
|
|
22
|
+
// know — a hand-edited journal — is no motion.
|
|
23
|
+
export const movesFlow = (e) => Object.hasOwn(ENTRY_PROGRESS, e.t) && ENTRY_PROGRESS[e.t] === 'act' && !vacuousEvidence(e);
|
package/dist/recommend.js
CHANGED
|
@@ -122,29 +122,16 @@ function recommendCore(ctx) {
|
|
|
122
122
|
tradeoff: 'buys exactly one round; the discharge is that round passing, and the grant does not refresh until an approve, a revise-upstream or a passed run',
|
|
123
123
|
});
|
|
124
124
|
// 1 — malformed. D126 removed it from pendingDecision, so reaching here means a caller
|
|
125
|
-
// asked anyway; answer with the
|
|
125
|
+
// asked anyway; answer with the act that actually helps rather than four dispositions.
|
|
126
|
+
// Since row 212 the re-run is the only one.
|
|
126
127
|
if (last.outcome === 'malformed') {
|
|
127
128
|
return {
|
|
128
129
|
key: 'next', rule: 'malformed-rerun',
|
|
129
130
|
options: [
|
|
130
131
|
opt(`witness gate ${gate} ${target}`, 'root', {
|
|
131
|
-
why: `the battery emitted ${last.malformed?.length ?? 0} schema violation(s) and no verdict — this round judged nothing, and malformed rounds do not spend the budget, so re-running is free`,
|
|
132
|
+
why: `the battery emitted ${last.malformed?.length ?? 0} schema violation(s) and no verdict — this round judged nothing, and malformed rounds do not spend the budget, so re-running is free${last.malformed?.length ? `, and it re-asks only ${last.malformed.map((m) => m.reviewer).join(' · ')}` : ''}`,
|
|
132
133
|
note: 'a second malformed round on the same pin and prompts trips malformed-streak, which names the config remedy',
|
|
133
134
|
}),
|
|
134
|
-
opt((() => {
|
|
135
|
-
// D152 (issue #17). `--only` takes lens/skill names, never gate names — the old
|
|
136
|
-
// line was refused by the very verb it named, which is D129's "a rendered command
|
|
137
|
-
// runs" violated inside the recommender. The malformed rows name the lens that
|
|
138
|
-
// failed to parse, so use it; with none named, the whole reviewer suite is the
|
|
139
|
-
// honest scope.
|
|
140
|
-
const lens = last.malformed?.[0]?.reviewer;
|
|
141
|
-
return lens
|
|
142
|
-
? `witness calibrate ${last.model} --only ${lens}`
|
|
143
|
-
: `witness calibrate ${last.model} --suite reviewers`;
|
|
144
|
-
})(), 'root', {
|
|
145
|
-
when: 'the battery has malformed more than once — the lens or the model is at fault, not the artifact',
|
|
146
|
-
tradeoff: 'spends a calibration run; nothing about this artifact changes',
|
|
147
|
-
}),
|
|
148
135
|
],
|
|
149
136
|
};
|
|
150
137
|
}
|
package/dist/reviewer.js
CHANGED
|
@@ -91,9 +91,9 @@ const OUTSIDE_DRIVE_WANT = 'wait for the reset — witness drive waits it out on
|
|
|
91
91
|
// How long before its session's deadline a reviewer stops waiting: room to journal and exit.
|
|
92
92
|
const SESSION_MARGIN_MS = 60_000;
|
|
93
93
|
const REVIEWER_TIMEOUT_MS = 600_000;
|
|
94
|
-
// One stalled call must not cost a whole run: a
|
|
95
|
-
//
|
|
96
|
-
//
|
|
94
|
+
// One stalled call must not cost a whole run: a battery launches every lens at once, and
|
|
95
|
+
// treating one transient stall as fatal throws away every verdict already paid for.
|
|
96
|
+
// Retries are bounded so a genuinely wedged binary still ends.
|
|
97
97
|
const TIMEOUT_RETRIES = 2;
|
|
98
98
|
const MAX_OUTPUT = 64 * 1024 * 1024;
|
|
99
99
|
const TERM_GRACE_MS = 5_000;
|
|
@@ -106,7 +106,7 @@ const EXIT_GRACE_MS = 2_000;
|
|
|
106
106
|
function prepareInvocation(ctx, harness, opts) {
|
|
107
107
|
let pin;
|
|
108
108
|
if (opts.model !== undefined) {
|
|
109
|
-
const pinR = validatePin(harness, '
|
|
109
|
+
const pinR = validatePin(harness, opts.pinField ?? 'model', opts.model);
|
|
110
110
|
if (!pinR.ok)
|
|
111
111
|
return refuse(pinR.violations);
|
|
112
112
|
pin = pinR.value;
|
|
@@ -172,7 +172,7 @@ export function invokeReviewer(ctx, harness, opts) {
|
|
|
172
172
|
});
|
|
173
173
|
if (c === 'retry')
|
|
174
174
|
continue;
|
|
175
|
-
//
|
|
175
|
+
// The sync lane (drift's) never waits: it refuses a limit as an attended gate does.
|
|
176
176
|
const limit = usageLimitOf(c, Date.now());
|
|
177
177
|
return limit ? refuse([v(p.cmd, 'usage-limit', limit.text, OUTSIDE_DRIVE_WANT)]) : c;
|
|
178
178
|
}
|
package/dist/rounds.js
CHANGED
|
@@ -18,10 +18,11 @@ export function sameKey(a, b) {
|
|
|
18
18
|
a.harness === b.harness;
|
|
19
19
|
}
|
|
20
20
|
// Rows 106 and 107: did this round's reviewers run on something other than what was
|
|
21
|
-
// pinned? One definition for
|
|
22
|
-
//
|
|
23
|
-
// inline form inverts silently, and a flipped exemption is a budget that never
|
|
24
|
-
// False for every pre-0.8.0 entry by construction
|
|
21
|
+
// pinned? One definition for every reader — the cache/resume exclusion below, the budget
|
|
22
|
+
// exemption in roundsSinceApprove, the caps, the delta base and autonomy's re-run arm —
|
|
23
|
+
// because the inline form inverts silently, and a flipped exemption is a budget that never
|
|
24
|
+
// spends. False for every pre-0.8.0 entry by construction, and for every round since row 212,
|
|
25
|
+
// which asks the pin alone: only a 0.25.x journal holds a round it is true for.
|
|
25
26
|
export function fellBack(run) {
|
|
26
27
|
return (run.pin ?? run.model) !== run.model;
|
|
27
28
|
}
|
|
@@ -52,7 +53,7 @@ function lastResetIndex(entries, gate) {
|
|
|
52
53
|
}
|
|
53
54
|
return -1;
|
|
54
55
|
}
|
|
55
|
-
// The window the round budget spans, and therefore the window the streak
|
|
56
|
+
// The window the round budget spans, and therefore the window the malformed-streak brake guards:
|
|
56
57
|
// an approve, a revise-upstream or a passed run settles everything before it, so runs on
|
|
57
58
|
// the far side of one can neither spend budget nor trip a brake. gate.ts took the last two
|
|
58
59
|
// runs in the WHOLE stream, so an approved pair of fallen-back rounds — the dismissal row
|
|
@@ -266,15 +267,20 @@ export function appendKind(entries, gate, key) {
|
|
|
266
267
|
// Row 106: a substituted round is not evidence for another one, and `resume` and
|
|
267
268
|
// `changed-nothing` are both decisions about THIS run taken from THAT one without
|
|
268
269
|
// invoking anything. Excluding it is what makes a re-gate retry the pin — a
|
|
269
|
-
// recovered pin yields a real verdict immediately, a dead one
|
|
270
|
-
//
|
|
270
|
+
// recovered pin yields a real verdict immediately, and since row 212 a dead one refuses
|
|
271
|
+
// the gate naming the pin to fix.
|
|
271
272
|
// Keeping it here traps the human exactly as row 107's own trap does: `resume`
|
|
272
273
|
// never retries, and `changed-nothing` says `edit the artifact` about an artifact
|
|
273
274
|
// that was never the problem. Re-SHOWING the entry is `decide --show`'s job.
|
|
275
|
+
// Row 209. A malformed round judged nothing, so there is nothing to resume: re-showing it
|
|
276
|
+
// re-ran nothing while its own block said re-running is free. A re-gate repairs it instead —
|
|
277
|
+
// the lenses that answered are carried and the ones that did not are asked again.
|
|
274
278
|
if (!fellBack(last) && sameKey(keyOf(last), key)) {
|
|
275
279
|
const revised = entries.slice(lastRunIdx + 1).some((e) => isDecision(e, gate) &&
|
|
276
280
|
['revise', 'revise-upstream'].includes(e.decision));
|
|
277
|
-
|
|
281
|
+
if (revised)
|
|
282
|
+
return { kind: 'changed-nothing', entry: last };
|
|
283
|
+
return last.outcome === 'malformed' ? { kind: 'repair', from: last } : { kind: 'resume', entry: last };
|
|
278
284
|
}
|
|
279
285
|
}
|
|
280
286
|
for (let i = lastRunIdx - 1; i >= 0; i--) {
|
package/dist/runner.js
CHANGED
|
@@ -49,17 +49,20 @@ function runCommand(runRoot, ctx, cmd) {
|
|
|
49
49
|
export function untrustedOf(violations) {
|
|
50
50
|
return violations.find((x) => x.rule.startsWith('untrusted-'))?.got;
|
|
51
51
|
}
|
|
52
|
+
// Row 205. The runner knows no target, so it names the verb that does: `next` prints the grant
|
|
53
|
+
// to make, and the human names the command in the chat. The env var is the automation route.
|
|
54
|
+
const UNTRUSTED_WANT = 'a trusted command — witness next names the grant to make, or set WITNESS_TRUST_CMDS=1 for automation';
|
|
52
55
|
export async function runFiltered(runRoot, ctx, template, specId, trustRoot = runRoot) {
|
|
53
56
|
const trust = await ensureTrusted(trustRoot, ctx, template);
|
|
54
57
|
if (trust !== 'trusted') {
|
|
55
|
-
return refuse([v('criteria.runner', `untrusted-${trust}`, template, trust === 'blocked' ?
|
|
58
|
+
return refuse([v('criteria.runner', `untrusted-${trust}`, template, trust === 'blocked' ? UNTRUSTED_WANT : 'trust was declined')]);
|
|
56
59
|
}
|
|
57
60
|
return ok(execCommand(runRoot, ctx, template.replaceAll('{id}', specId)));
|
|
58
61
|
}
|
|
59
62
|
export async function runFullSuite(runRoot, ctx, rc, trustRoot = runRoot) {
|
|
60
63
|
const trust = await ensureTrusted(trustRoot, ctx, rc.suiteCmd);
|
|
61
64
|
if (trust !== 'trusted') {
|
|
62
|
-
return refuse([v('ship.test', `untrusted-${trust}`, rc.suiteCmd, trust === 'blocked' ?
|
|
65
|
+
return refuse([v('ship.test', `untrusted-${trust}`, rc.suiteCmd, trust === 'blocked' ? UNTRUSTED_WANT : 'trust was declined')]);
|
|
63
66
|
}
|
|
64
67
|
for (const f of reportFiles(runRoot, rc.reportGlob))
|
|
65
68
|
rmSync(join(runRoot, f));
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Row 210 (issue #58). A drive session's time is the time the host was awake.
|
|
2
|
+
//
|
|
3
|
+
// One `setTimeout(stop, sessionTimeoutMs)` measured the wrong thing wherever libuv's clock counts
|
|
4
|
+
// suspend: on Windows the issue's timer fired 10 s after a 9 h sleep, with about 24 s awake, and
|
|
5
|
+
// on macOS libuv reads `mach_continuous_time`, which counts sleep too (probed: `process.hrtime`
|
|
6
|
+
// equals the wall time since boot on a Mac that slept 28 h). Linux's `CLOCK_MONOTONIC` stands still
|
|
7
|
+
// in suspend, so there a sleep never reached the timer and leaves no late check (a reading). Nothing
|
|
8
|
+
// here depends on which: a check that fires more than SUSPEND_GAP_MS late slept through its
|
|
9
|
+
// lateness, on any platform. No check is armed for more than SESSION_TICK_MS, so a limit past
|
|
10
|
+
// 2^31 ms cannot overflow Node's timer and fire at once (P4), the bug `realClock.sleep` already
|
|
11
|
+
// slices around.
|
|
12
|
+
//
|
|
13
|
+
// Residual (C4): a drive event-loop stall longer than SUSPEND_GAP_MS also reads as sleep.
|
|
14
|
+
export const SESSION_TICK_MS = 1_000;
|
|
15
|
+
export const SUSPEND_GAP_MS = 30_000;
|
|
16
|
+
export const monotonicTicker = {
|
|
17
|
+
now: () => performance.now(),
|
|
18
|
+
after: (ms, fn) => { const t = setTimeout(fn, ms); return () => clearTimeout(t); },
|
|
19
|
+
};
|
|
20
|
+
export function sessionClock(limitMs, ticker, on) {
|
|
21
|
+
const t0 = ticker.now();
|
|
22
|
+
let last = t0; // when the pending check was armed
|
|
23
|
+
let wait = 0; // how far ahead of `last` it is due
|
|
24
|
+
let asleep = 0;
|
|
25
|
+
let cancel;
|
|
26
|
+
let expired = false;
|
|
27
|
+
let frozen;
|
|
28
|
+
// The interval since the last check, accounted: lateness past the gap is sleep.
|
|
29
|
+
const account = (now) => {
|
|
30
|
+
const late = now - last - wait;
|
|
31
|
+
if (late > SUSPEND_GAP_MS) {
|
|
32
|
+
asleep += late;
|
|
33
|
+
on.slept(late);
|
|
34
|
+
}
|
|
35
|
+
last = now;
|
|
36
|
+
return now - t0 - asleep;
|
|
37
|
+
};
|
|
38
|
+
const arm = (awake) => {
|
|
39
|
+
wait = Math.min(SESSION_TICK_MS, limitMs - awake);
|
|
40
|
+
cancel = ticker.after(wait, check);
|
|
41
|
+
};
|
|
42
|
+
const check = () => {
|
|
43
|
+
const awake = account(ticker.now());
|
|
44
|
+
if (awake < limitMs) {
|
|
45
|
+
arm(awake);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
expired = true;
|
|
49
|
+
cancel = undefined;
|
|
50
|
+
on.expire();
|
|
51
|
+
};
|
|
52
|
+
arm(0);
|
|
53
|
+
return {
|
|
54
|
+
awakeMs: () => frozen ?? ticker.now() - t0 - asleep,
|
|
55
|
+
// Cancels the pending check and accounts its interval by the same rule, which catches a
|
|
56
|
+
// sleep no check has seen yet (a session that ends right after the host wakes). After an
|
|
57
|
+
// expiry nothing is pending, so it only freezes.
|
|
58
|
+
stop() {
|
|
59
|
+
if (frozen !== undefined)
|
|
60
|
+
return;
|
|
61
|
+
cancel?.();
|
|
62
|
+
frozen = expired ? ticker.now() - t0 - asleep : account(ticker.now());
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
package/dist/settings.js
CHANGED
|
@@ -183,7 +183,8 @@ export function settingAt(path, list = SETTINGS) {
|
|
|
183
183
|
return list.find((s) => s.path === path);
|
|
184
184
|
}
|
|
185
185
|
// The default in force at `schema`: the entry under the greatest key ≤ schema. Undefined
|
|
186
|
-
// before `since`, and for a schema that gave the setting no default (a pin at 1: the
|
|
186
|
+
// before `since`, and for a schema that gave the setting no default (a pin at 1: the
|
|
187
|
+
// session default).
|
|
187
188
|
export function defaultAt(s, schema) {
|
|
188
189
|
if (schema < s.since)
|
|
189
190
|
return undefined;
|
package/dist/settle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { trustedCommands, untrustedCmdsFor } from './allowlist.js';
|
|
1
|
+
import { grantOf, shownCmd, sourced, trustedCommands, untrustedCmdsFor } from './allowlist.js';
|
|
2
2
|
import { arbitrate, decisionEvidence, menuFor } from './arbiter.js';
|
|
3
3
|
import { keptStopLine, policyFor } from './autonomy.js';
|
|
4
4
|
import { EXIT } from './cli.js';
|
|
@@ -76,13 +76,14 @@ export async function settleStop(ctx, root, cfg, gate, target) {
|
|
|
76
76
|
};
|
|
77
77
|
if (policy.kind === 'human') {
|
|
78
78
|
// Row 194: the gate ran only on a look the human opened, so approving is their one act.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
// Row 205 (final review): a trust grant is one line per command — escaped, with its source and
|
|
80
|
+
// the grant that names it — as `next`'s pre-flight prints it, so the chat shows the source.
|
|
81
|
+
const line = policy.stop === 'design-look'
|
|
82
|
+
? keptStopLine(policy.stop, `the human approves the screen or sends a note — witness decide design ${target} --show`)
|
|
83
|
+
: sourced(cfg, canon, target, untrusted).map((c) => keptStopLine('trust-grant', `${shownCmd(c)} · ${grantOf(target, c)}`)).join('\n');
|
|
83
84
|
renderDecision(block).forEach((l) => ctx.out(l));
|
|
84
85
|
ctx.out(line);
|
|
85
|
-
return { kind: 'kept', stop: policy.stop, line };
|
|
86
|
+
return { kind: 'kept', stop: policy.stop, line, ...(policy.stop === 'trust-grant' ? { untrusted } : {}) };
|
|
86
87
|
}
|
|
87
88
|
if (policy.kind === 'take') {
|
|
88
89
|
const actR = actOfCommand(policy.command);
|
|
@@ -113,7 +114,12 @@ export async function settleStop(ctx, root, cfg, gate, target) {
|
|
|
113
114
|
const rule = ruling.violations[0]?.rule ?? 'unknown';
|
|
114
115
|
renderRefusal(ruling.violations).forEach((l) => ctx.err(l));
|
|
115
116
|
renderDecision(block).forEach((l) => ctx.out(l));
|
|
116
|
-
|
|
117
|
+
// Row 212: a refusal on a pinned arbiter carries the pin's row — name the setting here too,
|
|
118
|
+
// since the settle pass runs quiet and this line is all `next` and drive show of it.
|
|
119
|
+
const pinRow = ruling.violations.find((x) => x.rule === 'pin-unanswered');
|
|
120
|
+
const why = pinRow
|
|
121
|
+
? `the arbiter could not be invoked on its pin — ${pinRow.field} · pin-unanswered (${pinRow.got})`
|
|
122
|
+
: `the arbiter could not be invoked (${rule})`;
|
|
117
123
|
ctx.out(leftLine(gate, target, why));
|
|
118
124
|
// Final review F6: a usage limit is named, so drive can wait it out as its own pause.
|
|
119
125
|
const limited = ruling.violations.find((x) => x.rule === 'usage-limit');
|
package/dist/spawn.js
CHANGED
|
@@ -17,10 +17,15 @@ const CMD_META = /[()[\]%!^"`<>&|;, *?]|(?<=%)[^]/gu;
|
|
|
17
17
|
// Windows env names are case-insensitive, and a spread process.env carries `Path` beside
|
|
18
18
|
// any `PATH` a caller adds. Node gives the child the key that sorts first, so resolution
|
|
19
19
|
// reads that one — any other answer names a binary the child never sees.
|
|
20
|
-
function envGet(env, name) {
|
|
20
|
+
export function envGet(env, name) {
|
|
21
21
|
const key = Object.keys(env).sort().find((k) => k.toUpperCase() === name);
|
|
22
22
|
return key === undefined ? undefined : env[key];
|
|
23
23
|
}
|
|
24
|
+
// Row 211. A System32 binary by its absolute path, never one PATH could shadow (row 201) — the
|
|
25
|
+
// one builder for resolveSpawn's cmd.exe, treeStop's taskkill, the toast and keep-awake helpers.
|
|
26
|
+
export function system32(env, ...parts) {
|
|
27
|
+
return win32.join(envGet(env, 'SYSTEMROOT') ?? 'C:\\Windows', 'System32', ...parts);
|
|
28
|
+
}
|
|
24
29
|
function isFile(p) {
|
|
25
30
|
try {
|
|
26
31
|
return statSync(p).isFile();
|
|
@@ -101,7 +106,7 @@ export function resolveSpawn(cmd, args, env, platform = process.platform) {
|
|
|
101
106
|
}
|
|
102
107
|
const line = [`"${file}"`, ...args.map((a) => caret(caret(crtQuote(a))))].join(' ');
|
|
103
108
|
return ok({
|
|
104
|
-
file:
|
|
109
|
+
file: system32(env, 'cmd.exe'),
|
|
105
110
|
args: ['/d', '/v:off', '/s', '/c', `"${line}"`],
|
|
106
111
|
env: { ...env, NoDefaultCurrentDirectoryInExePath: '1' },
|
|
107
112
|
windowsVerbatimArguments: true,
|
|
@@ -139,7 +144,7 @@ export const execSync = ((command, ...rest) => cp.execSync(command, ...hidden(re
|
|
|
139
144
|
// System32 `cmd.exe` precedent.
|
|
140
145
|
export function treeStop(pid, env) {
|
|
141
146
|
return {
|
|
142
|
-
file:
|
|
147
|
+
file: system32(env, 'taskkill.exe'),
|
|
143
148
|
args: ['/PID', String(pid), '/T', '/F'],
|
|
144
149
|
};
|
|
145
150
|
}
|
package/dist/stamp.js
CHANGED
|
@@ -22,7 +22,7 @@ export function writeStamp(root, s) {
|
|
|
22
22
|
writeDoc(join(root, s.rel), { meta: { ...s.doc.meta, status: s.to }, body: s.doc.body });
|
|
23
23
|
appendEntry(root, s.stream, s.entry);
|
|
24
24
|
}
|
|
25
|
-
function prState(ctx, root, pr) {
|
|
25
|
+
export function prState(ctx, root, pr) {
|
|
26
26
|
try {
|
|
27
27
|
const out = execFileSync('gh', ['pr', 'view', String(pr), '--json', 'state'], {
|
|
28
28
|
cwd: root, env: ctx.env, encoding: 'utf8', timeout: 3_000,
|
package/dist/toon.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
// A shell word is quoted only when it needs it, so the common line stays the one a human
|
|
2
|
+
// types — a path in drive's watch line, a command in a `--cmd` grant (row 205).
|
|
3
|
+
export const shellArg = (p) => /^[\w@%+=:,./-]+$/.test(p) ? p : `'${p.replaceAll("'", "'\\''")}'`;
|
|
4
|
+
// Security review. A command a human is asked to trust is repo-authored text: a carriage return
|
|
5
|
+
// or an escape sequence could paint a different command over the real one, a bidi override
|
|
6
|
+
// reorder it (Trojan Source), an invisible filler hide a second command beside it. A denylist of
|
|
7
|
+
// such characters always misses one, so the rule is an allowlist: printable ASCII shows as it
|
|
8
|
+
// is, anything else is spelled out, and a command carrying any of it is never granted.
|
|
9
|
+
const UNSHOWABLE = /[^\x20-\x7e]/u;
|
|
10
|
+
export const hasControl = (s) => UNSHOWABLE.test(s);
|
|
11
|
+
export const visible = (s) => s.replace(new RegExp(UNSHOWABLE.source, 'gu'), (c) => c === '\n' ? '\\n' : c === '\r' ? '\\r' : c === '\t' ? '\\t'
|
|
12
|
+
: c.codePointAt(0) < 0x100 ? `\\x${c.codePointAt(0).toString(16).padStart(2, '0')}` : `\\u{${c.codePointAt(0).toString(16)}}`);
|
|
1
13
|
function esc(value) {
|
|
2
14
|
const s = String(value ?? '');
|
|
3
15
|
return /[,"\n]|^\s|\s$/.test(s) ? `"${s.replaceAll('"', '""')}"` : s;
|