@holmes-lab/holmes-kit 0.41.2 → 0.41.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +28 -5
  3. package/bin/holmes-mcp.js +36 -1
  4. package/dist/.build-id +1 -1
  5. package/dist/holmes/cli/claude-switches.d.ts +9 -0
  6. package/dist/holmes/cli/claude-switches.js +11 -8
  7. package/dist/holmes/cli/doctor.d.ts +7 -1
  8. package/dist/holmes/cli/doctor.js +63 -20
  9. package/dist/holmes/cli/holmes-hook-id.d.ts +9 -0
  10. package/dist/holmes/cli/holmes-hook-id.js +22 -0
  11. package/dist/holmes/cli/hook-failure-posture.d.ts +44 -0
  12. package/dist/holmes/cli/hook-failure-posture.js +65 -0
  13. package/dist/holmes/cli/index.js +3 -1
  14. package/dist/holmes/cli/init.d.ts +6 -0
  15. package/dist/holmes/cli/init.js +151 -3
  16. package/dist/holmes/cli/native-deps.d.ts +10 -4
  17. package/dist/holmes/cli/native-deps.js +30 -29
  18. package/dist/holmes/cli/run-wiring.js +4 -2
  19. package/dist/holmes/cli/runtime-binding.d.ts +24 -0
  20. package/dist/holmes/cli/runtime-binding.js +67 -25
  21. package/dist/holmes/cli/settings-merge.d.ts +3 -2
  22. package/dist/holmes/cli/settings-merge.js +11 -9
  23. package/dist/holmes/config/config.d.ts +6 -0
  24. package/dist/holmes/config/config.js +23 -3
  25. package/dist/holmes/config/judgement-keys.d.ts +20 -0
  26. package/dist/holmes/config/judgement-keys.js +100 -0
  27. package/dist/holmes/config/project-caps.js +3 -2
  28. package/dist/holmes/governance/autonomous-shell.js +1 -1
  29. package/dist/holmes/governance/autonomy.d.ts +27 -1
  30. package/dist/holmes/governance/autonomy.js +126 -6
  31. package/dist/holmes/governance/wiring-receipt.d.ts +7 -0
  32. package/dist/holmes/governance/wiring-receipt.js +84 -0
  33. package/dist/holmes/guardrail/cli-root.d.ts +31 -0
  34. package/dist/holmes/guardrail/cli-root.js +261 -0
  35. package/dist/holmes/guardrail/command-traits.d.ts +2 -0
  36. package/dist/holmes/guardrail/command-traits.js +26 -1
  37. package/dist/holmes/guardrail/impact-gate.d.ts +17 -1
  38. package/dist/holmes/guardrail/impact-gate.js +44 -5
  39. package/dist/holmes/guardrail/outward-acts.js +10 -3
  40. package/dist/holmes/guardrail/package-manager-acts.d.ts +41 -0
  41. package/dist/holmes/guardrail/package-manager-acts.js +1298 -0
  42. package/dist/holmes/guardrail/refusal-codes.js +9 -1
  43. package/dist/holmes/guardrail/shell-syntax.d.ts +3 -0
  44. package/dist/holmes/guardrail/shell-syntax.js +7 -2
  45. package/dist/holmes/guardrail/write-target.d.ts +20 -0
  46. package/dist/holmes/guardrail/write-target.js +168 -2
  47. package/dist/holmes/hooks/pre-tool-use.d.ts +110 -3
  48. package/dist/holmes/hooks/pre-tool-use.js +1208 -60
  49. package/dist/holmes/mcp/evidence-artifact.d.ts +112 -0
  50. package/dist/holmes/mcp/evidence-artifact.js +2 -0
  51. package/dist/holmes/mcp/handlers/maintenance-evidence.d.ts +2 -1
  52. package/dist/holmes/mcp/handlers/maintenance-evidence.js +24 -2
  53. package/dist/holmes/mcp/handlers/operator-inspection.d.ts +1 -1
  54. package/dist/holmes/mcp/handlers/operator-inspection.js +2 -2
  55. package/dist/holmes/mcp/handlers/requirement-triage.d.ts +1 -1
  56. package/dist/holmes/mcp/handlers/requirement-triage.js +3 -2
  57. package/dist/holmes/mcp/handlers/spec-approval.d.ts +1 -1
  58. package/dist/holmes/mcp/handlers/spec-approval.js +6 -6
  59. package/dist/holmes/mcp/handlers/test-execution.d.ts +8 -0
  60. package/dist/holmes/mcp/handlers/test-execution.js +12 -6
  61. package/dist/holmes/mcp/handlers.d.ts +16 -7
  62. package/dist/holmes/mcp/maintenance-evidence.d.ts +11 -82
  63. package/dist/holmes/mcp/maintenance-evidence.js +57 -2
  64. package/dist/holmes/mcp/outcome-replay.d.ts +18 -0
  65. package/dist/holmes/mcp/outcome-replay.js +85 -0
  66. package/dist/holmes/mcp/outcome-windows.d.ts +136 -0
  67. package/dist/holmes/mcp/outcome-windows.js +236 -0
  68. package/dist/holmes/mcp/tool-schemas.js +1 -1
  69. package/dist/holmes/project/hook-specs-arg.d.ts +4 -0
  70. package/dist/holmes/project/hook-specs-arg.js +39 -0
  71. package/dist/holmes/project/install-layout.d.ts +11 -0
  72. package/dist/holmes/project/install-layout.js +109 -0
  73. package/dist/holmes/project/install-scripts-policy.d.ts +4 -1
  74. package/dist/holmes/project/install-scripts-policy.js +6 -3
  75. package/dist/holmes/project/native-recovery.d.ts +29 -0
  76. package/dist/holmes/project/native-recovery.js +62 -0
  77. package/dist/holmes/project/root.d.ts +6 -0
  78. package/dist/holmes/project/root.js +15 -3
  79. package/dist/holmes/project/wiring-receipt-format.d.ts +20 -0
  80. package/dist/holmes/project/wiring-receipt-format.js +42 -0
  81. package/dist/holmes/project/workspace-preflight.d.ts +9 -0
  82. package/dist/holmes/project/workspace-preflight.js +40 -1
  83. package/dist/holmes/review/classification-replay.d.ts +53 -0
  84. package/dist/holmes/review/classification-replay.js +78 -0
  85. package/dist/holmes/review/head-worktree.js +5 -4
  86. package/dist/holmes/review/run-provenance.js +3 -2
  87. package/dist/holmes/review/test-evidence.js +2 -2
  88. package/dist/holmes/review/test-outcomes.js +3 -1
  89. package/dist/holmes/rtm/graph-store.d.ts +5 -0
  90. package/dist/holmes/rtm/graph-store.js +12 -4
  91. package/dist/holmes/rtm/native-driver.d.ts +42 -0
  92. package/dist/holmes/rtm/native-driver.js +147 -0
  93. package/dist/holmes/rtm/rtm-graph.js +11 -2
  94. package/dist/holmes/runtime/dispatch.d.ts +6 -0
  95. package/dist/holmes/runtime/dispatch.js +51 -2
  96. package/dist/holmes/runtime/hook-process.d.ts +6 -0
  97. package/dist/holmes/runtime/hook-process.js +3 -3
  98. package/dist/holmes/update/semver-strict.d.ts +3 -0
  99. package/dist/holmes/update/semver-strict.js +58 -0
  100. package/docs/install-guide.md +8 -1
  101. package/package.json +1 -1
  102. package/playbooks/tdd-slice/PLAYBOOK.md +1 -1
  103. package/release-history.json +36 -1
@@ -0,0 +1,112 @@
1
+ /**
2
+ * The persisted maintenance evidence artifact's types, apart from the module that writes artifacts
3
+ * (maintenance-evidence) and the one that windows their outcomes (outcome-windows). A-SPEC-772.29: the two imported each
4
+ * other — values one way, this type back — a cycle the repository's no-cycles census refuses (A-SPEC-574.3). Both
5
+ * re-export what they used to define, so importers are unchanged. The fields' own specs are named beside them.
6
+ */
7
+ import type { MaintenanceAnalysis } from './maintenance-analyze';
8
+ /** Why a persisted analysis's window cannot be read from git (from A-SPEC-578.18). */
9
+ export type UnattributableReason = 'no-head' | 'diverged' | 'too-wide' | 'not-a-repository';
10
+ export interface EvidenceOutcome {
11
+ recordedAt: string;
12
+ actualFiles: string[];
13
+ actualSymbols: string[];
14
+ actualTests: string[];
15
+ /** Absent when nobody has judged the classification: unscored, NOT scored as wrong. */
16
+ actualClassification?: string;
17
+ /**
18
+ * (A-SPEC-578.17) which window the files came from. Absent on an outcome recorded by a caller or before windows
19
+ * existed (scored as `unwindowed`, never as a window).
20
+ */
21
+ window?: OutcomeWindow;
22
+ }
23
+ /** (A-SPEC-578.17) */
24
+ export type OutcomeWindow = {
25
+ kind: 'commits';
26
+ from: string;
27
+ to: string;
28
+ shas: string[];
29
+ } | {
30
+ kind: 'superseded';
31
+ by: string;
32
+ sameRequest: boolean | null;
33
+ } | {
34
+ kind: 'unattributable';
35
+ reason: UnattributableReason;
36
+ };
37
+ export interface EvidenceArtifact {
38
+ artifactSchema: string;
39
+ digest: string;
40
+ recordedAt: string;
41
+ analysisSchema: string;
42
+ extractorVersion: string;
43
+ classification: string;
44
+ confidence: number;
45
+ /**
46
+ * (A-SPEC-740) optional on purpose: an artifact recorded before the marker existed is just as uncalibrated, and the
47
+ * schema string stays 1.4 so calibration still reads it.
48
+ */
49
+ confidenceCalibrated?: false;
50
+ graphBasis: MaintenanceAnalysis['graphBasis'];
51
+ predicted: {
52
+ files: string[];
53
+ primaryFiles: string[];
54
+ symbols: string[];
55
+ tests: string[];
56
+ /**
57
+ * (A-SPEC-277) sha256 of each predicted file AS ANALYSED. HEAD alone cannot see an uncommitted edit to the very file
58
+ * under analysis, which would leave the evidence looking current while describing content that no longer exists.
59
+ * Computed by the caller (reading files is I/O; this module is pure), keyed by the same repo-relative path as `files`.
60
+ */
61
+ fileDigests: Record<string, string>;
62
+ /**
63
+ * (A-SPEC-578.17) the ranked set before the cap: the emitted candidates in rank order, then the rerank pool in its
64
+ * order. `files` is the emitted ten, sorted; this keeps the order and the tail so a miss at ten can be told from a
65
+ * miss in the ranking. Optional: artifacts written before it read as before.
66
+ */
67
+ rankedFiles?: string[];
68
+ };
69
+ /**
70
+ * (A-SPEC-276) What the analysis did NOT establish. A pre-edit gate that reads only the prediction would treat "we saw
71
+ * no impact" and "we could not look" as the same sentence; they are opposite claims. The artifact is the durable
72
+ * evidence, so the uncertainty travels with it.
73
+ */
74
+ uncertainty: {
75
+ unknowns: string[];
76
+ coverage: {
77
+ scannedFiles: number;
78
+ skippedFiles: string[];
79
+ unsupportedLanguages: string[];
80
+ };
81
+ /** The caller walk stopped at a bound: the transitive set is a lower bound, not a complete one. */
82
+ impactTruncated: boolean;
83
+ testScopeTier: string;
84
+ /** (A-SPEC-744) why the scope was what it was; optional so older artifacts still read. */
85
+ testScopeReason?: string;
86
+ testScopeCauses?: string[];
87
+ /** Files reachable only through a call edge — affected, but never analysed as edit candidates. */
88
+ impactedFiles: string[];
89
+ /**
90
+ * (A-SPEC-279) Whether each constraint axis was EXAMINED. False means the input was missing, never that the axis
91
+ * came back clean — the distinction the gate acts on.
92
+ */
93
+ securityAssessed: boolean;
94
+ compatibilityAssessed: boolean;
95
+ /**
96
+ * (A-SPEC-333.9) the governing documents the architecture basis held. The gate keeps the axis open for an edit of a
97
+ * governing document a diff-built basis did not hold. Optional: older artifacts read as before.
98
+ */
99
+ architectureTouched?: string[];
100
+ };
101
+ outcome?: EvidenceOutcome;
102
+ /**
103
+ * (A-SPEC-278.3) what the caller asked and which files it said it would change. The pre-edit gate covers a new file the
104
+ * request names (A-SPEC-278.2), which it could not do while the artifact kept no request. Optional: older artifacts
105
+ * read as before.
106
+ */
107
+ request?: string;
108
+ changedFiles?: string[];
109
+ /** (A-SPEC-293.1) where the architecture axis's changed files came from; never itself a list the gate reads. */
110
+ changedFilesSource?: ChangedFilesSource;
111
+ }
112
+ export type ChangedFilesSource = 'caller' | 'git-diff-default' | 'none';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -17,7 +17,7 @@ export declare function createMaintenanceEvidenceHandlers(context: MaintenanceEv
17
17
  actualSymbols?: string[];
18
18
  actualTests?: string[];
19
19
  actualClassification?: string;
20
- }): Promise<import("../maintenance-evidence").EvidenceArtifact>;
20
+ }): Promise<import("../evidence-artifact").EvidenceArtifact>;
21
21
  impact_gate_check(a: {
22
22
  root: string;
23
23
  target: string;
@@ -45,6 +45,7 @@ export declare function createMaintenanceEvidenceHandlers(context: MaintenanceEv
45
45
  unrecorded: number;
46
46
  causes: Record<string, number>;
47
47
  };
48
+ fileScores: import("../outcome-windows").FileScores;
48
49
  }>;
49
50
  };
50
51
  export {};
@@ -34,15 +34,33 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.createMaintenanceEvidenceHandlers = createMaintenanceEvidenceHandlers;
37
- // @implements A-SPEC-724.1, A-SPEC-603, A-SPEC-734
37
+ // @implements A-SPEC-476.9, A-SPEC-580.4, A-SPEC-724.1, A-SPEC-603, A-SPEC-734, A-SPEC-578.18
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");
41
41
  const maintenance_evidence_1 = require("../maintenance-evidence");
42
42
  const impact_gate_1 = require("../../guardrail/impact-gate");
43
+ const judgement_keys_1 = require("../../config/judgement-keys");
43
44
  const root_1 = require("../../project/root");
44
45
  const trace_gaps_1 = require("../../rtm/trace-gaps");
45
46
  const bounded_io_1 = require("../../project/bounded-io");
47
+ /**
48
+ * @implements A-SPEC-578.18 — `ax.config.json` `calibration.unscoredPaths`: an array of strings, or nothing (the default
49
+ * then applies). Read here rather than through loadConfig's schema: it is an observation setting, and a malformed value
50
+ * must only fall back to the default, never fail the call.
51
+ */
52
+ function unscoredOf(root) {
53
+ // @implements A-SPEC-476.9 — the one parser (config/judgement-keys), so the gate compares what this reader reads
54
+ let text = null;
55
+ try {
56
+ text = fs.readFileSync(path.join(root, 'ax.config.json'), 'utf8');
57
+ }
58
+ catch {
59
+ text = null;
60
+ }
61
+ const v = (0, judgement_keys_1.unscoredPathsOfText)(text);
62
+ return v !== null ? { unscored: v } : {};
63
+ }
46
64
  /** Raw handlers: the public facade attaches basis exactly once. */
47
65
  function createMaintenanceEvidenceHandlers(context) {
48
66
  return {
@@ -92,12 +110,15 @@ function createMaintenanceEvidenceHandlers(context) {
92
110
  catch {
93
111
  gaps = undefined;
94
112
  }
113
+ // @implements A-SPEC-580.4 — with no analysis, say why none can exist when the native driver does not load (A6)
114
+ const driverCause = artifact ? null : (0, impact_gate_1.driverCauseOf)();
95
115
  return (0, impact_gate_1.evaluateEditEvidence)({
96
116
  target,
97
117
  artifact,
98
118
  currentHead: head,
99
119
  currentTargetDigest: context.fileDigestOf(root, a.target),
100
120
  ...(gaps ? { traceGaps: gaps } : {}),
121
+ ...(driverCause ? { driverUnavailable: driverCause } : {}),
101
122
  });
102
123
  },
103
124
  // @implements A-SPEC-268
@@ -110,7 +131,8 @@ function createMaintenanceEvidenceHandlers(context) {
110
131
  // Corrupt and off-schema records travel WITH the score. A calibration that quietly dropped
111
132
  // them would report a clean number over an unstated subset of the evidence.
112
133
  return {
113
- ...(0, maintenance_evidence_1.computeCalibration)(read.artifacts, { minSamples: a.minSamples }),
134
+ // @implements A-SPEC-578.18 — the project's own unscored paths (`calibration.unscoredPaths`), when it declares them
135
+ ...(0, maintenance_evidence_1.computeCalibration)(read.artifacts, { minSamples: a.minSamples, ...unscoredOf(root) }),
114
136
  artifacts: read.artifacts.length,
115
137
  unreadable: read.unreadable,
116
138
  skippedSchema: read.skippedSchema,
@@ -99,7 +99,7 @@ export declare function createOperatorInspectionHandlers(context: OperatorInspec
99
99
  sourceCommit: string | null;
100
100
  head: string | null;
101
101
  };
102
- unavailable?: "empty" | "unreadable";
102
+ unavailable?: "empty" | "unreadable" | "driver-unavailable";
103
103
  } | undefined;
104
104
  nextAction: string;
105
105
  request?: ApprovalRequestState | undefined;
@@ -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-794.85, A-SPEC-605, A-SPEC-605.1, A-SPEC-779.3, A-SPEC-245.17, A-SPEC-794.33, A-SPEC-794.34, A-SPEC-794.35, A-SPEC-794.37, A-SPEC-794.40, A-SPEC-794.41, A-SPEC-794.42, A-SPEC-794.44
39
+ // @implements A-SPEC-580.2, A-SPEC-794.85, A-SPEC-605, A-SPEC-605.1, A-SPEC-779.3, A-SPEC-245.17, A-SPEC-794.33, A-SPEC-794.34, A-SPEC-794.35, A-SPEC-794.37, A-SPEC-794.40, A-SPEC-794.41, A-SPEC-794.42, A-SPEC-794.44
40
40
  // @implements A-SPEC-642, A-SPEC-245.9, A-SPEC-245.15
41
41
  // @implements A-SPEC-631
42
42
  // @implements A-SPEC-768
@@ -194,7 +194,7 @@ function createOperatorInspectionHandlers(context) {
194
194
  const { openPublishedGraph, headCommitOf } = require('../../rtm/graph-store');
195
195
  const { cleanSubprocessEnv } = require('../../project/root');
196
196
  const view = openPublishedGraph(dbPath, headCommitOf(a.root, cleanSubprocessEnv()));
197
- if (view.status === 'empty' || view.status === 'unreadable') {
197
+ if (view.status === 'empty' || view.status === 'unreadable' || view.status === 'driver-unavailable') {
198
198
  graphPreview = { unavailable: view.status, ...(view.graphAsOf ? { graphAsOf: view.graphAsOf } : {}) };
199
199
  }
200
200
  else if (view.graph !== null) {
@@ -29,7 +29,7 @@ export declare const TRIAGE_WAIT_MAX_MS = 60000;
29
29
  * above the ceiling is the ceiling); every other value leaves the default.
30
30
  */
31
31
  export declare function triageWaitMsFrom(env: Record<string, string | undefined>): number;
32
- type GraphStatus = 'current' | 'stale' | 'unverified' | 'absent' | 'unreadable' | 'empty';
32
+ type GraphStatus = 'current' | 'stale' | 'unverified' | 'absent' | 'unreadable' | 'empty' | 'driver-unavailable';
33
33
  export declare function createRequirementTriageHandlers(context: RequirementTriageHandlerContext): {
34
34
  requirement_triage(a: {
35
35
  root: string;
@@ -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, A-SPEC-476.1
39
+ // @implements A-SPEC-580.2, 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"));
@@ -241,7 +241,8 @@ function createRequirementTriageHandlers(context) {
241
241
  // A-SPEC-742 review round 1: a vector whose cosine was filtered out (<= 0) ranked nothing.
242
242
  const lexical = !semanticCandidates.some((c) => Number.isFinite(c.score) && c.score > 0);
243
243
  const ranked = (0, requirement_triage_1.triageRequirements)({ prompt: a.prompt, documents, evidence: lineageEvidence,
244
- semanticCandidates, semantic, graph: { state: graph.status }, topK: a.topK });
244
+ // A-SPEC-580.2 — the ranker knows an unusable graph as 'unreadable'; the evidence keeps the precise status
245
+ semanticCandidates, semantic, graph: { state: graph.status === 'driver-unavailable' ? 'unreadable' : graph.status }, topK: a.topK });
245
246
  const result = freshnessCurrent ? ranked : {
246
247
  ...ranked, verdict: 'ambiguous',
247
248
  reasons: [...ranked.reasons, `freshness-${freshness?.state ?? 'absent'}`],
@@ -112,7 +112,7 @@ export declare function createSpecApprovalHandlers(context: SpecApprovalContext)
112
112
  advisoryIds?: Partial<Record<string, string>> | undefined;
113
113
  killsAdvisory?: import("../../review/kills-check").KillsAdvisory | undefined;
114
114
  fttFulfilment?: import("../../rtm/ftt-fulfilment").FttFulfilment | undefined;
115
- impactAdvisoryUnavailable?: "unreadable" | "empty" | undefined;
115
+ impactAdvisoryUnavailable?: "unreadable" | "empty" | "driver-unavailable" | undefined;
116
116
  impactGraph?: {
117
117
  status: "current" | "stale" | "unverified";
118
118
  sourceCommit: string | null;
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.createSpecApprovalHandlers = createSpecApprovalHandlers;
37
37
  exports.readProjectFile = readProjectFile;
38
- // @implements A-SPEC-794.95, A-SPEC-794.88, A-SPEC-794.85, A-SPEC-794.81, A-SPEC-182.3, A-SPEC-718.3, A-SPEC-770.6, A-SPEC-718.1,A-SPEC-718.2, A-SPEC-718, A-SPEC-551.1, A-SPEC-551.2, A-SPEC-627.1, A-SPEC-622, A-SPEC-100.2, A-SPEC-128, A-SPEC-132, A-SPEC-133, A-SPEC-151, A-SPEC-188, A-SPEC-189, A-SPEC-244, A-SPEC-245, A-SPEC-729, A-SPEC-532.7, A-SPEC-792.1, A-SPEC-792.4
38
+ // @implements A-SPEC-580.2, A-SPEC-794.95, A-SPEC-794.88, A-SPEC-794.85, A-SPEC-794.81, A-SPEC-182.3, A-SPEC-718.3, A-SPEC-770.6, A-SPEC-718.1,A-SPEC-718.2, A-SPEC-718, A-SPEC-551.1, A-SPEC-551.2, A-SPEC-627.1, A-SPEC-622, A-SPEC-100.2, A-SPEC-128, A-SPEC-132, A-SPEC-133, A-SPEC-151, A-SPEC-188, A-SPEC-189, A-SPEC-244, A-SPEC-245, A-SPEC-729, A-SPEC-532.7, A-SPEC-792.1, A-SPEC-792.4
39
39
  // @implements A-SPEC-631, A-SPEC-733, A-SPEC-245.9, A-SPEC-245.15
40
40
  const fs = __importStar(require("node:fs"));
41
41
  const compat_impact_1 = require("../../spec/compat-impact");
@@ -213,7 +213,7 @@ function createSpecApprovalHandlers(context) {
213
213
  if (ceilingNote !== null) {
214
214
  // @implements A-SPEC-792.4 — under a full profile the owner's ceiling still binds, and refuses at once.
215
215
  if (fullEntry !== null) {
216
- return { ok: false, reason: `spec_approve: ${a.id} — [full autonomy: the owner's ceiling keeps this seal; the owner changes autonomy.ceiling in ax.config.json]${ceilingNote} (no approval request was filed)` };
216
+ return { ok: false, reason: `spec_approve: ${a.id} — [full autonomy: the owner's ceiling keeps this seal; ask the owner — the ceiling is theirs to change]${ceilingNote} (no approval request was filed)` };
217
217
  }
218
218
  autonomyNote = ceilingNote;
219
219
  }
@@ -432,11 +432,11 @@ function createSpecApprovalHandlers(context) {
432
432
  // @implements A-SPEC-182.3 — an ancestor above the parents that is not approved: refused in a run or under strict
433
433
  // (above); interactively sealed as in 0.35.25 and named in the result.
434
434
  const ancestorWarning = prepared.ancestorWarnings
435
- ? `${prepared.ancestorWarnings.join('; ')} — sealed; a run or classification.strict refuses this`
435
+ ? `${prepared.ancestorWarnings.join('; ')} — sealed; a run or the owner's strict classification refuses this`
436
436
  : undefined;
437
437
  const scaffoldLeft = scaffoldStrict ? [] : (0, approval_blockers_1.scaffoldSections)(prepared.candidate);
438
438
  const scaffoldWarning = scaffoldLeft.length > 0
439
- ? `${scaffoldLeft.join(', ')} still hold the spec_slice_init scaffold — sealed; a run or classification.strict refuses this`
439
+ ? `${scaffoldLeft.join(', ')} still hold the spec_slice_init scaffold — sealed; a run or the owner's strict classification refuses this`
440
440
  : undefined;
441
441
  const { candidate, digest } = prepared;
442
442
  const priorDigest = (0, spec_digest_1.sealOf)(spec).approvedDigest;
@@ -553,7 +553,7 @@ function createSpecApprovalHandlers(context) {
553
553
  // @implements A-SPEC-631 — the graph's CONDITION rides beside the advisory: current/stale/unverified,
554
554
  // or the reason no advisory could be derived. An empty graph is never reported as no impact.
555
555
  let impactGraph;
556
- let impactAdvisoryUnavailable;
556
+ let impactAdvisoryUnavailable; // A-SPEC-580.2
557
557
  try {
558
558
  if (spec.type === 'A-SPEC' && a.root) {
559
559
  const dbPath = path.join(a.root, '.ax', 'rtm.sqlite');
@@ -562,7 +562,7 @@ function createSpecApprovalHandlers(context) {
562
562
  const { openPublishedGraph, headCommitOf } = require('../../rtm/graph-store');
563
563
  const { cleanSubprocessEnv } = require('../../project/root');
564
564
  const view = openPublishedGraph(dbPath, headCommitOf(a.root, cleanSubprocessEnv()));
565
- if (view.status === 'empty' || view.status === 'unreadable') {
565
+ if (view.status === 'empty' || view.status === 'unreadable' || view.status === 'driver-unavailable') {
566
566
  impactAdvisoryUnavailable = view.status;
567
567
  }
568
568
  else if (view.graph !== null) {
@@ -72,6 +72,7 @@ export declare function createTestExecutionHandlers(context: TestExecutionContex
72
72
  separator: string;
73
73
  dropped: string[];
74
74
  }[] | undefined;
75
+ calibrationWindowsFailed?: number | undefined;
75
76
  calibrationClosed?: string[] | undefined;
76
77
  nextCall?: string | undefined;
77
78
  notFullBecause?: string | undefined;
@@ -134,6 +135,7 @@ export declare function createTestExecutionHandlers(context: TestExecutionContex
134
135
  separator: string;
135
136
  dropped: string[];
136
137
  }[] | undefined;
138
+ calibrationWindowsFailed?: number | undefined;
137
139
  calibrationClosed?: string[] | undefined;
138
140
  nextCall?: string | undefined;
139
141
  notFullBecause?: string | undefined;
@@ -192,6 +194,7 @@ export declare function createTestExecutionHandlers(context: TestExecutionContex
192
194
  separator: string;
193
195
  dropped: string[];
194
196
  }[] | undefined;
197
+ calibrationWindowsFailed?: number | undefined;
195
198
  calibrationClosed?: string[] | undefined;
196
199
  nextCall?: string | undefined;
197
200
  notFullBecause?: string | undefined;
@@ -254,6 +257,7 @@ export declare function createTestExecutionHandlers(context: TestExecutionContex
254
257
  separator: string;
255
258
  dropped: string[];
256
259
  }[] | undefined;
260
+ calibrationWindowsFailed?: number | undefined;
257
261
  calibrationClosed?: string[] | undefined;
258
262
  nextCall?: string | undefined;
259
263
  notFullBecause?: string | undefined;
@@ -312,6 +316,7 @@ export declare function createTestExecutionHandlers(context: TestExecutionContex
312
316
  separator: string;
313
317
  dropped: string[];
314
318
  }[] | undefined;
319
+ calibrationWindowsFailed?: number | undefined;
315
320
  calibrationClosed?: string[] | undefined;
316
321
  nextCall?: string | undefined;
317
322
  notFullBecause?: string | undefined;
@@ -374,6 +379,7 @@ export declare function createTestExecutionHandlers(context: TestExecutionContex
374
379
  separator: string;
375
380
  dropped: string[];
376
381
  }[] | undefined;
382
+ calibrationWindowsFailed?: number | undefined;
377
383
  calibrationClosed?: string[] | undefined;
378
384
  nextCall?: string | undefined;
379
385
  notFullBecause?: string | undefined;
@@ -432,6 +438,7 @@ export declare function createTestExecutionHandlers(context: TestExecutionContex
432
438
  separator: string;
433
439
  dropped: string[];
434
440
  }[] | undefined;
441
+ calibrationWindowsFailed?: number | undefined;
435
442
  calibrationClosed?: string[] | undefined;
436
443
  nextCall?: string | undefined;
437
444
  notFullBecause?: string | undefined;
@@ -494,6 +501,7 @@ export declare function createTestExecutionHandlers(context: TestExecutionContex
494
501
  separator: string;
495
502
  dropped: string[];
496
503
  }[] | undefined;
504
+ calibrationWindowsFailed?: number | undefined;
497
505
  calibrationClosed?: string[] | undefined;
498
506
  nextCall?: string | undefined;
499
507
  notFullBecause?: string | undefined;
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.declaredPrepare = declaredPrepare;
37
37
  exports.createTestExecutionHandlers = createTestExecutionHandlers;
38
- // @implements A-SPEC-616, A-SPEC-100.2, A-SPEC-102.1, A-SPEC-121.2, A-SPEC-121.3, A-SPEC-128, A-SPEC-130, A-SPEC-189, A-SPEC-233, A-SPEC-419, A-SPEC-433, A-SPEC-534.5, A-SPEC-534.8, A-SPEC-578.4, A-SPEC-614, A-SPEC-734, A-SPEC-768.1, A-SPEC-466.1, A-SPEC-466.2, A-SPEC-466.3, A-SPEC-466.6, A-SPEC-128.2, A-SPEC-128.4, A-SPEC-128.5, A-SPEC-128.6, A-SPEC-128.7, A-SPEC-128.8, A-SPEC-128.9, A-SPEC-128.10, A-SPEC-128.13, A-SPEC-794.119
38
+ // @implements A-SPEC-616, A-SPEC-100.2, A-SPEC-102.1, A-SPEC-121.2, A-SPEC-121.3, A-SPEC-128, A-SPEC-130, A-SPEC-189, A-SPEC-233, A-SPEC-419, A-SPEC-433, A-SPEC-534.5, A-SPEC-534.8, A-SPEC-578.4, A-SPEC-614, A-SPEC-734, A-SPEC-768.1, A-SPEC-466.1, A-SPEC-466.2, A-SPEC-466.3, A-SPEC-466.6, A-SPEC-128.2, A-SPEC-128.4, A-SPEC-128.5, A-SPEC-128.6, A-SPEC-128.7, A-SPEC-128.8, A-SPEC-128.9, A-SPEC-128.10, A-SPEC-128.13, A-SPEC-794.119, A-SPEC-578.17, A-SPEC-578.18
39
39
  const fs = __importStar(require("node:fs"));
40
40
  const path = __importStar(require("node:path"));
41
41
  const node_child_process_1 = require("node:child_process");
@@ -75,14 +75,14 @@ function declaredPrepare(dir) {
75
75
  parsed = JSON.parse(fs.readFileSync(file, 'utf8'));
76
76
  }
77
77
  catch (e) {
78
- throw new Error(`HEAD's ax.config.json cannot be read as JSON (${(e instanceof Error ? e.message : String(e)).slice(0, 160)}) — a declared testRun.prepare cannot be told apart from none`);
78
+ throw new Error(`HEAD's ax.config.json cannot be read as JSON (${(e instanceof Error ? e.message : String(e)).slice(0, 160)}) — a declared prepare command cannot be told apart from none; ask the owner to fix the file`);
79
79
  }
80
80
  const tr = parsed !== null && typeof parsed === 'object' ? parsed.testRun : undefined;
81
81
  const prep = tr !== null && typeof tr === 'object' ? tr.prepare : undefined;
82
82
  if (prep === undefined || prep === null || (Array.isArray(prep) && prep.length === 0))
83
83
  return undefined;
84
84
  if (!Array.isArray(prep) || !prep.every((x) => typeof x === 'string' && x !== '')) {
85
- throw new Error(`HEAD's ax.config.json declares testRun.prepare as ${JSON.stringify(prep).slice(0, 120)} — it must be a non-empty array of non-empty strings (an argv, no shell)`);
85
+ throw new Error(`HEAD's ax.config.json declares a prepare command as ${JSON.stringify(prep).slice(0, 120)} — it must be a non-empty array of non-empty strings (an argv, no shell); ask the owner to fix it`);
86
86
  }
87
87
  return prep;
88
88
  }
@@ -392,10 +392,15 @@ function createTestExecutionHandlers(context) {
392
392
  // to it would be contamination rather than measurement. Its own try: an observation that
393
393
  // could change `passed` would be a gate wearing another name.
394
394
  let calibrationClosed;
395
+ let calibrationWindowsFailed;
395
396
  try {
396
- const closed = (0, maintenance_evidence_1.closeOpenArtifacts)(path.join(root, maintenance_evidence_1.EVIDENCE_DIR), { files: changedFiles }, new Date().toISOString(), previousEvidenceTs).closed;
397
- if (closed.length > 0)
398
- calibrationClosed = closed;
397
+ // @implements A-SPEC-578.17, A-SPEC-578.18 — each analysis is scored on its own window (its HEAD to the next
398
+ // analysis's HEAD), closed once that window has ended; a git failure closes nothing and is counted
399
+ const r = (0, maintenance_evidence_1.closeOpenArtifacts)(path.join(root, maintenance_evidence_1.EVIDENCE_DIR), { files: changedFiles, root }, new Date().toISOString(), previousEvidenceTs);
400
+ if (r.closed.length > 0)
401
+ calibrationClosed = r.closed;
402
+ if ((r.failed ?? 0) > 0)
403
+ calibrationWindowsFailed = r.failed;
399
404
  }
400
405
  catch { /* the loop is observation; it never touches the verdict */ }
401
406
  // @implements A-SPEC-128
@@ -431,6 +436,7 @@ function createTestExecutionHandlers(context) {
431
436
  ...(excludeDirsIgnored.length ? { excludeDirsIgnored } : {}),
432
437
  ...(notFullBecause ? { notFullBecause } : {}), ...(nextCall ? { nextCall } : {}),
433
438
  ...(calibrationClosed ? { calibrationClosed } : {}),
439
+ ...(calibrationWindowsFailed ? { calibrationWindowsFailed } : {}),
434
440
  ...(anchorDiagnostics.length > 0 ? { anchorDiagnostics } : {}), ...(worktreeLeft !== null ? { worktreeLeft } : {}) };
435
441
  },
436
442
  };
@@ -802,7 +802,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
802
802
  };
803
803
  }[];
804
804
  graph: {
805
- status: "absent" | "current" | "unreadable" | "empty" | "stale" | "unverified";
805
+ status: "absent" | "current" | "unreadable" | "empty" | "stale" | "unverified" | "driver-unavailable";
806
806
  sourceCommit: string | null;
807
807
  graphAsOf: string | null;
808
808
  resolutionLimits: string[];
@@ -862,7 +862,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
862
862
  };
863
863
  }[];
864
864
  graph: {
865
- status: "absent" | "current" | "unreadable" | "empty" | "stale" | "unverified";
865
+ status: "absent" | "current" | "unreadable" | "empty" | "stale" | "unverified" | "driver-unavailable";
866
866
  sourceCommit: string | null;
867
867
  graphAsOf: string | null;
868
868
  resolutionLimits: string[];
@@ -944,7 +944,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
944
944
  };
945
945
  }[];
946
946
  graph: {
947
- status: "absent" | "current" | "unreadable" | "empty" | "stale" | "unverified";
947
+ status: "absent" | "current" | "unreadable" | "empty" | "stale" | "unverified" | "driver-unavailable";
948
948
  sourceCommit: string | null;
949
949
  graphAsOf: string | null;
950
950
  resolutionLimits: string[];
@@ -1010,7 +1010,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
1010
1010
  };
1011
1011
  }[];
1012
1012
  graph: {
1013
- status: "absent" | "current" | "unreadable" | "empty" | "stale" | "unverified";
1013
+ status: "absent" | "current" | "unreadable" | "empty" | "stale" | "unverified" | "driver-unavailable";
1014
1014
  sourceCommit: string | null;
1015
1015
  graphAsOf: string | null;
1016
1016
  resolutionLimits: string[];
@@ -1107,7 +1107,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
1107
1107
  actualSymbols?: string[];
1108
1108
  actualTests?: string[];
1109
1109
  actualClassification?: string;
1110
- }): Promise<import("./maintenance-evidence").EvidenceArtifact>;
1110
+ }): Promise<import("./evidence-artifact").EvidenceArtifact>;
1111
1111
  impact_gate_check(a: {
1112
1112
  root: string;
1113
1113
  target: string;
@@ -1135,6 +1135,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
1135
1135
  unrecorded: number;
1136
1136
  causes: Record<string, number>;
1137
1137
  };
1138
+ fileScores: import("./outcome-windows").FileScores;
1138
1139
  }>;
1139
1140
  [HOST_APPROVAL_PROBE]: {
1140
1141
  prepareHostApproval: (input: {
@@ -1248,7 +1249,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
1248
1249
  sourceCommit: string | null;
1249
1250
  head: string | null;
1250
1251
  };
1251
- unavailable?: "empty" | "unreadable";
1252
+ unavailable?: "empty" | "unreadable" | "driver-unavailable";
1252
1253
  } | undefined;
1253
1254
  nextAction: string;
1254
1255
  request?: import("./handlers/operator-inspection").ApprovalRequestState | undefined;
@@ -1362,7 +1363,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
1362
1363
  advisoryIds?: Partial<Record<string, string>> | undefined;
1363
1364
  killsAdvisory?: import("../review/kills-check").KillsAdvisory | undefined;
1364
1365
  fttFulfilment?: import("../rtm/ftt-fulfilment").FttFulfilment | undefined;
1365
- impactAdvisoryUnavailable?: "unreadable" | "empty" | undefined;
1366
+ impactAdvisoryUnavailable?: "unreadable" | "empty" | "driver-unavailable" | undefined;
1366
1367
  impactGraph?: {
1367
1368
  status: "current" | "stale" | "unverified";
1368
1369
  sourceCommit: string | null;
@@ -1613,6 +1614,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
1613
1614
  separator: string;
1614
1615
  dropped: string[];
1615
1616
  }[] | undefined;
1617
+ calibrationWindowsFailed?: number | undefined;
1616
1618
  calibrationClosed?: string[] | undefined;
1617
1619
  nextCall?: string | undefined;
1618
1620
  notFullBecause?: string | undefined;
@@ -1675,6 +1677,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
1675
1677
  separator: string;
1676
1678
  dropped: string[];
1677
1679
  }[] | undefined;
1680
+ calibrationWindowsFailed?: number | undefined;
1678
1681
  calibrationClosed?: string[] | undefined;
1679
1682
  nextCall?: string | undefined;
1680
1683
  notFullBecause?: string | undefined;
@@ -1733,6 +1736,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
1733
1736
  separator: string;
1734
1737
  dropped: string[];
1735
1738
  }[] | undefined;
1739
+ calibrationWindowsFailed?: number | undefined;
1736
1740
  calibrationClosed?: string[] | undefined;
1737
1741
  nextCall?: string | undefined;
1738
1742
  notFullBecause?: string | undefined;
@@ -1795,6 +1799,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
1795
1799
  separator: string;
1796
1800
  dropped: string[];
1797
1801
  }[] | undefined;
1802
+ calibrationWindowsFailed?: number | undefined;
1798
1803
  calibrationClosed?: string[] | undefined;
1799
1804
  nextCall?: string | undefined;
1800
1805
  notFullBecause?: string | undefined;
@@ -1853,6 +1858,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
1853
1858
  separator: string;
1854
1859
  dropped: string[];
1855
1860
  }[] | undefined;
1861
+ calibrationWindowsFailed?: number | undefined;
1856
1862
  calibrationClosed?: string[] | undefined;
1857
1863
  nextCall?: string | undefined;
1858
1864
  notFullBecause?: string | undefined;
@@ -1915,6 +1921,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
1915
1921
  separator: string;
1916
1922
  dropped: string[];
1917
1923
  }[] | undefined;
1924
+ calibrationWindowsFailed?: number | undefined;
1918
1925
  calibrationClosed?: string[] | undefined;
1919
1926
  nextCall?: string | undefined;
1920
1927
  notFullBecause?: string | undefined;
@@ -1973,6 +1980,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
1973
1980
  separator: string;
1974
1981
  dropped: string[];
1975
1982
  }[] | undefined;
1983
+ calibrationWindowsFailed?: number | undefined;
1976
1984
  calibrationClosed?: string[] | undefined;
1977
1985
  nextCall?: string | undefined;
1978
1986
  notFullBecause?: string | undefined;
@@ -2035,6 +2043,7 @@ declare function makeRawHandlers(store: SpecStore, opts?: ElicitOpts): {
2035
2043
  separator: string;
2036
2044
  dropped: string[];
2037
2045
  }[] | undefined;
2046
+ calibrationWindowsFailed?: number | undefined;
2038
2047
  calibrationClosed?: string[] | undefined;
2039
2048
  nextCall?: string | undefined;
2040
2049
  notFullBecause?: string | undefined;