@tiphys/kernel 0.0.0 → 0.2.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 (207) hide show
  1. package/AGENTS.md +663 -0
  2. package/LICENSE +202 -0
  3. package/assurance-modes.yaml +299 -0
  4. package/checklists/clean-room.yaml +325 -0
  5. package/checklists/env-failure-diagnosis.yaml +68 -0
  6. package/checklists/flake-playbook.yaml +68 -0
  7. package/checklists/hazard-review.yaml +144 -0
  8. package/checklists/plan-review.yaml +103 -0
  9. package/dist/bin/tiphys.d.ts +2 -0
  10. package/dist/bin/tiphys.js +92 -0
  11. package/dist/src/adapters/load.d.ts +202 -0
  12. package/dist/src/adapters/load.js +440 -0
  13. package/dist/src/brief.d.ts +32 -0
  14. package/dist/src/brief.js +66 -0
  15. package/dist/src/checklists.d.ts +169 -0
  16. package/dist/src/checklists.js +310 -0
  17. package/dist/src/checks.d.ts +1539 -0
  18. package/dist/src/checks.js +5025 -0
  19. package/dist/src/cli.d.ts +9 -0
  20. package/dist/src/cli.js +68 -0
  21. package/dist/src/commands/brief.d.ts +92 -0
  22. package/dist/src/commands/brief.js +343 -0
  23. package/dist/src/commands/checklist.d.ts +42 -0
  24. package/dist/src/commands/checklist.js +168 -0
  25. package/dist/src/commands/cutover.d.ts +35 -0
  26. package/dist/src/commands/cutover.js +448 -0
  27. package/dist/src/commands/doctor.d.ts +264 -0
  28. package/dist/src/commands/doctor.js +1546 -0
  29. package/dist/src/commands/gates.d.ts +9 -0
  30. package/dist/src/commands/gates.js +360 -0
  31. package/dist/src/commands/init.d.ts +30 -0
  32. package/dist/src/commands/init.js +177 -0
  33. package/dist/src/commands/lock.d.ts +34 -0
  34. package/dist/src/commands/lock.js +340 -0
  35. package/dist/src/commands/mode.d.ts +40 -0
  36. package/dist/src/commands/mode.js +134 -0
  37. package/dist/src/commands/next.d.ts +130 -0
  38. package/dist/src/commands/next.js +597 -0
  39. package/dist/src/commands/plan.d.ts +20 -0
  40. package/dist/src/commands/plan.js +105 -0
  41. package/dist/src/commands/pool.d.ts +1 -0
  42. package/dist/src/commands/pool.js +139 -0
  43. package/dist/src/commands/resume.d.ts +1 -0
  44. package/dist/src/commands/resume.js +88 -0
  45. package/dist/src/commands/spawn.d.ts +1 -0
  46. package/dist/src/commands/spawn.js +195 -0
  47. package/dist/src/commands/status.d.ts +21 -0
  48. package/dist/src/commands/status.js +122 -0
  49. package/dist/src/commands/sync.d.ts +47 -0
  50. package/dist/src/commands/sync.js +341 -0
  51. package/dist/src/commands/teardown.d.ts +1 -0
  52. package/dist/src/commands/teardown.js +87 -0
  53. package/dist/src/commands/tuition.d.ts +21 -0
  54. package/dist/src/commands/tuition.js +218 -0
  55. package/dist/src/commands/validate.d.ts +78 -0
  56. package/dist/src/commands/validate.js +430 -0
  57. package/dist/src/commands/watch.d.ts +1 -0
  58. package/dist/src/commands/watch.js +172 -0
  59. package/dist/src/cutover.d.ts +584 -0
  60. package/dist/src/cutover.js +1444 -0
  61. package/dist/src/exclusion.d.ts +389 -0
  62. package/dist/src/exclusion.js +843 -0
  63. package/dist/src/exec/env.d.ts +278 -0
  64. package/dist/src/exec/env.js +334 -0
  65. package/dist/src/fleet.d.ts +223 -0
  66. package/dist/src/fleet.js +298 -0
  67. package/dist/src/gates/adapters/http-json.d.ts +5 -0
  68. package/dist/src/gates/adapters/http-json.js +283 -0
  69. package/dist/src/gates/adapters/migrations-command.d.ts +1 -0
  70. package/dist/src/gates/adapters/migrations-command.js +373 -0
  71. package/dist/src/gates/citations.d.ts +408 -0
  72. package/dist/src/gates/citations.js +1169 -0
  73. package/dist/src/gates/coverage.d.ts +375 -0
  74. package/dist/src/gates/coverage.js +836 -0
  75. package/dist/src/gates/credentials.d.ts +233 -0
  76. package/dist/src/gates/credentials.js +752 -0
  77. package/dist/src/gates/deploy.d.ts +1 -0
  78. package/dist/src/gates/deploy.js +33 -0
  79. package/dist/src/gates/gate-classes.d.ts +56 -0
  80. package/dist/src/gates/gate-classes.js +633 -0
  81. package/dist/src/gates/manifest.d.ts +99 -0
  82. package/dist/src/gates/manifest.js +208 -0
  83. package/dist/src/gates/merge-preconditions.d.ts +319 -0
  84. package/dist/src/gates/merge-preconditions.js +932 -0
  85. package/dist/src/gates/migrations.d.ts +1 -0
  86. package/dist/src/gates/migrations.js +36 -0
  87. package/dist/src/gates/pin.d.ts +114 -0
  88. package/dist/src/gates/pin.js +154 -0
  89. package/dist/src/gates/red-witness.d.ts +22 -0
  90. package/dist/src/gates/red-witness.js +482 -0
  91. package/dist/src/gates/release.d.ts +283 -0
  92. package/dist/src/gates/release.js +820 -0
  93. package/dist/src/gates/result.d.ts +116 -0
  94. package/dist/src/gates/result.js +91 -0
  95. package/dist/src/gates/run.d.ts +614 -0
  96. package/dist/src/gates/run.js +1614 -0
  97. package/dist/src/gates/schemas/citation-config.schema.json +59 -0
  98. package/dist/src/gates/schemas/coverage-config.schema.json +77 -0
  99. package/dist/src/gates/schemas/gate-manifest.schema.json +125 -0
  100. package/dist/src/gates/schemas/gate-result.schema.json +160 -0
  101. package/dist/src/gates/schemas/phase-declaration.schema.json +87 -0
  102. package/dist/src/gates/schemas/release-record.schema.json +119 -0
  103. package/dist/src/gates/schemas/verifier-config.schema.json +101 -0
  104. package/dist/src/gates/schemas/witness-spec.schema.json +110 -0
  105. package/dist/src/gates/scope.d.ts +131 -0
  106. package/dist/src/gates/scope.js +1018 -0
  107. package/dist/src/gates/suite.d.ts +217 -0
  108. package/dist/src/gates/suite.js +968 -0
  109. package/dist/src/gates/validate.d.ts +121 -0
  110. package/dist/src/gates/validate.js +414 -0
  111. package/dist/src/hooks.d.ts +84 -0
  112. package/dist/src/hooks.js +125 -0
  113. package/dist/src/index.d.ts +31 -0
  114. package/dist/src/index.js +30 -0
  115. package/dist/src/liveness.d.ts +321 -0
  116. package/dist/src/liveness.js +396 -0
  117. package/dist/src/lock.d.ts +256 -0
  118. package/dist/src/lock.js +792 -0
  119. package/dist/src/model-resolution.d.ts +159 -0
  120. package/dist/src/model-resolution.js +307 -0
  121. package/dist/src/modes.d.ts +149 -0
  122. package/dist/src/modes.js +258 -0
  123. package/dist/src/path-identity.d.ts +34 -0
  124. package/dist/src/path-identity.js +48 -0
  125. package/dist/src/plan.d.ts +73 -0
  126. package/dist/src/plan.js +153 -0
  127. package/dist/src/pool.d.ts +326 -0
  128. package/dist/src/pool.js +988 -0
  129. package/dist/src/roles.d.ts +461 -0
  130. package/dist/src/roles.js +776 -0
  131. package/dist/src/spawn.d.ts +482 -0
  132. package/dist/src/spawn.js +1003 -0
  133. package/dist/src/status.d.ts +116 -0
  134. package/dist/src/status.js +148 -0
  135. package/dist/src/task.d.ts +504 -0
  136. package/dist/src/task.js +307 -0
  137. package/dist/src/teardown.d.ts +39 -0
  138. package/dist/src/teardown.js +422 -0
  139. package/dist/src/tuition.d.ts +159 -0
  140. package/dist/src/tuition.js +311 -0
  141. package/dist/src/validate.d.ts +263 -0
  142. package/dist/src/validate.js +742 -0
  143. package/dist/src/version.d.ts +3 -0
  144. package/dist/src/version.js +38 -0
  145. package/dist/src/watcher.d.ts +275 -0
  146. package/dist/src/watcher.js +849 -0
  147. package/dist/src/witness/run.d.ts +299 -0
  148. package/dist/src/witness/run.js +1373 -0
  149. package/dist/src/witness/spec.d.ts +270 -0
  150. package/dist/src/witness/spec.js +475 -0
  151. package/dist/tsconfig.src.tsbuildinfo +1 -0
  152. package/gate-registry.yaml +526 -0
  153. package/gates.manifest.json +257 -0
  154. package/package.json +72 -3
  155. package/role-model-config.yaml +88 -0
  156. package/roles/README.md +128 -0
  157. package/roles/_shared-dispatch-contract.md +87 -0
  158. package/roles/adversarial-plan-reviewer.md +80 -0
  159. package/roles/clean-room-reviewer.md +140 -0
  160. package/roles/implementer.md +463 -0
  161. package/roles/investigator.md +138 -0
  162. package/roles/plan-writer.md +95 -0
  163. package/schemas/README.md +82 -0
  164. package/schemas/assurance-modes.schema.json +264 -0
  165. package/schemas/charter.schema.json +185 -0
  166. package/schemas/checklist.schema.json +114 -0
  167. package/schemas/cutover-state.schema.json +64 -0
  168. package/schemas/decision-record.schema.json +88 -0
  169. package/schemas/executor-record.schema.json +36 -0
  170. package/schemas/final-report.schema.json +90 -0
  171. package/schemas/finding.schema.json +106 -0
  172. package/schemas/gate-registry.schema.json +260 -0
  173. package/schemas/mechanism-index.schema.json +94 -0
  174. package/schemas/model-resolution.schema.json +362 -0
  175. package/schemas/plan.schema.json +300 -0
  176. package/schemas/report.schema.json +579 -0
  177. package/schemas/role-brief.schema.json +105 -0
  178. package/schemas/role-model-config.schema.json +90 -0
  179. package/schemas/status-line.schema.json +40 -0
  180. package/schemas/tuition.schema.json +191 -0
  181. package/schemas/verdict.schema.json +295 -0
  182. package/schemas/work-history.schema.json +183 -0
  183. package/schemas/write-bypass.schema.json +69 -0
  184. package/templates/charter.example.yaml +54 -0
  185. package/templates/decision-record.example.yaml +27 -0
  186. package/templates/final-report.example.yaml +80 -0
  187. package/templates/plan.example.yaml +87 -0
  188. package/templates/report.example.yaml +236 -0
  189. package/templates/warnings.md +74 -0
  190. package/templates/work-history.example.yaml +185 -0
  191. package/tuition/README.md +76 -0
  192. package/tuition/T-001.yaml +48 -0
  193. package/tuition/T-002.yaml +51 -0
  194. package/tuition/T-003.yaml +100 -0
  195. package/tuition/T-004.yaml +52 -0
  196. package/tuition/T-005.yaml +72 -0
  197. package/tuition/T-006.yaml +81 -0
  198. package/tuition/T-007.yaml +56 -0
  199. package/tuition/T-008.yaml +111 -0
  200. package/tuition/T-009.yaml +50 -0
  201. package/tuition/T-015.yaml +36 -0
  202. package/tuition/T-016.yaml +36 -0
  203. package/tuition/T-017.yaml +46 -0
  204. package/tuition/T-018.yaml +84 -0
  205. package/tuition/T-021.yaml +40 -0
  206. package/tuition/T-022.yaml +36 -0
  207. package/tuition/mechanism-index.yaml +256 -0
@@ -0,0 +1,299 @@
1
+ import type { Pin } from "../gates/pin.ts";
2
+ import type { DangerousStateMember, WitnessSpec } from "./spec.ts";
3
+ /**
4
+ * THE RED-WITNESS HARNESS (kernel plan M2, M2-P2 step 3, step 4, step 5).
5
+ *
6
+ * A test guards a behavior only when it has been demonstrated RED against a
7
+ * dangerous state that intersects the phase diff and GREEN at head, in a
8
+ * pinned isolated run. This module evaluates one witness spec: refusal
9
+ * rules (a) to (g) first, each producing `red` with a reason naming its
10
+ * source, then per-member execution in a scratch clone the harness owns.
11
+ *
12
+ * ISOLATION (M2-C-4). Every member is evaluated in its own scratch clone
13
+ * under a directory this run created with mkdtemp. The caller's repository
14
+ * is only ever READ (git read commands and file reads through the delivered
15
+ * probes); after any run its HEAD and working tree are untouched.
16
+ *
17
+ * PINS (M2-C-5, and work-history decision D-P2-1). The delivered pin is
18
+ * five fields including ctimeMs, which userspace cannot restore, so pins
19
+ * bracket EACH TEST EXECUTION rather than the mutate-restore cycle: the red
20
+ * runs are bracketed by a pin pair over the dangerous tree they actually
21
+ * execute, and the green head run by a pair over the head tree. A
22
+ * difference inside either pair is `error` naming the path and the fields.
23
+ *
24
+ * REPORTER PIN (MECHANISMS.md, "Parsing another program's reporter
25
+ * output"). The child is always invoked with an explicit
26
+ * `--test-reporter tap`; a stream that does not open with `TAP version` is
27
+ * an error naming the expected and observed formats, never a widened parse.
28
+ *
29
+ * C-2 and C-3: children run in the foreground via spawnSync with a
30
+ * timeout; nothing here probes a process, detaches, or touches /proc.
31
+ */
32
+ export interface WitnessHooks {
33
+ /**
34
+ * DOCUMENTED IN-HARNESS TEST HOOK (M2-P2 criterion 7, M2R-009). Called
35
+ * once per member, between the green run's start and end pins, with the
36
+ * clone's absolute path. Exists so a pin witness can rewrite a file
37
+ * byte-identically inside the pinned window and prove the five-field pin
38
+ * catches it. Never set outside tests.
39
+ */
40
+ betweenPins?: (cloneDir: string) => void;
41
+ }
42
+ export interface DiffFile {
43
+ path: string;
44
+ /** git name-status letter (A, M, D, R...). */
45
+ status: string;
46
+ /** New-side [start, end] line ranges of changed hunks, 1-based inclusive. */
47
+ hunks: Array<[number, number]>;
48
+ }
49
+ export interface PhaseDiff {
50
+ baseSha: string;
51
+ headSha: string;
52
+ /**
53
+ * The merge base of base and head, which is the revision the `base...head`
54
+ * three-dot diff below is actually taken against. Anything asking "what did
55
+ * this phase change" must read the old side HERE and not at `baseSha`: on a
56
+ * branch that has fallen behind, `baseSha` carries commits the branch never
57
+ * saw, and reading them as the branch's own starting point reproduces the
58
+ * two-dot misreading of standing warning 13.
59
+ *
60
+ * It falls back to `baseSha` when git computes no merge base, and THAT
61
+ * FALLBACK IS UNREACHABLE THROUGH THIS FUNCTION, which is said here rather
62
+ * than left for a reader to assume it is a tested path. Measured 2026-08-15
63
+ * on two orphan roots in one repository: `git merge-base A B` exits 1 with no
64
+ * output, and `git diff --name-status --no-renames A...B` exits 128 with
65
+ * `fatal: <A>...<B>: no merge base`. The diff below is the same three-dot
66
+ * form, so `computePhaseDiff` returns `ok: false` on the diff and never
67
+ * reaches the assignment. The fallback stays because the alternative is
68
+ * `"".trim()` silently becoming a sha-shaped empty string, which is a worse
69
+ * failure than an unreachable line.
70
+ */
71
+ mergeBaseSha: string;
72
+ files: Map<string, DiffFile>;
73
+ }
74
+ export interface EvaluationInputs {
75
+ repoRoot: string;
76
+ headSha: string;
77
+ /**
78
+ * The ref or sha resolved per clone against the FETCHED remote (M2-P2
79
+ * step 7: merge-time re-verification is the `--baseline` parameter).
80
+ */
81
+ baselineRef: string;
82
+ diff: PhaseDiff;
83
+ destructiveCommands: string[];
84
+ behaviors: Set<string>;
85
+ /** Repo-relative test file path -> source at the audited head. */
86
+ testFiles: Map<string, string>;
87
+ /** Changed files the spawn grep matched (rule (f) derivation). */
88
+ spawningChangedFiles: string[];
89
+ scratchRoot: string;
90
+ /**
91
+ * Indices into `spec.dangerousStates` that THIS PHASE AUTHORED, which is
92
+ * the exact scope of rule (d). Empty for a stored witness the phase did not
93
+ * touch, and empty is the whole of "rule (d) does not apply here".
94
+ *
95
+ * This replaced a file-granular `phaseOwn: boolean`. The boolean was decided
96
+ * by the spec FILE appearing in the diff and then gated a PER MEMBER
97
+ * obligation, so any edit to any member imposed rule (d) on every sibling
98
+ * member of the same file. See `phaseOwnedMemberIndices` in ../witness/spec.ts
99
+ * for the derivation and for why an unreadable baseline owns everything.
100
+ */
101
+ phaseOwnedMembers: ReadonlySet<number>;
102
+ hooks?: WitnessHooks;
103
+ }
104
+ export interface MemberRun {
105
+ exitCode: number;
106
+ red: boolean;
107
+ failedNamedTests: string[];
108
+ passedNamedTests: string[];
109
+ missingNamedTests: string[];
110
+ }
111
+ export interface PinPairRecord {
112
+ start: Pin;
113
+ end: Pin;
114
+ equal: boolean;
115
+ }
116
+ export interface MemberRecord {
117
+ index: number;
118
+ member: DangerousStateMember;
119
+ description: string;
120
+ baselineSha?: string;
121
+ /** The applied dangerous-state diff, verbatim (git diff output). */
122
+ appliedDiff?: string;
123
+ mutatedLines?: {
124
+ file: string;
125
+ lines: number[];
126
+ };
127
+ preservesAssertedText?: boolean;
128
+ rate?: {
129
+ red: number;
130
+ total: number;
131
+ };
132
+ runs: MemberRun[];
133
+ redPins?: PinPairRecord;
134
+ greenPins?: PinPairRecord;
135
+ headGreen?: boolean;
136
+ unreachedArm?: {
137
+ file: string;
138
+ lines: number[];
139
+ greenTests: string[];
140
+ };
141
+ problem?: string;
142
+ }
143
+ export type WitnessStatus = "green" | "red" | "error";
144
+ export interface WitnessEvaluation {
145
+ witness: string;
146
+ specPath: string;
147
+ behavior: string;
148
+ status: WitnessStatus;
149
+ reasons: string[];
150
+ textAsserting: boolean;
151
+ assertedPatterns: string[];
152
+ testFiles: string[];
153
+ captures?: Array<{
154
+ path: string;
155
+ sha256: string;
156
+ provenance: string;
157
+ }>;
158
+ members: MemberRecord[];
159
+ }
160
+ interface GitResult {
161
+ ok: boolean;
162
+ status: number | null;
163
+ stdout: string;
164
+ stderr: string;
165
+ reason: string;
166
+ }
167
+ export declare function gitIn(cwd: string, args: string[]): GitResult;
168
+ /**
169
+ * Compute the phase diff base...head: changed files with status and the
170
+ * new-side line ranges of every changed hunk.
171
+ */
172
+ export declare function computePhaseDiff(repoRoot: string, base: string, head: string): {
173
+ ok: true;
174
+ diff: PhaseDiff;
175
+ } | {
176
+ ok: false;
177
+ reason: string;
178
+ };
179
+ /**
180
+ * The spawn grep of rule (f), over the changed files' head-state contents.
181
+ * Exactly the plan's four tokens (M2-P2 step 4 rule (f)): a wider pattern
182
+ * (for example a bare `exec(`) false-positives on `RegExp.exec` calls and
183
+ * would derive a capture obligation from a file that spawns nothing.
184
+ */
185
+ export declare const SPAWN_GREP: RegExp;
186
+ /**
187
+ * The shell form of rule (f)'s derivation (CR-H2). A POSIX shell script that
188
+ * spawns another program and PARSES its output contains none of the four JS
189
+ * tokens, so `SPAWN_GREP` is blind to exactly where M1's V-2 lived
190
+ * (`bin/fm-*.sh` classifying git contention output). A shell spawn-and-parse
191
+ * is derived as the conjunction of two signals over the script text:
192
+ * - SPAWN: another program's output is captured (a pipeline `|`, a command
193
+ * substitution `$(...)` or backticks, or stdin consumed by `read`/`while
194
+ * read`);
195
+ * - PARSE: that output is classified or transformed (`grep`, `awk`, `sed`,
196
+ * `cut`, `tr`, a `case` branch, or a `[[ ... =~ ... ]]` regex test).
197
+ * The conjunction is deliberately narrow: a script that only runs a command
198
+ * for its exit status, with no capture and no classifier, is not "in that
199
+ * state" and is not burdened with a capture obligation. What this does NOT
200
+ * cover is stated in the work history (rule (f), shell residue).
201
+ */
202
+ export declare const SHELL_SPAWN: RegExp;
203
+ export declare const SHELL_PARSE: RegExp;
204
+ /** True when the shell script text both spawns a program and parses its output. */
205
+ export declare function shellSpawnsAndParses(text: string): boolean;
206
+ export interface TapTestPoint {
207
+ name: string;
208
+ ok: boolean;
209
+ skipped: boolean;
210
+ }
211
+ export type TapParse = {
212
+ ok: true;
213
+ tests: TapTestPoint[];
214
+ } | {
215
+ ok: false;
216
+ reason: string;
217
+ };
218
+ /**
219
+ * Parse a PINNED tap stream. The format is a controlled input: the child
220
+ * was invoked with `--test-reporter tap`, so a stream that does not open
221
+ * with `TAP version` is a reporter-pin failure naming both formats, never
222
+ * something to parse anyway.
223
+ */
224
+ export declare function parseTapStream(text: string): TapParse;
225
+ export interface TextAssertionDerivation {
226
+ textAsserting: boolean;
227
+ /** Document paths (repo-relative) the named tests' sources read. */
228
+ documents: string[];
229
+ /** Regex sources and literals the assertions apply to those contents. */
230
+ patterns: string[];
231
+ }
232
+ /**
233
+ * Rule (g)'s text-assertion detection, DERIVED from the named tests'
234
+ * sources rather than declared: a source that reads a document from a path
235
+ * outside `src/` and `test/` (a workflow, a manifest, a configuration
236
+ * document) and ASSERTS THAT DOCUMENT'S TEXT is text-asserting. The
237
+ * assertion is tied to the read result (a variable binding or an inline
238
+ * read), never a free-floating assert form, so a read consumed by a project
239
+ * function stays behaviour. Detection is syntactic and fails CONSERVATIVELY:
240
+ * a recognised assert form whose pattern is not statically extractable still
241
+ * marks the witness text-asserting (subject to rule (g)) rather than
242
+ * returning false. The derivation's limits are stated in the work history.
243
+ */
244
+ export declare function deriveTextAssertions(sources: string[]): TextAssertionDerivation;
245
+ /**
246
+ * Resolve named tests to the repo-relative test files whose head-state
247
+ * source contains the name literally. A name found nowhere is a spec
248
+ * defect the caller turns into a red reason.
249
+ */
250
+ export declare function resolveNamedTests(tests: string[], testFiles: Map<string, string>): {
251
+ files: string[];
252
+ missing: string[];
253
+ };
254
+ /**
255
+ * The 1-based line numbers a find text occupies, across every occurrence,
256
+ * multi-line finds included (a single-line scan misses those, and rule (d)
257
+ * plus the unreached-arm report both need the true span).
258
+ */
259
+ export declare function findOccurrenceLines(body: string, find: string): number[];
260
+ interface CloneOutcome {
261
+ dir?: string;
262
+ reason?: string;
263
+ }
264
+ /**
265
+ * Create a scratch clone of the audited repository at the audited head,
266
+ * with `origin` pointing at the audited repository's own origin when it
267
+ * has one (so baselines resolve against the real remote after a fetch,
268
+ * never a stale local ref), else at the audited repository itself.
269
+ */
270
+ export declare function makeClone(repoRoot: string, headSha: string, scratchRoot: string, label: string): CloneOutcome;
271
+ /**
272
+ * Evaluate one witness spec end to end. Refusal rules first; then, per
273
+ * declared dangerous-state member, a scratch clone, the member applied, the
274
+ * named tests run red `repeats` times, head restored, the named tests run
275
+ * green, everything pinned and recorded.
276
+ */
277
+ export declare function evaluateWitness(spec: WitnessSpec, specPath: string, inputs: EvaluationInputs): WitnessEvaluation;
278
+ /** Create the scratch root this harness owns; the caller removes it. */
279
+ export declare function makeScratchRoot(): string;
280
+ /** Remove a scratch root created by makeScratchRoot. */
281
+ export declare function removeScratchRoot(root: string): void;
282
+ /**
283
+ * Read the head-state sources of every test file under `test/`, from git
284
+ * rather than the working tree, because on pull_request events the checkout
285
+ * is a synthetic merge commit and the audited head is `--head`.
286
+ */
287
+ export declare function readTestFilesAtHead(repoRoot: string, headSha: string): {
288
+ ok: true;
289
+ files: Map<string, string>;
290
+ } | {
291
+ ok: false;
292
+ reason: string;
293
+ };
294
+ /** Resolve the absolute path of a repository root, refusing a non-directory. */
295
+ export declare function resolveRepoRoot(path: string): {
296
+ root?: string;
297
+ reason?: string;
298
+ };
299
+ export {};