@davesheffer/hunch 1.31.1 → 1.32.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 (220) hide show
  1. package/README.md +1 -0
  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 +602 -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 +124 -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/hookcache.d.ts +10 -0
  101. package/dist/core/hookpolicy.d.ts +47 -0
  102. package/dist/core/ids.d.ts +36 -0
  103. package/dist/core/importReview.d.ts +30 -0
  104. package/dist/core/io.d.ts +23 -0
  105. package/dist/core/jsonc.d.ts +4 -0
  106. package/dist/core/landscapeAdoption.d.ts +66 -0
  107. package/dist/core/landscapeDelivery.d.ts +76 -0
  108. package/dist/core/memorylog.d.ts +37 -0
  109. package/dist/core/migrate.d.ts +28 -0
  110. package/dist/core/outcomeExperience.d.ts +89 -0
  111. package/dist/core/overlaySafety.d.ts +24 -0
  112. package/dist/core/overlaySafety.js +7 -1
  113. package/dist/core/paths.d.ts +31 -0
  114. package/dist/core/pipeline.d.ts +289 -0
  115. package/dist/core/premises.d.ts +43 -0
  116. package/dist/core/provenance.d.ts +21 -0
  117. package/dist/core/publication.d.ts +54 -0
  118. package/dist/core/refrepair.d.ts +24 -0
  119. package/dist/core/refrepair.js +1 -1
  120. package/dist/core/relativeImports.d.ts +11 -0
  121. package/dist/core/repair.d.ts +44 -0
  122. package/dist/core/repairqueue.d.ts +40 -0
  123. package/dist/core/repairqueue.js +133 -0
  124. package/dist/core/reviewMemory.d.ts +40 -0
  125. package/dist/core/reviewqueue.d.ts +54 -0
  126. package/dist/core/safeRepoFile.d.ts +20 -0
  127. package/dist/core/served.d.ts +57 -0
  128. package/dist/core/served.js +14 -0
  129. package/dist/core/stateContract.d.ts +979 -0
  130. package/dist/core/stateDelivery.d.ts +78 -0
  131. package/dist/core/stateRecords.d.ts +383 -0
  132. package/dist/core/stats.d.ts +88 -0
  133. package/dist/core/strictgate.d.ts +33 -0
  134. package/dist/core/taskReport.d.ts +226 -0
  135. package/dist/core/taskReport.js +514 -0
  136. package/dist/core/taskReportCapture.d.ts +8 -0
  137. package/dist/core/taskReportCapture.js +36 -0
  138. package/dist/core/taskReportEvidence.d.ts +26 -0
  139. package/dist/core/taskReportEvidence.js +268 -0
  140. package/dist/core/taskReportHook.d.ts +20 -0
  141. package/dist/core/taskReportHook.js +76 -0
  142. package/dist/core/taskReportPaths.d.ts +3 -0
  143. package/dist/core/taskReportPaths.js +23 -0
  144. package/dist/core/taskReportPublic.d.ts +31 -0
  145. package/dist/core/taskReportPublic.js +45 -0
  146. package/dist/core/taskReportRender.d.ts +6 -0
  147. package/dist/core/taskReportRender.js +97 -0
  148. package/dist/core/topics.d.ts +73 -0
  149. package/dist/core/types.d.ts +1239 -0
  150. package/dist/core/version.d.ts +10 -0
  151. package/dist/eval/guards.d.ts +45 -0
  152. package/dist/eval/harness.d.ts +58 -0
  153. package/dist/extractors/adrImport.d.ts +59 -0
  154. package/dist/extractors/comments.d.ts +7 -0
  155. package/dist/extractors/correctionSources.d.ts +11 -0
  156. package/dist/extractors/diff.d.ts +40 -0
  157. package/dist/extractors/git.d.ts +304 -0
  158. package/dist/extractors/git.js +208 -20
  159. package/dist/extractors/helm.d.ts +31 -0
  160. package/dist/extractors/indexer.d.ts +55 -0
  161. package/dist/extractors/landscapeDiscovery.d.ts +41 -0
  162. package/dist/extractors/languages.d.ts +77 -0
  163. package/dist/extractors/nativeTreeSitter.d.ts +16 -0
  164. package/dist/extractors/parse.d.ts +54 -0
  165. package/dist/extractors/php.d.ts +26 -0
  166. package/dist/extractors/repoSource.d.ts +53 -0
  167. package/dist/extractors/testreport.d.ts +36 -0
  168. package/dist/integrations/ciAction.d.ts +8 -0
  169. package/dist/integrations/claudeConfig.d.ts +44 -0
  170. package/dist/integrations/claudemd.d.ts +13 -0
  171. package/dist/integrations/claudemd.js +11 -2
  172. package/dist/integrations/gitignore.d.ts +16 -0
  173. package/dist/integrations/gitignore.js +7 -0
  174. package/dist/integrations/health.d.ts +74 -0
  175. package/dist/integrations/hooks.d.ts +41 -0
  176. package/dist/integrations/hooks.js +92 -66
  177. package/dist/integrations/madrExport.d.ts +39 -0
  178. package/dist/integrations/madrManifest.d.ts +69 -0
  179. package/dist/integrations/mergeDriver.d.ts +3 -0
  180. package/dist/integrations/mergeDriver.js +25 -8
  181. package/dist/integrations/probe.d.ts +4 -0
  182. package/dist/integrations/providers.d.ts +103 -0
  183. package/dist/integrations/scaffold.d.ts +29 -0
  184. package/dist/integrations/sync.d.ts +30 -0
  185. package/dist/integrations/sync.js +3 -2
  186. package/dist/integrations/team.d.ts +70 -0
  187. package/dist/integrations/worktree.d.ts +8 -0
  188. package/dist/mcp/roots.d.ts +16 -0
  189. package/dist/mcp/server.d.ts +36 -0
  190. package/dist/mcp/server.js +74 -22
  191. package/dist/mcp/taskReportTools.d.ts +3 -0
  192. package/dist/mcp/taskReportTools.js +106 -0
  193. package/dist/serve/app.d.ts +36 -0
  194. package/dist/serve/config.d.ts +100 -0
  195. package/dist/serve/writelock.d.ts +22 -0
  196. package/dist/store/changeLedger.d.ts +132 -0
  197. package/dist/store/compact.d.ts +33 -0
  198. package/dist/store/db.d.ts +9 -0
  199. package/dist/store/embedder.d.ts +32 -0
  200. package/dist/store/hunchStore.d.ts +624 -0
  201. package/dist/store/hunchStore.js +6 -3
  202. package/dist/store/jsonStore.d.ts +125 -0
  203. package/dist/store/merge.d.ts +39 -0
  204. package/dist/store/privateMigrate.d.ts +24 -0
  205. package/dist/store/replay.d.ts +56 -0
  206. package/dist/store/schema.d.ts +17 -0
  207. package/dist/store/stateBinding.d.ts +145 -0
  208. package/dist/store/stateCapture.d.ts +15 -0
  209. package/dist/synthesis/cliAdapter.d.ts +22 -0
  210. package/dist/synthesis/initiator.d.ts +13 -0
  211. package/dist/synthesis/provider.d.ts +307 -0
  212. package/dist/synthesis/synthesize.d.ts +117 -0
  213. package/dist/synthesis/tripwires.d.ts +9 -0
  214. package/dist/taskReports.d.ts +76 -0
  215. package/dist/taskReports.js +67 -0
  216. package/dist/wiki/adopt.d.ts +22 -0
  217. package/dist/wiki/graph.d.ts +87 -0
  218. package/dist/wiki/wiki.d.ts +242 -0
  219. package/package.json +6 -5
  220. package/server.json +2 -2
@@ -0,0 +1,45 @@
1
+ import { z } from "zod";
2
+ import type { HunchStore } from "../store/hunchStore.js";
3
+ import { type G2BehaviorCandidateReview, type G2BehaviorHumanDisposition, type G2BehaviorReplayReceipt, type G2BehaviorReviewResolution } from "./g2BehaviorCandidates.js";
4
+ export declare const G2BehaviorDispositionSchema: z.ZodEnum<{
5
+ rejected: "rejected";
6
+ selected: "selected";
7
+ }>;
8
+ export declare const G2BehaviorAttestationSchema: z.ZodObject<{
9
+ id: z.ZodString;
10
+ content_hash: z.ZodString;
11
+ candidate_id: z.ZodString;
12
+ candidate_hash: z.ZodString;
13
+ commit: z.ZodString;
14
+ review_hash: z.ZodString;
15
+ replay_id: z.ZodString;
16
+ replay_hash: z.ZodString;
17
+ dependency_snapshot_ids: z.ZodArray<z.ZodString>;
18
+ disposition: z.ZodEnum<{
19
+ rejected: "rejected";
20
+ selected: "selected";
21
+ }>;
22
+ actor: z.ZodString;
23
+ reason: z.ZodString;
24
+ supersedes: z.ZodNullable<z.ZodString>;
25
+ data_class: z.ZodLiteral<"private">;
26
+ authority: z.ZodLiteral<"none">;
27
+ effects: z.ZodLiteral<"review_only">;
28
+ created_at: z.ZodString;
29
+ }, z.core.$strict>;
30
+ export type G2BehaviorAttestation = z.infer<typeof G2BehaviorAttestationSchema>;
31
+ export declare function g2BehaviorAttestationContentHash(attestation: G2BehaviorAttestation): string;
32
+ export declare function compileG2BehaviorAttestation(report: G2BehaviorCandidateReview, candidateId: string, reviewHash: string, replay: G2BehaviorReplayReceipt, disposition: G2BehaviorHumanDisposition, actor: string, reason: string, opts?: {
33
+ now?: string;
34
+ supersedes?: string | null;
35
+ }): G2BehaviorAttestation;
36
+ /** Resolve exact-behavior supersession chains without timestamp trust. */
37
+ export declare function currentG2BehaviorAttestations(records: G2BehaviorAttestation[]): G2BehaviorAttestation[];
38
+ export declare class G2BehaviorAttestationRepository {
39
+ private readonly store;
40
+ constructor(store: HunchStore);
41
+ list(): G2BehaviorAttestation[];
42
+ current(): G2BehaviorAttestation[];
43
+ resolutions(): G2BehaviorReviewResolution[];
44
+ put(attestation: G2BehaviorAttestation): G2BehaviorAttestation;
45
+ }
@@ -0,0 +1,123 @@
1
+ import type { HunchStore } from "../store/hunchStore.js";
2
+ import { type G2CandidateReviewOptions, type G2CandidateReviewResolution } from "./g2Candidates.js";
3
+ export type G2BehaviorRunnerKind = "node-test" | "node-test-tsx";
4
+ export type G2BehaviorHumanDisposition = "selected" | "rejected";
5
+ export interface G2BehaviorCandidateReviewOptions extends G2CandidateReviewOptions {
6
+ /** Build one finite review batch directly from an exact current human-confirmed
7
+ * decision instead of requiring a rejected structural proxy first. */
8
+ decisionId?: string;
9
+ }
10
+ export interface G2BehaviorReviewResolution {
11
+ id: string;
12
+ candidate_id: string;
13
+ candidate_hash: string;
14
+ review_hash: string;
15
+ replay_id: string;
16
+ replay_hash: string;
17
+ disposition: G2BehaviorHumanDisposition;
18
+ actor: string;
19
+ reason: string;
20
+ created_at: string;
21
+ }
22
+ export interface G2BehaviorCandidate {
23
+ id: string;
24
+ commit: string;
25
+ commit_subject: string;
26
+ commit_date: string;
27
+ statement: string;
28
+ test: {
29
+ file: string;
30
+ name: string;
31
+ source_hash: string;
32
+ };
33
+ runner: {
34
+ kind: G2BehaviorRunnerKind;
35
+ argv: string[];
36
+ };
37
+ decision_ids: string[];
38
+ source_candidate_ids: string[];
39
+ source_attestation_ids: string[];
40
+ proposed_corpus: {
41
+ known_bad: {
42
+ ref: string;
43
+ expected: "failed";
44
+ };
45
+ known_good: {
46
+ ref: string;
47
+ expected: "passed";
48
+ };
49
+ observed: false;
50
+ };
51
+ grounding: "rejected_proxy_plus_added_test" | "human_decision_plus_added_test" | "human_decision_plus_modified_test";
52
+ data_class: "private";
53
+ authority: "none";
54
+ writes: "none";
55
+ proof_status: "not_run";
56
+ human_review?: G2BehaviorReviewResolution;
57
+ }
58
+ export interface G2BehaviorCandidateReview {
59
+ id: string;
60
+ content_hash: string;
61
+ structural_review_hash: string;
62
+ since: string;
63
+ max_commits: number;
64
+ limit: number;
65
+ grounded_rejections_scanned: number;
66
+ candidate_commits: number;
67
+ behavior_candidates: number;
68
+ selected_candidates?: number;
69
+ rejected_candidates?: number;
70
+ unreviewed_candidates?: number;
71
+ commits_without_added_tests: string[];
72
+ extraction_failures: Array<{
73
+ commit: string;
74
+ file: string;
75
+ error: string;
76
+ }>;
77
+ items: G2BehaviorCandidate[];
78
+ has_more: boolean;
79
+ limitations: string[];
80
+ data_class: "private";
81
+ authority: "none";
82
+ writes: "none";
83
+ proof_status: "not_run";
84
+ grounding_mode?: "human_decision_plus_added_test";
85
+ source_decision_id?: string;
86
+ source_grounding_hash?: string;
87
+ }
88
+ export interface G2BehaviorReplayLeg {
89
+ commit: string;
90
+ expected: "failed" | "passed";
91
+ result: "failed" | "passed" | "error";
92
+ exit_code: number | null;
93
+ error_code?: string;
94
+ dependency_snapshot_id?: string;
95
+ }
96
+ export interface G2BehaviorReplayReceipt {
97
+ id: string;
98
+ content_hash: string;
99
+ candidate_id: string;
100
+ candidate_hash: string;
101
+ review_hash: string;
102
+ test: G2BehaviorCandidate["test"];
103
+ runner: G2BehaviorCandidate["runner"];
104
+ known_bad: G2BehaviorReplayLeg;
105
+ known_good: G2BehaviorReplayLeg;
106
+ verdict: "behavior_confirmed" | "inconclusive";
107
+ budget_ms: number;
108
+ limitations: string[];
109
+ data_class: "private";
110
+ authority: "none";
111
+ effects: "diagnostic_only";
112
+ writes: "disposable_only";
113
+ }
114
+ /** Extract literal node:test names without interpreting source or template expressions. */
115
+ export declare function addedNodeTestNames(source: string): string[];
116
+ export declare function g2BehaviorCandidateHash(candidate: G2BehaviorCandidate): string;
117
+ export declare function g2BehaviorReplayContentHash(receipt: G2BehaviorReplayReceipt): string;
118
+ export declare function g2BehaviorReviewContentHash(report: G2BehaviorCandidateReview): string;
119
+ export declare function buildG2BehaviorCandidateReview(store: HunchStore, root: string, opts?: G2BehaviorCandidateReviewOptions, resolutions?: G2CandidateReviewResolution[], behaviorResolutions?: G2BehaviorReviewResolution[]): G2BehaviorCandidateReview;
120
+ export declare function nodeTestInfrastructureError(output: string): string | null;
121
+ export declare function replayG2BehaviorCandidate(root: string, report: G2BehaviorCandidateReview, candidateId: string, reviewHash: string, opts?: {
122
+ timeoutMs?: number;
123
+ }): G2BehaviorReplayReceipt;
@@ -0,0 +1,83 @@
1
+ import type { G2BehaviorCandidate, G2BehaviorCandidateReview } from "./g2BehaviorCandidates.js";
2
+ export interface G2BehaviorDependencySnapshot {
3
+ id: string;
4
+ content_hash: string;
5
+ input_hash: string;
6
+ package_json_hash: string;
7
+ sanitized_package_json_hash: string;
8
+ package_lock_hash: string;
9
+ dependency_projection_hash: string;
10
+ runtime: {
11
+ node: string;
12
+ npm: string;
13
+ platform: NodeJS.Platform;
14
+ arch: string;
15
+ };
16
+ allow_install_scripts: string[];
17
+ installed_lock_hash: string;
18
+ native_binaries: Array<{
19
+ file: string;
20
+ sha256: string;
21
+ }>;
22
+ node_modules_hash: string;
23
+ format_version: 2;
24
+ data_class: "private";
25
+ authority: "none";
26
+ effects: "cache_only";
27
+ writes: "cache_only";
28
+ }
29
+ export interface G2BehaviorDependencySnapshotReceipt {
30
+ id: string;
31
+ content_hash: string;
32
+ candidate_id: string;
33
+ candidate_hash: string;
34
+ review_hash: string;
35
+ snapshots: G2BehaviorDependencySnapshot[];
36
+ legs: {
37
+ known_bad: {
38
+ commit: string;
39
+ dependency_snapshot_id: string;
40
+ };
41
+ known_good: {
42
+ commit: string;
43
+ dependency_snapshot_id: string;
44
+ };
45
+ };
46
+ allow_install_scripts: string[];
47
+ data_class: "private";
48
+ authority: "none";
49
+ effects: "cache_only";
50
+ writes: "cache_only";
51
+ }
52
+ export interface G2BehaviorDependencyCommitSnapshots {
53
+ snapshots: G2BehaviorDependencySnapshot[];
54
+ commits: Array<{
55
+ commit: string;
56
+ dependency_snapshot_id: string;
57
+ }>;
58
+ }
59
+ /** Hash every directory, regular file, executable bit, and internal symlink in
60
+ * a dependency tree. Traversal uses raw UTF-8 byte ordering rather than the
61
+ * host locale, and rejects filesystem shapes that cannot be copied safely. */
62
+ export declare function dependencySnapshotTreeHash(nodeModules: string): string;
63
+ /** Create one independently writable dependency tree. COPYFILE_FICLONE is a
64
+ * copy-on-write optimization where supported, never a shared hardlink; the
65
+ * byte-copy fallback has the same isolation. Pre/post hashes bind the copy. */
66
+ export declare function materializeDependencyTree(source: string, destination: string, opts?: {
67
+ expectedHash?: string;
68
+ }): string;
69
+ /** Materialize a private writable dependency tree for one disposable run. */
70
+ export declare function materializeDependencySnapshot(dependency: {
71
+ snapshot: Pick<G2BehaviorDependencySnapshot, "id" | "node_modules_hash">;
72
+ nodeModules: string;
73
+ }, destination: string): void;
74
+ export declare function dependencySnapshotById(root: string, id: string): {
75
+ snapshot: G2BehaviorDependencySnapshot;
76
+ nodeModules: string;
77
+ } | null;
78
+ export declare function dependencySnapshotForCommit(root: string, commit: string, allowedIds?: string[]): {
79
+ snapshot: G2BehaviorDependencySnapshot;
80
+ nodeModules: string;
81
+ } | null;
82
+ export declare function provisionG2BehaviorDependencySnapshotsForCommits(root: string, commits: string[], allowInstallScripts?: string[], timeoutMs?: number): G2BehaviorDependencyCommitSnapshots;
83
+ export declare function provisionG2BehaviorDependencySnapshots(root: string, report: G2BehaviorCandidateReview, candidate: G2BehaviorCandidate, allowInstallScripts?: string[], timeoutMs?: number): G2BehaviorDependencySnapshotReceipt;
@@ -0,0 +1,77 @@
1
+ import { z } from "zod";
2
+ import { type G2BehaviorCandidateReview } from "./g2BehaviorCandidates.js";
3
+ import { type G2BehaviorAttestation } from "./g2BehaviorAttestation.js";
4
+ export declare const G2BehaviorMaterializationAssessmentSchema: z.ZodObject<{
5
+ id: z.ZodString;
6
+ content_hash: z.ZodString;
7
+ source_review: z.ZodObject<{
8
+ id: z.ZodString;
9
+ content_hash: z.ZodString;
10
+ structural_review_hash: z.ZodString;
11
+ grounding_mode: z.ZodOptional<z.ZodLiteral<"human_decision_plus_added_test">>;
12
+ source_decision_id: z.ZodOptional<z.ZodString>;
13
+ source_grounding_hash: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strict>;
15
+ policy_ir_version: z.ZodLiteral<2>;
16
+ evaluator: z.ZodObject<{
17
+ name: z.ZodLiteral<"hunch-executable-behavior">;
18
+ version: z.ZodLiteral<"1.0.0">;
19
+ }, z.core.$strict>;
20
+ supported_assertion_kinds: z.ZodArray<z.ZodEnum<{
21
+ exists: "exists";
22
+ reaches: "reaches";
23
+ "not-reaches": "not-reaches";
24
+ "must-pass-through": "must-pass-through";
25
+ "executable-behavior": "executable-behavior";
26
+ }>>;
27
+ selected_attestations: z.ZodNumber;
28
+ materialized_policies: z.ZodLiteral<0>;
29
+ readiness: z.ZodLiteral<"ready_for_materialization">;
30
+ items: z.ZodArray<z.ZodObject<{
31
+ candidate_id: z.ZodString;
32
+ candidate_hash: z.ZodString;
33
+ attestation_id: z.ZodString;
34
+ attestation_hash: z.ZodString;
35
+ attested_review_hash: z.ZodString;
36
+ replay_id: z.ZodString;
37
+ replay_hash: z.ZodString;
38
+ dependency_snapshot_ids: z.ZodArray<z.ZodString>;
39
+ commit: z.ZodString;
40
+ test: z.ZodObject<{
41
+ file: z.ZodString;
42
+ name: z.ZodString;
43
+ source_hash: z.ZodString;
44
+ }, z.core.$strict>;
45
+ durable_meaning: z.ZodString;
46
+ status: z.ZodLiteral<"ready_for_materialization">;
47
+ reason: z.ZodString;
48
+ required_capability: z.ZodObject<{
49
+ assertion: z.ZodLiteral<"executable-behavior">;
50
+ current_baseline: z.ZodLiteral<"required">;
51
+ known_bad: z.ZodLiteral<"must_fail_behaviorally">;
52
+ known_good: z.ZodLiteral<"must_pass">;
53
+ mutation_controls: z.ZodLiteral<"required">;
54
+ }, z.core.$strict>;
55
+ }, z.core.$strict>>;
56
+ outputs: z.ZodObject<{
57
+ policies: z.ZodArray<z.ZodNever>;
58
+ corpora: z.ZodArray<z.ZodNever>;
59
+ plans: z.ZodArray<z.ZodNever>;
60
+ proofs: z.ZodArray<z.ZodNever>;
61
+ }, z.core.$strict>;
62
+ limitations: z.ZodArray<z.ZodString>;
63
+ data_class: z.ZodLiteral<"private">;
64
+ authority: z.ZodLiteral<"none">;
65
+ effects: z.ZodLiteral<"assessment_only">;
66
+ writes: z.ZodLiteral<"none">;
67
+ proof_status: z.ZodLiteral<"not_run">;
68
+ activation: z.ZodLiteral<"separate_human_action_required">;
69
+ }, z.core.$strict>;
70
+ export type G2BehaviorMaterializationAssessment = z.infer<typeof G2BehaviorMaterializationAssessmentSchema>;
71
+ export declare function g2BehaviorMaterializationContentHash(assessment: G2BehaviorMaterializationAssessment): string;
72
+ /**
73
+ * Assess exact selected behavior receipts against the currently implemented
74
+ * Policy IR. This is intentionally fail-closed: it never substitutes a static
75
+ * symbol or edge proxy for behavior that the evaluator cannot execute.
76
+ */
77
+ export declare function assessG2BehaviorMaterialization(report: G2BehaviorCandidateReview, currentAttestations: G2BehaviorAttestation[]): G2BehaviorMaterializationAssessment;
@@ -0,0 +1,48 @@
1
+ import { z } from "zod";
2
+ import type { HunchStore } from "../store/hunchStore.js";
3
+ import { type G2BehaviorCandidateReview } from "./g2BehaviorCandidates.js";
4
+ import type { G2BehaviorAttestation } from "./g2BehaviorAttestation.js";
5
+ import type { PolicyRepository } from "./repository.js";
6
+ export declare const G2BehaviorPolicyMaterializationSchema: z.ZodObject<{
7
+ id: z.ZodString;
8
+ content_hash: z.ZodString;
9
+ assessment_id: z.ZodString;
10
+ assessment_hash: z.ZodString;
11
+ source_review_id: z.ZodString;
12
+ source_review_hash: z.ZodString;
13
+ current_commit: z.ZodString;
14
+ dependency_snapshots: z.ZodArray<z.ZodObject<{
15
+ id: z.ZodString;
16
+ content_hash: z.ZodString;
17
+ }, z.core.$strict>>;
18
+ materialized_policies: z.ZodNumber;
19
+ items: z.ZodArray<z.ZodObject<{
20
+ candidate_id: z.ZodString;
21
+ attestation_id: z.ZodString;
22
+ policy_id: z.ZodString;
23
+ policy_hash: z.ZodString;
24
+ corpus_id: z.ZodString;
25
+ corpus_hash: z.ZodString;
26
+ plan_id: z.ZodString;
27
+ plan_hash: z.ZodString;
28
+ proof_id: z.ZodString;
29
+ proof_hash: z.ZodString;
30
+ proof_class: z.ZodLiteral<"P3">;
31
+ policy_state: z.ZodEnum<{
32
+ proposed: "proposed";
33
+ active_advisory: "active_advisory";
34
+ active_blocking: "active_blocking";
35
+ }>;
36
+ }, z.core.$strict>>;
37
+ data_class: z.ZodLiteral<"private">;
38
+ authority: z.ZodLiteral<"none">;
39
+ effects: z.ZodLiteral<"policy_proposal_only">;
40
+ writes: z.ZodLiteral<"private_policy_artifacts">;
41
+ activation: z.ZodLiteral<"separate_human_action_required">;
42
+ }, z.core.$strict>;
43
+ export type G2BehaviorPolicyMaterialization = z.infer<typeof G2BehaviorPolicyMaterializationSchema>;
44
+ export declare function materializeSelectedG2BehaviorPolicies(store: HunchStore, root: string, repository: PolicyRepository, report: G2BehaviorCandidateReview, currentAttestations: G2BehaviorAttestation[], opts?: {
45
+ now?: string;
46
+ allowInstallScripts?: string[];
47
+ dependencyTimeoutMs?: number;
48
+ }): G2BehaviorPolicyMaterialization;
@@ -0,0 +1,43 @@
1
+ import { z } from "zod";
2
+ import type { HunchStore } from "../store/hunchStore.js";
3
+ import { type G2CandidateHumanDisposition, type G2CandidateReviewReport, type G2CandidateReviewResolution } from "./g2Candidates.js";
4
+ export declare const G2CandidateDispositionSchema: z.ZodEnum<{
5
+ rejected: "rejected";
6
+ selected: "selected";
7
+ }>;
8
+ export declare const G2CandidateAttestationSchema: z.ZodObject<{
9
+ id: z.ZodString;
10
+ content_hash: z.ZodString;
11
+ candidate_id: z.ZodString;
12
+ candidate_hash: z.ZodString;
13
+ structural_candidate_id: z.ZodString;
14
+ commit: z.ZodString;
15
+ review_hash: z.ZodString;
16
+ disposition: z.ZodEnum<{
17
+ rejected: "rejected";
18
+ selected: "selected";
19
+ }>;
20
+ actor: z.ZodString;
21
+ reason: z.ZodString;
22
+ supersedes: z.ZodNullable<z.ZodString>;
23
+ data_class: z.ZodLiteral<"private">;
24
+ authority: z.ZodLiteral<"none">;
25
+ effects: z.ZodLiteral<"review_only">;
26
+ created_at: z.ZodString;
27
+ }, z.core.$strict>;
28
+ export type G2CandidateAttestation = z.infer<typeof G2CandidateAttestationSchema>;
29
+ export declare function g2CandidateAttestationContentHash(attestation: G2CandidateAttestation): string;
30
+ export declare function compileG2CandidateAttestation(report: G2CandidateReviewReport, candidateId: string, reviewHash: string, disposition: G2CandidateHumanDisposition, actor: string, reason: string, opts?: {
31
+ now?: string;
32
+ supersedes?: string | null;
33
+ }): G2CandidateAttestation;
34
+ /** Resolve exact-candidate supersession chains without timestamp trust. */
35
+ export declare function currentG2CandidateAttestations(records: G2CandidateAttestation[]): G2CandidateAttestation[];
36
+ export declare class G2CandidateAttestationRepository {
37
+ private readonly store;
38
+ constructor(store: HunchStore);
39
+ list(): G2CandidateAttestation[];
40
+ current(): G2CandidateAttestation[];
41
+ resolutions(): G2CandidateReviewResolution[];
42
+ put(attestation: G2CandidateAttestation): G2CandidateAttestation;
43
+ }
@@ -0,0 +1,80 @@
1
+ import { HunchStore } from "../store/hunchStore.js";
2
+ import type { PolicyAssertion, PolicyScope } from "./schema.js";
3
+ export type G2CandidateAttestationStatus = "human_grounded_exact" | "human_grounded_needs_selection" | "unattested_structural_coincidence";
4
+ export type G2CandidateHumanDisposition = "selected" | "rejected";
5
+ export interface G2CandidateReviewResolution {
6
+ id: string;
7
+ candidate_id: string;
8
+ candidate_hash: string;
9
+ review_hash: string;
10
+ disposition: G2CandidateHumanDisposition;
11
+ actor: string;
12
+ reason: string;
13
+ created_at: string;
14
+ }
15
+ export interface G2CandidateReviewItem {
16
+ id: string;
17
+ candidate_id: string;
18
+ commit: string;
19
+ commit_subject: string;
20
+ commit_date: string;
21
+ changed_files: string[];
22
+ sibling_candidates: number;
23
+ basis: "added-call" | "removed-call" | "added-symbol" | "removed-import" | "added-relative-import" | "removed-relative-import";
24
+ reason: string;
25
+ assertion: PolicyAssertion;
26
+ scope: PolicyScope;
27
+ proposed_corpus: {
28
+ known_bad: {
29
+ ref: string;
30
+ expected: "violated";
31
+ };
32
+ known_good: {
33
+ ref: string;
34
+ expected: "satisfied";
35
+ };
36
+ observed: false;
37
+ };
38
+ attestation: {
39
+ status: G2CandidateAttestationStatus;
40
+ decision_ids: string[];
41
+ };
42
+ human_review: G2CandidateReviewResolution | null;
43
+ }
44
+ export interface G2CandidateReviewReport {
45
+ id: string;
46
+ content_hash: string;
47
+ since: string;
48
+ max_commits: number;
49
+ limit: number;
50
+ scanned_fix_commits: number;
51
+ candidate_commits: number;
52
+ total_candidates: number;
53
+ human_grounded_exact: number;
54
+ human_grounded_needs_selection: number;
55
+ unattested_structural_coincidence: number;
56
+ selected_candidates: number;
57
+ rejected_candidates: number;
58
+ unreviewed_candidates: number;
59
+ extraction_failures: Array<{
60
+ commit: string;
61
+ error: string;
62
+ }>;
63
+ items: G2CandidateReviewItem[];
64
+ has_more: boolean;
65
+ data_class: "private";
66
+ authority: "none";
67
+ writes: "none";
68
+ proof_status: "not_run";
69
+ }
70
+ export interface G2CandidateReviewOptions {
71
+ since?: string;
72
+ maxCommits?: number;
73
+ limit?: number;
74
+ }
75
+ export declare function g2CandidateItemHash(item: G2CandidateReviewItem): string;
76
+ export declare function g2CandidateReviewContentHash(report: G2CandidateReviewReport): string;
77
+ export declare function positiveBound(value: number, label: string, max: number): number;
78
+ /** Read-only review packet. Structural facts propose corpus pairs but cannot
79
+ * become policy evidence until an exact human judgment selects their semantics. */
80
+ export declare function buildG2CandidateReview(store: HunchStore, root: string, opts?: G2CandidateReviewOptions, resolutions?: G2CandidateReviewResolution[]): G2CandidateReviewReport;
@@ -0,0 +1,33 @@
1
+ import type { Runbook } from "../core/types.js";
2
+ import type { G2Plan, G2RunbookCategory } from "./g2.js";
3
+ interface DrillSpec {
4
+ file: string;
5
+ name: string;
6
+ }
7
+ export declare const G2_OPERATIONAL_DRILLS: Record<G2RunbookCategory, DrillSpec>;
8
+ export interface G2OperationalDrillReceipt {
9
+ id: string;
10
+ content_hash: string;
11
+ category: G2RunbookCategory;
12
+ plan_id: string;
13
+ runbook_id: string;
14
+ runbook_hash: string;
15
+ test: DrillSpec & {
16
+ source_hash: string;
17
+ };
18
+ runner: {
19
+ name: "node-test-tsx";
20
+ isolation_flag: string;
21
+ };
22
+ result: "passed" | "failed" | "error";
23
+ exit_code: number | null;
24
+ selected_event: "passed" | "failed" | null;
25
+ error_code?: string;
26
+ log_hash: string;
27
+ data_class: "private";
28
+ authority: "none";
29
+ effects: "diagnostic_only";
30
+ writes: "none";
31
+ }
32
+ export declare function executeG2OperationalDrill(root: string, plan: G2Plan, runbook: Runbook, category: G2RunbookCategory, timeoutMs?: number): G2OperationalDrillReceipt;
33
+ export {};