@holmes-lab/holmes-kit 0.37.2 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/README.md +17 -2
- package/dist/.build-id +1 -1
- package/dist/holmes/cli/approve-status.js +2 -1
- package/dist/holmes/cli/approve.d.ts +1 -0
- package/dist/holmes/cli/approve.js +36 -4
- package/dist/holmes/cli/autonomy.d.ts +28 -0
- package/dist/holmes/cli/autonomy.js +62 -8
- package/dist/holmes/cli/doctor.js +12 -1
- package/dist/holmes/cli/index.js +64 -5
- package/dist/holmes/cli/mcp-processes.d.ts +32 -0
- package/dist/holmes/cli/mcp-processes.js +132 -0
- package/dist/holmes/cli/run-provision.d.ts +6 -0
- package/dist/holmes/cli/run-provision.js +114 -0
- package/dist/holmes/cli/run.d.ts +5 -0
- package/dist/holmes/cli/run.js +38 -6
- package/dist/holmes/cli/runtime-binding-approval.js +2 -3
- package/dist/holmes/governance/approval-queue.d.ts +12 -1
- package/dist/holmes/governance/approval-queue.js +23 -28
- package/dist/holmes/governance/autonomy.d.ts +3 -1
- package/dist/holmes/governance/autonomy.js +28 -2
- package/dist/holmes/governance/full-autonomy.d.ts +72 -0
- package/dist/holmes/governance/full-autonomy.js +308 -0
- package/dist/holmes/governance/tool-actions.js +2 -0
- package/dist/holmes/guardrail/operator-person.js +3 -2
- package/dist/holmes/guardrail/refusal-codes.js +19 -4
- package/dist/holmes/guardrail/risk-classifier.js +21 -3
- package/dist/holmes/guardrail/run-refusals.d.ts +6 -1
- package/dist/holmes/guardrail/run-refusals.js +19 -12
- package/dist/holmes/guardrail/run-stages.d.ts +5 -0
- package/dist/holmes/guardrail/run-stages.js +23 -3
- package/dist/holmes/guardrail/write-target.js +4 -1
- package/dist/holmes/hooks/pre-tool-use.d.ts +2 -0
- package/dist/holmes/hooks/pre-tool-use.js +88 -11
- package/dist/holmes/hooks/session-start.d.ts +5 -0
- package/dist/holmes/hooks/session-start.js +29 -1
- package/dist/holmes/hooks/stop.js +6 -4
- package/dist/holmes/mcp/elicit-approval.js +5 -6
- package/dist/holmes/mcp/handlers/approval-ask.d.ts +11 -0
- package/dist/holmes/mcp/handlers/approval-ask.js +18 -3
- package/dist/holmes/mcp/handlers/review-verdict.js +3 -2
- package/dist/holmes/mcp/handlers/spec-approval.d.ts +2 -0
- package/dist/holmes/mcp/handlers/spec-approval.js +23 -5
- package/dist/holmes/mcp/handlers/workspace-preflight.d.ts +5 -0
- package/dist/holmes/mcp/handlers/workspace-preflight.js +10 -2
- package/dist/holmes/mcp/handlers.d.ts +12 -0
- package/dist/holmes/mcp/handlers.js +25 -3
- package/dist/holmes/mcp/operator-recovery.d.ts +7 -2
- package/dist/holmes/mcp/operator-recovery.js +15 -58
- package/dist/holmes/mcp/server-staleness.d.ts +43 -0
- package/dist/holmes/mcp/server-staleness.js +158 -0
- package/dist/holmes/mcp/server.js +26 -2
- package/dist/holmes/mcp/tool-schemas.js +14 -1
- package/dist/holmes/project/workspace-preflight.d.ts +5 -0
- package/dist/holmes/project/workspace-preflight.js +24 -1
- package/dist/holmes/review/verdicts.d.ts +5 -0
- package/dist/holmes/review/verdicts.js +16 -1
- package/package.json +1 -1
- package/playbooks/promote-slice/PLAYBOOK.md +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,50 @@ 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.39.0] - 2026-10-23
|
|
11
|
+
|
|
12
|
+
Orchestration hardening, for the reference orchestrator's staged multi-agent runs (supervisor directive of 2026-10-23, items D1, D2, D4 and D11), plus the fixes G0 round 5 found before the SDLC comparison pilot.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **`run start --provision` (A-SPEC-774.29).** It makes a Claude Code worktree governed:
|
|
16
|
+
- **What it writes.** The worktree's `.mcp.json` holmes-kit entry and `.claude/settings.local.json` hooks, pinned to the CLI's own package. It writes only where `git check-ignore` says the path is ignored, so nothing it writes can be committed, and nothing is left behind when the worktree is removed.
|
|
17
|
+
- **No secret is copied.** It never writes `.claude/settings.json`.
|
|
18
|
+
- **Checks.** Run start's checks read `settings.local.json` too. The provision result is the first check and is recorded on the run.
|
|
19
|
+
- **Other engines.** Codex and Antigravity are refused by name.
|
|
20
|
+
- **A run's review policy (A-SPEC-102.10).**
|
|
21
|
+
- `run start --review-rounds <1-20>` records a cap on failing review rounds. Once the independent `fail` verdicts on the run's base reach it, a transition to a reviewed stage stops the run as `review.unresolved` and names the last round's findings, and every later tool call in the run is refused as stopped.
|
|
22
|
+
- `--strict-review` makes open important findings block, at transitions and at Stop.
|
|
23
|
+
- A run without either flag is judged as before.
|
|
24
|
+
- **`approval_withdraw` (A-SPEC-779.7).** A session withdraws a request its own MCP server filed. The request is recorded as withdrawn and leaves the operator's inbox. Another session's request is refused.
|
|
25
|
+
- **A stale MCP server says so (A-SPEC-251.4, 251.5).**
|
|
26
|
+
- Every object tool result carries `serverStale` once the installed package's version or build differs from what the server loaded.
|
|
27
|
+
- `workspace_preflight` gains an `mcp-build` check. Servers write a heartbeat.
|
|
28
|
+
- `doctor` (row `mcp server processes`) and the SessionStart banner name every running holmes-kit MCP server that started before its install was last written. That includes servers older than the self-check.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
- **A spec write the store could not read (A-SPEC-792.9).** A Write, Edit or MultiEdit that would leave a spec file unreadable to the store is now refused with the parse error (`spec.unreadable`, permanent). Before, a headless session could break a spec's frontmatter into a state only a person could repair, and that deadlocked a G0 run at Stop.
|
|
32
|
+
- **Interpreter environment reads (A-SPEC-163.9).** An interpreter command counts as an environment read only when `environ`, `environb` or `ENVIRON` stands as a whole identifier. `pytest tests/test_environment.py` and `import sphinx.environment` are no longer refused as dumps.
|
|
33
|
+
- **Refusals from a working directory inside `.ax` (A-SPEC-773.5).** A refusal judged over `.ax` only because the shell's working directory is inside `.ax` now says so, and names `cd <workspace root>` on its own as the way out.
|
|
34
|
+
- **SDLC evaluation arms are isolated (A-SPEC-791.8).** Every arm starts isolated from the operator's user settings and plugins (`--setting-sources project,local`, `--strict-mcp-config`), and the launch summary records the environment.
|
|
35
|
+
|
|
36
|
+
## [0.38.0] - 2026-10-22
|
|
37
|
+
|
|
38
|
+
Full autonomy mode, and no approval decided by a typed terminal command (REQ-792). Owner direction, 2026-10-22: "full, 100% self-driving mode must be supported", and "the lowest-grade approval UX — approving with a command in a terminal — must be zero".
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
- **Full autonomy profile (A-SPEC-792.3, 792.4, 792.5, 792.7).** `holmes-kit autonomy full --scope <dir>` issues one user-level profile (`~/.holmes/full-autonomy.json`). Issuing it is the person's act, decided once in the session's approval form, and an agent can never issue it. Inside the scope, no judgment waits for a person:
|
|
42
|
+
- **Spec seals.** A seal the grader hands to a person seals with actor `full-autonomy:`. Three rules are refused at once, each naming the step that needs no person: a REQ never admitted through triage, an undeclared `breaking_change`, and an unknown kind. The owner's `autonomy.ceiling` still binds.
|
|
43
|
+
- **Shell acts.** A workspace-local destructive git act (`reset --hard`, `clean -f`, `restore .`, `branch -D`) or an `rm -rf` inside the scope or the scratch root is approved only after a restorable recovery point is written under `refs/holmes/full/`. If that point cannot be written, the act is refused.
|
|
44
|
+
- **Everything else** — acts outside the scope, `cd` or `-C` elsewhere, secrets and environment reads, config, approval or ledger writes, and push or publish unless the profile allows them — is refused at once with a route. Nothing is queued, so a headless run never waits for a person. The refusal's `[holmes-refusal]` line names `full-autonomy.refused` (class `permanent`), so an orchestrator changes its plan instead of pausing for a person or calling `approval_ask` for a request that does not exist (A-SPEC-792.8).
|
|
45
|
+
- **Measured.** G0 round 5 ran 6 headless Holmes runs (Claude Code, Haiku) under one profile. It filed 0 approval requests, and no run waited.
|
|
46
|
+
- **Flags.** `--allow-push` and `--allow-publish` are off by default. `--no-architecture` keeps architecture documents with the owner.
|
|
47
|
+
- **Revoking.** `--revoke` needs no proof.
|
|
48
|
+
- **Visibility.** `autonomy status`, `doctor` and the session banner name an active profile.
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
- **No agent-facing text tells a person to type an approval command (A-SPEC-792.1).** Thirteen places named `approve --grant … --target …`: refusals, MCP recovery hints, approval_ask's own refusal, the run wait, refusal codes, form notices, Stop lines and the promote-slice playbook. Each now names `approval_ask` with the request id, and a static census pins zero. The `approve` CLI remains the operator's tool.
|
|
52
|
+
- **A shell grant lasts until it is used (A-SPEC-792.2).** It still covers only the exact command, in the workspace where it was minted, once. A command granted again after a spent grant gets a fresh nonce (`<id>.r<n>`) instead of a replay refusal.
|
|
53
|
+
|
|
10
54
|
## [0.37.2] - 2026-10-22
|
|
11
55
|
|
|
12
56
|
Three approval-UX fixes found by the SDLC comparison's feasibility gate (G0). In G0 round 1, headless Claude Code agents in Holmes workspaces filed 11 approval requests. One of them ended a run waiting for a person who was never coming, so the run changed no code. With these fixes, rounds 2 and 3 had no run blocked by an approval.
|
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
<!-- holmes-kit:attest:begin -->
|
|
10
10
|

|
|
11
11
|
|
|
12
|
-
**
|
|
13
|
-
Measured at `
|
|
12
|
+
**478/478** source files (100%) trace to an approved spec · **963/1040** approved A-SPECs (92.5%) are anchored from code.
|
|
13
|
+
Measured at `91233aabcdaf` (specs `sha256:c6a0ee346e19`) — reproduce with `holmes-kit attest --exclude docs/goals/probes/`.
|
|
14
14
|
<!-- holmes-kit:attest:end -->
|
|
15
15
|
|
|
16
16
|
---
|
|
@@ -22,6 +22,20 @@ Measured at `1d8fd9d2ab01` (specs `sha256:7cc2b555ea49`) — reproduce with `hol
|
|
|
22
22
|
---
|
|
23
23
|
|
|
24
24
|
### 🛡️ Currently Supported Features (Production Features)
|
|
25
|
+
- **An orchestrator's runs carry their own wiring and review policy** *(new in 0.39.0)*:
|
|
26
|
+
- **`run start --provision`** makes a Claude Code worktree governed. It writes the worktree's `.mcp.json` and `.claude/settings.local.json`, and only where git ignores them. They are pinned to the CLI's own build, no secret is copied, and nothing is left behind when the worktree is removed. Codex and Antigravity runs are refused by name for now.
|
|
27
|
+
- **`--review-rounds <1-20>`** stops a run as `review.unresolved` once its failing independent reviews reach the cap, and names the unresolved findings. **`--strict-review`** also blocks on open important findings, at transitions and at Stop.
|
|
28
|
+
- **`approval_withdraw`** lets a session withdraw a request its own MCP server filed. Another session's request is refused.
|
|
29
|
+
- **A stale MCP server says so.** A running server reports `serverStale` on every tool result once the install it loaded has changed. `workspace_preflight` checks its build, and `doctor` and the session banner name every holmes-kit server that started before the last upgrade.
|
|
30
|
+
- **Full autonomy mode — no judgment waits for a person, and no approval is typed in a terminal** *(new in 0.38.0)*:
|
|
31
|
+
- **Issuing.** `holmes-kit autonomy full --scope <dir>` issues a user-level profile. The person decides it once, in the session's approval form, and an agent can never issue it.
|
|
32
|
+
- **Inside the scope**, every judgment ends at once:
|
|
33
|
+
- A seal the grader hands to a person seals as `full-autonomy:`. An un-admitted REQ or an undeclared or unknown grade is refused, and the refusal names its fix.
|
|
34
|
+
- A workspace-local destructive git act, or an `rm -rf` inside the scope, passes after a restorable recovery point is written under `refs/holmes/full/`.
|
|
35
|
+
- Everything else is refused with a route and never queued: secrets, config, approval or ledger writes, acts outside the scope, and push or publish unless the profile allows them. A headless benchmark run never waits on a person.
|
|
36
|
+
- **Revoking.** `--revoke` ends the profile.
|
|
37
|
+
- **Typed commands are gone.** No refusal, hint, form or playbook names a typed `approve --grant` any more. The agent calls `approval_ask` with the id.
|
|
38
|
+
- **Shell grants** last until they are used.
|
|
25
39
|
- **Approvals happen in the session, not in a separate terminal** *(new in 0.37.0 — security fix, upgrade recommended)*: a refusal now ends with `Agent: call approval_ask with id "req-…"`. The MCP tool `approval_ask` shows that request in the harness's approval form, and the person's answer is recorded exactly as `holmes-kit approve` records it. That covers shell, config and code-write approvals (on Claude Code today; Codex and Antigravity are a named gap until measured) and a request a run awaits. `review_verdict` records an independent review verdict the same way. The form waits for the person (no 240-second limit). An agent's own shell, and the session's `!`, can no longer run `approve --grant`, `--watch` or `autonomy on`: through 0.36.1 an agent could approve its own refused command by running the command its refusal printed.
|
|
26
40
|
- **An orchestrator can run governed agents, and reviews become gates** *(new in 0.36.0)*: `holmes-kit run start --worktree <dir> --engine claude|codex|agy [--scope <A-SPEC>]…` opens a run that pins the CLI, MCP and hook builds, prints the headless command and a stop key, and ends only with that key (`run status`, `run transition`, `run stop`). Inside a run every judgement fails closed: agent launches are refused, refusals are logged with a repeat stop, an approval pauses the run until the operator decides it in a terminal, a declared stage machine (analysis → design → implement → review → test → done) denies writes per stage, and Stop and push wait for an independent passing review. `holmes-kit review record|status|gate|mrp` records verdicts bound to a commit range, refuses self-review (an agent-harness ancestor process included), and assembles the merge-ready package. Every deny ends with a `[holmes-refusal]` line carrying a stable code. A project can cap its semantic tier (`semantic.maxTier`) and its automatic approval (`autonomy.ceiling`) in `ax.config.json`, and only an approval can raise either. doctor counts cloud embedding requests. `approve --withdraw` lets a run close its own request. Interactive sessions keep 0.35.25 verdicts, except for the gate holes this release closes: path-less spec staging, computed shell writes, executable files and side paths under a role policy, and Claude Code's PowerShell tool on Windows. Interactive agent launches may carry the autonomy options measured to keep the child's Holmes gate. This is an interim release of the role/phase goal: the acceptance scenario with a reference orchestrator has not been run yet.
|
|
27
41
|
|
|
@@ -316,6 +330,7 @@ flowchart LR
|
|
|
316
330
|
| `holmes-kit doctor --target <root> --registry <bindings.json>` | Diagnose the same operator registry used by custom routing installations |
|
|
317
331
|
| `holmes-kit autonomy status` | Show the current autonomous-approval posture (project default + session envelope) |
|
|
318
332
|
| `holmes-kit autonomy on --for 2h` | Self-drive low-risk specs for this session only (expiring; needs a TTY or `HOLMES_APPROVAL`) |
|
|
333
|
+
| `holmes-kit autonomy full --scope <dir>` | Full autonomy inside `<dir>` (decided once in the session approval form): no judgment there waits for a person; `--allow-push`, `--allow-publish`, `--no-architecture`; `--revoke` ends it |
|
|
319
334
|
| `holmes-kit autonomy off` | End session autonomy immediately; if the project default in `.mcp.json` still keeps autonomy on, it says so and exits 1 instead of claiming OFF |
|
|
320
335
|
| `holmes-kit semantic-setup` | Download and verify the local `bge-m3` model (retry/recovery; shared across projects) |
|
|
321
336
|
| `holmes-kit semantic-check` | Verify local inference **offline**, without downloading anything |
|
package/dist/.build-id
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
b694c7d6-mvkb62p4
|
|
@@ -87,10 +87,11 @@ function statusContext(root, now = new Date().toISOString()) {
|
|
|
87
87
|
delegation = { mode: 'off' };
|
|
88
88
|
}
|
|
89
89
|
const liveGrants = new Set();
|
|
90
|
+
// @implements A-SPEC-792.2 — a re-grant's nonce is `<id>.r<n>`; it is live for request `<id>`.
|
|
90
91
|
try {
|
|
91
92
|
for (const g of (0, approval_grants_1.readGrants)(root).grants)
|
|
92
93
|
if (typeof g.nonce === 'string')
|
|
93
|
-
liveGrants.add(g.nonce);
|
|
94
|
+
liveGrants.add(g.nonce.replace(/\.r\d+$/, ''));
|
|
94
95
|
}
|
|
95
96
|
catch { /* no grants dir */ }
|
|
96
97
|
return { now, workspace, delegation, liveGrants };
|
|
@@ -48,6 +48,7 @@ export declare function denyRequest(root: string, id: string, reason: string, ac
|
|
|
48
48
|
export declare function withdrawRequest(root: string, id: string, reason: string, ctx: {
|
|
49
49
|
env: NodeJS.ProcessEnv;
|
|
50
50
|
cwd: string;
|
|
51
|
+
server?: string;
|
|
51
52
|
}): DecisionResult;
|
|
52
53
|
/** Hold with a question — approve/deny later. The agent carries the question to the user. */
|
|
53
54
|
export declare function holdRequest(root: string, id: string, question: string, actor: string): DecisionResult;
|
|
@@ -49,7 +49,7 @@ exports.decisionDetail = decisionDetail;
|
|
|
49
49
|
exports.renderRefusals = renderRefusals;
|
|
50
50
|
exports.renderNonTtyHint = renderNonTtyHint;
|
|
51
51
|
exports.runInteractive = runInteractive;
|
|
52
|
-
// @implements A-SPEC-246, A-SPEC-626, A-SPEC-532.5, A-SPEC-770.3, A-SPEC-770.6, A-SPEC-770.12, A-SPEC-779.2
|
|
52
|
+
// @implements A-SPEC-246, A-SPEC-626, A-SPEC-532.5, A-SPEC-770.3, A-SPEC-770.6, A-SPEC-770.12, A-SPEC-779.2, A-SPEC-792.2
|
|
53
53
|
// @implements A-SPEC-549.4 — renderPending and renderNonTtyHint in this file are the English CLI
|
|
54
54
|
// surface the Hangul-absence guard reads.
|
|
55
55
|
const execution_context_1 = require("../project/execution-context");
|
|
@@ -171,6 +171,21 @@ const TAMPERED = ['queue record is not self-consistent — id is not derived fro
|
|
|
171
171
|
function recordIsSelfConsistent(entry) {
|
|
172
172
|
return entry.id === (0, approval_queue_1.approvalRequestId)(entry.kind, entry.target);
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* @implements A-SPEC-792.2 — the request id is the nonce while it is unspent; a second decision for the same act takes
|
|
176
|
+
* `<id>.r<n>`, so it is not refused as a replay of the first (measured 2026-10-21/22: a spec `git add` granted twice).
|
|
177
|
+
* The suffix keeps the request id readable in the ledger and in `approve --status`.
|
|
178
|
+
*/
|
|
179
|
+
function freshNonce(root, id) {
|
|
180
|
+
const { FileLedgerStore } = require('../governance/ledger-store');
|
|
181
|
+
const ledger = new FileLedgerStore(path.join(root, '.ax', 'ledger'));
|
|
182
|
+
if (!ledger.isNonceConsumed(id))
|
|
183
|
+
return id;
|
|
184
|
+
for (let n = 1; n <= 1000; n++)
|
|
185
|
+
if (!ledger.isNonceConsumed(`${id}.r${n}`))
|
|
186
|
+
return `${id}.r${n}`;
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
174
189
|
function grantRequest(root, id, opts) {
|
|
175
190
|
const ttl = opts.ttlMinutes ?? exports.DEFAULT_TTL_MINUTES;
|
|
176
191
|
if (typeof ttl !== 'number' || !Number.isFinite(ttl) || !Number.isInteger(ttl) || ttl <= 0 || ttl > MAX_TTL_MINUTES) {
|
|
@@ -181,7 +196,10 @@ function grantRequest(root, id, opts) {
|
|
|
181
196
|
// expire by time; it ends when it is used, revoked, or the content changes (the subject no longer matches). Measured
|
|
182
197
|
// 2026-10-04: five seal grants expired unused after 30 minutes. An explicit --ttl still bounds it; a request without
|
|
183
198
|
// a subject keeps the default, because there the clock is all that stands between the decision and a changed act.
|
|
184
|
-
|
|
199
|
+
// @implements A-SPEC-792.2 — a shell grant's scope is the exact command text, so a different act already has a
|
|
200
|
+
// different id: the clock only re-asked the person about the identical act (field report 2026-10-22).
|
|
201
|
+
const untilUsed = opts.ttlMinutes === undefined
|
|
202
|
+
&& ((typeof entry?.subject === 'string' && entry.subject !== '') || entry?.kind === 'shell');
|
|
185
203
|
if (!entry)
|
|
186
204
|
return { ok: false, reason: `no pending request ${(0, screen_safe_1.rowField)(id, 40)} — check with ${(0, npx_bin_1.holmesKitCommand)(root)} approve --list` };
|
|
187
205
|
if (!recordIsSelfConsistent(entry))
|
|
@@ -192,6 +210,9 @@ function grantRequest(root, id, opts) {
|
|
|
192
210
|
// second guard is not defence in depth, it is a line nobody can prove still works (round-3
|
|
193
211
|
// mutation test: neutering it left the suite green).
|
|
194
212
|
const expires = untilUsed ? approval_grants_1.GRANT_NO_EXPIRY : new Date(Date.now() + ttl * 60_000).toISOString();
|
|
213
|
+
const nonce = freshNonce(root, id);
|
|
214
|
+
if (nonce === null)
|
|
215
|
+
return { ok: false, reason: `request ${(0, screen_safe_1.rowField)(id, 40)} has been granted and spent too many times — file a new request` };
|
|
195
216
|
// @implements A-SPEC-649 — the grant names WHERE it was minted and WHAT the operator read, so a
|
|
196
217
|
// copy in another clone and a seal of changed content are refused by name (measured 2026-09-14:
|
|
197
218
|
// both were accepted). A legacy workspace has no id to name; a request filed without a subject
|
|
@@ -222,7 +243,7 @@ function grantRequest(root, id, opts) {
|
|
|
222
243
|
expires,
|
|
223
244
|
// Stated, never implied by a missing field: a file that merely lacks an expiry is not a grant (isNarrow).
|
|
224
245
|
...(untilUsed ? { lifetime: 'until-used' } : {}),
|
|
225
|
-
nonce
|
|
246
|
+
nonce,
|
|
226
247
|
};
|
|
227
248
|
// @implements A-SPEC-262.1 — AUDIT AND AUTHORITY STAND OR FALL TOGETHER.
|
|
228
249
|
// Round-3 wrote the grant first and discarded the append's failure: a live nonce with no record.
|
|
@@ -327,10 +348,21 @@ function withdrawRequest(root, id, reason, ctx) {
|
|
|
327
348
|
return { ok: false, reason: `no pending request ${(0, screen_safe_1.rowField)(id, 40)}` };
|
|
328
349
|
if (!recordIsSelfConsistent(entry))
|
|
329
350
|
return { ok: false, reason: TAMPERED };
|
|
351
|
+
// @implements A-SPEC-779.7 — the MCP server instance that filed a request withdraws it: an interactive session's
|
|
352
|
+
// request otherwise had no requester, and the operator approved nine abandoned ones (2026-10-23).
|
|
353
|
+
if (entry.requesterServer !== undefined) {
|
|
354
|
+
if (ctx.server !== entry.requesterServer) {
|
|
355
|
+
return { ok: false, reason: `only the session whose MCP server filed ${(0, screen_safe_1.rowField)(id, 40)} withdraws it: filed by server ${(0, screen_safe_1.rowField)(entry.requesterServer, 60)}; this is ${ctx.server ? `server ${(0, screen_safe_1.rowField)(ctx.server, 60)}` : 'not that server'}` };
|
|
356
|
+
}
|
|
357
|
+
if (!appendEvent(root, { event: 'withdrawn', id, reason: reason.trim(), server: ctx.server, covered: entry.count })) {
|
|
358
|
+
return { ok: false, reason: 'could not write the withdrawal record (queue event) — check write permission on .ax/approvals. Nothing was recorded' };
|
|
359
|
+
}
|
|
360
|
+
return { ok: true };
|
|
361
|
+
}
|
|
330
362
|
const { runMode } = require('../governance/run-mode');
|
|
331
363
|
const here = runMode(ctx.env, root, ctx.cwd).id;
|
|
332
364
|
if (entry.requesterRun === undefined) {
|
|
333
|
-
return { ok: false, reason: `${(0, screen_safe_1.rowField)(id, 40)} was filed outside a run, so no requester can withdraw it — the operator denies it` };
|
|
365
|
+
return { ok: false, reason: `${(0, screen_safe_1.rowField)(id, 40)} was filed outside a run and outside an MCP server, so no requester can withdraw it — the operator denies it` };
|
|
334
366
|
}
|
|
335
367
|
if (here !== entry.requesterRun) {
|
|
336
368
|
return { ok: false, reason: `only the run that filed ${(0, screen_safe_1.rowField)(id, 40)} withdraws it: filed by run ${(0, screen_safe_1.rowField)(entry.requesterRun, 60)}; this is ${here ? `run ${(0, screen_safe_1.rowField)(here, 60)}` : 'not a run'}` };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FullProfileFlags } from '../governance/full-autonomy';
|
|
1
2
|
import { Approval } from '../guardrail/risk-gate';
|
|
2
3
|
/** `--for` accepts `2h` / `90m` / `7d` / a bare number of hours. Minutes, capped at 7 days (like grants);
|
|
3
4
|
* null on a malformed value; default 2h when omitted. */
|
|
@@ -7,6 +8,10 @@ export interface AutonomyIO {
|
|
|
7
8
|
isTTY: boolean;
|
|
8
9
|
approval?: Approval;
|
|
9
10
|
env?: NodeJS.ProcessEnv;
|
|
11
|
+
/** @implements A-SPEC-792.7 — the home whose full autonomy profile `status` reports (default os.homedir()). */
|
|
12
|
+
home?: string;
|
|
13
|
+
/** Internal: `status` without the full-profile line (the posture line it is followed by). */
|
|
14
|
+
postureOnly?: boolean;
|
|
10
15
|
}
|
|
11
16
|
/** @implements A-SPEC-771 — the delegation subcommand's own inputs, parsed by the CLI entry and passed through. */
|
|
12
17
|
export interface AutonomyExtra {
|
|
@@ -62,6 +67,29 @@ export declare function autonomyGrantGate(input: {
|
|
|
62
67
|
now: string;
|
|
63
68
|
envApproval?: Approval;
|
|
64
69
|
}, deps: AutonomyGrantDeps): AutonomyGrantVerdict;
|
|
70
|
+
/** @implements A-SPEC-792.3 — the flags are the request's subject, so a grant for one set cannot issue another. */
|
|
71
|
+
export declare function fullProfileSubject(flags: FullProfileFlags): string;
|
|
72
|
+
/**
|
|
73
|
+
* @implements A-SPEC-792.3 — may `autonomy full --scope` write the entry? The same order as `autonomyGrantGate`
|
|
74
|
+
* (A-SPEC-718.7): a covering approval (the session form's grant), a person's own terminal, otherwise a request the
|
|
75
|
+
* session form decides. The scope's real path is the target, so the request names exactly what it would open.
|
|
76
|
+
*/
|
|
77
|
+
export declare function fullProfileGate(input: {
|
|
78
|
+
scope: string;
|
|
79
|
+
askRoot: string;
|
|
80
|
+
flags: FullProfileFlags;
|
|
81
|
+
now: string;
|
|
82
|
+
envApproval?: Approval;
|
|
83
|
+
}, deps: AutonomyGrantDeps): AutonomyGrantVerdict;
|
|
84
|
+
/** @implements A-SPEC-792.3 — write or revoke an entry once the gate (issue) has passed; revoking needs no proof. */
|
|
85
|
+
export declare function runAutonomyFull(home: string, args: {
|
|
86
|
+
scope: string;
|
|
87
|
+
flags?: FullProfileFlags;
|
|
88
|
+
revoke: boolean;
|
|
89
|
+
}, io: {
|
|
90
|
+
now: string;
|
|
91
|
+
actor: string;
|
|
92
|
+
}): AutonomyResult;
|
|
65
93
|
/** @implements A-SPEC-718.7 — the posture `autonomy status` reports, never coloured by the caller's own environment. */
|
|
66
94
|
export declare function autonomyPostureLine(root: string, now: string): string;
|
|
67
95
|
/**
|
|
@@ -35,13 +35,18 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.parseForMinutes = parseForMinutes;
|
|
37
37
|
exports.autonomyGrantGate = autonomyGrantGate;
|
|
38
|
+
exports.fullProfileSubject = fullProfileSubject;
|
|
39
|
+
exports.fullProfileGate = fullProfileGate;
|
|
40
|
+
exports.runAutonomyFull = runAutonomyFull;
|
|
38
41
|
exports.autonomyPostureLine = autonomyPostureLine;
|
|
39
42
|
exports.runAutonomy = runAutonomy;
|
|
40
|
-
// @implements A-SPEC-553.1, A-SPEC-553.2, A-SPEC-771, A-SPEC-718.7
|
|
43
|
+
// @implements A-SPEC-553.1, A-SPEC-553.2, A-SPEC-771, A-SPEC-718.7, A-SPEC-792.3, A-SPEC-792.7
|
|
41
44
|
const fs = __importStar(require("node:fs"));
|
|
45
|
+
const full_autonomy_1 = require("../governance/full-autonomy");
|
|
46
|
+
const autonomy_1 = require("../governance/autonomy");
|
|
42
47
|
const path = __importStar(require("node:path"));
|
|
43
48
|
const risk_gate_1 = require("../guardrail/risk-gate");
|
|
44
|
-
const
|
|
49
|
+
const autonomy_2 = require("../governance/autonomy");
|
|
45
50
|
const delegation_1 = require("../governance/delegation");
|
|
46
51
|
const PROJECT_DEFAULT_ON = 'autonomous spec approval: ON (project default, .mcp.json) — governance-critical still ask you. '
|
|
47
52
|
+ 'Turn it off by removing HOLMES_AUTONOMOUS_APPROVAL from .mcp.json (or holmes-kit init --no-autonomy).';
|
|
@@ -112,6 +117,49 @@ function autonomyGrantGate(input, deps) {
|
|
|
112
117
|
const id = (0, approval_queue_1.approvalRequestId)(action.kind, action.target);
|
|
113
118
|
return { proceed: false, id, message: `${why}${(0, approval_queue_1.pendingRequestLine)(id, action.kind, input.askRoot, title, input.root)}` };
|
|
114
119
|
}
|
|
120
|
+
/** @implements A-SPEC-792.3 — the flags are the request's subject, so a grant for one set cannot issue another. */
|
|
121
|
+
function fullProfileSubject(flags) {
|
|
122
|
+
return `push=${flags.push ? 1 : 0};publish=${flags.publish ? 1 : 0};architecture=${flags.architecture ? 1 : 0}`;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* @implements A-SPEC-792.3 — may `autonomy full --scope` write the entry? The same order as `autonomyGrantGate`
|
|
126
|
+
* (A-SPEC-718.7): a covering approval (the session form's grant), a person's own terminal, otherwise a request the
|
|
127
|
+
* session form decides. The scope's real path is the target, so the request names exactly what it would open.
|
|
128
|
+
*/
|
|
129
|
+
function fullProfileGate(input, deps) {
|
|
130
|
+
const action = { kind: 'autonomy-profile', target: input.scope, subject: fullProfileSubject(input.flags) };
|
|
131
|
+
const covering = deps.resolve(input.askRoot, input.envApproval, action, input.now);
|
|
132
|
+
if (covering !== undefined) {
|
|
133
|
+
const nonce = covering.approval.nonce;
|
|
134
|
+
return { proceed: true, approval: covering.approval, ...(covering.source === 'grant' && typeof nonce === 'string' ? { spend: nonce } : {}) };
|
|
135
|
+
}
|
|
136
|
+
const why = deps.guard();
|
|
137
|
+
if (why === null)
|
|
138
|
+
return { proceed: true };
|
|
139
|
+
const title = `full autonomy for ${input.scope} (${action.subject})`;
|
|
140
|
+
deps.enqueue(input.askRoot, { ...action, why: `no judgment under ${input.scope} waits for a person (${action.subject})`, title });
|
|
141
|
+
const id = (0, approval_queue_1.approvalRequestId)(action.kind, action.target);
|
|
142
|
+
return { proceed: false, id, message: `${why}${(0, approval_queue_1.pendingRequestLine)(id, action.kind, input.askRoot, title, input.scope)}` };
|
|
143
|
+
}
|
|
144
|
+
/** @implements A-SPEC-792.3 — write or revoke an entry once the gate (issue) has passed; revoking needs no proof. */
|
|
145
|
+
function runAutonomyFull(home, args, io) {
|
|
146
|
+
if (args.revoke) {
|
|
147
|
+
const n = (0, full_autonomy_1.removeFullProfileEntry)(home, args.scope === '' ? undefined : args.scope);
|
|
148
|
+
return { ok: true, exitCode: 0, message: n > 0 ? `full autonomy revoked (${n} scope${n === 1 ? '' : 's'})` : 'full autonomy: nothing to revoke' };
|
|
149
|
+
}
|
|
150
|
+
let scope;
|
|
151
|
+
try {
|
|
152
|
+
scope = fs.realpathSync.native(args.scope);
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return { ok: false, exitCode: 2, message: `--scope ${args.scope} does not exist` };
|
|
156
|
+
}
|
|
157
|
+
if (!fs.statSync(scope).isDirectory())
|
|
158
|
+
return { ok: false, exitCode: 2, message: `--scope ${args.scope} is not a directory` };
|
|
159
|
+
const flags = args.flags ?? { push: false, publish: false, architecture: true };
|
|
160
|
+
(0, full_autonomy_1.addFullProfileEntry)(home, { scope, flags, issuedAt: io.now, issuedBy: io.actor });
|
|
161
|
+
return { ok: true, exitCode: 0, message: `full autonomy: ON for ${scope} (${fullProfileSubject(flags)}) — no judgment there waits for a person` };
|
|
162
|
+
}
|
|
115
163
|
/** @implements A-SPEC-718.7 — the posture `autonomy status` reports, never coloured by the caller's own environment. */
|
|
116
164
|
function autonomyPostureLine(root, now) {
|
|
117
165
|
return runAutonomy(root, 'status', undefined, { now, isTTY: false, env: {} }).message;
|
|
@@ -124,20 +172,26 @@ function autonomyPostureLine(root, now) {
|
|
|
124
172
|
*/
|
|
125
173
|
function runAutonomy(root, sub, forStr, io, extra = {}) {
|
|
126
174
|
const env = io.env ?? process.env;
|
|
127
|
-
const markerPath = path.join(root, ...
|
|
175
|
+
const markerPath = path.join(root, ...autonomy_2.SESSION_AUTONOMY_MARKER);
|
|
128
176
|
if (sub === undefined || sub === 'status') {
|
|
177
|
+
// @implements A-SPEC-792.7 — an active full profile is named first; the posture line follows unchanged.
|
|
178
|
+
const full = io.postureOnly ? '' : (0, autonomy_1.fullAutonomyLine)(root, io.home);
|
|
179
|
+
if (full !== '') {
|
|
180
|
+
const rest = runAutonomy(root, sub, forStr, { ...io, postureOnly: true }, extra);
|
|
181
|
+
return { ...rest, message: `${full}\n${rest.message}` };
|
|
182
|
+
}
|
|
129
183
|
// @implements A-SPEC-771 — an active run delegation is reported beside whichever posture is on.
|
|
130
184
|
const delegationLine = delegationStatusLine(root, io.now);
|
|
131
185
|
const withDelegation = (message) => delegationLine === null ? message : `${message}\n${delegationLine}`;
|
|
132
|
-
const envOn = typeof env[
|
|
186
|
+
const envOn = typeof env[autonomy_2.AUTONOMY_ENV] === 'string' && env[autonomy_2.AUTONOMY_ENV] !== '';
|
|
133
187
|
if (envOn)
|
|
134
188
|
return { ok: true, exitCode: 0, message: withDelegation('autonomous spec approval: ON (project default, .mcp.json) — governance-critical still ask you') };
|
|
135
189
|
// @implements A-SPEC-553.2 — the same project default the server and the session banner read
|
|
136
190
|
// (A-SPEC-560.2). The CLI read only the shell environment, which never carries .mcp.json's env, and
|
|
137
191
|
// answered OFF while the server sealed specs autonomously.
|
|
138
|
-
if ((0,
|
|
192
|
+
if ((0, autonomy_2.projectDefaultAutonomy)(root))
|
|
139
193
|
return { ok: true, exitCode: 0, message: withDelegation(PROJECT_DEFAULT_ON) };
|
|
140
|
-
if ((0,
|
|
194
|
+
if ((0, autonomy_2.sessionAutonomyActive)(root, io.now)) {
|
|
141
195
|
let expires = '';
|
|
142
196
|
try {
|
|
143
197
|
expires = String(JSON.parse(fs.readFileSync(markerPath, 'utf8')).expires);
|
|
@@ -186,8 +240,8 @@ function runAutonomy(root, sub, forStr, io, extra = {}) {
|
|
|
186
240
|
}
|
|
187
241
|
// @implements A-SPEC-553.2 — the emergency control never reports a de-escalation that did not happen
|
|
188
242
|
// (A-SPEC-558.1): with the project default (or the environment switch) still on, autonomy is still ON.
|
|
189
|
-
const envStillOn = typeof env[
|
|
190
|
-
if (envStillOn || (0,
|
|
243
|
+
const envStillOn = typeof env[autonomy_2.AUTONOMY_ENV] === 'string' && env[autonomy_2.AUTONOMY_ENV] !== '';
|
|
244
|
+
if (envStillOn || (0, autonomy_2.projectDefaultAutonomy)(root)) {
|
|
191
245
|
return { ok: false, exitCode: 1, message: 'session autonomy ended, but autonomous spec approval is still ON: the project default in .mcp.json '
|
|
192
246
|
+ '(HOLMES_AUTONOMOUS_APPROVAL) keeps it on — remove it from .mcp.json (or holmes-kit init --no-autonomy) to turn it off.' };
|
|
193
247
|
}
|
|
@@ -75,7 +75,7 @@ exports.wiringHandshakeChecks = wiringHandshakeChecks;
|
|
|
75
75
|
exports.semanticCoverageCheck = semanticCoverageCheck;
|
|
76
76
|
exports.semanticTierVerdict = semanticTierVerdict;
|
|
77
77
|
exports.detectTreeKeyTemporary = detectTreeKeyTemporary;
|
|
78
|
-
// @implements A-SPEC-476.1, A-SPEC-476.5, A-SPEC-751.4, A-SPEC-751.9, A-SPEC-770.3, A-SPEC-770.6, A-SPEC-770.7, A-SPEC-770.9, A-SPEC-770.10,A-SPEC-733,A-SPEC-727, A-SPEC-774.22, A-SPEC-781.2, A-SPEC-182.3, A-SPEC-182.4,A-SPEC-721, A-SPEC-738, A-SPEC-734, A-SPEC-751, A-SPEC-751.2, A-SPEC-772.1, A-SPEC-772.5, A-SPEC-772.6, A-SPEC-772.7, A-SPEC-772.8, A-SPEC-772.9, A-SPEC-772.10, A-SPEC-772.11
|
|
78
|
+
// @implements A-SPEC-251.5, A-SPEC-476.1, A-SPEC-476.5, A-SPEC-751.4, A-SPEC-751.9, A-SPEC-770.3, A-SPEC-770.6, A-SPEC-770.7, A-SPEC-770.9, A-SPEC-770.10,A-SPEC-733,A-SPEC-727, A-SPEC-774.22, A-SPEC-781.2, A-SPEC-182.3, A-SPEC-182.4,A-SPEC-721, A-SPEC-738, A-SPEC-734, A-SPEC-751, A-SPEC-751.2, A-SPEC-772.1, A-SPEC-772.5, A-SPEC-772.6, A-SPEC-772.7, A-SPEC-772.8, A-SPEC-772.9, A-SPEC-772.10, A-SPEC-772.11
|
|
79
79
|
// @implements A-SPEC-704, A-SPEC-710, A-SPEC-712, A-SPEC-769.14, A-SPEC-769.16, A-SPEC-769.17, A-SPEC-769.18, A-SPEC-769.19, A-SPEC-769.20, A-SPEC-769.21
|
|
80
80
|
const doctor_guidance_1 = require("./doctor-guidance");
|
|
81
81
|
// @implements A-SPEC-264, A-SPEC-423, A-SPEC-549.1, A-SPEC-590
|
|
@@ -1573,6 +1573,17 @@ async function runDoctor(packageRoot, target, opts, extraChecks) {
|
|
|
1573
1573
|
}
|
|
1574
1574
|
}
|
|
1575
1575
|
catch { /* .mcp.json absent or unparseable -> proceed without this check */ }
|
|
1576
|
+
// @implements A-SPEC-251.5 — the wiring can match while a running server still serves an older install: list every
|
|
1577
|
+
// holmes-kit MCP server process that started before its package was installed (read-only; ending them is the operator's).
|
|
1578
|
+
try {
|
|
1579
|
+
const { listProcessRows, staleMcpServers, readPackageInstall, mcpProcessesRow } = require('./mcp-processes');
|
|
1580
|
+
const rows = listProcessRows();
|
|
1581
|
+
const r = mcpProcessesRow(rows === null ? null : staleMcpServers(rows, readPackageInstall));
|
|
1582
|
+
// doctor has no INFO level: an unavailable scan adds no row, as an undecidable check never does here.
|
|
1583
|
+
if (r.level !== 'INFO')
|
|
1584
|
+
add(r.name, r.level, r.detail);
|
|
1585
|
+
}
|
|
1586
|
+
catch { /* the scan is diagnostic only */ }
|
|
1576
1587
|
// @implements A-SPEC-259 — the wiring is judged by SPAWNING it. String comparison is exactly how
|
|
1577
1588
|
// the dead `npx -y <pkg>@<ver> holmes-mcp` form (npx resolves the default bin and hands
|
|
1578
1589
|
// `holmes-mcp` to it as an argument) passed the launcher test, this doctor's own handshake check
|
package/dist/holmes/cli/index.js
CHANGED
|
@@ -37,7 +37,7 @@ exports.isBrokenPipe = void 0;
|
|
|
37
37
|
exports.packageRoot = packageRoot;
|
|
38
38
|
exports.main = main;
|
|
39
39
|
exports.installPipeGuard = installPipeGuard;
|
|
40
|
-
// @implements A-SPEC-704, A-SPEC-773, A-SPEC-770.11,A-SPEC-709, A-SPEC-734,A-SPEC-751, A-SPEC-752, A-SPEC-772.4, A-SPEC-779, A-SPEC-102.2, A-SPEC-774.20, A-SPEC-102.7, A-SPEC-779.2
|
|
40
|
+
// @implements A-SPEC-704, A-SPEC-773, A-SPEC-770.11,A-SPEC-709, A-SPEC-734,A-SPEC-751, A-SPEC-752, A-SPEC-772.4, A-SPEC-779, A-SPEC-102.2, A-SPEC-774.20, A-SPEC-102.7, A-SPEC-779.2, A-SPEC-792.3, A-SPEC-102.10
|
|
41
41
|
// @implements A-SPEC-549.2
|
|
42
42
|
// @implements A-SPEC-591, A-SPEC-626
|
|
43
43
|
const cli_execution_1 = require("./cli-execution");
|
|
@@ -81,7 +81,7 @@ const KNOWN_FLAGS = {
|
|
|
81
81
|
'runtime-binding': ['help', 'workspace', 'package', 'release-package', 'registry', 'dry-run', 'activate-hooks'],
|
|
82
82
|
guidance: ['help', 'target', 'dry-run'],
|
|
83
83
|
init: ['help', 'target', 'mode', 'specs-dir', 'settings', 'matcher', 'dry-run', 'no-mcp', 'remove', 'force', 'agent', 'mcp-launcher', 'autonomy', 'no-autonomy'],
|
|
84
|
-
autonomy: ['help', 'target', 'for', 'run', 'allow', 'limit', 'rationale'], // @implements A-SPEC-771.1 — the run delegation's flags
|
|
84
|
+
autonomy: ['help', 'target', 'for', 'run', 'allow', 'limit', 'rationale', 'scope', 'revoke', 'allow-push', 'allow-publish', 'no-architecture'], // @implements A-SPEC-771.1 — the run delegation's flags; A-SPEC-792.3 — the full profile's
|
|
85
85
|
doctor: ['help', 'target', 'json', 'agent', 'registry'],
|
|
86
86
|
// @implements A-SPEC-702 — a statement, not a gate: how many source files trace to an approved spec.
|
|
87
87
|
attest: ['help', 'target', 'exclude', 'json', 'badge', 'readme'],
|
|
@@ -89,7 +89,7 @@ const KNOWN_FLAGS = {
|
|
|
89
89
|
scratch: ['help', 'new'],
|
|
90
90
|
// @implements A-SPEC-774.10 — the role policy rewritten into the new vocabulary with equal verdicts.
|
|
91
91
|
roles: ['help', 'target', 'dry-run'],
|
|
92
|
-
run: ['help', 'target', 'worktree', 'engine', 'engine-arg', 'id', 'key', 'scope', 'to', 'why', 'accept-unknown-versions'], // @implements A-SPEC-774.17, A-SPEC-102.5, A-SPEC-781, A-SPEC-774.20
|
|
92
|
+
run: ['help', 'target', 'worktree', 'engine', 'engine-arg', 'id', 'key', 'scope', 'to', 'why', 'accept-unknown-versions', 'provision', 'review-rounds', 'strict-review'], // @implements A-SPEC-774.17, A-SPEC-102.5, A-SPEC-781, A-SPEC-774.20, A-SPEC-774.29, A-SPEC-102.10
|
|
93
93
|
review: ['help', 'target', 'base', 'head', 'verdict', 'finding', 'engine', 'model', 'session', 'strict', 'solid'], // @implements A-SPEC-102.2, A-SPEC-102.7
|
|
94
94
|
skills: ['help', 'target'],
|
|
95
95
|
ci: ['help', 'target', 'specs-dir', 'json'],
|
|
@@ -136,7 +136,7 @@ class UnknownFlagError extends Error {
|
|
|
136
136
|
// A-SPEC-251.1 (round 26): `yes` — `upgrade --yes` was refused as "--yes requires a value", so the non-interactive
|
|
137
137
|
// upgrade its own guidance names could not run (measured).
|
|
138
138
|
// A-SPEC-774.24: --accept-unknown-versions names its fields, so it is a value flag, not one of these.
|
|
139
|
-
const BOOLEAN_FLAGS = new Set(['badge', 'readme', 'help', 'dry-run', 'no-mcp', 'remove', 'force', 'json', 'list', 'status', 'watch', 'autonomy', 'no-autonomy', 'yes']); // A-SPEC-650: --status
|
|
139
|
+
const BOOLEAN_FLAGS = new Set(['badge', 'readme', 'help', 'dry-run', 'no-mcp', 'remove', 'force', 'json', 'list', 'status', 'watch', 'autonomy', 'no-autonomy', 'yes', 'allow-push', 'allow-publish', 'no-architecture', 'provision', 'strict-review']); // `--revoke` stays a value flag: `approve --revoke <id>` // A-SPEC-650: --status
|
|
140
140
|
/** @implements A-SPEC-770.11 — value flags whose value may be omitted; the handler supplies the default. */
|
|
141
141
|
const OPTIONAL_VALUE_FLAGS = new Set(['refusals']);
|
|
142
142
|
/** @implements A-SPEC-771.1 — value flags that may be given more than once. */
|
|
@@ -371,7 +371,7 @@ async function main(argv) {
|
|
|
371
371
|
// silently wrote into CWD while the named target stayed stale (round-3 HIGH).
|
|
372
372
|
const expected = cmd === 'runtime-binding' ? ['setup', 'status', 'remove'] : cmd === 'guidance' ? ['check', 'refresh'] : cmd === 'skills' ? ['refresh'] : cmd === 'ledger' ? ['rechain']
|
|
373
373
|
: cmd === 'semantic-key' ? ['set', 'unset', 'status']
|
|
374
|
-
: cmd === 'autonomy' ? ['status', 'on', 'off', 'delegate', 'revoke-delegation'] // @implements A-SPEC-771.1
|
|
374
|
+
: cmd === 'autonomy' ? ['status', 'on', 'off', 'delegate', 'revoke-delegation', 'full'] // @implements A-SPEC-771.1, A-SPEC-792.3
|
|
375
375
|
: cmd === 'roles' ? ['migrate'] // @implements A-SPEC-774.10
|
|
376
376
|
: cmd === 'run' ? ['start', 'status', 'stop', 'transition'] // @implements A-SPEC-774.17, A-SPEC-781
|
|
377
377
|
: cmd === 'review' ? ['record', 'status', 'gate', 'mrp'] : []; // @implements A-SPEC-102.2, A-SPEC-102.6
|
|
@@ -481,6 +481,61 @@ async function main(argv) {
|
|
|
481
481
|
let effective = approval;
|
|
482
482
|
let spend;
|
|
483
483
|
const minutes = sub === 'on' ? parseForMinutes(forStr) : null;
|
|
484
|
+
if (sub === 'full') {
|
|
485
|
+
// @implements A-SPEC-792.3 — the full profile: issued through the session form (the autonomyGrantGate order),
|
|
486
|
+
// revoked freely. It is user-level, so the home directory holds it, whatever workspace asked.
|
|
487
|
+
const { fullProfileGate, runAutonomyFull } = require('./autonomy');
|
|
488
|
+
const os4 = require('node:os');
|
|
489
|
+
const home = os4.homedir();
|
|
490
|
+
const rawScope = str('scope');
|
|
491
|
+
const scopeArg = rawScope === undefined ? '' : rawScope.replace(/^~(?=$|\/)/, home);
|
|
492
|
+
// `--revoke` alone, `--revoke <scope>` or `--revoke --scope <scope>` (it is a value flag shared with approve).
|
|
493
|
+
if (flags.revoke !== undefined) {
|
|
494
|
+
const revokeScope = typeof flags.revoke === 'string' ? flags.revoke.replace(/^~(?=$|\/)/, home) : scopeArg;
|
|
495
|
+
const r = runAutonomyFull(home, { scope: revokeScope, revoke: true }, { now, actor: approval?.actor ?? 'operator' });
|
|
496
|
+
process[r.ok ? 'stdout' : 'stderr'].write(`${r.message}\n`);
|
|
497
|
+
return r.exitCode;
|
|
498
|
+
}
|
|
499
|
+
if (scopeArg === '') {
|
|
500
|
+
process.stderr.write('autonomy full needs --scope <path> (or --revoke)\n');
|
|
501
|
+
return 2;
|
|
502
|
+
}
|
|
503
|
+
let scope;
|
|
504
|
+
try {
|
|
505
|
+
scope = fs.realpathSync.native(scopeArg);
|
|
506
|
+
}
|
|
507
|
+
catch {
|
|
508
|
+
process.stderr.write(`--scope ${scopeArg} does not exist\n`);
|
|
509
|
+
return 2;
|
|
510
|
+
}
|
|
511
|
+
const fullFlags = { push: flags['allow-push'] === true, publish: flags['allow-publish'] === true, architecture: flags['no-architecture'] !== true };
|
|
512
|
+
const { resolveApproval } = require('../governance/approval-grants');
|
|
513
|
+
const { enqueueApprovalRequest } = require('../governance/approval-queue');
|
|
514
|
+
const { resolveProjectRoot } = require('../project/root');
|
|
515
|
+
let askRoot = root;
|
|
516
|
+
try {
|
|
517
|
+
const p = resolveProjectRoot(process.cwd());
|
|
518
|
+
if (p.marker === '.ax')
|
|
519
|
+
askRoot = p.root;
|
|
520
|
+
}
|
|
521
|
+
catch { /* the target's own project */ }
|
|
522
|
+
const v = fullProfileGate({ scope, askRoot, flags: fullFlags, now, envApproval: approval }, {
|
|
523
|
+
guard: () => operatorActGuard('issuing a full autonomy profile'),
|
|
524
|
+
resolve: (r, env, action, n) => resolveApproval(r, env, action, n),
|
|
525
|
+
enqueue: (r, req) => { enqueueApprovalRequest(r, req); },
|
|
526
|
+
});
|
|
527
|
+
if (!v.proceed) {
|
|
528
|
+
process.stderr.write(`${withRefusalLine(v.message)}\n`);
|
|
529
|
+
return 2;
|
|
530
|
+
}
|
|
531
|
+
const r = runAutonomyFull(home, { scope, flags: fullFlags, revoke: false }, { now, actor: v.approval?.actor ?? 'operator' });
|
|
532
|
+
if (r.ok && v.spend !== undefined) {
|
|
533
|
+
const { consumeGrantFile } = require('../governance/approval-grants');
|
|
534
|
+
consumeGrantFile(askRoot, v.spend);
|
|
535
|
+
}
|
|
536
|
+
process[r.ok ? 'stdout' : 'stderr'].write(`${r.message}\n`);
|
|
537
|
+
return r.exitCode;
|
|
538
|
+
}
|
|
484
539
|
if (sub === 'on' && minutes !== null) {
|
|
485
540
|
// @implements A-SPEC-718.7 — the person grants it in the session form: a refused `on` files an autonomy-grant
|
|
486
541
|
// request in the asking session's project (where approval_ask finds it), and the retry spends the grant.
|
|
@@ -577,6 +632,10 @@ async function main(argv) {
|
|
|
577
632
|
engineArgs: str('engine-arg')?.split('\n'), id: str('id'), key: str('key'), scope: str('scope')?.split('\n'), to: str('to'), why: str('why'),
|
|
578
633
|
// @implements A-SPEC-774.20 — start despite unreadable versions; run start records which.
|
|
579
634
|
...(acceptParsed !== null ? { acceptUnknownVersions: acceptParsed.fields } : {}),
|
|
635
|
+
...(flags.provision === true ? { provision: true } : {}), // @implements A-SPEC-774.29
|
|
636
|
+
// @implements A-SPEC-102.10 — the run's review policy, validated by run start.
|
|
637
|
+
...(str('review-rounds') !== undefined ? { reviewRounds: str('review-rounds') } : {}),
|
|
638
|
+
...(flags['strict-review'] === true ? { strictReview: true } : {}),
|
|
580
639
|
}, { stdout: (t) => process.stdout.write(t), stderr: (t) => process.stderr.write(t) });
|
|
581
640
|
}
|
|
582
641
|
// @implements A-SPEC-102.2 — review verdicts for callers that are not MCP clients.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface PsRow {
|
|
2
|
+
pid: number;
|
|
3
|
+
startedMs: number;
|
|
4
|
+
command: string;
|
|
5
|
+
}
|
|
6
|
+
export interface StaleServer {
|
|
7
|
+
pid: number;
|
|
8
|
+
startedAt: string;
|
|
9
|
+
packageRoot: string;
|
|
10
|
+
installedVersion: string;
|
|
11
|
+
installedAt: string;
|
|
12
|
+
}
|
|
13
|
+
/** Rows of `ps -Ao pid=,lstart=,command=` under LC_ALL=C: `<pid> <Dow Mon DD HH:MM:SS YYYY> <command>`. */
|
|
14
|
+
export declare function parsePsRows(text: string): PsRow[];
|
|
15
|
+
/** The holmes-kit package at `root`: its version and the mtime of its package.json (the install time). */
|
|
16
|
+
export declare function readPackageInstall(root: string): {
|
|
17
|
+
version: string;
|
|
18
|
+
installedMs: number;
|
|
19
|
+
} | null;
|
|
20
|
+
export declare function staleMcpServers(rows: PsRow[], readPkg: (root: string) => {
|
|
21
|
+
version: string;
|
|
22
|
+
installedMs: number;
|
|
23
|
+
} | null): StaleServer[];
|
|
24
|
+
/** The process table, or null where it cannot be read (win32, or ps failing). Bounded by a 3 s timeout. */
|
|
25
|
+
export declare function listProcessRows(): PsRow[] | null;
|
|
26
|
+
export declare function mcpProcessesRow(stale: StaleServer[] | null): {
|
|
27
|
+
name: string;
|
|
28
|
+
level: 'PASS' | 'WARN' | 'INFO';
|
|
29
|
+
detail: string;
|
|
30
|
+
};
|
|
31
|
+
/** One banner line for the servers running from the workspace's wired package root, or ''. */
|
|
32
|
+
export declare function mcpProcessBannerLine(stale: StaleServer[], wiredRoot: string): string;
|