@popovych.co/witness 0.28.2 → 0.28.3
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/README.md +1 -1
- package/dist/abandon.d.ts +67 -0
- package/dist/act.d.ts +16 -0
- package/dist/act.js +61 -0
- package/dist/adopt.d.ts +21 -0
- package/dist/allowlist.d.ts +48 -0
- package/dist/allowlist.js +79 -5
- package/dist/arbiter.d.ts +37 -0
- package/dist/arbiter.js +7 -5
- package/dist/ask.d.ts +29 -0
- package/dist/ask.js +11 -5
- package/dist/autonomy.d.ts +46 -0
- package/dist/autonomy.js +24 -12
- package/dist/awake.d.ts +15 -0
- package/dist/basis.d.ts +9 -0
- package/dist/battery.d.ts +23 -0
- package/dist/bin.d.ts +2 -0
- package/dist/caps.d.ts +20 -0
- package/dist/cli.d.ts +18 -0
- package/dist/config-file.d.ts +12 -0
- package/dist/config.d.ts +96 -0
- package/dist/config.js +2 -1
- package/dist/contain.d.ts +16 -0
- package/dist/context.d.ts +25 -0
- package/dist/criteria.d.ts +27 -0
- package/dist/criteria.js +2 -1
- package/dist/decide-view.d.ts +46 -0
- package/dist/decide-view.js +137 -0
- package/dist/decisions.d.ts +23 -0
- package/dist/deferral.d.ts +26 -0
- package/dist/delta.d.ts +58 -0
- package/dist/departure.d.ts +66 -0
- package/dist/design.d.ts +34 -0
- package/dist/drafts.d.ts +31 -0
- package/dist/drafts.js +5 -3
- package/dist/drift.d.ts +23 -0
- package/dist/drive-presence.d.ts +27 -0
- package/dist/drive-presence.js +15 -4
- package/dist/drive-report.d.ts +24 -0
- package/dist/drive-report.js +4 -4
- package/dist/drive.d.ts +97 -0
- package/dist/drive.js +68 -71
- package/dist/dsl.d.ts +23 -0
- package/dist/dsl.js +8 -3
- package/dist/evidence.d.ts +65 -0
- package/dist/floor.d.ts +6 -0
- package/dist/fm.d.ts +9 -0
- package/dist/gate-run-view.d.ts +57 -0
- package/dist/gate-run-view.js +100 -0
- package/dist/gate.d.ts +91 -0
- package/dist/gate.js +14 -67
- package/dist/gates/decompose.d.ts +1 -0
- package/dist/gates/decompose.js +3 -1
- package/dist/gates/design.d.ts +1 -0
- package/dist/gates/design.js +6 -2
- package/dist/gates/implement.d.ts +1 -0
- package/dist/gates/implement.js +9 -2
- package/dist/gates/index.d.ts +5 -0
- package/dist/gates/plan.d.ts +1 -0
- package/dist/gates/plan.js +10 -4
- package/dist/gates/ship.d.ts +1 -0
- package/dist/gates/ship.js +4 -2
- package/dist/gitio.d.ts +30 -0
- package/dist/gitio.js +4 -1
- package/dist/glob.d.ts +2 -0
- package/dist/harness.d.ts +73 -0
- package/dist/harness.js +36 -15
- package/dist/history.d.ts +10 -0
- package/dist/idlists.d.ts +2 -0
- package/dist/install.d.ts +29 -0
- package/dist/journal.d.ts +74 -0
- package/dist/journal.js +5 -1
- package/dist/junit.d.ts +9 -0
- package/dist/live.d.ts +24 -0
- package/dist/lock.d.ts +9 -0
- package/dist/matcher.d.ts +8 -0
- package/dist/migration.d.ts +25 -0
- package/dist/model.d.ts +8 -0
- package/dist/models.d.ts +9 -0
- package/dist/models.js +10 -0
- package/dist/needs-you.d.ts +75 -0
- package/dist/needs-you.js +104 -40
- package/dist/needs.d.ts +44 -0
- package/dist/needs.js +37 -7
- package/dist/notify.d.ts +12 -0
- package/dist/opener.d.ts +15 -0
- package/dist/pin.d.ts +12 -0
- package/dist/pin.js +9 -2
- package/dist/principles.d.ts +3 -0
- package/dist/probe.d.ts +1 -0
- package/dist/progress.d.ts +3 -0
- package/dist/recommend.d.ts +31 -0
- package/dist/recommend.js +51 -42
- package/dist/refusal.d.ts +20 -0
- package/dist/refusal.js +12 -4
- package/dist/registry.d.ts +1 -0
- package/dist/released-comments.d.ts +1 -0
- package/dist/review.d.ts +27 -0
- package/dist/reviewed.d.ts +23 -0
- package/dist/reviewer.d.ts +47 -0
- package/dist/rounds.d.ts +135 -0
- package/dist/rounds.js +38 -21
- package/dist/runner-lock.d.ts +5 -0
- package/dist/runner.d.ts +30 -0
- package/dist/scan.d.ts +27 -0
- package/dist/schemas.d.ts +11 -0
- package/dist/schemas.js +7 -3
- package/dist/session-clock.d.ts +16 -0
- package/dist/settings.d.ts +73 -0
- package/dist/settings.js +12 -2
- package/dist/settle.d.ts +39 -0
- package/dist/settle.js +59 -30
- package/dist/sha.d.ts +5 -0
- package/dist/ship.d.ts +20 -0
- package/dist/ship.js +21 -12
- package/dist/slice.d.ts +45 -0
- package/dist/slice.js +2 -2
- package/dist/snapshot.d.ts +10 -0
- package/dist/spawn.d.ts +22 -0
- package/dist/stamp.d.ts +27 -0
- package/dist/stamp.js +3 -1
- package/dist/steps.d.ts +30 -0
- package/dist/steps.js +8 -3
- package/dist/toon.d.ts +17 -0
- package/dist/toon.js +150 -14
- package/dist/txn.d.ts +28 -0
- package/dist/usage.d.ts +25 -0
- package/dist/verbs/abandon.d.ts +2 -0
- package/dist/verbs/adopt.d.ts +2 -0
- package/dist/verbs/adopt.js +9 -4
- package/dist/verbs/ask.d.ts +2 -0
- package/dist/verbs/check.d.ts +2 -0
- package/dist/verbs/check.js +29 -10
- package/dist/verbs/clean.d.ts +2 -0
- package/dist/verbs/dashboard.d.ts +59 -0
- package/dist/verbs/dashboard.js +4 -2
- package/dist/verbs/decide.d.ts +34 -0
- package/dist/verbs/decide.js +95 -130
- package/dist/verbs/design.d.ts +2 -0
- package/dist/verbs/design.js +8 -5
- package/dist/verbs/diff.d.ts +2 -0
- package/dist/verbs/diff.js +4 -2
- package/dist/verbs/dismiss.d.ts +2 -0
- package/dist/verbs/dispatch.d.ts +2 -0
- package/dist/verbs/dispatch.js +2 -2
- package/dist/verbs/draft.d.ts +2 -0
- package/dist/verbs/draft.js +6 -3
- package/dist/verbs/drive.d.ts +2 -0
- package/dist/verbs/evidence.d.ts +5 -0
- package/dist/verbs/floor.d.ts +2 -0
- package/dist/verbs/gate.d.ts +3 -0
- package/dist/verbs/index-verb.d.ts +2 -0
- package/dist/verbs/init.d.ts +2 -0
- package/dist/verbs/log.d.ts +9 -0
- package/dist/verbs/migrate.d.ts +13 -0
- package/dist/verbs/next.d.ts +61 -0
- package/dist/verbs/next.js +112 -84
- package/dist/verbs/read.d.ts +2 -0
- package/dist/verbs/read.js +3 -1
- package/dist/verbs/recap.d.ts +28 -0
- package/dist/verbs/recap.js +3 -3
- package/dist/verbs/recover.d.ts +5 -0
- package/dist/verbs/recover.js +14 -9
- package/dist/verbs/rename.d.ts +2 -0
- package/dist/verbs/rename.js +1 -1
- package/dist/verbs/retry.d.ts +2 -0
- package/dist/verbs/review.d.ts +2 -0
- package/dist/verbs/review.js +1 -1
- package/dist/verbs/satisfy.d.ts +2 -0
- package/dist/verbs/ship.d.ts +3 -0
- package/dist/verbs/start.d.ts +2 -0
- package/dist/verbs/start.js +12 -7
- package/dist/verbs/step-close.d.ts +2 -0
- package/dist/verbs/sync.d.ts +15 -0
- package/dist/verbs/trust.d.ts +4 -0
- package/dist/verbs/trust.js +34 -32
- package/dist/verbs/turn.d.ts +2 -0
- package/dist/verbs/wait.d.ts +9 -0
- package/dist/verbs/wait.js +3 -3
- package/dist/verbs/write.d.ts +18 -0
- package/dist/verbs/write.js +11 -5
- package/dist/verdict.d.ts +60 -0
- package/dist/version.d.ts +4 -0
- package/dist/worker-stream.d.ts +22 -0
- package/dist/worktree.d.ts +22 -0
- package/dist/worktree.js +1 -1
- package/package.json +7 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/commands/witness.md +10 -10
- package/plugin/hooks/canon-guard.mjs +71 -10
- package/plugin/hooks/session-dashboard.sh +1 -1
- package/plugin/skills/witness-brainstorm/SKILL.md +3 -3
- package/plugin/skills/witness-decompose/SKILL.md +3 -3
- package/plugin/skills/witness-design/SKILL.md +2 -2
- package/plugin/skills/witness-implement/SKILL.md +2 -2
- package/plugin/skills/witness-plan/SKILL.md +2 -2
- package/plugin/skills/witness-ship/SKILL.md +2 -2
package/dist/recommend.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cliAct } from './act.js';
|
|
2
|
+
import { anchorRecurrence, boundReached, ladderSpent, lastGateRun, pendingDecision, repairsOnRegate, repairGranted, reviseAct, roundBudget, roundsSinceApprove, } from './rounds.js';
|
|
2
3
|
import { hasControl, visible } from './toon.js';
|
|
3
|
-
// Commands are emitted raw (D120):
|
|
4
|
-
//
|
|
4
|
+
// Commands are emitted raw (D120). Row 239: each is its act's line, which the quoter already
|
|
5
|
+
// made one pasteable command; `esc` would wrap a line holding a `"` in TOON's quotes, and pasted
|
|
6
|
+
// inside them it is one word, not a command.
|
|
5
7
|
export function renderDecision(d) {
|
|
6
8
|
const n = d.options.length;
|
|
7
9
|
const out = [`${d.key}: ${n} option${n === 1 ? '' : 's'} · 1 is recommended`];
|
|
@@ -30,11 +32,17 @@ export function renderDecision(d) {
|
|
|
30
32
|
const RESERVED = new Set(['ship', 'design']);
|
|
31
33
|
const blockingAnchors = (r) => (r.verdicts ?? []).flatMap((rv) => rv.findings.filter((f) => f.blocking)
|
|
32
34
|
.map((f) => (typeof f.anchor === 'string' ? f.anchor : `omission:${f.anchor.scope}`)));
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
export
|
|
37
|
-
const
|
|
35
|
+
// Rows 139/203. Every option that offers a command is built from its act: the block prints the
|
|
36
|
+
// act's line, and the option pastes unless a word of it is one the human must fill. Row 239: nor
|
|
37
|
+
// when it is withheld (`Act.withheld`). The command is still shown, and its note says why.
|
|
38
|
+
export function option(act, depth, rest = {}) {
|
|
39
|
+
const { note: given, ...shown } = rest;
|
|
40
|
+
const note = [given, act.withheld].filter((n) => n !== undefined).join(' · ');
|
|
41
|
+
return {
|
|
42
|
+
command: act.line, depth, runnable: act.inputs.length === 0 && act.withheld === undefined, act, ...shown,
|
|
43
|
+
...(note !== '' ? { note } : {}),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
38
46
|
// The rule table is an ORDERED FIRST-MATCH list (D121). The id of the rule that matched is
|
|
39
47
|
// what the journal records, so a wrong recommendation is attributable to one line here
|
|
40
48
|
// rather than to a weighting — and each rule is testable from one journal state.
|
|
@@ -60,7 +68,7 @@ function withTrustVariants(d, untrusted) {
|
|
|
60
68
|
options.push(o);
|
|
61
69
|
// The obligation-minting `--approve --override` is deliberately excluded: D143 keeps
|
|
62
70
|
// trust off nods, and stacking a grant onto the ledger act would bury it twice over.
|
|
63
|
-
if (
|
|
71
|
+
if (o.act?.argv.at(-1) !== '--approve')
|
|
64
72
|
continue;
|
|
65
73
|
options[options.length - 1] = {
|
|
66
74
|
...o,
|
|
@@ -71,7 +79,7 @@ function withTrustVariants(d, untrusted) {
|
|
|
71
79
|
continue;
|
|
72
80
|
// The twin is the same stamp plus a grant, so it carries the stamp's depth: next to a
|
|
73
81
|
// deferral approve (checks-failed) it is a deferral too, never a root fix.
|
|
74
|
-
options.push(
|
|
82
|
+
options.push(option(cliAct(...o.act.argv, '--trust-cmds'), o.depth, {
|
|
75
83
|
when: 'you have read these commands and accept them running unattended at every later gate',
|
|
76
84
|
tradeoff: `grants them repo-wide in .witness/allow.json (machine-local): ${grantable.join(' · ')}`,
|
|
77
85
|
note: 'a bare affirmation never grants trust — this form must be named (D143)',
|
|
@@ -88,9 +96,10 @@ function recommendCore(ctx) {
|
|
|
88
96
|
const last = lastGateRun(entries, gate);
|
|
89
97
|
if (!last)
|
|
90
98
|
return undefined;
|
|
91
|
-
const d =
|
|
92
|
-
const up =
|
|
93
|
-
|
|
99
|
+
const d = (...rest) => cliAct('decide', gate, target, ...rest);
|
|
100
|
+
const up = d('--revise', '--upstream', upstream ?? '<effort>');
|
|
101
|
+
// Row 239. Bare where the run holds facts: no reviewer text reaches a command.
|
|
102
|
+
const note = reviseAct(gate, target, entries);
|
|
94
103
|
const atBound = boundReached(entries, gate);
|
|
95
104
|
const budget = roundBudget(entries, gate);
|
|
96
105
|
const spent = roundsSinceApprove(entries, gate);
|
|
@@ -101,8 +110,8 @@ function recommendCore(ctx) {
|
|
|
101
110
|
// class in a new dress. Every rule therefore carries the whole live set and only the ORDER
|
|
102
111
|
// and the prose differ. Omitted rather than flagged when no upstream resolves — `decide`
|
|
103
112
|
// refuses that with `unknown-owner`, so it is an illegal act, not an unresolved one (D129).
|
|
104
|
-
const upAlt = (when, tradeoff) => upstream === undefined ? [] : [
|
|
105
|
-
const stopOpt =
|
|
113
|
+
const upAlt = (when, tradeoff) => upstream === undefined ? [] : [option(up, 'root', { when, tradeoff })];
|
|
114
|
+
const stopOpt = option(d('--stop'), 'terminal', {
|
|
106
115
|
when: 'this work should not continue as scoped',
|
|
107
116
|
tradeoff: 'parks the flow — next stops offering it and reopening is an explicit act',
|
|
108
117
|
});
|
|
@@ -113,7 +122,7 @@ function recommendCore(ctx) {
|
|
|
113
122
|
// nothing, which is the unaccounted band-aid D122 exists to prevent. Advertising it beside
|
|
114
123
|
// an accounted one would make the block the place a human learns to skip the ledger, so
|
|
115
124
|
// the block names one approve and it is the one that mints the obligation.
|
|
116
|
-
const overrideOpt =
|
|
125
|
+
const overrideOpt = option(d('--approve', '--override'), 'deferral', {
|
|
117
126
|
when: 'you have read the finding and judge it wrong',
|
|
118
127
|
tradeoff: 'stamps the artifact over a live blocking finding; mints an obligation that stays open in status until a later battery no longer reports it (the discharge)',
|
|
119
128
|
});
|
|
@@ -121,11 +130,11 @@ function recommendCore(ctx) {
|
|
|
121
130
|
// carries it unconditionally for a reason it states: nothing else offers it, and under D124
|
|
122
131
|
// `--stop` parks rather than discards, so a bound screen without abandon offers no way to
|
|
123
132
|
// end the work. The bound-recurrence branch omitted it and two existing tests caught that.
|
|
124
|
-
const abandonOpt =
|
|
133
|
+
const abandonOpt = option(cliAct('abandon', target), 'terminal', {
|
|
125
134
|
when: 'this work should be discarded, not parked',
|
|
126
135
|
tradeoff: 'irreversible — unlike --stop, nothing reopens it',
|
|
127
136
|
});
|
|
128
|
-
const repairOpt =
|
|
137
|
+
const repairOpt = option(d('--revise', '--repair'), 'deferral', {
|
|
129
138
|
when: 'the edit you just made is the fix and you want it verified rather than assumed',
|
|
130
139
|
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',
|
|
131
140
|
});
|
|
@@ -136,7 +145,7 @@ function recommendCore(ctx) {
|
|
|
136
145
|
return {
|
|
137
146
|
key: 'next', rule: 'malformed-rerun',
|
|
138
147
|
options: [
|
|
139
|
-
|
|
148
|
+
option(cliAct('gate', gate, target), 'root', {
|
|
140
149
|
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${
|
|
141
150
|
// A promise of what appendKind does (row 209): moved content is a fresh round, every
|
|
142
151
|
// lens asked; a revise since makes it changed-nothing; a fallen-back round re-runs.
|
|
@@ -162,11 +171,11 @@ function recommendCore(ctx) {
|
|
|
162
171
|
// No anchor: the findings describe bytes that no longer exist, and pinning a decision
|
|
163
172
|
// to one of them would file recurrence against a verdict nothing can still reproduce.
|
|
164
173
|
options: [
|
|
165
|
-
|
|
174
|
+
option(cliAct('gate', gate, target), 'root', {
|
|
166
175
|
why: `the verdict judged @${last.reviewed_sha.slice(0, 7)} and the content has moved since — no battery has read the current bytes, so every finding above describes a tree that no longer exists`,
|
|
167
176
|
tradeoff: `spends round ${nextRound} of ${budget}${nextRound >= budget ? ' — the last before the bound' : ''}`,
|
|
168
177
|
}),
|
|
169
|
-
|
|
178
|
+
option(note, 'root', {
|
|
170
179
|
when: 'you already know the next edit and want no verdict on this state',
|
|
171
180
|
tradeoff: 'spends no round now — the round is spent by the re-gate that follows it',
|
|
172
181
|
}),
|
|
@@ -196,7 +205,7 @@ function recommendCore(ctx) {
|
|
|
196
205
|
return {
|
|
197
206
|
key: 'decide', rule: 'bound-recurrence', anchor: primary,
|
|
198
207
|
options: [
|
|
199
|
-
|
|
208
|
+
option(up, 'root', { why: `${primary} survived ${recurrence} rounds across distinct reviewed shas — patching here has failed every time, and upstream is unspent for this anchor` }),
|
|
200
209
|
...(stale ? [] : [overrideOpt]),
|
|
201
210
|
...(repairGranted(entries, gate) ? [] : [repairOpt]),
|
|
202
211
|
stopOpt,
|
|
@@ -209,13 +218,13 @@ function recommendCore(ctx) {
|
|
|
209
218
|
return {
|
|
210
219
|
key: 'decide', rule: stale ? 'bound-stale' : 'bound', anchor: primary,
|
|
211
220
|
options: [
|
|
212
|
-
...(stale ? [] : [
|
|
221
|
+
...(stale ? [] : [option(d('--approve', '--override'), 'deferral', {
|
|
213
222
|
why: `the round budget is spent (${spent} of ${budget}) and the gate will not run again; nothing below the bound remains`,
|
|
214
223
|
tradeoff: overrideOpt.tradeoff,
|
|
215
224
|
})]),
|
|
216
225
|
...(stale
|
|
217
|
-
? [
|
|
218
|
-
: [
|
|
226
|
+
? [option(up, 'root', { why: 'verdict and content disagree, so --approve is not offered — no battery read the current bytes — and the gate will not re-run' })]
|
|
227
|
+
: [option(up, 'root', { when: 'the parent artifact is what is wrong', tradeoff: 'reopens the parent stage and resets this budget' })]),
|
|
219
228
|
...(repairGranted(entries, gate) ? [] : [repairOpt]),
|
|
220
229
|
stopOpt,
|
|
221
230
|
abandonOpt,
|
|
@@ -227,8 +236,8 @@ function recommendCore(ctx) {
|
|
|
227
236
|
return {
|
|
228
237
|
key: 'decide', rule: `anchor-recurrence-${recurrence}`, anchor: primary,
|
|
229
238
|
options: [
|
|
230
|
-
|
|
231
|
-
|
|
239
|
+
option(up, 'root', { why: `${primary} was found in ${recurrence} rounds across distinct reviewed shas — one honest fix already failed at this seam, so the likelier fault is above it` }),
|
|
240
|
+
option(note, 'root', { when: 'the previous fix was the wrong fix and you now know the right one', tradeoff: `spends ${rounds}; recurring again leaves only the endgame set` }),
|
|
232
241
|
overrideOpt,
|
|
233
242
|
stopOpt,
|
|
234
243
|
],
|
|
@@ -240,8 +249,8 @@ function recommendCore(ctx) {
|
|
|
240
249
|
return {
|
|
241
250
|
key: 'decide', rule: 'pin-contradiction',
|
|
242
251
|
options: [
|
|
243
|
-
|
|
244
|
-
|
|
252
|
+
option(note, 'root', { why: `a finding contradicts policy pin #${pinned.contradicts_pin} — the gate escalated the conflict rather than burning a round on it, and only you can settle which side holds` }),
|
|
253
|
+
option(d('--approve'), 'root', { when: 'the pin still holds and the finding is the thing that is wrong', tradeoff: 'the lens will raise it again on the next round unless the pin is restated' }),
|
|
245
254
|
...upAlt('the pin itself is what should change, and it was set at the stage above', 'reopens the parent stage and resets this budget'),
|
|
246
255
|
stopOpt,
|
|
247
256
|
],
|
|
@@ -254,8 +263,8 @@ function recommendCore(ctx) {
|
|
|
254
263
|
? {
|
|
255
264
|
key: 'decide', rule: 'blocking-parent', anchor: primary,
|
|
256
265
|
options: [
|
|
257
|
-
|
|
258
|
-
|
|
266
|
+
option(up, 'root', { why: `${anchors.length} of ${anchors.length} blocking findings anchor to ${upstream}, not to this artifact — it is faithful to a parent that is wrong` }),
|
|
267
|
+
option(note, 'root', { when: 'this artifact can route around the parent gap without the parent changing', tradeoff: 'leaves the parent wrong for everything else that derives from it' }),
|
|
259
268
|
overrideOpt,
|
|
260
269
|
stopOpt,
|
|
261
270
|
],
|
|
@@ -263,7 +272,7 @@ function recommendCore(ctx) {
|
|
|
263
272
|
: {
|
|
264
273
|
key: 'decide', rule: 'blocking-here', anchor: primary,
|
|
265
274
|
options: [
|
|
266
|
-
|
|
275
|
+
option(note, 'root', { why: `${anchors.length} blocking finding${anchors.length === 1 ? '' : 's'} anchored inside this artifact (${anchors.slice(0, 2).join(', ')}); ${rounds}` }),
|
|
267
276
|
...upAlt('the finding is only true because the parent asks for something unbuildable here', 'reopens the parent stage and resets this budget; a wrong upstream spends a whole stage cycle'),
|
|
268
277
|
overrideOpt,
|
|
269
278
|
stopOpt,
|
|
@@ -285,8 +294,8 @@ function recommendCore(ctx) {
|
|
|
285
294
|
return {
|
|
286
295
|
key: 'decide', rule: 'checks-failed',
|
|
287
296
|
options: [
|
|
288
|
-
|
|
289
|
-
|
|
297
|
+
option(d('--approve'), 'root', { why: `the one failed check is amendment-ack — a spec was amended under in-progress plans · approving is the acknowledgement it asks for; ${rounds}` }),
|
|
298
|
+
option(note, 'root', { when: 'the amendment should not land under the in-progress plans as it stands', tradeoff: `costs ${rounds}; the gate re-runs on your edit` }),
|
|
290
299
|
...upAlt('what should change is the amendment the stage above made', 'reopens the parent stage and resets this budget'),
|
|
291
300
|
stopOpt,
|
|
292
301
|
],
|
|
@@ -295,9 +304,9 @@ function recommendCore(ctx) {
|
|
|
295
304
|
return {
|
|
296
305
|
key: 'decide', rule: 'checks-failed',
|
|
297
306
|
options: [
|
|
298
|
-
|
|
307
|
+
option(note, 'root', { why: `${names.length} deterministic check${names.length === 1 ? '' : 's'} failed: ${names.join(' · ')} — no finding blocks · fix what the check names; ${rounds}` }),
|
|
299
308
|
...upAlt('the check fails because of what the stage above asked for', 'reopens the parent stage and resets this budget'),
|
|
300
|
-
|
|
309
|
+
option(d('--approve'), 'deferral', {
|
|
301
310
|
when: 'the failing check is wrong or cannot pass for a reason outside this artifact',
|
|
302
311
|
tradeoff: 'stamps the artifact over a failed deterministic check · no obligation is minted — the failure stays visible only until a later gate run passes the check',
|
|
303
312
|
}),
|
|
@@ -310,8 +319,8 @@ function recommendCore(ctx) {
|
|
|
310
319
|
return {
|
|
311
320
|
key: 'decide', rule: 'non-blocking-only',
|
|
312
321
|
options: [
|
|
313
|
-
|
|
314
|
-
|
|
322
|
+
option(d('--approve'), 'root', { why: `${nonBlocking} finding${nonBlocking === 1 ? '' : 's'}, none blocking; all ${last.checks.length} checks green` }),
|
|
323
|
+
option(note, 'root', { when: 'a non-blocking finding is one you want fixed before it becomes load-bearing', tradeoff: `spends ${rounds} on findings the battery already judged non-blocking` }),
|
|
315
324
|
...upAlt('the finding points at something the stage above got wrong', 'reopens the parent stage and resets this budget'),
|
|
316
325
|
stopOpt,
|
|
317
326
|
],
|
|
@@ -322,7 +331,7 @@ function recommendCore(ctx) {
|
|
|
322
331
|
return {
|
|
323
332
|
key: 'decide', rule: 'reserved-stop-clean',
|
|
324
333
|
options: [
|
|
325
|
-
|
|
334
|
+
option(d('--approve'), 'root', {
|
|
326
335
|
why: `${last.checks.length} of ${last.checks.length} checks green, 0 findings — approve is what the evidence supports`,
|
|
327
336
|
judgeFirst: RESERVED.has(gate)
|
|
328
337
|
? (gate === 'ship'
|
|
@@ -330,7 +339,7 @@ function recommendCore(ctx) {
|
|
|
330
339
|
: 'the look itself — the critic judged canon-compliance and coverage, not whether this is the right design')
|
|
331
340
|
: 'whether this cut is how you would ship it. Coverage is checked; the shape of the cut is not',
|
|
332
341
|
}),
|
|
333
|
-
|
|
342
|
+
option(note, 'root', { when: 'the evidence is right and the thing itself is wrong', tradeoff: `costs ${rounds}; the gate re-runs on your edit` }),
|
|
334
343
|
...upAlt('what is wrong is what this stage was ASKED to build, not how it was built', 'reopens the parent stage and resets this budget; the work here waits on that cycle'),
|
|
335
344
|
stopOpt,
|
|
336
345
|
],
|
|
@@ -340,10 +349,10 @@ function recommendCore(ctx) {
|
|
|
340
349
|
return {
|
|
341
350
|
key: 'decide', rule: 'manual-stop',
|
|
342
351
|
options: [
|
|
343
|
-
|
|
352
|
+
option(d('--approve'), 'root', {
|
|
344
353
|
why: `${last.checks.length - checksFailed.length} of ${last.checks.length} checks green, 0 blocking findings — nothing in the evidence stopped this round; the stop is the --manual flag armed for this run`,
|
|
345
354
|
}),
|
|
346
|
-
|
|
355
|
+
option(note, 'root', { when: 'you armed --manual because you expect the battery to miss something and you can name it', tradeoff: `spends ${rounds} on a round the evidence passed` }),
|
|
347
356
|
...upAlt('what you armed --manual to catch is a fault in the stage above', 'reopens the parent stage and resets this budget'),
|
|
348
357
|
stopOpt,
|
|
349
358
|
],
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface Violation {
|
|
2
|
+
field: string;
|
|
3
|
+
rule: string;
|
|
4
|
+
got: string;
|
|
5
|
+
want: string;
|
|
6
|
+
remedy?: string;
|
|
7
|
+
human?: true;
|
|
8
|
+
}
|
|
9
|
+
export type Result<T> = {
|
|
10
|
+
ok: true;
|
|
11
|
+
value: T;
|
|
12
|
+
} | {
|
|
13
|
+
ok: false;
|
|
14
|
+
violations: Violation[];
|
|
15
|
+
};
|
|
16
|
+
export declare function ok<T>(value: T): Result<T>;
|
|
17
|
+
export declare function refuse<T>(violations: Violation[]): Result<T>;
|
|
18
|
+
export declare function v(field: string, rule: string, got: string, want: string, remedy?: string): Violation;
|
|
19
|
+
export declare const humanCall: (x: Violation) => Violation;
|
|
20
|
+
export declare function renderRefusal(violations: Violation[]): string[];
|
package/dist/refusal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rows } from './toon.js';
|
|
1
|
+
import { logSafe, rows } from './toon.js';
|
|
2
2
|
export function ok(value) {
|
|
3
3
|
return { ok: true, value };
|
|
4
4
|
}
|
|
@@ -9,6 +9,8 @@ export function v(field, rule, got, want, remedy) {
|
|
|
9
9
|
return remedy === undefined ? { field, rule, got, want } : { field, rule, got, want, remedy };
|
|
10
10
|
}
|
|
11
11
|
export const humanCall = (x) => ({ ...x, human: true });
|
|
12
|
+
// Row 239 (ruling R25). A cell as the table prints it: as `rows` reads a value, spelled out.
|
|
13
|
+
const spelled = (cell) => logSafe(String(cell ?? ''));
|
|
12
14
|
export function renderRefusal(violations) {
|
|
13
15
|
const runnable = [...new Set(violations.map((x) => x.remedy).filter((r) => r !== undefined && !/<[^>]+>/.test(r)))];
|
|
14
16
|
// D167. Row 108's principle cuts both ways: the stop is true for the human's rows and false for
|
|
@@ -16,9 +18,15 @@ export function renderRefusal(violations) {
|
|
|
16
18
|
const human = [...new Set(violations.filter((x) => x.human).map((x) => x.rule))];
|
|
17
19
|
const mixed = violations.some((x) => !x.human);
|
|
18
20
|
return [
|
|
19
|
-
// The
|
|
20
|
-
//
|
|
21
|
-
|
|
21
|
+
// The four columns alone make each row: a remedy is not a column and must not become one.
|
|
22
|
+
// Row 239 (ruling R25): the table heads the `run:` remedy rows below it, so, as R16(a) has every
|
|
23
|
+
// line heading an offered row print, each cell is spelled out (`logSafe`): a `got` or a `want`
|
|
24
|
+
// echoing foreign text — a hand-edited doc's id, a typed argument, a tool's output — that holds a
|
|
25
|
+
// line break would otherwise start a physical line of its own, which can read `run:`. Printable
|
|
26
|
+
// text prints as it did, and only this printed copy is spelled: the violations stay as given.
|
|
27
|
+
...rows('refused', ['field', 'rule', 'got', 'want'], violations.map((x) => ({
|
|
28
|
+
field: spelled(x.field), rule: spelled(x.rule), got: spelled(x.got), want: spelled(x.want),
|
|
29
|
+
}))),
|
|
22
30
|
...runnable.map((r) => `run: ${r}`),
|
|
23
31
|
human.length
|
|
24
32
|
? `help: a human's decision: ${human.join(' · ')} — stop and surface the list; re-running cannot clear it`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function latestPublished(env: Record<string, string | undefined>): Promise<string | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RELEASED_COMMENTS: ReadonlySet<string>;
|
package/dist/review.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Ctx } from './cli.js';
|
|
2
|
+
import { type Config } from './config.js';
|
|
3
|
+
import { type ChangeClass, type GateName } from './gate.js';
|
|
4
|
+
import { type Result } from './refusal.js';
|
|
5
|
+
import { type GateRunEntry, type ReviewerVerdict } from './rounds.js';
|
|
6
|
+
import { type Reviewed } from './verdict.js';
|
|
7
|
+
export interface ReviewInput {
|
|
8
|
+
cls: ChangeClass;
|
|
9
|
+
reviewedSha: string;
|
|
10
|
+
reviewed: Reviewed;
|
|
11
|
+
promptBody: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ReviewRun {
|
|
14
|
+
model: string;
|
|
15
|
+
verdicts: ReviewerVerdict[];
|
|
16
|
+
malformed: NonNullable<GateRunEntry['malformed']>;
|
|
17
|
+
answered?: {
|
|
18
|
+
round: number;
|
|
19
|
+
run: string;
|
|
20
|
+
};
|
|
21
|
+
earlier?: {
|
|
22
|
+
round: number;
|
|
23
|
+
why: string;
|
|
24
|
+
blocking: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export declare function reviewOnce(ctx: Ctx, root: string, cfg: Config, gate: GateName, target: string, input: ReviewInput): Promise<Result<ReviewRun>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Canon, CanonDoc } from './scan.js';
|
|
2
|
+
export declare function diffReviewedSha(runRoot: string, base: string): string;
|
|
3
|
+
export declare function implementReviewedSha(runRoot: string, base: string, plan: CanonDoc): string;
|
|
4
|
+
export interface WriteInfo {
|
|
5
|
+
sha: string;
|
|
6
|
+
covers?: string[];
|
|
7
|
+
carries?: string[];
|
|
8
|
+
decisions?: Array<{
|
|
9
|
+
id: string;
|
|
10
|
+
text: string;
|
|
11
|
+
}>;
|
|
12
|
+
created?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function effortWrites(root: string, effort: string): Map<string, WriteInfo>;
|
|
15
|
+
export declare function effortSpecs(root: string, canon: Canon, effort: string): CanonDoc[];
|
|
16
|
+
export declare function effortCanon(root: string, canon: Canon, effort: string): CanonDoc[];
|
|
17
|
+
export declare function principlesOwner(root: string, canon: Canon): string | undefined;
|
|
18
|
+
export declare function effortOf(root: string, artifactId: string): string | undefined;
|
|
19
|
+
export declare function effortReviewedSha(root: string, canon: Canon, effort: string): {
|
|
20
|
+
sha: string;
|
|
21
|
+
docs: CanonDoc[];
|
|
22
|
+
};
|
|
23
|
+
export declare function planPairSha(plan: CanonDoc, parent: CanonDoc, decisions?: string): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Ctx } from './cli.js';
|
|
2
|
+
import { type Harness } from './harness.js';
|
|
3
|
+
import type { PolicyPin } from './journal.js';
|
|
4
|
+
import { type Result } from './refusal.js';
|
|
5
|
+
import { type Clock } from './usage.js';
|
|
6
|
+
import type { Reviewed } from './verdict.js';
|
|
7
|
+
export type ContentKind = Reviewed['kind'];
|
|
8
|
+
export type ToolPolicy = 'none' | 'read';
|
|
9
|
+
export declare function toolsFor(reviewed: Reviewed): ToolPolicy;
|
|
10
|
+
export declare const PROMPT_NAMES: readonly ["slicing-critic", "plan-critic", "code-reviewer", "silent-failure-hunter", "type-design", "pr-test", "drift-reviewer", "design-critic", "design-reviewer"];
|
|
11
|
+
export interface LensDoc {
|
|
12
|
+
path: string;
|
|
13
|
+
contents: string;
|
|
14
|
+
}
|
|
15
|
+
export interface Lens {
|
|
16
|
+
name: string;
|
|
17
|
+
contents: string;
|
|
18
|
+
docs?: LensDoc[];
|
|
19
|
+
}
|
|
20
|
+
export declare function promptsDir(): string;
|
|
21
|
+
export declare function resolvePrompt(name: string): Result<Lens>;
|
|
22
|
+
export declare function docKeysFor(gate: string, lens: string): string[];
|
|
23
|
+
export declare function loadLensDocs(root: string, paths: string[]): Result<LensDoc[]>;
|
|
24
|
+
export declare function docsBlock(docs: LensDoc[]): string;
|
|
25
|
+
export declare function pinsBlock(pins: PolicyPin[]): string;
|
|
26
|
+
export declare function promptsSha(lenses: Lens[], extra?: string): string;
|
|
27
|
+
export interface InvokeExtras {
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
extensions?: readonly string[];
|
|
30
|
+
}
|
|
31
|
+
export interface InvokeOpts extends InvokeExtras {
|
|
32
|
+
cwd: string;
|
|
33
|
+
prompt: string;
|
|
34
|
+
model?: string;
|
|
35
|
+
pinField?: string;
|
|
36
|
+
lens?: string;
|
|
37
|
+
clock?: Clock;
|
|
38
|
+
tools?: ToolPolicy;
|
|
39
|
+
}
|
|
40
|
+
export declare const REVIEWER_WAIT_MAX_MS = 21600000;
|
|
41
|
+
export declare function invokeReviewer(ctx: Ctx, harness: Harness, opts: InvokeOpts): Result<{
|
|
42
|
+
text: string;
|
|
43
|
+
}>;
|
|
44
|
+
export declare function invokeReviewerAsync(ctx: Ctx, harness: Harness, opts: InvokeOpts): Promise<Result<{
|
|
45
|
+
text: string;
|
|
46
|
+
}>>;
|
|
47
|
+
export declare function parseVerdictText(text: string): Result<unknown>;
|
package/dist/rounds.d.ts
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { type Act } from './act.js';
|
|
2
|
+
import type { Entry } from './journal.js';
|
|
3
|
+
import type { HeldRow } from './needs.js';
|
|
4
|
+
import type { Violation } from './refusal.js';
|
|
5
|
+
import type { CoverageItem, Finding } from './verdict.js';
|
|
6
|
+
export interface GateCheck {
|
|
7
|
+
name: string;
|
|
8
|
+
ok: boolean;
|
|
9
|
+
detail?: string;
|
|
10
|
+
untrusted?: string[];
|
|
11
|
+
held?: HeldRow[];
|
|
12
|
+
}
|
|
13
|
+
export interface ReviewerVerdict {
|
|
14
|
+
reviewer: string;
|
|
15
|
+
coverage: CoverageItem[];
|
|
16
|
+
findings: Finding[];
|
|
17
|
+
}
|
|
18
|
+
export interface GateRunEntry {
|
|
19
|
+
v: 1;
|
|
20
|
+
t: 'gate-run';
|
|
21
|
+
gate: string;
|
|
22
|
+
artifact: string;
|
|
23
|
+
round: number;
|
|
24
|
+
run_id: string;
|
|
25
|
+
reviewed_sha: string;
|
|
26
|
+
prompts_sha: string;
|
|
27
|
+
witness: string;
|
|
28
|
+
model: string;
|
|
29
|
+
pin?: string;
|
|
30
|
+
harness?: string;
|
|
31
|
+
reviewer_extensions?: string[];
|
|
32
|
+
cached?: boolean;
|
|
33
|
+
manual?: boolean;
|
|
34
|
+
fallback?: string[];
|
|
35
|
+
rerolled?: string[];
|
|
36
|
+
skipped?: string[];
|
|
37
|
+
standing?: string;
|
|
38
|
+
artifact_sha?: string;
|
|
39
|
+
diff_sha?: string;
|
|
40
|
+
reviewed_tree?: string;
|
|
41
|
+
basis_sha?: string;
|
|
42
|
+
setup_sha?: string;
|
|
43
|
+
delta?: {
|
|
44
|
+
round: number;
|
|
45
|
+
run: string;
|
|
46
|
+
};
|
|
47
|
+
carried?: {
|
|
48
|
+
run: string;
|
|
49
|
+
lenses: string[];
|
|
50
|
+
};
|
|
51
|
+
checks: GateCheck[];
|
|
52
|
+
verdicts?: ReviewerVerdict[];
|
|
53
|
+
malformed?: Array<{
|
|
54
|
+
reviewer: string;
|
|
55
|
+
violations: Violation[];
|
|
56
|
+
}>;
|
|
57
|
+
outcome: 'passed' | 'stopped' | 'malformed';
|
|
58
|
+
}
|
|
59
|
+
export interface DecisionEntry {
|
|
60
|
+
v: 1;
|
|
61
|
+
t: 'human-decision';
|
|
62
|
+
gate: string;
|
|
63
|
+
artifact: string;
|
|
64
|
+
round: number;
|
|
65
|
+
decision: 'approve' | 'revise' | 'revise-upstream' | 'stop' | 'abandon-effort';
|
|
66
|
+
override?: boolean;
|
|
67
|
+
repair?: true;
|
|
68
|
+
note?: string;
|
|
69
|
+
upstream?: {
|
|
70
|
+
artifact: string;
|
|
71
|
+
gate: string;
|
|
72
|
+
};
|
|
73
|
+
caused_by?: {
|
|
74
|
+
artifact: string;
|
|
75
|
+
gate: string;
|
|
76
|
+
round: number;
|
|
77
|
+
};
|
|
78
|
+
anchor?: string;
|
|
79
|
+
recommended?: string;
|
|
80
|
+
rule?: string;
|
|
81
|
+
selected?: 'affirmation' | 'policy' | 'arbiter';
|
|
82
|
+
reason?: string;
|
|
83
|
+
arbiter?: {
|
|
84
|
+
model: string;
|
|
85
|
+
prompts_sha: string;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export interface GateKey {
|
|
89
|
+
reviewed_sha: string;
|
|
90
|
+
gate: string;
|
|
91
|
+
prompts_sha: string;
|
|
92
|
+
pin: string;
|
|
93
|
+
witness: string;
|
|
94
|
+
harness: string;
|
|
95
|
+
}
|
|
96
|
+
export declare function keyOf(run: GateRunEntry): GateKey;
|
|
97
|
+
export declare function sameKey(a: GateKey, b: GateKey): boolean;
|
|
98
|
+
export declare function fellBack(run: GateRunEntry): boolean;
|
|
99
|
+
export declare function gateRuns(entries: Entry[], gate: string): GateRunEntry[];
|
|
100
|
+
export declare function lastGateRun(entries: Entry[], gate: string): GateRunEntry | undefined;
|
|
101
|
+
export declare const ROUND_BOUND = 3;
|
|
102
|
+
export declare function runsSinceReset(entries: Entry[], gate: string): GateRunEntry[];
|
|
103
|
+
export declare function deltaBase(entries: Entry[], gate: string, reviewedSha: string): GateRunEntry | undefined;
|
|
104
|
+
export declare function roundsSinceApprove(entries: Entry[], gate: string): number;
|
|
105
|
+
export declare function repairGranted(entries: Entry[], gate: string): boolean;
|
|
106
|
+
export declare function roundBudget(entries: Entry[], gate: string): number;
|
|
107
|
+
export declare function boundReached(entries: Entry[], gate: string): boolean;
|
|
108
|
+
export declare function anchorRecurrence(entries: Entry[], gate: string, anchor: string): number;
|
|
109
|
+
export declare function ladderSpent(entries: Entry[], gate: string, anchor: string): boolean;
|
|
110
|
+
export declare function notePrefill(entries: Entry[], gate: string): string;
|
|
111
|
+
export declare function reviseAct(gate: string, target: string, entries: Entry[]): Act;
|
|
112
|
+
export declare function exitActs(gate: string, target: string, entries: Entry[], stale: boolean, upstream: string | undefined): Act[];
|
|
113
|
+
export declare function liveExits(gate: string, target: string, entries: Entry[], stale: boolean, upstream: string | undefined): string;
|
|
114
|
+
export declare function reopenActs(gate: string, target: string, entries: Entry[], upstream: string | undefined): Act[];
|
|
115
|
+
export declare function reopenCommand(gate: string, target: string, entries: Entry[], upstream: string | undefined): string;
|
|
116
|
+
export declare function pendingDecision(entries: Entry[], gate: string): GateRunEntry | undefined;
|
|
117
|
+
export declare function openReopen(entries: Entry[], gate: string): DecisionEntry | undefined;
|
|
118
|
+
export type AppendKind = {
|
|
119
|
+
kind: 'resume';
|
|
120
|
+
entry: GateRunEntry;
|
|
121
|
+
} | {
|
|
122
|
+
kind: 'changed-nothing';
|
|
123
|
+
entry: GateRunEntry;
|
|
124
|
+
} | {
|
|
125
|
+
kind: 'cached';
|
|
126
|
+
from: GateRunEntry;
|
|
127
|
+
} | {
|
|
128
|
+
kind: 'repair';
|
|
129
|
+
from: GateRunEntry;
|
|
130
|
+
} | {
|
|
131
|
+
kind: 'fresh';
|
|
132
|
+
};
|
|
133
|
+
export declare function repairsOnRegate(entries: Entry[], gate: string): boolean;
|
|
134
|
+
export declare function answersKey(run: GateRunEntry, key: GateKey): boolean;
|
|
135
|
+
export declare function appendKind(entries: Entry[], gate: string, key: GateKey): AppendKind;
|