@holmes-lab/holmes-kit 0.36.0 → 0.36.1
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/CHANGELOG.md +48 -0
- package/README.md +2 -2
- package/dist/.build-id +1 -1
- package/dist/holmes/guardrail/refusal-codes.js +2 -1
- package/dist/holmes/hooks/adapters/antigravity.d.ts +1 -1
- package/dist/holmes/hooks/adapters/antigravity.js +6 -2
- package/dist/holmes/hooks/pre-tool-use.d.ts +20 -1
- package/dist/holmes/hooks/pre-tool-use.js +48 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,54 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
<!-- @implements A-SPEC-209 -->
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.36.1] - 2026-10-20
|
|
11
|
+
|
|
12
|
+
A Windows patch. On a Windows host, Codex and Antigravity run the shell text they send under a Bash name in Windows
|
|
13
|
+
PowerShell, and 0.36.0 judged that text with Bash rules only, so a PowerShell cmdlet that writes a code file passed the
|
|
14
|
+
gate. 0.36.1 judges it a second time as the PowerShell it runs. macOS and Linux hosts, Claude Code, and every other
|
|
15
|
+
payload are judged byte-identically to 0.36.0.
|
|
16
|
+
|
|
17
|
+
Upgrading: nothing is required.
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- **A Codex shell command on Windows is also judged as the PowerShell text Codex runs** (A-SPEC-790.2).
|
|
22
|
+
- Measured 2026-10-20 with codex-cli 0.154.0: Codex runs its shell tool as `powershell.exe -Command '…'` in Windows
|
|
23
|
+
PowerShell 5.1, but names it Bash.
|
|
24
|
+
- Before (built hook, dist 41aba965): as a Codex payload, `Set-Content src\holmes\x.ts x`,
|
|
25
|
+
`'x' | Out-File src/holmes/x.ts`, `Copy-Item C:\Temp\e.ts src\holmes\x.ts` and
|
|
26
|
+
`New-Item -ItemType File src/holmes/x.ts` were **allowed**, while Claude Code's PowerShell tool denied each one.
|
|
27
|
+
- After: the Bash reading runs first and its denial is the decision. Then the PowerShell text is judged, and a denial
|
|
28
|
+
there is the decision too. PowerShell text the translator cannot read is refused as
|
|
29
|
+
`a Codex command that PowerShell runs and the gate cannot judge (…)`, code `gate.unjudgeable`.
|
|
30
|
+
- A Codex payload is recognised by its shape (a `turn_id` without a `prompt_id`), only on a win32 host.
|
|
31
|
+
- **An Antigravity `run_command` on Windows gets the same second reading** (A-SPEC-790.7).
|
|
32
|
+
- Measured 2026-10-20 on Windows 11: agy runs the command as `powershell.exe powershell -Command "…"`.
|
|
33
|
+
- Before: through the built Antigravity hook, `Set-Content src\holmes\x.ts x`, `'x' | Out-File src/holmes/x.ts`,
|
|
34
|
+
`New-Item -ItemType File src/holmes/x.ts` and `Copy-Item C:\Temp\e.ts src\holmes\x.ts` were `ask`, not denied.
|
|
35
|
+
- After: on win32 the adapter marks the payload `shell_dialect: 'powershell'`, and each of the four is denied. The
|
|
36
|
+
mark can only add a reading, so setting it gains a caller nothing.
|
|
37
|
+
- **An operator's grant still lets such a command through once** (A-SPEC-790.8).
|
|
38
|
+
- Without this, the Bash reading spent the single-use grant, and the PowerShell reading then looked for a new one for
|
|
39
|
+
its translated text. A granted Codex or Antigravity command could never pass on Windows.
|
|
40
|
+
- Now the second reading honors the approvals the first reading of the same call spent, for the same kind and the
|
|
41
|
+
command as written. They are not spent again. A replay is still refused.
|
|
42
|
+
- Denials that no approval lifts are unchanged: a code write, the role policy, the plan scope and unjudgeable text.
|
|
43
|
+
|
|
44
|
+
### Known issues
|
|
45
|
+
|
|
46
|
+
- **Windows full run** (762 suites, 9,929 tests): 13 reds in 8 suites, none in code this release changes.
|
|
47
|
+
- Seven timing bounds: harness-config-protection rounds 41, 43 and 44, mcp-version `:1187` and `:1807`,
|
|
48
|
+
nested-worktree round 8, and dispatch-recovery's input-time bound.
|
|
49
|
+
- Three over-blocks under a spaced root (`ax-readonly-overblock`). They fail closed.
|
|
50
|
+
- Two test-portability defects: `spec-list-store` puts a native path into a `RegExp` unescaped, and the Python
|
|
51
|
+
`tomllib` cross-check in `codex-toml-escapes` reads its stdin in the locale code page.
|
|
52
|
+
- `install-script` Stage 4b ran from an elevated shell, where the protected npm prefix is writable. It was not re-run
|
|
53
|
+
from a normal shell.
|
|
54
|
+
- **Spec numbers.** The Windows session sealed these slices as A-SPEC-790.5 and 790.6, numbers 0.36.0 had already
|
|
55
|
+
shipped for other slices. They ship here as A-SPEC-790.7 and 790.8.
|
|
56
|
+
- The other 0.36.0 known issues stand, except that the Codex/Antigravity Windows shell item is now resolved.
|
|
57
|
+
|
|
10
58
|
## [0.36.0] - 2026-10-20
|
|
11
59
|
|
|
12
60
|
This is an interim hardening release of the role/phase goal (`docs/goals/GOAL-role-phase-sdlc-hardening-2026-10-17.md`).
|
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
<!-- holmes-kit:attest:begin -->
|
|
10
10
|

|
|
11
11
|
|
|
12
|
-
**473/481** source files (98.3%) trace to an approved spec · **
|
|
13
|
-
Measured at `
|
|
12
|
+
**473/481** source files (98.3%) trace to an approved spec · **928/1005** approved A-SPECs (92.3%) are anchored from code.
|
|
13
|
+
Measured at `8b45cd0dcb78` (specs `sha256:0b3ecc947d6c`) — reproduce with `holmes-kit attest`.
|
|
14
14
|
<!-- holmes-kit:attest:end -->
|
|
15
15
|
|
|
16
16
|
---
|
package/dist/.build-id
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
0ddc829e-mvgdgz84
|
|
@@ -30,7 +30,8 @@ exports.REFUSAL_CODES = [
|
|
|
30
30
|
code: 'gate.unjudgeable', class: 'retryable',
|
|
31
31
|
remediation: ['split the command or edit into smaller parts', 'retry; if it repeats, ask the operator'],
|
|
32
32
|
// A-SPEC-790.3: a PowerShell command the translator cannot read is retried in plainer parts.
|
|
33
|
-
|
|
33
|
+
// A-SPEC-790.2: so is a Codex command on Windows, which PowerShell runs and the translator cannot read.
|
|
34
|
+
test: /too large to judge|internal error|deadline|timed out|risk classification failed|PreToolUse Hook\] Error|result of this write to|a shell command (?:of|with more than)|a PowerShell command that cannot be judged|an? (?:Codex|Antigravity) command that PowerShell runs and the gate cannot judge/i,
|
|
34
35
|
},
|
|
35
36
|
{
|
|
36
37
|
code: 'launch.refused', class: 'needs_hitl',
|
|
@@ -34,7 +34,7 @@ export declare function shippedHookTimeoutMs(hookPath: string): number;
|
|
|
34
34
|
* 번역할 수 없는 입력은 **닫는 쪽**으로 답한다. 어댑터가 조용히 `allow` 를 돌려주면 게이트가
|
|
35
35
|
* 없는 것과 같고, 그 사실은 아무 데도 나타나지 않는다 — REQ-144 가 같은 방향으로 세운 규율이다.
|
|
36
36
|
*/
|
|
37
|
-
export declare function adaptPreToolUse(stdin: string, cwd?: string, run?: HookRunner): AgyPreDecision;
|
|
37
|
+
export declare function adaptPreToolUse(stdin: string, cwd?: string, run?: HookRunner, host?: NodeJS.Platform): AgyPreDecision;
|
|
38
38
|
/**
|
|
39
39
|
* Stop: 게이트가 "막아라"라고 하면, 이 하네스에서 막는 말은 `continue` 다.
|
|
40
40
|
*
|
|
@@ -37,7 +37,7 @@ exports.TOOL_MAP = void 0;
|
|
|
37
37
|
exports.shippedHookTimeoutMs = shippedHookTimeoutMs;
|
|
38
38
|
exports.adaptPreToolUse = adaptPreToolUse;
|
|
39
39
|
exports.adaptStop = adaptStop;
|
|
40
|
-
// @implements A-SPEC-193, A-SPEC-772.1
|
|
40
|
+
// @implements A-SPEC-193, A-SPEC-772.1, A-SPEC-790.7
|
|
41
41
|
// @implements A-SPEC-734
|
|
42
42
|
// @implements A-SPEC-769.10, A-SPEC-769.11
|
|
43
43
|
const fs = __importStar(require("node:fs"));
|
|
@@ -139,7 +139,7 @@ const READ_ONLY_AS = new Set(['Read', 'Grep', 'Glob']);
|
|
|
139
139
|
* 번역할 수 없는 입력은 **닫는 쪽**으로 답한다. 어댑터가 조용히 `allow` 를 돌려주면 게이트가
|
|
140
140
|
* 없는 것과 같고, 그 사실은 아무 데도 나타나지 않는다 — REQ-144 가 같은 방향으로 세운 규율이다.
|
|
141
141
|
*/
|
|
142
|
-
function adaptPreToolUse(stdin, cwd = process.cwd(), run = runShippedHook) {
|
|
142
|
+
function adaptPreToolUse(stdin, cwd = process.cwd(), run = runShippedHook, host = process.platform) {
|
|
143
143
|
let payload;
|
|
144
144
|
try {
|
|
145
145
|
payload = JSON.parse(stdin);
|
|
@@ -204,10 +204,14 @@ function adaptPreToolUse(stdin, cwd = process.cwd(), run = runShippedHook) {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
const root = workspaceOf(payload, cwd);
|
|
207
|
+
// @implements A-SPEC-790.7 — on Windows, run_command runs as `powershell.exe powershell -Command "…"` (measured
|
|
208
|
+
// 2026-10-20); the mark asks the gate for A-SPEC-790.2's second reading, which can only be stricter.
|
|
209
|
+
const powershell = host === 'win32' && map?.as === 'Bash' && map.commandArg !== undefined;
|
|
207
210
|
const raw = run(shippedHook('pre-tool-use.js'), JSON.stringify({
|
|
208
211
|
tool_name: map?.as ?? name,
|
|
209
212
|
tool_input: toolInput,
|
|
210
213
|
cwd: root,
|
|
214
|
+
...(powershell ? { shell_dialect: 'powershell' } : {}),
|
|
211
215
|
}), root);
|
|
212
216
|
const out = decisionOf(raw);
|
|
213
217
|
if (!out.answered) {
|
|
@@ -129,6 +129,19 @@ export interface HookInput {
|
|
|
129
129
|
/** @implements A-SPEC-769.7 — `'no-op'`: the one cause is an update block with no `+`/`-` line; the paths are named. */
|
|
130
130
|
patchUnreadableCause?: 'shell-marker' | 'no-op';
|
|
131
131
|
patchNoopPaths?: string[];
|
|
132
|
+
/**
|
|
133
|
+
* @implements A-SPEC-790.2 — a Codex shell payload on a win32 host, read as the PowerShell text Codex runs it as
|
|
134
|
+
* (`powershell.exe -Command '…'`, measured 2026-10-20); evaluateHook judges it a second time when the Bash reading allows.
|
|
135
|
+
* @implements A-SPEC-790.7 — also an Antigravity run_command marked `shell_dialect: 'powershell'`; `harness` names
|
|
136
|
+
* which one in the unjudgeable refusal.
|
|
137
|
+
*/
|
|
138
|
+
codexPowerShell?: ({
|
|
139
|
+
shell: string;
|
|
140
|
+
} | {
|
|
141
|
+
unjudgeable: string;
|
|
142
|
+
}) & {
|
|
143
|
+
harness: 'codex' | 'antigravity';
|
|
144
|
+
};
|
|
132
145
|
}
|
|
133
146
|
/**
|
|
134
147
|
* @implements A-SPEC-753.2 — what a denial leaves in the provenance ledger: the reason up to the operator command.
|
|
@@ -136,7 +149,7 @@ export interface HookInput {
|
|
|
136
149
|
* is the one artefact meant to carry no raw command. The reason printed to the harness is unchanged.
|
|
137
150
|
*/
|
|
138
151
|
export declare function ledgerSummaryOf(reason: string): string;
|
|
139
|
-
export declare function normalizeHookInput(raw: unknown): HookInput;
|
|
152
|
+
export declare function normalizeHookInput(raw: unknown, host?: NodeJS.Platform): HookInput;
|
|
140
153
|
/**
|
|
141
154
|
* Which way to fail when the gate itself throws.
|
|
142
155
|
*
|
|
@@ -267,6 +280,12 @@ export declare function evaluateHook(input: {
|
|
|
267
280
|
*/
|
|
268
281
|
projectRoot: string;
|
|
269
282
|
now?: string;
|
|
283
|
+
carriedApprovals?: {
|
|
284
|
+
command: string;
|
|
285
|
+
reading: string;
|
|
286
|
+
approvals: Approval[];
|
|
287
|
+
};
|
|
288
|
+
onApprovalsSpent?: (approvals: Approval[]) => void;
|
|
270
289
|
}): {
|
|
271
290
|
permissionDecision: 'allow' | 'deny';
|
|
272
291
|
permissionDecisionReason?: string;
|
|
@@ -53,7 +53,7 @@ exports.gateErrorDecision = gateErrorDecision;
|
|
|
53
53
|
exports.wiredSpecsDir = wiredSpecsDir;
|
|
54
54
|
exports.evaluateHook = evaluateHook;
|
|
55
55
|
exports.readSpecsSync = readSpecsSync;
|
|
56
|
-
// @implements A-SPEC-476.7, A-SPEC-226.3, A-SPEC-774.28, A-SPEC-747.4, A-SPEC-747.7, A-SPEC-774.23, A-SPEC-753.3, A-SPEC-773, A-SPEC-773.1, A-SPEC-773.2, A-SPEC-134.2,A-SPEC-278,A-SPEC-733, A-SPEC-734, A-SPEC-747, A-SPEC-477.1, A-SPEC-753, A-SPEC-163.7, A-SPEC-768.2, A-SPEC-772.1, A-SPEC-747.3, A-SPEC-774.26, A-SPEC-163.8, A-SPEC-790
|
|
56
|
+
// @implements A-SPEC-476.7, A-SPEC-226.3, A-SPEC-774.28, A-SPEC-747.4, A-SPEC-747.7, A-SPEC-774.23, A-SPEC-753.3, A-SPEC-773, A-SPEC-773.1, A-SPEC-773.2, A-SPEC-134.2,A-SPEC-278,A-SPEC-733, A-SPEC-734, A-SPEC-747, A-SPEC-477.1, A-SPEC-753, A-SPEC-163.7, A-SPEC-768.2, A-SPEC-772.1, A-SPEC-747.3, A-SPEC-774.26, A-SPEC-163.8, A-SPEC-790, A-SPEC-790.2, A-SPEC-790.7, A-SPEC-790.8
|
|
57
57
|
const powershell_shell_1 = require("../guardrail/powershell-shell");
|
|
58
58
|
const shell_argument_roles_1 = require("../guardrail/shell-argument-roles");
|
|
59
59
|
// @implements A-SPEC-549.3 — the hook's deny reasons are English here; hooks-english.test.ts drives
|
|
@@ -1342,7 +1342,7 @@ function ledgerSummaryOf(reason) {
|
|
|
1342
1342
|
const at = reason.indexOf(' Operator: ');
|
|
1343
1343
|
return at === -1 ? reason : reason.slice(0, at);
|
|
1344
1344
|
}
|
|
1345
|
-
function normalizeHookInput(raw) {
|
|
1345
|
+
function normalizeHookInput(raw, host = process.platform) {
|
|
1346
1346
|
const str = (v) => (typeof v === 'string' ? v : undefined);
|
|
1347
1347
|
if (!raw || typeof raw !== 'object')
|
|
1348
1348
|
return { tool_name: '', tool_input: {} };
|
|
@@ -1386,6 +1386,16 @@ function normalizeHookInput(raw) {
|
|
|
1386
1386
|
const cmd = psShell ?? cmdRaw;
|
|
1387
1387
|
if (cmd !== undefined)
|
|
1388
1388
|
out.command = cmd;
|
|
1389
|
+
// @implements A-SPEC-790.2 — Codex on Windows runs its shell tool in Windows PowerShell 5.1 (measured 2026-10-20,
|
|
1390
|
+
// codex-cli 0.154.0), but names it Bash; a Codex-shaped payload (turn_id without prompt_id, as hookHarnessOf reads it)
|
|
1391
|
+
// on a win32 host also carries its PowerShell reading. The host is an argument so either host's answer is testable.
|
|
1392
|
+
const toolLower = (str(r.tool_name) ?? '').toLowerCase();
|
|
1393
|
+
const codexShaped = typeof r.turn_id === 'string' && r.turn_id !== '' && !(typeof r.prompt_id === 'string' && r.prompt_id !== '');
|
|
1394
|
+
// @implements A-SPEC-790.7 — the Antigravity adapter marks its run_command on win32; the mark only adds a reading.
|
|
1395
|
+
const agyMarked = r.shell_dialect === 'powershell';
|
|
1396
|
+
const codexPs = host === 'win32' && (codexShaped || agyMarked) && ps === null && cmdRaw !== undefined
|
|
1397
|
+
&& (toolLower === 'bash' || toolLower === 'shell')
|
|
1398
|
+
? { ...(0, powershell_shell_1.powershellAsShell)(cmdRaw), harness: codexShaped ? 'codex' : 'antigravity' } : null;
|
|
1389
1399
|
const wd = str(ti.workdir);
|
|
1390
1400
|
if (wd !== undefined && wd.trim() !== '')
|
|
1391
1401
|
out.workdir = wd.trim();
|
|
@@ -1481,6 +1491,7 @@ function normalizeHookInput(raw) {
|
|
|
1481
1491
|
const sessionId = str(r.session_id);
|
|
1482
1492
|
return { tool_name: psShell !== undefined ? 'Bash' : str(r.tool_name) ?? '', tool_input: out, ...(cwd === undefined ? {} : { cwd }), ...(sessionId ? { session_id: sessionId } : {}), ...(malformed ? { malformed: true } : {}),
|
|
1483
1493
|
...(ps !== null && 'unjudgeable' in ps ? { powershellUnjudgeable: ps.unjudgeable } : {}),
|
|
1494
|
+
...(codexPs !== null ? { codexPowerShell: codexPs } : {}),
|
|
1484
1495
|
...(patchUnreadable ? { patchUnreadable: true } : {}), ...(shellMarked && !otherUnreadable ? { patchUnreadableCause: 'shell-marker' } : {}),
|
|
1485
1496
|
...(noopPaths !== null && !shellMarked ? { patchUnreadableCause: 'no-op', patchNoopPaths: noopPaths } : {}) };
|
|
1486
1497
|
}
|
|
@@ -1624,6 +1635,23 @@ function wiredSpecsDir(argv, env) {
|
|
|
1624
1635
|
exports.DEFAULT_SPECS_DIR = '.ax/specs';
|
|
1625
1636
|
// @implements A-SPEC-100.2
|
|
1626
1637
|
function evaluateHook(input, specsDir, opts) {
|
|
1638
|
+
// @implements A-SPEC-790.2 — a Codex shell payload on Windows: the Bash reading first (a denial there is the decision,
|
|
1639
|
+
// and nothing more is filed); then the PowerShell text Codex actually runs. Only ever stricter than the Bash reading.
|
|
1640
|
+
const codexPs = input.codexPowerShell;
|
|
1641
|
+
if (codexPs !== undefined) {
|
|
1642
|
+
const { codexPowerShell: _bashOnly, ...bashInput } = input;
|
|
1643
|
+
// @implements A-SPEC-790.8 — what the first reading spent answers the second for the same command: the operator's
|
|
1644
|
+
// single-use grant was spent by one reading and looked for anew by the other, so a granted command never passed.
|
|
1645
|
+
let spent = [];
|
|
1646
|
+
const bashVerdict = evaluateHook(bashInput, specsDir, { ...opts, onApprovalsSpent: (a) => { spent = a; } });
|
|
1647
|
+
if (bashVerdict.permissionDecision === 'deny')
|
|
1648
|
+
return bashVerdict;
|
|
1649
|
+
if ('unjudgeable' in codexPs) {
|
|
1650
|
+
const who = codexPs.harness === 'antigravity' ? 'an Antigravity' : 'a Codex';
|
|
1651
|
+
return { permissionDecision: 'deny', permissionDecisionReason: `[Holmes-Kit] ${who} command that PowerShell runs and the gate cannot judge (${codexPs.unjudgeable}) is refused (REQ-790)` };
|
|
1652
|
+
}
|
|
1653
|
+
return evaluateHook({ ...bashInput, tool_input: { ...bashInput.tool_input, command: codexPs.shell } }, specsDir, { ...opts, carriedApprovals: { command: String(bashInput.tool_input?.command ?? ''), reading: codexPs.shell, approvals: spent } });
|
|
1654
|
+
}
|
|
1627
1655
|
// @implements A-SPEC-728 (rule 40) — a spec edit's result is shared within this call only: a caller that hands the same
|
|
1628
1656
|
// tool_input object back changed must not be judged on the earlier result.
|
|
1629
1657
|
editedMemo = null;
|
|
@@ -1771,13 +1799,21 @@ function evaluateHook(input, specsDir, opts) {
|
|
|
1771
1799
|
// `rm -rf /`) has already judged its deletions; the wiring-deletion rule below must not re-deny it.
|
|
1772
1800
|
// @implements A-SPEC-477.1 — spend only after every shell check succeeds.
|
|
1773
1801
|
const pendingApprovals = [];
|
|
1802
|
+
// @implements A-SPEC-790.8 — a carried approval answers first, only for its own kind and the command as written;
|
|
1803
|
+
// it is not spent again and files no request. Every other approval resolves as before, against the text judged.
|
|
1804
|
+
const carried = opts.carriedApprovals?.reading === command ? opts.carriedApprovals : undefined;
|
|
1805
|
+
const resolveForCommand = (kind) => {
|
|
1806
|
+
const held = carried?.approvals.find((a) => (0, risk_gate_1.approvalCovers)(a, { kind, target: carried.command }, nowTs));
|
|
1807
|
+
return held !== undefined ? { approval: held, source: 'carried' }
|
|
1808
|
+
: (0, approval_grants_1.resolveApproval)(opts.projectRoot, approval, { kind, target: command }, nowTs);
|
|
1809
|
+
};
|
|
1774
1810
|
const legacySessionApproval = approval?.scope === undefined
|
|
1775
1811
|
&& (0, risk_gate_1.approvalCovers)(approval, { kind: 'config-write', target: command }, nowTs);
|
|
1776
1812
|
let hardHitlCovered = false;
|
|
1777
1813
|
if (assessment.level === 'hard-hitl') {
|
|
1778
1814
|
// @implements A-SPEC-245 — env first, then the grant files. The grant's mandatory nonce rides
|
|
1779
1815
|
// the SAME atomic ledger consumption below, so hard-hitl single-use needs no new machinery.
|
|
1780
|
-
const resolved = (
|
|
1816
|
+
const resolved = resolveForCommand('shell');
|
|
1781
1817
|
const covers = resolved !== undefined;
|
|
1782
1818
|
const deny = (why) => ({
|
|
1783
1819
|
permissionDecision: 'deny',
|
|
@@ -1921,7 +1957,7 @@ function evaluateHook(input, specsDir, opts) {
|
|
|
1921
1957
|
: providerCredential
|
|
1922
1958
|
? '[Holmes-Kit] the command accesses a protected provider credential — requires operator approval'
|
|
1923
1959
|
: '[Holmes-Kit] command reads or dumps process environment (holds out-of-band approval secrets) — requires operator approval';
|
|
1924
|
-
const resolved = (
|
|
1960
|
+
const resolved = resolveForCommand('config-write');
|
|
1925
1961
|
if (!resolved) {
|
|
1926
1962
|
let hint = (0, approval_queue_1.queueHint)(opts.projectRoot, { kind: 'config-write', target: command, why: reason });
|
|
1927
1963
|
// The queue deliberately suppresses duplicate writes, not the pending operator decision.
|
|
@@ -2131,7 +2167,7 @@ function evaluateHook(input, specsDir, opts) {
|
|
|
2131
2167
|
// One config-write approval (env or a granted queue request for this exact command) lifts both
|
|
2132
2168
|
// rules below; the refusal files that request, as the Write/Edit config gate does.
|
|
2133
2169
|
const liftByConfigWrite = (why) => {
|
|
2134
|
-
const r = (
|
|
2170
|
+
const r = resolveForCommand('config-write');
|
|
2135
2171
|
if (r !== undefined) {
|
|
2136
2172
|
pendingApprovals.push(r);
|
|
2137
2173
|
return null;
|
|
@@ -2391,17 +2427,19 @@ function evaluateHook(input, specsDir, opts) {
|
|
|
2391
2427
|
}
|
|
2392
2428
|
}
|
|
2393
2429
|
}
|
|
2394
|
-
|
|
2430
|
+
// @implements A-SPEC-790.8 — a carried approval was spent by the first reading; only the others are spent here.
|
|
2431
|
+
const spendable = pendingApprovals.flatMap((p) => (p.source === 'carried' ? [] : [p]));
|
|
2432
|
+
if (spendable.length > 0) {
|
|
2395
2433
|
const deny = (why) => ({ permissionDecision: 'deny',
|
|
2396
2434
|
permissionDecisionReason: `[Holmes-Kit] ${why}` });
|
|
2397
2435
|
// @implements A-SPEC-477.1 — a later invalid approval must not spend an earlier valid one.
|
|
2398
2436
|
// Validate the complete set, then check all replays and append under ONE existing ledger hold.
|
|
2399
2437
|
// This coordinates validation; it does not promise rollback after an I/O failure during append.
|
|
2400
|
-
if (
|
|
2438
|
+
if (spendable.some(({ approval }) => (0, provenance_chain_1.blankNonce)(approval.nonce))) {
|
|
2401
2439
|
return deny('the approval declared single-use (nonce) but the value is empty — single-use cannot be enforced, so it is denied');
|
|
2402
2440
|
}
|
|
2403
2441
|
const ledgerFile = (0, ledger_store_2.writerChainFile)(path.join(opts.projectRoot, '.ax', 'ledger'));
|
|
2404
|
-
const unique = new Map(
|
|
2442
|
+
const unique = new Map(spendable.filter(({ approval }) => !!approval.nonce)
|
|
2405
2443
|
.map(({ approval }) => [approval.nonce, approval]));
|
|
2406
2444
|
const check = () => {
|
|
2407
2445
|
const conflict = (0, ledger_store_2.ledgerConflictReason)(path.dirname(ledgerFile));
|
|
@@ -2432,10 +2470,11 @@ function evaluateHook(input, specsDir, opts) {
|
|
|
2432
2470
|
catch (err) {
|
|
2433
2471
|
return deny(`could not obtain exclusive ledger access to spend the single-use approval (${err instanceof Error ? err.message : String(err)})`);
|
|
2434
2472
|
}
|
|
2435
|
-
for (const { source, approval } of
|
|
2473
|
+
for (const { source, approval } of spendable) {
|
|
2436
2474
|
if (source === 'grant' && approval.nonce)
|
|
2437
2475
|
(0, approval_grants_1.consumeGrantFile)(opts.projectRoot, approval.nonce);
|
|
2438
2476
|
}
|
|
2477
|
+
opts.onApprovalsSpent?.(spendable.map(({ approval }) => approval));
|
|
2439
2478
|
}
|
|
2440
2479
|
// @implements A-SPEC-774.13 — an allowed interactive launch inherits this session's authority variables; a hook
|
|
2441
2480
|
// cannot change a command's environment, so it names them (never their values) and gives the operator's re-run.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"//": "@implements A-SPEC-209",
|
|
3
3
|
"name": "@holmes-lab/holmes-kit",
|
|
4
|
-
"version": "0.36.
|
|
4
|
+
"version": "0.36.1",
|
|
5
5
|
"description": "Holmes-Kit — deterministic Agentic Software Engineering (ASE) harness with causal traceability (spec chain + D-CPG + RTM + phase guardrail)",
|
|
6
6
|
"main": "dist/holmes/mcp/server.js",
|
|
7
7
|
"types": "dist/holmes/mcp/server.d.ts",
|