@holmes-lab/holmes-kit 0.28.0 → 0.30.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 +100 -0
- package/README.md +24 -21
- package/dist/.build-id +1 -1
- package/dist/holmes/cli/agents-guidance-history.d.ts +1 -1
- package/dist/holmes/cli/agents-guidance-history.js +11 -2
- package/dist/holmes/cli/agents-guidance.d.ts +1 -0
- package/dist/holmes/cli/agents-guidance.js +11 -8
- package/dist/holmes/cli/codex-toml.d.ts +23 -1
- package/dist/holmes/cli/codex-toml.js +151 -4
- package/dist/holmes/cli/doctor.d.ts +11 -1
- package/dist/holmes/cli/doctor.js +113 -13
- package/dist/holmes/cli/init.d.ts +2 -0
- package/dist/holmes/cli/init.js +20 -40
- package/dist/holmes/cli/interactive-prompt.js +2 -2
- package/dist/holmes/cli/worktree-readiness.d.ts +1 -0
- package/dist/holmes/cli/worktree-readiness.js +17 -3
- package/dist/holmes/cpg/ast-mutation.d.ts +2 -0
- package/dist/holmes/cpg/ast-mutation.js +4 -2
- package/dist/holmes/cpg/foundation/cfg.d.ts +10 -0
- package/dist/holmes/cpg/foundation/cfg.js +27 -1
- package/dist/holmes/governance/autonomy.d.ts +9 -0
- package/dist/holmes/governance/autonomy.js +28 -1
- package/dist/holmes/hooks/rtm-refresh-child.d.ts +22 -1
- package/dist/holmes/hooks/rtm-refresh-child.js +100 -18
- package/dist/holmes/hooks/rtm-refresh.d.ts +20 -1
- package/dist/holmes/hooks/rtm-refresh.js +56 -15
- package/dist/holmes/mcp/approval-adapters.d.ts +22 -0
- package/dist/holmes/mcp/approval-adapters.js +21 -0
- package/dist/holmes/mcp/approval-commit.d.ts +21 -0
- package/dist/holmes/mcp/approval-commit.js +92 -0
- package/dist/holmes/mcp/approval-intent.d.ts +44 -0
- package/dist/holmes/mcp/approval-intent.js +67 -0
- package/dist/holmes/mcp/approval-policy.d.ts +14 -0
- package/dist/holmes/mcp/approval-policy.js +18 -0
- package/dist/holmes/mcp/elicit-approval.d.ts +2 -0
- package/dist/holmes/mcp/elicit-approval.js +5 -2
- package/dist/holmes/mcp/handlers/graph-operations.d.ts +24 -1
- package/dist/holmes/mcp/handlers/graph-operations.js +38 -6
- package/dist/holmes/mcp/handlers/maintenance-evidence.js +1 -1
- package/dist/holmes/mcp/handlers/requirement-triage.d.ts +142 -0
- package/dist/holmes/mcp/handlers/requirement-triage.js +220 -0
- package/dist/holmes/mcp/handlers/review-evidence.d.ts +2 -1
- package/dist/holmes/mcp/handlers/review-evidence.js +9 -5
- package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +7 -0
- package/dist/holmes/mcp/handlers/slice-orchestration.js +8 -1
- package/dist/holmes/mcp/handlers/spec-approval.d.ts +26 -2
- package/dist/holmes/mcp/handlers/spec-approval.js +72 -47
- package/dist/holmes/mcp/handlers/spec-authoring.js +20 -2
- package/dist/holmes/mcp/handlers.d.ts +153 -0
- package/dist/holmes/mcp/handlers.js +67 -13
- package/dist/holmes/mcp/maintenance-analyze.js +28 -4
- package/dist/holmes/mcp/maintenance-evidence.js +1 -1
- package/dist/holmes/mcp/requirement-triage-evidence.d.ts +45 -0
- package/dist/holmes/mcp/requirement-triage-evidence.js +149 -0
- package/dist/holmes/mcp/server.js +5 -3
- package/dist/holmes/mcp/supervisor.js +7 -3
- package/dist/holmes/mcp/tool-schemas.d.ts +8 -0
- package/dist/holmes/mcp/tool-schemas.js +44 -1
- package/dist/holmes/refresh/freshness-coordinator.d.ts +67 -0
- package/dist/holmes/refresh/freshness-coordinator.js +230 -0
- package/dist/holmes/review/condition-hunk-replay.d.ts +45 -0
- package/dist/holmes/review/condition-hunk-replay.js +122 -0
- package/dist/holmes/review/condition-hunk-resolution.d.ts +65 -0
- package/dist/holmes/review/condition-hunk-resolution.js +258 -0
- package/dist/holmes/review/requirement-triage-benchmark.d.ts +45 -0
- package/dist/holmes/review/requirement-triage-benchmark.js +72 -0
- package/dist/holmes/review/requirement-triage-human-records.d.ts +59 -0
- package/dist/holmes/review/requirement-triage-human-records.js +119 -0
- package/dist/holmes/review/requirement-triage.d.ts +61 -0
- package/dist/holmes/review/requirement-triage.js +143 -0
- package/dist/holmes/review/scope.js +6 -1
- package/dist/holmes/review/test-outcomes.d.ts +28 -0
- package/dist/holmes/review/test-outcomes.js +90 -1
- package/dist/holmes/semantic/local-model.d.ts +3 -3
- package/dist/holmes/semantic/local-model.js +10 -12
- package/dist/holmes/semantic/model-cache.d.ts +15 -6
- package/dist/holmes/semantic/model-cache.js +77 -21
- package/dist/holmes/semantic/tier.d.ts +5 -1
- package/dist/holmes/semantic/tier.js +7 -6
- package/dist/holmes/semantic/vector-coverage.d.ts +17 -0
- package/dist/holmes/semantic/vector-coverage.js +37 -0
- package/docs/install-guide.md +19 -24
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ exports.ANALYZE_TEXT_CAP = exports.ANALYZE_LIST_CAP = exports.PRIMARY_TIER_WIDTH
|
|
|
4
4
|
exports.unquoteGitPath = unquoteGitPath;
|
|
5
5
|
exports.analyzeMaintenance = analyzeMaintenance;
|
|
6
6
|
exports.boundAnalysis = boundAnalysis;
|
|
7
|
-
// @implements A-SPEC-310
|
|
7
|
+
// @implements A-SPEC-725, A-SPEC-310
|
|
8
8
|
// @implements A-SPEC-295
|
|
9
9
|
// @implements A-SPEC-294
|
|
10
10
|
// @implements A-SPEC-293
|
|
@@ -398,8 +398,32 @@ function analyzeMaintenance(input) {
|
|
|
398
398
|
// the pinned replay floors read that field and are unchanged by construction — and the reserved
|
|
399
399
|
// slots come out of the pool, which is material for the caller rather than a verdict.
|
|
400
400
|
const LEXICAL_GUARANTEE = 10;
|
|
401
|
+
const candidateHits = [...ordered.slice(0, LOCALIZATION_TOP_N)];
|
|
402
|
+
// @implements A-SPEC-725 — a cited request may have fewer than ten local lexical/spec results.
|
|
403
|
+
// Only then may a direct, scanned importer of the lexical leader fill a vacant slot: it is a
|
|
404
|
+
// local dependency fact, does not displace or reorder an emitted candidate, and is deliberately
|
|
405
|
+
// narrower than the cited-request graph expansion A-SPEC-407 rejected.
|
|
406
|
+
const citedForUnderfullWindow = (0, localize_1.citationsIn)(input.request, new Set(specs.map((spec) => spec.id))).cited;
|
|
407
|
+
if (citedForUnderfullWindow.length > 0 && candidateHits.length > 0 && candidateHits.length < LOCALIZATION_TOP_N) {
|
|
408
|
+
const emitted = new Set(candidateHits.map((hit) => hit.file));
|
|
409
|
+
const scannedPaths = new Set(scanned.map((file) => file.sourcePath));
|
|
410
|
+
for (const importer of input.graph.importersOf(candidateHits[0].file).sort()) {
|
|
411
|
+
if (candidateHits.length >= LOCALIZATION_TOP_N)
|
|
412
|
+
break;
|
|
413
|
+
if (emitted.has(importer) || !scannedPaths.has(importer) || (0, history_admission_1.isVendorPath)(importer))
|
|
414
|
+
continue;
|
|
415
|
+
candidateHits.push({
|
|
416
|
+
file: importer,
|
|
417
|
+
score: 0,
|
|
418
|
+
matchedSymbols: [],
|
|
419
|
+
viaSpecs: [],
|
|
420
|
+
why: [`reached through direct importer of ${candidateHits[0].file}`],
|
|
421
|
+
});
|
|
422
|
+
emitted.add(importer);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
401
425
|
const exposedTail = ordered.slice(LOCALIZATION_TOP_N);
|
|
402
|
-
const inCandidates = new Set(
|
|
426
|
+
const inCandidates = new Set(candidateHits.map((h) => h.file));
|
|
403
427
|
const wouldShow = new Set(exposedTail.slice(0, RERANK_POOL_N).map((h) => h.file));
|
|
404
428
|
const rescued = localization.hits.slice(0, LEXICAL_GUARANTEE)
|
|
405
429
|
.filter((h) => !inCandidates.has(h.file) && !wouldShow.has(h.file))
|
|
@@ -408,8 +432,8 @@ function analyzeMaintenance(input) {
|
|
|
408
432
|
const rescuedFiles = new Set(rescued.map((h) => h.file));
|
|
409
433
|
const rerankPool = [...rescued, ...exposedTail.filter((h) => !rescuedFiles.has(h.file))]
|
|
410
434
|
.slice(0, RERANK_POOL_N).map(shape);
|
|
411
|
-
const lexicalSymbolsOf = new Map(
|
|
412
|
-
const candidates =
|
|
435
|
+
const lexicalSymbolsOf = new Map(candidateHits.map((hit) => [hit.file, sortedUnique(hit.matchedSymbols)]));
|
|
436
|
+
const candidates = candidateHits.map((hit) => ({
|
|
413
437
|
file: hit.file,
|
|
414
438
|
score: hit.score,
|
|
415
439
|
// @implements A-SPEC-573.4 — the emitted list, which is what a caller reads and what the
|
|
@@ -42,7 +42,7 @@ exports.recordOutcome = recordOutcome;
|
|
|
42
42
|
exports.openArtifacts = openArtifacts;
|
|
43
43
|
exports.closeOpenArtifacts = closeOpenArtifacts;
|
|
44
44
|
exports.computeCalibration = computeCalibration;
|
|
45
|
-
// @implements A-SPEC-271
|
|
45
|
+
// @implements A-SPEC-724.1, A-SPEC-271
|
|
46
46
|
// @implements A-SPEC-268
|
|
47
47
|
const fs = __importStar(require("node:fs"));
|
|
48
48
|
const path = __importStar(require("node:path"));
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare const REQUIREMENT_TRIAGE_EVIDENCE_DIR: string;
|
|
2
|
+
export interface RequirementTriageArtifactV1 {
|
|
3
|
+
schema: 'requirement-triage-evidence/1';
|
|
4
|
+
promptDigest: string;
|
|
5
|
+
result: unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface RequirementTriageArtifact {
|
|
8
|
+
schema: 'requirement-triage-evidence/2';
|
|
9
|
+
promptDigest: string;
|
|
10
|
+
workspaceId: string;
|
|
11
|
+
head: string | null;
|
|
12
|
+
freshnessGeneration: string;
|
|
13
|
+
result: unknown;
|
|
14
|
+
}
|
|
15
|
+
type StoredArtifact = RequirementTriageArtifactV1 | RequirementTriageArtifact;
|
|
16
|
+
/** Writes an atomically published artifact addressed by its content digest. */
|
|
17
|
+
export declare function writeRequirementTriageEvidence(root: string, artifact: StoredArtifact): {
|
|
18
|
+
digest: string;
|
|
19
|
+
path: string;
|
|
20
|
+
};
|
|
21
|
+
/** Validates the address and all authoring-relevant bindings; v1 is advisory-only and never authoring evidence. */
|
|
22
|
+
export declare function validateTriageArtifact(root: string, digest: string, expected: {
|
|
23
|
+
promptDigest: string;
|
|
24
|
+
workspaceId: string;
|
|
25
|
+
head: string | null;
|
|
26
|
+
}): {
|
|
27
|
+
ok: true;
|
|
28
|
+
artifact: RequirementTriageArtifact;
|
|
29
|
+
} | {
|
|
30
|
+
ok: false;
|
|
31
|
+
reason: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* @implements A-SPEC-724 — the ONE intake boundary every REQ-creating act crosses (spec_create and
|
|
35
|
+
* spec_slice_init). A new REQ may be born only from a current, prompt-bound v2 triage artifact whose
|
|
36
|
+
* freshness receipt is the current one for this workspace and HEAD. Callers run their own
|
|
37
|
+
* deterministic refusals first and call this immediately before their first write.
|
|
38
|
+
*/
|
|
39
|
+
export declare function validateRequirementIntake(root: string, triageEvidence: unknown): {
|
|
40
|
+
ok: true;
|
|
41
|
+
} | {
|
|
42
|
+
ok: false;
|
|
43
|
+
reason: string;
|
|
44
|
+
};
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,149 @@
|
|
|
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.REQUIREMENT_TRIAGE_EVIDENCE_DIR = void 0;
|
|
37
|
+
exports.writeRequirementTriageEvidence = writeRequirementTriageEvidence;
|
|
38
|
+
exports.validateTriageArtifact = validateTriageArtifact;
|
|
39
|
+
exports.validateRequirementIntake = validateRequirementIntake;
|
|
40
|
+
// @implements A-SPEC-724, A-SPEC-719
|
|
41
|
+
// @implements A-SPEC-713
|
|
42
|
+
/** Content-addressed, isolated persistence for advisory requirement triage results. */
|
|
43
|
+
const crypto = __importStar(require("node:crypto"));
|
|
44
|
+
const fs = __importStar(require("node:fs"));
|
|
45
|
+
const path = __importStar(require("node:path"));
|
|
46
|
+
const node_child_process_1 = require("node:child_process");
|
|
47
|
+
const freshness_coordinator_1 = require("../refresh/freshness-coordinator");
|
|
48
|
+
exports.REQUIREMENT_TRIAGE_EVIDENCE_DIR = path.join('.ax', 'evidence', 'requirement-triage');
|
|
49
|
+
const sha256 = (text) => `sha256:${crypto.createHash('sha256').update(text).digest('hex')}`;
|
|
50
|
+
const DIGEST = /^sha256:[a-f0-9]{64}$/;
|
|
51
|
+
/** Canonical JSON keeps equivalent object construction from creating different evidence addresses. */
|
|
52
|
+
function stable(value) {
|
|
53
|
+
if (value === null || typeof value === 'boolean' || typeof value === 'string')
|
|
54
|
+
return JSON.stringify(value);
|
|
55
|
+
if (typeof value === 'number') {
|
|
56
|
+
if (!Number.isFinite(value))
|
|
57
|
+
throw new Error('requirement triage artifact contains a non-finite number');
|
|
58
|
+
return JSON.stringify(value);
|
|
59
|
+
}
|
|
60
|
+
if (Array.isArray(value))
|
|
61
|
+
return `[${value.map(stable).join(',')}]`;
|
|
62
|
+
if (typeof value === 'object') {
|
|
63
|
+
const row = value;
|
|
64
|
+
return `{${Object.keys(row).sort().map((key) => `${JSON.stringify(key)}:${stable(row[key])}`).join(',')}}`;
|
|
65
|
+
}
|
|
66
|
+
throw new Error('requirement triage artifact is not JSON-serializable');
|
|
67
|
+
}
|
|
68
|
+
/** Writes an atomically published artifact addressed by its content digest. */
|
|
69
|
+
function writeRequirementTriageEvidence(root, artifact) {
|
|
70
|
+
const v2 = artifact.schema === 'requirement-triage-evidence/2'
|
|
71
|
+
&& typeof artifact.workspaceId === 'string' && artifact.workspaceId !== ''
|
|
72
|
+
&& (typeof artifact.head === 'string' || artifact.head === null)
|
|
73
|
+
&& typeof artifact.freshnessGeneration === 'string' && artifact.freshnessGeneration !== '';
|
|
74
|
+
if ((!v2 && artifact.schema !== 'requirement-triage-evidence/1') || !DIGEST.test(artifact.promptDigest)) {
|
|
75
|
+
throw new Error('requirement triage artifact requires a sha256 prompt digest');
|
|
76
|
+
}
|
|
77
|
+
const body = `${stable(artifact)}\n`;
|
|
78
|
+
const digest = sha256(body);
|
|
79
|
+
const dir = path.join(root, exports.REQUIREMENT_TRIAGE_EVIDENCE_DIR);
|
|
80
|
+
const target = path.join(dir, `${digest.slice('sha256:'.length)}.json`);
|
|
81
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
82
|
+
if (!fs.existsSync(target)) {
|
|
83
|
+
const temp = `${target}.${process.pid}.tmp`;
|
|
84
|
+
fs.writeFileSync(temp, body, 'utf8');
|
|
85
|
+
fs.renameSync(temp, target);
|
|
86
|
+
}
|
|
87
|
+
return { digest, path: target };
|
|
88
|
+
}
|
|
89
|
+
/** Validates the address and all authoring-relevant bindings; v1 is advisory-only and never authoring evidence. */
|
|
90
|
+
function validateTriageArtifact(root, digest, expected) {
|
|
91
|
+
if (!DIGEST.test(digest))
|
|
92
|
+
return { ok: false, reason: 'triage evidence digest is malformed' };
|
|
93
|
+
const file = path.join(root, exports.REQUIREMENT_TRIAGE_EVIDENCE_DIR, `${digest.slice('sha256:'.length)}.json`);
|
|
94
|
+
let raw;
|
|
95
|
+
try {
|
|
96
|
+
raw = fs.readFileSync(file, 'utf8');
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return { ok: false, reason: 'triage evidence is missing' };
|
|
100
|
+
}
|
|
101
|
+
if (sha256(raw) !== digest)
|
|
102
|
+
return { ok: false, reason: 'triage evidence digest does not match its content' };
|
|
103
|
+
let artifact;
|
|
104
|
+
try {
|
|
105
|
+
artifact = JSON.parse(raw);
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return { ok: false, reason: 'triage evidence is unreadable' };
|
|
109
|
+
}
|
|
110
|
+
const a = artifact;
|
|
111
|
+
if (a.schema !== 'requirement-triage-evidence/2' || a.promptDigest !== expected.promptDigest
|
|
112
|
+
|| a.workspaceId !== expected.workspaceId || a.head !== expected.head || typeof a.freshnessGeneration !== 'string') {
|
|
113
|
+
return { ok: false, reason: 'triage evidence does not bind this prompt, workspace, and HEAD' };
|
|
114
|
+
}
|
|
115
|
+
return { ok: true, artifact: a };
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @implements A-SPEC-724 — the ONE intake boundary every REQ-creating act crosses (spec_create and
|
|
119
|
+
* spec_slice_init). A new REQ may be born only from a current, prompt-bound v2 triage artifact whose
|
|
120
|
+
* freshness receipt is the current one for this workspace and HEAD. Callers run their own
|
|
121
|
+
* deterministic refusals first and call this immediately before their first write.
|
|
122
|
+
*/
|
|
123
|
+
function validateRequirementIntake(root, triageEvidence) {
|
|
124
|
+
const evidence = triageEvidence;
|
|
125
|
+
if (!evidence || typeof evidence.digest !== 'string' || typeof evidence.promptDigest !== 'string') {
|
|
126
|
+
return { ok: false, reason: '새 REQ에는 requirement_triage가 발급한 현재 triage_evidence {digest,promptDigest}가 필요합니다. 같은 prompt로 requirement_triage(persist:true)를 실행한 뒤 다시 시도하십시오.' };
|
|
127
|
+
}
|
|
128
|
+
let head = null;
|
|
129
|
+
try {
|
|
130
|
+
head = (0, node_child_process_1.execFileSync)('git', ['-C', root, 'rev-parse', 'HEAD'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || null;
|
|
131
|
+
}
|
|
132
|
+
catch { /* non-git root is null */ }
|
|
133
|
+
const workspaceId = (0, freshness_coordinator_1.workspaceIdFor)(root);
|
|
134
|
+
const artifact = validateTriageArtifact(root, evidence.digest, { promptDigest: evidence.promptDigest, workspaceId, head });
|
|
135
|
+
if (!artifact.ok)
|
|
136
|
+
return { ok: false, reason: `새 REQ triage evidence를 검증할 수 없습니다: ${artifact.reason}` };
|
|
137
|
+
const receipt = (0, freshness_coordinator_1.readFreshnessReceipt)(root, { workspaceId, head, now: new Date() });
|
|
138
|
+
// A-SPEC-719: intake-usable, i.e. current graph and a current or owner-chosen lexical-only
|
|
139
|
+
// requirement lane; the source lane is reported, never required.
|
|
140
|
+
if (!receipt || !(0, freshness_coordinator_1.intakeUsable)(receipt) || receipt.generation !== artifact.artifact.freshnessGeneration) {
|
|
141
|
+
return { ok: false, reason: '새 REQ triage evidence의 fresh-evidence receipt가 현재 workspace/HEAD에서 current가 아닙니다. refresh가 완료된 뒤 requirement_triage를 다시 실행하십시오.' };
|
|
142
|
+
}
|
|
143
|
+
const verdict = artifact.artifact.result.verdict;
|
|
144
|
+
if (verdict === 'fulfilled')
|
|
145
|
+
return { ok: false, reason: 'triage 결과가 fulfilled입니다. 동일 요구사항의 새 REQ를 만들지 말고 기존 lineage를 사용하십시오.' };
|
|
146
|
+
if (verdict !== 'new' && verdict !== 'ambiguous')
|
|
147
|
+
return { ok: false, reason: `triage 결과 ${String(verdict)}는 새 REQ 생성 근거가 아닙니다. existing-change는 기존 REQ의 후속 변경으로 작성하십시오.` };
|
|
148
|
+
return { ok: true };
|
|
149
|
+
}
|
|
@@ -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-625, A-SPEC-564.1
|
|
4
|
+
// @implements A-SPEC-720, A-SPEC-718, A-SPEC-625, A-SPEC-564.1
|
|
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");
|
|
@@ -10,6 +10,7 @@ const handlers_1 = require("./handlers");
|
|
|
10
10
|
const tool_schemas_1 = require("./tool-schemas");
|
|
11
11
|
Object.defineProperty(exports, "HOOK_ENFORCED_TOOLS", { enumerable: true, get: function () { return tool_schemas_1.HOOK_ENFORCED_TOOLS; } });
|
|
12
12
|
const validate_args_1 = require("./validate-args");
|
|
13
|
+
const approval_adapters_1 = require("./approval-adapters");
|
|
13
14
|
// @implements A-SPEC-100.2
|
|
14
15
|
// @implements A-SPEC-652.2 — the store is opened at an ABSOLUTE path resolved against the project
|
|
15
16
|
// root (CLAUDE_PROJECT_DIR, then the nearest .mcp.json/.ax ancestor, then cwd), and the path is
|
|
@@ -35,7 +36,7 @@ const store = new spec_store_1.LocalMarkdownRepository(SPECS_DIR);
|
|
|
35
36
|
const { runElicitFlow } = require('./elicit-approval');
|
|
36
37
|
const elicit = async (req) => {
|
|
37
38
|
try {
|
|
38
|
-
if (!server.getClientCapabilities()
|
|
39
|
+
if (!(0, approval_adapters_1.supportsFormElicitation)(server.getClientCapabilities()))
|
|
39
40
|
return { kind: 'silent' };
|
|
40
41
|
return await runElicitFlow((form, timeoutMs) => server.elicitInput(form, { timeout: timeoutMs }), req);
|
|
41
42
|
}
|
|
@@ -45,6 +46,7 @@ const elicit = async (req) => {
|
|
|
45
46
|
};
|
|
46
47
|
const handlers = (0, handlers_1.makeHandlers)(store, {
|
|
47
48
|
elicit,
|
|
49
|
+
elicitationAvailable: () => (0, approval_adapters_1.supportsFormElicitation)(server.getClientCapabilities()),
|
|
48
50
|
observeInvocation: root => stampSession(root),
|
|
49
51
|
clientName: () => { try {
|
|
50
52
|
return server.getClientVersion()?.name ?? 'unknown';
|
|
@@ -126,7 +128,7 @@ const TOOLS = Object.keys(handlers)
|
|
|
126
128
|
.map((name) => {
|
|
127
129
|
const def = tool_schemas_1.TOOL_SCHEMAS[name];
|
|
128
130
|
return def
|
|
129
|
-
? { name, description: def.description, inputSchema: def.inputSchema }
|
|
131
|
+
? { name, description: def.description, inputSchema: def.inputSchema, ...(def.annotations ? { annotations: def.annotations } : {}) }
|
|
130
132
|
: { name, description: name, inputSchema: { type: 'object', properties: {} } };
|
|
131
133
|
});
|
|
132
134
|
server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({ tools: TOOLS }));
|
|
@@ -37,7 +37,7 @@ exports.Supervisor = exports.MAX_CONSECUTIVE_SILENT_DEATHS = exports.AUTORELOAD_
|
|
|
37
37
|
exports.autoreloadEnabled = autoreloadEnabled;
|
|
38
38
|
exports.shouldSwap = shouldSwap;
|
|
39
39
|
exports.createResponseCounter = createResponseCounter;
|
|
40
|
-
// @implements A-SPEC-162
|
|
40
|
+
// @implements A-SPEC-721, A-SPEC-162
|
|
41
41
|
const node_child_process_1 = require("node:child_process");
|
|
42
42
|
const path = __importStar(require("node:path"));
|
|
43
43
|
const basis_1 = require("./basis");
|
|
@@ -235,8 +235,12 @@ class Supervisor {
|
|
|
235
235
|
spawnChild(stdout) {
|
|
236
236
|
// `stdio: ['pipe','pipe','pipe']` keeps the typed streams non-null; the child's stderr is
|
|
237
237
|
// forwarded rather than inherited so a supervised run logs identically to an unsupervised one.
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
// @implements A-SPEC-721 — the child runs where the unsupervised server would: the launcher's own
|
|
239
|
+
// working directory, i.e. the harness session's workspace. The package root is only where the
|
|
240
|
+
// code lives; running the child there bound Codex sessions (autoreload on, no HOLMES_SPECS) to
|
|
241
|
+
// the package instead of the user's project.
|
|
242
|
+
const child = (0, node_child_process_1.spawn)('node', [path.join(this.repoRoot, 'dist', 'holmes', 'mcp', 'server.js')], {
|
|
243
|
+
cwd: process.cwd(), stdio: ['pipe', 'pipe', 'pipe'],
|
|
240
244
|
});
|
|
241
245
|
child.stderr.on('data', (d) => process.stderr.write(d));
|
|
242
246
|
this.child = child;
|
|
@@ -7,6 +7,14 @@ export interface JsonSchema {
|
|
|
7
7
|
export interface ToolSchema {
|
|
8
8
|
description: string;
|
|
9
9
|
inputSchema: JsonSchema;
|
|
10
|
+
/** MCP presentation hints. They ask the host to show a confirmation; they are never authority. */
|
|
11
|
+
annotations?: {
|
|
12
|
+
title?: string;
|
|
13
|
+
readOnlyHint?: boolean;
|
|
14
|
+
destructiveHint?: boolean;
|
|
15
|
+
idempotentHint?: boolean;
|
|
16
|
+
openWorldHint?: boolean;
|
|
17
|
+
};
|
|
10
18
|
}
|
|
11
19
|
export declare const HOOK_ENFORCED_TOOLS: Set<string>;
|
|
12
20
|
export declare const TOOL_SCHEMAS: Record<string, ToolSchema>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TOOL_SCHEMAS = exports.HOOK_ENFORCED_TOOLS = void 0;
|
|
4
|
-
// @implements A-SPEC-703, A-SPEC-629, A-SPEC-628, A-SPEC-623, A-SPEC-277, A-SPEC-624, A-SPEC-627
|
|
4
|
+
// @implements A-SPEC-719, A-SPEC-720, A-SPEC-718, A-SPEC-703, A-SPEC-629, A-SPEC-628, A-SPEC-623, A-SPEC-277, A-SPEC-624, A-SPEC-627, A-SPEC-713
|
|
5
5
|
// @implements A-SPEC-495 — the maintenance_analyze description carries the semantic-evidence
|
|
6
6
|
// consumer contract (sem-verify / semCos / semanticAlternates) beside the anti-prediction warning.
|
|
7
7
|
// @implements A-SPEC-642
|
|
@@ -38,6 +38,26 @@ const ROOT_ANY = str('Absolute path to the project root. Version control is opti
|
|
|
38
38
|
// the rest of the tool metadata and has no import side effects.
|
|
39
39
|
exports.HOOK_ENFORCED_TOOLS = new Set(['phase_check', 'risk_check', 'rtm_check', 'spec_validate']);
|
|
40
40
|
exports.TOOL_SCHEMAS = {
|
|
41
|
+
approval_commit: {
|
|
42
|
+
description: 'Complete a server-issued, one-use in-session approval continuation. This sensitive annotation asks the host to show its native tool confirmation; the server records arrival only as a host-gated continuation, never proof of a human response. Send the unmodified approvalIntent returned by the original refused action, then retry that original action. The server verifies challenge, kind, target, subject digest, workspace, session run and expiry; this tool never reads HOLMES_APPROVAL or writes configuration.',
|
|
43
|
+
annotations: { title: 'Holmes-Kit approval confirmation', readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
|
|
44
|
+
inputSchema: {
|
|
45
|
+
type: 'object',
|
|
46
|
+
properties: {
|
|
47
|
+
id: str('Opaque server-issued approval intent id.'),
|
|
48
|
+
challenge: str('Opaque one-use server challenge; copy unchanged from approvalIntent.'),
|
|
49
|
+
kind: str('Canonical action kind displayed by the host.'),
|
|
50
|
+
target: str('Canonical action target displayed by the host.'),
|
|
51
|
+
subject: str('Exact subject digest displayed by the host.'),
|
|
52
|
+
workspace: str('Server-derived workspace binding displayed by the host.'),
|
|
53
|
+
runId: str('Server session binding displayed by the host.'),
|
|
54
|
+
harness: str('Detected harness name displayed by the host.'),
|
|
55
|
+
expiresAt: str('Server-issued expiry timestamp displayed by the host.'),
|
|
56
|
+
},
|
|
57
|
+
required: ['id', 'challenge', 'kind', 'target', 'subject', 'workspace', 'runId', 'harness', 'expiresAt'],
|
|
58
|
+
additionalProperties: false,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
41
61
|
entity_integrate: {
|
|
42
62
|
description: 'Plan integration of fixed common-ancestor Git inputs for the configured adopted store, apply an exact approved plan, inspect an operation recovery-plan, or recover it with current authority. Preserves entity UUIDs and explicit conflicts, coordinates store/source ownership, journals publication and records completion audit and derived-state obligations. Leaves Git refs/index unchanged. Completed retries verify existing evidence without republishing. discharge rebuilds this replica\'s graph and semantic cache for a completed operation and records one immutable discharge.json bound to its obligations; obligations lists completed operations with pending, discharged or invalid obligations (read-only). abandon rolls a pending operation a third state blocked back to its own before-bytes, preserves foreign bytes, releases ownership and audits the abandonment. Unsupported inputs remain explicit blockers; no implicit adoption or approval.',
|
|
43
63
|
inputSchema: { type: 'object', properties: { root: ROOT_ANY, operation: { type: 'string', enum: ['plan', 'apply', 'recovery-plan', 'recover', 'abandon', 'discharge', 'obligations'] },
|
|
@@ -104,6 +124,11 @@ exports.TOOL_SCHEMAS = {
|
|
|
104
124
|
// silently, with no refusal. Declaring it makes the control surface visible; the data
|
|
105
125
|
// exemption stays for genuine frontmatter.
|
|
106
126
|
root: ROOT,
|
|
127
|
+
triage_evidence: {
|
|
128
|
+
type: 'object', description: 'Required for a new REQ: current requirement_triage(persist:true) v2 evidence.',
|
|
129
|
+
properties: { digest: str('Content-addressed triage evidence digest.'), promptDigest: str('Digest of the exact authoring prompt.') },
|
|
130
|
+
required: ['digest', 'promptDigest'],
|
|
131
|
+
},
|
|
107
132
|
},
|
|
108
133
|
required: ['type', 'id', 'title'],
|
|
109
134
|
additionalProperties: true,
|
|
@@ -366,6 +391,19 @@ exports.TOOL_SCHEMAS = {
|
|
|
366
391
|
required: ['root', 'request'],
|
|
367
392
|
},
|
|
368
393
|
},
|
|
394
|
+
requirement_triage: {
|
|
395
|
+
description: 'Read-only requirement lifecycle advisory. BM25 always ranks governed REQ/H-SPEC/A-SPEC/T-SPEC lineages; cached local BGE-M3 or explicit Gemini candidates are additive. Content, approval, implementation-anchor, and fresh execution evidence determine fulfilled, existing-change, new, or ambiguous. It never creates, edits, approves, unseals, retires, or opens a source-edit gate.',
|
|
396
|
+
inputSchema: {
|
|
397
|
+
type: 'object',
|
|
398
|
+
properties: {
|
|
399
|
+
root: ROOT_ANY,
|
|
400
|
+
prompt: str('User requirement or requested behavior to compare with governed requirement lineages.'),
|
|
401
|
+
topK: num('Maximum displayed candidate lineages (default 10, clamped to 1..20).'),
|
|
402
|
+
persist: bool('Write only a content-addressed requirement-triage evidence artifact. Default false.'),
|
|
403
|
+
},
|
|
404
|
+
required: ['root', 'prompt'],
|
|
405
|
+
},
|
|
406
|
+
},
|
|
369
407
|
maintenance_outcome: {
|
|
370
408
|
description: 'Record what a change actually touched against a previously persisted maintenance analysis, so the prediction can later be scored. The digest must name an analysis this project already stored.',
|
|
371
409
|
inputSchema: {
|
|
@@ -609,6 +647,11 @@ exports.TOOL_SCHEMAS = {
|
|
|
609
647
|
title: str('Title for the requirement and specs.'),
|
|
610
648
|
objective: str('High-level objective or problem statement.'),
|
|
611
649
|
filesToTouch: strArray('List of source/test file paths to be touched by this slice.'),
|
|
650
|
+
triage_evidence: {
|
|
651
|
+
type: 'object', description: 'Required: this call creates a new REQ, so it needs current requirement_triage(persist:true) v2 evidence for the same prompt, exactly as spec_create(type=REQ) does.',
|
|
652
|
+
properties: { digest: str('Content-addressed triage evidence digest.'), promptDigest: str('Digest of the exact authoring prompt.') },
|
|
653
|
+
required: ['digest', 'promptDigest'],
|
|
654
|
+
},
|
|
612
655
|
},
|
|
613
656
|
required: ['sliceName', 'title', 'objective', 'filesToTouch'],
|
|
614
657
|
},
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export type FreshnessLane = 'current' | 'refreshing' | 'retry-at' | 'failed' | 'suppressed' | 'not-adopted' | 'stale';
|
|
2
|
+
export interface FreshnessReceipt {
|
|
3
|
+
schema: 'fresh-evidence/1';
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
head: string | null;
|
|
6
|
+
generation: string;
|
|
7
|
+
state: FreshnessLane;
|
|
8
|
+
startedAt?: string;
|
|
9
|
+
completedAt?: string;
|
|
10
|
+
attempt: number;
|
|
11
|
+
retryAt?: string;
|
|
12
|
+
graph: FreshnessLane;
|
|
13
|
+
sourceSemantic: FreshnessLane;
|
|
14
|
+
requirementSemantic: FreshnessLane;
|
|
15
|
+
}
|
|
16
|
+
export interface RefreshRequest {
|
|
17
|
+
workspaceId: string;
|
|
18
|
+
head: string | null;
|
|
19
|
+
now: Date;
|
|
20
|
+
}
|
|
21
|
+
export interface RefreshCompletion {
|
|
22
|
+
graph: FreshnessLane;
|
|
23
|
+
sourceSemantic: FreshnessLane;
|
|
24
|
+
requirementSemantic: FreshnessLane;
|
|
25
|
+
head: string | null;
|
|
26
|
+
}
|
|
27
|
+
export declare const FRESHNESS_RECEIPT_FILE: string;
|
|
28
|
+
export declare const FRESHNESS_LEASE_MS: number;
|
|
29
|
+
/** A failed detached worker is visible immediately but retries only after this bounded pause. */
|
|
30
|
+
export declare const FRESHNESS_RETRY_MS: number;
|
|
31
|
+
/**
|
|
32
|
+
* A usable terminal receipt coalesces for its HEAD only this long. HEAD alone does not move while
|
|
33
|
+
* someone edits, so without an interval the graph would never refresh between commits — the former
|
|
34
|
+
* marker's 30-minute window, which A-SPEC-566.4 measured as the advisory's quality factor.
|
|
35
|
+
*/
|
|
36
|
+
export declare const FRESHNESS_REREFRESH_MS: number;
|
|
37
|
+
/**
|
|
38
|
+
* Whether a receipt can ground requirement intake: a current graph plus a requirement lane that is
|
|
39
|
+
* current or the owner-chosen lexical-only `not-adopted`/`suppressed`. The source lane never counts.
|
|
40
|
+
*/
|
|
41
|
+
export declare function intakeUsable(receipt: FreshnessReceipt | null | undefined): boolean;
|
|
42
|
+
/** Usable, but without requirement vectors: triage ran on lexical evidence alone. */
|
|
43
|
+
export declare function lexicalOnly(receipt: FreshnessReceipt | null | undefined): boolean;
|
|
44
|
+
/** Read-only judgement: untrusted, expired, foreign, and commit-mismatched state is never current. */
|
|
45
|
+
export declare function readFreshnessReceipt(root: string, expected: RefreshRequest): FreshnessReceipt | null;
|
|
46
|
+
/**
|
|
47
|
+
* Publish a new lease before the detached worker is started. The caller alone
|
|
48
|
+
* performs spawning when `spawn` is true; all matching live callers coalesce.
|
|
49
|
+
*/
|
|
50
|
+
export declare function requestRefresh(root: string, input: RefreshRequest): {
|
|
51
|
+
spawn: boolean;
|
|
52
|
+
receipt: FreshnessReceipt;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* True only while `generation` still holds the live lease in an existing root. A worker asks this
|
|
56
|
+
* before each phase that writes, so a superseded or orphaned child stops instead of recreating
|
|
57
|
+
* `.ax` under a root that was removed (A-SPEC-724).
|
|
58
|
+
*/
|
|
59
|
+
export declare function ownsLease(root: string, generation: string): boolean;
|
|
60
|
+
/** Publish only the lease owner’s terminal observation; a superseded worker cannot overwrite a newer lease. */
|
|
61
|
+
export declare function completeRefresh(root: string, generation: string, completion: RefreshCompletion, now: Date): FreshnessReceipt | null;
|
|
62
|
+
/**
|
|
63
|
+
* Initialized/registered workspaces use their governed identity. Legacy
|
|
64
|
+
* workspaces remain safe to refresh: their canonical real path is a local,
|
|
65
|
+
* deterministic identity and is never persisted as a secret or sent remotely.
|
|
66
|
+
*/
|
|
67
|
+
export declare function workspaceIdFor(root: string): string;
|