@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/gitio.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type Result } from './refusal.js';
|
|
2
|
+
export declare function git(root: string, ...args: string[]): string;
|
|
3
|
+
export declare function tryGit(root: string, ...args: string[]): {
|
|
4
|
+
ok: boolean;
|
|
5
|
+
out: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function gitBlob(root: string, rev: string, rel: string): Buffer | undefined;
|
|
8
|
+
export declare function primaryRoot(cwd: string): Result<string>;
|
|
9
|
+
export declare function stateDirs(root: string): string[];
|
|
10
|
+
export declare function isStatePath(root: string, rel: string): boolean;
|
|
11
|
+
export declare function stateOnlyAdvance(wt: string, root: string, from: string, to: string): boolean;
|
|
12
|
+
export declare function dirtyStatePaths(root: string): string[];
|
|
13
|
+
export declare const TRAILER = "Witness-State: 1";
|
|
14
|
+
export declare function commitWithTrailer(root: string, files: string[], subject: string): Result<{
|
|
15
|
+
sha: string;
|
|
16
|
+
}>;
|
|
17
|
+
export declare function stateCommit(root: string, files: string[], subject: string): Result<{
|
|
18
|
+
sha: string;
|
|
19
|
+
}>;
|
|
20
|
+
export interface CommitAudit {
|
|
21
|
+
sha: string;
|
|
22
|
+
subject: string;
|
|
23
|
+
trailered: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare function auditStateCommits(root: string): CommitAudit[];
|
|
26
|
+
export declare function divergence(root: string, branch: string): {
|
|
27
|
+
ahead: number;
|
|
28
|
+
behind: number;
|
|
29
|
+
} | undefined;
|
|
30
|
+
export declare function resolveStartBase(root: string, branch: string): Result<string>;
|
package/dist/gitio.js
CHANGED
|
@@ -2,6 +2,7 @@ import { dirname } from 'node:path';
|
|
|
2
2
|
import { canonPaths } from './config.js';
|
|
3
3
|
import { ok, refuse, v } from './refusal.js';
|
|
4
4
|
import { execFileSync } from './spawn.js';
|
|
5
|
+
import { offeredLine } from './toon.js';
|
|
5
6
|
// D158 (#20). A reviewer-bound diff is legitimately multi-megabyte and Node's spawnSync
|
|
6
7
|
// default is 1 MiB, which crashed ship/gate as `spawnSync git ENOBUFS` — and, worse,
|
|
7
8
|
// silently truncated every tryGit consumer into a wrong answer. Sized like reviewer.ts's
|
|
@@ -216,8 +217,10 @@ export function resolveStartBase(root, branch) {
|
|
|
216
217
|
// A remedy only where one is true. A remote that simply lacks the branch is fixed by
|
|
217
218
|
// one push; an unreachable host is not fixed by anything witness can render, and a
|
|
218
219
|
// `run:` that fixes nothing is the D129 defect D147's placeholder test guards against.
|
|
220
|
+
// Row 239: the push is another tool's command, through the one renderer, and none where
|
|
221
|
+
// it is withheld.
|
|
219
222
|
const missingRef = /couldn't find remote ref|no such ref|not our ref/i.test(fetched.out);
|
|
220
|
-
return refuse([v('remote', 'fetch-failed', fetched.out.trim().slice(0, 160), `origin/${branch} reachable — check the network, or push ${branch} once if the remote has no such branch`, missingRef ?
|
|
223
|
+
return refuse([v('remote', 'fetch-failed', fetched.out.trim().slice(0, 160), `origin/${branch} reachable — check the network, or push ${branch} once if the remote has no such branch`, missingRef ? offeredLine(['git', 'push', '-u', 'origin', branch]) : undefined)]);
|
|
221
224
|
}
|
|
222
225
|
return ok(`origin/${branch}`);
|
|
223
226
|
}
|
package/dist/glob.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type ParsedPin } from './pin.js';
|
|
2
|
+
import type { ToolPolicy } from './reviewer.js';
|
|
3
|
+
import { type Result } from './refusal.js';
|
|
4
|
+
import { type Platform } from './toon.js';
|
|
5
|
+
import { type WorkerStream } from './worker-stream.js';
|
|
6
|
+
export declare const HARNESSES: readonly ["claude-code", "pi"];
|
|
7
|
+
export type HarnessName = (typeof HARNESSES)[number];
|
|
8
|
+
export declare const DEFAULT_HARNESS: HarnessName;
|
|
9
|
+
export declare const STAGE_SKILLS: readonly ["witness-brainstorm", "witness-decompose", "witness-design", "witness-implement", "witness-plan", "witness-ship"];
|
|
10
|
+
export interface HarnessSpawn {
|
|
11
|
+
cmd: string;
|
|
12
|
+
args: string[];
|
|
13
|
+
env: Record<string, string>;
|
|
14
|
+
}
|
|
15
|
+
export type ReviewerSpawn = HarnessSpawn;
|
|
16
|
+
export interface Harness {
|
|
17
|
+
name: HarnessName;
|
|
18
|
+
launch: string;
|
|
19
|
+
defaultProvider?: string;
|
|
20
|
+
relay: string;
|
|
21
|
+
session: string;
|
|
22
|
+
settings?: string;
|
|
23
|
+
bundled: boolean;
|
|
24
|
+
waitMode: 'background' | 'add-on';
|
|
25
|
+
payload: Array<{
|
|
26
|
+
from: string;
|
|
27
|
+
to: string;
|
|
28
|
+
}>;
|
|
29
|
+
skills: {
|
|
30
|
+
project: string;
|
|
31
|
+
global: string;
|
|
32
|
+
};
|
|
33
|
+
reviewer: {
|
|
34
|
+
spawn(pin: ParsedPin | undefined, extensions?: readonly string[], tools?: ToolPolicy): ReviewerSpawn;
|
|
35
|
+
parseEnvelope(stdout: string): Result<{
|
|
36
|
+
text: string;
|
|
37
|
+
}>;
|
|
38
|
+
};
|
|
39
|
+
worker: {
|
|
40
|
+
spawn(prompt: string, model?: string, transcripts?: string): HarnessSpawn;
|
|
41
|
+
stream(home: string): WorkerStream;
|
|
42
|
+
transcripts?(env: Record<string, string | undefined>, root: string): string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export type HarnessSource = 'detected' | 'config' | 'default';
|
|
46
|
+
export declare function loadHarness(name: string): Result<Harness>;
|
|
47
|
+
export declare function detectionVariables(): string[];
|
|
48
|
+
export declare function resolveJudge(env: Record<string, string | undefined>, declared: string | undefined): Result<{
|
|
49
|
+
harness: Harness;
|
|
50
|
+
source: HarnessSource;
|
|
51
|
+
}>;
|
|
52
|
+
export declare function resolveDriver(env: Record<string, string | undefined>, declared: string | undefined): Result<{
|
|
53
|
+
harness: Harness;
|
|
54
|
+
source: HarnessSource;
|
|
55
|
+
}>;
|
|
56
|
+
export declare function judgeLine(r: Result<{
|
|
57
|
+
harness: Harness;
|
|
58
|
+
source: HarnessSource;
|
|
59
|
+
}>): string;
|
|
60
|
+
export declare function modelFlags(harness: Harness, model: string | undefined): string[];
|
|
61
|
+
export declare function thinkingEnv(harness: Harness, model: string | undefined): Record<string, string>;
|
|
62
|
+
export declare function handoffLine(harness: Harness, home: string, model: string | undefined, platform?: Platform): string;
|
|
63
|
+
export declare function relayLine(harness: Harness): string;
|
|
64
|
+
export declare function resolveSkills(env: Record<string, string | undefined>, root: string, harness: Harness): {
|
|
65
|
+
scope: 'global' | 'project-only' | 'absent';
|
|
66
|
+
dir?: string;
|
|
67
|
+
};
|
|
68
|
+
export declare function skillsVisibility(env: Record<string, string | undefined>, root: string, harness: Harness): 'global' | 'project-only' | 'absent';
|
|
69
|
+
export declare function skillPins(dir: string): Array<{
|
|
70
|
+
skill: string;
|
|
71
|
+
pin: string;
|
|
72
|
+
}>;
|
|
73
|
+
export declare function validatePin(harness: Harness, field: string, raw: string): Result<ParsedPin>;
|
package/dist/harness.js
CHANGED
|
@@ -4,6 +4,7 @@ import { homedir } from 'node:os';
|
|
|
4
4
|
import { basename, join } from 'node:path';
|
|
5
5
|
import { CLAUDE_THINKING_BUDGET, parsePin } from './pin.js';
|
|
6
6
|
import { ok, refuse, v } from './refusal.js';
|
|
7
|
+
import { quotedWord, shellLine } from './toon.js';
|
|
7
8
|
import { pinIn } from './version.js';
|
|
8
9
|
import { claudeStream, piStream } from './worker-stream.js';
|
|
9
10
|
export const HARNESSES = ['claude-code', 'pi'];
|
|
@@ -280,9 +281,9 @@ export function judgeLine(r) {
|
|
|
280
281
|
// for a provider-qualified pin — pastes cleanly, resolves to nothing: bug B2's shape.
|
|
281
282
|
// Pi renders the provider and its native `:thinking` suffix; claude-code renders the
|
|
282
283
|
// bare id and carries non-off thinking as a MAX_THINKING_TOKENS prefix on the line.
|
|
283
|
-
// The model flag as ARGV, which is what a spawn takes; `
|
|
284
|
-
// answer
|
|
285
|
-
// shape both consumers can use without either re-deriving it.
|
|
284
|
+
// The model flag as ARGV, which is what a spawn takes; `handoffLine` below prints this same
|
|
285
|
+
// answer through the quoter for a pasteable line. Decision 88's renderer-over-a-parsed-pin,
|
|
286
|
+
// in the shape both consumers can use without either re-deriving it.
|
|
286
287
|
export function modelFlags(harness, model) {
|
|
287
288
|
if (model === undefined || model === '')
|
|
288
289
|
return [];
|
|
@@ -307,19 +308,39 @@ export function thinkingEnv(harness, model) {
|
|
|
307
308
|
return {};
|
|
308
309
|
return { MAX_THINKING_TOKENS: String(CLAUDE_THINKING_BUDGET[parsed.value.thinking]) };
|
|
309
310
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
//
|
|
315
|
-
//
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
311
|
+
// Row 239. The line that hands the work to a session in another home, for the shell `platform`
|
|
312
|
+
// pastes into, where it runs exactly this: change to `home`, then start the harness. The home and
|
|
313
|
+
// `/witness` are always quoted (`quotedWord`): a checkout's path can hold a quote, a space or
|
|
314
|
+
// `$(…)`, and the path once stood raw inside a `'…'` that its own quote closed. The launch and the
|
|
315
|
+
// model flag print as argv words (`shellLine`): a pin's characters are checked where the config
|
|
316
|
+
// loads, not here. Off Windows: `cd '<home>' && [MAX_THINKING_TOKENS=<n> ]<launch>[ --model <pin>]
|
|
317
|
+
// '/witness'`, where the budget prefixes the one command. On Windows (the plan's B16) Windows
|
|
318
|
+
// PowerShell has no `&&`, and a failed `Set-Location` is no terminating error: `-ErrorAction Stop`
|
|
319
|
+
// makes it one, so nothing after it on the line runs. A budget set there would outlive the line,
|
|
320
|
+
// since the session keeps its environment, and a later handoff with no budget, pasted in the same
|
|
321
|
+
// window, would start with it (ruling R21): the line saves the variable, sets it, launches, and
|
|
322
|
+
// restores it, and the restore after `;` runs whether or not the launch succeeds. Assigning `$null`
|
|
323
|
+
// removes the variable, so one that was unset is unset again. REASONED: there is no Windows here.
|
|
324
|
+
// The line is never withheld (the plan's B5): the home is a cmdlet's argument, which PowerShell
|
|
325
|
+
// alone reads, and the words a launch shim can hand cmd.exe are constants and a pin, whose
|
|
326
|
+
// character set holds none it reads.
|
|
327
|
+
export function handoffLine(harness, home, model, platform = process.platform) {
|
|
328
|
+
// `thinkingEnv` names one variable at most: claude's budget.
|
|
329
|
+
const budget = Object.entries(thinkingEnv(harness, model))[0];
|
|
330
|
+
const launch = `${shellLine([harness.launch, ...modelFlags(harness, model)], platform)} ${quotedWord('/witness', platform)}`;
|
|
331
|
+
if (platform === 'win32') {
|
|
332
|
+
const cd = `Set-Location -LiteralPath ${quotedWord(home, platform)} -ErrorAction Stop; `;
|
|
333
|
+
if (budget === undefined)
|
|
334
|
+
return `${cd}${launch}`;
|
|
335
|
+
const [k, val] = budget;
|
|
336
|
+
return `${cd}$witnessThinking = $env:${k}; $env:${k} = ${quotedWord(val, platform)}; ${launch}; $env:${k} = $witnessThinking`;
|
|
337
|
+
}
|
|
338
|
+
return `cd ${quotedWord(home, platform)} && ${budget !== undefined ? `${budget[0]}=${budget[1]} ` : ''}${launch}`;
|
|
319
339
|
}
|
|
320
|
-
//
|
|
321
|
-
//
|
|
322
|
-
//
|
|
340
|
+
// The relay as the skill prints it: the harness's own command for a fresh context, then
|
|
341
|
+
// `/witness`. Row 239: every reader prints it raw (`cmd()`, the plan's B18); its wording, with
|
|
342
|
+
// no comma, dates from when it printed through `kv`, whose TOON quoting wrapped any value
|
|
343
|
+
// holding one.
|
|
323
344
|
export function relayLine(harness) {
|
|
324
345
|
return `${harness.relay} then /witness`;
|
|
325
346
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type RawDoc } from './fm.js';
|
|
2
|
+
import type { Canon } from './scan.js';
|
|
3
|
+
export declare function contentAtSha(root: string, rel: string, sha: string): RawDoc | undefined;
|
|
4
|
+
export interface BaseResolution {
|
|
5
|
+
kind: 'plan-pin' | 'empty';
|
|
6
|
+
sha?: string;
|
|
7
|
+
planId?: string;
|
|
8
|
+
decisions?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function baseForSpec(root: string, canon: Canon, specId: string, excludePlanId?: string): BaseResolution;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type Harness } from './harness.js';
|
|
2
|
+
import { type Result } from './refusal.js';
|
|
3
|
+
export declare function packageRoot(): string;
|
|
4
|
+
export interface SyncResult {
|
|
5
|
+
written: string[];
|
|
6
|
+
overwritten: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function preflightPayload(root: string, harness: Harness): Result<void>;
|
|
9
|
+
export declare function installPayload(root: string, harness: Harness): Result<SyncResult>;
|
|
10
|
+
export declare function payloadHomes(root: string): string[];
|
|
11
|
+
export declare function payloadStale(root: string, harness: Harness): string[];
|
|
12
|
+
export declare function installAllHomes(root: string, harness: Harness): Result<Array<{
|
|
13
|
+
home: string;
|
|
14
|
+
synced: SyncResult;
|
|
15
|
+
}>>;
|
|
16
|
+
export declare const WITNESS_MARKETPLACE = "witness";
|
|
17
|
+
export declare const CONTEXT_PLUGIN = "witness-context@witness";
|
|
18
|
+
export declare const CONTEXT_INSTALL = "claude plugin marketplace add popovych-co/witness && claude plugin install witness-context@witness";
|
|
19
|
+
export declare function mergeSettings(existing: string | undefined): {
|
|
20
|
+
text: string;
|
|
21
|
+
changed: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare function recordHarness(configText: string, name: string): {
|
|
24
|
+
text: string;
|
|
25
|
+
changed: boolean;
|
|
26
|
+
declared?: string;
|
|
27
|
+
};
|
|
28
|
+
export declare function writeSettings(root: string, rel: string, text: string): void;
|
|
29
|
+
export declare function readIfExists(root: string, rel: string): string | undefined;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export type EntryType = 'recap' | 'write' | 'write-refused' | 'gate-run' | 'human-decision' | 'drift-check' | 'test-evidence' | 'adopt' | 'status' | 'design-write' | 'design-reconfirm' | 'design-stamp' | 'design-shown' | 'dispatch' | 'policy-pin' | 'sync' | 'trust' | 'deferral' | 'deferral-moved' | 'deferral-retyped' | 'deferral-discharged' | 'deferral-dismissed' | 'ask' | 'ask-withdrawn' | 'need-satisfied' | 'step-close' | 'retry';
|
|
2
|
+
export interface Entry {
|
|
3
|
+
v: 1;
|
|
4
|
+
t: EntryType;
|
|
5
|
+
[k: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface RecapEntry extends Entry {
|
|
8
|
+
t: 'recap';
|
|
9
|
+
effort: string;
|
|
10
|
+
class: 'feature' | 'fix' | 'chore';
|
|
11
|
+
goals: Array<{
|
|
12
|
+
id: string;
|
|
13
|
+
text: string;
|
|
14
|
+
}>;
|
|
15
|
+
non_goals: Array<{
|
|
16
|
+
id: string;
|
|
17
|
+
text: string;
|
|
18
|
+
}>;
|
|
19
|
+
constraints: Array<{
|
|
20
|
+
id: string;
|
|
21
|
+
text: string;
|
|
22
|
+
}>;
|
|
23
|
+
decisions?: Array<{
|
|
24
|
+
id: string;
|
|
25
|
+
text: string;
|
|
26
|
+
}>;
|
|
27
|
+
slices: string[];
|
|
28
|
+
ask?: string;
|
|
29
|
+
}
|
|
30
|
+
export type StatusCause = 'gate-approve' | 'start' | 'ship' | 'merge' | 'abandon' | 'supersede' | 'template';
|
|
31
|
+
export interface StatusEntry {
|
|
32
|
+
v: 1;
|
|
33
|
+
t: 'status';
|
|
34
|
+
artifact: string;
|
|
35
|
+
from: string;
|
|
36
|
+
to: string;
|
|
37
|
+
cause: StatusCause;
|
|
38
|
+
run_id?: string;
|
|
39
|
+
worktree?: string;
|
|
40
|
+
branch?: string;
|
|
41
|
+
pr?: number;
|
|
42
|
+
by?: string;
|
|
43
|
+
note?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface JournalCtx {
|
|
46
|
+
session: string;
|
|
47
|
+
tokens?: number;
|
|
48
|
+
window?: number;
|
|
49
|
+
}
|
|
50
|
+
export declare const journalRel: (id: string) => string;
|
|
51
|
+
export declare function streamExists(root: string, id: string): boolean;
|
|
52
|
+
export declare function withJournalCtx<T>(c: JournalCtx | undefined, fn: () => T): T;
|
|
53
|
+
export declare const entryLine: (entry: {
|
|
54
|
+
t: EntryType;
|
|
55
|
+
[k: string]: unknown;
|
|
56
|
+
}) => string;
|
|
57
|
+
export declare function appendEntry(root: string, id: string, entry: {
|
|
58
|
+
t: EntryType;
|
|
59
|
+
[k: string]: unknown;
|
|
60
|
+
}): string;
|
|
61
|
+
export declare function readStream(root: string, id: string): Entry[];
|
|
62
|
+
export declare function journalActs(root: string, stream: string, at?: string): Array<{
|
|
63
|
+
entry: Entry;
|
|
64
|
+
commit: string;
|
|
65
|
+
}>;
|
|
66
|
+
export declare function latestRecap(root: string, effort: string): RecapEntry | undefined;
|
|
67
|
+
export declare function streamIds(root: string): string[];
|
|
68
|
+
export declare function effortStreams(root: string): string[];
|
|
69
|
+
export declare function effortAbandoned(entries: Entry[]): boolean;
|
|
70
|
+
export interface PolicyPin {
|
|
71
|
+
ordinal: number;
|
|
72
|
+
text: string;
|
|
73
|
+
}
|
|
74
|
+
export declare function policyPins(entries: Entry[]): PolicyPin[];
|
package/dist/journal.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
2
|
import { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync } from 'node:fs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
+
import { ID_RE } from './dsl.js';
|
|
4
5
|
import { tryGit } from './gitio.js';
|
|
5
6
|
import { version } from './version.js';
|
|
6
7
|
const dir = (root) => join(root, '.witness', 'journal');
|
|
@@ -82,8 +83,11 @@ export function streamIds(root) {
|
|
|
82
83
|
.map((f) => f.slice(0, -'.jsonl'.length))
|
|
83
84
|
.sort();
|
|
84
85
|
}
|
|
86
|
+
// Row 239 (the plan's B15). A stream's id is its file's name, which a commit can make anything, and
|
|
87
|
+
// an effort's slug is printed into the commands witness offers: a stream named outside the id set is
|
|
88
|
+
// no effort here, so nothing reading efforts offers it (`witness check` reports it, `stream-name`).
|
|
85
89
|
export function effortStreams(root) {
|
|
86
|
-
return streamIds(root).filter((id) => readStream(root, id)[0]?.t === 'recap');
|
|
90
|
+
return streamIds(root).filter((id) => ID_RE.test(id) && readStream(root, id)[0]?.t === 'recap');
|
|
87
91
|
}
|
|
88
92
|
export function effortAbandoned(entries) {
|
|
89
93
|
return entries.some((e) => e.t === 'human-decision' && e.decision === 'abandon-effort');
|
package/dist/junit.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Result } from './refusal.js';
|
|
2
|
+
export interface TestOutcome {
|
|
3
|
+
name: string;
|
|
4
|
+
classname: string;
|
|
5
|
+
status: 'passed' | 'failed' | 'skipped';
|
|
6
|
+
}
|
|
7
|
+
export declare function parseJUnit(xml: string): TestOutcome[];
|
|
8
|
+
export declare function reportFiles(root: string, glob: string): string[];
|
|
9
|
+
export declare function mergeReports(root: string, glob: string): Result<TestOutcome[]>;
|
package/dist/live.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type KeptStop } from './autonomy.js';
|
|
2
|
+
import type { AsideKind } from './drive.js';
|
|
3
|
+
import type { Canon } from './scan.js';
|
|
4
|
+
export declare const LIVE_DIR = ".witness/live";
|
|
5
|
+
export type EndReason = 'done' | 'idle-limit' | 'ceiling' | 'usage' | 'autonomy-off' | 'spawn-failed' | 'signal';
|
|
6
|
+
export interface LiveAside {
|
|
7
|
+
target: string;
|
|
8
|
+
kind: AsideKind;
|
|
9
|
+
gate?: string;
|
|
10
|
+
stop?: KeptStop;
|
|
11
|
+
}
|
|
12
|
+
export interface LiveState {
|
|
13
|
+
pid: number;
|
|
14
|
+
asides: LiveAside[];
|
|
15
|
+
ended?: EndReason;
|
|
16
|
+
}
|
|
17
|
+
export declare function writeLive(root: string, state: LiveState): void;
|
|
18
|
+
export declare function readLive(root: string, canon: Canon): LiveState | undefined;
|
|
19
|
+
export declare function liveDrive(root: string, canon: Canon): LiveState | undefined;
|
|
20
|
+
export declare function lastEnd(root: string, canon: Canon): EndReason | undefined;
|
|
21
|
+
export declare function takeWaiter(root: string, pid: number, session?: string): void;
|
|
22
|
+
export type WaiterState = 'mine' | 'replaced' | 'taken';
|
|
23
|
+
export declare function waiterState(root: string, pid: number, session?: string): WaiterState;
|
|
24
|
+
export declare function waiterIs(root: string, pid: number): boolean;
|
package/dist/lock.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Result } from './refusal.js';
|
|
2
|
+
export declare const LOCK_WAIT_MS = 30000;
|
|
3
|
+
export declare function isAlive(pid: number): boolean;
|
|
4
|
+
export declare function pause(ms: number): void;
|
|
5
|
+
export declare function pidOf(text: string | undefined): number | undefined;
|
|
6
|
+
export declare function takeStale(p: string, stale: (text: string | undefined) => boolean): 'taken' | 'busy';
|
|
7
|
+
export declare function lockHolder(root: string): number | undefined;
|
|
8
|
+
export declare function releaseIfMine(p: string, pid: number): void;
|
|
9
|
+
export declare function acquireLock(root: string, pid?: number, waitMs?: number): Result<() => void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function normalizeName(s: string): string;
|
|
2
|
+
export declare function matchesTag(testName: string, specId: string): boolean;
|
|
3
|
+
export declare function extractCanonicalTags(text: string): string[];
|
|
4
|
+
export interface SourceTags {
|
|
5
|
+
counts: Map<string, number>;
|
|
6
|
+
files: Map<string, string[]>;
|
|
7
|
+
}
|
|
8
|
+
export declare function sourceTags(root: string, excludes: string[]): SourceTags;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Result } from './refusal.js';
|
|
2
|
+
import { type Setting } from './settings.js';
|
|
3
|
+
export type ChangeKind = 'added' | 'filled' | 'expanded' | 'moved';
|
|
4
|
+
export interface Change {
|
|
5
|
+
kind: ChangeKind;
|
|
6
|
+
path: string;
|
|
7
|
+
from?: unknown;
|
|
8
|
+
to: unknown;
|
|
9
|
+
}
|
|
10
|
+
type Raw = Record<string, unknown>;
|
|
11
|
+
export declare const newestSchema: () => number;
|
|
12
|
+
export declare function sectionsOf(known: ReadonlySet<string>): Set<string>;
|
|
13
|
+
export declare function withoutEmpty(raw: Raw): Raw;
|
|
14
|
+
export declare function deepEqual(a: unknown, b: unknown): boolean;
|
|
15
|
+
export declare function migrateValues(raw: Raw, from: number, opts: {
|
|
16
|
+
mode: 'memory' | 'write';
|
|
17
|
+
to?: number;
|
|
18
|
+
settings?: readonly Setting[];
|
|
19
|
+
harness?: string;
|
|
20
|
+
}): Result<{
|
|
21
|
+
raw: Raw;
|
|
22
|
+
changes: Change[];
|
|
23
|
+
}>;
|
|
24
|
+
export declare function olderSchemaWarning(from: number, to: number, changes: readonly Change[]): string;
|
|
25
|
+
export {};
|
package/dist/model.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Config } from './config.js';
|
|
2
|
+
import type { GateName } from './settings.js';
|
|
3
|
+
import { type Result, type Violation } from './refusal.js';
|
|
4
|
+
export { MODEL_ALIASES } from './pin.js';
|
|
5
|
+
export declare const SESSION_DEFAULT = "session-default";
|
|
6
|
+
export declare function stagePin(cfg: Config, role: GateName | 'arbiter'): Result<string | undefined>;
|
|
7
|
+
export declare function stageModel(cfg: Config, role: GateName | 'arbiter'): Result<string>;
|
|
8
|
+
export declare function unansweredPin(rows: Violation[], field: string, model: string, harness: string): Violation[];
|
package/dist/models.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { loadConfig, type Config } from './config.js';
|
|
2
|
+
export { loadCanon, type Canon } from './scan.js';
|
|
3
|
+
export { liveDrive } from './live.js';
|
|
4
|
+
export { HELD_KINDS, WAIT_KINDS, WAIT_LABEL, needsYou, needsYouToken, type NeedYou, type TrustGrant, type WaitKind } from './needs-you.js';
|
|
5
|
+
export { decideView, type DecideView, type Disposition, type LastRun } from './decide-view.js';
|
|
6
|
+
export { type FindingView, type GateRunView } from './gate-run-view.js';
|
|
7
|
+
export { trustListing, type TrustListing, type TrustRow, type TrustStatus } from './allowlist.js';
|
|
8
|
+
export { type Act, type ActInput, type ActInputName } from './act.js';
|
|
9
|
+
export { type Decision, type Option } from './recommend.js';
|
package/dist/models.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Rows 139/203. The CLI's read surface for the UI, `@popovych.co/witness/models`: the models the
|
|
2
|
+
// text renders from (the inbox's items, a decide view, a trust listing, and the acts they carry)
|
|
3
|
+
// and the reads that feed them, as plain data. Nothing here writes (spec n1); row 228 records the
|
|
4
|
+
// entry when 1b lands. The package exports this entry alone, so a reader reaches nothing past it.
|
|
5
|
+
export { loadConfig } from './config.js';
|
|
6
|
+
export { loadCanon } from './scan.js';
|
|
7
|
+
export { liveDrive } from './live.js';
|
|
8
|
+
export { HELD_KINDS, WAIT_KINDS, WAIT_LABEL, needsYou, needsYouToken } from './needs-you.js';
|
|
9
|
+
export { decideView } from './decide-view.js';
|
|
10
|
+
export { trustListing } from './allowlist.js';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type Act } from './act.js';
|
|
2
|
+
import type { Ctx } from './cli.js';
|
|
3
|
+
import type { Config } from './config.js';
|
|
4
|
+
import type { Aside } from './drive.js';
|
|
5
|
+
import type { Decision } from './recommend.js';
|
|
6
|
+
import { type Canon } from './scan.js';
|
|
7
|
+
export interface TrustGrant {
|
|
8
|
+
cmd: string;
|
|
9
|
+
source: string;
|
|
10
|
+
grant?: Act;
|
|
11
|
+
}
|
|
12
|
+
interface ItemBase {
|
|
13
|
+
target: string;
|
|
14
|
+
key: string;
|
|
15
|
+
notice?: true;
|
|
16
|
+
}
|
|
17
|
+
export type NeedYou = ItemBase & ({
|
|
18
|
+
kind: 'pending-txn';
|
|
19
|
+
op: string;
|
|
20
|
+
recover: Decision;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'design-look';
|
|
23
|
+
open: Act;
|
|
24
|
+
show: Act;
|
|
25
|
+
} | {
|
|
26
|
+
kind: 'trust-grant';
|
|
27
|
+
commands?: TrustGrant[];
|
|
28
|
+
list: Act;
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'need';
|
|
31
|
+
need: string;
|
|
32
|
+
text: string;
|
|
33
|
+
holds: string[];
|
|
34
|
+
satisfy: Act;
|
|
35
|
+
} | {
|
|
36
|
+
kind: 'decision';
|
|
37
|
+
gate: string;
|
|
38
|
+
show: Act;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'conversation';
|
|
41
|
+
ask?: string;
|
|
42
|
+
handoff?: string;
|
|
43
|
+
} | {
|
|
44
|
+
kind: 'merge';
|
|
45
|
+
pr?: string;
|
|
46
|
+
} | {
|
|
47
|
+
kind: 'parked';
|
|
48
|
+
gate: string;
|
|
49
|
+
round?: number;
|
|
50
|
+
why: string;
|
|
51
|
+
reopen: Act[];
|
|
52
|
+
} | {
|
|
53
|
+
kind: 'stuck';
|
|
54
|
+
why?: string;
|
|
55
|
+
retry?: Act;
|
|
56
|
+
} | {
|
|
57
|
+
kind: 'capped';
|
|
58
|
+
why?: string;
|
|
59
|
+
retry?: Act;
|
|
60
|
+
});
|
|
61
|
+
export type WaitKind = NeedYou['kind'];
|
|
62
|
+
export type AsideFacts = Pick<Aside, 'target' | 'kind'> & Partial<Pick<Aside, 'gate' | 'stop' | 'line' | 'why' | 'trust'>>;
|
|
63
|
+
export declare const WAIT_LABEL: Record<WaitKind, string>;
|
|
64
|
+
type HeldKind = 'merge' | 'parked' | 'stuck' | 'capped';
|
|
65
|
+
export declare const HELD_KINDS: ReadonlySet<WaitKind>;
|
|
66
|
+
export type HeldItem = Extract<NeedYou, {
|
|
67
|
+
kind: HeldKind;
|
|
68
|
+
}>;
|
|
69
|
+
export declare const isHeld: (item: NeedYou) => item is HeldItem;
|
|
70
|
+
export declare const WAIT_KINDS: ReadonlySet<WaitKind>;
|
|
71
|
+
export declare function needsYou(root: string, ctx: Pick<Ctx, 'env'>, cfg: Config, canon: Canon, aside: readonly AsideFacts[]): NeedYou[];
|
|
72
|
+
export declare function needYouRows(item: NeedYou): string[];
|
|
73
|
+
export declare function waitingRows(item: HeldItem): string[];
|
|
74
|
+
export declare function needsYouToken(items: readonly NeedYou[]): string;
|
|
75
|
+
export {};
|