@davesheffer/hunch 1.31.1 → 1.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/README.md +2 -1
  2. package/dist/cli/automaticReviewMemory.d.ts +13 -0
  3. package/dist/cli/dna.d.ts +2 -0
  4. package/dist/cli/index.d.ts +16 -0
  5. package/dist/cli/index.js +606 -43
  6. package/dist/cli/integrations.d.ts +2 -0
  7. package/dist/cli/integrations.js +5 -2
  8. package/dist/cli/invocation.d.ts +35 -0
  9. package/dist/cli/preflight.d.ts +1 -0
  10. package/dist/cli/reviewMemory.d.ts +4 -0
  11. package/dist/cli/reviewMemoryProvider.d.ts +14 -0
  12. package/dist/cli/serve.d.ts +2 -0
  13. package/dist/cli/taskReport.d.ts +6 -0
  14. package/dist/cli/taskReport.js +128 -0
  15. package/dist/cli/update.d.ts +14 -0
  16. package/dist/client/state.d.ts +248 -0
  17. package/dist/constitution/adapters.d.ts +29 -0
  18. package/dist/constitution/behaviorAttestationBinding.d.ts +3 -0
  19. package/dist/constitution/behaviorEvaluator.d.ts +8 -0
  20. package/dist/constitution/behaviorProof.d.ts +9 -0
  21. package/dist/constitution/behaviorWorkspace.d.ts +25 -0
  22. package/dist/constitution/bootstrap.d.ts +30 -0
  23. package/dist/constitution/canonical.d.ts +15 -0
  24. package/dist/constitution/card.d.ts +58 -0
  25. package/dist/constitution/compiler.d.ts +52 -0
  26. package/dist/constitution/composition.d.ts +10 -0
  27. package/dist/constitution/corpus.d.ts +7 -0
  28. package/dist/constitution/correctionPolicyMaterializer.d.ts +57 -0
  29. package/dist/constitution/delta.d.ts +4 -0
  30. package/dist/constitution/disposition.d.ts +20 -0
  31. package/dist/constitution/evaluator.d.ts +47 -0
  32. package/dist/constitution/experiment.d.ts +466 -0
  33. package/dist/constitution/experimentRunner.d.ts +7 -0
  34. package/dist/constitution/g2.d.ts +209 -0
  35. package/dist/constitution/g2BehaviorAttestation.d.ts +45 -0
  36. package/dist/constitution/g2BehaviorCandidates.d.ts +123 -0
  37. package/dist/constitution/g2BehaviorDependencies.d.ts +83 -0
  38. package/dist/constitution/g2BehaviorMaterialization.d.ts +77 -0
  39. package/dist/constitution/g2BehaviorPolicyMaterializer.d.ts +48 -0
  40. package/dist/constitution/g2CandidateAttestation.d.ts +43 -0
  41. package/dist/constitution/g2Candidates.d.ts +80 -0
  42. package/dist/constitution/g2Drills.d.ts +33 -0
  43. package/dist/constitution/g3.d.ts +311 -0
  44. package/dist/constitution/g3Conformance.d.ts +33 -0
  45. package/dist/constitution/lifecycle.d.ts +25 -0
  46. package/dist/constitution/mutation.d.ts +15 -0
  47. package/dist/constitution/nodeTestEvidence.d.ts +13 -0
  48. package/dist/constitution/plan.d.ts +18 -0
  49. package/dist/constitution/policyRuntime.d.ts +5 -0
  50. package/dist/constitution/proof.d.ts +11 -0
  51. package/dist/constitution/repairPolicies.d.ts +34 -0
  52. package/dist/constitution/replacementFreeGit.d.ts +14 -0
  53. package/dist/constitution/replay.d.ts +40 -0
  54. package/dist/constitution/replayCache.d.ts +14 -0
  55. package/dist/constitution/replayWorker.d.ts +1 -0
  56. package/dist/constitution/repository.d.ts +129 -0
  57. package/dist/constitution/safeCheckout.d.ts +9 -0
  58. package/dist/constitution/schema.d.ts +1763 -0
  59. package/dist/constitution/scorecard.d.ts +219 -0
  60. package/dist/constitution/service.d.ts +398 -0
  61. package/dist/constitution/shadow.d.ts +54 -0
  62. package/dist/constitution/sourceMutation.d.ts +15 -0
  63. package/dist/constitution/staticGraphBaseline.d.ts +13 -0
  64. package/dist/constitution/structural.d.ts +64 -0
  65. package/dist/core/agenthook.d.ts +63 -0
  66. package/dist/core/agenthook.js +1 -0
  67. package/dist/core/automaticReviewMemory.d.ts +60 -0
  68. package/dist/core/autoreview.d.ts +66 -0
  69. package/dist/core/canonicalOrder.d.ts +3 -0
  70. package/dist/core/capturetoken.d.ts +19 -0
  71. package/dist/core/changeIdentity.d.ts +22 -0
  72. package/dist/core/changeProof.d.ts +14 -0
  73. package/dist/core/checkreport.d.ts +140 -0
  74. package/dist/core/commitrepair.d.ts +171 -0
  75. package/dist/core/commitrepair.js +238 -0
  76. package/dist/core/compare.d.ts +21 -0
  77. package/dist/core/config.d.ts +20 -0
  78. package/dist/core/conformance.d.ts +35 -0
  79. package/dist/core/constraintmatch.d.ts +54 -0
  80. package/dist/core/correction.d.ts +42 -0
  81. package/dist/core/correctionStage.d.ts +224 -0
  82. package/dist/core/declarationClusters.d.ts +149 -0
  83. package/dist/core/delivery.d.ts +110 -0
  84. package/dist/core/docanchors.d.ts +32 -0
  85. package/dist/core/docscan.d.ts +26 -0
  86. package/dist/core/drift.d.ts +13 -0
  87. package/dist/core/drift.js +31 -1
  88. package/dist/core/dupdetect.d.ts +43 -0
  89. package/dist/core/escalations.d.ts +129 -0
  90. package/dist/core/escalations.js +165 -0
  91. package/dist/core/events.d.ts +29 -0
  92. package/dist/core/evidenceMap.d.ts +164 -0
  93. package/dist/core/externalImports.d.ts +8 -0
  94. package/dist/core/format.d.ts +13 -0
  95. package/dist/core/glob.d.ts +9 -0
  96. package/dist/core/groundingLag.d.ts +84 -0
  97. package/dist/core/groundingLag.js +16 -2
  98. package/dist/core/groundingMerge.d.ts +15 -0
  99. package/dist/core/groundingMerge.js +95 -0
  100. package/dist/core/hookObservations.d.ts +9 -0
  101. package/dist/core/hookObservations.js +33 -0
  102. package/dist/core/hookcache.d.ts +10 -0
  103. package/dist/core/hookpolicy.d.ts +47 -0
  104. package/dist/core/ids.d.ts +36 -0
  105. package/dist/core/importReview.d.ts +30 -0
  106. package/dist/core/io.d.ts +23 -0
  107. package/dist/core/jsonc.d.ts +4 -0
  108. package/dist/core/landscapeAdoption.d.ts +66 -0
  109. package/dist/core/landscapeDelivery.d.ts +76 -0
  110. package/dist/core/memorylog.d.ts +37 -0
  111. package/dist/core/migrate.d.ts +28 -0
  112. package/dist/core/outcomeExperience.d.ts +89 -0
  113. package/dist/core/overlaySafety.d.ts +24 -0
  114. package/dist/core/overlaySafety.js +7 -1
  115. package/dist/core/paths.d.ts +31 -0
  116. package/dist/core/pipeline.d.ts +289 -0
  117. package/dist/core/premises.d.ts +43 -0
  118. package/dist/core/provenance.d.ts +21 -0
  119. package/dist/core/publication.d.ts +54 -0
  120. package/dist/core/refrepair.d.ts +24 -0
  121. package/dist/core/refrepair.js +1 -1
  122. package/dist/core/relativeImports.d.ts +11 -0
  123. package/dist/core/repair.d.ts +44 -0
  124. package/dist/core/repairqueue.d.ts +40 -0
  125. package/dist/core/repairqueue.js +133 -0
  126. package/dist/core/reviewMemory.d.ts +40 -0
  127. package/dist/core/reviewqueue.d.ts +54 -0
  128. package/dist/core/safeRepoFile.d.ts +20 -0
  129. package/dist/core/served.d.ts +57 -0
  130. package/dist/core/served.js +14 -0
  131. package/dist/core/stateContract.d.ts +979 -0
  132. package/dist/core/stateDelivery.d.ts +78 -0
  133. package/dist/core/stateRecords.d.ts +383 -0
  134. package/dist/core/stats.d.ts +88 -0
  135. package/dist/core/strictgate.d.ts +33 -0
  136. package/dist/core/taskReport.d.ts +226 -0
  137. package/dist/core/taskReport.js +514 -0
  138. package/dist/core/taskReportCapture.d.ts +8 -0
  139. package/dist/core/taskReportCapture.js +36 -0
  140. package/dist/core/taskReportEvidence.d.ts +28 -0
  141. package/dist/core/taskReportEvidence.js +272 -0
  142. package/dist/core/taskReportHook.d.ts +20 -0
  143. package/dist/core/taskReportHook.js +76 -0
  144. package/dist/core/taskReportPaths.d.ts +3 -0
  145. package/dist/core/taskReportPaths.js +23 -0
  146. package/dist/core/taskReportPublic.d.ts +31 -0
  147. package/dist/core/taskReportPublic.js +45 -0
  148. package/dist/core/taskReportRender.d.ts +6 -0
  149. package/dist/core/taskReportRender.js +97 -0
  150. package/dist/core/topics.d.ts +73 -0
  151. package/dist/core/types.d.ts +1239 -0
  152. package/dist/core/version.d.ts +10 -0
  153. package/dist/eval/guards.d.ts +45 -0
  154. package/dist/eval/harness.d.ts +58 -0
  155. package/dist/extractors/adrImport.d.ts +59 -0
  156. package/dist/extractors/comments.d.ts +7 -0
  157. package/dist/extractors/correctionSources.d.ts +11 -0
  158. package/dist/extractors/diff.d.ts +40 -0
  159. package/dist/extractors/git.d.ts +304 -0
  160. package/dist/extractors/git.js +208 -20
  161. package/dist/extractors/helm.d.ts +31 -0
  162. package/dist/extractors/indexer.d.ts +55 -0
  163. package/dist/extractors/landscapeDiscovery.d.ts +41 -0
  164. package/dist/extractors/languages.d.ts +77 -0
  165. package/dist/extractors/nativeTreeSitter.d.ts +16 -0
  166. package/dist/extractors/parse.d.ts +54 -0
  167. package/dist/extractors/php.d.ts +26 -0
  168. package/dist/extractors/repoSource.d.ts +53 -0
  169. package/dist/extractors/testreport.d.ts +36 -0
  170. package/dist/integrations/ciAction.d.ts +8 -0
  171. package/dist/integrations/claudeConfig.d.ts +44 -0
  172. package/dist/integrations/claudemd.d.ts +13 -0
  173. package/dist/integrations/claudemd.js +11 -2
  174. package/dist/integrations/gitignore.d.ts +16 -0
  175. package/dist/integrations/gitignore.js +7 -0
  176. package/dist/integrations/health.d.ts +74 -0
  177. package/dist/integrations/health.js +32 -2
  178. package/dist/integrations/hooks.d.ts +41 -0
  179. package/dist/integrations/hooks.js +92 -66
  180. package/dist/integrations/madrExport.d.ts +39 -0
  181. package/dist/integrations/madrManifest.d.ts +69 -0
  182. package/dist/integrations/mergeDriver.d.ts +3 -0
  183. package/dist/integrations/mergeDriver.js +25 -8
  184. package/dist/integrations/probe.d.ts +4 -0
  185. package/dist/integrations/providers.d.ts +103 -0
  186. package/dist/integrations/scaffold.d.ts +29 -0
  187. package/dist/integrations/sync.d.ts +30 -0
  188. package/dist/integrations/sync.js +3 -2
  189. package/dist/integrations/team.d.ts +70 -0
  190. package/dist/integrations/worktree.d.ts +8 -0
  191. package/dist/mcp/roots.d.ts +16 -0
  192. package/dist/mcp/server.d.ts +36 -0
  193. package/dist/mcp/server.js +74 -22
  194. package/dist/mcp/taskReportTools.d.ts +188 -0
  195. package/dist/mcp/taskReportTools.js +147 -0
  196. package/dist/serve/app.d.ts +36 -0
  197. package/dist/serve/config.d.ts +100 -0
  198. package/dist/serve/writelock.d.ts +22 -0
  199. package/dist/store/changeLedger.d.ts +132 -0
  200. package/dist/store/compact.d.ts +33 -0
  201. package/dist/store/db.d.ts +9 -0
  202. package/dist/store/embedder.d.ts +32 -0
  203. package/dist/store/hunchStore.d.ts +624 -0
  204. package/dist/store/hunchStore.js +6 -3
  205. package/dist/store/jsonStore.d.ts +125 -0
  206. package/dist/store/merge.d.ts +39 -0
  207. package/dist/store/privateMigrate.d.ts +24 -0
  208. package/dist/store/replay.d.ts +56 -0
  209. package/dist/store/schema.d.ts +17 -0
  210. package/dist/store/stateBinding.d.ts +145 -0
  211. package/dist/store/stateCapture.d.ts +15 -0
  212. package/dist/synthesis/cliAdapter.d.ts +22 -0
  213. package/dist/synthesis/initiator.d.ts +13 -0
  214. package/dist/synthesis/provider.d.ts +307 -0
  215. package/dist/synthesis/synthesize.d.ts +117 -0
  216. package/dist/synthesis/tripwires.d.ts +9 -0
  217. package/dist/taskReports.d.ts +79 -0
  218. package/dist/taskReports.js +69 -0
  219. package/dist/wiki/adopt.d.ts +22 -0
  220. package/dist/wiki/graph.d.ts +87 -0
  221. package/dist/wiki/wiki.d.ts +242 -0
  222. package/package.json +6 -5
  223. package/server.json +2 -2
@@ -0,0 +1,311 @@
1
+ import { z } from "zod";
2
+ import type { HunchStore } from "../store/hunchStore.js";
3
+ import { type G2ReadinessReport } from "./g2.js";
4
+ export declare const G3_REQUIRED_EXPERIMENTS: readonly ["EXP-01", "EXP-03"];
5
+ export type G3RequiredExperiment = (typeof G3_REQUIRED_EXPERIMENTS)[number];
6
+ export declare const G3PlanSchema: z.ZodObject<{
7
+ id: z.ZodString;
8
+ content_hash: z.ZodString;
9
+ gate: z.ZodLiteral<"G3">;
10
+ g2_readiness_hash: z.ZodString;
11
+ policy_ids: z.ZodArray<z.ZodString>;
12
+ clients: z.ZodArray<z.ZodString>;
13
+ experiments: z.ZodObject<{
14
+ retrieval: z.ZodString;
15
+ compiler: z.ZodString;
16
+ }, z.core.$strict>;
17
+ actor: z.ZodString;
18
+ reason: z.ZodString;
19
+ supersedes: z.ZodNullable<z.ZodString>;
20
+ data_class: z.ZodLiteral<"private">;
21
+ authority: z.ZodLiteral<"none">;
22
+ created_at: z.ZodString;
23
+ }, z.core.$strict>;
24
+ export type G3Plan = z.infer<typeof G3PlanSchema>;
25
+ export interface CompileG3PlanInput {
26
+ g2_readiness_hash: string;
27
+ policy_ids: string[];
28
+ clients: string[];
29
+ experiments: {
30
+ retrieval: string;
31
+ compiler: string;
32
+ };
33
+ actor: string;
34
+ reason: string;
35
+ supersedes?: string | null;
36
+ }
37
+ export declare function g3PlanContentHash(plan: G3Plan): string;
38
+ export declare function compileG3Plan(input: CompileG3PlanInput, opts?: {
39
+ now?: string;
40
+ }): G3Plan;
41
+ export declare const ExperimentPreregistrationSchema: z.ZodObject<{
42
+ id: z.ZodString;
43
+ content_hash: z.ZodString;
44
+ experiment: z.ZodEnum<{
45
+ "EXP-03": "EXP-03";
46
+ "EXP-01": "EXP-01";
47
+ }>;
48
+ revision: z.ZodNumber;
49
+ hypothesis: z.ZodString;
50
+ primary_metric: z.ZodString;
51
+ secondary_metrics: z.ZodArray<z.ZodString>;
52
+ unit: z.ZodEnum<{
53
+ repository: "repository";
54
+ pull_request: "pull_request";
55
+ task: "task";
56
+ developer: "developer";
57
+ policy_candidate: "policy_candidate";
58
+ }>;
59
+ arms: z.ZodArray<z.ZodObject<{
60
+ id: z.ZodString;
61
+ description: z.ZodString;
62
+ }, z.core.$strict>>;
63
+ assignment: z.ZodObject<{
64
+ method: z.ZodEnum<{
65
+ randomized: "randomized";
66
+ blocked_randomized: "blocked_randomized";
67
+ paired_randomized: "paired_randomized";
68
+ }>;
69
+ unit: z.ZodEnum<{
70
+ repository: "repository";
71
+ pull_request: "pull_request";
72
+ task: "task";
73
+ developer: "developer";
74
+ policy_candidate: "policy_candidate";
75
+ }>;
76
+ seed: z.ZodString;
77
+ }, z.core.$strict>;
78
+ strata: z.ZodArray<z.ZodString>;
79
+ inclusion: z.ZodArray<z.ZodString>;
80
+ exclusion: z.ZodArray<z.ZodString>;
81
+ sample_plan: z.ZodObject<{
82
+ minimum_per_arm: z.ZodNumber;
83
+ target_per_arm: z.ZodNumber;
84
+ maximum_total: z.ZodNumber;
85
+ rationale: z.ZodString;
86
+ }, z.core.$strict>;
87
+ analysis_plan: z.ZodObject<{
88
+ primary_estimator: z.ZodString;
89
+ effect_size: z.ZodString;
90
+ uncertainty: z.ZodString;
91
+ missing_data: z.ZodString;
92
+ multiple_metrics: z.ZodString;
93
+ }, z.core.$strict>;
94
+ stopping_rule: z.ZodString;
95
+ guardrails: z.ZodArray<z.ZodString>;
96
+ privacy_class: z.ZodLiteral<"private">;
97
+ status: z.ZodLiteral<"registered">;
98
+ actor: z.ZodString;
99
+ reason: z.ZodString;
100
+ supersedes: z.ZodNullable<z.ZodString>;
101
+ authority: z.ZodLiteral<"none">;
102
+ registered_at: z.ZodString;
103
+ }, z.core.$strict>;
104
+ export type ExperimentPreregistration = z.infer<typeof ExperimentPreregistrationSchema>;
105
+ export type CompileExperimentPreregistrationInput = Omit<ExperimentPreregistration, "id" | "content_hash" | "revision" | "privacy_class" | "status" | "authority" | "registered_at"> & {
106
+ revision?: number;
107
+ };
108
+ export declare function experimentPreregistrationContentHash(spec: ExperimentPreregistration): string;
109
+ export declare function compileExperimentPreregistration(input: CompileExperimentPreregistrationInput, opts?: {
110
+ now?: string;
111
+ }): ExperimentPreregistration;
112
+ declare const ComprehensionSchema: z.ZodObject<{
113
+ requirement: z.ZodEnum<{
114
+ correct: "correct";
115
+ incorrect: "incorrect";
116
+ }>;
117
+ limitations: z.ZodEnum<{
118
+ correct: "correct";
119
+ incorrect: "incorrect";
120
+ }>;
121
+ authority: z.ZodEnum<{
122
+ correct: "correct";
123
+ incorrect: "incorrect";
124
+ }>;
125
+ }, z.core.$strict>;
126
+ export declare const ProofReviewMeasurementSchema: z.ZodObject<{
127
+ id: z.ZodString;
128
+ content_hash: z.ZodString;
129
+ plan_id: z.ZodString;
130
+ policy_id: z.ZodString;
131
+ policy_hash: z.ZodString;
132
+ proof_id: z.ZodString;
133
+ proof_hash: z.ZodString;
134
+ card_hash: z.ZodString;
135
+ reviewer: z.ZodString;
136
+ duration_ms: z.ZodNumber;
137
+ comprehension: z.ZodObject<{
138
+ requirement: z.ZodEnum<{
139
+ correct: "correct";
140
+ incorrect: "incorrect";
141
+ }>;
142
+ limitations: z.ZodEnum<{
143
+ correct: "correct";
144
+ incorrect: "incorrect";
145
+ }>;
146
+ authority: z.ZodEnum<{
147
+ correct: "correct";
148
+ incorrect: "incorrect";
149
+ }>;
150
+ }, z.core.$strict>;
151
+ notes: z.ZodString;
152
+ supersedes: z.ZodNullable<z.ZodString>;
153
+ data_class: z.ZodLiteral<"private">;
154
+ authority: z.ZodLiteral<"none">;
155
+ measured_at: z.ZodString;
156
+ }, z.core.$strict>;
157
+ export type ProofReviewMeasurement = z.infer<typeof ProofReviewMeasurementSchema>;
158
+ export interface CompileProofReviewMeasurementInput {
159
+ plan_id: string;
160
+ policy_id: string;
161
+ policy_hash: string;
162
+ proof_id: string;
163
+ proof_hash: string;
164
+ card_hash: string;
165
+ reviewer: string;
166
+ duration_ms: number;
167
+ comprehension: z.infer<typeof ComprehensionSchema>;
168
+ notes: string;
169
+ supersedes?: string | null;
170
+ }
171
+ export declare function proofReviewMeasurementContentHash(record: ProofReviewMeasurement): string;
172
+ export declare function compileProofReviewMeasurement(input: CompileProofReviewMeasurementInput, opts?: {
173
+ now?: string;
174
+ }): ProofReviewMeasurement;
175
+ export declare const AdapterConformanceReceiptSchema: z.ZodObject<{
176
+ id: z.ZodString;
177
+ content_hash: z.ZodString;
178
+ plan_id: z.ZodString;
179
+ clients: z.ZodArray<z.ZodString>;
180
+ test: z.ZodObject<{
181
+ file: z.ZodString;
182
+ name: z.ZodString;
183
+ source_hash: z.ZodString;
184
+ }, z.core.$strict>;
185
+ runner: z.ZodObject<{
186
+ name: z.ZodLiteral<"node-test-tsx">;
187
+ isolation_flag: z.ZodString;
188
+ }, z.core.$strict>;
189
+ result: z.ZodEnum<{
190
+ error: "error";
191
+ passed: "passed";
192
+ failed: "failed";
193
+ }>;
194
+ exit_code: z.ZodNullable<z.ZodNumber>;
195
+ selected_event: z.ZodNullable<z.ZodEnum<{
196
+ passed: "passed";
197
+ failed: "failed";
198
+ }>>;
199
+ verdict_agreement: z.ZodNullable<z.ZodNumber>;
200
+ confirmed_private_leaks: z.ZodNullable<z.ZodNumber>;
201
+ error_code: z.ZodOptional<z.ZodString>;
202
+ log_hash: z.ZodString;
203
+ supersedes: z.ZodNullable<z.ZodString>;
204
+ data_class: z.ZodLiteral<"private">;
205
+ authority: z.ZodLiteral<"none">;
206
+ effects: z.ZodLiteral<"diagnostic_only">;
207
+ writes: z.ZodLiteral<"evidence_receipt_only">;
208
+ executed_at: z.ZodString;
209
+ }, z.core.$strict>;
210
+ export type AdapterConformanceReceipt = z.infer<typeof AdapterConformanceReceiptSchema>;
211
+ export declare function adapterConformanceContentHash(receipt: AdapterConformanceReceipt): string;
212
+ export declare function compileAdapterConformanceReceipt(input: Omit<AdapterConformanceReceipt, "id" | "content_hash" | "data_class" | "authority" | "effects" | "writes" | "executed_at">, opts?: {
213
+ now?: string;
214
+ }): AdapterConformanceReceipt;
215
+ export declare function currentG3Plans(records: G3Plan[]): G3Plan[];
216
+ export declare function currentExperimentPreregistrations(records: ExperimentPreregistration[]): ExperimentPreregistration[];
217
+ export declare function currentProofReviewMeasurements(records: ProofReviewMeasurement[]): ProofReviewMeasurement[];
218
+ export declare function currentAdapterConformanceReceipts(records: AdapterConformanceReceipt[]): AdapterConformanceReceipt[];
219
+ export type ScoreBand = "green" | "yellow" | "red" | "unmeasured";
220
+ export interface G3Scorecard {
221
+ median_review_burden_ms: {
222
+ value: number | null;
223
+ band: ScoreBand;
224
+ };
225
+ proof_comprehension: {
226
+ correct: number;
227
+ total: number;
228
+ rate: number | null;
229
+ band: ScoreBand;
230
+ };
231
+ required_client_verdict_agreement: {
232
+ value: number | null;
233
+ band: ScoreBand;
234
+ };
235
+ current_proof_rate: {
236
+ current: number;
237
+ selected: number;
238
+ value: number | null;
239
+ band: ScoreBand;
240
+ };
241
+ confirmed_private_leaks: {
242
+ value: number | null;
243
+ band: ScoreBand;
244
+ };
245
+ overall: ScoreBand;
246
+ }
247
+ export interface G3PolicyEvidence {
248
+ policy_id: string;
249
+ state: string | null;
250
+ authority_kind: string | null;
251
+ proof_current: boolean;
252
+ card_hash: string | null;
253
+ review_id: string | null;
254
+ review_duration_ms: number | null;
255
+ comprehension_correct: boolean | null;
256
+ reasons: string[];
257
+ }
258
+ export interface G3ReadinessReport {
259
+ id: string;
260
+ content_hash: string;
261
+ gate: "G3";
262
+ manifest: G3Plan | null;
263
+ g2_readiness: {
264
+ id: string;
265
+ content_hash: string;
266
+ recommendation: string;
267
+ };
268
+ policy_evidence: G3PolicyEvidence[];
269
+ experiments: Array<{
270
+ experiment: G3RequiredExperiment;
271
+ id: string | null;
272
+ content_hash: string | null;
273
+ current: boolean;
274
+ reasons: string[];
275
+ }>;
276
+ conformance: AdapterConformanceReceipt | null;
277
+ scorecard: G3Scorecard;
278
+ active_blocking_policy_ids: string[];
279
+ blockers: string[];
280
+ recommendation: "not_ready" | "eligible_for_human_g3_signoff";
281
+ authority: "none";
282
+ g3_passed: false;
283
+ }
284
+ export interface ScoreG3ReadinessInput {
285
+ manifest: G3Plan | null;
286
+ g2_readiness: G2ReadinessReport;
287
+ policy_evidence: G3PolicyEvidence[];
288
+ experiments: G3ReadinessReport["experiments"];
289
+ conformance: AdapterConformanceReceipt | null;
290
+ active_blocking_policy_ids: string[];
291
+ }
292
+ export declare function scoreG3Readiness(input: ScoreG3ReadinessInput): G3ReadinessReport;
293
+ /** Private-only append-only storage for G3 plans, preregistrations, measurements, and conformance. */
294
+ export declare class G3EvidenceRepository {
295
+ private readonly store;
296
+ constructor(store: HunchStore);
297
+ private requirePrivate;
298
+ listPlans(): G3Plan[];
299
+ currentPlan(): G3Plan | null;
300
+ putPlan(plan: G3Plan): G3Plan;
301
+ listExperiments(): ExperimentPreregistration[];
302
+ currentExperiments(): ExperimentPreregistration[];
303
+ putExperiment(spec: ExperimentPreregistration): ExperimentPreregistration;
304
+ listReviews(): ProofReviewMeasurement[];
305
+ currentReviews(): ProofReviewMeasurement[];
306
+ putReview(review: ProofReviewMeasurement): ProofReviewMeasurement;
307
+ listConformance(): AdapterConformanceReceipt[];
308
+ currentConformance(): AdapterConformanceReceipt[];
309
+ putConformance(receipt: AdapterConformanceReceipt): AdapterConformanceReceipt;
310
+ }
311
+ export {};
@@ -0,0 +1,33 @@
1
+ import type { G3Plan, AdapterConformanceReceipt } from "./g3.js";
2
+ export declare const G3_CONFORMANCE_CLIENTS: readonly ["ci", "cli", "mcp"];
3
+ export declare const G3_CONFORMANCE_TEST: {
4
+ readonly file: "test/behavior-workspace.test.ts";
5
+ readonly name: "CLI, MCP, and check share one non-blocking working-snapshot receipt without public leakage";
6
+ };
7
+ /** The certifiable client profiles. Each maps a HUMAN-SELECTED client set to the
8
+ * ONE executable fixture that exercises every named surface end-to-end and
9
+ * asserts receipt equality + zero private leaks. The vscode profile executes the
10
+ * extension's real spawn seam (vscode-extension/src/spawnCore.ts) against an
11
+ * npm-style shim — naming a client never certifies it; only its fixture does. */
12
+ export declare const G3_CONFORMANCE_PROFILES: readonly [{
13
+ readonly clients: readonly ["ci", "cli", "mcp"];
14
+ readonly test: {
15
+ readonly file: "test/behavior-workspace.test.ts";
16
+ readonly name: "CLI, MCP, and check share one non-blocking working-snapshot receipt without public leakage";
17
+ };
18
+ }, {
19
+ readonly clients: readonly ["ci", "cli", "mcp", "vscode"];
20
+ readonly test: {
21
+ readonly file: "test/behavior-workspace.test.ts";
22
+ readonly name: "CLI, MCP, check, and the VS Code seam share one non-blocking working-snapshot receipt without public leakage";
23
+ };
24
+ }];
25
+ export declare function g3ConformanceSourceHash(root: string): string;
26
+ /** Execute the real end-to-end fixture matching the plan's human-selected client
27
+ * profile. Unsupported client sets return an error receipt rather than being
28
+ * silently treated as equivalent to a certified profile. */
29
+ export declare function executeG3AdapterConformance(root: string, plan: G3Plan, opts?: {
30
+ timeoutMs?: number;
31
+ now?: string;
32
+ supersedes?: string | null;
33
+ }): AdapterConformanceReceipt;
@@ -0,0 +1,25 @@
1
+ import { type HistoryDisposition, type PolicyProof, type PolicySpec } from "./schema.js";
2
+ import type { G2BehaviorAttestation } from "./g2BehaviorAttestation.js";
3
+ export declare function blockingEvidenceError(proof: PolicyProof, dispositions?: HistoryDisposition[]): string | null;
4
+ /** Activation is a runtime property, not merely an approval-time check. The
5
+ * audit fallback keeps correction policies compiled before `origin` was added
6
+ * fail-closed after they are loaded by the current schema. */
7
+ export declare function activationGateError(policy: PolicySpec): string | null;
8
+ /** Rechecked on every blocking evaluation; a hand-edited lifecycle flag without
9
+ * a current P3 proof is a configuration error, never authority. */
10
+ export declare function blockingProofError(policy: PolicySpec, proof: PolicyProof | undefined, dispositions?: HistoryDisposition[], composition?: PolicySpec[], currentBehaviorAttestations?: G2BehaviorAttestation[]): string | null;
11
+ export declare function proposeProvedPolicy(policy: PolicySpec, proof: PolicyProof, at: string, composition?: PolicySpec[], currentBehaviorAttestations?: G2BehaviorAttestation[]): PolicySpec;
12
+ export declare function approvePolicy(policy: PolicySpec, proof: PolicyProof, mode: "advisory" | "blocking", actor: string, at: string, dispositions?: HistoryDisposition[], composition?: PolicySpec[], currentBehaviorAttestations?: G2BehaviorAttestation[]): PolicySpec;
13
+ /** Human-authored exception relationship only. It invalidates the child's old
14
+ * proof/authority; the broad parent remains the separately activated unit. */
15
+ export declare function linkPolicyException(child: PolicySpec, parent: PolicySpec, actor: string, reason: string, at: string): PolicySpec;
16
+ export declare function demotePolicy(policy: PolicySpec, actor: string, reason: string, at: string): PolicySpec;
17
+ /** Targeted advisory withdrawal (the §57 gap): pull the human authority back and
18
+ * return the policy to `proposed`. It stops surfacing as an active rule and
19
+ * RE-ENTERS the inline escalation loop ("activate or reject?") — the reversible
20
+ * half of retirement. History is append-only; nothing is erased. */
21
+ export declare function withdrawPolicy(policy: PolicySpec, actor: string, reason: string, at: string): PolicySpec;
22
+ /** Permanent retirement: the rule is deliberately DONE — it stops surfacing
23
+ * anywhere (active rules, escalations) but its full history and audit trail stay
24
+ * (supersede-never-erase, HC-08). Closes the valid-time window. */
25
+ export declare function retirePolicy(policy: PolicySpec, actor: string, reason: string, at: string): PolicySpec;
@@ -0,0 +1,15 @@
1
+ import { type GraphSnapshot } from "./evaluator.js";
2
+ import { type MutationReceipt, type PolicyEvaluation, type PolicySpec, type ProofPlan } from "./schema.js";
3
+ type PlannedMutation = ProofPlan["mutations"][number];
4
+ export interface MutationHarnessResult {
5
+ receipts: MutationReceipt[];
6
+ primary_evaluations: PolicyEvaluation[];
7
+ }
8
+ /** Execute only canonical evaluator/parser mutations. Project scripts, builds,
9
+ * tests, models, and providers are deliberately outside this evidence path. */
10
+ export declare function runMutationHarness(root: string, policy: PolicySpec, base: GraphSnapshot, planned: PlannedMutation[], opts?: {
11
+ policyHash?: string;
12
+ mutationPolicy?: PolicySpec;
13
+ evaluate?: (snapshot: GraphSnapshot) => PolicyEvaluation;
14
+ }): MutationHarnessResult;
15
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare const NODE_TEST_REPORTER_PROTOCOL = "hunch-node-test-reporter-v1";
2
+ export declare const NODE_TEST_REPORTER_SOURCE = "export default async function* hunchReporter(source) {\n for await (const event of source) {\n if (event.type !== \"test:pass\" && event.type !== \"test:fail\") continue;\n yield JSON.stringify({\n protocol: \"hunch-node-test-reporter-v1\",\n type: event.type,\n name: event.data.name,\n nesting: event.data.nesting,\n skip: event.data.skip ?? null,\n todo: event.data.todo ?? null\n }) + \"\\n\";\n }\n}\n";
3
+ export interface NodeTestReporterEvent {
4
+ protocol: typeof NODE_TEST_REPORTER_PROTOCOL;
5
+ type: "test:pass" | "test:fail";
6
+ name: string;
7
+ nesting?: number;
8
+ skip: string | boolean | null;
9
+ todo: string | boolean | null;
10
+ }
11
+ export declare function exactNodeTestPattern(name: string): string;
12
+ export declare function nodeTestIsolationFlag(): string;
13
+ export declare function nodeTestReporterEvents(output: string): NodeTestReporterEvent[];
@@ -0,0 +1,18 @@
1
+ import type { HunchStore } from "../store/hunchStore.js";
2
+ import type { PolicyRepository } from "./repository.js";
3
+ export { canonicalStaticGraphBaseline } from "./staticGraphBaseline.js";
4
+ import { type PolicySpec, type ProofPlan } from "./schema.js";
5
+ export interface ProofPlanOptions {
6
+ maxCommits?: number;
7
+ maxMutations?: number;
8
+ maxMinutes?: number;
9
+ now?: string;
10
+ publicOnly?: boolean;
11
+ privateOnly?: boolean;
12
+ composition?: PolicySpec[];
13
+ /** Optional stable artifact label for worktree-agnostic materializers. */
14
+ repositoryName?: string;
15
+ }
16
+ /** Deterministic compiler-to-harness contract. It plans replay and mutations but
17
+ * executes neither, grants no authority, and performs no provider/model call. */
18
+ export declare function createProofPlan(store: HunchStore, root: string, repository: PolicyRepository, policy: PolicySpec, opts?: ProofPlanOptions): ProofPlan;
@@ -0,0 +1,5 @@
1
+ import { BEHAVIOR_MUTATION_ENGINE, BEHAVIOR_POLICY_EVALUATOR, MUTATION_ENGINE, POLICY_EVALUATOR, type PolicySpec } from "./schema.js";
2
+ export type PolicyEvaluatorIdentity = typeof POLICY_EVALUATOR | typeof BEHAVIOR_POLICY_EVALUATOR;
3
+ export type PolicyMutationEngineIdentity = typeof MUTATION_ENGINE | typeof BEHAVIOR_MUTATION_ENGINE;
4
+ export declare function evaluatorForPolicy(policy: PolicySpec): PolicyEvaluatorIdentity;
5
+ export declare function mutationEngineForPolicy(policy: PolicySpec): PolicyMutationEngineIdentity;
@@ -0,0 +1,11 @@
1
+ import { type PolicyProof, type PolicySpec, type ProofPlan } from "./schema.js";
2
+ import type { HunchStore } from "../store/hunchStore.js";
3
+ /** Inward proof execution. A canonical plan uses immutable disposable replay
4
+ * snapshots; the no-plan fallback preserves the original Gate-G1 current graph
5
+ * plus one deterministic mutation behavior. */
6
+ export declare function provePolicy(store: HunchStore, root: string, policy: PolicySpec, opts?: {
7
+ publicOnly?: boolean;
8
+ now?: string;
9
+ plan?: ProofPlan;
10
+ composition?: PolicySpec[];
11
+ }): PolicyProof;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Policy binding self-repair (Phase 5 slice 2). Same zero-guessing contract as
3
+ * core/repair.ts: git-confirmed renames only, EXACT matches only.
4
+ *
5
+ * Repairable bindings:
6
+ * - scope.paths entries that are exact paths (globs are scope-intent, untouched);
7
+ * - `symbol:<file>:<name>` selector file parts (mirrors evaluator.ts's
8
+ * lastIndexOf(":") parse exactly); bare `symbol:<name>`, `symbol-id:`,
9
+ * `external:` and component selectors carry no file identity and are untouched.
10
+ *
11
+ * Deliberately NOT repairable: executable-behavior test pins. Their file path is
12
+ * hash-pinned to a source_commit where the OLD path exists — rewriting the path
13
+ * would silently break the pin. A renamed pinned test needs re-attestation, which
14
+ * is a human/evidence act, not a repair.
15
+ *
16
+ * A repaired policy gets revision+1 and a system-actor "repaired" audit event.
17
+ * Its authority is NOT touched: the existing proof-hash revalidation already
18
+ * fails blocking safe when semantics moved under a stale proof, and the repaired
19
+ * policy surfaces as an inline escalation asking for a re-prove.
20
+ */
21
+ import type { PolicySpec } from "./schema.js";
22
+ import type { RenamePair } from "../core/repair.js";
23
+ export interface PolicyBindingRewrite {
24
+ id: string;
25
+ field: "scope.paths" | "assertion.selector";
26
+ from: string;
27
+ to: string;
28
+ }
29
+ /** Live policies only — a superseded/retired/rejected policy's history stays as
30
+ * written. Returns the rewrites; empty when the renames touch nothing exactly. */
31
+ export declare function planPolicyRepair(renames: readonly RenamePair[], policies: readonly PolicySpec[]): PolicyBindingRewrite[];
32
+ /** Apply a policy's rewrites (pure): revision+1, system-actor audit, updated_at.
33
+ * Returns the original reference when nothing in the plan touches this policy. */
34
+ export declare function repairPolicySpec(policy: PolicySpec, rewrites: readonly PolicyBindingRewrite[], at: string): PolicySpec;
@@ -0,0 +1,14 @@
1
+ import { type CommitMeta } from "../extractors/git.js";
2
+ /** Constitution proof identity is the repository's real object graph, never a
3
+ * clone-local `refs/replace/*` or legacy graft view. Keep this environment
4
+ * private to proof planning so every traversal and ancestry check agrees with
5
+ * replay, which uses the same Git invariant. */
6
+ export declare function replacementFreeGitEnvironment(source?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
7
+ /** Resolve one commit-ish through the real object graph. */
8
+ export declare function replacementFreeExactCommit(root: string, ref: string): string | null;
9
+ /** Files changed by an exact commit, ignoring local replacement objects. */
10
+ export declare function replacementFreeCommitFiles(root: string, commit: string): string[];
11
+ export declare function replacementFreeCommitMeta(root: string, commit: string): CommitMeta | null;
12
+ /** Exact introducing commit for a Git-native policy record. */
13
+ export declare function replacementFreeFirstCommitForFile(root: string, file: string): string;
14
+ export declare function replacementFreeIsAncestorOrSame(root: string, ancestor: string, descendant: string): boolean;
@@ -0,0 +1,40 @@
1
+ import { type GraphSnapshot } from "./evaluator.js";
2
+ import { type PolicySpec, type ProofPlan, type ReplayReceipt } from "./schema.js";
3
+ export type ReplayLeg = ReplayReceipt["leg"];
4
+ export interface ProofReplayResult {
5
+ current: ReplayReceipt;
6
+ known_bad: ReplayReceipt[];
7
+ known_good: ReplayReceipt[];
8
+ accepted_history: ReplayReceipt[];
9
+ replay_receipts: ReplayReceipt[];
10
+ selected_history_commits: string[];
11
+ history_complete: boolean;
12
+ cache_stats: {
13
+ hits: number;
14
+ misses: number;
15
+ rebuilds: number;
16
+ memory_hits: number;
17
+ };
18
+ worker_stats: {
19
+ limit: number;
20
+ peak: number;
21
+ scheduled: number;
22
+ };
23
+ current_snapshot?: GraphSnapshot;
24
+ }
25
+ export interface ReplayExecutionOptions {
26
+ /** Operational scheduling only; never enters canonical proof semantics. */
27
+ maxWorkers?: number;
28
+ composition?: PolicySpec[];
29
+ }
30
+ export declare const DEFAULT_REPLAY_WORKERS = 4;
31
+ export declare const MAX_REPLAY_WORKERS = 8;
32
+ export declare function replaySafeEnvironment(home: string, gitConfig: string): NodeJS.ProcessEnv;
33
+ export declare function hasUnsafeReplayFilter(root: string, env: NodeJS.ProcessEnv): boolean;
34
+ export declare function replayGitArgs(root: string, hooks: string, args: string[]): string[];
35
+ export declare function cleanupReplayWorktree(root: string, hooks: string, env: NodeJS.ProcessEnv, run: string, checkout: string): boolean;
36
+ /** Execute an immutable ProofPlan with the current in-process static evaluator.
37
+ * Repository hooks, user-global Git configuration, overlay discovery, project
38
+ * scripts, provider calls, and project tests are outside this path. Every
39
+ * disposable worktree and derived graph is removed in a finally block. */
40
+ export declare function replayProofPlan(root: string, policy: PolicySpec, inputPlan: ProofPlan, opts?: ReplayExecutionOptions): ProofReplayResult;
@@ -0,0 +1,14 @@
1
+ import { type GraphSnapshot } from "./evaluator.js";
2
+ import { type DataClass } from "./schema.js";
3
+ export declare const REPLAY_CACHE_ENGINE: {
4
+ readonly name: "hunch-tsjs-static-index";
5
+ readonly version: "4";
6
+ };
7
+ export type ReplayCacheStatus = "hit" | "miss" | "invalid";
8
+ export declare function replayCacheKey(commit: string, dataClass: DataClass, engineVersion?: "4"): string;
9
+ export declare function replayCacheFile(root: string, commit: string, dataClass: DataClass, engineVersion?: "4"): string;
10
+ export declare function loadReplaySnapshot(root: string, commit: string, dataClass: DataClass, engineVersion?: "4"): {
11
+ status: ReplayCacheStatus;
12
+ snapshot?: GraphSnapshot;
13
+ };
14
+ export declare function putReplaySnapshot(root: string, snapshot: GraphSnapshot, dataClass: DataClass, engineVersion?: "4"): string;
@@ -0,0 +1 @@
1
+ export {};