@holmes-lab/holmes-kit 0.35.1 → 0.35.3
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 +72 -0
- package/README.md +6 -3
- package/dist/.build-id +1 -1
- package/dist/holmes/cli/approve.js +9 -2
- package/dist/holmes/cli/doctor.js +21 -2
- package/dist/holmes/cli/init.d.ts +2 -0
- package/dist/holmes/cli/init.js +37 -1
- package/dist/holmes/cli/runtime-binding.d.ts +16 -0
- package/dist/holmes/cli/runtime-binding.js +62 -2
- package/dist/holmes/governance/approval-grants.d.ts +7 -0
- package/dist/holmes/governance/approval-grants.js +8 -2
- package/dist/holmes/governance/approval-queue.d.ts +5 -0
- package/dist/holmes/governance/approval-queue.js +14 -3
- package/dist/holmes/governance/autonomy.d.ts +10 -1
- package/dist/holmes/governance/autonomy.js +66 -14
- package/dist/holmes/guardrail/risk-classifier.js +32 -3
- package/dist/holmes/guardrail/write-verb-word.d.ts +13 -0
- package/dist/holmes/guardrail/write-verb-word.js +55 -0
- package/dist/holmes/hooks/pre-tool-use.d.ts +2 -0
- package/dist/holmes/hooks/pre-tool-use.js +32 -9
- package/dist/holmes/mcp/approval-policy.d.ts +4 -1
- package/dist/holmes/mcp/approval-policy.js +5 -4
- package/dist/holmes/mcp/elicit-approval.d.ts +0 -2
- package/dist/holmes/mcp/elicit-approval.js +3 -4
- package/dist/holmes/mcp/handlers/review-evidence.d.ts +1 -2
- package/dist/holmes/mcp/handlers/review-evidence.js +4 -12
- package/dist/holmes/mcp/handlers/spec-approval.d.ts +2 -2
- package/dist/holmes/mcp/handlers/spec-approval.js +18 -11
- package/dist/holmes/mcp/handlers.d.ts +1 -9
- package/dist/holmes/mcp/handlers.js +7 -7
- package/dist/holmes/mcp/harness-attestation.d.ts +10 -1
- package/dist/holmes/mcp/harness-attestation.js +70 -3
- package/dist/holmes/mcp/operator-recovery.js +4 -1
- package/dist/holmes/mcp/server.js +6 -3
- package/package.json +1 -1
|
@@ -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-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-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
|
|
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");
|
|
@@ -89,6 +89,10 @@ function createSpecApprovalHandlers(context) {
|
|
|
89
89
|
// id helps no one — the standard refusal handles it).
|
|
90
90
|
let elicitExpiredMs;
|
|
91
91
|
let risk;
|
|
92
|
+
// @implements A-SPEC-532.3 — which grading rule handed this seal to the operator (said in the refusal).
|
|
93
|
+
let autonomyNote = '';
|
|
94
|
+
// @implements A-SPEC-532.4 — the declared direction of a gate change sealed without the owner (said in the ledger).
|
|
95
|
+
let sealedDirection = '';
|
|
92
96
|
let subject;
|
|
93
97
|
// @implements A-SPEC-732 (round 2) — the digest a person or the autonomy grade decided on; the
|
|
94
98
|
// seal must be built from that same content.
|
|
@@ -179,9 +183,17 @@ function createSpecApprovalHandlers(context) {
|
|
|
179
183
|
})();
|
|
180
184
|
if (noIntake)
|
|
181
185
|
risk = 'hitl';
|
|
186
|
+
if (autonomyOn && risk === 'hitl') {
|
|
187
|
+
const rule = noIntake ? 'requirement-without-intake' : (0, autonomy_1.specApprovalAutonomyReason)(target.spec, resolver([target.spec]), below);
|
|
188
|
+
if (rule !== null)
|
|
189
|
+
autonomyNote = `\n[autonomy: this seal is the operator's — ${rule} (${(0, autonomy_1.autonomyRuleMeaning)(rule)})]`;
|
|
190
|
+
}
|
|
182
191
|
if (autonomyOn && risk === 'auto') {
|
|
183
192
|
approveResolved = { approval: autonomousApproval(below?.map((s) => s.id)), source: 'autonomous' };
|
|
184
193
|
decidedSubject = targetSubject;
|
|
194
|
+
const direction = (0, autonomy_1.declaredGateDirection)(target.spec);
|
|
195
|
+
if (direction !== null)
|
|
196
|
+
sealedDirection = ` [gate change sealed without the owner — declared ${direction}]`;
|
|
185
197
|
}
|
|
186
198
|
else if (autonomyOn && !(0, autonomy_1.requiresAutonomousApprovalPrompt)(target.spec, below)) {
|
|
187
199
|
// @implements A-SPEC-551.1 — autonomous mode does not turn an ordinary HITL request
|
|
@@ -193,7 +205,7 @@ function createSpecApprovalHandlers(context) {
|
|
|
193
205
|
// The MODEL text is capped BEFORE the server markers are appended (round-2): a ~185+ char
|
|
194
206
|
// title pushed '(재봉인)' past the dialog's 200-char summary cap, dressing a re-seal (the
|
|
195
207
|
// more consequential act) as a first approval. The cap cuts the title, never the marker.
|
|
196
|
-
const out = await tryElicit('spec-approve', a.id, `${a.id} — ${target.spec.title.slice(0, 120)}${resealing ? ' (재봉인)' : ''}${noIntake ? ' (triage 기록 없음)' : ''}
|
|
208
|
+
const out = await tryElicit('spec-approve', a.id, `${a.id} — ${target.spec.title.slice(0, 120)}${resealing ? ' (재봉인)' : ''}${noIntake ? ' (triage 기록 없음)' : ''}`);
|
|
197
209
|
const presentation = out.kind === 'answered'
|
|
198
210
|
? (out.decision.granted ? { kind: 'approve', reason: out.decision.reason } : { kind: 'deny', reason: out.decision.reason })
|
|
199
211
|
: out.kind === 'expired' ? { kind: 'timeout' } : { kind: 'unavailable' };
|
|
@@ -202,19 +214,14 @@ function createSpecApprovalHandlers(context) {
|
|
|
202
214
|
approveResolved = { approval: elicitApproval(out.kind === 'answered' ? out.decision.reason : undefined), source: 'elicitation' };
|
|
203
215
|
decidedSubject = targetSubject;
|
|
204
216
|
}
|
|
205
|
-
else if (decision.kind === 'approved' && presentation.kind === 'timeout') {
|
|
206
|
-
approveResolved = { approval: autonomousApproval(undefined, 'timeout'), source: 'autonomous' };
|
|
207
|
-
decidedSubject = targetSubject;
|
|
208
|
-
}
|
|
209
217
|
else if (out.kind === 'answered') {
|
|
210
218
|
// The human ANSWERED (deny/question/decline): the answer is the message, and no queue
|
|
211
219
|
// entry is filed — a decided request is not a pending one (REQ-246 visibility).
|
|
212
220
|
return { ok: false, reason: `spec_approve: 세션에서 거부됨 — ${out.decision.reason ?? '(사유 없음)'}. 사유를 해소한 뒤 다시 시도하십시오.` };
|
|
213
221
|
}
|
|
214
222
|
else if (out.kind === 'expired') {
|
|
215
|
-
// @implements A-SPEC-718 — a direct in-session prompt may time out.
|
|
216
|
-
//
|
|
217
|
-
// OFF keeps the established fail-closed expiry + queue behavior.
|
|
223
|
+
// @implements A-SPEC-718.1 — a direct in-session prompt may time out. Silence is not a
|
|
224
|
+
// decision in any mode: the expiry is reported and the request stays in the queue.
|
|
218
225
|
elicitExpiredMs = out.waitedMs;
|
|
219
226
|
}
|
|
220
227
|
else if (out.kind === 'silent' && context.approvalAdapter().kind === 'host-gated-tool' && bindingOk()) {
|
|
@@ -244,7 +251,7 @@ function createSpecApprovalHandlers(context) {
|
|
|
244
251
|
catch {
|
|
245
252
|
refusedGrants = '';
|
|
246
253
|
}
|
|
247
|
-
return { ok: false, reason: (elicitExpiredMs !== undefined ? (0, elicit_approval_1.expiredNotice)(elicitExpiredMs) : '') + refusedGrants + (context.approvalRouteNote?.() ?? '')
|
|
254
|
+
return { ok: false, reason: (elicitExpiredMs !== undefined ? (0, elicit_approval_1.expiredNotice)(elicitExpiredMs) : '') + refusedGrants + (context.approvalRouteNote?.() ?? '') + autonomyNote
|
|
248
255
|
+ 'spec_approve requires an out-of-band HOLMES_APPROVAL that COVERS this act — a request-payload approval is not a channel, and an expired or elsewhere-scoped token does not open this door (scoped approvals need kind "spec-approve"). (fail-closed)'
|
|
249
256
|
+ context.refusalQueueHint(a.root, { kind: 'spec-approve', target: a.id, why: '스펙 봉인 승인', ...(subject ? { subject } : {}), ...(risk ? { risk } : {}) }) };
|
|
250
257
|
}
|
|
@@ -392,7 +399,7 @@ function createSpecApprovalHandlers(context) {
|
|
|
392
399
|
ts: new Date().toISOString(),
|
|
393
400
|
actor: approveResolved.approval.actor,
|
|
394
401
|
kind: 'spec-approved',
|
|
395
|
-
summary: `approved ${a.id} sealing ${digest}`,
|
|
402
|
+
summary: `approved ${a.id} sealing ${digest}${sealedDirection}`,
|
|
396
403
|
inputs: [a.id, digest],
|
|
397
404
|
rationale: approveResolved.approval.rationale,
|
|
398
405
|
authorization: (0, provenance_chain_1.authorizationRef)(approveResolved.approval.actor, approveResolved.approval.token),
|
|
@@ -406,15 +406,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
|
|
|
406
406
|
root: string;
|
|
407
407
|
base?: string;
|
|
408
408
|
head?: string;
|
|
409
|
-
since
|
|
410
|
-
/**
|
|
411
|
-
* A root the caller named that this process cannot read is the CALLER'S mistake, not a fault.
|
|
412
|
-
* @implements A-SPEC-189 §10 (round 11)
|
|
413
|
-
*/
|
|
414
|
-
? /**
|
|
415
|
-
* A root the caller named that this process cannot read is the CALLER'S mistake, not a fault.
|
|
416
|
-
* @implements A-SPEC-189 §10 (round 11)
|
|
417
|
-
*/: string;
|
|
409
|
+
since?: string;
|
|
418
410
|
}) => Promise<{
|
|
419
411
|
requirementSemanticWarm?: {
|
|
420
412
|
tier: string;
|
|
@@ -38,7 +38,7 @@ exports.isHandlerRefusal = isHandlerRefusal;
|
|
|
38
38
|
exports.unreadableAmong = unreadableAmong;
|
|
39
39
|
exports.makeHandlers = makeHandlers;
|
|
40
40
|
exports.collectDecisions = collectDecisions;
|
|
41
|
-
// @implements A-SPEC-723, 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
|
|
41
|
+
// @implements A-SPEC-718.1, A-SPEC-718.2, A-SPEC-723, 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
42
|
const operator_recovery_1 = require("./operator-recovery");
|
|
43
43
|
// @implements A-SPEC-643
|
|
44
44
|
// @implements A-SPEC-642
|
|
@@ -812,7 +812,7 @@ function makeRawHandlers(store, opts) {
|
|
|
812
812
|
// other failure mode (no channel, wrong kind, a throwing elicitor) is `silent`, whose refusal
|
|
813
813
|
// stays byte-identical to the pre-elicitation one — nothing is ever worse than before the
|
|
814
814
|
// channel existed.
|
|
815
|
-
const tryElicit = async (kind, target, summary
|
|
815
|
+
const tryElicit = async (kind, target, summary) => {
|
|
816
816
|
// @implements A-SPEC-540.1 — operator opt-out: with HOLMES_ELICIT=off the server never shows the
|
|
817
817
|
// in-client prompt, folding to the byte-identical `silent` (refuse+enqueue) path so claude/agy/
|
|
818
818
|
// codex all converge on one out-of-band surface (holmes-kit approve). Unset ⇒ unchanged.
|
|
@@ -823,7 +823,7 @@ function makeRawHandlers(store, opts) {
|
|
|
823
823
|
if (!opts?.elicit || !elicit_approval_1.ELICITABLE_KINDS.has(kind))
|
|
824
824
|
return { kind: 'silent' };
|
|
825
825
|
try {
|
|
826
|
-
return await opts.elicit({ kind, target, summary
|
|
826
|
+
return await opts.elicit({ kind, target, summary });
|
|
827
827
|
}
|
|
828
828
|
catch {
|
|
829
829
|
return { kind: 'silent' };
|
|
@@ -845,11 +845,12 @@ function makeRawHandlers(store, opts) {
|
|
|
845
845
|
// rides the existing seal path, but its actor names `autonomous:<client>` so an audit can tell a
|
|
846
846
|
// self-approved seal from a human-approved (elicitation) or operator (env/grant) one. Single-use
|
|
847
847
|
// by construction — it exists only inside this call, persisted nowhere.
|
|
848
|
-
|
|
849
|
-
|
|
848
|
+
// @implements A-SPEC-718.1 — its only source is the grader's `auto`; an expired prompt never reaches it.
|
|
849
|
+
const autonomousApproval = (derivedFrom) => ({
|
|
850
|
+
actor: `autonomous:${opts?.clientName?.() ?? 'unknown'}`,
|
|
850
851
|
token: crypto.randomUUID(),
|
|
851
852
|
// @implements A-SPEC-587 — an upstream grade is DERIVED; the audit line names the A-SPECs it came from.
|
|
852
|
-
rationale: `autonomous grant (${'HOLMES_AUTONOMOUS_APPROVAL'} enabled,
|
|
853
|
+
rationale: `autonomous grant (${'HOLMES_AUTONOMOUS_APPROVAL'} enabled, spec grade auto${derivedFrom && derivedFrom.length > 0 ? ` — derived from ${derivedFrom.join(', ')}` : ''})`,
|
|
853
854
|
});
|
|
854
855
|
// @implements A-SPEC-617, A-SPEC-100.2, A-SPEC-102.1, A-SPEC-133, A-SPEC-135, A-SPEC-141, A-SPEC-157, A-SPEC-160, A-SPEC-189, A-SPEC-191, A-SPEC-244, A-SPEC-245, A-SPEC-263.1, A-SPEC-497.1
|
|
855
856
|
const reviewEvidence = (0, review_evidence_1.createReviewEvidenceHandlers)({
|
|
@@ -862,7 +863,6 @@ function makeRawHandlers(store, opts) {
|
|
|
862
863
|
hasElicitor: () => Boolean(opts?.elicit),
|
|
863
864
|
tryElicit,
|
|
864
865
|
elicitApproval,
|
|
865
|
-
autonomousApproval,
|
|
866
866
|
resolveHandlerApproval: (root, approval, action, now) => resolveHandlerApproval(root, store, approval, action, now),
|
|
867
867
|
refusalQueueHint: (root, request) => refusalQueueHint(root, store, request),
|
|
868
868
|
});
|
|
@@ -14,7 +14,16 @@ export interface HarnessAttestation {
|
|
|
14
14
|
harness?: string;
|
|
15
15
|
reason?: string;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @implements A-SPEC-751.3 — is `script` one of the operator runtime registry's own MCP dispatcher files, unchanged
|
|
19
|
+
* since its installation receipt. Measured 2026-10-04: A-SPEC-751 starts the server through
|
|
20
|
+
* `node <registry dir>/<harness>-mcp.js`; the walk below read that as a plain node script and stopped, so in-session
|
|
21
|
+
* approval was switched off on every workspace of a registered machine. Any read or parse failure is "no".
|
|
22
|
+
* Limit, stated: the receipt and the file are writable by the operator's own account — this shows the launcher is the
|
|
23
|
+
* installed dispatcher, not that the account is uncompromised (the trust the image check already rests on).
|
|
24
|
+
*/
|
|
25
|
+
export declare function dispatcherVerifier(registryPath: string): (script: string) => boolean;
|
|
17
26
|
/** Walk up from `pid` (the server's parent) through launchers to a harness executable. */
|
|
18
|
-
export declare function attestHarness(pid: number, lookup: ProcLookup, maxDepth?: number): HarnessAttestation;
|
|
27
|
+
export declare function attestHarness(pid: number, lookup: ProcLookup, maxDepth?: number, isDispatcher?: (script: string) => boolean): HarnessAttestation;
|
|
19
28
|
/** The live process table: `ps` on POSIX, CIM through PowerShell on Windows. Null when unreadable. */
|
|
20
29
|
export declare function systemProcLookup(platform?: NodeJS.Platform): ProcLookup;
|
|
@@ -33,9 +33,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.dispatcherVerifier = dispatcherVerifier;
|
|
36
37
|
exports.attestHarness = attestHarness;
|
|
37
38
|
exports.systemProcLookup = systemProcLookup;
|
|
38
|
-
// @implements A-SPEC-732
|
|
39
|
+
// @implements A-SPEC-732, A-SPEC-751.3
|
|
39
40
|
// In-session approval (a form, or the host-gated continuation) trusts the client that answers it. An
|
|
40
41
|
// agent can start its own copy of this server, name itself `claude-code` and answer for a person
|
|
41
42
|
// (measured, H7 round 1). So before offering either route, the server asks who launched it: the
|
|
@@ -50,6 +51,7 @@ exports.systemProcLookup = systemProcLookup;
|
|
|
50
51
|
const fs = __importStar(require("node:fs"));
|
|
51
52
|
const path = __importStar(require("node:path"));
|
|
52
53
|
const node_child_process_1 = require("node:child_process");
|
|
54
|
+
const node_crypto_1 = require("node:crypto");
|
|
53
55
|
const HARNESS_EXES = new Set(['claude', 'codex', 'agy', 'antigravity']);
|
|
54
56
|
const imageName = (image) => path.win32.basename(path.posix.basename(image)).toLowerCase().replace(/\.exe$/, '');
|
|
55
57
|
/** `agy` and `antigravity` name the same harness. */
|
|
@@ -101,8 +103,66 @@ function isLauncher(args) {
|
|
|
101
103
|
}
|
|
102
104
|
return false;
|
|
103
105
|
}
|
|
106
|
+
const NODE_PROGRAM_OPTIONS = new Set(['-e', '-p', '-r', '--eval', '--print', '--require', '--import', '--loader', '--experimental-loader']);
|
|
107
|
+
/** Quote-aware words of a process's argument string (the first is the executable). */
|
|
108
|
+
function argWords(args) {
|
|
109
|
+
const out = [];
|
|
110
|
+
const re = /"([^"]*)"|'([^']*)'|(\S+)/g;
|
|
111
|
+
for (let m = re.exec(args); m !== null; m = re.exec(args))
|
|
112
|
+
out.push(m[1] ?? m[2] ?? m[3]);
|
|
113
|
+
return out;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* @implements A-SPEC-751.3 — the script a `node` process runs, or null when an option names a program or a preload
|
|
117
|
+
* (`-e`, `-r`, `--require`, `--import`, `--loader` …: such a process runs something other than its script).
|
|
118
|
+
* Options that take no program are stepped over; `--` ends options.
|
|
119
|
+
*/
|
|
120
|
+
function nodeScriptOf(args) {
|
|
121
|
+
const words = argWords(args).slice(1);
|
|
122
|
+
for (let i = 0; i < words.length; i++) {
|
|
123
|
+
const w = words[i];
|
|
124
|
+
if (w === '--')
|
|
125
|
+
return words[i + 1] ?? null;
|
|
126
|
+
if (!w.startsWith('-'))
|
|
127
|
+
return w;
|
|
128
|
+
if (NODE_PROGRAM_OPTIONS.has(w.split('=')[0]) || !w.startsWith('--'))
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* @implements A-SPEC-751.3 — is `script` one of the operator runtime registry's own MCP dispatcher files, unchanged
|
|
135
|
+
* since its installation receipt. Measured 2026-10-04: A-SPEC-751 starts the server through
|
|
136
|
+
* `node <registry dir>/<harness>-mcp.js`; the walk below read that as a plain node script and stopped, so in-session
|
|
137
|
+
* approval was switched off on every workspace of a registered machine. Any read or parse failure is "no".
|
|
138
|
+
* Limit, stated: the receipt and the file are writable by the operator's own account — this shows the launcher is the
|
|
139
|
+
* installed dispatcher, not that the account is uncompromised (the trust the image check already rests on).
|
|
140
|
+
*/
|
|
141
|
+
function dispatcherVerifier(registryPath) {
|
|
142
|
+
return (script) => {
|
|
143
|
+
try {
|
|
144
|
+
if (!path.isAbsolute(script))
|
|
145
|
+
return false;
|
|
146
|
+
const dir = fs.realpathSync.native(path.dirname(registryPath));
|
|
147
|
+
const real = fs.realpathSync.native(script);
|
|
148
|
+
if (path.dirname(real) !== dir || !/^(?:claude|codex|antigravity)-mcp\.js$/.test(path.basename(real)))
|
|
149
|
+
return false;
|
|
150
|
+
const st = fs.lstatSync(real);
|
|
151
|
+
if (!st.isFile() || st.size > 1024 * 1024)
|
|
152
|
+
return false;
|
|
153
|
+
const rows = JSON.parse(fs.readFileSync(path.join(dir, 'installation.json'), 'utf8')).files;
|
|
154
|
+
if (!Array.isArray(rows))
|
|
155
|
+
return false;
|
|
156
|
+
const digest = (0, node_crypto_1.createHash)('sha256').update(fs.readFileSync(real, 'utf8')).digest('hex');
|
|
157
|
+
return rows.some((r) => !!r && typeof r === 'object' && r.path === real && r.digest === digest);
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
104
164
|
/** Walk up from `pid` (the server's parent) through launchers to a harness executable. */
|
|
105
|
-
function attestHarness(pid, lookup, maxDepth = 8) {
|
|
165
|
+
function attestHarness(pid, lookup, maxDepth = 8, isDispatcher) {
|
|
106
166
|
const chain = [];
|
|
107
167
|
const seen = new Set();
|
|
108
168
|
let cur = pid;
|
|
@@ -114,8 +174,15 @@ function attestHarness(pid, lookup, maxDepth = 8) {
|
|
|
114
174
|
if (row === null)
|
|
115
175
|
return { attested: false, chain, reason: 'the process table could not be read' };
|
|
116
176
|
const harness = harnessOf(row.args, row.exe);
|
|
117
|
-
|
|
177
|
+
// @implements A-SPEC-751.3 — the receipted runtime dispatcher is a launcher; the chain records the hop as such.
|
|
178
|
+
const viaDispatcher = harness === null && isDispatcher !== undefined && ['node', 'nodejs'].includes(exeName(row.args))
|
|
179
|
+
&& (() => { const script = nodeScriptOf(row.args); return script !== null && isDispatcher(script); })();
|
|
180
|
+
const shown = viaDispatcher ? 'dispatcher' : harness ?? (exeName(row.args) || '?');
|
|
118
181
|
chain.push(shown);
|
|
182
|
+
if (viaDispatcher) {
|
|
183
|
+
cur = row.ppid;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
119
186
|
if (harness !== null) {
|
|
120
187
|
if (typeof row.image !== 'string' || row.image === '') {
|
|
121
188
|
return { attested: false, chain, reason: `the executable image of ${shown} could not be read` };
|
|
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.operatorRecovery = operatorRecovery;
|
|
37
|
-
// @implements A-SPEC-754
|
|
37
|
+
// @implements A-SPEC-754, A-SPEC-532.3
|
|
38
38
|
const path = __importStar(require("node:path"));
|
|
39
39
|
const unsafeDisplay = /[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/;
|
|
40
40
|
function literal(value, platform) {
|
|
@@ -56,7 +56,10 @@ function operatorRecovery(root, target, operation, options) {
|
|
|
56
56
|
return '';
|
|
57
57
|
if (!command)
|
|
58
58
|
return `\n[승인 대기 ${id}] The request was recorded. Use the installed approval UI; a path exceeds the safe command display limit. No truncated command is provided.`;
|
|
59
|
+
// @implements A-SPEC-532.3 — the resident surface is offered beside the one-off command (owner, 2026-10-04:
|
|
60
|
+
// "why am I still pasting commands"): one key per arriving request.
|
|
59
61
|
return `\n[승인 대기 ${id}] 운영자: ${command} --grant ${literal(id, platform)}`
|
|
62
|
+
+ `\nOr keep the approval surface open and decide each arriving request with one key: ${command} --watch`
|
|
60
63
|
+ `\nAfter official approval, retry ${operation ? display(operation) : 'the original MCP operation'} for target ${display(target)} in the same workspace. Do not retry until approval is available.`;
|
|
61
64
|
},
|
|
62
65
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HOOK_ENFORCED_TOOLS = void 0;
|
|
4
|
-
// @implements A-SPEC-720, A-SPEC-718, A-SPEC-625, A-SPEC-564.1, A-SPEC-732, A-SPEC-734
|
|
4
|
+
// @implements A-SPEC-720, A-SPEC-718, A-SPEC-625, A-SPEC-564.1, A-SPEC-732, A-SPEC-734, A-SPEC-751.3
|
|
5
5
|
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
6
6
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
7
7
|
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
@@ -49,12 +49,15 @@ const elicit = async (req) => {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
// @implements A-SPEC-732 (round 2) — who launched this server, asked once, on first need.
|
|
52
|
-
const { attestHarness, systemProcLookup } = require('./harness-attestation');
|
|
52
|
+
const { attestHarness, systemProcLookup, dispatcherVerifier } = require('./harness-attestation');
|
|
53
|
+
// @implements A-SPEC-751.3 — the operator runtime registry's dispatcher is a launcher (it sits between the harness and
|
|
54
|
+
// this server on a registered machine); the path is the registry's fixed default, never taken from the request.
|
|
55
|
+
const runtimeRegistryPath = require('node:path').join(require('node:os').homedir(), '.holmes', 'runtime', 'bindings.json');
|
|
53
56
|
let attested;
|
|
54
57
|
const harnessAttestation = () => {
|
|
55
58
|
if (attested === undefined) {
|
|
56
59
|
try {
|
|
57
|
-
attested = attestHarness(process.ppid, systemProcLookup());
|
|
60
|
+
attested = attestHarness(process.ppid, systemProcLookup(), 8, dispatcherVerifier(runtimeRegistryPath));
|
|
58
61
|
}
|
|
59
62
|
catch {
|
|
60
63
|
attested = { attested: false, chain: [], reason: 'the process table could not be read' };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"//": "@implements A-SPEC-209",
|
|
3
3
|
"name": "@holmes-lab/holmes-kit",
|
|
4
|
-
"version": "0.35.
|
|
4
|
+
"version": "0.35.3",
|
|
5
5
|
"description": "Holmes-Kit — deterministic Agentic Software Engineering (ASE) harness with causal traceability (spec chain + D-CPG + RTM + phase guardrail)",
|
|
6
6
|
"main": "dist/holmes/mcp/server.js",
|
|
7
7
|
"types": "dist/holmes/mcp/server.d.ts",
|