@holmes-lab/holmes-kit 0.35.24 → 0.36.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 +363 -0
- package/README.md +4 -2
- package/dist/.build-id +1 -1
- package/dist/holmes/cli/approve-status.js +4 -1
- package/dist/holmes/cli/approve-watch.js +3 -1
- package/dist/holmes/cli/approve.d.ts +10 -0
- package/dist/holmes/cli/approve.js +34 -4
- package/dist/holmes/cli/claude-switches.d.ts +7 -1
- package/dist/holmes/cli/claude-switches.js +11 -7
- package/dist/holmes/cli/codex-toml.d.ts +3 -0
- package/dist/holmes/cli/codex-toml.js +2 -1
- package/dist/holmes/cli/doctor.d.ts +31 -1
- package/dist/holmes/cli/doctor.js +204 -7
- package/dist/holmes/cli/index.js +115 -4
- package/dist/holmes/cli/init.js +4 -3
- package/dist/holmes/cli/os-notify.d.ts +3 -1
- package/dist/holmes/cli/os-notify.js +10 -4
- package/dist/holmes/cli/review.d.ts +25 -0
- package/dist/holmes/cli/review.js +111 -0
- package/dist/holmes/cli/roles-readme.d.ts +11 -0
- package/dist/holmes/cli/roles-readme.js +38 -16
- package/dist/holmes/cli/roles.d.ts +12 -0
- package/dist/holmes/cli/roles.js +86 -0
- package/dist/holmes/cli/run.d.ts +65 -0
- package/dist/holmes/cli/run.js +308 -0
- package/dist/holmes/cli/runtime-binding-approval.js +3 -2
- package/dist/holmes/cli/runtime-binding.d.ts +30 -0
- package/dist/holmes/cli/runtime-binding.js +116 -11
- package/dist/holmes/cli/scratch.d.ts +12 -0
- package/dist/holmes/cli/scratch.js +20 -0
- package/dist/holmes/cli/test-platform.d.ts +16 -0
- package/dist/holmes/cli/test-platform.js +31 -1
- package/dist/holmes/config/config.d.ts +49 -0
- package/dist/holmes/config/config.js +146 -3
- package/dist/holmes/config/project-caps.d.ts +21 -0
- package/dist/holmes/config/project-caps.js +114 -0
- package/dist/holmes/governance/approval-queue.d.ts +17 -3
- package/dist/holmes/governance/approval-queue.js +51 -8
- package/dist/holmes/governance/autonomy.d.ts +6 -0
- package/dist/holmes/governance/autonomy.js +21 -0
- package/dist/holmes/governance/push-gate-runner.d.ts +8 -0
- package/dist/holmes/governance/push-gate-runner.js +49 -1
- package/dist/holmes/governance/replica-id.d.ts +9 -0
- package/dist/holmes/governance/replica-id.js +44 -7
- package/dist/holmes/governance/role-policy.d.ts +41 -1
- package/dist/holmes/governance/role-policy.js +137 -20
- package/dist/holmes/governance/run-mode.d.ts +14 -0
- package/dist/holmes/governance/run-mode.js +120 -0
- package/dist/holmes/governance/tool-actions.d.ts +30 -0
- package/dist/holmes/governance/tool-actions.js +121 -0
- package/dist/holmes/guardrail/agent-launch-policy.d.ts +15 -0
- package/dist/holmes/guardrail/agent-launch-policy.js +177 -0
- package/dist/holmes/guardrail/classification-mode.d.ts +17 -0
- package/dist/holmes/guardrail/classification-mode.js +135 -0
- package/dist/holmes/guardrail/dynamic-write.d.ts +43 -0
- package/dist/holmes/guardrail/dynamic-write.js +304 -0
- package/dist/holmes/guardrail/impact-gate.d.ts +2 -0
- package/dist/holmes/guardrail/impact-gate.js +34 -11
- package/dist/holmes/guardrail/phase.d.ts +2 -1
- package/dist/holmes/guardrail/phase.js +22 -8
- package/dist/holmes/guardrail/powershell-shell.d.ts +21 -0
- package/dist/holmes/guardrail/powershell-shell.js +801 -0
- package/dist/holmes/guardrail/refusal-codes.d.ts +24 -0
- package/dist/holmes/guardrail/refusal-codes.js +140 -0
- package/dist/holmes/guardrail/risk-classifier.d.ts +17 -0
- package/dist/holmes/guardrail/risk-classifier.js +255 -27
- package/dist/holmes/guardrail/risk-types.d.ts +16 -0
- package/dist/holmes/guardrail/run-plan-scope.d.ts +23 -0
- package/dist/holmes/guardrail/run-plan-scope.js +155 -0
- package/dist/holmes/guardrail/run-refusals.d.ts +116 -0
- package/dist/holmes/guardrail/run-refusals.js +348 -0
- package/dist/holmes/guardrail/run-stages.d.ts +67 -0
- package/dist/holmes/guardrail/run-stages.js +188 -0
- package/dist/holmes/guardrail/scope-judgment.d.ts +5 -1
- package/dist/holmes/guardrail/scope-judgment.js +8 -10
- package/dist/holmes/guardrail/scope-refusal-memory.d.ts +3 -0
- package/dist/holmes/guardrail/scope-refusal-memory.js +85 -0
- package/dist/holmes/guardrail/shell-words.js +7 -7
- package/dist/holmes/guardrail/write-target.d.ts +31 -2
- package/dist/holmes/guardrail/write-target.js +118 -16
- package/dist/holmes/hooks/pre-tool-use.d.ts +36 -2
- package/dist/holmes/hooks/pre-tool-use.js +740 -81
- package/dist/holmes/hooks/session-start.js +5 -3
- package/dist/holmes/hooks/stop.d.ts +35 -1
- package/dist/holmes/hooks/stop.js +142 -7
- package/dist/holmes/mcp/elicit-approval.js +4 -4
- package/dist/holmes/mcp/handlers/graph-operations.js +5 -5
- package/dist/holmes/mcp/handlers/maintenance-analysis.js +2 -2
- package/dist/holmes/mcp/handlers/operator-inspection.d.ts +2 -1
- package/dist/holmes/mcp/handlers/operator-inspection.js +3 -1
- package/dist/holmes/mcp/handlers/phase-queries.js +16 -1
- package/dist/holmes/mcp/handlers/requirement-triage.js +2 -2
- package/dist/holmes/mcp/handlers/spec-approval.d.ts +3 -3
- package/dist/holmes/mcp/handlers/spec-approval.js +56 -9
- package/dist/holmes/mcp/handlers/spec-lifecycle.d.ts +1 -0
- package/dist/holmes/mcp/handlers/spec-lifecycle.js +3 -3
- package/dist/holmes/mcp/handlers/spec-queries.d.ts +7 -0
- package/dist/holmes/mcp/handlers/spec-queries.js +5 -0
- package/dist/holmes/mcp/handlers/workspace-queries.js +2 -2
- package/dist/holmes/mcp/handlers.d.ts +2 -3
- package/dist/holmes/mcp/handlers.js +22 -2
- package/dist/holmes/mcp/harness-attestation.d.ts +2 -0
- package/dist/holmes/mcp/harness-attestation.js +3 -1
- package/dist/holmes/mcp/operator-recovery.d.ts +2 -0
- package/dist/holmes/mcp/operator-recovery.js +4 -3
- package/dist/holmes/mcp/server.js +9 -0
- package/dist/holmes/mcp/tool-schemas.js +6 -3
- package/dist/holmes/project/npx-bin.d.ts +26 -0
- package/dist/holmes/project/npx-bin.js +272 -2
- package/dist/holmes/project/root.js +6 -1
- package/dist/holmes/project/run-records.d.ts +17 -0
- package/dist/holmes/project/run-records.js +126 -0
- package/dist/holmes/project/scratch-root.d.ts +12 -0
- package/dist/holmes/project/scratch-root.js +132 -0
- package/dist/holmes/review/mrp.d.ts +35 -0
- package/dist/holmes/review/mrp.js +119 -0
- package/dist/holmes/review/verdicts.d.ts +117 -0
- package/dist/holmes/review/verdicts.js +345 -0
- package/dist/holmes/runtime/dispatch.js +6 -3
- package/dist/holmes/semantic/cloud-usage.d.ts +20 -0
- package/dist/holmes/semantic/cloud-usage.js +106 -0
- package/dist/holmes/semantic/embedder.d.ts +15 -6
- package/dist/holmes/semantic/embedder.js +84 -3
- package/dist/holmes/semantic/local-model.d.ts +21 -2
- package/dist/holmes/semantic/local-model.js +14 -3
- package/dist/holmes/semantic/tier.d.ts +25 -0
- package/dist/holmes/semantic/tier.js +86 -1
- package/dist/holmes/semantic/vector-cache.d.ts +1 -0
- package/dist/holmes/semantic/vector-cache.js +4 -1
- package/dist/holmes/spec/approval-blockers.d.ts +11 -1
- package/dist/holmes/spec/approval-blockers.js +70 -2
- package/dist/holmes/spec/renumber.d.ts +1 -1
- package/dist/holmes/spec/renumber.js +5 -2
- package/dist/holmes/spec/transition-policy.d.ts +5 -7
- package/dist/holmes/spec/transition-policy.js +17 -2
- package/package.json +1 -1
|
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.detectInstallMode = detectInstallMode;
|
|
37
37
|
exports.buildSessionStartOutput = buildSessionStartOutput;
|
|
38
38
|
exports.driftNudge = driftNudge;
|
|
39
|
-
// @implements A-SPEC-531.2, A-SPEC-734
|
|
39
|
+
// @implements A-SPEC-531.2, A-SPEC-734, A-SPEC-476.1
|
|
40
40
|
// The SessionStart banner hook. It emits the intro (+ optional update notice) as additionalContext,
|
|
41
41
|
// which Claude Code delivers to BOTH the human transcript and the agent context — the "human and
|
|
42
42
|
// agent" delivery REQ-531 asks for. The update refresh is a DETACHED, fire-and-forget child so the
|
|
@@ -205,10 +205,12 @@ if (require.main === module) {
|
|
|
205
205
|
// again — a recurring advertisement for an opt-in feature is the noise class this project
|
|
206
206
|
// removed the same day. Fail-open, exactly like the autonomy banner above it.
|
|
207
207
|
try {
|
|
208
|
-
const {
|
|
208
|
+
const { resolveProjectSemanticTier } = require('../semantic/tier');
|
|
209
209
|
const { tierAdviceLines, shouldInvite, markInvited } = require('../semantic/tier-advice');
|
|
210
|
+
const { resolveProjectRoot } = require('../project/root');
|
|
210
211
|
const cwd = process.cwd();
|
|
211
|
-
|
|
212
|
+
// @implements A-SPEC-476.1 — the project's capped tier, read at its `.ax` root.
|
|
213
|
+
const tier = resolveProjectSemanticTier(resolveProjectRoot(cwd).root);
|
|
212
214
|
if (shouldInvite(tier, cwd, (p) => fs.existsSync(p))) {
|
|
213
215
|
const lines = tierAdviceLines(tier);
|
|
214
216
|
if (lines.length > 0) {
|
|
@@ -44,7 +44,7 @@ export interface StopEvidence {
|
|
|
44
44
|
* printed under; absent means every line is printed as the session's. Never read for the verdict.
|
|
45
45
|
*/
|
|
46
46
|
pendingRequests?: Pick<PendingRequest, 'id' | 'target'>[];
|
|
47
|
-
/** The
|
|
47
|
+
/** The holmes-kit command the block text prints before `approve` (default: the issuing version, A-SPEC-770.3). */
|
|
48
48
|
launcher?: string;
|
|
49
49
|
/** A-SPEC id -> number of real test cases (`it(`/`test(`) found in test files anchored to it. */
|
|
50
50
|
testCasesByAspec?: Record<string, number>;
|
|
@@ -114,6 +114,19 @@ export interface StopEvidence {
|
|
|
114
114
|
* changed source files and still catches a file with no anchor at all.
|
|
115
115
|
*/
|
|
116
116
|
unanchoredChangedSources?: string[];
|
|
117
|
+
/** @implements A-SPEC-166.3 — changed-source anchors naming a draft or missing spec; `undefined` is no signal. */
|
|
118
|
+
unapprovedChangedAnchors?: {
|
|
119
|
+
file: string;
|
|
120
|
+
id: string;
|
|
121
|
+
}[];
|
|
122
|
+
/** @implements A-SPEC-166.3 — a run or `classification.strict`: the findings above block (ART-1); else tracked. */
|
|
123
|
+
anchorStrict?: boolean;
|
|
124
|
+
/** @implements A-SPEC-102.3 — in a run, the run's range whose review gate fails; absent is no signal. */
|
|
125
|
+
reviewGate?: {
|
|
126
|
+
base: string;
|
|
127
|
+
head: string;
|
|
128
|
+
reasons: string[];
|
|
129
|
+
};
|
|
117
130
|
/**
|
|
118
131
|
* @implements A-SPEC-453
|
|
119
132
|
* Spec ids approved in the working tree with NO `spec-approved` record in the ledger — ART-5's
|
|
@@ -183,6 +196,25 @@ export declare function changedAnchoredAspecs(root: string): string[] | undefine
|
|
|
183
196
|
* which produces no violation. Failing closed here would block every ungoverned scratch directory.
|
|
184
197
|
*/
|
|
185
198
|
export declare function unanchoredChangedSources(root: string): string[] | undefined;
|
|
199
|
+
/**
|
|
200
|
+
* @implements A-SPEC-166.3
|
|
201
|
+
* M3 at the turn boundary: the write gate judged the disk before the harness wrote, and other paths never met the gate.
|
|
202
|
+
* Every anchor on a changed source must name an approved spec; one naming a draft or a missing spec is a finding.
|
|
203
|
+
* `undefined` is no signal (as for ART-1); a file that cannot be read drops out rather than becoming a finding.
|
|
204
|
+
*/
|
|
205
|
+
/**
|
|
206
|
+
* @implements A-SPEC-102.3 — the I/O half: in a run whose record carries `base`, the review gate over base..HEAD of the
|
|
207
|
+
* run's worktree. Nothing outside a run, without a base, at an unmoved HEAD, on a passing gate, or on any error.
|
|
208
|
+
*/
|
|
209
|
+
export declare function runReviewGate(root: string, env: NodeJS.ProcessEnv, cwd?: string, sessionId?: string): {
|
|
210
|
+
base: string;
|
|
211
|
+
head: string;
|
|
212
|
+
reasons: string[];
|
|
213
|
+
} | undefined;
|
|
214
|
+
export declare function unapprovedChangedAnchors(root: string, specs: Spec[]): {
|
|
215
|
+
file: string;
|
|
216
|
+
id: string;
|
|
217
|
+
}[] | undefined;
|
|
186
218
|
export interface DependencyReappraisal {
|
|
187
219
|
file: string;
|
|
188
220
|
aspecs: string[];
|
|
@@ -355,6 +387,8 @@ export declare function decideStopGuard(wantsBlock: boolean, priorConsecutiveBlo
|
|
|
355
387
|
};
|
|
356
388
|
/** Test seam for the same reason as the two exports below — the CLI sets this on a real run. */
|
|
357
389
|
export declare function __setWiredSpecsForTest(v: string | undefined): void;
|
|
390
|
+
/** @implements A-SPEC-770.7 — the approval command from this project's root (round 2: the Stop block passed none). */
|
|
391
|
+
export declare function stopLauncher(): string;
|
|
358
392
|
/**
|
|
359
393
|
* `readGuardCount`, degraded to 0 if it throws.
|
|
360
394
|
*
|
|
@@ -41,6 +41,8 @@ exports.collectDistFreshness = collectDistFreshness;
|
|
|
41
41
|
exports.collectCiVerdicts = collectCiVerdicts;
|
|
42
42
|
exports.changedAnchoredAspecs = changedAnchoredAspecs;
|
|
43
43
|
exports.unanchoredChangedSources = unanchoredChangedSources;
|
|
44
|
+
exports.runReviewGate = runReviewGate;
|
|
45
|
+
exports.unapprovedChangedAnchors = unapprovedChangedAnchors;
|
|
44
46
|
exports.dependencyReappraisals = dependencyReappraisals;
|
|
45
47
|
exports.reappraisalWarningLine = reappraisalWarningLine;
|
|
46
48
|
exports.escalateReappraisals = escalateReappraisals;
|
|
@@ -56,13 +58,14 @@ exports.acknowledgeStop = acknowledgeStop;
|
|
|
56
58
|
exports.describeTokenHealth = describeTokenHealth;
|
|
57
59
|
exports.decideStopGuard = decideStopGuard;
|
|
58
60
|
exports.__setWiredSpecsForTest = __setWiredSpecsForTest;
|
|
61
|
+
exports.stopLauncher = stopLauncher;
|
|
59
62
|
exports.guardCountOrZero = guardCountOrZero;
|
|
60
63
|
exports.readGuardCount = readGuardCount;
|
|
61
64
|
exports.collectForbiddenEdgeJudgement = collectForbiddenEdgeJudgement;
|
|
62
65
|
exports.stopSharedScan = stopSharedScan;
|
|
63
66
|
exports.scanCodeCycles = scanCodeCycles;
|
|
64
67
|
exports.writeGuardCount = writeGuardCount;
|
|
65
|
-
// @implements A-SPEC-734, A-SPEC-772.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
|
|
66
69
|
// @implements A-SPEC-769.9, A-SPEC-769.10, A-SPEC-769.11
|
|
67
70
|
const fs = __importStar(require("node:fs"));
|
|
68
71
|
// @implements A-SPEC-549.3 — evaluateStop's messages are English here; the Hangul-absence guard
|
|
@@ -272,8 +275,8 @@ function collectSemanticCoverage(root, tier) {
|
|
|
272
275
|
// shipped default — zero egress, never opted in — was told "not run" on EVERY turn about a
|
|
273
276
|
// layer it never asked for. Found by a consumer-shape probe before release, not by the suite,
|
|
274
277
|
// because the not-adopted case was exercised through a verdict object the consumer never has.
|
|
275
|
-
const {
|
|
276
|
-
const t = tier ??
|
|
278
|
+
const { resolveProjectSemanticTier } = require('../semantic/tier');
|
|
279
|
+
const t = tier ?? resolveProjectSemanticTier(root); // @implements A-SPEC-476.1
|
|
277
280
|
if (t.tier === 'none')
|
|
278
281
|
return '';
|
|
279
282
|
const { readCoverageState, coverageStopLine } = require('../semantic/vector-coverage');
|
|
@@ -427,6 +430,76 @@ function unanchoredChangedSources(root) {
|
|
|
427
430
|
}
|
|
428
431
|
return out;
|
|
429
432
|
}
|
|
433
|
+
/**
|
|
434
|
+
* @implements A-SPEC-166.3
|
|
435
|
+
* M3 at the turn boundary: the write gate judged the disk before the harness wrote, and other paths never met the gate.
|
|
436
|
+
* Every anchor on a changed source must name an approved spec; one naming a draft or a missing spec is a finding.
|
|
437
|
+
* `undefined` is no signal (as for ART-1); a file that cannot be read drops out rather than becoming a finding.
|
|
438
|
+
*/
|
|
439
|
+
/**
|
|
440
|
+
* @implements A-SPEC-102.3 — the I/O half: in a run whose record carries `base`, the review gate over base..HEAD of the
|
|
441
|
+
* run's worktree. Nothing outside a run, without a base, at an unmoved HEAD, on a passing gate, or on any error.
|
|
442
|
+
*/
|
|
443
|
+
function runReviewGate(root, env, cwd, sessionId) {
|
|
444
|
+
let mode;
|
|
445
|
+
try {
|
|
446
|
+
const { runMode } = require('../governance/run-mode');
|
|
447
|
+
mode = runMode(env, root, cwd, sessionId);
|
|
448
|
+
}
|
|
449
|
+
catch {
|
|
450
|
+
return undefined;
|
|
451
|
+
} // whether this is a run cannot be read: as an interactive session
|
|
452
|
+
if (!mode.run)
|
|
453
|
+
return undefined;
|
|
454
|
+
// @implements A-SPEC-774.21 — in a run, a gate that cannot judge blocks, naming what it could not read.
|
|
455
|
+
const cannot = (what, base = '?', head = '?') => ({ base, head, reasons: [`the review gate could not judge this run: ${what}`] });
|
|
456
|
+
try {
|
|
457
|
+
if (!mode.id)
|
|
458
|
+
return cannot('the run has no id');
|
|
459
|
+
const { listRuns, mainCheckoutOf } = require('../project/run-records');
|
|
460
|
+
const rec = listRuns(mainCheckoutOf(root)).find((r) => r.run_id === mode.id);
|
|
461
|
+
if (!rec)
|
|
462
|
+
return cannot(`no run record for ${mode.id}`);
|
|
463
|
+
if (typeof rec.base !== 'string' || rec.base === '')
|
|
464
|
+
return cannot('run record carries no base');
|
|
465
|
+
const { gateRange, resolveRange } = require('../review/verdicts');
|
|
466
|
+
const range = resolveRange(rec.worktree, rec.base, 'HEAD');
|
|
467
|
+
if ('error' in range)
|
|
468
|
+
return cannot(`the range ${rec.base}..HEAD does not resolve (${range.error})`, rec.base);
|
|
469
|
+
if (range.head === range.base)
|
|
470
|
+
return undefined;
|
|
471
|
+
const g = gateRange(rec.worktree, range.base, range.head, {});
|
|
472
|
+
return g.ok ? undefined : { base: range.base, head: range.head, reasons: g.reasons };
|
|
473
|
+
}
|
|
474
|
+
catch (e) {
|
|
475
|
+
return cannot(e instanceof Error ? e.message : String(e));
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
function unapprovedChangedAnchors(root, specs) {
|
|
479
|
+
const SOURCE = /\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs|py|go|rs|java|kt|cs|rb|php|swift)$/;
|
|
480
|
+
const VENDORED = /^(?:reference|node_modules|dist|build|vendor|third_party)\//;
|
|
481
|
+
const paths = workTreePaths(root);
|
|
482
|
+
if (paths === null)
|
|
483
|
+
return undefined;
|
|
484
|
+
const { anchorSpecIds, stripStringLiterals } = require('../rtm/anchor-ids');
|
|
485
|
+
const approved = new Set(specs.filter((s) => s.status === 'approved').map((s) => s.id));
|
|
486
|
+
const out = [];
|
|
487
|
+
for (const rel of [...paths].sort()) {
|
|
488
|
+
if (!SOURCE.test(rel) || VENDORED.test(rel))
|
|
489
|
+
continue;
|
|
490
|
+
let text;
|
|
491
|
+
try {
|
|
492
|
+
text = readRegularText(path.join(root, rel));
|
|
493
|
+
}
|
|
494
|
+
catch {
|
|
495
|
+
continue;
|
|
496
|
+
}
|
|
497
|
+
for (const id of new Set(anchorSpecIds(stripStringLiterals(text))))
|
|
498
|
+
if (!approved.has(id))
|
|
499
|
+
out.push({ file: rel, id });
|
|
500
|
+
}
|
|
501
|
+
return out;
|
|
502
|
+
}
|
|
430
503
|
const REAPPRAISAL_VENDORED = /^(?:reference|node_modules|dist|build|vendor|third_party)\//;
|
|
431
504
|
function depLangOf(rel) {
|
|
432
505
|
if (/\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs)$/.test(rel))
|
|
@@ -847,6 +920,26 @@ function evaluateStop(specs, evidence) {
|
|
|
847
920
|
problems.push(`[ART-1] ${detail}`);
|
|
848
921
|
structured.push({ article: 'ART-1', detail });
|
|
849
922
|
}
|
|
923
|
+
// @implements A-SPEC-166.3 — the turn-boundary re-check of changed anchors: blocking in a run or under strict,
|
|
924
|
+
// a tracked line otherwise (the owner principle: interactive use keeps its 0.35.25 verdicts).
|
|
925
|
+
const unapprovedAnchorDetails = (evidence?.unapprovedChangedAnchors ?? []).map((f) => `${f.file}: its anchor names ${f.id}, which is not approved — approve it, or re-anchor through the write gate`);
|
|
926
|
+
if (evidence?.anchorStrict) {
|
|
927
|
+
for (const detail of unapprovedAnchorDetails) {
|
|
928
|
+
problems.push(`[ART-1] ${detail}`);
|
|
929
|
+
structured.push({ article: 'ART-1', detail });
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
else if (unapprovedAnchorDetails.length > 0) {
|
|
933
|
+
tracked = [...(tracked ?? []), ...unapprovedAnchorDetails.map((detail) => ({ article: 'ART-1', detail }))];
|
|
934
|
+
}
|
|
935
|
+
// @implements A-SPEC-102.3 — a run's work is done only with an independent passing review of its range.
|
|
936
|
+
if (evidence?.reviewGate) {
|
|
937
|
+
const g = evidence.reviewGate;
|
|
938
|
+
const detail = `the run's commits ${g.base}..${g.head} are not reviewed (${g.reasons.join('; ')}) — an independent reviewer records a verdict with `
|
|
939
|
+
+ `holmes-kit review record --base ${g.base} --head ${g.head} --verdict pass`;
|
|
940
|
+
problems.push(`[ART-7] ${detail}`);
|
|
941
|
+
structured.push({ article: 'ART-7', detail });
|
|
942
|
+
}
|
|
850
943
|
// @implements A-SPEC-453 — ART-5's second enforcement point. The seal is forgeable; the record
|
|
851
944
|
// of the approving act is not.
|
|
852
945
|
for (const id of evidence?.unrecordedApprovals ?? []) {
|
|
@@ -867,6 +960,8 @@ function evaluateStop(specs, evidence) {
|
|
|
867
960
|
.concat(evidence?.provenance && !evidence.provenance.ok ? ['ART-2'] : [])
|
|
868
961
|
.concat(evidence?.findingsUnreadable ? ['ART-7'] : [])
|
|
869
962
|
.concat((evidence?.unanchoredChangedSources ?? []).length > 0 ? ['ART-1'] : [])
|
|
963
|
+
.concat(evidence?.anchorStrict && (evidence?.unapprovedChangedAnchors ?? []).length > 0 ? ['ART-1'] : [])
|
|
964
|
+
.concat(evidence?.reviewGate ? ['ART-7'] : [])
|
|
870
965
|
.concat((evidence?.unrecordedApprovals ?? []).length > 0 ? ['ART-5'] : [])
|
|
871
966
|
.concat((evidence?.rolledBackLedgers ?? []).length > 0 ? ['ART-2'] : []))];
|
|
872
967
|
return {
|
|
@@ -875,7 +970,7 @@ function evaluateStop(specs, evidence) {
|
|
|
875
970
|
violations: structured,
|
|
876
971
|
...(tracked ? { tracked } : {}),
|
|
877
972
|
// @implements A-SPEC-247.1 — the same lines, each under the heading that says who acts next. Text only.
|
|
878
|
-
reason: stopBlockText(structured, evidence?.pendingRequests ?? [], evidence?.launcher ?? (
|
|
973
|
+
reason: stopBlockText(structured, evidence?.pendingRequests ?? [], evidence?.launcher ?? stopLauncher()),
|
|
879
974
|
};
|
|
880
975
|
}
|
|
881
976
|
/** The leading document id of an ART-4 detail (`T-SPEC-752.4: declared coverage …`). */
|
|
@@ -912,7 +1007,7 @@ function stopBlockText(violations, pending, launcher) {
|
|
|
912
1007
|
: v.article === 'ART-7' ? v.findingId : undefined;
|
|
913
1008
|
const request = subject === undefined ? undefined : requestFor.get(subject);
|
|
914
1009
|
if (request !== undefined) {
|
|
915
|
-
operator.push(`${line} — request ${request} is pending: the operator decides it, in the session's approval dialog or with ${launcher}
|
|
1010
|
+
operator.push(`${line} — request ${request} is pending: the operator decides it, in the session's approval dialog or with ${launcher} approve`);
|
|
916
1011
|
}
|
|
917
1012
|
else if (v.article === 'ART-4') {
|
|
918
1013
|
session.push(`${line} — anchor real covering tests, or, when the design is withdrawn, retire the spec with spec_retire`);
|
|
@@ -1109,6 +1204,15 @@ function __setWiredSpecsForTest(v) { WIRED_SPECS = v; }
|
|
|
1109
1204
|
* `git rev-parse --show-toplevel`, and the ART-4 loop called it per test file (1,000 tests: 16.7 s — measured).
|
|
1110
1205
|
*/
|
|
1111
1206
|
let STOP_ROOT = null;
|
|
1207
|
+
/** @implements A-SPEC-770.7 — the approval command from this project's root (round 2: the Stop block passed none). */
|
|
1208
|
+
function stopLauncher() {
|
|
1209
|
+
try {
|
|
1210
|
+
return (0, npx_bin_1.holmesKitCommand)(stopProjectRoot());
|
|
1211
|
+
}
|
|
1212
|
+
catch {
|
|
1213
|
+
return (0, npx_bin_1.holmesKitCommand)();
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1112
1216
|
function stopProjectRoot() {
|
|
1113
1217
|
const cwd = process.cwd();
|
|
1114
1218
|
if (STOP_ROOT === null || STOP_ROOT.cwd !== cwd)
|
|
@@ -1551,6 +1655,21 @@ if (require.main === module) {
|
|
|
1551
1655
|
} // @implements A-SPEC-191 (§4a) — list() absorbs ENOENT; a throw means the ledger EXISTS and cannot be read, which must block, not launder
|
|
1552
1656
|
// @implements A-SPEC-452 — collected here (I/O half) so evaluateStop stays pure.
|
|
1553
1657
|
const unanchored = unanchoredChangedSources(stopProjectRoot());
|
|
1658
|
+
// @implements A-SPEC-166.3 — the same changed sources, asked whether their anchors name approved specs. The mode is
|
|
1659
|
+
// read here (I/O half): a run, or the owner's classification.strict. Any error leaves the signal absent.
|
|
1660
|
+
let unapprovedAnchors;
|
|
1661
|
+
let anchorStrict = false;
|
|
1662
|
+
try {
|
|
1663
|
+
unapprovedAnchors = unapprovedChangedAnchors(stopProjectRoot(), specs);
|
|
1664
|
+
const { runMode } = require('../governance/run-mode');
|
|
1665
|
+
anchorStrict = runMode(process.env, stopProjectRoot(), typeof input.cwd === 'string' ? input.cwd : undefined, typeof input.session_id === 'string' ? input.session_id : undefined).run
|
|
1666
|
+
|| (0, config_1.loadConfig)(stopProjectRoot()).classification.strict;
|
|
1667
|
+
}
|
|
1668
|
+
catch {
|
|
1669
|
+
unapprovedAnchors = undefined;
|
|
1670
|
+
}
|
|
1671
|
+
// @implements A-SPEC-102.3 — in a run, the review gate over the run's range.
|
|
1672
|
+
const reviewGate = runReviewGate(stopProjectRoot(), process.env, typeof input.cwd === 'string' ? input.cwd : undefined, typeof input.session_id === 'string' ? input.session_id : undefined);
|
|
1554
1673
|
// @implements A-SPEC-453
|
|
1555
1674
|
const unrecorded = unrecordedApprovals(stopProjectRoot());
|
|
1556
1675
|
// @implements A-SPEC-455
|
|
@@ -1668,7 +1787,7 @@ if (require.main === module) {
|
|
|
1668
1787
|
pendingRequests = require('../governance/approval-queue').readQueue(stopProjectRoot()).pending;
|
|
1669
1788
|
}
|
|
1670
1789
|
catch { /* text only */ }
|
|
1671
|
-
let out = evaluateStop(specs, { pendingRequests, testCasesByAspec, provenance, executedByAspec, findings, findingsUnreadable, unanchoredChangedSources: unanchored, unrecordedApprovals: unrecorded, rolledBackLedgers: rolledBack, redFirstMode, changedAspecs, outcomesByAspec, ...(knownDefects ? { knownDefects } : {}), ...(ci ? { ci } : {}), ...(dist ? { dist } : {}), ...(analysis ? { analysis } : {}), ...(semantic ? { semantic } : {}), ...(forbiddenEdges ? { forbiddenEdges } : {}), ...(cycles ? { cycles } : {}) });
|
|
1790
|
+
let out = evaluateStop(specs, { pendingRequests, testCasesByAspec, provenance, executedByAspec, findings, findingsUnreadable, unanchoredChangedSources: unanchored, ...(unapprovedAnchors ? { unapprovedChangedAnchors: unapprovedAnchors, anchorStrict } : {}), ...(reviewGate ? { reviewGate } : {}), unrecordedApprovals: unrecorded, rolledBackLedgers: rolledBack, redFirstMode, changedAspecs, outcomesByAspec, ...(knownDefects ? { knownDefects } : {}), ...(ci ? { ci } : {}), ...(dist ? { dist } : {}), ...(analysis ? { analysis } : {}), ...(semantic ? { semantic } : {}), ...(forbiddenEdges ? { forbiddenEdges } : {}), ...(cycles ? { cycles } : {}) });
|
|
1672
1791
|
// @implements A-SPEC-534.4 — track mode records ART-8 findings without blocking: surface them so
|
|
1673
1792
|
// the operator observes RED-first gaps before an owner promotes the posture to strict.
|
|
1674
1793
|
// @implements A-SPEC-559.2 — spec-evolution trigger (observe-first, NEVER blocks): a dirty
|
|
@@ -1709,6 +1828,18 @@ if (require.main === module) {
|
|
|
1709
1828
|
}
|
|
1710
1829
|
const guard = decideStopGuard(out.block, guardCountOrZero(sessionId));
|
|
1711
1830
|
const persisted = writeGuardCount(sessionId, guard.nextCount);
|
|
1831
|
+
// @implements A-SPEC-778.1 — in a run, each blocked Stop goes on the run's log, and the cap yield stalls the run
|
|
1832
|
+
// there, so the orchestrator reads a stalled run instead of a turn that merely ended. Never touches the verdict.
|
|
1833
|
+
let stallLine = null;
|
|
1834
|
+
if (out.block) {
|
|
1835
|
+
try {
|
|
1836
|
+
const { recordRunStopBlock } = require('../guardrail/run-refusals');
|
|
1837
|
+
stallLine = recordRunStopBlock({ projectRoot: stopProjectRoot(), env: process.env, cwd: typeof input.cwd === 'string' ? input.cwd : undefined, sessionId }, out.articles ?? [], guard.capped || (guard.block && !persisted && input.stop_hook_active === true));
|
|
1838
|
+
}
|
|
1839
|
+
catch {
|
|
1840
|
+
stallLine = null;
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1712
1843
|
// @implements A-SPEC-769.2 — the stage line, only when the stages used at least half of the hook budget; a
|
|
1713
1844
|
// clock fault is swallowed, because an observation never touches the verdict.
|
|
1714
1845
|
clock.mark('evaluate');
|
|
@@ -1733,6 +1864,8 @@ if (require.main === module) {
|
|
|
1733
1864
|
// State cannot persist -> the counter can never advance. Degrade to the stateless one-shot
|
|
1734
1865
|
// guard instead of blocking forever: stop_hook_active means we already blocked once.
|
|
1735
1866
|
process.stderr.write(`[Holmes-Kit] governance gate yielding (guard state unwritable, one-shot fallback) — issues remain UNRESOLVED:\n${out.reason ?? ''}\n`);
|
|
1867
|
+
if (stallLine)
|
|
1868
|
+
process.stderr.write(`${stallLine}\n`);
|
|
1736
1869
|
process.exitCode = 0;
|
|
1737
1870
|
return;
|
|
1738
1871
|
}
|
|
@@ -1743,10 +1876,12 @@ if (require.main === module) {
|
|
|
1743
1876
|
else if (ackWaiting.length > 0) {
|
|
1744
1877
|
// @implements A-SPEC-247 — acknowledged, not clean: name what is waiting so the user sees
|
|
1745
1878
|
// the standing approval debt exactly once, and the agent knows the ball is not in its court.
|
|
1746
|
-
process.stderr.write(`[Holmes-Kit] awaiting approval — items waiting on the owner's decision: ${ackWaiting.join(', ')}. Decide them at ${(
|
|
1879
|
+
process.stderr.write(`[Holmes-Kit] awaiting approval — items waiting on the owner's decision: ${ackWaiting.join(', ')}. Decide them at ${stopLauncher()} approve. (This debt does not re-block.)\n`);
|
|
1747
1880
|
}
|
|
1748
1881
|
else if (guard.capped) {
|
|
1749
1882
|
process.stderr.write(`[Holmes-Kit] governance gate YIELDING after ${exports.MAX_CONSECUTIVE_BLOCKS} consecutive blocks — issues remain UNRESOLVED:\n${out.reason ?? ''}\n`);
|
|
1883
|
+
if (stallLine)
|
|
1884
|
+
process.stderr.write(`${stallLine}\n`);
|
|
1750
1885
|
}
|
|
1751
1886
|
// exitCode, NOT process.exit(): exit() tears the process down before large async stdout
|
|
1752
1887
|
// writes flush — a >64KB block decision reached the hook runner as TRUNCATED (invalid) JSON
|
|
@@ -9,7 +9,7 @@ exports.buildDecisionForm = buildDecisionForm;
|
|
|
9
9
|
exports.buildReasonForm = buildReasonForm;
|
|
10
10
|
exports.runElicitFlow = runElicitFlow;
|
|
11
11
|
exports.interpretElicitResult = interpretElicitResult;
|
|
12
|
-
// @implements A-SPEC-718.2, A-SPEC-718, A-SPEC-263.1, A-SPEC-732
|
|
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
13
|
const npx_bin_1 = require("../project/npx-bin");
|
|
14
14
|
/**
|
|
15
15
|
* The decision comes INTO the session (REQ-263): an approval-shaped refusal (spec_approve without a
|
|
@@ -91,7 +91,7 @@ function classifyElicitError(e, timeoutMs = exports.ELICIT_TIMEOUT_MS) {
|
|
|
91
91
|
* Template-owned text with no interpolated attacker data.
|
|
92
92
|
*/
|
|
93
93
|
function expiredNotice(waitedMs) {
|
|
94
|
-
return `[세션 승인 다이얼로그 만료 — ${Math.round(waitedMs / 1000)}초 무응답] 요청은 승인 큐로 회송되었습니다. 결정: ${(0, npx_bin_1.
|
|
94
|
+
return `[세션 승인 다이얼로그 만료 — ${Math.round(waitedMs / 1000)}초 무응답] 요청은 승인 큐로 회송되었습니다. 결정: ${(0, npx_bin_1.holmesKitCommand)()} approve. `;
|
|
95
95
|
}
|
|
96
96
|
// FLATTEN attacker-influenced text (round-1): the model chooses spec titles and finding ids, and
|
|
97
97
|
// interpolating them raw let a crafted title inject fake lines ("[시스템] … approve.") into the
|
|
@@ -110,7 +110,7 @@ const flat = (s, max) => s.replace(/[\u0000-\u001f\u007f\u0085\u2028\u2029\u200b
|
|
|
110
110
|
function buildDecisionForm(req, attempt, timeoutMs) {
|
|
111
111
|
const redisplay = attempt > 1 ? `⚠ 재표시 ${attempt}/${exports.MAX_PRESENTATIONS} — 이전 다이얼로그는 만료되어 무효입니다\n` : '';
|
|
112
112
|
// @implements A-SPEC-718.2 — one outcome for silence, in every mode: the request returns to the queue.
|
|
113
|
-
const timeoutNotice = `⏱ ${timeoutMs / 1000}초 내 미결정 시 승인 큐로 회송됩니다(운영자: ${(0, npx_bin_1.
|
|
113
|
+
const timeoutNotice = `⏱ ${timeoutMs / 1000}초 내 미결정 시 승인 큐로 회송됩니다(운영자: ${(0, npx_bin_1.holmesKitCommand)()} approve).`;
|
|
114
114
|
return {
|
|
115
115
|
// @implements A-SPEC-497.1 — the forewarning is the LAST line and template-owned: it survives a
|
|
116
116
|
// cap-filling summary (appended after the caps) and tells the human, before the clock runs out,
|
|
@@ -217,7 +217,7 @@ function interpretElicitResult(r) {
|
|
|
217
217
|
// @implements A-SPEC-732 — the protocol cannot tell a person's decline from a client that declines
|
|
218
218
|
// forms automatically (codex exec, measured 2026-09-24), so the reason names both and the fallback.
|
|
219
219
|
if (r.action === 'decline')
|
|
220
|
-
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, set HOLMES_ELICIT=off in the holmes-kit MCP server environment and decide with
|
|
220
|
+
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, set HOLMES_ELICIT=off in the holmes-kit MCP server environment and decide with ' + `${(0, npx_bin_1.holmesKitCommand)()} approve` }; // A-SPEC-770.6
|
|
221
221
|
if (r.action !== 'accept')
|
|
222
222
|
return null; // cancel, absent, anything else: no decision
|
|
223
223
|
const content = r.content;
|
|
@@ -39,7 +39,7 @@ exports.warmRequirementSemanticCache = warmRequirementSemanticCache;
|
|
|
39
39
|
exports.headOf = headOf;
|
|
40
40
|
exports.refreshSemanticVectors = refreshSemanticVectors;
|
|
41
41
|
exports.createGraphOperationsHandlers = createGraphOperationsHandlers;
|
|
42
|
-
// @implements A-SPEC-719, A-SPEC-734, A-SPEC-741.1, A-SPEC-758.1, A-SPEC-688.1, A-SPEC-719.5, A-SPEC-719.8
|
|
42
|
+
// @implements A-SPEC-476.1, A-SPEC-719, A-SPEC-734, A-SPEC-741.1, A-SPEC-758.1, A-SPEC-688.1, A-SPEC-719.5, A-SPEC-719.8
|
|
43
43
|
// @implements A-SPEC-614, A-SPEC-613, A-SPEC-100.2, A-SPEC-121.2, A-SPEC-128, A-SPEC-139, A-SPEC-189, A-SPEC-280, A-SPEC-282, A-SPEC-283, A-SPEC-419, A-SPEC-433, A-SPEC-469, A-SPEC-478, A-SPEC-568.1, A-SPEC-568.2, A-SPEC-569.1, A-SPEC-569.2, A-SPEC-569.3, A-SPEC-589
|
|
44
44
|
// @implements A-SPEC-632
|
|
45
45
|
const fs = __importStar(require("node:fs"));
|
|
@@ -52,7 +52,7 @@ const graph_store_1 = require("../../rtm/graph-store");
|
|
|
52
52
|
const assoc_arm_1 = require("../../assoc/assoc-arm");
|
|
53
53
|
const trace_gaps_1 = require("../../rtm/trace-gaps");
|
|
54
54
|
// @implements A-SPEC-478 — the semantic tier runtime stays at the async reindex edge.
|
|
55
|
-
const tier_1 = require("../../semantic/tier");
|
|
55
|
+
const tier_1 = require("../../semantic/tier"); // A-SPEC-476.1: the project-capped tier
|
|
56
56
|
const vector_cache_1 = require("../../semantic/vector-cache");
|
|
57
57
|
const embedder_1 = require("../../semantic/embedder");
|
|
58
58
|
const unreadable_paths_1 = require("../../semantic/unreadable-paths");
|
|
@@ -100,7 +100,7 @@ function publishCurrentGraph(root, specs, scanned) {
|
|
|
100
100
|
* could not embed — a discharge must not record the last one as done.
|
|
101
101
|
*/
|
|
102
102
|
async function warmSemanticCache(root, scanned) {
|
|
103
|
-
const tier = (0, tier_1.
|
|
103
|
+
const tier = (0, tier_1.resolveProjectSemanticTier)(root);
|
|
104
104
|
if (tier.tier === 'none')
|
|
105
105
|
return { status: 'not-applicable', tier: 'none' };
|
|
106
106
|
const configured = tier.model ? `${tier.tier}:${tier.model}` : tier.tier;
|
|
@@ -125,7 +125,7 @@ async function warmSemanticCache(root, scanned) {
|
|
|
125
125
|
}
|
|
126
126
|
/** Requirement prose is warmed only by the explicit reindex operation. */
|
|
127
127
|
async function warmRequirementSemanticCache(root, specs) {
|
|
128
|
-
const tier = (0, tier_1.
|
|
128
|
+
const tier = (0, tier_1.resolveProjectSemanticTier)(root);
|
|
129
129
|
if (tier.tier === 'none')
|
|
130
130
|
return { status: 'not-applicable', tier: 'none' };
|
|
131
131
|
const configured = tier.model ? `${tier.tier}:${tier.model}` : tier.tier;
|
|
@@ -165,7 +165,7 @@ function headOf(root) {
|
|
|
165
165
|
* records SUPPRESSED rather than a failure, so an owner who turned it off is never shown a fault.
|
|
166
166
|
*/
|
|
167
167
|
async function refreshSemanticVectors(root, env = process.env, warm = warmSemanticCache, scan) {
|
|
168
|
-
const tier = (0, tier_1.
|
|
168
|
+
const tier = (0, tier_1.resolveProjectSemanticTier)(root);
|
|
169
169
|
if (tier.tier === 'none')
|
|
170
170
|
return { lane: 'not-adopted' }; // never opted in: nothing transferred
|
|
171
171
|
const at = new Date().toISOString();
|
|
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.createMaintenanceAnalysisHandlers = createMaintenanceAnalysisHandlers;
|
|
37
|
-
// @implements A-SPEC-745, A-SPEC-469.1,
|
|
37
|
+
// @implements A-SPEC-476.1, A-SPEC-745, A-SPEC-469.1,A-SPEC-469.2, A-SPEC-741, A-SPEC-741.1, A-SPEC-612, A-SPEC-100.2, A-SPEC-128, A-SPEC-189, A-SPEC-267, A-SPEC-268, A-SPEC-269, A-SPEC-277, A-SPEC-283, A-SPEC-290, A-SPEC-292, A-SPEC-293, A-SPEC-378, A-SPEC-388, A-SPEC-418, A-SPEC-478, A-SPEC-571.2, A-SPEC-573.4, A-SPEC-578.5, A-SPEC-734, A-SPEC-278.3
|
|
38
38
|
const fs = __importStar(require("node:fs"));
|
|
39
39
|
const path = __importStar(require("node:path"));
|
|
40
40
|
const node_child_process_1 = require("node:child_process");
|
|
@@ -143,7 +143,7 @@ function createMaintenanceAnalysisHandlers(context) {
|
|
|
143
143
|
// (no tier, no module, no key, embed error) leaves `semantic` undefined = today's behavior.
|
|
144
144
|
let semantic;
|
|
145
145
|
try {
|
|
146
|
-
const rt = (0, embedder_1.makeTierEmbedder)((0, tier_1.
|
|
146
|
+
const rt = (0, embedder_1.makeTierEmbedder)((0, tier_1.resolveProjectSemanticTier)(root), new vector_cache_1.VectorCache(root)); // A-SPEC-476.1
|
|
147
147
|
if (rt !== null) {
|
|
148
148
|
const qv = await rt.embedQuery(a.request);
|
|
149
149
|
semantic = { label: rt.label, queryVector: qv, cachedDocVector: rt.cachedDocVector };
|
|
@@ -5,7 +5,8 @@ import type { ApprovalStatus } from '../../spec/approval-status';
|
|
|
5
5
|
/** The spec-approve request for one spec as the queue holds it now: its state and, when held, the operator's LATEST question. */
|
|
6
6
|
export interface ApprovalRequestState {
|
|
7
7
|
id: string;
|
|
8
|
-
|
|
8
|
+
/** @implements A-SPEC-779.3 — `withdrawn`: the run that filed it closed it; no operator decided it. */
|
|
9
|
+
state: 'pending' | 'held' | 'granted' | 'consumed' | 'denied' | 'revoked' | 'withdrawn';
|
|
9
10
|
question?: string;
|
|
10
11
|
reason?: string;
|
|
11
12
|
ts?: string;
|
|
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.approvalRequestOf = approvalRequestOf;
|
|
37
37
|
exports.nextActionOf = nextActionOf;
|
|
38
38
|
exports.createOperatorInspectionHandlers = createOperatorInspectionHandlers;
|
|
39
|
-
// @implements A-SPEC-605, A-SPEC-605.1
|
|
39
|
+
// @implements A-SPEC-605, A-SPEC-605.1, A-SPEC-779.3
|
|
40
40
|
// @implements A-SPEC-642
|
|
41
41
|
// @implements A-SPEC-631
|
|
42
42
|
// @implements A-SPEC-768
|
|
@@ -92,6 +92,8 @@ function nextActionOf(described, request) {
|
|
|
92
92
|
case 'held': return `held — the operator asks: ${request.question ?? '(no question recorded)'}. Resolve it in the spec or tests, then call spec_approve again.`;
|
|
93
93
|
case 'denied': return `denied — ${request.reason ?? 'no reason recorded'}. Do not re-request the same act; report it to the user.`;
|
|
94
94
|
case 'revoked': return `revoked — ${request.reason ?? 'no reason recorded'}. Do not re-request the same act; report it to the user.`;
|
|
95
|
+
// @implements A-SPEC-779.3
|
|
96
|
+
case 'withdrawn': return `withdrawn by the run that filed it — ${request.reason ?? 'no reason recorded'}. If the seal is still needed, spec_approve files a new request.`;
|
|
95
97
|
case 'granted': return 'granted — call spec_approve now; the grant seals it.';
|
|
96
98
|
case 'consumed': return 'the grant was consumed but this spec is not sealed — call spec_approve again, and report its refusal to the user if it refuses.';
|
|
97
99
|
case 'pending': return "pending the operator's decision — wait, then call approval_status again; when sealed is true, retry spec_approve immediately.";
|
|
@@ -41,6 +41,8 @@ const fs = __importStar(require("node:fs"));
|
|
|
41
41
|
const path = __importStar(require("node:path"));
|
|
42
42
|
const phase_1 = require("../../guardrail/phase");
|
|
43
43
|
const write_target_1 = require("../../guardrail/write-target");
|
|
44
|
+
const classification_mode_1 = require("../../guardrail/classification-mode");
|
|
45
|
+
const run_mode_1 = require("../../governance/run-mode");
|
|
44
46
|
// @implements A-SPEC-735 — the whole corpus in one answer was 153,888 characters here, past what a
|
|
45
47
|
// client accepts, so the overview could not be read. A bounded summary plus a stateless page.
|
|
46
48
|
const PAGE_DEFAULT = 100;
|
|
@@ -160,7 +162,20 @@ function createPhaseQueryHandlers(context) {
|
|
|
160
162
|
},
|
|
161
163
|
async phase_check(a) {
|
|
162
164
|
const specs = await context.listSpecs();
|
|
163
|
-
|
|
165
|
+
// @implements A-SPEC-775.1 — the advisory answers in the mode the hook judges in: a run or the owner's
|
|
166
|
+
// strict opt-in narrows test folders and makes unclassified writes code.
|
|
167
|
+
const bound = context.boundSpecsRoot();
|
|
168
|
+
let opts;
|
|
169
|
+
if (bound !== undefined) {
|
|
170
|
+
try {
|
|
171
|
+
const root = context.projectRootOf(bound);
|
|
172
|
+
opts = (0, classification_mode_1.classifyOptionsFor)(root, (0, run_mode_1.runMode)(process.env, root).run);
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
opts = undefined;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const action = a.action ?? (0, phase_1.classifyAction)(a.target, undefined, opts);
|
|
164
179
|
if (!action)
|
|
165
180
|
return { decision: 'allow', note: 'unclassified target' };
|
|
166
181
|
return (0, phase_1.phaseCheck)(action, { specs, targetAspecId: a.targetAspecId });
|
|
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.TRIAGE_WAIT_MAX_MS = exports.TRIAGE_WAIT_MS = void 0;
|
|
37
37
|
exports.triageWaitMsFrom = triageWaitMsFrom;
|
|
38
38
|
exports.createRequirementTriageHandlers = createRequirementTriageHandlers;
|
|
39
|
-
// @implements A-SPEC-743, A-SPEC-742, A-SPEC-729, A-SPEC-723, A-SPEC-719, A-SPEC-734, A-SPEC-723.1
|
|
39
|
+
// @implements A-SPEC-743, A-SPEC-742, A-SPEC-729, A-SPEC-723, A-SPEC-719, A-SPEC-734, A-SPEC-723.1, A-SPEC-476.1
|
|
40
40
|
// @implements A-SPEC-713
|
|
41
41
|
/** Read-only MCP projection of the pure requirement lifecycle triage model. */
|
|
42
42
|
const crypto = __importStar(require("node:crypto"));
|
|
@@ -204,7 +204,7 @@ function createRequirementTriageHandlers(context) {
|
|
|
204
204
|
}
|
|
205
205
|
for (const value of Object.values(lineageEvidence))
|
|
206
206
|
value.implementationAnchors.sort();
|
|
207
|
-
const tier = (0, tier_1.
|
|
207
|
+
const tier = (0, tier_1.resolveProjectSemanticTier)(root); // A-SPEC-476.1
|
|
208
208
|
// A-SPEC-719: the owner's transfer switch is lexical-only for triage too — the prompt is not
|
|
209
209
|
// embedded (a cloud tier would send it out); the state reads as the owner-chosen not-adopted.
|
|
210
210
|
// The switch may live in only one process's env (hooks and MCP servers see different envs), so a
|
|
@@ -42,6 +42,7 @@ export interface SpecApprovalContext {
|
|
|
42
42
|
why: string;
|
|
43
43
|
subject?: string;
|
|
44
44
|
risk?: string;
|
|
45
|
+
title?: string;
|
|
45
46
|
}): string;
|
|
46
47
|
foreignRootReason(root?: string): string | null;
|
|
47
48
|
/** @implements A-SPEC-732 — why no in-session route was offered (unattested server), or ''. */
|
|
@@ -64,9 +65,6 @@ export declare function createSpecApprovalHandlers(context: SpecApprovalContext)
|
|
|
64
65
|
ok: false;
|
|
65
66
|
reason: string;
|
|
66
67
|
findings: import("../../spec/validator").Finding[];
|
|
67
|
-
candidate?: undefined;
|
|
68
|
-
digest?: undefined;
|
|
69
|
-
parentDigests?: undefined;
|
|
70
68
|
} | {
|
|
71
69
|
ok: boolean;
|
|
72
70
|
reason: string;
|
|
@@ -92,6 +90,8 @@ export declare function createSpecApprovalHandlers(context: SpecApprovalContext)
|
|
|
92
90
|
blockers?: undefined;
|
|
93
91
|
approvalIntent?: undefined;
|
|
94
92
|
} | {
|
|
93
|
+
ancestorWarning?: string | undefined;
|
|
94
|
+
scaffoldWarning?: string | undefined;
|
|
95
95
|
dismissUnknown?: string[] | undefined;
|
|
96
96
|
advisoryHistory?: import("../../rtm/advisory-outcomes").AdvisoryState[] | undefined;
|
|
97
97
|
advisoryIds?: Partial<Record<string, string>> | undefined;
|