@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
|
@@ -47,7 +47,7 @@ exports.classifyArchitectureReversal = classifyArchitectureReversal;
|
|
|
47
47
|
exports.classifySecret = classifySecret;
|
|
48
48
|
exports.classifyBlastRadius = classifyBlastRadius;
|
|
49
49
|
exports.assessRisk = assessRisk;
|
|
50
|
-
// @implements A-SPEC-125.1, A-SPEC-773, A-SPEC-773.1, A-SPEC-773.2, A-SPEC-627,A-SPEC-728,A-SPEC-737, A-SPEC-747, A-SPEC-753, A-SPEC-747.1, A-SPEC-226.1, A-SPEC-226.2, A-SPEC-747.3, A-SPEC-226.3, A-SPEC-747.9, A-SPEC-728.3
|
|
50
|
+
// @implements A-SPEC-125.1, A-SPEC-773, A-SPEC-773.1, A-SPEC-773.2, A-SPEC-627,A-SPEC-728,A-SPEC-737, A-SPEC-747, A-SPEC-753, A-SPEC-747.1, A-SPEC-226.1, A-SPEC-226.2, A-SPEC-747.3, A-SPEC-226.3, A-SPEC-747.9, A-SPEC-728.3, A-SPEC-773.4
|
|
51
51
|
const fs = __importStar(require("node:fs"));
|
|
52
52
|
const path = __importStar(require("node:path"));
|
|
53
53
|
const shell_argument_roles_1 = require("./shell-argument-roles");
|
|
@@ -260,7 +260,9 @@ function rmDangerReason(cmd, signals) {
|
|
|
260
260
|
// @implements A-SPEC-773.2 — an absolute target is where an agent's temporary work usually is: name the place
|
|
261
261
|
// whose directories it may remove (round 1, quality: nothing told an agent the scratch root exists).
|
|
262
262
|
const hint = targets.some((t) => t.replace(/^["']/, '').startsWith('/'))
|
|
263
|
-
|
|
263
|
+
// @implements A-SPEC-773.4 — say what the command gives back and that it needs no person (G0 round 1: 4 of 6 runs
|
|
264
|
+
// filed an approval request for an rm of their own /tmp directory instead).
|
|
265
|
+
? '; no person needed for temporary work: `holmes-kit scratch --new <label>` prints a directory that you may create, fill and rm -rf — use it instead of /tmp (POSIX)' : '';
|
|
264
266
|
return `recursive rm of a catastrophic / version-controlled / out-of-project / system target — whole-tree destruction${hint}`;
|
|
265
267
|
}
|
|
266
268
|
if (targets.length > 0 && safeties.every((s) => s === 'safe'))
|
|
@@ -1860,7 +1862,9 @@ function classifyReversibilityAsWritten(action) {
|
|
|
1860
1862
|
return {
|
|
1861
1863
|
axis,
|
|
1862
1864
|
level: 'hard-hitl',
|
|
1863
|
-
|
|
1865
|
+
// @implements A-SPEC-773.4 — name the reads the gate already admits (G0 round 1: 5 of 6 runs filed an approval
|
|
1866
|
+
// request for a read loop it could not judge, while one read command with a glob passes).
|
|
1867
|
+
reasons: ['shell command over a protected .ax governance path is not recognisably read-only; to read, use one read command with literal paths or a glob — `cat .ax/specs/*/<ID>.md | head`, `grep -n <word> .ax/specs/…`, `sed -n 1,80p <file>` — or the Read tool; loops, xargs and sh -c are not judged as reads'],
|
|
1864
1868
|
};
|
|
1865
1869
|
}
|
|
1866
1870
|
// @implements A-SPEC-226.3 — the same act without the spelling.
|
|
@@ -45,7 +45,7 @@ exports.applyRunRefusalStop = applyRunRefusalStop;
|
|
|
45
45
|
exports.recordRunStopBlock = recordRunStopBlock;
|
|
46
46
|
exports.runState = runState;
|
|
47
47
|
exports.grantGuard = grantGuard;
|
|
48
|
-
// @implements A-SPEC-778, A-SPEC-779, A-SPEC-780, A-SPEC-781, A-SPEC-780.1, A-SPEC-774.20, A-SPEC-781.2, A-SPEC-770.12, A-SPEC-778.1, A-SPEC-779.2
|
|
48
|
+
// @implements A-SPEC-778, A-SPEC-779, A-SPEC-780, A-SPEC-781, A-SPEC-780.1, A-SPEC-774.20, A-SPEC-781.2, A-SPEC-770.12, A-SPEC-778.1, A-SPEC-779.2, A-SPEC-792.1
|
|
49
49
|
/**
|
|
50
50
|
* @implements A-SPEC-778 — a refusal loop in a run ends in a stop the orchestrator can read, not in a used-up budget.
|
|
51
51
|
* Every PreToolUse refusal of a run is appended to `<main>/.ax/state/run-refusals/<run>.jsonl` (a protected path the
|
|
@@ -247,7 +247,8 @@ function applyRunRefusalStop(out, ctx) {
|
|
|
247
247
|
return {
|
|
248
248
|
permissionDecision: 'deny',
|
|
249
249
|
permissionDecisionReason: `[Holmes-Kit] this run is awaiting approval ${wait.request} (${wait.code ?? 'approval'}) since ${wait.ts} — `
|
|
250
|
-
|
|
250
|
+
// @implements A-SPEC-792.1 — the interactive session's form (A-SPEC-779.5), never a command to type.
|
|
251
|
+
+ `the person decides it in the interactive session's approval form (approval_ask with id "${wait.request}", workspace ${queueRoot}); `
|
|
251
252
|
+ `until then every tool call of this run is refused (the wait stops the run after ${cfg.approvalWaitMinutes} minutes)`,
|
|
252
253
|
};
|
|
253
254
|
}
|
|
@@ -262,7 +263,7 @@ function applyRunRefusalStop(out, ctx) {
|
|
|
262
263
|
const request = REQUEST_RE.exec(reason)?.[1];
|
|
263
264
|
if (request && rc.class === 'needs_hitl'
|
|
264
265
|
&& append(file, { ts: now.toISOString(), event: 'awaiting_approval', request, code: rc.code, queue_root: ctx.projectRoot })) {
|
|
265
|
-
next += `\n[Holmes-Kit] this run now awaits approval ${request}: until the
|
|
266
|
+
next += `\n[Holmes-Kit] this run now awaits approval ${request}: until the person decides it in the interactive session's approval form, every tool call of this run is refused`;
|
|
266
267
|
}
|
|
267
268
|
const count = events.filter((e) => e.event === 'refusal' && e.code === rc.code).length + 1;
|
|
268
269
|
if (count >= limit)
|
|
@@ -321,13 +322,13 @@ function runState(main, runId, opts) {
|
|
|
321
322
|
function grantGuard(root, id, opts) {
|
|
322
323
|
const marker = opts.env.HOLMES_RUN_ID;
|
|
323
324
|
if (typeof marker === 'string' && marker.trim() !== '') {
|
|
324
|
-
return 'a grant is the operator\'s,
|
|
325
|
+
return 'a grant is the operator\'s, in an interactive session\'s approval form — not from inside a run (HOLMES_RUN_ID is set in this process)';
|
|
325
326
|
}
|
|
326
327
|
if (opts.interactive)
|
|
327
328
|
return null;
|
|
328
329
|
const dir = (0, exports.runRefusalsDir)((0, run_records_1.mainCheckoutOf)(root));
|
|
329
330
|
// @implements A-SPEC-779.1 — a log that cannot be read cannot say no run awaits the request: refuse, naming it.
|
|
330
|
-
const unknown = (what) => `cannot tell whether a run awaits ${id}: the run logs cannot be read (${what}) — the
|
|
331
|
+
const unknown = (what) => `cannot tell whether a run awaits ${id}: the run logs cannot be read (${what}) — the person decides it in an interactive session's approval form`;
|
|
331
332
|
let names;
|
|
332
333
|
try {
|
|
333
334
|
names = fs.readdirSync(dir).filter((n) => n.endsWith('.jsonl'));
|
|
@@ -341,7 +342,7 @@ function grantGuard(root, id, opts) {
|
|
|
341
342
|
return unknown(path.join(dir, n));
|
|
342
343
|
const wait = openWait(events);
|
|
343
344
|
if (wait && wait.request === id) {
|
|
344
|
-
return `${id} is awaited by run ${n.slice(0, -'.jsonl'.length)}; the
|
|
345
|
+
return `${id} is awaited by run ${n.slice(0, -'.jsonl'.length)}; the person decides it in an interactive session's approval form (this CLI is not attached to a terminal)`;
|
|
345
346
|
}
|
|
346
347
|
}
|
|
347
348
|
return null;
|
|
@@ -73,7 +73,7 @@ exports.commandBases = commandBases;
|
|
|
73
73
|
exports.shellSegments = shellSegments;
|
|
74
74
|
exports.resolvesInside = resolvesInside;
|
|
75
75
|
exports.foreignMcpPaths = foreignMcpPaths;
|
|
76
|
-
// @implements A-SPEC-728, A-SPEC-733, A-SPEC-163, A-SPEC-627, A-SPEC-768.2, A-SPEC-768.3, A-SPEC-163.8, A-SPEC-476.3, A-SPEC-476.7
|
|
76
|
+
// @implements A-SPEC-728, A-SPEC-733, A-SPEC-163, A-SPEC-627, A-SPEC-768.2, A-SPEC-768.3, A-SPEC-163.8, A-SPEC-476.3, A-SPEC-476.7, A-SPEC-792.3
|
|
77
77
|
const fs = __importStar(require("node:fs"));
|
|
78
78
|
const path = __importStar(require("node:path"));
|
|
79
79
|
const os = __importStar(require("node:os"));
|
|
@@ -863,6 +863,9 @@ function wiringDirs(root, env, home) {
|
|
|
863
863
|
const out = [
|
|
864
864
|
{ dir: path.join(home, '.claude'), name: SETTINGS_NAME, known: ['settings.json', 'settings.local.json'], label: (n) => `~/.claude/${n}`, dirIsWiring: true },
|
|
865
865
|
...codexHomes(env, home).map((dir) => ({ dir, name: /^(?:config\.toml|hooks\.json)$/i, known: ['config.toml', 'hooks.json'], label: (n) => `Codex user ${n}`, dirIsWiring: true })),
|
|
866
|
+
// @implements A-SPEC-792.3 — the full autonomy profile: written by the operator CLI only; ~/.holmes itself is not
|
|
867
|
+
// wiring (its update cache and runtime copies keep their own rules).
|
|
868
|
+
{ dir: path.join(home, '.holmes'), name: /^full-autonomy\.json$/i, known: ['full-autonomy.json'], label: () => '~/.holmes/full-autonomy.json', dirIsWiring: false },
|
|
866
869
|
];
|
|
867
870
|
if (root !== null) {
|
|
868
871
|
out.push({ dir: path.join(root, '.claude'), name: SETTINGS_NAME, known: ['settings.json', 'settings.local.json'], label: (n) => `.claude/${n}`, dirIsWiring: true }, { dir: root, name: /^\.mcp\.json$/i, known: ['.mcp.json'], label: () => '.mcp.json', dirIsWiring: false }, ...(capsOutOfScope ? [] : [{ dir: root, name: /^ax\.config\.json$/i, known: [exports.PROJECT_CAPS_LABEL], label: () => exports.PROJECT_CAPS_LABEL, dirIsWiring: false }]), { dir: path.join(root, '.agents'), name: /^(?:hooks|mcp_config)\.json$/i, known: ['hooks.json', 'mcp_config.json'], label: (n) => `.agents/${n}`, dirIsWiring: true }, { dir: path.join(root, '.codex'), name: /^(?:config\.toml|mcp_config\.json)$/i, known: ['config.toml', 'mcp_config.json'], label: (n) => `.codex/${n}`, dirIsWiring: true },
|
|
@@ -286,6 +286,8 @@ export declare function evaluateHook(input: {
|
|
|
286
286
|
approvals: Approval[];
|
|
287
287
|
};
|
|
288
288
|
onApprovalsSpent?: (approvals: Approval[]) => void;
|
|
289
|
+
/** @implements A-SPEC-792.5 — the home whose full autonomy profile applies (default os.homedir()); a test seam. */
|
|
290
|
+
home?: string;
|
|
289
291
|
}): {
|
|
290
292
|
permissionDecision: 'allow' | 'deny';
|
|
291
293
|
permissionDecisionReason?: string;
|
|
@@ -53,7 +53,7 @@ exports.gateErrorDecision = gateErrorDecision;
|
|
|
53
53
|
exports.wiredSpecsDir = wiredSpecsDir;
|
|
54
54
|
exports.evaluateHook = evaluateHook;
|
|
55
55
|
exports.readSpecsSync = readSpecsSync;
|
|
56
|
-
// @implements A-SPEC-476.7, A-SPEC-226.3, A-SPEC-774.28, A-SPEC-747.4, A-SPEC-747.7, A-SPEC-774.23, A-SPEC-753.3, A-SPEC-773, A-SPEC-773.1, A-SPEC-773.2, A-SPEC-134.2,A-SPEC-278,A-SPEC-733, A-SPEC-734, A-SPEC-747, A-SPEC-477.1, A-SPEC-753, A-SPEC-163.7, A-SPEC-768.2, A-SPEC-772.1, A-SPEC-747.3, A-SPEC-774.26, A-SPEC-163.8, A-SPEC-790, A-SPEC-790.2, A-SPEC-790.7, A-SPEC-790.8
|
|
56
|
+
// @implements A-SPEC-476.7, A-SPEC-226.3, A-SPEC-774.28, A-SPEC-747.4, A-SPEC-747.7, A-SPEC-774.23, A-SPEC-753.3, A-SPEC-773, A-SPEC-773.1, A-SPEC-773.2, A-SPEC-134.2,A-SPEC-278,A-SPEC-733, A-SPEC-734, A-SPEC-747, A-SPEC-477.1, A-SPEC-753, A-SPEC-163.7, A-SPEC-768.2, A-SPEC-772.1, A-SPEC-747.3, A-SPEC-774.26, A-SPEC-163.8, A-SPEC-790, A-SPEC-790.2, A-SPEC-790.7, A-SPEC-790.8, A-SPEC-792.5
|
|
57
57
|
const powershell_shell_1 = require("../guardrail/powershell-shell");
|
|
58
58
|
const shell_argument_roles_1 = require("../guardrail/shell-argument-roles");
|
|
59
59
|
// @implements A-SPEC-549.3 — the hook's deny reasons are English here; hooks-english.test.ts drives
|
|
@@ -64,6 +64,8 @@ const shell_argument_roles_1 = require("../guardrail/shell-argument-roles");
|
|
|
64
64
|
const registry_1 = require("../messages/registry");
|
|
65
65
|
const root_1 = require("../project/root");
|
|
66
66
|
const scratch_root_1 = require("../project/scratch-root");
|
|
67
|
+
const crypto = __importStar(require("node:crypto"));
|
|
68
|
+
const full_autonomy_1 = require("../governance/full-autonomy"); // @implements A-SPEC-792.5
|
|
67
69
|
const fs = __importStar(require("node:fs"));
|
|
68
70
|
const path = __importStar(require("node:path"));
|
|
69
71
|
const os = __importStar(require("node:os"));
|
|
@@ -1733,6 +1735,22 @@ function evaluateHook(input, specsDir, opts) {
|
|
|
1733
1735
|
}
|
|
1734
1736
|
// @implements A-SPEC-133 — resolved once so every gate in this call shares one timestamp.
|
|
1735
1737
|
const nowTs = opts?.now ?? new Date().toISOString();
|
|
1738
|
+
// @implements A-SPEC-792.5 — the full autonomy profile covering this project, read at most once per call. Under it no
|
|
1739
|
+
// refusal files a request: every place that would queue one answers with the route instead.
|
|
1740
|
+
let fullCache;
|
|
1741
|
+
const fullEntry = () => {
|
|
1742
|
+
if (fullCache === undefined) {
|
|
1743
|
+
try {
|
|
1744
|
+
const s = (0, full_autonomy_1.readFullProfile)(opts.home ?? os.homedir(), opts.projectRoot);
|
|
1745
|
+
fullCache = s.active ? s.entry : null;
|
|
1746
|
+
}
|
|
1747
|
+
catch {
|
|
1748
|
+
fullCache = null;
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
return fullCache;
|
|
1752
|
+
};
|
|
1753
|
+
const hintOrRoute = (req, extra) => (fullEntry() !== null ? (0, full_autonomy_1.fullModeRefusalTail)(req.kind) : (0, approval_queue_1.queueHint)(opts.projectRoot, req, extra));
|
|
1736
1754
|
// @implements A-SPEC-125.4
|
|
1737
1755
|
// Bash/shell risk gate: this branch runs BEFORE the Write/Edit phaseCheck logic below and
|
|
1738
1756
|
// is intentionally fail-CLOSED — a classifier throw on the Bash surface denies, never
|
|
@@ -1822,14 +1840,41 @@ function evaluateHook(input, specsDir, opts) {
|
|
|
1822
1840
|
// @implements A-SPEC-244 — the refusal itself files the review request. The queue kind is the
|
|
1823
1841
|
// approval SCOPE kind ('shell'), so the reviewing CLI can mint a covering grant mechanically.
|
|
1824
1842
|
hardHitlCovered = covers;
|
|
1825
|
-
|
|
1843
|
+
const full = covers ? null : fullEntry();
|
|
1844
|
+
if (full !== null) {
|
|
1845
|
+
// @implements A-SPEC-792.5 — a full scope approves a scoped destructive act after a recovery point and refuses
|
|
1846
|
+
// every other act at once; nothing is filed, so a run never waits on it.
|
|
1847
|
+
const v = (0, full_autonomy_1.fullModeShellVerdict)({ command, reasons: assessment.reasons, cwd: shellBase, workspace: opts.projectRoot, scratchRoot: (0, scratch_root_1.trustedScratchRoot)(), entry: full });
|
|
1848
|
+
if (v.outcome === 'refuse')
|
|
1849
|
+
return deny(`refused${(0, full_autonomy_1.fullModeRefusalTail)('shell', v.route)}`);
|
|
1850
|
+
let recoveryRef;
|
|
1851
|
+
if (v.recovery) {
|
|
1852
|
+
const r = (0, full_autonomy_1.writeRecoveryRef)(opts.projectRoot, nowTs);
|
|
1853
|
+
if ('error' in r)
|
|
1854
|
+
return deny(`refused${(0, full_autonomy_1.fullModeRefusalTail)('shell', r.error)}`);
|
|
1855
|
+
recoveryRef = r.ref;
|
|
1856
|
+
}
|
|
1857
|
+
try {
|
|
1858
|
+
new ledger_store_1.FileLedgerStore(path.join(opts.projectRoot, '.ax', 'ledger')).append({
|
|
1859
|
+
ts: nowTs, actor: `full-autonomy:${full.scope}`, kind: 'full-autonomy-approved',
|
|
1860
|
+
summary: `hard-hitl shell act approved under full autonomy${recoveryRef ? ` (recovery ${recoveryRef})` : ''}`.slice(0, 200),
|
|
1861
|
+
inputs: [crypto.createHash('sha256').update(command).digest('hex')],
|
|
1862
|
+
rationale: assessment.reasons.join('; ').slice(0, 300),
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1865
|
+
catch { /* the act is approved; the audit row is best effort like the other gate records */ }
|
|
1866
|
+
hardHitlCovered = true;
|
|
1867
|
+
}
|
|
1868
|
+
else if (!covers) {
|
|
1826
1869
|
// @implements A-SPEC-564.2 — the base reason's length rides along so the refusal record
|
|
1827
1870
|
// knows the FULL feedback cost (base + hint), not just the hint's half.
|
|
1828
1871
|
const base = 'requires an approval that covers this command';
|
|
1829
1872
|
return deny(base
|
|
1830
1873
|
+ (0, approval_queue_1.queueHint)(opts.projectRoot, { kind: 'shell', target: command, why: assessment.reasons.join('; ') }, { baseReasonBytes: base.length }));
|
|
1831
1874
|
}
|
|
1832
|
-
|
|
1875
|
+
else {
|
|
1876
|
+
pendingApprovals.push(resolved);
|
|
1877
|
+
}
|
|
1833
1878
|
}
|
|
1834
1879
|
// Bash BYPASS gates (adversarial review: `cat > evil.ts` created ungoverned files, `echo x >
|
|
1835
1880
|
// .claude/settings.json` forged hook config, and `echo $HOLMES_LEDGER_KEY` harvested the very
|
|
@@ -1959,7 +2004,7 @@ function evaluateHook(input, specsDir, opts) {
|
|
|
1959
2004
|
: '[Holmes-Kit] command reads or dumps process environment (holds out-of-band approval secrets) — requires operator approval';
|
|
1960
2005
|
const resolved = resolveForCommand('config-write');
|
|
1961
2006
|
if (!resolved) {
|
|
1962
|
-
let hint = (
|
|
2007
|
+
let hint = hintOrRoute({ kind: 'config-write', target: command, why: reason }); // A-SPEC-792.5
|
|
1963
2008
|
// The queue deliberately suppresses duplicate writes, not the pending operator decision.
|
|
1964
2009
|
const id = (0, approval_queue_1.approvalRequestId)('config-write', command);
|
|
1965
2010
|
if (!hint && (0, approval_queue_1.readQueue)(opts.projectRoot).pending.some((request) => request.id === id)) {
|
|
@@ -2173,7 +2218,7 @@ function evaluateHook(input, specsDir, opts) {
|
|
|
2173
2218
|
return null;
|
|
2174
2219
|
}
|
|
2175
2220
|
return { permissionDecision: 'deny', permissionDecisionReason: `[Holmes-Kit] ${why} — an out-of-band approval that includes config-write is required (A-SPEC-728)`
|
|
2176
|
-
+ (
|
|
2221
|
+
+ hintOrRoute({ kind: 'config-write', target: command, why }) }; // A-SPEC-792.5
|
|
2177
2222
|
};
|
|
2178
2223
|
let configWriteLifted = false;
|
|
2179
2224
|
if (userCfgKind) {
|
|
@@ -2675,7 +2720,7 @@ function evaluateHook(input, specsDir, opts) {
|
|
|
2675
2720
|
const userResolved = (0, approval_grants_1.resolveApproval)(opts.projectRoot, weApproval, { kind: 'config-write', target: norm }, nowTs);
|
|
2676
2721
|
if (userResolved === undefined) {
|
|
2677
2722
|
return { permissionDecision: 'deny', permissionDecisionReason: `[Holmes-Kit] ${userKind} is a hook/approval config — it can forge HOLMES_APPROVAL or turn governance off, so an out-of-band approval that includes config-write is required`
|
|
2678
|
-
+ (
|
|
2723
|
+
+ hintOrRoute({ kind: 'config-write', target: norm, why: `writing ${userKind}` }) }; // A-SPEC-792.5
|
|
2679
2724
|
}
|
|
2680
2725
|
if (userResolved.source === 'grant' && userResolved.approval.nonce)
|
|
2681
2726
|
(0, approval_grants_1.consumeGrantFile)(opts.projectRoot, userResolved.approval.nonce);
|
|
@@ -2721,7 +2766,7 @@ function evaluateHook(input, specsDir, opts) {
|
|
|
2721
2766
|
permissionDecision: 'deny',
|
|
2722
2767
|
permissionDecisionReason: '[Holmes-Kit] the role policy (.ax/roles/) defines the very authority this gate enforces —'
|
|
2723
2768
|
+ ' an agent cannot change it itself. An out-of-band approval that includes config-write is required.'
|
|
2724
|
-
+ (
|
|
2769
|
+
+ hintOrRoute({ kind: 'config-write', target: norm, why: 'writing the role policy (.ax/roles/)' }), // A-SPEC-792.5
|
|
2725
2770
|
};
|
|
2726
2771
|
}
|
|
2727
2772
|
if (rolesResolved.source === 'grant' && rolesResolved.approval.nonce)
|
|
@@ -2742,7 +2787,7 @@ function evaluateHook(input, specsDir, opts) {
|
|
|
2742
2787
|
// wording false as harnesses grow (REQ-155: a diagnosis that points at the wrong file has negative value).
|
|
2743
2788
|
const kindName = configKind ?? (0, write_target_2.protectedKindOf)(opts.projectRoot, norm) ?? 'config';
|
|
2744
2789
|
return { permissionDecision: 'deny', permissionDecisionReason: `[Holmes-Kit] ${kindName} is a hook/approval config — it can forge HOLMES_APPROVAL or turn governance off, so an out-of-band approval that includes config-write is required`
|
|
2745
|
-
+ (
|
|
2790
|
+
+ hintOrRoute({ kind: 'config-write', target: norm, why: `writing ${kindName}` }) }; // A-SPEC-792.5
|
|
2746
2791
|
}
|
|
2747
2792
|
if (cfgResolved.source === 'grant' && cfgResolved.approval.nonce)
|
|
2748
2793
|
(0, approval_grants_1.consumeGrantFile)(opts.projectRoot, cfgResolved.approval.nonce);
|
|
@@ -2759,7 +2804,7 @@ function evaluateHook(input, specsDir, opts) {
|
|
|
2759
2804
|
const capsResolved = (0, approval_grants_1.resolveApproval)(opts.projectRoot, weApproval, { kind: 'config-write', target: norm }, nowTs);
|
|
2760
2805
|
if (capsResolved === undefined) {
|
|
2761
2806
|
return { permissionDecision: 'deny', permissionDecisionReason: `[Holmes-Kit] this write raises or removes a project cap in ax.config.json (${capsAct}) — a cap narrows this agent, so only the owner lifts it: an out-of-band approval that includes config-write is required (A-SPEC-476.3)`
|
|
2762
|
-
+ (
|
|
2807
|
+
+ hintOrRoute({ kind: 'config-write', target: norm, why: `raising a project cap (${capsAct})` }) }; // A-SPEC-792.5
|
|
2763
2808
|
}
|
|
2764
2809
|
if (capsResolved.source === 'grant' && capsResolved.approval.nonce)
|
|
2765
2810
|
(0, approval_grants_1.consumeGrantFile)(opts.projectRoot, capsResolved.approval.nonce);
|
|
@@ -3249,7 +3294,7 @@ function evaluateHook(input, specsDir, opts) {
|
|
|
3249
3294
|
if (debt && debt.length > 0 && !cureOnly
|
|
3250
3295
|
&& (0, approval_grants_1.resolveApproval)(projectRoot, weApproval, { kind: 'code-write', target: relPath }, nowTs) === undefined) {
|
|
3251
3296
|
const why = `code write under constitution debt (${debt.join(', ')})`;
|
|
3252
|
-
let hint = (
|
|
3297
|
+
let hint = hintOrRoute({ kind: 'code-write', target: relPath, why }); // A-SPEC-792.5
|
|
3253
3298
|
// @implements A-SPEC-134.2 — a decision-kind request that is already pending is not written again, so the
|
|
3254
3299
|
// hint is empty for it. The refusal still names that request; "could not persist" is for a queue that
|
|
3255
3300
|
// really could not be written.
|
|
@@ -65,7 +65,7 @@ exports.collectForbiddenEdgeJudgement = collectForbiddenEdgeJudgement;
|
|
|
65
65
|
exports.stopSharedScan = stopSharedScan;
|
|
66
66
|
exports.scanCodeCycles = scanCodeCycles;
|
|
67
67
|
exports.writeGuardCount = writeGuardCount;
|
|
68
|
-
// @implements A-SPEC-734, A-SPEC-772.1, A-SPEC-770.3, A-SPEC-770.7, A-SPEC-774.21, A-SPEC-778.1, A-SPEC-476.1
|
|
68
|
+
// @implements A-SPEC-734, A-SPEC-772.1, A-SPEC-770.3, A-SPEC-770.7, A-SPEC-774.21, A-SPEC-778.1, A-SPEC-476.1, A-SPEC-792.1
|
|
69
69
|
// @implements A-SPEC-769.9, A-SPEC-769.10, A-SPEC-769.11
|
|
70
70
|
const fs = __importStar(require("node:fs"));
|
|
71
71
|
// @implements A-SPEC-549.3 — evaluateStop's messages are English here; the Hangul-absence guard
|
|
@@ -1009,7 +1009,7 @@ function stopBlockText(violations, pending, launcher) {
|
|
|
1009
1009
|
: v.article === 'ART-7' ? v.findingId : undefined;
|
|
1010
1010
|
const request = subject === undefined ? undefined : requestFor.get(subject);
|
|
1011
1011
|
if (request !== undefined) {
|
|
1012
|
-
operator.push(`${line} — request ${request} is pending: the operator decides it
|
|
1012
|
+
operator.push(`${line} — request ${request} is pending: the operator decides it in the session's approval dialog (approval_ask with id "${request}")`); // A-SPEC-792.1
|
|
1013
1013
|
}
|
|
1014
1014
|
else if (v.article === 'ART-4') {
|
|
1015
1015
|
session.push(`${line} — anchor real covering tests, or, when the design is withdrawn, retire the spec with spec_retire`);
|
|
@@ -1878,7 +1878,7 @@ if (require.main === module) {
|
|
|
1878
1878
|
else if (ackWaiting.length > 0) {
|
|
1879
1879
|
// @implements A-SPEC-247 — acknowledged, not clean: name what is waiting so the user sees
|
|
1880
1880
|
// the standing approval debt exactly once, and the agent knows the ball is not in its court.
|
|
1881
|
-
process.stderr.write(`[Holmes-Kit] awaiting approval — items waiting on the owner's decision: ${ackWaiting.join(', ')}.
|
|
1881
|
+
process.stderr.write(`[Holmes-Kit] awaiting approval — items waiting on the owner's decision: ${ackWaiting.join(', ')}. The person decides each in the session's approval form (approval_ask with its id). (This debt does not re-block.)\n`); // A-SPEC-792.1
|
|
1882
1882
|
}
|
|
1883
1883
|
else if (guard.capped) {
|
|
1884
1884
|
process.stderr.write(`[Holmes-Kit] governance gate YIELDING after ${exports.MAX_CONSECUTIVE_BLOCKS} consecutive blocks — issues remain UNRESOLVED:\n${out.reason ?? ''}\n`);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// @implements A-SPEC-718.2, A-SPEC-718, A-SPEC-263.1, A-SPEC-732, A-SPEC-770.3, A-SPEC-770.6, A-SPEC-792.1
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.MAX_PRESENTATIONS = exports.WAIT_FOR_PERSON_MS = exports.ELICIT_TIMEOUT_MS = exports.ELICITABLE_KINDS = void 0;
|
|
4
5
|
exports.elicitationDisabled = elicitationDisabled;
|
|
@@ -9,8 +10,6 @@ exports.buildDecisionForm = buildDecisionForm;
|
|
|
9
10
|
exports.buildReasonForm = buildReasonForm;
|
|
10
11
|
exports.runElicitFlow = runElicitFlow;
|
|
11
12
|
exports.interpretElicitResult = interpretElicitResult;
|
|
12
|
-
// @implements A-SPEC-718.2, A-SPEC-718, A-SPEC-263.1, A-SPEC-732, A-SPEC-770.3, A-SPEC-770.6
|
|
13
|
-
const npx_bin_1 = require("../project/npx-bin");
|
|
14
13
|
/**
|
|
15
14
|
* The decision comes INTO the session (REQ-263): an approval-shaped refusal (spec_approve without a
|
|
16
15
|
* covering HOLMES_APPROVAL) becomes an in-session question when the client advertises the MCP
|
|
@@ -94,7 +93,7 @@ function classifyElicitError(e, timeoutMs = exports.ELICIT_TIMEOUT_MS) {
|
|
|
94
93
|
* Template-owned text with no interpolated attacker data.
|
|
95
94
|
*/
|
|
96
95
|
function expiredNotice(waitedMs) {
|
|
97
|
-
return `[세션 승인 다이얼로그 만료 — ${Math.round(waitedMs / 1000)}초 무응답] 요청은 승인 큐로 회송되었습니다. 결정:
|
|
96
|
+
return `[세션 승인 다이얼로그 만료 — ${Math.round(waitedMs / 1000)}초 무응답] 요청은 승인 큐로 회송되었습니다. 결정: 에이전트가 approval_ask 로 다시 묻습니다. `;
|
|
98
97
|
}
|
|
99
98
|
// FLATTEN attacker-influenced text (round-1): the model chooses spec titles and finding ids, and
|
|
100
99
|
// interpolating them raw let a crafted title inject fake lines ("[시스템] … approve.") into the
|
|
@@ -115,8 +114,8 @@ function buildDecisionForm(req, attempt, timeoutMs) {
|
|
|
115
114
|
// @implements A-SPEC-718.2 — one outcome for silence, in every mode: the request returns to the queue.
|
|
116
115
|
// @implements A-SPEC-718.6 — a form that waits for the person says so instead of counting seconds.
|
|
117
116
|
const timeoutNotice = timeoutMs >= exports.WAIT_FOR_PERSON_MS
|
|
118
|
-
? `⏱ 결정할 때까지 기다립니다 — 결정 없이 세션이 끝나면 요청은 승인 큐에
|
|
119
|
-
: `⏱ ${timeoutMs / 1000}초 내 미결정 시 승인 큐로 회송됩니다(
|
|
117
|
+
? `⏱ 결정할 때까지 기다립니다 — 결정 없이 세션이 끝나면 요청은 승인 큐에 남고, 에이전트가 approval_ask 로 다시 물을 수 있습니다.`
|
|
118
|
+
: `⏱ ${timeoutMs / 1000}초 내 미결정 시 승인 큐로 회송됩니다(에이전트가 approval_ask 로 다시 물을 수 있습니다).`;
|
|
120
119
|
return {
|
|
121
120
|
// @implements A-SPEC-497.1 — the forewarning is the LAST line and template-owned: it survives a
|
|
122
121
|
// cap-filling summary (appended after the caps) and tells the human, before the clock runs out,
|
|
@@ -223,7 +222,7 @@ function interpretElicitResult(r) {
|
|
|
223
222
|
// @implements A-SPEC-732 — the protocol cannot tell a person's decline from a client that declines
|
|
224
223
|
// forms automatically (codex exec, measured 2026-09-24), so the reason names both and the fallback.
|
|
225
224
|
if (r.action === 'decline')
|
|
226
|
-
return { granted: false, reason: 'the session client declined the approval form (decline) — a person declined, or a client that cannot show forms (e.g. codex exec) declined automatically. If nobody saw the form,
|
|
225
|
+
return { granted: false, reason: 'the session client declined the approval form (decline) — a person declined, or a client that cannot show forms (e.g. codex exec) declined automatically. If nobody saw the form, the person decides it in the approval form of a Claude Code session on this workspace (approval_ask)' }; // A-SPEC-792.1
|
|
227
226
|
if (r.action !== 'accept')
|
|
228
227
|
return null; // cancel, absent, anything else: no decision
|
|
229
228
|
const content = r.content;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FORM_WAITS_FOR_PERSON = void 0;
|
|
4
4
|
exports.createApprovalAskHandlers = createApprovalAskHandlers;
|
|
5
|
-
// @implements A-SPEC-718.4
|
|
5
|
+
// @implements A-SPEC-718.4, A-SPEC-792.1
|
|
6
6
|
/**
|
|
7
7
|
* approval_ask — the person decides a pending request in the session's approval form, so no approval needs a typed
|
|
8
8
|
* command (owner audit 2026-10-20). Since A-SPEC-779.4 neither the agent's shell nor the session's `!` can run
|
|
@@ -15,7 +15,6 @@ exports.createApprovalAskHandlers = createApprovalAskHandlers;
|
|
|
15
15
|
const elicit_approval_1 = require("../elicit-approval");
|
|
16
16
|
const approval_queue_1 = require("../../governance/approval-queue");
|
|
17
17
|
const approve_1 = require("../../cli/approve");
|
|
18
|
-
const npx_bin_1 = require("../../project/npx-bin");
|
|
19
18
|
const screen_safe_1 = require("../../cli/screen-safe");
|
|
20
19
|
/** Clients whose form waits for the person in every mode measured (claude-code: forms expired unanswered, 2026-10-19). */
|
|
21
20
|
exports.FORM_WAITS_FOR_PERSON = new Set(['claude-code']);
|
|
@@ -30,7 +29,9 @@ function createApprovalAskHandlers(context) {
|
|
|
30
29
|
async approval_ask(a) {
|
|
31
30
|
const root = context.rootOf(a.root);
|
|
32
31
|
const id = typeof a.id === 'string' ? a.id.trim() : '';
|
|
33
|
-
|
|
32
|
+
// @implements A-SPEC-792.1 — the route that still reaches a person, never a command to type: a Claude Code session on
|
|
33
|
+
// this workspace, whose form is measured to wait for a person (FORM_WAITS_FOR_PERSON).
|
|
34
|
+
const fallback = `The request stays pending: the person decides it in the approval form of a Claude Code session on this workspace (approval_ask with id "${id}")`;
|
|
34
35
|
const refuse = (why) => ({ ok: false, id, reason: `${why}. ${fallback}` });
|
|
35
36
|
// @implements A-SPEC-779.5 — a run's own server never asks; a request a run awaits is the person's to decide in the
|
|
36
37
|
// interactive session's form (owner, 2026-10-20). The CLI keeps A-SPEC-779's terminal-only rule (grantGuard).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createReviewVerdictHandlers = createReviewVerdictHandlers;
|
|
4
|
-
// @implements A-SPEC-102.9
|
|
4
|
+
// @implements A-SPEC-102.9, A-SPEC-792.1
|
|
5
5
|
/**
|
|
6
6
|
* review_verdict — the person records an independent review verdict in the session's approval form. A-SPEC-102.7/102.8
|
|
7
7
|
* make a CLI verdict independent only from a person's own terminal, so a review meant leaving the session (the owner's
|
|
@@ -20,7 +20,8 @@ function createReviewVerdictHandlers(context) {
|
|
|
20
20
|
async review_verdict(a) {
|
|
21
21
|
const root = context.rootOf(a.root);
|
|
22
22
|
const env = context.env();
|
|
23
|
-
|
|
23
|
+
// @implements A-SPEC-792.1 — a Claude Code session's form, never a command to type.
|
|
24
|
+
const fallback = `The verdict stays unrecorded: the person records it in the approval form of a Claude Code session on this workspace (review_verdict for ${a.base}..${a.head})`;
|
|
24
25
|
const refuse = (why) => ({ ok: false, reason: `${why}. ${fallback}` });
|
|
25
26
|
const marker = env[RUN];
|
|
26
27
|
if (typeof marker === 'string' && marker.trim() !== '')
|
|
@@ -47,6 +47,8 @@ export interface SpecApprovalContext {
|
|
|
47
47
|
foreignRootReason(root?: string): string | null;
|
|
48
48
|
/** @implements A-SPEC-732 — why no in-session route was offered (unattested server), or ''. */
|
|
49
49
|
approvalRouteNote?(): string;
|
|
50
|
+
/** @implements A-SPEC-792.4 — the home whose full autonomy profile applies (default os.homedir()). */
|
|
51
|
+
fullAutonomyHome?(): string;
|
|
50
52
|
}
|
|
51
53
|
export declare function createSpecApprovalHandlers(context: SpecApprovalContext): {
|
|
52
54
|
/**
|
|
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.createSpecApprovalHandlers = createSpecApprovalHandlers;
|
|
37
37
|
exports.readProjectFile = readProjectFile;
|
|
38
|
-
// @implements A-SPEC-182.3, A-SPEC-718.3, A-SPEC-770.6, A-SPEC-718.1,A-SPEC-718.2, A-SPEC-718, A-SPEC-551.1, A-SPEC-551.2, A-SPEC-627.1, A-SPEC-622, A-SPEC-100.2, A-SPEC-128, A-SPEC-132, A-SPEC-133, A-SPEC-151, A-SPEC-188, A-SPEC-189, A-SPEC-244, A-SPEC-245, A-SPEC-729
|
|
38
|
+
// @implements A-SPEC-182.3, A-SPEC-718.3, A-SPEC-770.6, A-SPEC-718.1,A-SPEC-718.2, A-SPEC-718, A-SPEC-551.1, A-SPEC-551.2, A-SPEC-627.1, A-SPEC-622, A-SPEC-100.2, A-SPEC-128, A-SPEC-132, A-SPEC-133, A-SPEC-151, A-SPEC-188, A-SPEC-189, A-SPEC-244, A-SPEC-245, A-SPEC-729, A-SPEC-532.7, A-SPEC-792.1, A-SPEC-792.4
|
|
39
39
|
// @implements A-SPEC-631, A-SPEC-733
|
|
40
40
|
const fs = __importStar(require("node:fs"));
|
|
41
41
|
const compat_impact_1 = require("../../spec/compat-impact");
|
|
@@ -48,6 +48,8 @@ const autonomy_1 = require("../../governance/autonomy");
|
|
|
48
48
|
const config_1 = require("../../config/config");
|
|
49
49
|
const write_target_1 = require("../../guardrail/write-target");
|
|
50
50
|
const delegation_1 = require("../../governance/delegation"); // @implements A-SPEC-771
|
|
51
|
+
const full_autonomy_1 = require("../../governance/full-autonomy"); // @implements A-SPEC-792.4
|
|
52
|
+
const os = __importStar(require("node:os"));
|
|
51
53
|
const approval_grants_1 = require("../../governance/approval-grants");
|
|
52
54
|
const spec_digest_1 = require("../../spec/spec-digest");
|
|
53
55
|
const version_conflict_1 = require("../../spec/version-conflict");
|
|
@@ -57,7 +59,6 @@ const review_targets_1 = require("../../review/review-targets");
|
|
|
57
59
|
const requirement_triage_evidence_1 = require("../requirement-triage-evidence");
|
|
58
60
|
const approval_policy_1 = require("../approval-policy");
|
|
59
61
|
const approval_blockers_1 = require("../../spec/approval-blockers");
|
|
60
|
-
const npx_bin_1 = require("../../project/npx-bin");
|
|
61
62
|
function createSpecApprovalHandlers(context) {
|
|
62
63
|
const { store, resolver, projectRootOf, cachedScan, tryElicit, elicitApproval, autonomousApproval } = context;
|
|
63
64
|
return {
|
|
@@ -150,7 +151,10 @@ function createSpecApprovalHandlers(context) {
|
|
|
150
151
|
catch {
|
|
151
152
|
return undefined;
|
|
152
153
|
} })();
|
|
153
|
-
|
|
154
|
+
// @implements A-SPEC-792.4 — a full autonomy profile covering this project: no seal here waits for a person.
|
|
155
|
+
const fullState = autonomyRoot === undefined ? null : (0, full_autonomy_1.readFullProfile)(context.fullAutonomyHome?.() ?? os.homedir(), autonomyRoot);
|
|
156
|
+
const fullEntry = fullState !== null && fullState.active ? fullState.entry : null;
|
|
157
|
+
const autonomyOn = fullEntry !== null || (0, autonomy_1.autonomousApprovalEnabled)(process.env, autonomyRoot, new Date().toISOString());
|
|
154
158
|
// @implements A-SPEC-718.3 — the continuation's only person is the host's own tool confirmation, which
|
|
155
159
|
// the server cannot see and an allow rule or auto mode removes. Under autonomous approval — the posture
|
|
156
160
|
// in which nobody is at the keyboard — it is neither spent here nor offered below (measured: the caller
|
|
@@ -205,12 +209,26 @@ function createSpecApprovalHandlers(context) {
|
|
|
205
209
|
}
|
|
206
210
|
}
|
|
207
211
|
if (ceilingNote !== null) {
|
|
212
|
+
// @implements A-SPEC-792.4 — under a full profile the owner's ceiling still binds, and refuses at once.
|
|
213
|
+
if (fullEntry !== null) {
|
|
214
|
+
return { ok: false, reason: `spec_approve: ${a.id} — [full autonomy: the owner's ceiling keeps this seal; the owner changes autonomy.ceiling in ax.config.json]${ceilingNote} (no approval request was filed)` };
|
|
215
|
+
}
|
|
208
216
|
autonomyNote = ceilingNote;
|
|
209
217
|
}
|
|
210
218
|
else if (autonomyOn && risk === 'hitl') {
|
|
211
219
|
const rule = noIntake ? 'requirement-without-intake' : (0, autonomy_1.specApprovalAutonomyReason)(target.spec, resolver([target.spec]), below);
|
|
212
|
-
if (rule !== null) {
|
|
213
|
-
|
|
220
|
+
if (rule !== null && fullEntry !== null) {
|
|
221
|
+
// @implements A-SPEC-792.4 — sealed as full-autonomy, or refused with the self-serve route; never asked.
|
|
222
|
+
const verdict = (0, full_autonomy_1.fullSealVerdict)(rule, fullEntry.flags);
|
|
223
|
+
if (verdict.outcome === 'refuse') {
|
|
224
|
+
return { ok: false, reason: `spec_approve: ${a.id} — [full autonomy: ${rule}] ${verdict.route} (no approval request was filed)` };
|
|
225
|
+
}
|
|
226
|
+
const base = autonomousApproval(below?.map((s) => s.id));
|
|
227
|
+
approveResolved = { approval: { ...base, actor: base.actor.replace(/^autonomous:/, 'full-autonomy:'), rationale: `full autonomy (scope ${fullEntry.scope}, rule ${rule})${verdict.mark}` }, source: 'full-autonomy' };
|
|
228
|
+
decidedSubject = targetSubject;
|
|
229
|
+
}
|
|
230
|
+
else if (rule !== null) {
|
|
231
|
+
autonomyNote = `\n[autonomy: this seal is the operator's — ${rule} (${(0, autonomy_1.autonomyRuleMeaning)(rule)})]${(0, autonomy_1.autonomyNextStep)(rule, a.id)}`; // A-SPEC-532.7
|
|
214
232
|
// @implements A-SPEC-771 — the operator's run delegation may cover this very rule: then the seal proceeds
|
|
215
233
|
// as a DELEGATED grant (actor `delegated:<client>`, the run and the rule in the ledger) and no person is
|
|
216
234
|
// asked; otherwise the refusal names which limit of the delegation applied. The grader's verdict above
|
|
@@ -384,7 +402,7 @@ function createSpecApprovalHandlers(context) {
|
|
|
384
402
|
const bound = approveResolved.approval;
|
|
385
403
|
if (typeof bound.subject === 'string' && bound.subject !== '' && bound.subject !== (0, spec_digest_1.specDigest)(cur.spec)) {
|
|
386
404
|
const current = (0, spec_digest_1.specDigest)(cur.spec);
|
|
387
|
-
return { ok: false, reason: `[grant ${bound.nonce ?? '?'} refused: stale-subject] the grant was minted for another content of ${a.id}; the
|
|
405
|
+
return { ok: false, reason: `[grant ${bound.nonce ?? '?'} refused: stale-subject] the grant was minted for another content of ${a.id}; the person reads the current content and decides again in the session form (approval_ask with the id below); the new grant replaces the stale one.` // A-SPEC-792.1
|
|
388
406
|
+ context.refusalQueueHint(a.root, { kind: 'spec-approve', target: a.id, why: '스펙 봉인 승인', subject: current, title: cur.spec.title }) };
|
|
389
407
|
}
|
|
390
408
|
}
|
|
@@ -61,6 +61,8 @@ export interface ElicitOpts {
|
|
|
61
61
|
home?: string;
|
|
62
62
|
installerPackageRoot?: string;
|
|
63
63
|
};
|
|
64
|
+
/** @implements A-SPEC-792.4 — the home whose `.holmes/full-autonomy.json` spec_approve reads (default: the user's). */
|
|
65
|
+
fullAutonomyHome?: () => string;
|
|
64
66
|
}
|
|
65
67
|
/**
|
|
66
68
|
* @implements A-SPEC-299
|
|
@@ -39,7 +39,7 @@ exports.isHandlerRefusal = isHandlerRefusal;
|
|
|
39
39
|
exports.unreadableAmong = unreadableAmong;
|
|
40
40
|
exports.makeHandlers = makeHandlers;
|
|
41
41
|
exports.collectDecisions = collectDecisions;
|
|
42
|
-
// @implements A-SPEC-774.25, A-SPEC-770.12, A-SPEC-718.1, A-SPEC-718.2, A-SPEC-723, A-SPEC-723.1, A-SPEC-545.6, A-SPEC-720, A-SPEC-718, A-SPEC-703, A-SPEC-629, A-SPEC-628, A-SPEC-599, A-SPEC-603, A-SPEC-604, A-SPEC-605, A-SPEC-606, A-SPEC-607, A-SPEC-608, A-SPEC-609, A-SPEC-610, A-SPEC-611, A-SPEC-612, A-SPEC-613, A-SPEC-614, A-SPEC-615, A-SPEC-616, A-SPEC-617, A-SPEC-618, A-SPEC-621, A-SPEC-622, A-SPEC-624, A-SPEC-625, A-SPEC-627, A-SPEC-713, A-SPEC-732, A-SPEC-754
|
|
42
|
+
// @implements A-SPEC-774.25, A-SPEC-770.12, A-SPEC-718.1, A-SPEC-718.2, A-SPEC-723, A-SPEC-723.1, A-SPEC-545.6, A-SPEC-720, A-SPEC-718, A-SPEC-703, A-SPEC-629, A-SPEC-628, A-SPEC-599, A-SPEC-603, A-SPEC-604, A-SPEC-605, A-SPEC-606, A-SPEC-607, A-SPEC-608, A-SPEC-609, A-SPEC-610, A-SPEC-611, A-SPEC-612, A-SPEC-613, A-SPEC-614, A-SPEC-615, A-SPEC-616, A-SPEC-617, A-SPEC-618, A-SPEC-621, A-SPEC-622, A-SPEC-624, A-SPEC-625, A-SPEC-627, A-SPEC-713, A-SPEC-732, A-SPEC-754, A-SPEC-792.4
|
|
43
43
|
const operator_recovery_1 = require("./operator-recovery");
|
|
44
44
|
// @implements A-SPEC-643
|
|
45
45
|
// @implements A-SPEC-642
|
|
@@ -929,6 +929,7 @@ function makeRawHandlers(store, opts) {
|
|
|
929
929
|
resolveHandlerApproval: (root, approval, action, now) => resolveHandlerApproval(root, store, approval, action, now),
|
|
930
930
|
refusalQueueHint: (root, request) => refusalQueueHint(root, store, request, 'spec_approve'),
|
|
931
931
|
foreignRootReason: (root) => foreignRootReason(store, root),
|
|
932
|
+
...(opts?.fullAutonomyHome ? { fullAutonomyHome: opts.fullAutonomyHome } : {}), // @implements A-SPEC-792.4
|
|
932
933
|
});
|
|
933
934
|
/**
|
|
934
935
|
* Where the audit record for a governance act belongs — resolved BEFORE the act writes anything.
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Formatting only: the caller must return pending text only after a successful enqueue.
|
|
3
|
+
*
|
|
4
|
+
* @implements A-SPEC-792.1 — the hint names no command to type. The operator lines it used to carry (`approve --grant`,
|
|
5
|
+
* `approve --watch`, A-SPEC-532.3) were relayed by agents and typed by the person in a terminal — the UX REQ-792 removes.
|
|
6
|
+
* `platform`, `executable` and `cli` once built that command; they are accepted and no longer used.
|
|
7
|
+
*/
|
|
2
8
|
export declare function operatorRecovery(root: string, target: string, operation?: string, options?: {
|
|
3
9
|
platform?: NodeJS.Platform;
|
|
4
10
|
executable?: string;
|
|
@@ -6,6 +12,5 @@ export declare function operatorRecovery(root: string, target: string, operation
|
|
|
6
12
|
/** @implements A-SPEC-770.12 — `requestLabel(kind, target, title)`, set inside the bracket after the id. */
|
|
7
13
|
label?: string;
|
|
8
14
|
}): {
|
|
9
|
-
reviewCommand: string;
|
|
10
15
|
pendingHint(id: string): string;
|
|
11
16
|
};
|