@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.
- package/CHANGELOG.md +34 -0
- package/README.md +12 -2
- package/dist/.build-id +1 -1
- package/dist/holmes/cli/approve-status.js +2 -1
- package/dist/holmes/cli/approve.js +24 -3
- package/dist/holmes/cli/autonomy.d.ts +72 -0
- package/dist/holmes/cli/autonomy.js +92 -8
- package/dist/holmes/cli/doctor.js +4 -13
- package/dist/holmes/cli/index.js +98 -10
- package/dist/holmes/cli/runtime-binding-approval.js +2 -3
- package/dist/holmes/governance/approval-queue.d.ts +7 -1
- package/dist/holmes/governance/approval-queue.js +10 -28
- package/dist/holmes/governance/autonomy.d.ts +10 -1
- package/dist/holmes/governance/autonomy.js +46 -2
- package/dist/holmes/governance/full-autonomy.d.ts +72 -0
- package/dist/holmes/governance/full-autonomy.js +308 -0
- package/dist/holmes/guardrail/operator-person.js +3 -2
- package/dist/holmes/guardrail/refusal-codes.js +13 -4
- package/dist/holmes/guardrail/risk-classifier.js +7 -3
- package/dist/holmes/guardrail/run-refusals.js +7 -6
- 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 +55 -10
- package/dist/holmes/hooks/stop.js +3 -3
- package/dist/holmes/mcp/elicit-approval.js +5 -6
- package/dist/holmes/mcp/handlers/approval-ask.js +4 -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 +24 -6
- package/dist/holmes/mcp/handlers.d.ts +2 -0
- package/dist/holmes/mcp/handlers.js +2 -1
- package/dist/holmes/mcp/operator-recovery.d.ts +7 -2
- package/dist/holmes/mcp/operator-recovery.js +15 -58
- package/dist/holmes/mcp/tool-schemas.js +1 -1
- package/dist/holmes/review/run-replay.d.ts +31 -0
- package/dist/holmes/review/run-replay.js +25 -2
- package/package.json +1 -1
- package/playbooks/promote-slice/PLAYBOOK.md +2 -1
|
@@ -56,7 +56,6 @@ const execution_context_1 = require("../project/execution-context");
|
|
|
56
56
|
const run_mode_1 = require("./run-mode");
|
|
57
57
|
const root_1 = require("../project/root");
|
|
58
58
|
const node_crypto_1 = require("node:crypto");
|
|
59
|
-
const npx_bin_1 = require("../project/npx-bin");
|
|
60
59
|
const fs = __importStar(require("node:fs"));
|
|
61
60
|
const path = __importStar(require("node:path"));
|
|
62
61
|
const screen_safe_1 = require("../cli/screen-safe");
|
|
@@ -110,26 +109,15 @@ function requestLabel(kind, target, title) {
|
|
|
110
109
|
const f = (s, max) => (0, screen_safe_1.flattenField)(s, max).replace(/[\]「」]/g, ' ').trim();
|
|
111
110
|
return ` · ${f(kind ?? '', 40)} ${f(target ?? '', 60)} 「${f(title, 80)}」`;
|
|
112
111
|
}
|
|
113
|
-
|
|
112
|
+
/**
|
|
113
|
+
* @implements A-SPEC-792.1 — the header and the in-session route only. The `운영자: … approve --grant <id> --target …`
|
|
114
|
+
* clause (A-SPEC-770, 770.1, 770.2) is gone: an agent relayed it verbatim and the person typed it in a terminal
|
|
115
|
+
* (field report 2026-10-22), the UX REQ-792 removes. The request id still names the workspace's queue entry, and the
|
|
116
|
+
* approve CLI still finds it by id; nothing tells a person to type it.
|
|
117
|
+
*/
|
|
118
|
+
function pendingRequestLine(id, kind, _root, title, target) {
|
|
114
119
|
const label = requestLabel(kind, target, title); // @implements A-SPEC-770.12
|
|
115
|
-
|
|
116
|
-
const command = `${(0, npx_bin_1.holmesKitCommand)(root)} approve`; // A-SPEC-770.6 — the root the request is stored in
|
|
117
|
-
// @implements A-SPEC-770.2 — the request lives in the refusal log / queue of the workspace whose hook refused, not in
|
|
118
|
-
// the shell's cwd (measured 2026-10-12: a command run under a worktree filed its request in the development root;
|
|
119
|
-
// 2026-10-13, Codex X1: the hint carried no `--target` at all). With a root, every command names it; a root with
|
|
120
|
-
// white space is double-quoted once; a root is never folded or relativised. Without a root the A-SPEC-770.1 lines
|
|
121
|
-
// are produced byte for byte.
|
|
122
|
-
const targetFlag = root === undefined ? '' : ` --target ${/\s/.test(root) ? `"${root}"` : root}`;
|
|
123
|
-
// @implements A-SPEC-770 — a request outside the decision inbox (A-SPEC-563.1 routes gate refusals to the local
|
|
124
|
-
// refusal log) names the id-bearing command, because the bare command opens a screen that by design does not list
|
|
125
|
-
// it. Field report (jarvis, 2026-10-11): the operator ran the bare command, saw six old inbox requests, and the
|
|
126
|
-
// agent's shell command was refused again with the same id. A decision kind keeps the short line: it IS listed.
|
|
127
|
-
// @implements A-SPEC-770.1 — the id rides the `--grant` flag: the CLI refuses a positional id (`unexpected
|
|
128
|
-
// argument: req-…`, measured by the operator on 0.35.17 with the command this line used to name).
|
|
129
|
-
if (kind !== undefined && !exports.DECISION_KINDS.has(kind)) {
|
|
130
|
-
return `\n[승인 대기 ${id}${label}] 운영자: ${command} --grant ${id}${targetFlag} — 인박스 화면에는 뜨지 않는 거부입니다(${command} --refusals${targetFlag} 로 조회)${approvalAskLine(id)}`;
|
|
131
|
-
}
|
|
132
|
-
return root === undefined ? `\n[승인 대기 ${id}${label}] 운영자: ${command}${approvalAskLine(id)}` : `\n[승인 대기 ${id}${label}] 운영자: ${command} --grant ${id}${targetFlag}${approvalAskLine(id)}`;
|
|
120
|
+
return `\n[승인 대기 ${id}${label}]${approvalAskLine(id)}`;
|
|
133
121
|
}
|
|
134
122
|
/**
|
|
135
123
|
* @implements A-SPEC-718.5 — the in-session route, addressed to the agent: since A-SPEC-779.4 neither the agent's shell
|
|
@@ -571,14 +559,8 @@ function queueHint(root, req, opts) {
|
|
|
571
559
|
// template-owned margin; this producer, read by the operator AND relayed by the agent, never got
|
|
572
560
|
// one. The first row keeps the template's own opening; the rest sit under the margin.
|
|
573
561
|
const question = `\n[보류 — 운영자 질문: ${(0, screen_safe_1.flattenField)(held.question ?? '(질문 없음)', 300)}] 게이트는 닫혀 있습니다.`;
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
// would change the command the operator is being asked to execute.
|
|
577
|
-
return (0, screen_safe_1.wrapColumns)(question + ' 이 질문에 대한 답을 사용자에게 보고하십시오. 결정은 운영자 승인 UI에서 내립니다.', 76, ' \u2502 ')
|
|
578
|
-
+ `\n운영자 검토: ${opts.reviewCommand}`;
|
|
579
|
-
}
|
|
580
|
-
return (0, screen_safe_1.wrapColumns)(question
|
|
581
|
-
+ ` 이 질문에 대한 답을 사용자에게 보고하십시오. 결정은 운영자가 ${(0, npx_bin_1.holmesKitCommand)(root)} approve 에서 내립니다.`, 76, ' \u2502 ');
|
|
562
|
+
// @implements A-SPEC-792.1 — the decision is the person's in the session form, never a command to type.
|
|
563
|
+
return (0, screen_safe_1.wrapColumns)(question + ' 이 질문에 대한 답을 사용자에게 보고하십시오. 결정은 세션 승인 창에서 내립니다 — 답을 받은 뒤 approval_ask 로 ' + id + ' 를 다시 물으십시오.', 76, ' \u2502 ');
|
|
582
564
|
}
|
|
583
565
|
const decided = state.decisions[id];
|
|
584
566
|
const denialLine = decided?.event === 'denied'
|
|
@@ -27,6 +27,13 @@ export declare function specApprovalAutonomy(spec: Spec, resolveParent: (id: str
|
|
|
27
27
|
export declare function declaredGateDirection(spec: Spec): 'tightens' | 'wording' | null;
|
|
28
28
|
/** @implements A-SPEC-532.3 — one plain clause per rule name, for the refusal a person reads. */
|
|
29
29
|
export declare function autonomyRuleMeaning(rule: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* @implements A-SPEC-532.7 — the step that resolves a rule without a person, or '' when only a person can. Measured in
|
|
32
|
+
* G0 round 1 (2026-10-21): a Haiku agent sealed REQ-001 first, got `upstream-without-aspec`, asked a person twice
|
|
33
|
+
* through approval_ask in a headless run, and ended without changing code. `descendantAspecs` counts drafts, so writing
|
|
34
|
+
* the A-SPEC beneath makes the same seal gradable — the refusal never said so.
|
|
35
|
+
*/
|
|
36
|
+
export declare function autonomyNextStep(rule: string, specId: string): string;
|
|
30
37
|
/**
|
|
31
38
|
* @implements A-SPEC-532.3 — the first rule that hands this seal to the owner, or null when none does. Measured
|
|
32
39
|
* 2026-10-04: two gate specs were refused with the generic out-of-band sentence and neither the session nor the owner
|
|
@@ -54,7 +61,9 @@ export declare function sessionAutonomyActive(root: string, now: string): boolea
|
|
|
54
61
|
* (A-SPEC-553.1). `root`/`now` are optional so env-only callers are byte-identical. */
|
|
55
62
|
export declare function projectDefaultAutonomy(root: string): boolean;
|
|
56
63
|
export declare function autonomousApprovalEnabled(env: NodeJS.ProcessEnv, root?: string, now?: string): boolean;
|
|
57
|
-
|
|
64
|
+
/** @implements A-SPEC-792.7 — the full profile covering `root`, as one line (without the banner prefix), or ''. */
|
|
65
|
+
export declare function fullAutonomyLine(root: string, home?: string): string;
|
|
66
|
+
export declare function autonomyBanner(env: NodeJS.ProcessEnv, root: string, now: string, home?: string): string;
|
|
58
67
|
export declare function autonomyMarkerShouldPrune(root: string, now: string): boolean;
|
|
59
68
|
export declare function versionBumpKind(from: string, to: string): 'major' | 'minor' | 'patch' | 'none';
|
|
60
69
|
export declare function releaseAutonomy(specs: Spec[], versionBump: 'major' | 'minor' | 'patch' | 'none', env: NodeJS.ProcessEnv, root?: string, now?: string): ApprovalAutonomy;
|
|
@@ -39,17 +39,19 @@ exports.descendantAspecs = descendantAspecs;
|
|
|
39
39
|
exports.specApprovalAutonomy = specApprovalAutonomy;
|
|
40
40
|
exports.declaredGateDirection = declaredGateDirection;
|
|
41
41
|
exports.autonomyRuleMeaning = autonomyRuleMeaning;
|
|
42
|
+
exports.autonomyNextStep = autonomyNextStep;
|
|
42
43
|
exports.specApprovalAutonomyReason = specApprovalAutonomyReason;
|
|
43
44
|
exports.ceilingRefusal = ceilingRefusal;
|
|
44
45
|
exports.requiresAutonomousApprovalPrompt = requiresAutonomousApprovalPrompt;
|
|
45
46
|
exports.sessionAutonomyActive = sessionAutonomyActive;
|
|
46
47
|
exports.projectDefaultAutonomy = projectDefaultAutonomy;
|
|
47
48
|
exports.autonomousApprovalEnabled = autonomousApprovalEnabled;
|
|
49
|
+
exports.fullAutonomyLine = fullAutonomyLine;
|
|
48
50
|
exports.autonomyBanner = autonomyBanner;
|
|
49
51
|
exports.autonomyMarkerShouldPrune = autonomyMarkerShouldPrune;
|
|
50
52
|
exports.versionBumpKind = versionBumpKind;
|
|
51
53
|
exports.releaseAutonomy = releaseAutonomy;
|
|
52
|
-
// @implements A-SPEC-532.1, A-SPEC-718, A-SPEC-532.3, A-SPEC-532.4
|
|
54
|
+
// @implements A-SPEC-532.1, A-SPEC-718, A-SPEC-532.3, A-SPEC-532.4, A-SPEC-532.7, A-SPEC-792.7
|
|
53
55
|
// Whether a spec approval may be sealed AUTONOMOUSLY by the agent, or must still ask a human through
|
|
54
56
|
// the MCP elicitation TUI. The governance chain (REQ→H→A→T→CPG + RTM + taint + phase gate) already
|
|
55
57
|
// forces quality structurally, so a low/mid-risk spec self-approving under an explicitly-enabled
|
|
@@ -66,6 +68,8 @@ const scope_judgment_1 = require("../guardrail/scope-judgment");
|
|
|
66
68
|
/** The out-of-band switch. An agent cannot read or set it — the pre-tool-use gate blocks that
|
|
67
69
|
* (A-SPEC-532.2), the same self-disarm protection HOLMES_APPROVAL and HOLMES_GATE_BYPASS have. */
|
|
68
70
|
const delegation_1 = require("./delegation"); // @implements A-SPEC-771 — the run delegation, the third envelope
|
|
71
|
+
const full_autonomy_1 = require("./full-autonomy"); // @implements A-SPEC-792.7
|
|
72
|
+
const os = __importStar(require("node:os"));
|
|
69
73
|
exports.AUTONOMY_ENV = 'HOLMES_AUTONOMOUS_APPROVAL';
|
|
70
74
|
/**
|
|
71
75
|
* Path prefixes whose files govern the gate, the ledger, taint boundaries, or this session's own
|
|
@@ -201,6 +205,23 @@ function autonomyRuleMeaning(rule) {
|
|
|
201
205
|
default: return 'the spec kind is not one the grader knows';
|
|
202
206
|
}
|
|
203
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* @implements A-SPEC-532.7 — the step that resolves a rule without a person, or '' when only a person can. Measured in
|
|
210
|
+
* G0 round 1 (2026-10-21): a Haiku agent sealed REQ-001 first, got `upstream-without-aspec`, asked a person twice
|
|
211
|
+
* through approval_ask in a headless run, and ended without changing code. `descendantAspecs` counts drafts, so writing
|
|
212
|
+
* the A-SPEC beneath makes the same seal gradable — the refusal never said so.
|
|
213
|
+
*/
|
|
214
|
+
function autonomyNextStep(rule, specId) {
|
|
215
|
+
if (rule === 'upstream-without-aspec') {
|
|
216
|
+
return `\n[next, no person needed: scaffold the H-SPEC and A-SPEC beneath ${specId} (drafts are fine) and write the A-SPEC's `
|
|
217
|
+
+ `Files to Touch, then call spec_approve on ${specId} again — with an A-SPEC beneath it this seal is graded on that `
|
|
218
|
+
+ 'scope, automatically when nothing else holds it; spec_slice_approve seals the chain in order]';
|
|
219
|
+
}
|
|
220
|
+
if (rule === 'files-to-touch-empty') {
|
|
221
|
+
return `\n[next, no person needed: write the paths this change touches under ## Files to Touch in ${specId}, then call spec_approve again]`;
|
|
222
|
+
}
|
|
223
|
+
return '';
|
|
224
|
+
}
|
|
204
225
|
/**
|
|
205
226
|
* @implements A-SPEC-532.3 — the first rule that hands this seal to the owner, or null when none does. Measured
|
|
206
227
|
* 2026-10-04: two gate specs were refused with the generic out-of-band sentence and neither the session nor the owner
|
|
@@ -359,7 +380,30 @@ function autonomousApprovalEnabled(env, root, now) {
|
|
|
359
380
|
}
|
|
360
381
|
// @implements A-SPEC-554.1 — the session-start REMINDER (the headless hook surfaces, it never decides).
|
|
361
382
|
// Only ON postures get a line; OFF is silent (a permanent line is one nobody reads). Wired below.
|
|
362
|
-
|
|
383
|
+
/** @implements A-SPEC-792.7 — the full profile covering `root`, as one line (without the banner prefix), or ''. */
|
|
384
|
+
function fullAutonomyLine(root, home = os.homedir()) {
|
|
385
|
+
let s;
|
|
386
|
+
try {
|
|
387
|
+
s = (0, full_autonomy_1.readFullProfile)(home, root);
|
|
388
|
+
}
|
|
389
|
+
catch {
|
|
390
|
+
return '';
|
|
391
|
+
}
|
|
392
|
+
if (!s.active)
|
|
393
|
+
return '';
|
|
394
|
+
const f = s.entry.flags;
|
|
395
|
+
const onOff = (b) => (b ? 'on' : 'off');
|
|
396
|
+
return `full autonomy: ON (scope ${s.entry.scope}; push ${onOff(f.push)}, publish ${onOff(f.publish)}, architecture ${onOff(f.architecture)}) — no judgment here waits for a person`;
|
|
397
|
+
}
|
|
398
|
+
function autonomyBanner(env, root, now, home) {
|
|
399
|
+
// @implements A-SPEC-792.7 — an active full profile is named first; without one the banner is what it was.
|
|
400
|
+
const full = fullAutonomyLine(root, home);
|
|
401
|
+
const posture = postureBanner(env, root, now);
|
|
402
|
+
if (full === '')
|
|
403
|
+
return posture;
|
|
404
|
+
return `[Holmes-Kit] ${full}; a refusal names its route${posture === '' ? '' : `\n${posture}`}`;
|
|
405
|
+
}
|
|
406
|
+
function postureBanner(env, root, now) {
|
|
363
407
|
const v = env[exports.AUTONOMY_ENV];
|
|
364
408
|
// @implements A-SPEC-771 — one added line names an active run delegation, beside whichever posture line applies.
|
|
365
409
|
const delegation = (0, delegation_1.readDelegation)(root, now);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export declare const FULL_PROFILE_FILE: readonly [".holmes", "full-autonomy.json"];
|
|
2
|
+
export declare const FULL_PROFILE_SCHEMA = "full-autonomy/1";
|
|
3
|
+
export interface FullProfileFlags {
|
|
4
|
+
push: boolean;
|
|
5
|
+
publish: boolean;
|
|
6
|
+
architecture: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface FullProfileEntry {
|
|
9
|
+
scope: string;
|
|
10
|
+
flags: FullProfileFlags;
|
|
11
|
+
issuedAt: string;
|
|
12
|
+
issuedBy: string;
|
|
13
|
+
}
|
|
14
|
+
export type FullProfileState = {
|
|
15
|
+
active: true;
|
|
16
|
+
entry: FullProfileEntry;
|
|
17
|
+
} | {
|
|
18
|
+
active: false;
|
|
19
|
+
why: 'none' | 'unreadable' | 'invalid' | 'outside';
|
|
20
|
+
};
|
|
21
|
+
/** The entry covering `workspace` by real path; the longest scope wins. Fail-closed on every malformed shape. */
|
|
22
|
+
export declare function readFullProfile(home: string, workspace: string): FullProfileState;
|
|
23
|
+
export type FullSealVerdict = {
|
|
24
|
+
outcome: 'seal';
|
|
25
|
+
mark: string;
|
|
26
|
+
} | {
|
|
27
|
+
outcome: 'refuse';
|
|
28
|
+
route: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* @implements A-SPEC-792.4 — what a full scope does with a seal the grader hands to a person: seal it, or refuse it at
|
|
32
|
+
* once with the step that needs no person. Three rules are refused because sealing them would seal something nobody
|
|
33
|
+
* declared (an un-admitted requirement, an undeclared or unknown grade); an architecture document follows its flag.
|
|
34
|
+
*/
|
|
35
|
+
export declare function fullSealVerdict(rule: string, flags: FullProfileFlags): FullSealVerdict;
|
|
36
|
+
export type FullShellVerdict = {
|
|
37
|
+
outcome: 'approve';
|
|
38
|
+
recovery: boolean;
|
|
39
|
+
} | {
|
|
40
|
+
outcome: 'refuse';
|
|
41
|
+
route: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* @implements A-SPEC-792.5 — what a full scope does with a hard-HITL shell verdict. Every reason must be approvable:
|
|
45
|
+
* a workspace-local destructive git act, an rm whose every target sits strictly inside the scope or the scratch root,
|
|
46
|
+
* or a force push the profile allows. Anything else — and anything whose landing place cannot be proven — is refused
|
|
47
|
+
* with a route. The classifier's verdict is never changed; only what happens to it.
|
|
48
|
+
*/
|
|
49
|
+
export declare function fullModeShellVerdict(input: {
|
|
50
|
+
command: string;
|
|
51
|
+
reasons: readonly string[];
|
|
52
|
+
cwd: string;
|
|
53
|
+
workspace: string;
|
|
54
|
+
scratchRoot: string | null;
|
|
55
|
+
entry: FullProfileEntry;
|
|
56
|
+
}): FullShellVerdict;
|
|
57
|
+
/** The tail a full-scope refusal carries instead of a queued request (config, secrets, approvals, code under debt). */
|
|
58
|
+
export declare function fullModeRefusalTail(kind: 'shell' | 'config-write' | 'code-write', route?: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* @implements A-SPEC-792.5 — the recovery point a full-scope destructive act needs first: the whole work tree (tracked
|
|
61
|
+
* and untracked, not ignored) committed through a temporary index and kept under `refs/holmes/full/`. Bounded git calls;
|
|
62
|
+
* any failure is returned so the act is refused.
|
|
63
|
+
*/
|
|
64
|
+
export declare function writeRecoveryRef(workspace: string, now: string): {
|
|
65
|
+
ref: string;
|
|
66
|
+
} | {
|
|
67
|
+
error: string;
|
|
68
|
+
};
|
|
69
|
+
/** Add or replace the entry for `entry.scope` (the caller holds the operator proof). */
|
|
70
|
+
export declare function addFullProfileEntry(home: string, entry: FullProfileEntry): void;
|
|
71
|
+
/** Remove the entry for `scope`, or every entry; returns how many went. Revoking needs no proof. */
|
|
72
|
+
export declare function removeFullProfileEntry(home: string, scope?: string): number;
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.FULL_PROFILE_SCHEMA = exports.FULL_PROFILE_FILE = void 0;
|
|
37
|
+
exports.readFullProfile = readFullProfile;
|
|
38
|
+
exports.fullSealVerdict = fullSealVerdict;
|
|
39
|
+
exports.fullModeShellVerdict = fullModeShellVerdict;
|
|
40
|
+
exports.fullModeRefusalTail = fullModeRefusalTail;
|
|
41
|
+
exports.writeRecoveryRef = writeRecoveryRef;
|
|
42
|
+
exports.addFullProfileEntry = addFullProfileEntry;
|
|
43
|
+
exports.removeFullProfileEntry = removeFullProfileEntry;
|
|
44
|
+
// @implements A-SPEC-792.3, A-SPEC-792.4, A-SPEC-792.5
|
|
45
|
+
// The full autonomy profile (REQ-792) — the fifth envelope. The owner names, once, the scopes (a workspace or a root of
|
|
46
|
+
// workspaces) where no judgment may wait for a person. It lives at user level because a benchmark copies its arm for
|
|
47
|
+
// every run and a workspace-bound document (the run delegation, A-SPEC-771) does not follow the copy. The CLI writes it
|
|
48
|
+
// under operator proof; the gate protects it as user config (A-SPEC-728); anything malformed covers nothing.
|
|
49
|
+
const fs = __importStar(require("node:fs"));
|
|
50
|
+
const path = __importStar(require("node:path"));
|
|
51
|
+
exports.FULL_PROFILE_FILE = ['.holmes', 'full-autonomy.json'];
|
|
52
|
+
exports.FULL_PROFILE_SCHEMA = 'full-autonomy/1';
|
|
53
|
+
const ENTRY_KEYS = new Set(['scope', 'flags', 'issuedAt', 'issuedBy']);
|
|
54
|
+
const FLAG_KEYS = ['push', 'publish', 'architecture'];
|
|
55
|
+
const MAX_BYTES = 64 * 1024;
|
|
56
|
+
function realOrNull(p) {
|
|
57
|
+
try {
|
|
58
|
+
return fs.realpathSync.native(p);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const fold = (p) => (process.platform === 'win32' ? p.toLowerCase() : p);
|
|
65
|
+
/** `scope` covers `target` (both real paths) at a path-segment boundary. */
|
|
66
|
+
function covers(scope, target) {
|
|
67
|
+
const s = fold(scope);
|
|
68
|
+
const t = fold(target);
|
|
69
|
+
return t === s || t.startsWith(s.endsWith(path.sep) ? s : s + path.sep);
|
|
70
|
+
}
|
|
71
|
+
/** One entry, or null when it is not exactly what the CLI writes: closed keys, an absolute real scope, boolean flags. */
|
|
72
|
+
function entryOf(raw) {
|
|
73
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
74
|
+
return null;
|
|
75
|
+
const e = raw;
|
|
76
|
+
if (Object.keys(e).some((k) => !ENTRY_KEYS.has(k)))
|
|
77
|
+
return null;
|
|
78
|
+
if (typeof e.scope !== 'string' || !path.isAbsolute(e.scope))
|
|
79
|
+
return null;
|
|
80
|
+
// A scope that is not its own real path (relative pieces, a link) could be re-pointed after issue: it covers nothing.
|
|
81
|
+
if (realOrNull(e.scope) !== e.scope)
|
|
82
|
+
return null;
|
|
83
|
+
const f = e.flags;
|
|
84
|
+
if (!f || typeof f !== 'object' || Object.keys(f).some((k) => !FLAG_KEYS.includes(k)))
|
|
85
|
+
return null;
|
|
86
|
+
if (FLAG_KEYS.some((k) => typeof f[k] !== 'boolean'))
|
|
87
|
+
return null;
|
|
88
|
+
if (typeof e.issuedAt !== 'string' || typeof e.issuedBy !== 'string')
|
|
89
|
+
return null;
|
|
90
|
+
return { scope: e.scope, flags: { push: f.push, publish: f.publish, architecture: f.architecture }, issuedAt: e.issuedAt, issuedBy: e.issuedBy };
|
|
91
|
+
}
|
|
92
|
+
function readEntries(home) {
|
|
93
|
+
const file = path.join(home, ...exports.FULL_PROFILE_FILE);
|
|
94
|
+
let raw;
|
|
95
|
+
try {
|
|
96
|
+
const st = fs.lstatSync(file);
|
|
97
|
+
if (!st.isFile() || st.size > MAX_BYTES)
|
|
98
|
+
return { why: 'invalid' };
|
|
99
|
+
raw = fs.readFileSync(file, 'utf8');
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
return e.code === 'ENOENT' ? { why: 'none' } : { why: 'unreadable' };
|
|
103
|
+
}
|
|
104
|
+
let doc;
|
|
105
|
+
try {
|
|
106
|
+
doc = JSON.parse(raw);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return { why: 'unreadable' };
|
|
110
|
+
}
|
|
111
|
+
const d = doc;
|
|
112
|
+
if (!d || typeof d !== 'object' || d.schema !== exports.FULL_PROFILE_SCHEMA || !Array.isArray(d.entries))
|
|
113
|
+
return { why: 'invalid' };
|
|
114
|
+
const entries = d.entries.map(entryOf);
|
|
115
|
+
// One forged entry voids the file: the CLI never writes one, so its presence says the file was edited by hand.
|
|
116
|
+
if (entries.some((e) => e === null))
|
|
117
|
+
return { why: 'invalid' };
|
|
118
|
+
return { entries: entries };
|
|
119
|
+
}
|
|
120
|
+
/** The entry covering `workspace` by real path; the longest scope wins. Fail-closed on every malformed shape. */
|
|
121
|
+
function readFullProfile(home, workspace) {
|
|
122
|
+
const r = readEntries(home);
|
|
123
|
+
if ('why' in r)
|
|
124
|
+
return { active: false, why: r.why };
|
|
125
|
+
const target = realOrNull(workspace);
|
|
126
|
+
if (target === null)
|
|
127
|
+
return { active: false, why: 'outside' };
|
|
128
|
+
const hit = r.entries.filter((e) => covers(e.scope, target)).sort((a, b) => b.scope.length - a.scope.length)[0];
|
|
129
|
+
return hit ? { active: true, entry: hit } : { active: false, why: r.entries.length === 0 ? 'none' : 'outside' };
|
|
130
|
+
}
|
|
131
|
+
function writeEntries(home, entries) {
|
|
132
|
+
const file = path.join(home, ...exports.FULL_PROFILE_FILE);
|
|
133
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
134
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
135
|
+
fs.writeFileSync(tmp, JSON.stringify({ schema: exports.FULL_PROFILE_SCHEMA, entries }, null, 2) + '\n', { mode: 0o600 });
|
|
136
|
+
fs.renameSync(tmp, file);
|
|
137
|
+
}
|
|
138
|
+
/** The bare grader rule an upstream reason resolves to (`upstream-has-human-aspec: <id> — <child>` → the child's). */
|
|
139
|
+
function bareRule(rule) {
|
|
140
|
+
const upstream = /^upstream-has-human-aspec: \S+ — (.+)$/.exec(rule);
|
|
141
|
+
return (upstream ? upstream[1] : rule).split(':')[0].trim();
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @implements A-SPEC-792.4 — what a full scope does with a seal the grader hands to a person: seal it, or refuse it at
|
|
145
|
+
* once with the step that needs no person. Three rules are refused because sealing them would seal something nobody
|
|
146
|
+
* declared (an un-admitted requirement, an undeclared or unknown grade); an architecture document follows its flag.
|
|
147
|
+
*/
|
|
148
|
+
function fullSealVerdict(rule, flags) {
|
|
149
|
+
switch (bareRule(rule)) {
|
|
150
|
+
case 'requirement-without-intake':
|
|
151
|
+
return { outcome: 'refuse', route: 'run requirement_triage({ persist: true }) on the requirement\'s prompt and record its triage_evidence on the REQ, then seal again' };
|
|
152
|
+
case 'breaking-change-undeclared':
|
|
153
|
+
return { outcome: 'refuse', route: 'declare breaking_change with one of the grader\'s grades, then seal again' };
|
|
154
|
+
case 'unknown-kind':
|
|
155
|
+
return { outcome: 'refuse', route: 'the spec kind is not one the grader knows — use REQ, H-SPEC, A-SPEC, C-SPEC, T-SPEC or ADR' };
|
|
156
|
+
case 'architecture-document':
|
|
157
|
+
return flags.architecture
|
|
158
|
+
? { outcome: 'seal', mark: ' [architecture document sealed under full autonomy]' }
|
|
159
|
+
: { outcome: 'refuse', route: 'this full profile keeps architecture documents with the owner (issued with --no-architecture)' };
|
|
160
|
+
default:
|
|
161
|
+
return { outcome: 'seal', mark: '' };
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/** Reasons a full scope may approve, by the classifier's own words (risk-classifier.ts), with whether a ref is needed. */
|
|
165
|
+
const WORKSPACE_GIT_ACTS = [/^git reset --hard\b/, /^git clean -f\b/, /^git restore\/checkout \./, /^git branch -D\b/];
|
|
166
|
+
const RM_ACTS = [/^recursive rm of a catastrophic/, /^rm -rf of an unverified target/];
|
|
167
|
+
/** A command that may land somewhere other than the workspace it is judged in. */
|
|
168
|
+
const ELSEWHERE = /(?:^|[\s;&|(`])(?:cd|pushd|chdir)(?:\s|$)|\bgit\s+(?:-C\b|--git-dir\b|--work-tree\b)/;
|
|
169
|
+
/** Text whose targets are only known when the shell runs it. */
|
|
170
|
+
const UNPROVABLE = /[$`*?[\]{}~]|\\/;
|
|
171
|
+
/** Tokens of every `rm` segment, flags dropped; null when a segment cannot be read as plain words. */
|
|
172
|
+
function rmTargetsOf(command) {
|
|
173
|
+
const out = [];
|
|
174
|
+
for (const seg of command.split(/&&|\|\||[;|\n]/)) {
|
|
175
|
+
const words = seg.trim().split(/\s+/).filter(Boolean);
|
|
176
|
+
if (words[0] !== 'rm')
|
|
177
|
+
continue;
|
|
178
|
+
let options = true;
|
|
179
|
+
for (const w of words.slice(1)) {
|
|
180
|
+
if (options && w === '--') {
|
|
181
|
+
options = false;
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if (options && w.startsWith('-'))
|
|
185
|
+
continue;
|
|
186
|
+
const t = w.replace(/^(["'])(.*)\1$/, '$2');
|
|
187
|
+
if (UNPROVABLE.test(t) || /["']/.test(t))
|
|
188
|
+
return null;
|
|
189
|
+
out.push(t);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return out;
|
|
193
|
+
}
|
|
194
|
+
/** The entry's real location: the parent resolved, the last name not followed (rm removes a link, not its target). */
|
|
195
|
+
function entryReal(cwd, target) {
|
|
196
|
+
const abs = path.resolve(cwd, target);
|
|
197
|
+
const parent = realOrNull(path.dirname(abs));
|
|
198
|
+
return parent === null ? null : path.join(parent, path.basename(abs));
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* @implements A-SPEC-792.5 — what a full scope does with a hard-HITL shell verdict. Every reason must be approvable:
|
|
202
|
+
* a workspace-local destructive git act, an rm whose every target sits strictly inside the scope or the scratch root,
|
|
203
|
+
* or a force push the profile allows. Anything else — and anything whose landing place cannot be proven — is refused
|
|
204
|
+
* with a route. The classifier's verdict is never changed; only what happens to it.
|
|
205
|
+
*/
|
|
206
|
+
function fullModeShellVerdict(input) {
|
|
207
|
+
const { command, reasons, entry } = input;
|
|
208
|
+
if (ELSEWHERE.test(command)) {
|
|
209
|
+
return { outcome: 'refuse', route: 'the command changes directory or names another work tree, so where it lands cannot be proven — run the act from the workspace without cd, pushd or git -C' };
|
|
210
|
+
}
|
|
211
|
+
let recovery = false;
|
|
212
|
+
for (const reason of reasons) {
|
|
213
|
+
if (/^git push --force/.test(reason)) {
|
|
214
|
+
if (!entry.flags.push)
|
|
215
|
+
return { outcome: 'refuse', route: 'this full profile keeps force pushes with the owner (issued without --allow-push)' };
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
if (WORKSPACE_GIT_ACTS.some((re) => re.test(reason))) {
|
|
219
|
+
recovery = true;
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
if (RM_ACTS.some((re) => re.test(reason))) {
|
|
223
|
+
const targets = rmTargetsOf(command);
|
|
224
|
+
if (targets === null || targets.length === 0)
|
|
225
|
+
return { outcome: 'refuse', route: 'an rm whose targets are only known when the shell runs it (globs, variables, quotes) cannot be proven inside the scope — name each target literally' };
|
|
226
|
+
const workspace = realOrNull(input.workspace) ?? input.workspace;
|
|
227
|
+
for (const t of targets) {
|
|
228
|
+
const real = entryReal(input.cwd, t);
|
|
229
|
+
if (real === null)
|
|
230
|
+
return { outcome: 'refuse', route: `cannot resolve ${t} — name a target whose parent directory exists` };
|
|
231
|
+
const inScratch = input.scratchRoot !== null && covers(input.scratchRoot, real) && fold(real) !== fold(input.scratchRoot);
|
|
232
|
+
const inScope = covers(entry.scope, real) && fold(real) !== fold(entry.scope) && !covers(real, workspace);
|
|
233
|
+
if (!inScratch && !inScope)
|
|
234
|
+
return { outcome: 'refuse', route: `${t} resolves outside the full scope (${entry.scope}) and the scratch root — full autonomy removes only what lies inside them` };
|
|
235
|
+
if (!inScratch && covers(workspace, real))
|
|
236
|
+
recovery = true;
|
|
237
|
+
}
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
return { outcome: 'refuse', route: `full autonomy approves only workspace-local destructive git acts and scoped rm; this act (${reason.split(' — ')[0]}) is refused` };
|
|
241
|
+
}
|
|
242
|
+
return { outcome: 'approve', recovery };
|
|
243
|
+
}
|
|
244
|
+
/** The tail a full-scope refusal carries instead of a queued request (config, secrets, approvals, code under debt). */
|
|
245
|
+
function fullModeRefusalTail(kind, route) {
|
|
246
|
+
const why = route ?? (kind === 'code-write'
|
|
247
|
+
? 'resolve the constitution debt this refusal names'
|
|
248
|
+
: 'this act widens the agent\'s own authority (configuration, secrets or approvals) and is refused without asking');
|
|
249
|
+
return ` — full autonomy: ${why}; no approval request was filed`;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* @implements A-SPEC-792.5 — the recovery point a full-scope destructive act needs first: the whole work tree (tracked
|
|
253
|
+
* and untracked, not ignored) committed through a temporary index and kept under `refs/holmes/full/`. Bounded git calls;
|
|
254
|
+
* any failure is returned so the act is refused.
|
|
255
|
+
*/
|
|
256
|
+
function writeRecoveryRef(workspace, now) {
|
|
257
|
+
const { execFileSync } = require('node:child_process');
|
|
258
|
+
const os = require('node:os');
|
|
259
|
+
const run = (args, env) => execFileSync('git', args, {
|
|
260
|
+
cwd: workspace, encoding: 'utf8', timeout: 20_000, maxBuffer: 4 * 1024 * 1024, stdio: ['ignore', 'pipe', 'pipe'],
|
|
261
|
+
env: { ...process.env, ...env, GIT_TERMINAL_PROMPT: '0' },
|
|
262
|
+
}).trim();
|
|
263
|
+
let step = 'git rev-parse HEAD';
|
|
264
|
+
const index = path.join(os.tmpdir(), `holmes-full-${process.pid}-${Date.now()}.index`);
|
|
265
|
+
try {
|
|
266
|
+
const head = run(['rev-parse', '--verify', 'HEAD']);
|
|
267
|
+
step = 'git add -A (temporary index)';
|
|
268
|
+
run(['add', '-A'], { GIT_INDEX_FILE: index });
|
|
269
|
+
step = 'git write-tree';
|
|
270
|
+
const tree = run(['write-tree'], { GIT_INDEX_FILE: index });
|
|
271
|
+
step = 'git commit-tree';
|
|
272
|
+
const commit = run(['commit-tree', tree, '-p', head, '-m', `holmes full-autonomy recovery point ${now}`], { GIT_AUTHOR_NAME: 'holmes-kit', GIT_AUTHOR_EMAIL: 'holmes-kit@localhost', GIT_COMMITTER_NAME: 'holmes-kit', GIT_COMMITTER_EMAIL: 'holmes-kit@localhost' });
|
|
273
|
+
step = 'git update-ref';
|
|
274
|
+
const ref = `refs/holmes/full/${now.replace(/[^0-9TZ]/g, '')}-${commit.slice(0, 8)}`;
|
|
275
|
+
run(['update-ref', ref, commit]);
|
|
276
|
+
return { ref };
|
|
277
|
+
}
|
|
278
|
+
catch (e) {
|
|
279
|
+
return { error: `the recovery point could not be written (${step}: ${String(e.message ?? e).split('\n')[0].slice(0, 160)})` };
|
|
280
|
+
}
|
|
281
|
+
finally {
|
|
282
|
+
fs.rmSync(index, { force: true });
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
/** Add or replace the entry for `entry.scope` (the caller holds the operator proof). */
|
|
286
|
+
function addFullProfileEntry(home, entry) {
|
|
287
|
+
const r = readEntries(home);
|
|
288
|
+
const kept = 'entries' in r ? r.entries.filter((e) => fold(e.scope) !== fold(entry.scope)) : [];
|
|
289
|
+
writeEntries(home, [...kept, entry]);
|
|
290
|
+
}
|
|
291
|
+
/** Remove the entry for `scope`, or every entry; returns how many went. Revoking needs no proof. */
|
|
292
|
+
function removeFullProfileEntry(home, scope) {
|
|
293
|
+
const r = readEntries(home);
|
|
294
|
+
if (!('entries' in r)) {
|
|
295
|
+
// An unreadable or forged file is removed whole when everything is revoked; a single-scope revoke leaves it.
|
|
296
|
+
if (scope === undefined && r.why !== 'none') {
|
|
297
|
+
fs.rmSync(path.join(home, ...exports.FULL_PROFILE_FILE), { force: true });
|
|
298
|
+
return 1;
|
|
299
|
+
}
|
|
300
|
+
return 0;
|
|
301
|
+
}
|
|
302
|
+
const want = scope === undefined ? null : fold(realOrNull(scope) ?? scope);
|
|
303
|
+
const kept = want === null ? [] : r.entries.filter((e) => fold(e.scope) !== want);
|
|
304
|
+
const removed = r.entries.length - kept.length;
|
|
305
|
+
if (removed > 0)
|
|
306
|
+
writeEntries(home, kept);
|
|
307
|
+
return removed;
|
|
308
|
+
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.agentProcessReason = agentProcessReason;
|
|
4
4
|
exports.setOperatorProbeForTests = setOperatorProbeForTests;
|
|
5
5
|
exports.operatorActGuard = operatorActGuard;
|
|
6
|
-
// @implements A-SPEC-779.4, A-SPEC-779.6
|
|
6
|
+
// @implements A-SPEC-779.4, A-SPEC-779.6, A-SPEC-792.1
|
|
7
7
|
/**
|
|
8
8
|
* Who may grant. The refusal text prints the very command that approves it, so a model following that text from its
|
|
9
9
|
* own shell approved itself (measured on 0.36.1). A granting act here refuses a process that an agent harness started:
|
|
@@ -38,6 +38,7 @@ function operatorActGuard(act) {
|
|
|
38
38
|
const remedy = why.startsWith(UNREADABLE)
|
|
39
39
|
? 'The operator decides in the session\'s approval dialog (approval_ask) — this process\'s parents could not be read, '
|
|
40
40
|
+ 'so it cannot be told apart from an agent\'s.'
|
|
41
|
-
|
|
41
|
+
// @implements A-SPEC-792.1 — the dialog only; a typed command is not offered.
|
|
42
|
+
: 'The operator decides in the session\'s approval dialog (approval_ask).';
|
|
42
43
|
return `${act} is the operator's — this process runs under an agent harness (${why}). ${remedy}`;
|
|
43
44
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// @implements A-SPEC-777, A-SPEC-778, A-SPEC-779, A-SPEC-780, A-SPEC-781.1, A-SPEC-778.2, A-SPEC-790.3, A-SPEC-476.4
|
|
2
|
+
// @implements A-SPEC-777, A-SPEC-778, A-SPEC-779, A-SPEC-780, A-SPEC-781.1, A-SPEC-778.2, A-SPEC-790.3, A-SPEC-476.4, A-SPEC-792.1, A-SPEC-792.8
|
|
3
3
|
/**
|
|
4
4
|
* @implements A-SPEC-777 — a refusal's kind, readable by a program. An orchestrator retries a `retryable` refusal,
|
|
5
5
|
* pauses for a person on `needs_hitl`, and changes its plan on `permanent`. The prose stays for people; the line
|
|
@@ -17,7 +17,8 @@ exports.REFUSAL_CODES = [
|
|
|
17
17
|
{
|
|
18
18
|
// @implements A-SPEC-779 — a run waiting for the operator's decision: retry after it, never around it.
|
|
19
19
|
code: 'run.awaiting-approval', class: 'retryable',
|
|
20
|
-
|
|
20
|
+
// @implements A-SPEC-792.1 — the session form, never a typed command.
|
|
21
|
+
remediation: ['wait: the person decides the request in the interactive session\'s approval form', 'retry after the decision; do not work around it'],
|
|
21
22
|
test: /this run is awaiting approval/i,
|
|
22
23
|
},
|
|
23
24
|
{
|
|
@@ -26,6 +27,13 @@ exports.REFUSAL_CODES = [
|
|
|
26
27
|
remediation: ['stop working in this run', 'the operator ends it with holmes-kit run stop and starts a new run'],
|
|
27
28
|
test: /this run stopped|this run is now stopped|this run stalled|was not decided within|the Holmes install changed since run start/i, // A-SPEC-778.1/778.2: stalled
|
|
28
29
|
},
|
|
30
|
+
{
|
|
31
|
+
// @implements A-SPEC-792.8 — under a full profile nothing was filed and no person decides; ahead of every row that
|
|
32
|
+
// would send an orchestrator to approval_ask or to the operator.
|
|
33
|
+
code: 'full-autonomy.refused', class: 'permanent',
|
|
34
|
+
remediation: ['no person decides this: full autonomy refused it without filing a request — do not call approval_ask', 'follow the route the refusal names, or change the plan'],
|
|
35
|
+
test: /full autonomy: [^\n]*no approval request was filed/i,
|
|
36
|
+
},
|
|
29
37
|
{
|
|
30
38
|
code: 'gate.unjudgeable', class: 'retryable',
|
|
31
39
|
remediation: ['split the command or edit into smaller parts', 'retry; if it repeats, ask the operator'],
|
|
@@ -56,7 +64,7 @@ exports.REFUSAL_CODES = [
|
|
|
56
64
|
{
|
|
57
65
|
// @implements A-SPEC-779.1 — a grant refused because it is not the operator's, or a run may await it.
|
|
58
66
|
code: 'grant.operator-only', class: 'needs_hitl',
|
|
59
|
-
remediation: ['
|
|
67
|
+
remediation: ['call approval_ask with the request id — the person decides in the session approval form'],
|
|
60
68
|
// @implements A-SPEC-779.4 — and a granting act from a process an agent harness started.
|
|
61
69
|
test: /a grant is the operator's|is awaited by run|cannot tell whether a run awaits|runs under an agent harness/i,
|
|
62
70
|
},
|
|
@@ -69,7 +77,8 @@ exports.REFUSAL_CODES = [
|
|
|
69
77
|
{
|
|
70
78
|
code: 'approval.required', class: 'needs_hitl',
|
|
71
79
|
// @implements A-SPEC-718.5 — the in-session route first; the terminal command is the operator's alternative.
|
|
72
|
-
|
|
80
|
+
// A-SPEC-792.1 — the session form is the one route; no command to run is offered.
|
|
81
|
+
remediation: ['call approval_ask with the request id — the person decides in the session form', 'after the decision, retry the refused act once'],
|
|
73
82
|
// @implements A-SPEC-476.4 — and raising an owner cap, or a shell write over one (A-SPEC-476.3).
|
|
74
83
|
test: /hard-hitl|Integrity\]|Governance Path Destruction|requires operator|raises or removes a project cap|sets a project cap/i,
|
|
75
84
|
},
|