@holmes-lab/holmes-kit 0.2.1 → 0.3.1
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 +55 -0
- package/dist/.build-id +1 -1
- package/dist/holmes/assoc/assoc-arm.d.ts +94 -0
- package/dist/holmes/assoc/assoc-arm.js +187 -0
- package/dist/holmes/assoc/explore.d.ts +21 -0
- package/dist/holmes/assoc/explore.js +160 -0
- package/dist/holmes/assoc/impact-baseline.d.ts +13 -0
- package/dist/holmes/assoc/impact-baseline.js +48 -0
- package/dist/holmes/assoc/ppr.d.ts +64 -0
- package/dist/holmes/assoc/ppr.js +110 -0
- package/dist/holmes/cli/agents.d.ts +24 -11
- package/dist/holmes/cli/agents.js +93 -21
- package/dist/holmes/cli/doctor.d.ts +56 -0
- package/dist/holmes/cli/doctor.js +311 -5
- package/dist/holmes/cli/index.js +13 -1
- package/dist/holmes/cli/semantic-key.d.ts +19 -0
- package/dist/holmes/cli/semantic-key.js +93 -0
- package/dist/holmes/config/config.d.ts +9 -0
- package/dist/holmes/config/config.js +8 -1
- package/dist/holmes/cpg/language-capability.d.ts +65 -0
- package/dist/holmes/cpg/language-capability.js +145 -0
- package/dist/holmes/cpg/language-parser-walk.js +179 -34
- package/dist/holmes/cpg/language-parser.d.ts +1 -1
- package/dist/holmes/governance/ledger-rechain.d.ts +12 -0
- package/dist/holmes/governance/ledger-rechain.js +17 -2
- package/dist/holmes/governance/provenance-ledger.js +21 -0
- package/dist/holmes/guardrail/blind-spots.js +12 -1
- package/dist/holmes/guardrail/impact-gate.d.ts +77 -0
- package/dist/holmes/guardrail/impact-gate.js +263 -0
- package/dist/holmes/guardrail/write-target.d.ts +38 -1
- package/dist/holmes/guardrail/write-target.js +41 -4
- package/dist/holmes/hooks/adapters/antigravity.js +12 -1
- package/dist/holmes/hooks/corrupt-state-run.d.ts +33 -0
- package/dist/holmes/hooks/corrupt-state-run.js +16 -0
- package/dist/holmes/hooks/pre-tool-use.d.ts +26 -0
- package/dist/holmes/hooks/pre-tool-use.js +203 -11
- package/dist/holmes/hooks/stop.d.ts +65 -0
- package/dist/holmes/hooks/stop.js +200 -2
- package/dist/holmes/mcp/elicit-approval.d.ts +32 -2
- package/dist/holmes/mcp/elicit-approval.js +30 -2
- package/dist/holmes/mcp/handlers.d.ts +88 -0
- package/dist/holmes/mcp/handlers.js +636 -35
- package/dist/holmes/mcp/maintenance-analyze.d.ts +435 -0
- package/dist/holmes/mcp/maintenance-analyze.js +994 -0
- package/dist/holmes/mcp/maintenance-evidence.d.ts +140 -0
- package/dist/holmes/mcp/maintenance-evidence.js +253 -0
- package/dist/holmes/mcp/server.js +13 -10
- package/dist/holmes/mcp/tool-schemas.js +71 -0
- package/dist/holmes/project/root.js +3 -1
- package/dist/holmes/review/baseline-arm.d.ts +37 -0
- package/dist/holmes/review/baseline-arm.js +51 -0
- package/dist/holmes/review/captured-stdin-guard.d.ts +8 -0
- package/dist/holmes/review/captured-stdin-guard.js +48 -0
- package/dist/holmes/review/coherence-verify.d.ts +31 -0
- package/dist/holmes/review/coherence-verify.js +144 -0
- package/dist/holmes/review/commit-text.d.ts +50 -0
- package/dist/holmes/review/commit-text.js +76 -0
- package/dist/holmes/review/confidence-calibration.d.ts +39 -0
- package/dist/holmes/review/confidence-calibration.js +39 -0
- package/dist/holmes/review/content-baseline.d.ts +38 -0
- package/dist/holmes/review/content-baseline.js +103 -0
- package/dist/holmes/review/content-verify.d.ts +20 -0
- package/dist/holmes/review/content-verify.js +73 -0
- package/dist/holmes/review/dense-retrieval.d.ts +66 -0
- package/dist/holmes/review/dense-retrieval.js +97 -0
- package/dist/holmes/review/edge-quality.d.ts +44 -0
- package/dist/holmes/review/edge-quality.js +117 -0
- package/dist/holmes/review/evaluation-metrics.d.ts +138 -0
- package/dist/holmes/review/evaluation-metrics.js +175 -0
- package/dist/holmes/review/graph-verifier.d.ts +34 -0
- package/dist/holmes/review/graph-verifier.js +62 -0
- package/dist/holmes/review/hop-ablation.d.ts +100 -0
- package/dist/holmes/review/hop-ablation.js +89 -0
- package/dist/holmes/review/manual-baseline.d.ts +209 -0
- package/dist/holmes/review/manual-baseline.js +2846 -0
- package/dist/holmes/review/oracle-gap.d.ts +32 -0
- package/dist/holmes/review/oracle-gap.js +102 -0
- package/dist/holmes/review/point-in-time-replay.d.ts +41 -0
- package/dist/holmes/review/point-in-time-replay.js +161 -0
- package/dist/holmes/review/rank-diagnosis.d.ts +43 -0
- package/dist/holmes/review/rank-diagnosis.js +163 -0
- package/dist/holmes/review/replay-calibration.d.ts +62 -0
- package/dist/holmes/review/replay-calibration.js +83 -0
- package/dist/holmes/review/replay-corpus.d.ts +135 -0
- package/dist/holmes/review/replay-corpus.js +210 -0
- package/dist/holmes/review/run-replay.d.ts +260 -0
- package/dist/holmes/review/run-replay.js +729 -0
- package/dist/holmes/review/semantic-arm.d.ts +271 -0
- package/dist/holmes/review/semantic-arm.js +717 -0
- package/dist/holmes/review/semantic-retrieval.d.ts +55 -0
- package/dist/holmes/review/semantic-retrieval.js +156 -0
- package/dist/holmes/review/spec-layer-stats.d.ts +38 -0
- package/dist/holmes/review/spec-layer-stats.js +52 -0
- package/dist/holmes/review/temporal-prior.d.ts +33 -0
- package/dist/holmes/review/temporal-prior.js +53 -0
- package/dist/holmes/review/test-runner.d.ts +15 -0
- package/dist/holmes/review/test-runner.js +41 -4
- package/dist/holmes/review/test-selection-breadth.d.ts +75 -0
- package/dist/holmes/review/test-selection-breadth.js +57 -0
- package/dist/holmes/review/traceability-benchmark.d.ts +81 -0
- package/dist/holmes/review/traceability-benchmark.js +135 -0
- package/dist/holmes/review/union-verify.d.ts +12 -0
- package/dist/holmes/review/union-verify.js +70 -0
- package/dist/holmes/rtm/graph-store.d.ts +51 -0
- package/dist/holmes/rtm/graph-store.js +122 -0
- package/dist/holmes/rtm/incremental.d.ts +25 -1
- package/dist/holmes/rtm/incremental.js +18 -1
- package/dist/holmes/rtm/localize.d.ts +28 -0
- package/dist/holmes/rtm/localize.js +272 -14
- package/dist/holmes/rtm/rtm-builder.d.ts +118 -3
- package/dist/holmes/rtm/rtm-builder.js +265 -28
- package/dist/holmes/rtm/rtm-graph.d.ts +117 -2
- package/dist/holmes/rtm/rtm-graph.js +194 -31
- package/dist/holmes/rtm/taint-benchmark.d.ts +97 -0
- package/dist/holmes/rtm/taint-benchmark.js +141 -0
- package/dist/holmes/rtm/test-scope.js +24 -1
- package/dist/holmes/semantic/credentials.d.ts +15 -0
- package/dist/holmes/semantic/credentials.js +134 -0
- package/dist/holmes/semantic/embedder.d.ts +44 -0
- package/dist/holmes/semantic/embedder.js +185 -0
- package/dist/holmes/semantic/hit-rerank.d.ts +4 -0
- package/dist/holmes/semantic/hit-rerank.js +38 -0
- package/dist/holmes/semantic/tier.d.ts +37 -0
- package/dist/holmes/semantic/tier.js +54 -0
- package/dist/holmes/semantic/vector-cache.d.ts +11 -0
- package/dist/holmes/semantic/vector-cache.js +91 -0
- package/dist/holmes/spec/acceptance-quality.d.ts +81 -0
- package/dist/holmes/spec/acceptance-quality.js +169 -0
- package/dist/holmes/spec/validator.js +33 -1
- package/dist/holmes/spec/yaml-scalar.d.ts +1 -0
- package/dist/holmes/spec/yaml-scalar.js +43 -0
- package/package.json +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// @implements A-SPEC-263.1
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ELICITABLE_KINDS = void 0;
|
|
4
|
+
exports.ELICIT_TIMEOUT_MS = exports.ELICITABLE_KINDS = void 0;
|
|
5
|
+
exports.classifyElicitError = classifyElicitError;
|
|
6
|
+
exports.expiredNotice = expiredNotice;
|
|
5
7
|
exports.buildElicitRequest = buildElicitRequest;
|
|
6
8
|
exports.interpretElicitResult = interpretElicitResult;
|
|
7
9
|
/**
|
|
@@ -26,6 +28,29 @@ exports.interpretElicitResult = interpretElicitResult;
|
|
|
26
28
|
*/
|
|
27
29
|
/** Approval kinds that may ask in-session. Widening this set is a spec revision, not a drive-by. */
|
|
28
30
|
exports.ELICITABLE_KINDS = new Set(['spec-approve', 'review-resolve']);
|
|
31
|
+
/** The one timeout truth: the SDK option, the dialog forewarning and `waitedMs` all derive from it. */
|
|
32
|
+
exports.ELICIT_TIMEOUT_MS = 120_000;
|
|
33
|
+
// This module is PURE (no SDK import — the doctrine above), so the SDK's ErrorCode.RequestTimeout
|
|
34
|
+
// lives here as a pinned constant; elicit-expiry.test.ts asserts parity against the real enum.
|
|
35
|
+
const MCP_REQUEST_TIMEOUT_CODE = -32001;
|
|
36
|
+
/**
|
|
37
|
+
* Classify an elicitInput rejection. Only the exact SDK timeout code — on a real Error — is
|
|
38
|
+
* `expired`; a message that merely SAYS "timed out", a near-miss code, or a code on a non-Error
|
|
39
|
+
* is `silent`, because the expiry face carries friendlier guidance and must not be spoofable.
|
|
40
|
+
*/
|
|
41
|
+
function classifyElicitError(e) {
|
|
42
|
+
return e instanceof Error && e.code === MCP_REQUEST_TIMEOUT_CODE
|
|
43
|
+
? { kind: 'expired', waitedMs: exports.ELICIT_TIMEOUT_MS }
|
|
44
|
+
: { kind: 'silent' };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The expiry notice that LEADS an expired refusal: what happened (the session dialog expired),
|
|
48
|
+
* where the request went (the approval queue), and where the decision still lives (the CLI).
|
|
49
|
+
* Template-owned text with no interpolated attacker data.
|
|
50
|
+
*/
|
|
51
|
+
function expiredNotice(waitedMs) {
|
|
52
|
+
return `[세션 승인 다이얼로그 만료 — ${Math.round(waitedMs / 1000)}초 무응답] 요청은 승인 큐로 회송되었습니다. 결정: npx holmes-kit approve. `;
|
|
53
|
+
}
|
|
29
54
|
/**
|
|
30
55
|
* The question form. Decisions only (REQ-263 Out): the single free-text field is `reason`, and it
|
|
31
56
|
* is subordinate to the decision — this channel never collects arbitrary input.
|
|
@@ -38,7 +63,10 @@ function buildElicitRequest(req) {
|
|
|
38
63
|
const flat = (s, max) => s.replace(/[\u0000-\u001f\u007f\u0085\u2028\u2029\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff]+/g, ' ')
|
|
39
64
|
.replace(/\s{2,}/g, ' ').trim().slice(0, max);
|
|
40
65
|
return {
|
|
41
|
-
|
|
66
|
+
// @implements A-SPEC-497.1 — the forewarning is the LAST line and template-owned: it survives a
|
|
67
|
+
// cap-filling summary (appended after the caps) and tells the human, before the clock runs out,
|
|
68
|
+
// where an undecided request goes and where the decision still lives.
|
|
69
|
+
message: `[Holmes-Kit 승인 요청] ${flat(req.kind, 40)} — ${flat(req.target, 80)}\n${flat(req.summary, 200)}\n승인(approve) / 거부(deny) / 질문(question) 을 선택하세요. 사유는 선택입니다.\n⏱ ${exports.ELICIT_TIMEOUT_MS / 1000}초 내 미결정 시 승인 큐로 회송됩니다(운영자: npx holmes-kit approve).`,
|
|
42
70
|
requestedSchema: {
|
|
43
71
|
type: 'object',
|
|
44
72
|
properties: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SpecStore } from '../spec/spec-store';
|
|
2
|
+
import { MaintenanceGroundTruth, MaintenanceAnalysis } from './maintenance-analyze';
|
|
2
3
|
import { Action } from '../guardrail/phase';
|
|
3
4
|
import { Basis } from './basis';
|
|
4
5
|
import { Finding } from '../review/findings';
|
|
@@ -36,6 +37,14 @@ export interface ElicitOpts {
|
|
|
36
37
|
elicit?: Elicitor;
|
|
37
38
|
clientName?: () => string;
|
|
38
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* @implements A-SPEC-299
|
|
42
|
+
* Ids that were written but cannot be read back. The store drops documents it cannot parse, so
|
|
43
|
+
* absence from `list()` — not an exception — is the signal.
|
|
44
|
+
*/
|
|
45
|
+
export declare function unreadableAmong(listed: ReadonlyArray<{
|
|
46
|
+
id: string;
|
|
47
|
+
}>, created: readonly string[]): string[];
|
|
39
48
|
export declare function makeHandlers(store: SpecStore, opts?: ElicitOpts): RawHandlers & {
|
|
40
49
|
basis_detail(a: {
|
|
41
50
|
root?: string;
|
|
@@ -188,12 +197,22 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
|
|
|
188
197
|
rtm_check(a?: {
|
|
189
198
|
root?: string;
|
|
190
199
|
}): Promise<{
|
|
200
|
+
ok: boolean;
|
|
201
|
+
reason: string;
|
|
202
|
+
issues?: undefined;
|
|
203
|
+
gaps?: undefined;
|
|
204
|
+
breakingChangeDistribution?: undefined;
|
|
205
|
+
} | {
|
|
191
206
|
issues: import("../rtm/rtm-check").RtmIssue[];
|
|
192
207
|
gaps: import("../rtm/gap-analyzer").ConvergenceGaps;
|
|
193
208
|
breakingChangeDistribution: Record<string, number>;
|
|
209
|
+
ok?: undefined;
|
|
210
|
+
reason?: undefined;
|
|
194
211
|
} | {
|
|
195
212
|
issues: import("../rtm/rtm-check").RtmIssue[];
|
|
196
213
|
breakingChangeDistribution: Record<string, number>;
|
|
214
|
+
ok?: undefined;
|
|
215
|
+
reason?: undefined;
|
|
197
216
|
gaps?: undefined;
|
|
198
217
|
}>;
|
|
199
218
|
/**
|
|
@@ -272,11 +291,21 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
|
|
|
272
291
|
taint_scan(a: {
|
|
273
292
|
root: string;
|
|
274
293
|
}): Promise<{
|
|
294
|
+
ok: boolean;
|
|
295
|
+
reason: string;
|
|
296
|
+
kind?: undefined;
|
|
297
|
+
limits?: undefined;
|
|
298
|
+
maxPaths?: undefined;
|
|
299
|
+
truncated?: undefined;
|
|
300
|
+
pairs?: undefined;
|
|
301
|
+
} | {
|
|
275
302
|
kind: string;
|
|
276
303
|
limits: ("name-based matching" | "no def-use" | "no sanitizers" | "call-edge-only")[];
|
|
277
304
|
maxPaths: number | undefined;
|
|
278
305
|
truncated: number;
|
|
279
306
|
pairs: import("../rtm/taint").TaintPair[];
|
|
307
|
+
ok?: undefined;
|
|
308
|
+
reason?: undefined;
|
|
280
309
|
}>;
|
|
281
310
|
test_run(a: {
|
|
282
311
|
root: string;
|
|
@@ -302,12 +331,57 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
|
|
|
302
331
|
issue: string;
|
|
303
332
|
topN?: number;
|
|
304
333
|
}): Promise<import("../rtm/localize").LocalizationReport>;
|
|
334
|
+
maintenance_analyze(a: {
|
|
335
|
+
root: string;
|
|
336
|
+
request: string;
|
|
337
|
+
historyLimit?: number;
|
|
338
|
+
contextBudget?: number;
|
|
339
|
+
groundTruth?: MaintenanceGroundTruth;
|
|
340
|
+
persist?: boolean;
|
|
341
|
+
changedFiles?: string[];
|
|
342
|
+
}): Promise<MaintenanceAnalysis & {
|
|
343
|
+
persistedTo?: string;
|
|
344
|
+
}>;
|
|
345
|
+
maintenance_outcome(a: {
|
|
346
|
+
root: string;
|
|
347
|
+
digest: string;
|
|
348
|
+
actualFiles?: string[];
|
|
349
|
+
actualSymbols?: string[];
|
|
350
|
+
actualTests?: string[];
|
|
351
|
+
actualClassification?: string;
|
|
352
|
+
}): Promise<import("./maintenance-evidence").EvidenceArtifact>;
|
|
353
|
+
impact_gate_check(a: {
|
|
354
|
+
root: string;
|
|
355
|
+
target: string;
|
|
356
|
+
digest?: string;
|
|
357
|
+
}): Promise<import("../guardrail/impact-gate").EditEvidenceVerdict>;
|
|
358
|
+
maintenance_calibration(a: {
|
|
359
|
+
root: string;
|
|
360
|
+
minSamples?: number;
|
|
361
|
+
}): Promise<{
|
|
362
|
+
artifacts: number;
|
|
363
|
+
unreadable: string[];
|
|
364
|
+
skippedSchema: number;
|
|
365
|
+
schema: string;
|
|
366
|
+
n: number;
|
|
367
|
+
withoutClassification: number;
|
|
368
|
+
bins: import("./maintenance-evidence").CalibrationBin[];
|
|
369
|
+
brierScore: number | null;
|
|
370
|
+
falsePositives: number;
|
|
371
|
+
falseNegatives: number;
|
|
372
|
+
minSamples: number;
|
|
373
|
+
status: "measured" | "insufficient-data";
|
|
374
|
+
}>;
|
|
305
375
|
rtm_impact(a: {
|
|
306
376
|
root: string;
|
|
307
377
|
changed: string[];
|
|
308
378
|
}): Promise<{
|
|
309
379
|
breadthWarning?: string | undefined;
|
|
310
380
|
impacted: string[];
|
|
381
|
+
rankedImpact: {
|
|
382
|
+
file: string;
|
|
383
|
+
score: number;
|
|
384
|
+
}[];
|
|
311
385
|
reachedByDepth: number[];
|
|
312
386
|
bounded: {
|
|
313
387
|
id: string;
|
|
@@ -321,6 +395,11 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
|
|
|
321
395
|
head?: string;
|
|
322
396
|
since?: string;
|
|
323
397
|
}): Promise<{
|
|
398
|
+
semanticWarm?: {
|
|
399
|
+
tier: string;
|
|
400
|
+
computed: number;
|
|
401
|
+
cached: number;
|
|
402
|
+
} | undefined;
|
|
324
403
|
changed: number;
|
|
325
404
|
nodes: number;
|
|
326
405
|
edges: number;
|
|
@@ -508,6 +587,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
|
|
|
508
587
|
}): Promise<{
|
|
509
588
|
ok: boolean;
|
|
510
589
|
specsCreated: string[];
|
|
590
|
+
unreadable: string[];
|
|
511
591
|
}>;
|
|
512
592
|
spec_slice_approve(a: {
|
|
513
593
|
root?: string;
|
|
@@ -515,6 +595,10 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
|
|
|
515
595
|
}): Promise<{
|
|
516
596
|
ok: boolean;
|
|
517
597
|
approvedSpecs: string[];
|
|
598
|
+
refused: {
|
|
599
|
+
id: string;
|
|
600
|
+
reason: string;
|
|
601
|
+
}[];
|
|
518
602
|
}>;
|
|
519
603
|
spec_remediate(a: {
|
|
520
604
|
root?: string;
|
|
@@ -523,6 +607,10 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
|
|
|
523
607
|
}): Promise<{
|
|
524
608
|
ok: boolean;
|
|
525
609
|
actionsTaken: string[];
|
|
610
|
+
refused: {
|
|
611
|
+
id: string;
|
|
612
|
+
reason: string;
|
|
613
|
+
}[];
|
|
526
614
|
}>;
|
|
527
615
|
};
|
|
528
616
|
export {};
|