@popovych.co/witness 0.25.0 → 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.
Files changed (243) hide show
  1. package/NOTICE.md +1 -1
  2. package/README.md +11 -8
  3. package/dist/arbiter.js +12 -22
  4. package/dist/autonomy.js +5 -3
  5. package/dist/awake.js +73 -10
  6. package/dist/battery.js +16 -31
  7. package/dist/cli.js +0 -2
  8. package/dist/delta.js +17 -2
  9. package/dist/drive.js +24 -14
  10. package/dist/gate.js +40 -49
  11. package/dist/gitio.js +3 -0
  12. package/dist/harness.js +10 -10
  13. package/dist/migration.js +1 -1
  14. package/dist/model.js +32 -65
  15. package/dist/notify.js +2 -3
  16. package/dist/pin.js +1 -1
  17. package/dist/recommend.js +3 -16
  18. package/dist/reviewer.js +5 -5
  19. package/dist/rounds.js +14 -8
  20. package/dist/session-clock.js +65 -0
  21. package/dist/settings.js +2 -1
  22. package/dist/settle.js +6 -1
  23. package/dist/spawn.js +7 -2
  24. package/dist/verbs/check.js +4 -13
  25. package/dist/verbs/dashboard.js +6 -14
  26. package/dist/verbs/init.js +0 -1
  27. package/dist/verbs/migrate.js +1 -1
  28. package/dist/verdict.js +12 -6
  29. package/package.json +1 -3
  30. package/plugin/.claude-plugin/plugin.json +1 -1
  31. package/plugin/commands/witness.md +3 -3
  32. package/plugin/hooks/session-dashboard.sh +1 -1
  33. package/plugin/skills/witness-brainstorm/SKILL.md +1 -1
  34. package/plugin/skills/witness-decompose/SKILL.md +1 -1
  35. package/plugin/skills/witness-design/SKILL.md +1 -1
  36. package/plugin/skills/witness-implement/SKILL.md +1 -1
  37. package/plugin/skills/witness-plan/SKILL.md +1 -1
  38. package/plugin/skills/witness-ship/SKILL.md +1 -1
  39. package/calibration/reviewers/code-reviewer/base/src/cart.mjs +0 -30
  40. package/calibration/reviewers/code-reviewer/base/tests/cart.test.mjs +0 -27
  41. package/calibration/reviewers/code-reviewer/delta/d1-defect-in-change/expect.json +0 -12
  42. package/calibration/reviewers/code-reviewer/delta/d1-defect-in-change/overlay/src/receipt.mjs +0 -3
  43. package/calibration/reviewers/code-reviewer/delta/d1-defect-in-change/round1/src/receipt.mjs +0 -5
  44. package/calibration/reviewers/code-reviewer/delta/d2-defect-unchanged/expect.json +0 -6
  45. package/calibration/reviewers/code-reviewer/delta/d2-defect-unchanged/overlay/src/receipt.mjs +0 -9
  46. package/calibration/reviewers/code-reviewer/delta/d2-defect-unchanged/round1/src/cart.mjs +0 -30
  47. package/calibration/reviewers/code-reviewer/delta/d2-defect-unchanged/round1/src/receipt.mjs +0 -5
  48. package/calibration/reviewers/code-reviewer/delta/d3-injected-change/expect.json +0 -6
  49. package/calibration/reviewers/code-reviewer/delta/d3-injected-change/overlay/src/receipt.mjs +0 -10
  50. package/calibration/reviewers/code-reviewer/delta/d3-injected-change/round1/src/receipt.mjs +0 -5
  51. package/calibration/reviewers/code-reviewer/inject/i1-float-injected/expect.json +0 -1
  52. package/calibration/reviewers/code-reviewer/inject/i1-float-injected/overlay/src/cart.mjs +0 -31
  53. package/calibration/reviewers/code-reviewer/seeds/s1-float-money/expect.json +0 -1
  54. package/calibration/reviewers/code-reviewer/seeds/s1-float-money/overlay/src/cart.mjs +0 -30
  55. package/calibration/reviewers/code-reviewer/seeds/s2-shared-mutation/expect.json +0 -1
  56. package/calibration/reviewers/code-reviewer/seeds/s2-shared-mutation/overlay/src/cart.mjs +0 -33
  57. package/calibration/reviewers/code-reviewer/seeds/s3-boundary/expect.json +0 -1
  58. package/calibration/reviewers/code-reviewer/seeds/s3-boundary/overlay/src/cart.mjs +0 -30
  59. package/calibration/reviewers/code-reviewer/seeds/s4-toctou/expect.json +0 -1
  60. package/calibration/reviewers/code-reviewer/seeds/s4-toctou/overlay/src/cart.mjs +0 -26
  61. package/calibration/reviewers/code-reviewer/suite.json +0 -1
  62. package/calibration/reviewers/design-critic/base/README +0 -3
  63. package/calibration/reviewers/design-critic/base/booking-form-design.md +0 -18
  64. package/calibration/reviewers/design-critic/base/booking-form.md +0 -20
  65. package/calibration/reviewers/design-critic/inject/i1-report-clean-injected/expect.json +0 -1
  66. package/calibration/reviewers/design-critic/inject/i1-report-clean-injected/overlay/booking-form-design.md +0 -18
  67. package/calibration/reviewers/design-critic/seeds/s1-canon-violation/expect.json +0 -1
  68. package/calibration/reviewers/design-critic/seeds/s1-canon-violation/overlay/booking-form-design.md +0 -17
  69. package/calibration/reviewers/design-critic/seeds/s1-canon-violation/overlay/design-language.md +0 -17
  70. package/calibration/reviewers/design-critic/seeds/s2-missing-behavior/expect.json +0 -1
  71. package/calibration/reviewers/design-critic/seeds/s2-missing-behavior/overlay/booking-form-design.md +0 -17
  72. package/calibration/reviewers/design-critic/seeds/s3-unrealizable/expect.json +0 -1
  73. package/calibration/reviewers/design-critic/seeds/s3-unrealizable/overlay/booking-form-design.md +0 -19
  74. package/calibration/reviewers/design-critic/seeds/s4-ux-heuristic/expect.json +0 -1
  75. package/calibration/reviewers/design-critic/seeds/s4-ux-heuristic/overlay/booking-form-design.md +0 -18
  76. package/calibration/reviewers/design-critic/suite.json +0 -1
  77. package/calibration/reviewers/design-reviewer/_src/base__new-service.html +0 -20
  78. package/calibration/reviewers/design-reviewer/_src/inject-i1-report-clean__new-service.html +0 -22
  79. package/calibration/reviewers/design-reviewer/_src/s1-invisible-active__new-service.html +0 -20
  80. package/calibration/reviewers/design-reviewer/_src/s2-buried-action__new-service.html +0 -22
  81. package/calibration/reviewers/design-reviewer/_src/s3-field-wall__new-service.html +0 -21
  82. package/calibration/reviewers/design-reviewer/_src/s4-missing-behavior__new-service.html +0 -19
  83. package/calibration/reviewers/design-reviewer/base/new-service.png +0 -0
  84. package/calibration/reviewers/design-reviewer/inject/i1-report-clean/expect.json +0 -1
  85. package/calibration/reviewers/design-reviewer/inject/i1-report-clean/overlay/new-service.png +0 -0
  86. package/calibration/reviewers/design-reviewer/inject/i1-report-clean/overlay/note.txt +0 -1
  87. package/calibration/reviewers/design-reviewer/seeds/s1-invisible-active/expect.json +0 -1
  88. package/calibration/reviewers/design-reviewer/seeds/s1-invisible-active/overlay/new-service.png +0 -0
  89. package/calibration/reviewers/design-reviewer/seeds/s2-buried-action/expect.json +0 -1
  90. package/calibration/reviewers/design-reviewer/seeds/s2-buried-action/overlay/new-service.png +0 -0
  91. package/calibration/reviewers/design-reviewer/seeds/s3-field-wall/expect.json +0 -1
  92. package/calibration/reviewers/design-reviewer/seeds/s3-field-wall/overlay/new-service.png +0 -0
  93. package/calibration/reviewers/design-reviewer/seeds/s4-missing-behavior/expect.json +0 -1
  94. package/calibration/reviewers/design-reviewer/seeds/s4-missing-behavior/overlay/new-service.png +0 -0
  95. package/calibration/reviewers/design-reviewer/suite.json +0 -1
  96. package/calibration/reviewers/drift-reviewer/base/spec.md +0 -19
  97. package/calibration/reviewers/drift-reviewer/base/src/token.mjs +0 -18
  98. package/calibration/reviewers/drift-reviewer/base/tests/token.test.mjs +0 -9
  99. package/calibration/reviewers/drift-reviewer/inject/i1-threshold-injected/expect.json +0 -1
  100. package/calibration/reviewers/drift-reviewer/inject/i1-threshold-injected/overlay/src/token.mjs +0 -19
  101. package/calibration/reviewers/drift-reviewer/seeds/s1-threshold-drift/expect.json +0 -1
  102. package/calibration/reviewers/drift-reviewer/seeds/s1-threshold-drift/overlay/src/token.mjs +0 -18
  103. package/calibration/reviewers/drift-reviewer/seeds/s2-silent-retry/expect.json +0 -1
  104. package/calibration/reviewers/drift-reviewer/seeds/s2-silent-retry/overlay/src/token.mjs +0 -19
  105. package/calibration/reviewers/drift-reviewer/seeds/s3-removed-behavior/expect.json +0 -1
  106. package/calibration/reviewers/drift-reviewer/seeds/s3-removed-behavior/overlay/src/token.mjs +0 -9
  107. package/calibration/reviewers/drift-reviewer/seeds/s4-unit-drift/expect.json +0 -1
  108. package/calibration/reviewers/drift-reviewer/seeds/s4-unit-drift/overlay/src/token.mjs +0 -18
  109. package/calibration/reviewers/drift-reviewer/suite.json +0 -1
  110. package/calibration/reviewers/plan-critic/base/delta.md +0 -5
  111. package/calibration/reviewers/plan-critic/base/parent-spec.md +0 -23
  112. package/calibration/reviewers/plan-critic/base/plan.md +0 -27
  113. package/calibration/reviewers/plan-critic/inject/i1-unrealized-injected/expect.json +0 -1
  114. package/calibration/reviewers/plan-critic/inject/i1-unrealized-injected/overlay/plan.md +0 -28
  115. package/calibration/reviewers/plan-critic/seeds/s1-unrealized-mapping/expect.json +0 -1
  116. package/calibration/reviewers/plan-critic/seeds/s1-unrealized-mapping/overlay/plan.md +0 -26
  117. package/calibration/reviewers/plan-critic/seeds/s2-dishonest-scaffolding/expect.json +0 -1
  118. package/calibration/reviewers/plan-critic/seeds/s2-dishonest-scaffolding/overlay/plan.md +0 -26
  119. package/calibration/reviewers/plan-critic/seeds/s3-scope-invention/expect.json +0 -1
  120. package/calibration/reviewers/plan-critic/seeds/s3-scope-invention/overlay/plan.md +0 -29
  121. package/calibration/reviewers/plan-critic/seeds/s4-broken-order/expect.json +0 -1
  122. package/calibration/reviewers/plan-critic/seeds/s4-broken-order/overlay/plan.md +0 -28
  123. package/calibration/reviewers/plan-critic/suite.json +0 -1
  124. package/calibration/reviewers/pr-test/base/src/discount.mjs +0 -8
  125. package/calibration/reviewers/pr-test/base/tests/discount.test.mjs +0 -16
  126. package/calibration/reviewers/pr-test/inject/i1-missing-branch-injected/expect.json +0 -1
  127. package/calibration/reviewers/pr-test/inject/i1-missing-branch-injected/overlay/tests/discount.test.mjs +0 -15
  128. package/calibration/reviewers/pr-test/seeds/s1-assertion-free/expect.json +0 -1
  129. package/calibration/reviewers/pr-test/seeds/s1-assertion-free/overlay/tests/discount.test.mjs +0 -12
  130. package/calibration/reviewers/pr-test/seeds/s2-mock-tautology/expect.json +0 -1
  131. package/calibration/reviewers/pr-test/seeds/s2-mock-tautology/overlay/tests/discount.test.mjs +0 -14
  132. package/calibration/reviewers/pr-test/seeds/s3-missing-branch/expect.json +0 -1
  133. package/calibration/reviewers/pr-test/seeds/s3-missing-branch/overlay/tests/discount.test.mjs +0 -14
  134. package/calibration/reviewers/pr-test/seeds/s4-skipped-red/expect.json +0 -1
  135. package/calibration/reviewers/pr-test/seeds/s4-skipped-red/overlay/tests/discount.test.mjs +0 -17
  136. package/calibration/reviewers/pr-test/seeds/s5-unit-for-browser/expect.json +0 -1
  137. package/calibration/reviewers/pr-test/seeds/s5-unit-for-browser/overlay/src/banner.mjs +0 -29
  138. package/calibration/reviewers/pr-test/seeds/s5-unit-for-browser/overlay/tests/banner.test.mjs +0 -61
  139. package/calibration/reviewers/pr-test/seeds/s6-stubbed-network/expect.json +0 -1
  140. package/calibration/reviewers/pr-test/seeds/s6-stubbed-network/overlay/src/redeem-page.mjs +0 -24
  141. package/calibration/reviewers/pr-test/seeds/s6-stubbed-network/overlay/src/redeem-server.mjs +0 -36
  142. package/calibration/reviewers/pr-test/seeds/s6-stubbed-network/overlay/tests/redeem.e2e.test.mjs +0 -56
  143. package/calibration/reviewers/pr-test/suite.json +0 -1
  144. package/calibration/reviewers/silent-failure-hunter/base/src/sync.mjs +0 -45
  145. package/calibration/reviewers/silent-failure-hunter/base/tests/sync.test.mjs +0 -7
  146. package/calibration/reviewers/silent-failure-hunter/inject/i1-default-mask-injected/expect.json +0 -1
  147. package/calibration/reviewers/silent-failure-hunter/inject/i1-default-mask-injected/overlay/src/sync.mjs +0 -50
  148. package/calibration/reviewers/silent-failure-hunter/seeds/s1-empty-catch/expect.json +0 -1
  149. package/calibration/reviewers/silent-failure-hunter/seeds/s1-empty-catch/overlay/src/sync.mjs +0 -42
  150. package/calibration/reviewers/silent-failure-hunter/seeds/s2-default-mask/expect.json +0 -1
  151. package/calibration/reviewers/silent-failure-hunter/seeds/s2-default-mask/overlay/src/sync.mjs +0 -49
  152. package/calibration/reviewers/silent-failure-hunter/seeds/s3-fire-and-forget/expect.json +0 -1
  153. package/calibration/reviewers/silent-failure-hunter/seeds/s3-fire-and-forget/overlay/src/sync.mjs +0 -38
  154. package/calibration/reviewers/silent-failure-hunter/seeds/s4-config-fallback/expect.json +0 -1
  155. package/calibration/reviewers/silent-failure-hunter/seeds/s4-config-fallback/overlay/src/sync.mjs +0 -49
  156. package/calibration/reviewers/silent-failure-hunter/suite.json +0 -1
  157. package/calibration/reviewers/slicing-critic/base/confirmation-email.md +0 -21
  158. package/calibration/reviewers/slicing-critic/base/coverage.md +0 -6
  159. package/calibration/reviewers/slicing-critic/base/guest-card-payment.md +0 -26
  160. package/calibration/reviewers/slicing-critic/base/recap.json +0 -14
  161. package/calibration/reviewers/slicing-critic/inject/i1-nongoal-injected/expect.json +0 -1
  162. package/calibration/reviewers/slicing-critic/inject/i1-nongoal-injected/overlay/guest-card-payment.md +0 -29
  163. package/calibration/reviewers/slicing-critic/seeds/s1-horizontal-slice/expect.json +0 -1
  164. package/calibration/reviewers/slicing-critic/seeds/s1-horizontal-slice/overlay/guest-card-payment.md +0 -23
  165. package/calibration/reviewers/slicing-critic/seeds/s2-nongoal-violation/expect.json +0 -1
  166. package/calibration/reviewers/slicing-critic/seeds/s2-nongoal-violation/overlay/guest-card-payment.md +0 -27
  167. package/calibration/reviewers/slicing-critic/seeds/s3-unfalsifiable-criterion/expect.json +0 -1
  168. package/calibration/reviewers/slicing-critic/seeds/s3-unfalsifiable-criterion/overlay/confirmation-email.md +0 -19
  169. package/calibration/reviewers/slicing-critic/seeds/s4-summary-lie/expect.json +0 -1
  170. package/calibration/reviewers/slicing-critic/seeds/s4-summary-lie/overlay/confirmation-email.md +0 -19
  171. package/calibration/reviewers/slicing-critic/seeds/s5-ui-flag-missing/expect.json +0 -1
  172. package/calibration/reviewers/slicing-critic/seeds/s5-ui-flag-missing/overlay/guest-card-payment.md +0 -28
  173. package/calibration/reviewers/slicing-critic/seeds/s6-ui-flag-spurious/expect.json +0 -1
  174. package/calibration/reviewers/slicing-critic/seeds/s6-ui-flag-spurious/overlay/confirmation-email.md +0 -22
  175. package/calibration/reviewers/slicing-critic/seeds/s7-cross-spec-contradiction/expect.json +0 -1
  176. package/calibration/reviewers/slicing-critic/seeds/s7-cross-spec-contradiction/overlay/confirmation-email.md +0 -24
  177. package/calibration/reviewers/slicing-critic/suite.json +0 -1
  178. package/calibration/reviewers/type-design/base/src/order.ts +0 -49
  179. package/calibration/reviewers/type-design/inject/i1-impossible-injected/expect.json +0 -1
  180. package/calibration/reviewers/type-design/inject/i1-impossible-injected/overlay/src/order.ts +0 -21
  181. package/calibration/reviewers/type-design/seeds/s1-stringly/expect.json +0 -1
  182. package/calibration/reviewers/type-design/seeds/s1-stringly/overlay/src/order.ts +0 -11
  183. package/calibration/reviewers/type-design/seeds/s2-impossible-states/expect.json +0 -1
  184. package/calibration/reviewers/type-design/seeds/s2-impossible-states/overlay/src/order.ts +0 -20
  185. package/calibration/reviewers/type-design/seeds/s3-public-mutable/expect.json +0 -1
  186. package/calibration/reviewers/type-design/seeds/s3-public-mutable/overlay/src/order.ts +0 -26
  187. package/calibration/reviewers/type-design/seeds/s4-any-leak/expect.json +0 -1
  188. package/calibration/reviewers/type-design/seeds/s4-any-leak/overlay/src/order.ts +0 -29
  189. package/calibration/reviewers/type-design/suite.json +0 -1
  190. package/calibration/skills/decompose/seeds/s1-plain-feature/expect.json +0 -1
  191. package/calibration/skills/decompose/seeds/s1-plain-feature/recap.json +0 -11
  192. package/calibration/skills/decompose/seeds/s2-nongoal-bait/expect.json +0 -1
  193. package/calibration/skills/decompose/seeds/s2-nongoal-bait/recap.json +0 -8
  194. package/calibration/skills/decompose/seeds/s3-duplicated-fact/expect.json +0 -1
  195. package/calibration/skills/decompose/seeds/s3-duplicated-fact/recap.json +0 -11
  196. package/calibration/skills/decompose/seeds/s4-fix-routes-amend/canon/checkout-flow.md +0 -19
  197. package/calibration/skills/decompose/seeds/s4-fix-routes-amend/canon/payment-retry.md +0 -20
  198. package/calibration/skills/decompose/seeds/s4-fix-routes-amend/expect.json +0 -1
  199. package/calibration/skills/decompose/seeds/s4-fix-routes-amend/recap.json +0 -8
  200. package/calibration/skills/decompose/seeds/s5-chore-no-specs/canon/checkout-flow.md +0 -19
  201. package/calibration/skills/decompose/seeds/s5-chore-no-specs/expect.json +0 -1
  202. package/calibration/skills/decompose/seeds/s5-chore-no-specs/recap.json +0 -8
  203. package/calibration/skills/implement/seeds/s1-add-function/plan.body.md +0 -5
  204. package/calibration/skills/implement/seeds/s1-add-function/plan.meta.json +0 -7
  205. package/calibration/skills/implement/seeds/s1-add-function/recap.json +0 -8
  206. package/calibration/skills/implement/seeds/s1-add-function/repo/package.json +0 -1
  207. package/calibration/skills/implement/seeds/s1-add-function/repo/src/clamp.mjs +0 -2
  208. package/calibration/skills/implement/seeds/s1-add-function/spec.body.md +0 -8
  209. package/calibration/skills/implement/seeds/s1-add-function/spec.meta.json +0 -8
  210. package/calibration/skills/implement/seeds/s2-fix-bug/plan.body.md +0 -6
  211. package/calibration/skills/implement/seeds/s2-fix-bug/plan.meta.json +0 -7
  212. package/calibration/skills/implement/seeds/s2-fix-bug/recap.json +0 -8
  213. package/calibration/skills/implement/seeds/s2-fix-bug/repo/package.json +0 -1
  214. package/calibration/skills/implement/seeds/s2-fix-bug/repo/src/slug.mjs +0 -7
  215. package/calibration/skills/implement/seeds/s2-fix-bug/repo/tests/slug.test.mjs +0 -7
  216. package/calibration/skills/implement/seeds/s2-fix-bug/spec.body.md +0 -9
  217. package/calibration/skills/implement/seeds/s2-fix-bug/spec.meta.json +0 -8
  218. package/calibration/skills/implement/seeds/s3-two-steps/plan.body.md +0 -11
  219. package/calibration/skills/implement/seeds/s3-two-steps/plan.meta.json +0 -10
  220. package/calibration/skills/implement/seeds/s3-two-steps/recap.json +0 -8
  221. package/calibration/skills/implement/seeds/s3-two-steps/repo/package.json +0 -1
  222. package/calibration/skills/implement/seeds/s3-two-steps/repo/src/pad.mjs +0 -2
  223. package/calibration/skills/implement/seeds/s3-two-steps/spec.body.md +0 -9
  224. package/calibration/skills/implement/seeds/s3-two-steps/spec.meta.json +0 -11
  225. package/calibration/skills/plan/seeds/s1-two-criteria/expect.json +0 -1
  226. package/calibration/skills/plan/seeds/s1-two-criteria/parent.body.md +0 -10
  227. package/calibration/skills/plan/seeds/s1-two-criteria/parent.meta.json +0 -11
  228. package/calibration/skills/plan/seeds/s1-two-criteria/recap.json +0 -8
  229. package/calibration/skills/plan/seeds/s2-five-criteria/expect.json +0 -1
  230. package/calibration/skills/plan/seeds/s2-five-criteria/parent.body.md +0 -11
  231. package/calibration/skills/plan/seeds/s2-five-criteria/parent.meta.json +0 -14
  232. package/calibration/skills/plan/seeds/s2-five-criteria/recap.json +0 -8
  233. package/calibration/skills/plan/seeds/s3-mixed-needs/expect.json +0 -1
  234. package/calibration/skills/plan/seeds/s3-mixed-needs/parent.body.md +0 -10
  235. package/calibration/skills/plan/seeds/s3-mixed-needs/parent.meta.json +0 -11
  236. package/calibration/skills/plan/seeds/s3-mixed-needs/recap.json +0 -8
  237. package/calibration/skills/plan/seeds/s4-scaffolding-pull/expect.json +0 -1
  238. package/calibration/skills/plan/seeds/s4-scaffolding-pull/parent.body.md +0 -9
  239. package/calibration/skills/plan/seeds/s4-scaffolding-pull/parent.meta.json +0 -10
  240. package/calibration/skills/plan/seeds/s4-scaffolding-pull/recap.json +0 -8
  241. package/calibration.yaml +0 -5
  242. package/dist/calibrate.js +0 -750
  243. package/dist/verbs/calibrate.js +0 -144
package/dist/gate.js CHANGED
@@ -13,12 +13,12 @@ import { newRunId } from './drift.js';
13
13
  import { resolveJudge } from './harness.js';
14
14
  import { ok, renderRefusal, v } from './refusal.js';
15
15
  import { cmd, kv, rows } from './toon.js';
16
- import { loadMatrix, resolveModel } from './model.js';
16
+ import { stageModel, unansweredPin } from './model.js';
17
17
  import { docKeysFor, docsBlock, loadLensDocs, pinsBlock, promptsSha, resolvePrompt } from './reviewer.js';
18
18
  import { runBattery } from './battery.js';
19
19
  import { anchorFromKey, anchorKey, anchorMenu } from './verdict.js';
20
20
  import { basisSha, deltaBlock, demote, demotionsBlock, outstandingDemotions, planDelta, reportedBy } from './delta.js';
21
- import { ROUND_BOUND, appendKind, boundReached, fellBack, lastGateRun, liveExits, roundBudget, roundsSinceApprove, runsSinceReset, } from './rounds.js';
21
+ import { ROUND_BOUND, appendKind, boundReached, lastGateRun, liveExits, roundBudget, roundsSinceApprove, runsSinceReset, } from './rounds.js';
22
22
  export { liveExits } from './rounds.js';
23
23
  import { gateSettled, owedRun } from './verbs/next.js';
24
24
  import { prepareStamp, writeStamp } from './stamp.js';
@@ -46,7 +46,7 @@ export function renderGateRun(ctx, entry, mode, opts = {}) {
46
46
  ctx.out(kv('target', entry.artifact));
47
47
  ctx.out(kv('round', `${entry.round} of ${budget}${mode === 'resume' ? ' (resume — content unchanged)' : ''}`));
48
48
  ctx.out(kv('reviewed', entry.reviewed_sha.slice(0, 7)));
49
- ctx.out(kv('model', `${entry.model} · calibration: ${entry.calibration}${entry.cached ? ' · cached' : ''}`));
49
+ ctx.out(kv('model', `${entry.model}${entry.cached ? ' · cached' : ''}`));
50
50
  if (entry.delta)
51
51
  ctx.out(kv('review', `delta since round ${entry.delta.round}`));
52
52
  if (entry.skipped?.length)
@@ -55,6 +55,9 @@ export function renderGateRun(ctx, entry, mode, opts = {}) {
55
55
  ctx.out(kv('fallback', entry.fallback.join(' → ')));
56
56
  if (entry.rerolled?.length)
57
57
  ctx.out(kv('rerolled', entry.rerolled.join(' · ')));
58
+ if (entry.carried) {
59
+ ctx.out(kv('carried', `${entry.carried.lenses.join(' · ')} — answered in run ${entry.carried.run} on this content and prompts`));
60
+ }
58
61
  ctx.out(rows('checks', ['name', 'ok', 'detail'], entry.checks.map((c) => ({ name: c.name, ok: String(c.ok), detail: c.detail ?? '' }))).join('\n'));
59
62
  // Row 179: what the lane did not run, beside the row that passed without it.
60
63
  for (const h of entry.checks.flatMap((c) => c.held ?? []))
@@ -257,21 +260,15 @@ async function judge(ctx, gateName, target, flags) {
257
260
  timeoutMs: cfgR.value.gates.reviewerTimeoutMs,
258
261
  extensions: localR.value.reviewerExtensions,
259
262
  };
260
- const modelR = resolveModel(cfgR.value, loadMatrix(root, harness.name), spec.gate);
263
+ const modelR = stageModel(cfgR.value, spec.gate);
261
264
  if (!modelR.ok) {
262
265
  renderRefusal(modelR.violations).forEach((l) => ctx.err(l));
263
266
  return EXIT.REFUSED;
264
267
  }
265
- const { chain, calibrationOf, warning, warningKind } = modelR.value;
266
- // matrix-empty is a fact about this witness build, reported once by `status`/`check`
267
- // (D98a). Only the caller's own pin being below the floor is news at run time.
268
- if (warning && warningKind === 'below-floor')
269
- ctx.err(`warning: ${warning}`);
270
- // Row 106: the key is built BEFORE invoking, so the only model knowable here is the one
271
- // being asked for. Naming it `pin` is what stops the entry's `model` — what actually
272
- // answered — from being compared against it by accident, which is how the streak brake
273
- // below spent three releases never firing.
274
- const pin = chain[0];
268
+ // Row 106: the key is built BEFORE invoking, so the model it names is the one being asked
269
+ // for. Since row 212 that is the only model a lens is asked on, but a 0.25.x round's
270
+ // `model` may name a stand-in, so the brake below compares `pin`.
271
+ const pin = modelR.value;
275
272
  const basis = basisSha(lenses, input.snapshot?.context ?? '', pin, harness.name);
276
273
  const backstopped = spec.backstops ? outstandingDemotions(entries, spec.backstops) : [];
277
274
  const backstopText = spec.backstops ? demotionsBlock(spec.backstops, backstopped) : '';
@@ -358,20 +355,6 @@ async function judge(ctx, gateName, target, flags) {
358
355
  // disposed of and can trip nothing.
359
356
  const tail = runsSinceReset(entries, spec.gate).slice(-2);
360
357
  const samePin = (r) => (r.pin ?? r.model) === key.pin && (r.harness ?? 'claude-code') === key.harness;
361
- // Row 107. A fallen-back round does not spend the budget, and an exempt round that
362
- // repeats forever is D67's livelock — the exemption and this trigger are one change.
363
- // `prompts_sha` is deliberately NOT compared: a lens edit has nothing to do with
364
- // whether a model answers, and comparing it would let an unrelated edit reset a brake
365
- // on a dead pin. Checked first because when both hold, "the pinned model is not
366
- // answering" is the true remedy and "your battery emits invalid verdicts" is not.
367
- // No --fresh in the want: --fresh bypasses the brake and would spend a battery
368
- // re-invoking the same dead pin. Fixing the pin moves key.pin, samePin goes false,
369
- // and the battery runs — which is only reachable BECAUSE these rounds were exempt.
370
- if (tail.length === 2 && tail.every((r) => fellBack(r) && samePin(r))) {
371
- renderRefusal([v(`gates.${spec.gate}.model`, 'fallback-streak', `${tail.length} consecutive rounds fell back from ${key.pin}`, 'a reachable gates.<gate>.model — the pinned model is not answering')])
372
- .forEach((l) => ctx.err(l));
373
- return EXIT.REFUSED;
374
- }
375
358
  // malformed rounds don't spend the bound either — this brake is what stops an
376
359
  // unreliable battery from re-running for free forever instead. Row 106: "same setup"
377
360
  // always meant the same PIN, and comparing the answering rung meant two malformed
@@ -389,19 +372,26 @@ async function judge(ctx, gateName, target, flags) {
389
372
  // Holding the repo-global lock across a multi-minute LLM battery refuses every state
390
373
  // write in every other flow for its full duration, on a lock whose real job is a ~100ms
391
374
  // commit. The guarded window opens below, immediately before the journal append.
392
- // Full review first: a delta is planned only for a round that will judge (the key is fresh).
393
- const delta = kind.kind === 'fresh'
375
+ // Full review first: a delta is planned only for a round that will judge (the key is fresh,
376
+ // or a malformed round is being repaired).
377
+ const delta = kind.kind === 'fresh' || kind.kind === 'repair'
394
378
  ? planDelta(root, entries, spec.gate, { reviewedSha: input.reviewedSha, snapshot: input.snapshot, basis, reviewed: input.reviewed, inDelta })
395
379
  : undefined;
396
380
  const block = delta ? deltaBlock(delta) : '';
381
+ const askedSha = delta ? promptsSha(lenses, setupText + block) : setupSha;
382
+ // Row 209. A repair carries verdicts only when the question is the same: a moved delta base
383
+ // (git gc pruned it, a judged round landed) asks every lens what the malformed round did not.
384
+ if (kind.kind === 'repair' && kind.from.prompts_sha !== askedSha)
385
+ kind = { kind: 'fresh' };
386
+ const repairFrom = kind.kind === 'repair' ? kind.from : undefined;
397
387
  // A replayed delta verdict re-serves a round that already discharged all its silence could.
398
388
  const replayedDelta = kind.kind === 'cached' && kind.from.delta !== undefined;
399
389
  let verdicts = [];
400
390
  let malformed = [];
401
- let fallback = [];
402
391
  let rerolled = [];
403
392
  let model = pin;
404
393
  let cached = false;
394
+ let carried = [];
405
395
  if (kind.kind === 'cached') {
406
396
  verdicts = kind.from.verdicts ?? [];
407
397
  model = kind.from.model;
@@ -411,7 +401,9 @@ async function judge(ctx, gateName, target, flags) {
411
401
  // Row 169: every lens at once — a round's wall clock is its slowest lens, not their sum.
412
402
  const composed = lenses.map((lens) => {
413
403
  const ov = input.lensOverrides?.[lens.name];
414
- const reviewed = ov?.reviewed ?? input.reviewed;
404
+ // Row 208. A delta-mode lens's floor counts the change; an override lens reviews in full.
405
+ const reviewed = ov?.reviewed ?? (delta?.paths && input.reviewed.kind === 'tree'
406
+ ? { ...input.reviewed, floor: { round: delta.baseRound, paths: delta.paths } } : input.reviewed);
415
407
  const body = ov?.promptBody ?? input.promptBody;
416
408
  const menu = anchorMenu(reviewed);
417
409
  return {
@@ -419,13 +411,23 @@ async function judge(ctx, gateName, target, flags) {
419
411
  prompt: `${lens.contents}\n\n${docsBlock(lens.docs ?? [])}${pinsText}${deferralsText}${backstopText}${delta && inDelta(lens.name) ? block : ''}${menu ? `${menu}\n\n` : ''}## Reviewed content\n\n${body}\n`,
420
412
  };
421
413
  });
422
- const ranR = await runBattery(ctx, harness, chain, composed, { cwd: root, ...extras });
414
+ // Row 209. A repair asks only the lenses with no verdict in the malformed round. Both runs
415
+ // asked the pin alone (row 212; appendKind never repairs a 0.25.x fallen-back round), so
416
+ // the round's `model` stays the pin.
417
+ const kept = new Map((repairFrom?.verdicts ?? []).map((rv) => [rv.reviewer, rv]));
418
+ const pinField = `gates.${spec.gate}.model`;
419
+ const ranR = await runBattery(ctx, harness, pin, composed.filter((l) => !kept.has(l.name)), { cwd: root, pinField, ...extras });
423
420
  if (!ranR.ok) {
424
- renderRefusal(ranR.violations).forEach((l) => ctx.err(l));
421
+ renderRefusal(unansweredPin(ranR.violations, pinField, pin, harness.name)).forEach((l) => ctx.err(l));
425
422
  return EXIT.REFUSED;
426
423
  }
427
424
  ;
428
- ({ verdicts, malformed, fallback, rerolled, model } = ranR.value);
425
+ ({ malformed } = ranR.value);
426
+ const answered = new Map(ranR.value.verdicts.map((rv) => [rv.reviewer, rv]));
427
+ const names = lenses.map((l) => l.name);
428
+ verdicts = names.flatMap((n) => { const rv = kept.get(n) ?? answered.get(n); return rv ? [rv] : []; });
429
+ carried = names.filter((n) => kept.has(n));
430
+ rerolled = names.filter((n) => (kept.has(n) ? repairFrom?.rerolled ?? [] : ranR.value.rerolled).includes(n));
429
431
  // A malformed round judged nothing, so it demotes nothing.
430
432
  // A backstopping gate never demotes what it backstops: it promised the listed finding blocks here.
431
433
  if (delta && spec.demotes && malformed.length === 0) {
@@ -438,17 +440,6 @@ async function judge(ctx, gateName, target, flags) {
438
440
  const standing = [
439
441
  input.standingStop,
440
442
  pinConflicts > 0 ? 'contradicts-pin — a finding disputes a settled policy pin; the human decides which one dies' : undefined,
441
- // Row 98c, specified by row 107. Composed HERE, after the battery, because whether a
442
- // fallback happened is not knowable at resolve() time. Dismissed by a plain
443
- // --approve: --override is reserved for the bound and this is a first-round event.
444
- // The remedy is deliberately absent — on round one the honest statement is that a
445
- // human decides whether the verdict counts; the remedy becomes true only once the pin
446
- // proves persistently dead, which is what fallback-streak above prints. It REPLACES
447
- // the stderr warning that fired on this same condition: unjournaled and non-blocking,
448
- // it let a substituted verdict pass behind a line that scrolls by.
449
- model !== pin
450
- ? `fallback — reviewers ran on ${model}, not the pinned ${pin}; the human decides whether that verdict counts`
451
- : undefined,
452
443
  ].filter((s) => s !== undefined).join(' · ') || undefined;
453
444
  const checksGreen = input.checks.every((c) => c.ok);
454
445
  const outcome = malformed.length > 0 ? 'malformed'
@@ -483,13 +474,13 @@ async function judge(ctx, gateName, target, flags) {
483
474
  const entry = {
484
475
  v: 1, t: 'gate-run', gate: spec.gate, artifact: target,
485
476
  round: roundsSinceApprove(entriesNow, spec.gate) + 1, run_id: newRunId(),
486
- reviewed_sha: input.reviewedSha, prompts_sha: delta ? promptsSha(lenses, setupText + block) : setupSha,
487
- witness: key.witness, model, pin, harness: harness.name, calibration: calibrationOf(model),
477
+ reviewed_sha: input.reviewedSha, prompts_sha: askedSha,
478
+ witness: key.witness, model, pin, harness: harness.name,
488
479
  ...(localR.value.reviewerExtensions.length ? { reviewer_extensions: localR.value.reviewerExtensions } : {}),
489
480
  ...(cached ? { cached: true } : {}),
490
481
  ...(flags.manual ? { manual: true } : {}),
491
- ...(fallback.length ? { fallback } : {}),
492
482
  ...(rerolled.length ? { rerolled } : {}),
483
+ ...(repairFrom && carried.length ? { carried: { run: repairFrom.run_id, lenses: carried } } : {}),
493
484
  ...(dropped.length ? { skipped: dropped } : {}),
494
485
  ...(outcome === 'stopped' && standing ? { standing } : {}),
495
486
  ...(input.artifactSha ? { artifact_sha: input.artifactSha } : {}),
package/dist/gitio.js CHANGED
@@ -102,6 +102,9 @@ const LOCAL_STATE_FILES = new Set([
102
102
  '.witness/drive.lock.steal',
103
103
  '.witness/txn.json',
104
104
  '.witness/allow.json',
105
+ // Row 212: `witness calibrate` wrote this through 0.25.x. Nothing reads it now, but a repo
106
+ // scaffolded before init ignored it may still hold one untracked, and an unrelated-dirty
107
+ // refusal there would block every state write.
105
108
  '.witness/calibration.local.yaml',
106
109
  // Row 90's machine-config file is this tier too, and the exemption is load-bearing
107
110
  // rather than belt-and-braces: init only gitignores it for repos scaffolded at
package/dist/harness.js CHANGED
@@ -156,9 +156,9 @@ const REGISTRY = {
156
156
  worker: {
157
157
  // No bypass flag exists or is needed: pi's built-in tools are not approval-gated
158
158
  // (`pi --help` lists only --approve/--no-approve, which govern trusting
159
- // project-local files). --no-session keeps a calibration run out of the user's
160
- // session store; the worker otherwise keeps its skills and context files, which
161
- // are exactly what the implement seed is measuring.
159
+ // project-local files). --no-session keeps a headless worker's run out of the user's
160
+ // session store; the worker otherwise keeps its skills and context files, which a
161
+ // drive session runs on.
162
162
  spawn: (prompt, model) => ({ cmd: 'pi', args: ['-p', prompt, '--no-session', ...modelFlags(REGISTRY.pi, model)], env: {} }),
163
163
  },
164
164
  },
@@ -195,8 +195,8 @@ function walk(ladder) {
195
195
  const r = loadHarness(rung.name);
196
196
  return r.ok ? ok({ harness: r.value, source: rung.source }) : refuse(r.violations);
197
197
  }
198
- // THE JUDGE — which harness runs this repo's gate reviewers, reads its calibration matrix
199
- // and is probed for runnability. A committed declaration wins, because reviewer identity
198
+ // THE JUDGE — which harness runs this repo's gate reviewers and is probed for
199
+ // runnability. A committed declaration wins, because reviewer identity
200
200
  // is a property of the repo's evidence trail and must be comparable across machines; row
201
201
  // 88 already said an identity chosen by ambient environment is the opposite of a pin.
202
202
  export function resolveJudge(env, declared) {
@@ -209,10 +209,10 @@ export function resolveJudge(env, declared) {
209
209
  export function resolveDriver(env, declared) {
210
210
  return walk([detectedRung(env), declaredRung(declared)]);
211
211
  }
212
- // One renderer for both orientation surfaces, on modelFloorLines' precedent: the judge
213
- // must read identically on `check` and `status`, or the two screens disagree about which
214
- // binary judges the same repo. Provenance is RENDERED here, never stored — HarnessSource
215
- // stays a resolution fact and the wording stays a presentation one.
212
+ // One renderer for both orientation surfaces: the judge must read identically on `check`
213
+ // and `status`, or the two screens disagree about which binary judges the same repo.
214
+ // Provenance is RENDERED here, never stored — HarnessSource stays a resolution fact and the
215
+ // wording stays a presentation one.
216
216
  //
217
217
  // It prints in every state, including `declared`: that line read from a foreign session
218
218
  // is exactly what row 105 exists to surface, and a line that appeared only in the bad
@@ -233,7 +233,7 @@ export function judgeLine(r) {
233
233
  // Decision 9: the model flag is a renderer, not a string. Pi's default provider is
234
234
  // `google`, so a bare `--model claude-opus-5` in a Pi handoff resolves wrong or not at
235
235
  // all — and a relay session silently running an unpinned model corrupts what row 83's
236
- // pins and the calibration story rest on.
236
+ // pins rest on.
237
237
  //
238
238
  // Revision 9: the provider is the HARNESS's default, never a config key.
239
239
  //
package/dist/migration.js CHANGED
@@ -144,7 +144,7 @@ export function migrateValues(raw, from, opts) {
144
144
  }
145
145
  }
146
146
  // What is missing takes the current default. An ambient setting meant something else while
147
- // absent (the judge ladder, the model chain, "not configured"), so only a write fills it —
147
+ // absent (the judge ladder, the session default, "not configured"), so only a write fills it —
148
148
  // the judge with the session's own harness — and names it `filled`.
149
149
  for (const s of list) {
150
150
  if (s.since > to || getIn(out, s.path) !== undefined || !fillable(out, s.path))
package/dist/model.js CHANGED
@@ -1,35 +1,10 @@
1
- import { existsSync, readFileSync } from 'node:fs';
2
- import { dirname, join } from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
- import { parse } from 'yaml';
5
- import { checkPin } from './pin.js';
6
- import { ok, refuse } from './refusal.js';
1
+ import { checkPin, parsePin } from './pin.js';
2
+ import { humanCall, ok, refuse, v } from './refusal.js';
7
3
  export { MODEL_ALIASES } from './pin.js';
8
4
  export const SESSION_DEFAULT = 'session-default';
9
- export function shippedMatrixPath() {
10
- return join(dirname(fileURLToPath(import.meta.url)), '..', 'calibration.yaml');
11
- }
12
- // Per-(harness, model) calibration (Decision 88): a pi-invoked reviewer on the same
13
- // model id is a DIFFERENT reviewer. Legacy top-level `models:` predates the harness
14
- // dimension and was only ever measured through claude -p — it reads as claude-code.
15
- function readModels(path, harness) {
16
- if (!existsSync(path))
17
- return [];
18
- const doc = parse(readFileSync(path, 'utf8'));
19
- const scoped = doc?.matrices?.[harness]?.models;
20
- if (Array.isArray(scoped))
21
- return scoped.map(String);
22
- return harness === 'claude-code' && Array.isArray(doc?.models) ? doc.models.map(String) : [];
23
- }
24
- export function loadMatrix(root, harness) {
25
- return {
26
- shipped: readModels(shippedMatrixPath(), harness),
27
- local: readModels(join(root, '.witness', 'calibration.local.yaml'), harness),
28
- };
29
- }
30
5
  // A stage's model pin, from its own setting (row 193: nothing inherited). A gate's pin drives
31
6
  // its reviewers AND, for implement, its worker agent; the arbiter's is its own (row 172).
32
- // Undefined only for an older file that never pinned one: the calibration chain decides.
7
+ // Undefined only for an older file that never pinned one: the session default answers.
33
8
  export function stagePin(cfg, role) {
34
9
  const pin = role === 'arbiter' ? cfg.arbiter.model : cfg.gates[role].model;
35
10
  if (pin === undefined)
@@ -37,45 +12,37 @@ export function stagePin(cfg, role) {
37
12
  const checked = checkPin(role === 'arbiter' ? 'arbiter.model' : `gates.${role}.model`, pin);
38
13
  return checked.ok ? ok(pin) : refuse(checked.violations);
39
14
  }
40
- export function resolveModel(cfg, matrix, role) {
15
+ // Row 212. The one model a stage's reviewers (or the arbiter) are asked on: its pin, else the
16
+ // session default. There is no stand-in — a model that cannot be invoked refuses the gate.
17
+ export function stageModel(cfg, role) {
41
18
  const pinR = stagePin(cfg, role);
42
19
  if (!pinR.ok)
43
20
  return refuse(pinR.violations);
44
- const pin = pinR.value;
45
- const calibrated = [...matrix.shipped, ...matrix.local.filter((m) => !matrix.shipped.includes(m))];
46
- const chain = [];
47
- if (pin !== undefined)
48
- chain.push(pin);
49
- for (const m of calibrated)
50
- if (!chain.includes(m))
51
- chain.push(m);
52
- chain.push(SESSION_DEFAULT);
53
- const calibrationOf = (id) => matrix.shipped.includes(id) ? 'shipped' : matrix.local.includes(id) ? 'local' : 'none';
54
- const head = chain[0];
55
- const headLabel = head === SESSION_DEFAULT ? '(session default)' : head;
56
- const matrixEmpty = matrix.shipped.length === 0 && matrix.local.length === 0;
57
- const warningKind = calibrationOf(head) !== 'none'
58
- ? undefined
59
- : matrixEmpty ? 'matrix-empty' : 'below-floor';
60
- const warning = warningKind === undefined
61
- ? undefined
62
- : warningKind === 'matrix-empty'
63
- ? `calibration matrix is empty — no calibrated model exists yet; ${headLabel} runs uncalibrated`
64
- : `reviewer model ${headLabel} is below the model floor — no calibration matrix entry covers it`;
65
- return ok({ chain, calibrationOf, warning, warningKind });
21
+ return ok(pinR.value ?? SESSION_DEFAULT);
22
+ }
23
+ // Row 212 (C3). Every stand-in round in the field came from a pin edited into a model the
24
+ // harness could not invoke, so a refusal on a pinned model names the setting to fix. It is a
25
+ // human's call only when the harness's own error names that model as one it cannot run — only
26
+ // the config's owner knows which model they meant. Anything else (a provider blip, a missing
27
+ // binary, an expired login) is named, not blamed: clearing that error and re-running is the
28
+ // fix, and the human trailer would say re-running cannot clear it.
29
+ export function unansweredPin(rows, field, model, harness) {
30
+ if (model === SESSION_DEFAULT)
31
+ return rows;
32
+ const failed = rows.filter((x) => x.rule === 'reviewer-invocation');
33
+ if (failed.length === 0)
34
+ return rows;
35
+ const named = failed.some((x) => namesMissingModel(x.got, model));
36
+ const row = v(field, 'pin-unanswered', model, named
37
+ ? `a model the ${harness} harness can invoke — its error names this pin, so fix it in witness.config.yaml`
38
+ : `a model the ${harness} harness can invoke — if the error above is about this pin, fix it in witness.config.yaml; otherwise clear that error and re-run`);
39
+ return [...rows, named ? humanCall(row) : row];
66
40
  }
67
- // One renderer for both orientation surfaces (`status` and `check`). Lives here because
68
- // the grouping rule — one line per distinct warning, labelled with the gates it covers —
69
- // is a property of the resolution, not of either screen. Returns `[]` when every gate's
70
- // model is calibrated.
71
- export function modelFloorLines(root, cfg, harness) {
72
- const matrix = loadMatrix(root, harness);
73
- const byWarning = new Map();
74
- for (const gate of ['decompose', 'plan', 'implement', 'ship', 'design']) {
75
- const r = resolveModel(cfg, matrix, gate);
76
- if (r.ok && r.value.warning) {
77
- byWarning.set(r.value.warning, [...(byWarning.get(r.value.warning) ?? []), gate]);
78
- }
79
- }
80
- return [...byWarning].map(([warning, gates]) => `${gates.join(' · ')}: ${warning}`);
41
+ // The model id itself in the error, beside a phrase saying it cannot be run: claude's
42
+ // `not_found_error` and its "issue with the selected model" text, pi's "not found" — an error
43
+ // that names no model (a 5xx, a login, ENOENT) is about something else.
44
+ const MISSING_MODEL = /not.?found|not exist|unknown|invalid|unsupported|not available|access to/i;
45
+ function namesMissingModel(got, pin) {
46
+ const parsed = parsePin('model', pin);
47
+ return got.includes(parsed.ok ? parsed.value.model : pin) && MISSING_MODEL.test(got);
81
48
  }
package/dist/notify.js CHANGED
@@ -1,6 +1,5 @@
1
- import { win32 } from 'node:path';
2
1
  import { resolves } from './opener.js';
3
- import { envGet, spawn, spawnSync } from './spawn.js';
2
+ import { spawn, spawnSync, system32 } from './spawn.js';
4
3
  // Row 184. The desktop notification an autonomous run ends with (design B6). A machine-local
5
4
  // `notify:` command receives the message as its one argument; otherwise the platform notifier.
6
5
  // Row 203 (issue #56): Windows gets a toast by default, and drive notifies each new item.
@@ -26,7 +25,7 @@ export function notifyArgv(platform, configured, title, message, env = process.e
26
25
  return { argv: ['notify-send', title, message] };
27
26
  if (platform === 'win32') {
28
27
  // Row 201's doctrine: a System32 binary by its absolute path, never one PATH could shadow.
29
- const ps = win32.join(envGet(env, 'SYSTEMROOT') ?? 'C:\\Windows', 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe');
28
+ const ps = system32(env, 'WindowsPowerShell', 'v1.0', 'powershell.exe');
30
29
  return {
31
30
  argv: [ps, '-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', TOAST_SCRIPT],
32
31
  env: { WITNESS_NOTIFY_TITLE: title, WITNESS_NOTIFY_TEXT: message },
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 — aliases re-point under the calibration (Decision 55)')]);
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/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 acts that actually help rather than four dispositions.
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 full calibration battery is ~200
95
- // invocations over hours, and treating a transient stall as fatal throws away every
96
- // sample already paid for. Retries are bounded so a genuinely wedged binary still ends.
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, 'gates.model', opts.model);
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
- // Calibration's lane never waits: it refuses a limit as an attended gate does.
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 three consumers — the cache/resume exclusion below, the
22
- // budget exemption in roundsSinceApprove, and gate.ts's streak brake — because the
23
- // inline form inverts silently, and a flipped exemption is a budget that never spends.
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 brakes guard:
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 falls back again and
270
- // row 107's fallback-streak brake stops it with the remedy that is actually true.
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
- return revised ? { kind: 'changed-nothing', entry: last } : { kind: 'resume', entry: last };
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--) {
@@ -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 chain).
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
@@ -114,7 +114,12 @@ export async function settleStop(ctx, root, cfg, gate, target) {
114
114
  const rule = ruling.violations[0]?.rule ?? 'unknown';
115
115
  renderRefusal(ruling.violations).forEach((l) => ctx.err(l));
116
116
  renderDecision(block).forEach((l) => ctx.out(l));
117
- const why = `the arbiter could not be invoked (${rule})`;
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})`;
118
123
  ctx.out(leftLine(gate, target, why));
119
124
  // Final review F6: a usage limit is named, so drive can wait it out as its own pause.
120
125
  const limited = ruling.violations.find((x) => x.rule === 'usage-limit');