@holmes-lab/holmes-kit 0.37.1 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +12 -2
  3. package/dist/.build-id +1 -1
  4. package/dist/holmes/cli/approve-status.js +2 -1
  5. package/dist/holmes/cli/approve.js +24 -3
  6. package/dist/holmes/cli/autonomy.d.ts +72 -0
  7. package/dist/holmes/cli/autonomy.js +92 -8
  8. package/dist/holmes/cli/doctor.js +4 -13
  9. package/dist/holmes/cli/index.js +98 -10
  10. package/dist/holmes/cli/runtime-binding-approval.js +2 -3
  11. package/dist/holmes/governance/approval-queue.d.ts +7 -1
  12. package/dist/holmes/governance/approval-queue.js +10 -28
  13. package/dist/holmes/governance/autonomy.d.ts +10 -1
  14. package/dist/holmes/governance/autonomy.js +46 -2
  15. package/dist/holmes/governance/full-autonomy.d.ts +72 -0
  16. package/dist/holmes/governance/full-autonomy.js +308 -0
  17. package/dist/holmes/guardrail/operator-person.js +3 -2
  18. package/dist/holmes/guardrail/refusal-codes.js +13 -4
  19. package/dist/holmes/guardrail/risk-classifier.js +7 -3
  20. package/dist/holmes/guardrail/run-refusals.js +7 -6
  21. package/dist/holmes/guardrail/write-target.js +4 -1
  22. package/dist/holmes/hooks/pre-tool-use.d.ts +2 -0
  23. package/dist/holmes/hooks/pre-tool-use.js +55 -10
  24. package/dist/holmes/hooks/stop.js +3 -3
  25. package/dist/holmes/mcp/elicit-approval.js +5 -6
  26. package/dist/holmes/mcp/handlers/approval-ask.js +4 -3
  27. package/dist/holmes/mcp/handlers/review-verdict.js +3 -2
  28. package/dist/holmes/mcp/handlers/spec-approval.d.ts +2 -0
  29. package/dist/holmes/mcp/handlers/spec-approval.js +24 -6
  30. package/dist/holmes/mcp/handlers.d.ts +2 -0
  31. package/dist/holmes/mcp/handlers.js +2 -1
  32. package/dist/holmes/mcp/operator-recovery.d.ts +7 -2
  33. package/dist/holmes/mcp/operator-recovery.js +15 -58
  34. package/dist/holmes/mcp/tool-schemas.js +1 -1
  35. package/dist/holmes/review/run-replay.d.ts +31 -0
  36. package/dist/holmes/review/run-replay.js +25 -2
  37. package/package.json +1 -1
  38. package/playbooks/promote-slice/PLAYBOOK.md +2 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,40 @@ 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.38.0] - 2026-10-22
11
+
12
+ 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".
13
+
14
+ ### Added
15
+ - **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:
16
+ - **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.
17
+ - **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.
18
+ - **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).
19
+ - **Measured.** G0 round 5 ran 6 headless Holmes runs (Claude Code, Haiku) under one profile. It filed 0 approval requests, and no run waited.
20
+ - **Flags.** `--allow-push` and `--allow-publish` are off by default. `--no-architecture` keeps architecture documents with the owner.
21
+ - **Revoking.** `--revoke` needs no proof.
22
+ - **Visibility.** `autonomy status`, `doctor` and the session banner name an active profile.
23
+
24
+ ### Changed
25
+ - **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.
26
+ - **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.
27
+
28
+ ## [0.37.2] - 2026-10-22
29
+
30
+ 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.
31
+
32
+ ### Fixed
33
+ - **Session autonomy is granted in the session's approval form (A-SPEC-718.7).**
34
+ - Before, from an agent's shell, `holmes-kit autonomy on` was refused with "the operator decides in the session's approval dialog", but it filed nothing for that dialog to decide. The only way through was the operator's own terminal.
35
+ - Now the refusal files an `autonomy-grant` request. Its subject names the duration, so a grant for 4h cannot enable 7d. The person approves it with `approval_ask`, and the same command then proceeds once and spends the grant.
36
+ - A person at their own terminal is unchanged.
37
+ - `holmes-kit doctor` now reports the autonomy posture `autonomy status` reports. Before, it said OFF beside a live session grant, because it read only the init default.
38
+ - **An autonomy refusal the agent can resolve by itself says how (A-SPEC-532.7).** When `upstream-without-aspec` or `files-to-touch-empty` holds a seal, the refusal now names the step: write the A-SPEC beneath it, drafts included, or fill in its Files to Touch, then seal again. No person is needed. Before, a Haiku agent sealed its REQ first, asked a person twice, and ended without changing code.
39
+ - **Two gate refusals name the route that needs no person (A-SPEC-773.4).**
40
+ - A read over `.ax` that the gate cannot judge now names the single-command reads it admits (`cat .ax/specs/*/<ID>.md | head`, `grep -n …`, `sed -n …`) and the Read tool.
41
+ - An `rm -rf` of an absolute temporary path now says that `holmes-kit scratch --new <label>` prints a directory the agent may create, fill and remove with no person.
42
+ - Every verdict is unchanged. The temporary-directory refusal itself stays (owner decision).
43
+
10
44
  ## [0.37.1] - 2026-10-21
11
45
 
12
46
  Two fixes. On Windows, 0.37.0 refused grants from a person's own terminal; Windows has been checked with fixture tests here but not yet re-measured on a Windows machine. The traced-files badge now counts only what git tracks.
package/README.md CHANGED
@@ -9,8 +9,8 @@
9
9
  <!-- holmes-kit:attest:begin -->
10
10
  ![traced files](.ax/badges/traced.svg)
11
11
 
12
- **466/466** source files (100%) trace to an approved spec · **937/1013** approved A-SPECs (92.4%) are anchored from code.
13
- Measured at `fd66f7ce5fef` (specs `sha256:7a6c4957d5c0`) — reproduce with `holmes-kit attest --exclude docs/goals/probes/`.
12
+ **475/475** source files (100%) trace to an approved spec · **954/1030** approved A-SPECs (92.6%) are anchored from code.
13
+ Measured at `622ce26a4958` (specs `sha256:35b66c9f8ccd`) — reproduce with `holmes-kit attest --exclude docs/goals/probes/`.
14
14
  <!-- holmes-kit:attest:end -->
15
15
 
16
16
  ---
@@ -22,6 +22,15 @@ Measured at `fd66f7ce5fef` (specs `sha256:7a6c4957d5c0`) — reproduce with `hol
22
22
  ---
23
23
 
24
24
  ### 🛡️ Currently Supported Features (Production Features)
25
+ - **Full autonomy mode — no judgment waits for a person, and no approval is typed in a terminal** *(new in 0.38.0)*:
26
+ - **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.
27
+ - **Inside the scope**, every judgment ends at once:
28
+ - 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.
29
+ - 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/`.
30
+ - 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.
31
+ - **Revoking.** `--revoke` ends the profile.
32
+ - **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.
33
+ - **Shell grants** last until they are used.
25
34
  - **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
35
  - **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
36
 
@@ -316,6 +325,7 @@ flowchart LR
316
325
  | `holmes-kit doctor --target <root> --registry <bindings.json>` | Diagnose the same operator registry used by custom routing installations |
317
326
  | `holmes-kit autonomy status` | Show the current autonomous-approval posture (project default + session envelope) |
318
327
  | `holmes-kit autonomy on --for 2h` | Self-drive low-risk specs for this session only (expiring; needs a TTY or `HOLMES_APPROVAL`) |
328
+ | `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
329
  | `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
330
  | `holmes-kit semantic-setup` | Download and verify the local `bge-m3` model (retry/recovery; shared across projects) |
321
331
  | `holmes-kit semantic-check` | Verify local inference **offline**, without downloading anything |
package/dist/.build-id CHANGED
@@ -1 +1 @@
1
- 829a8208-mvhbw5jo
1
+ 06fb6baa-mvj2vrie
@@ -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 };
@@ -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
- const untilUsed = opts.ttlMinutes === undefined && typeof entry?.subject === 'string' && entry.subject !== '';
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: id,
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.
@@ -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 {
@@ -20,6 +25,73 @@ export interface AutonomyResult {
20
25
  exitCode: 0 | 1 | 2;
21
26
  message: string;
22
27
  }
28
+ export type AutonomyGrantVerdict = {
29
+ proceed: true;
30
+ approval?: Approval;
31
+ spend?: string;
32
+ } | {
33
+ proceed: false;
34
+ id: string;
35
+ message: string;
36
+ };
37
+ export interface AutonomyGrantDeps {
38
+ guard: () => string | null;
39
+ resolve: (askRoot: string, env: Approval | undefined, action: {
40
+ kind: string;
41
+ target: string;
42
+ subject: string;
43
+ }, now: string) => {
44
+ approval: Approval;
45
+ source: 'env' | 'grant';
46
+ } | undefined;
47
+ enqueue: (askRoot: string, req: {
48
+ kind: string;
49
+ target: string;
50
+ why: string;
51
+ subject: string;
52
+ title: string;
53
+ }) => void;
54
+ }
55
+ /**
56
+ * @implements A-SPEC-718.7 — may `autonomy on` proceed? In order: an approval that covers this exact grant (the env
57
+ * token, or the grant the person's answer in the session form minted — `approval_ask`); a person at their own terminal;
58
+ * otherwise a request the session form can decide. Measured 2026-10-21: the refusal promised "the session's approval
59
+ * dialog" but filed nothing, so the only way through was a terminal the owner had asked never to need. The duration is
60
+ * the request's subject, so a grant for 4h cannot enable 7d. The request lives in the asking session's project
61
+ * (`askRoot`), where its `approval_ask` can find it, and names the workspace it would change.
62
+ */
63
+ export declare function autonomyGrantGate(input: {
64
+ root: string;
65
+ askRoot: string;
66
+ mins: number;
67
+ now: string;
68
+ envApproval?: Approval;
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;
93
+ /** @implements A-SPEC-718.7 — the posture `autonomy status` reports, never coloured by the caller's own environment. */
94
+ export declare function autonomyPostureLine(root: string, now: string): string;
23
95
  /**
24
96
  * The `holmes-kit autonomy status|on|off|delegate|revoke-delegation` core. Pure over injected io (clock/TTY/approval/
25
97
  * env) so every branch is testable. Enabling (`on`) and delegating are protected exactly like `init --autonomy`: the
@@ -34,16 +34,24 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.parseForMinutes = parseForMinutes;
37
+ exports.autonomyGrantGate = autonomyGrantGate;
38
+ exports.fullProfileSubject = fullProfileSubject;
39
+ exports.fullProfileGate = fullProfileGate;
40
+ exports.runAutonomyFull = runAutonomyFull;
41
+ exports.autonomyPostureLine = autonomyPostureLine;
37
42
  exports.runAutonomy = runAutonomy;
38
- // @implements A-SPEC-553.1, A-SPEC-553.2, A-SPEC-771
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
39
44
  const fs = __importStar(require("node:fs"));
45
+ const full_autonomy_1 = require("../governance/full-autonomy");
46
+ const autonomy_1 = require("../governance/autonomy");
40
47
  const path = __importStar(require("node:path"));
41
48
  const risk_gate_1 = require("../guardrail/risk-gate");
42
- const autonomy_1 = require("../governance/autonomy");
49
+ const autonomy_2 = require("../governance/autonomy");
43
50
  const delegation_1 = require("../governance/delegation");
44
51
  const PROJECT_DEFAULT_ON = 'autonomous spec approval: ON (project default, .mcp.json) — governance-critical still ask you. '
45
52
  + 'Turn it off by removing HOLMES_AUTONOMOUS_APPROVAL from .mcp.json (or holmes-kit init --no-autonomy).';
46
53
  const ledger_store_1 = require("../governance/ledger-store");
54
+ const approval_queue_1 = require("../governance/approval-queue");
47
55
  const provenance_chain_1 = require("../governance/provenance-chain");
48
56
  /** `--for` accepts `2h` / `90m` / `7d` / a bare number of hours. Minutes, capped at 7 days (like grants);
49
57
  * null on a malformed value; default 2h when omitted. */
@@ -86,6 +94,76 @@ function revokeDelegationQuietly(root, io, rationale) {
86
94
  }
87
95
  catch { /* the document is gone either way */ }
88
96
  }
97
+ /**
98
+ * @implements A-SPEC-718.7 — may `autonomy on` proceed? In order: an approval that covers this exact grant (the env
99
+ * token, or the grant the person's answer in the session form minted — `approval_ask`); a person at their own terminal;
100
+ * otherwise a request the session form can decide. Measured 2026-10-21: the refusal promised "the session's approval
101
+ * dialog" but filed nothing, so the only way through was a terminal the owner had asked never to need. The duration is
102
+ * the request's subject, so a grant for 4h cannot enable 7d. The request lives in the asking session's project
103
+ * (`askRoot`), where its `approval_ask` can find it, and names the workspace it would change.
104
+ */
105
+ function autonomyGrantGate(input, deps) {
106
+ const action = { kind: 'autonomy-grant', target: input.root, subject: `for=${input.mins}m` };
107
+ const covering = deps.resolve(input.askRoot, input.envApproval, action, input.now);
108
+ if (covering !== undefined) {
109
+ const nonce = covering.approval.nonce;
110
+ return { proceed: true, approval: covering.approval, ...(covering.source === 'grant' && typeof nonce === 'string' ? { spend: nonce } : {}) };
111
+ }
112
+ const why = deps.guard();
113
+ if (why === null)
114
+ return { proceed: true };
115
+ const title = `session autonomy for ${input.mins} minutes`;
116
+ deps.enqueue(input.askRoot, { ...action, why: `enable autonomous spec approval in ${input.root} for ${input.mins} minutes`, title });
117
+ const id = (0, approval_queue_1.approvalRequestId)(action.kind, action.target);
118
+ return { proceed: false, id, message: `${why}${(0, approval_queue_1.pendingRequestLine)(id, action.kind, input.askRoot, title, input.root)}` };
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
+ }
163
+ /** @implements A-SPEC-718.7 — the posture `autonomy status` reports, never coloured by the caller's own environment. */
164
+ function autonomyPostureLine(root, now) {
165
+ return runAutonomy(root, 'status', undefined, { now, isTTY: false, env: {} }).message;
166
+ }
89
167
  /**
90
168
  * The `holmes-kit autonomy status|on|off|delegate|revoke-delegation` core. Pure over injected io (clock/TTY/approval/
91
169
  * env) so every branch is testable. Enabling (`on`) and delegating are protected exactly like `init --autonomy`: the
@@ -94,20 +172,26 @@ function revokeDelegationQuietly(root, io, rationale) {
94
172
  */
95
173
  function runAutonomy(root, sub, forStr, io, extra = {}) {
96
174
  const env = io.env ?? process.env;
97
- const markerPath = path.join(root, ...autonomy_1.SESSION_AUTONOMY_MARKER);
175
+ const markerPath = path.join(root, ...autonomy_2.SESSION_AUTONOMY_MARKER);
98
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
+ }
99
183
  // @implements A-SPEC-771 — an active run delegation is reported beside whichever posture is on.
100
184
  const delegationLine = delegationStatusLine(root, io.now);
101
185
  const withDelegation = (message) => delegationLine === null ? message : `${message}\n${delegationLine}`;
102
- const envOn = typeof env[autonomy_1.AUTONOMY_ENV] === 'string' && env[autonomy_1.AUTONOMY_ENV] !== '';
186
+ const envOn = typeof env[autonomy_2.AUTONOMY_ENV] === 'string' && env[autonomy_2.AUTONOMY_ENV] !== '';
103
187
  if (envOn)
104
188
  return { ok: true, exitCode: 0, message: withDelegation('autonomous spec approval: ON (project default, .mcp.json) — governance-critical still ask you') };
105
189
  // @implements A-SPEC-553.2 — the same project default the server and the session banner read
106
190
  // (A-SPEC-560.2). The CLI read only the shell environment, which never carries .mcp.json's env, and
107
191
  // answered OFF while the server sealed specs autonomously.
108
- if ((0, autonomy_1.projectDefaultAutonomy)(root))
192
+ if ((0, autonomy_2.projectDefaultAutonomy)(root))
109
193
  return { ok: true, exitCode: 0, message: withDelegation(PROJECT_DEFAULT_ON) };
110
- if ((0, autonomy_1.sessionAutonomyActive)(root, io.now)) {
194
+ if ((0, autonomy_2.sessionAutonomyActive)(root, io.now)) {
111
195
  let expires = '';
112
196
  try {
113
197
  expires = String(JSON.parse(fs.readFileSync(markerPath, 'utf8')).expires);
@@ -156,8 +240,8 @@ function runAutonomy(root, sub, forStr, io, extra = {}) {
156
240
  }
157
241
  // @implements A-SPEC-553.2 — the emergency control never reports a de-escalation that did not happen
158
242
  // (A-SPEC-558.1): with the project default (or the environment switch) still on, autonomy is still ON.
159
- const envStillOn = typeof env[autonomy_1.AUTONOMY_ENV] === 'string' && env[autonomy_1.AUTONOMY_ENV] !== '';
160
- if (envStillOn || (0, autonomy_1.projectDefaultAutonomy)(root)) {
243
+ const envStillOn = typeof env[autonomy_2.AUTONOMY_ENV] === 'string' && env[autonomy_2.AUTONOMY_ENV] !== '';
244
+ if (envStillOn || (0, autonomy_2.projectDefaultAutonomy)(root)) {
161
245
  return { ok: false, exitCode: 1, message: 'session autonomy ended, but autonomous spec approval is still ON: the project default in .mcp.json '
162
246
  + '(HOLMES_AUTONOMOUS_APPROVAL) keeps it on — remove it from .mcp.json (or holmes-kit init --no-autonomy) to turn it off.' };
163
247
  }
@@ -1531,19 +1531,10 @@ async function runDoctor(packageRoot, target, opts, extraChecks) {
1531
1531
  // @implements A-SPEC-552.1 — surface the project's autonomy posture so a human always knows
1532
1532
  // whether the agent may self-approve. Read from the SAME place the MCP server does (.mcp.json
1533
1533
  // server env), never from doctor's own process, for the reason stated above.
1534
- let autonomyOn = false;
1535
- try {
1536
- const raw = fs.readFileSync(path.join(target, '.mcp.json'), 'utf8');
1537
- const env = JSON.parse(raw)
1538
- .mcpServers?.[init_1.SERVER_NAME]?.env;
1539
- autonomyOn = !!env && !!env['HOLMES_AUTONOMOUS_APPROVAL'];
1540
- }
1541
- catch {
1542
- autonomyOn = false;
1543
- }
1544
- add('autonomous spec approval', 'PASS', autonomyOn
1545
- ? 'ON — the agent may self-approve low-risk specs; governance-critical still ask you (holmes-kit autonomy off to disable)'
1546
- : 'OFF — every spec approval is human (enable at init, or holmes-kit autonomy on for one session)');
1534
+ // @implements A-SPEC-718.7 — the posture `autonomy status` reports (project default, session grant with its expiry, run
1535
+ // delegation, or OFF). Reading only the init default, this row said OFF beside a live session grant (2026-10-21).
1536
+ const { autonomyPostureLine } = require('./autonomy');
1537
+ add('autonomous spec approval', 'PASS', autonomyPostureLine(target, new Date().toISOString()).replace(/^autonomous spec approval: /, ''));
1547
1538
  // @implements A-SPEC-251.2 — the version this project's MCP server will ACTUALLY launch, vs this
1548
1539
  // CLI. The stale-global trap (measured 2026-08-23: .mcp.json pinned a 0.1.9 global while the user
1549
1540
  // believed they had upgraded) was invisible because nothing compared them. Offline: the launch
@@ -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
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'],
@@ -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']); // `--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
@@ -464,7 +464,7 @@ async function main(argv) {
464
464
  // foreground human act (raw-TTY proof, or an out-of-band HOLMES_APPROVAL for the non-interactive
465
465
  // path); the marker lives in the agent-write-protected .ax/state/, so a session cannot self-grant.
466
466
  if (cmd === 'autonomy') {
467
- const { runAutonomy } = await Promise.resolve().then(() => __importStar(require('./autonomy')));
467
+ const { runAutonomy, parseForMinutes, autonomyGrantGate } = await Promise.resolve().then(() => __importStar(require('./autonomy')));
468
468
  const root = path.resolve(typeof flags.target === 'string' ? flags.target : process.cwd());
469
469
  const forStr = typeof flags.for === 'string' ? flags.for : undefined;
470
470
  // @implements A-SPEC-771.1 — the delegation's own inputs ride through to the core; `--limit` may repeat.
@@ -476,13 +476,97 @@ async function main(argv) {
476
476
  // @implements A-SPEC-779.4 — the terminal path proves a person only when no agent harness started this process;
477
477
  // a covering out-of-band approval is its own proof and keeps its path.
478
478
  const sub = positionals[0];
479
- if (sub === 'on' || sub === 'delegate') {
479
+ const { operatorActGuard } = require('../guardrail/operator-person');
480
+ const { withRefusalLine } = require('../guardrail/refusal-codes');
481
+ let effective = approval;
482
+ let spend;
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
+ }
539
+ if (sub === 'on' && minutes !== null) {
540
+ // @implements A-SPEC-718.7 — the person grants it in the session form: a refused `on` files an autonomy-grant
541
+ // request in the asking session's project (where approval_ask finds it), and the retry spends the grant.
542
+ const { resolveApproval } = require('../governance/approval-grants');
543
+ const { enqueueApprovalRequest } = require('../governance/approval-queue');
544
+ const { resolveProjectRoot } = require('../project/root');
545
+ let askRoot = root;
546
+ try {
547
+ const p = resolveProjectRoot(process.cwd());
548
+ if (p.marker === '.ax')
549
+ askRoot = p.root;
550
+ }
551
+ catch { /* the target's own project */ }
552
+ const v = autonomyGrantGate({ root, askRoot, mins: minutes, now, envApproval: approval }, {
553
+ guard: () => operatorActGuard('enabling session autonomy'),
554
+ resolve: (r, env, action, n) => resolveApproval(r, env, action, n),
555
+ enqueue: (r, req) => { enqueueApprovalRequest(r, req); },
556
+ });
557
+ if (!v.proceed) {
558
+ process.stderr.write(`${withRefusalLine(v.message)}\n`);
559
+ return 2;
560
+ }
561
+ effective = v.approval;
562
+ if (v.spend !== undefined)
563
+ spend = { root: askRoot, nonce: v.spend };
564
+ }
565
+ else if (sub === 'delegate') {
480
566
  const { approvalCovers } = require('../guardrail/risk-gate');
481
567
  if (!approvalCovers(approval, { kind: 'autonomy-grant', target: root }, now)) {
482
- const { operatorActGuard } = require('../guardrail/operator-person');
483
- const why = operatorActGuard(sub === 'on' ? 'enabling session autonomy' : 'issuing a run delegation');
568
+ const why = operatorActGuard('issuing a run delegation');
484
569
  if (why !== null) {
485
- const { withRefusalLine } = require('../guardrail/refusal-codes');
486
570
  process.stderr.write(`${withRefusalLine(why)}\n`);
487
571
  return 2;
488
572
  }
@@ -491,8 +575,12 @@ async function main(argv) {
491
575
  const r = runAutonomy(root, sub, forStr, {
492
576
  now,
493
577
  isTTY: !!process.stdin.isTTY && !!process.stdout.isTTY,
494
- approval,
578
+ approval: effective,
495
579
  }, extra);
580
+ if (r.ok && spend !== undefined) {
581
+ const { consumeGrantFile } = require('../governance/approval-grants');
582
+ consumeGrantFile(spend.root, spend.nonce);
583
+ }
496
584
  process[r.ok ? 'stdout' : 'stderr'].write(`${r.message}\n`);
497
585
  return r.exitCode;
498
586
  });
@@ -35,9 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.runtimePlanDigest = runtimePlanDigest;
37
37
  exports.applyApprovedRuntimePlan = applyApprovedRuntimePlan;
38
- // @implements A-SPEC-752, A-SPEC-752.14, A-SPEC-770.3, A-SPEC-770.6
38
+ // @implements A-SPEC-752, A-SPEC-752.14, A-SPEC-770.3, A-SPEC-770.6, A-SPEC-792.1
39
39
  const path = __importStar(require("node:path"));
40
- const npx_bin_1 = require("../project/npx-bin");
41
40
  const node_crypto_1 = require("node:crypto");
42
41
  const risk_gate_1 = require("../guardrail/risk-gate");
43
42
  const approval_grants_1 = require("../governance/approval-grants");
@@ -83,7 +82,7 @@ function applyApprovedRuntimePlan(root, subject, envApproval, check, apply, appr
83
82
  const id = (0, approval_queue_1.approvalRequestId)(action.kind, target);
84
83
  if (result.reason !== 'written' && result.reason !== 'duplicate')
85
84
  throw new Error(`Cannot queue governance-wiring approval: ${result.reason}; nothing installed`);
86
- throw new Error(`governance-wiring approval required for plan ${subject}; request ${id}. In ${approvalRoot === root ? 'this workspace' : `the workspace ${approvalRoot}`} run ${(0, npx_bin_1.holmesKitCommand)(approvalRoot)} approve --list, then ${(0, npx_bin_1.holmesKitCommand)(approvalRoot)} approve --grant ${id} and retry the same runtime-binding command. If an old decision remains, revoke it and retry to request the current plan.`);
85
+ throw new Error(`governance-wiring approval required for plan ${subject}; request ${id}. In ${approvalRoot === root ? 'this workspace' : `the workspace ${approvalRoot}`} the person approves request ${id} in a session's approval form (approval_ask with id "${id}"), then retry the same runtime-binding command. If an old decision remains, revoke it and retry to request the current plan.`);
87
86
  };
88
87
  check();
89
88
  if (!resolve())
@@ -29,7 +29,13 @@ export declare const DECISION_KINDS: ReadonlySet<string>;
29
29
  * without a title (A-SPEC-770.1's bytes). Every field is flattened and bounded and loses `]`, so the bracket closes once.
30
30
  */
31
31
  export declare function requestLabel(kind: string | undefined, target: string | undefined, title: string | undefined): string;
32
- export declare function pendingRequestLine(id: string, kind?: string, root?: string, title?: string, target?: string): string;
32
+ /**
33
+ * @implements A-SPEC-792.1 — the header and the in-session route only. The `운영자: … approve --grant <id> --target …`
34
+ * clause (A-SPEC-770, 770.1, 770.2) is gone: an agent relayed it verbatim and the person typed it in a terminal
35
+ * (field report 2026-10-22), the UX REQ-792 removes. The request id still names the workspace's queue entry, and the
36
+ * approve CLI still finds it by id; nothing tells a person to type it.
37
+ */
38
+ export declare function pendingRequestLine(id: string, kind?: string, _root?: string, title?: string, target?: string): string;
33
39
  /**
34
40
  * @implements A-SPEC-718.5 — the in-session route, addressed to the agent: since A-SPEC-779.4 neither the agent's shell
35
41
  * nor the session's `!` can type the operator line above, so without this line an agent has no way to ask.