@holmes-lab/holmes-kit 0.29.0 → 0.31.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.
Files changed (169) hide show
  1. package/CHANGELOG.md +556 -0
  2. package/README.md +15 -5
  3. package/bin/holmes-hook-antigravity.js +4 -0
  4. package/bin/holmes-kit.js +4 -0
  5. package/bin/holmes-pre-push.js +3 -0
  6. package/bin/holmes-stop-antigravity.js +4 -0
  7. package/dist/.build-id +1 -1
  8. package/dist/holmes/cli/agents-guidance-history.d.ts +1 -1
  9. package/dist/holmes/cli/agents-guidance-history.js +11 -2
  10. package/dist/holmes/cli/agents-guidance.d.ts +1 -0
  11. package/dist/holmes/cli/agents-guidance.js +11 -8
  12. package/dist/holmes/cli/agents.d.ts +41 -0
  13. package/dist/holmes/cli/agents.js +382 -2
  14. package/dist/holmes/cli/attest.d.ts +2 -0
  15. package/dist/holmes/cli/attest.js +66 -15
  16. package/dist/holmes/cli/ci-gate.js +16 -1
  17. package/dist/holmes/cli/claude-switches.d.ts +95 -0
  18. package/dist/holmes/cli/claude-switches.js +967 -0
  19. package/dist/holmes/cli/codex-hooks.d.ts +77 -0
  20. package/dist/holmes/cli/codex-hooks.js +802 -0
  21. package/dist/holmes/cli/codex-oracle.d.ts +194 -0
  22. package/dist/holmes/cli/codex-oracle.js +1245 -0
  23. package/dist/holmes/cli/codex-toml.d.ts +58 -1
  24. package/dist/holmes/cli/codex-toml.js +456 -40
  25. package/dist/holmes/cli/doctor.d.ts +108 -8
  26. package/dist/holmes/cli/doctor.js +1408 -98
  27. package/dist/holmes/cli/index.js +23 -11
  28. package/dist/holmes/cli/init.d.ts +13 -0
  29. package/dist/holmes/cli/init.js +749 -77
  30. package/dist/holmes/cli/interactive-prompt.js +2 -2
  31. package/dist/holmes/cli/mcp-launcher.d.ts +64 -6
  32. package/dist/holmes/cli/mcp-launcher.js +189 -6
  33. package/dist/holmes/cli/mcp-version.js +13 -2
  34. package/dist/holmes/cli/settings-merge.js +8 -2
  35. package/dist/holmes/cli/upgrade.d.ts +13 -0
  36. package/dist/holmes/cli/upgrade.js +116 -23
  37. package/dist/holmes/cli/workspace-scope.d.ts +22 -0
  38. package/dist/holmes/cli/workspace-scope.js +375 -0
  39. package/dist/holmes/cli/worktree-readiness.d.ts +1 -0
  40. package/dist/holmes/cli/worktree-readiness.js +17 -3
  41. package/dist/holmes/cpg/cpg-scanner.d.ts +29 -0
  42. package/dist/holmes/cpg/cpg-scanner.js +403 -3
  43. package/dist/holmes/cpg/cycle-detect.js +2 -1
  44. package/dist/holmes/cpg/forbidden-edges.js +9 -2
  45. package/dist/holmes/cpg/required-calls.js +8 -1
  46. package/dist/holmes/governance/autonomy.d.ts +9 -0
  47. package/dist/holmes/governance/autonomy.js +28 -1
  48. package/dist/holmes/governance/constitution-debt.js +3 -2
  49. package/dist/holmes/governance/constitution.js +15 -3
  50. package/dist/holmes/governance/provenance-chain.js +3 -2
  51. package/dist/holmes/governance/push-gate-runner.js +4 -3
  52. package/dist/holmes/guardrail/dependency-delta.js +4 -3
  53. package/dist/holmes/guardrail/linear-match.d.ts +57 -0
  54. package/dist/holmes/guardrail/linear-match.js +256 -0
  55. package/dist/holmes/guardrail/risk-classifier.d.ts +6 -7
  56. package/dist/holmes/guardrail/risk-classifier.js +931 -44
  57. package/dist/holmes/guardrail/risk-types.d.ts +6 -0
  58. package/dist/holmes/guardrail/scope-judgment.d.ts +4 -24
  59. package/dist/holmes/guardrail/scope-judgment.js +100 -23
  60. package/dist/holmes/guardrail/shell-words.d.ts +42 -0
  61. package/dist/holmes/guardrail/shell-words.js +1720 -0
  62. package/dist/holmes/guardrail/write-target.d.ts +168 -3
  63. package/dist/holmes/guardrail/write-target.js +2379 -87
  64. package/dist/holmes/hooks/adapters/antigravity.d.ts +3 -1
  65. package/dist/holmes/hooks/adapters/antigravity.js +115 -11
  66. package/dist/holmes/hooks/pre-tool-use.d.ts +32 -6
  67. package/dist/holmes/hooks/pre-tool-use.js +923 -87
  68. package/dist/holmes/hooks/rtm-refresh-child.d.ts +22 -1
  69. package/dist/holmes/hooks/rtm-refresh-child.js +102 -18
  70. package/dist/holmes/hooks/rtm-refresh.d.ts +20 -1
  71. package/dist/holmes/hooks/rtm-refresh.js +60 -15
  72. package/dist/holmes/hooks/session-start.d.ts +10 -0
  73. package/dist/holmes/hooks/session-start.js +31 -7
  74. package/dist/holmes/hooks/stop.d.ts +2 -1
  75. package/dist/holmes/hooks/stop.js +197 -91
  76. package/dist/holmes/mcp/approval-adapters.d.ts +22 -0
  77. package/dist/holmes/mcp/approval-adapters.js +21 -0
  78. package/dist/holmes/mcp/approval-commit.d.ts +20 -0
  79. package/dist/holmes/mcp/approval-commit.js +108 -0
  80. package/dist/holmes/mcp/approval-intent.d.ts +44 -0
  81. package/dist/holmes/mcp/approval-intent.js +67 -0
  82. package/dist/holmes/mcp/approval-policy.d.ts +14 -0
  83. package/dist/holmes/mcp/approval-policy.js +18 -0
  84. package/dist/holmes/mcp/elicit-approval.d.ts +2 -0
  85. package/dist/holmes/mcp/elicit-approval.js +8 -3
  86. package/dist/holmes/mcp/handlers/graph-operations.d.ts +17 -1
  87. package/dist/holmes/mcp/handlers/graph-operations.js +15 -6
  88. package/dist/holmes/mcp/handlers/maintenance-analysis.js +11 -5
  89. package/dist/holmes/mcp/handlers/maintenance-evidence.js +3 -2
  90. package/dist/holmes/mcp/handlers/phase-queries.d.ts +22 -7
  91. package/dist/holmes/mcp/handlers/phase-queries.js +81 -2
  92. package/dist/holmes/mcp/handlers/requirement-triage.d.ts +26 -0
  93. package/dist/holmes/mcp/handlers/requirement-triage.js +48 -11
  94. package/dist/holmes/mcp/handlers/review-evidence.d.ts +2 -1
  95. package/dist/holmes/mcp/handlers/review-evidence.js +15 -5
  96. package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +18 -0
  97. package/dist/holmes/mcp/handlers/slice-orchestration.js +122 -16
  98. package/dist/holmes/mcp/handlers/spec-approval.d.ts +35 -2
  99. package/dist/holmes/mcp/handlers/spec-approval.js +175 -57
  100. package/dist/holmes/mcp/handlers/spec-authoring.js +36 -3
  101. package/dist/holmes/mcp/handlers/spec-queries.d.ts +39 -3
  102. package/dist/holmes/mcp/handlers/spec-queries.js +114 -7
  103. package/dist/holmes/mcp/handlers/test-execution.js +9 -3
  104. package/dist/holmes/mcp/handlers.d.ts +126 -8
  105. package/dist/holmes/mcp/handlers.js +109 -18
  106. package/dist/holmes/mcp/harness-attestation.d.ts +20 -0
  107. package/dist/holmes/mcp/harness-attestation.js +179 -0
  108. package/dist/holmes/mcp/maintenance-analyze.js +28 -4
  109. package/dist/holmes/mcp/maintenance-evidence.js +1 -1
  110. package/dist/holmes/mcp/requirement-triage-evidence.d.ts +72 -2
  111. package/dist/holmes/mcp/requirement-triage-evidence.js +227 -1
  112. package/dist/holmes/mcp/server.js +24 -3
  113. package/dist/holmes/mcp/supervisor.js +7 -3
  114. package/dist/holmes/mcp/tool-schemas.d.ts +8 -0
  115. package/dist/holmes/mcp/tool-schemas.js +54 -7
  116. package/dist/holmes/mcp/validate-args.js +12 -0
  117. package/dist/holmes/project/bounded-io.d.ts +102 -0
  118. package/dist/holmes/project/bounded-io.js +212 -0
  119. package/dist/holmes/project/change-source.js +3 -1
  120. package/dist/holmes/project/ci-runs.js +3 -2
  121. package/dist/holmes/project/ignore.d.ts +31 -2
  122. package/dist/holmes/project/ignore.js +409 -50
  123. package/dist/holmes/project/regular-file-guard.d.ts +13 -0
  124. package/dist/holmes/project/regular-file-guard.js +149 -0
  125. package/dist/holmes/project/root.js +12 -3
  126. package/dist/holmes/refresh/freshness-coordinator.d.ts +67 -0
  127. package/dist/holmes/refresh/freshness-coordinator.js +230 -0
  128. package/dist/holmes/reverse/anchor.js +4 -3
  129. package/dist/holmes/reverse/scan.js +6 -2
  130. package/dist/holmes/review/commit-text.js +3 -2
  131. package/dist/holmes/review/condition-hunk-replay.d.ts +12 -0
  132. package/dist/holmes/review/condition-hunk-replay.js +13 -2
  133. package/dist/holmes/review/condition-hunk-resolution.js +59 -8
  134. package/dist/holmes/review/failed-test-names.js +13 -10
  135. package/dist/holmes/review/findings.js +3 -1
  136. package/dist/holmes/review/kills-check.js +6 -1
  137. package/dist/holmes/review/point-in-time-replay.js +5 -4
  138. package/dist/holmes/review/replay-corpus.js +5 -4
  139. package/dist/holmes/review/requirement-triage-human-records.d.ts +59 -0
  140. package/dist/holmes/review/requirement-triage-human-records.js +119 -0
  141. package/dist/holmes/review/run-replay.js +3 -2
  142. package/dist/holmes/review/scope.js +6 -1
  143. package/dist/holmes/review/temporal-prior.js +3 -2
  144. package/dist/holmes/review/test-evidence.js +3 -2
  145. package/dist/holmes/review/test-outcomes.d.ts +28 -0
  146. package/dist/holmes/review/test-outcomes.js +92 -2
  147. package/dist/holmes/review/test-runner.d.ts +6 -0
  148. package/dist/holmes/review/test-runner.js +36 -15
  149. package/dist/holmes/rtm/advisory-outcomes.js +3 -2
  150. package/dist/holmes/rtm/anchor-ids.js +42 -2
  151. package/dist/holmes/rtm/file-anchors.js +4 -1
  152. package/dist/holmes/rtm/ftt-fulfilment.js +8 -3
  153. package/dist/holmes/rtm/git-changes.js +3 -1
  154. package/dist/holmes/rtm/graph-store.js +3 -2
  155. package/dist/holmes/rtm/test-scope.js +9 -4
  156. package/dist/holmes/spec/compat-impact.d.ts +25 -4
  157. package/dist/holmes/spec/compat-impact.js +682 -11
  158. package/dist/holmes/spec/entity-git-snapshot.js +3 -2
  159. package/dist/holmes/spec/entity-integration.js +3 -2
  160. package/dist/holmes/spec/entity-renumber-transaction.d.ts +19 -0
  161. package/dist/holmes/spec/entity-renumber-transaction.js +79 -6
  162. package/dist/holmes/spec/remote-spec-refs.js +3 -2
  163. package/dist/holmes/spec/renumber.js +25 -10
  164. package/dist/holmes/spec/spec-parser.js +9 -3
  165. package/dist/holmes/spec/yaml-scalar.js +2 -2
  166. package/dist/holmes/update/refresh.js +3 -1
  167. package/dist/holmes/update/update-notice.d.ts +6 -0
  168. package/dist/holmes/update/update-notice.js +18 -1
  169. package/package.json +11 -4
@@ -7,6 +7,10 @@ export interface RequirementTriageHandlerContext {
7
7
  cachedScan(root: string, repoRoot?: string): ScannedFile[];
8
8
  assertStoreReachable(tool: string, root: unknown): void;
9
9
  refusal(reason: string): Error;
10
+ requestFreshness?(root: string): {
11
+ status: 'spawned' | 'coalesced' | 'failed';
12
+ generation?: string;
13
+ };
10
14
  }
11
15
  type GraphStatus = 'current' | 'stale' | 'unverified' | 'absent' | 'unreadable' | 'empty';
12
16
  export declare function createRequirementTriageHandlers(context: RequirementTriageHandlerContext): {
@@ -20,6 +24,7 @@ export declare function createRequirementTriageHandlers(context: RequirementTria
20
24
  semantic: {
21
25
  localState?: import("../../semantic/model-cache").LocalModelState | undefined;
22
26
  recovery?: string | undefined;
27
+ suppressed?: true | undefined;
23
28
  tier: "local" | "none" | "cloud";
24
29
  covered: number;
25
30
  total: number;
@@ -55,6 +60,16 @@ export declare function createRequirementTriageHandlers(context: RequirementTria
55
60
  governedDocumentCount: number;
56
61
  scannedSourceCount: number;
57
62
  };
63
+ freshness: import("../../refresh/freshness-coordinator").FreshnessReceipt | {
64
+ state: string;
65
+ };
66
+ refresh: {
67
+ status: "spawned" | "coalesced" | "failed";
68
+ generation?: string;
69
+ } | {
70
+ status: "unavailable" | "not-needed";
71
+ };
72
+ lexicalOnly?: true | undefined;
58
73
  verdict: import("../../review/requirement-triage").RequirementVerdict;
59
74
  candidates: import("../../review/requirement-triage").RequirementTriageCandidate[];
60
75
  reasons: string[];
@@ -71,6 +86,7 @@ export declare function createRequirementTriageHandlers(context: RequirementTria
71
86
  semantic: {
72
87
  localState?: import("../../semantic/model-cache").LocalModelState | undefined;
73
88
  recovery?: string | undefined;
89
+ suppressed?: true | undefined;
74
90
  tier: "local" | "none" | "cloud";
75
91
  covered: number;
76
92
  total: number;
@@ -106,6 +122,16 @@ export declare function createRequirementTriageHandlers(context: RequirementTria
106
122
  governedDocumentCount: number;
107
123
  scannedSourceCount: number;
108
124
  };
125
+ freshness: import("../../refresh/freshness-coordinator").FreshnessReceipt | {
126
+ state: string;
127
+ };
128
+ refresh: {
129
+ status: "spawned" | "coalesced" | "failed";
130
+ generation?: string;
131
+ } | {
132
+ status: "unavailable" | "not-needed";
133
+ };
134
+ lexicalOnly?: true | undefined;
109
135
  verdict: import("../../review/requirement-triage").RequirementVerdict;
110
136
  candidates: import("../../review/requirement-triage").RequirementTriageCandidate[];
111
137
  reasons: string[];
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.createRequirementTriageHandlers = createRequirementTriageHandlers;
37
+ // @implements A-SPEC-729, A-SPEC-723, A-SPEC-719, A-SPEC-734
37
38
  // @implements A-SPEC-713
38
39
  /** Read-only MCP projection of the pure requirement lifecycle triage model. */
39
40
  const node_child_process_1 = require("node:child_process");
@@ -47,6 +48,8 @@ const vector_cache_1 = require("../../semantic/vector-cache");
47
48
  const requirement_triage_evidence_1 = require("../requirement-triage-evidence");
48
49
  const model_cache_1 = require("../../semantic/model-cache");
49
50
  const graph_store_1 = require("../../rtm/graph-store");
51
+ const freshness_coordinator_1 = require("../../refresh/freshness-coordinator");
52
+ const bounded_io_1 = require("../../project/bounded-io");
50
53
  const requirementKinds = new Set(['REQ', 'H-SPEC', 'A-SPEC', 'T-SPEC']);
51
54
  const cosine = (a, b) => {
52
55
  if (a.length === 0 || a.length !== b.length)
@@ -74,7 +77,7 @@ function lineageOf(id, byId) {
74
77
  }
75
78
  function headOf(root) {
76
79
  try {
77
- return (0, node_child_process_1.execFileSync)('git', ['-C', root, 'rev-parse', 'HEAD'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
80
+ return (0, node_child_process_1.execFileSync)('git', ['-C', root, 'rev-parse', 'HEAD'], { timeout: bounded_io_1.GIT_TIMEOUT_MS, maxBuffer: bounded_io_1.GIT_MAX_BUFFER, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
78
81
  }
79
82
  catch {
80
83
  return '';
@@ -116,6 +119,22 @@ function createRequirementTriageHandlers(context) {
116
119
  const scanned = context.cachedScan(root, root);
117
120
  const evidence = (0, test_evidence_1.readTestEvidence)(root);
118
121
  const currentHead = headOf(root);
122
+ const freshness = (0, freshness_coordinator_1.readFreshnessReceipt)(root, { workspaceId: (0, freshness_coordinator_1.workspaceIdFor)(root), head: currentHead || null, now: new Date() });
123
+ // A-SPEC-719: graph current plus a requirement lane that is current or the owner-chosen
124
+ // lexical-only not-adopted/suppressed. The source lane is reported, never required.
125
+ const freshnessCurrent = (0, freshness_coordinator_1.intakeUsable)(freshness);
126
+ // Triage remains read-only with respect to its decision: unavailable or
127
+ // stale evidence still returns ambiguity. The optional bridge merely
128
+ // requests the same detached, lease-coalesced refresh as the Stop hook.
129
+ let refresh;
130
+ if (!freshnessCurrent && context.requestFreshness) {
131
+ try {
132
+ refresh = context.requestFreshness(root);
133
+ }
134
+ catch {
135
+ refresh = { status: 'failed' };
136
+ }
137
+ }
119
138
  const graph = readGraphEvidence(root, currentHead, documents);
120
139
  const fresh = (0, test_evidence_1.isFresh)(evidence, currentHead) && evidence?.passed === true;
121
140
  const lineageEvidence = {};
@@ -135,7 +154,13 @@ function createRequirementTriageHandlers(context) {
135
154
  for (const value of Object.values(lineageEvidence))
136
155
  value.implementationAnchors.sort();
137
156
  const tier = (0, tier_1.resolveSemanticTier)();
138
- const runtime = (0, embedder_1.makeTierEmbedder)(tier, new vector_cache_1.VectorCache(root));
157
+ // A-SPEC-719: the owner's transfer switch is lexical-only for triage too — the prompt is not
158
+ // embedded (a cloud tier would send it out); the state reads as the owner-chosen not-adopted.
159
+ // The switch may live in only one process's env (hooks and MCP servers see different envs), so a
160
+ // receipt the refresh child recorded as suppressed also keeps this run from embedding.
161
+ const suppressed = (typeof process.env.HOLMES_NO_SEMANTIC_WARM === 'string' && process.env.HOLMES_NO_SEMANTIC_WARM !== '')
162
+ || freshness?.requirementSemantic === 'suppressed';
163
+ const runtime = suppressed ? null : (0, embedder_1.makeTierEmbedder)(tier, new vector_cache_1.VectorCache(root));
139
164
  const query = runtime ? await runtime.embedQuery(a.prompt) : null;
140
165
  const semanticCandidates = [];
141
166
  let covered = 0;
@@ -150,18 +175,26 @@ function createRequirementTriageHandlers(context) {
150
175
  semanticCandidates.push({ id: doc.id, score: cosine(query, vector) });
151
176
  }
152
177
  }
153
- const semanticState = runtime === null || query === null
154
- ? (tier.tier === 'none' && !tier.localRuntimePresent ? 'not-adopted' : 'unavailable')
155
- : covered === documents.length ? 'covered' : 'cold';
178
+ const semanticState = suppressed ? 'not-adopted'
179
+ : runtime === null || query === null
180
+ ? (tier.tier === 'none' && !tier.localRuntimePresent ? 'not-adopted' : 'unavailable')
181
+ : covered === documents.length ? 'covered' : 'cold';
156
182
  const readiness = tier.tier === 'none' && tier.localRuntimePresent ? (0, model_cache_1.readLocalModelReadiness)() : null;
157
183
  const availability = semanticState === 'covered' ? 'available'
158
184
  : semanticState === 'cold' || tier.tier === 'none' && tier.localRuntimePresent ? 'degraded'
159
185
  : 'unavailable';
160
186
  const semantic = { tier: tier.tier, covered, total: documents.length, state: semanticState,
161
- availability,
187
+ availability, ...(suppressed ? { suppressed: true } : {}),
162
188
  ...(readiness ? { localState: readiness.state, recovery: readiness.recovery } : {}) };
163
- const result = (0, requirement_triage_1.triageRequirements)({ prompt: a.prompt, documents, evidence: lineageEvidence,
189
+ // lexicalOnly describes THIS run: no semantic score contributed to its ranking.
190
+ const lexical = semanticCandidates.length === 0;
191
+ const ranked = (0, requirement_triage_1.triageRequirements)({ prompt: a.prompt, documents, evidence: lineageEvidence,
164
192
  semanticCandidates, semantic, graph: { state: graph.status }, topK: a.topK });
193
+ const result = freshnessCurrent ? ranked : {
194
+ ...ranked, verdict: 'ambiguous',
195
+ reasons: [...ranked.reasons, `freshness-${freshness?.state ?? 'absent'}`],
196
+ uncertainty: [...ranked.uncertainty, `freshness-${freshness?.state ?? 'absent'}`],
197
+ };
165
198
  const promptDigest = `sha256:${crypto.createHash('sha256').update(a.prompt).digest('hex')}`;
166
199
  const executionState = evidence === undefined ? 'absent'
167
200
  : !(0, test_evidence_1.isFresh)(evidence, currentHead) ? 'stale'
@@ -173,12 +206,16 @@ function createRequirementTriageHandlers(context) {
173
206
  graphProvenance: Object.fromEntries(candidate.documents.map((document) => [document.id, graph.provenanceBySpec[document.id] ?? null])),
174
207
  executionEvidence: { state: executionState, recordedHead: evidence?.head ?? null, currentHead },
175
208
  }));
176
- const answer = { schema: 'requirement-triage/1', ...result, promptDigest, semantic, provenance,
209
+ const answer = { schema: 'requirement-triage/1', ...result, ...(lexical ? { lexicalOnly: true } : {}), promptDigest, semantic, provenance,
177
210
  graph: { status: graph.status, sourceCommit: graph.sourceCommit, graphAsOf: graph.graphAsOf, resolutionLimits: graph.resolutionLimits },
178
- graphBasis: { head: currentHead, governedDocumentCount: documents.length, scannedSourceCount: scanned.length } };
179
- if (!a.persist)
211
+ graphBasis: { head: currentHead, governedDocumentCount: documents.length, scannedSourceCount: scanned.length },
212
+ freshness: freshness === null ? { state: 'absent' } : freshness,
213
+ refresh: refresh ?? { status: freshnessCurrent ? 'not-needed' : 'unavailable' } };
214
+ if (!a.persist || !freshnessCurrent || freshness === null)
180
215
  return answer;
181
- const artifact = (0, requirement_triage_evidence_1.writeRequirementTriageEvidence)(root, { schema: 'requirement-triage-evidence/1', promptDigest, result: answer });
216
+ // @implements A-SPEC-729 — persisted AND issued on the ledger; intake accepts nothing else.
217
+ const artifact = (0, requirement_triage_evidence_1.issueRequirementTriageEvidence)(root, { schema: 'requirement-triage-evidence/2', promptDigest,
218
+ workspaceId: freshness.workspaceId, head: freshness.head, freshnessGeneration: freshness.generation, result: answer });
182
219
  return { ...answer, evidenceDigest: artifact.digest, persistedTo: artifact.path, artifact };
183
220
  },
184
221
  };
@@ -10,8 +10,9 @@ export interface ReviewEvidenceContext {
10
10
  projectRootOf(root: string): string;
11
11
  basisFor(root: string | undefined, withDisk?: boolean): Basis;
12
12
  hasElicitor(): boolean;
13
- tryElicit(kind: string, target: string, summary: string): Promise<ElicitOutcome>;
13
+ tryElicit(kind: string, target: string, summary: string, timeoutBehavior?: 'queue' | 'autonomous-approve'): Promise<ElicitOutcome>;
14
14
  elicitApproval(reason?: string): Approval;
15
+ autonomousApproval(derivedFrom?: string[], source?: 'immediate' | 'timeout'): Approval;
15
16
  resolveHandlerApproval(root: string | undefined, approval: Approval | undefined, action: {
16
17
  kind: string;
17
18
  target: string;
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.createReviewEvidenceHandlers = createReviewEvidenceHandlers;
37
- // @implements A-SPEC-617, A-SPEC-100.2, A-SPEC-102.1, A-SPEC-133, A-SPEC-135, A-SPEC-141, A-SPEC-157, A-SPEC-160, A-SPEC-189, A-SPEC-191, A-SPEC-244, A-SPEC-245, A-SPEC-263.1, A-SPEC-497.1
37
+ // @implements A-SPEC-718, A-SPEC-617, A-SPEC-100.2, A-SPEC-102.1, A-SPEC-133, A-SPEC-135, A-SPEC-141, A-SPEC-157, A-SPEC-160, A-SPEC-189, A-SPEC-191, A-SPEC-244, A-SPEC-245, A-SPEC-263.1, A-SPEC-497.1, A-SPEC-732
38
38
  const path = __importStar(require("node:path"));
39
39
  const findings_1 = require("../../review/findings");
40
40
  const review_targets_1 = require("../../review/review-targets");
@@ -44,6 +44,7 @@ const ledger_store_1 = require("../../governance/ledger-store");
44
44
  const ledger_lock_1 = require("../../governance/ledger-lock");
45
45
  const approval_grants_1 = require("../../governance/approval-grants");
46
46
  const provenance_chain_1 = require("../../governance/provenance-chain");
47
+ const autonomy_1 = require("../../governance/autonomy");
47
48
  function createReviewEvidenceHandlers(context) {
48
49
  return {
49
50
  async review_record(a) {
@@ -104,6 +105,13 @@ function createReviewEvidenceHandlers(context) {
104
105
  const elicitExpiries = new Map();
105
106
  if (context.hasElicitor()) {
106
107
  try {
108
+ // @implements A-SPEC-732 (round 2) — autonomy is read at the project root, never a raw root.
109
+ const autonomyOn = (0, autonomy_1.autonomousApprovalEnabled)(process.env, (() => { try {
110
+ return context.projectRootOf(a.root);
111
+ }
112
+ catch {
113
+ return undefined;
114
+ } })(), new Date().toISOString());
107
115
  const snapshot = new Map();
108
116
  for (const f of new findings_1.FindingsLedger(findingsFile).list())
109
117
  snapshot.set(f.id, f);
@@ -121,11 +129,13 @@ function createReviewEvidenceHandlers(context) {
121
129
  }
122
130
  if (context.resolveHandlerApproval(a.root, env0, { kind: 'review-resolve', target: f.id }, new Date().toISOString()) !== undefined)
123
131
  continue; // an open door never summons a human
124
- const out = await context.tryElicit('review-resolve', f.id, `열린 치명 발견 ${f.id} 의 해소 기록`);
132
+ const out = await context.tryElicit('review-resolve', f.id, `열린 치명 발견 ${f.id} 의 해소 기록`, autonomyOn ? 'autonomous-approve' : 'queue');
125
133
  if (out.kind === 'answered' && out.decision.granted)
126
- elicitGrants.set(f.id, context.elicitApproval(out.decision.reason));
134
+ elicitGrants.set(f.id, { approval: context.elicitApproval(out.decision.reason), source: 'elicitation' });
127
135
  else if (out.kind === 'answered')
128
136
  elicitDenials.set(f.id, out.decision.reason ?? '(사유 없음)');
137
+ else if (out.kind === 'expired' && autonomyOn)
138
+ elicitGrants.set(f.id, { approval: context.autonomousApproval(undefined, 'timeout'), source: 'autonomous' });
129
139
  else if (out.kind === 'expired')
130
140
  elicitExpiries.set(f.id, out.waitedMs);
131
141
  }
@@ -190,8 +200,8 @@ function createReviewEvidenceHandlers(context) {
190
200
  const g = elicitGrants.get(f.id);
191
201
  if (g) {
192
202
  elicitGrants.delete(f.id);
193
- rrResolved = { approval: g, source: 'elicitation' };
194
- elicitationLifts.push({ id: f.id, approval: g });
203
+ rrResolved = { approval: g.approval, source: g.source };
204
+ elicitationLifts.push({ id: f.id, approval: g.approval });
195
205
  }
196
206
  }
197
207
  if (rrResolved === undefined) {
@@ -15,6 +15,16 @@ export interface SliceOrchestrationContext {
15
15
  sliceName: string;
16
16
  }): Promise<unknown>;
17
17
  };
18
+ /**
19
+ * @implements A-SPEC-732 (round 4) — the store and project root a slice acts on. A `root` naming
20
+ * another project is refused; a rootless call uses the BOUND store's project, never the cwd.
21
+ */
22
+ sliceStore(root: string | undefined): {
23
+ store: SpecStore;
24
+ root: string;
25
+ } | {
26
+ refusal: string;
27
+ };
18
28
  }
19
29
  /**
20
30
  * @implements A-SPEC-652.1 — the T-SPEC that belongs to an A-SPEC, by the mirror rule the
@@ -32,12 +42,19 @@ export declare function createSliceOrchestrationHandlers(context: SliceOrchestra
32
42
  title: string;
33
43
  objective: string;
34
44
  filesToTouch: string[];
45
+ triage_evidence?: unknown;
35
46
  }): Promise<{
36
47
  ok: boolean;
37
48
  reason: string;
38
49
  existing: string[];
39
50
  specsCreated: string[];
40
51
  unreadable: string[];
52
+ } | {
53
+ ok: boolean;
54
+ reason: string;
55
+ specsCreated: string[];
56
+ unreadable: string[];
57
+ existing?: undefined;
41
58
  } | {
42
59
  ok: boolean;
43
60
  specsCreated: string[];
@@ -49,6 +66,7 @@ export declare function createSliceOrchestrationHandlers(context: SliceOrchestra
49
66
  root?: string;
50
67
  sliceName: string;
51
68
  }): Promise<{
69
+ approvalIntent?: {} | null | undefined;
52
70
  ok: boolean;
53
71
  approvedSpecs: string[];
54
72
  alreadySealed: string[];
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.tspecFor = tspecFor;
37
37
  exports.createSliceOrchestrationHandlers = createSliceOrchestrationHandlers;
38
- // @implements A-SPEC-609, A-SPEC-100.2, A-SPEC-156, A-SPEC-203, A-SPEC-204, A-SPEC-298, A-SPEC-299, A-SPEC-536.1, A-SPEC-546.1, A-SPEC-565.2, A-SPEC-587.2, A-SPEC-501.1
38
+ // @implements A-SPEC-733, A-SPEC-732, A-SPEC-729, A-SPEC-724, A-SPEC-609, A-SPEC-100.2, A-SPEC-156, A-SPEC-203, A-SPEC-204, A-SPEC-298, A-SPEC-299, A-SPEC-536.1, A-SPEC-546.1, A-SPEC-565.2, A-SPEC-587.2, A-SPEC-501.1
39
39
  const fs = __importStar(require("node:fs"));
40
40
  const path = __importStar(require("node:path"));
41
41
  const spec_store_1 = require("../../spec/spec-store");
@@ -43,6 +43,10 @@ const root_1 = require("../../project/root");
43
43
  const yaml_scalar_1 = require("../../spec/yaml-scalar");
44
44
  const draft_1 = require("../../reverse/draft");
45
45
  const anchor_comment_1 = require("../../rtm/anchor-comment");
46
+ /** The only text `spec_remediate` writes into a file besides the comment syntax (A-SPEC-732 round 5). */
47
+ const REMEDIATE_ASPEC_ID = /^A-SPEC-\d{3,}(?:\.\d+)*$/;
48
+ const requirement_triage_evidence_1 = require("../requirement-triage-evidence");
49
+ const linear_match_1 = require("../../guardrail/linear-match");
46
50
  /**
47
51
  * @implements A-SPEC-652.1 — the T-SPEC that belongs to an A-SPEC, by the mirror rule the
48
52
  * author-slice playbook states (the chain inherits the parent's number, dot included): the
@@ -70,6 +74,8 @@ function tspecFor(aspec, specs) {
70
74
  function createSliceOrchestrationHandlers(context) {
71
75
  return {
72
76
  async spec_slice_init(a) {
77
+ // A-SPEC-651.5 (sealed) scaffolds drafts into the REQUESTED root, which may differ from the bound
78
+ // store; drafts seal nothing, and sealing them goes through spec_slice_approve's bound store.
73
79
  const root = a.root ? (0, root_1.resolveProjectRoot)(a.root).root : process.cwd();
74
80
  const specsDir = path.join(root, '.ax', 'specs');
75
81
  const existing = await context.listSpecs();
@@ -233,14 +239,48 @@ depends_on:
233
239
  if (existingFiles.length > 0) {
234
240
  return { ok: false, reason: `spec_slice_init: ${existingFiles.length} target file(s) already exist — nothing written`, existing: existingFiles, specsCreated: [], unreadable: [] };
235
241
  }
236
- fs.mkdirSync(path.join(specsDir, '01_req'), { recursive: true });
237
- fs.mkdirSync(path.join(specsDir, '02_h-spec', 'functional'), { recursive: true });
238
- fs.mkdirSync(path.join(specsDir, '03_a-spec'), { recursive: true });
239
- fs.mkdirSync(path.join(specsDir, '05_t-spec'), { recursive: true });
240
- fs.writeFileSync(path.join(specsDir, '01_req', `${reqId}.md`), reqContent);
241
- fs.writeFileSync(path.join(specsDir, '02_h-spec', 'functional', `${hspecId}.md`), hspecContent);
242
- fs.writeFileSync(path.join(specsDir, '03_a-spec', `${aspecId}.md`), aspecContent);
243
- fs.writeFileSync(path.join(specsDir, '05_t-spec', `${tspecId}.md`), tspecContent);
242
+ // @implements A-SPEC-724 — this act writes a new REQ, so it crosses the same intake boundary as
243
+ // spec_create(type=REQ): one shared validator, after the deterministic refusals above and
244
+ // before the first byte below.
245
+ const intake = (0, requirement_triage_evidence_1.validateRequirementIntake)(root, a.triage_evidence);
246
+ if (!intake.ok)
247
+ return { ok: false, reason: intake.reason, specsCreated: [], unreadable: [] };
248
+ // @implements A-SPEC-729 — spend the evidence on this REQ atomically, then record it on the REQ.
249
+ const triageDigest = a.triage_evidence.digest;
250
+ const spent = (0, requirement_triage_evidence_1.consumeRequirementTriageEvidence)(root, triageDigest, reqId);
251
+ if (!spent.ok)
252
+ return { ok: false, reason: spent.reason, specsCreated: [], unreadable: [] };
253
+ const reqWithEvidence = reqContent.replace(/^depends_on: \[\]$/m, `depends_on: []\ntriage_evidence: ${triageDigest}`);
254
+ const written = [];
255
+ try {
256
+ const plan = [
257
+ [reqId, path.join(specsDir, '01_req'), reqWithEvidence],
258
+ [hspecId, path.join(specsDir, '02_h-spec', 'functional'), hspecContent],
259
+ [aspecId, path.join(specsDir, '03_a-spec'), aspecContent],
260
+ [tspecId, path.join(specsDir, '05_t-spec'), tspecContent],
261
+ ];
262
+ for (const [id, dir, content] of plan) {
263
+ fs.mkdirSync(dir, { recursive: true });
264
+ // @implements A-SPEC-729 (round 4) — exclusive create: a file a concurrent call created after
265
+ // the existence check above is never overwritten (measured: 16/16 races lost one slice).
266
+ try {
267
+ fs.writeFileSync(path.join(dir, `${id}.md`), content, { flag: 'wx' });
268
+ }
269
+ catch (e) {
270
+ if (e.code === 'EEXIST')
271
+ throw new Error(`${id}.md was created by another call meanwhile and was left untouched`);
272
+ throw e;
273
+ }
274
+ written.push(id);
275
+ }
276
+ }
277
+ catch (e) {
278
+ // @implements A-SPEC-729 — the evidence is already spent; the files written so far stay
279
+ // (A-SPEC-299) and are NAMED, so a half-slice is never left behind silently.
280
+ return { ok: false, reason: `spec_slice_init: writing the chain failed (${e instanceof Error ? e.message : String(e)})`
281
+ + `${written.length > 0 ? ` after writing ${written.join(', ')}, which remain on disk` : ''}. 이 triage evidence는 이미 소비되었습니다 — requirement_triage(persist:true)를 다시 실행해 새 증거를 받으십시오.`,
282
+ specsCreated: written, unreadable: [] };
283
+ }
244
284
  // @implements A-SPEC-299
245
285
  // Read back what was just written. S-298 fixed one cause of unparseable frontmatter; this
246
286
  // closes the class. `list()` silently skips documents it cannot parse, so "created" and
@@ -253,8 +293,14 @@ depends_on:
253
293
  return { ok: unreadable.length === 0, specsCreated, unreadable };
254
294
  },
255
295
  async spec_slice_approve(a) {
256
- const root = a.root ? (0, root_1.resolveProjectRoot)(a.root).root : process.cwd();
257
- const rawStore = new spec_store_1.LocalMarkdownRepository(path.join(root, '.ax', 'specs'));
296
+ // @implements A-SPEC-732 (round 5) — an empty name matched every spec in the store.
297
+ if (typeof a.sliceName !== 'string' || a.sliceName.trim() === '') {
298
+ return { ok: false, approvedSpecs: [], alreadySealed: [], refused: [{ id: String(a.sliceName ?? ''), reason: 'sliceName is empty — name a slice or a spec id' }] };
299
+ }
300
+ const bound = context.sliceStore(a.root);
301
+ if ('refusal' in bound)
302
+ return { ok: false, approvedSpecs: [], alreadySealed: [], refused: [{ id: a.sliceName, reason: bound.refusal }] };
303
+ const { root, store: rawStore } = bound;
258
304
  const specs = await rawStore.list();
259
305
  const inSlice = specs.filter((s) => {
260
306
  if (s.frontmatter?.slice === a.sliceName)
@@ -288,10 +334,17 @@ depends_on:
288
334
  const matches = specs.filter((s) => s.id.includes(a.sliceName));
289
335
  idsToApprove.push(...matches.map((s) => s.id));
290
336
  }
337
+ // @implements A-SPEC-732 (round 3) — a slice named by a REQ id listed it twice (the slice spec
338
+ // and its own REQ): a form client was asked twice and the spec sealed twice.
339
+ const unique = [...new Set(idsToApprove)];
340
+ idsToApprove.splice(0, idsToApprove.length, ...unique);
291
341
  const rawHandlers = context.rawHandlersForStore(rawStore);
292
342
  const approvedSpecs = [];
293
343
  const alreadySealed = [];
294
344
  const refused = [];
345
+ // @implements A-SPEC-732 (round 3) — the host-gated continuation the inner spec_approve offered;
346
+ // dropping it left the caller nothing to commit.
347
+ let approvalIntent;
295
348
  if (idsToApprove.length === 0) {
296
349
  // Reporting this as a success is how a caller ends up believing an unapproved slice was
297
350
  // approved. Measured 2026-08-28: a broken-frontmatter REQ made the whole slice invisible
@@ -311,13 +364,17 @@ depends_on:
311
364
  continue;
312
365
  }
313
366
  const res = (await rawHandlers.spec_approve({ root, id }));
314
- if (res.approved || res.ok) {
367
+ // @implements A-SPEC-732 (round 4) — only the result's OWN string `approved` means sealed: an
368
+ // inherited `approved` (a polluted prototype) reported a draft as sealed.
369
+ if (Object.prototype.hasOwnProperty.call(res, 'approved') && typeof res.approved === 'string') {
315
370
  approvedSpecs.push(id);
316
371
  continue;
317
372
  }
318
373
  const findings = Array.isArray(res.findings)
319
374
  ? res.findings.map((f) => f.message).filter(Boolean).join('; ')
320
375
  : '';
376
+ if (res.approvalIntent !== undefined)
377
+ approvalIntent = res.approvalIntent;
321
378
  refused.push({ id, reason: findings ? `${res.reason ?? 'refused'}: ${findings}` : (res.reason ?? 'refused') });
322
379
  // The chain is topological: approving a child whose parent was refused would either fail
323
380
  // again or, worse, succeed against an unsealed parent. Stop and say what is left.
@@ -331,14 +388,64 @@ depends_on:
331
388
  refused.push({ id: missingTspec, reason: `no T-SPEC mirrors ${aspecId} or depends on it — write ${missingTspec} first` });
332
389
  }
333
390
  // `ok` means the slice is approved — freshly or already. Anything less is not a success.
334
- return { ok: refused.length === 0 && approvedSpecs.length + alreadySealed.length > 0, approvedSpecs, alreadySealed, refused };
391
+ return { ok: refused.length === 0 && approvedSpecs.length + alreadySealed.length > 0, approvedSpecs, alreadySealed, refused,
392
+ ...(approvalIntent !== undefined ? { approvalIntent } : {}) };
335
393
  },
336
394
  async spec_remediate(a) {
337
- const root = a.root ? (0, root_1.resolveProjectRoot)(a.root).root : process.cwd();
395
+ const bound = context.sliceStore(a.root);
396
+ if ('refusal' in bound)
397
+ return { ok: false, actionsTaken: [], refused: [{ id: a.aspecId ?? 'slice', reason: bound.refusal }] };
398
+ const { root, store: rawStore } = bound;
338
399
  const actionsTaken = [];
400
+ // @implements A-SPEC-732 (round 5) — the id is written into the file: a newline in it injected
401
+ // code and YAML keys into any in-project file (measured). Only a spec id is ever written.
402
+ if (a.aspecId !== undefined && !REMEDIATE_ASPEC_ID.test(a.aspecId)) {
403
+ return { ok: false, actionsTaken, refused: [{ id: String(a.aspecId).slice(0, 80), reason: 'aspecId must be an A-SPEC id (A-SPEC-<digits>[.<digits>]); nothing was written' }] };
404
+ }
339
405
  if (a.targetFile && a.aspecId) {
340
406
  const fullPath = path.isAbsolute(a.targetFile) ? a.targetFile : path.join(root, a.targetFile);
341
- if (fs.existsSync(fullPath)) {
407
+ // @implements A-SPEC-732 (round 4) — an anchor is written only inside the bound project.
408
+ const real = (p) => { try {
409
+ return fs.realpathSync(p);
410
+ }
411
+ catch {
412
+ return path.resolve(p);
413
+ } };
414
+ const rel = path.relative(real(root), path.join(real(path.dirname(path.resolve(fullPath))), path.basename(fullPath)));
415
+ const inside = rel !== '' && !rel.startsWith('..') && !path.isAbsolute(rel);
416
+ // Confirmation round (measured): a FILE symlink passed the directory-level check and the write
417
+ // followed it out of the project — or, named `.ts`, prepended `//` to the ledger. A link is
418
+ // never written through.
419
+ const isLink = (() => { try {
420
+ return fs.lstatSync(fullPath).isSymbolicLink();
421
+ }
422
+ catch {
423
+ return false;
424
+ } })();
425
+ // Round 5 (measured): a hard link carried the anchor out of the project and into a ledger, and
426
+ // `.ax/` is governance state no anchor belongs in.
427
+ const hardLinked = (() => { try {
428
+ return fs.lstatSync(fullPath).nlink > 1;
429
+ }
430
+ catch {
431
+ return false;
432
+ } })();
433
+ // Round 6: folded — `.AX/…` reached `.ax/` on a case-insensitive disk (measured); Windows also
434
+ // drops trailing dots and spaces from a segment.
435
+ const governed = (0, linear_match_1.trimTrailing)(rel.split(/[\\/]/)[0].toLowerCase(), '. ') === '.ax';
436
+ if (!inside) {
437
+ actionsTaken.push(`앵커 주입 거부: ${a.targetFile} 은(는) 이 프로젝트(${root}) 밖입니다`);
438
+ }
439
+ else if (governed) {
440
+ actionsTaken.push(`앵커 주입 거부: ${a.targetFile} 은(는) .ax/ 거버넌스 상태입니다 — 앵커는 소스 파일에만 씁니다`);
441
+ }
442
+ else if (hardLinked) {
443
+ actionsTaken.push(`앵커 주입 거부: ${a.targetFile} 은(는) 하드 링크가 둘 이상입니다 — 다른 경로의 같은 파일에 쓰게 됩니다`);
444
+ }
445
+ else if (isLink) {
446
+ actionsTaken.push(`앵커 주입 거부: ${a.targetFile} 은(는) 심볼릭 링크입니다 — 실제 파일에 직접 1행 앵커를 추가하십시오`);
447
+ }
448
+ else if (fs.existsSync(fullPath)) {
342
449
  // @implements A-SPEC-501.1 — BUG-4 (dogfooded twice): the old unconditional
343
450
  // `// @implements` broke Python/YAML targets outright AND produced anchors the scanner
344
451
  // could not read. The syntax comes from the one map the scanner is aligned with, an
@@ -355,7 +462,6 @@ depends_on:
355
462
  }
356
463
  }
357
464
  }
358
- const rawStore = new spec_store_1.LocalMarkdownRepository(path.join(root, '.ax', 'specs'));
359
465
  const rawHandlers = context.rawHandlersForStore(rawStore);
360
466
  const approveRes = await rawHandlers.spec_slice_approve({ root, sliceName: a.aspecId ?? 'slice' });
361
467
  if (approveRes.approvedSpecs?.length > 0) {
@@ -3,14 +3,30 @@ import { Spec } from '../../spec/spec-parser';
3
3
  import { ScannedFile } from '../../cpg/cpg-scanner';
4
4
  import { Approval } from '../../guardrail/risk-gate';
5
5
  import { ElicitOutcome } from '../elicit-approval';
6
+ import { ApprovalIntent } from '../approval-intent';
7
+ import { ApprovalAdapter } from '../approval-adapters';
6
8
  export interface SpecApprovalContext {
7
9
  store: SpecStore;
8
10
  resolver(specs: Spec[]): (id: string) => Spec | null;
9
11
  projectRootOf(root: string): string;
10
12
  cachedScan(root: string, repoRoot?: string): ScannedFile[];
11
- tryElicit(kind: string, target: string, summary: string): Promise<ElicitOutcome>;
13
+ tryElicit(kind: string, target: string, summary: string, timeoutBehavior?: 'queue' | 'autonomous-approve'): Promise<ElicitOutcome>;
12
14
  elicitApproval(reason?: string): Approval;
13
- autonomousApproval(derivedFrom?: string[]): Approval;
15
+ autonomousApproval(derivedFrom?: string[], source?: 'immediate' | 'timeout'): Approval;
16
+ approvalAdapter(): ApprovalAdapter;
17
+ approvalHarness(): string;
18
+ prepareHostApproval(input: {
19
+ kind: string;
20
+ target: string;
21
+ subject: string;
22
+ root?: string;
23
+ }): ApprovalIntent;
24
+ consumeHostApproval(input: {
25
+ kind: string;
26
+ target: string;
27
+ subject: string;
28
+ root?: string;
29
+ }): Approval | undefined;
14
30
  resolveHandlerApproval(root: string | undefined, approval: Approval | undefined, action: {
15
31
  kind: string;
16
32
  target: string;
@@ -28,6 +44,8 @@ export interface SpecApprovalContext {
28
44
  risk?: string;
29
45
  }): string;
30
46
  foreignRootReason(root?: string): string | null;
47
+ /** @implements A-SPEC-732 — why no in-session route was offered (unattested server), or ''. */
48
+ approvalRouteNote?(): string;
31
49
  }
32
50
  export declare function createSpecApprovalHandlers(context: SpecApprovalContext): {
33
51
  /**
@@ -52,11 +70,18 @@ export declare function createSpecApprovalHandlers(context: SpecApprovalContext)
52
70
  } | {
53
71
  ok: boolean;
54
72
  reason: string;
73
+ approvalIntent?: undefined;
74
+ conflict?: undefined;
75
+ } | {
76
+ ok: boolean;
77
+ reason: string;
78
+ approvalIntent: ApprovalIntent;
55
79
  conflict?: undefined;
56
80
  } | {
57
81
  ok: boolean;
58
82
  reason: string;
59
83
  conflict: import("../../spec/version-conflict").ConflictDetail;
84
+ approvalIntent?: undefined;
60
85
  } | {
61
86
  dismissUnknown?: string[] | undefined;
62
87
  advisoryHistory?: import("../../rtm/advisory-outcomes").AdvisoryState[] | undefined;
@@ -76,6 +101,7 @@ export declare function createSpecApprovalHandlers(context: SpecApprovalContext)
76
101
  digest: string;
77
102
  ok?: undefined;
78
103
  reason?: undefined;
104
+ approvalIntent?: undefined;
79
105
  conflict?: undefined;
80
106
  }>;
81
107
  /**
@@ -109,3 +135,10 @@ export declare function createSpecApprovalHandlers(context: SpecApprovalContext)
109
135
  reason?: undefined;
110
136
  }>;
111
137
  };
138
+ /**
139
+ * @implements A-SPEC-733 (round 3) — the approval act reads a Files-to-Touch path only when it is a
140
+ * regular file inside the project, at most 2 MB. Measured: a FIFO named there blocked approval, and a
141
+ * `../` path read a file outside the project. The descriptor is opened non-blocking and judged by
142
+ * fstat, so a path swapped between check and read is judged as what was opened.
143
+ */
144
+ export declare function readProjectFile(root: string, rel: string): string | null;