@davesheffer/hunch 1.31.0 → 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 (228) hide show
  1. package/README.md +3 -6
  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/client/state.js +2 -0
  18. package/dist/constitution/adapters.d.ts +29 -0
  19. package/dist/constitution/behaviorAttestationBinding.d.ts +3 -0
  20. package/dist/constitution/behaviorEvaluator.d.ts +8 -0
  21. package/dist/constitution/behaviorProof.d.ts +9 -0
  22. package/dist/constitution/behaviorWorkspace.d.ts +25 -0
  23. package/dist/constitution/bootstrap.d.ts +30 -0
  24. package/dist/constitution/canonical.d.ts +15 -0
  25. package/dist/constitution/card.d.ts +58 -0
  26. package/dist/constitution/compiler.d.ts +52 -0
  27. package/dist/constitution/composition.d.ts +10 -0
  28. package/dist/constitution/corpus.d.ts +7 -0
  29. package/dist/constitution/correctionPolicyMaterializer.d.ts +57 -0
  30. package/dist/constitution/delta.d.ts +4 -0
  31. package/dist/constitution/disposition.d.ts +20 -0
  32. package/dist/constitution/evaluator.d.ts +47 -0
  33. package/dist/constitution/experiment.d.ts +466 -0
  34. package/dist/constitution/experimentRunner.d.ts +7 -0
  35. package/dist/constitution/g2.d.ts +209 -0
  36. package/dist/constitution/g2BehaviorAttestation.d.ts +45 -0
  37. package/dist/constitution/g2BehaviorCandidates.d.ts +123 -0
  38. package/dist/constitution/g2BehaviorDependencies.d.ts +83 -0
  39. package/dist/constitution/g2BehaviorMaterialization.d.ts +77 -0
  40. package/dist/constitution/g2BehaviorPolicyMaterializer.d.ts +48 -0
  41. package/dist/constitution/g2CandidateAttestation.d.ts +43 -0
  42. package/dist/constitution/g2Candidates.d.ts +80 -0
  43. package/dist/constitution/g2Drills.d.ts +33 -0
  44. package/dist/constitution/g3.d.ts +311 -0
  45. package/dist/constitution/g3Conformance.d.ts +33 -0
  46. package/dist/constitution/lifecycle.d.ts +25 -0
  47. package/dist/constitution/mutation.d.ts +15 -0
  48. package/dist/constitution/nodeTestEvidence.d.ts +13 -0
  49. package/dist/constitution/plan.d.ts +18 -0
  50. package/dist/constitution/policyRuntime.d.ts +5 -0
  51. package/dist/constitution/proof.d.ts +11 -0
  52. package/dist/constitution/repairPolicies.d.ts +34 -0
  53. package/dist/constitution/replacementFreeGit.d.ts +14 -0
  54. package/dist/constitution/replay.d.ts +40 -0
  55. package/dist/constitution/replayCache.d.ts +14 -0
  56. package/dist/constitution/replayWorker.d.ts +1 -0
  57. package/dist/constitution/repository.d.ts +129 -0
  58. package/dist/constitution/safeCheckout.d.ts +9 -0
  59. package/dist/constitution/schema.d.ts +1763 -0
  60. package/dist/constitution/scorecard.d.ts +219 -0
  61. package/dist/constitution/service.d.ts +398 -0
  62. package/dist/constitution/shadow.d.ts +54 -0
  63. package/dist/constitution/sourceMutation.d.ts +15 -0
  64. package/dist/constitution/staticGraphBaseline.d.ts +13 -0
  65. package/dist/constitution/structural.d.ts +64 -0
  66. package/dist/core/agenthook.d.ts +63 -0
  67. package/dist/core/agenthook.js +1 -0
  68. package/dist/core/automaticReviewMemory.d.ts +60 -0
  69. package/dist/core/autoreview.d.ts +66 -0
  70. package/dist/core/canonicalOrder.d.ts +3 -0
  71. package/dist/core/capturetoken.d.ts +19 -0
  72. package/dist/core/changeIdentity.d.ts +22 -0
  73. package/dist/core/changeProof.d.ts +14 -0
  74. package/dist/core/checkreport.d.ts +140 -0
  75. package/dist/core/commitrepair.d.ts +171 -0
  76. package/dist/core/commitrepair.js +238 -0
  77. package/dist/core/compare.d.ts +21 -0
  78. package/dist/core/config.d.ts +20 -0
  79. package/dist/core/conformance.d.ts +35 -0
  80. package/dist/core/constraintmatch.d.ts +54 -0
  81. package/dist/core/correction.d.ts +42 -0
  82. package/dist/core/correctionStage.d.ts +224 -0
  83. package/dist/core/declarationClusters.d.ts +149 -0
  84. package/dist/core/delivery.d.ts +110 -0
  85. package/dist/core/docanchors.d.ts +32 -0
  86. package/dist/core/docscan.d.ts +26 -0
  87. package/dist/core/drift.d.ts +13 -0
  88. package/dist/core/drift.js +31 -1
  89. package/dist/core/dupdetect.d.ts +43 -0
  90. package/dist/core/escalations.d.ts +129 -0
  91. package/dist/core/escalations.js +165 -0
  92. package/dist/core/events.d.ts +29 -0
  93. package/dist/core/evidenceMap.d.ts +164 -0
  94. package/dist/core/externalImports.d.ts +8 -0
  95. package/dist/core/format.d.ts +13 -0
  96. package/dist/core/glob.d.ts +9 -0
  97. package/dist/core/groundingLag.d.ts +84 -0
  98. package/dist/core/groundingLag.js +16 -2
  99. package/dist/core/groundingMerge.d.ts +15 -0
  100. package/dist/core/groundingMerge.js +95 -0
  101. package/dist/core/hookcache.d.ts +10 -0
  102. package/dist/core/hookpolicy.d.ts +47 -0
  103. package/dist/core/ids.d.ts +36 -0
  104. package/dist/core/importReview.d.ts +30 -0
  105. package/dist/core/io.d.ts +23 -0
  106. package/dist/core/jsonc.d.ts +4 -0
  107. package/dist/core/landscapeAdoption.d.ts +66 -0
  108. package/dist/core/landscapeDelivery.d.ts +76 -0
  109. package/dist/core/memorylog.d.ts +37 -0
  110. package/dist/core/migrate.d.ts +28 -0
  111. package/dist/core/outcomeExperience.d.ts +89 -0
  112. package/dist/core/overlaySafety.d.ts +24 -0
  113. package/dist/core/overlaySafety.js +7 -1
  114. package/dist/core/paths.d.ts +31 -0
  115. package/dist/core/pipeline.d.ts +289 -0
  116. package/dist/core/premises.d.ts +43 -0
  117. package/dist/core/provenance.d.ts +21 -0
  118. package/dist/core/publication.d.ts +54 -0
  119. package/dist/core/refrepair.d.ts +24 -0
  120. package/dist/core/refrepair.js +1 -1
  121. package/dist/core/relativeImports.d.ts +11 -0
  122. package/dist/core/repair.d.ts +44 -0
  123. package/dist/core/repairqueue.d.ts +40 -0
  124. package/dist/core/repairqueue.js +133 -0
  125. package/dist/core/reviewMemory.d.ts +40 -0
  126. package/dist/core/reviewqueue.d.ts +54 -0
  127. package/dist/core/safeRepoFile.d.ts +20 -0
  128. package/dist/core/served.d.ts +57 -0
  129. package/dist/core/served.js +14 -0
  130. package/dist/core/stateContract.d.ts +979 -0
  131. package/dist/core/stateContract.js +87 -4
  132. package/dist/core/stateDelivery.d.ts +78 -0
  133. package/dist/core/stateRecords.d.ts +383 -0
  134. package/dist/core/stateRecords.js +16 -1
  135. package/dist/core/stats.d.ts +88 -0
  136. package/dist/core/strictgate.d.ts +33 -0
  137. package/dist/core/taskReport.d.ts +226 -0
  138. package/dist/core/taskReport.js +514 -0
  139. package/dist/core/taskReportCapture.d.ts +8 -0
  140. package/dist/core/taskReportCapture.js +36 -0
  141. package/dist/core/taskReportEvidence.d.ts +26 -0
  142. package/dist/core/taskReportEvidence.js +268 -0
  143. package/dist/core/taskReportHook.d.ts +20 -0
  144. package/dist/core/taskReportHook.js +76 -0
  145. package/dist/core/taskReportPaths.d.ts +3 -0
  146. package/dist/core/taskReportPaths.js +23 -0
  147. package/dist/core/taskReportPublic.d.ts +31 -0
  148. package/dist/core/taskReportPublic.js +45 -0
  149. package/dist/core/taskReportRender.d.ts +6 -0
  150. package/dist/core/taskReportRender.js +97 -0
  151. package/dist/core/topics.d.ts +73 -0
  152. package/dist/core/types.d.ts +1239 -0
  153. package/dist/core/version.d.ts +10 -0
  154. package/dist/eval/guards.d.ts +45 -0
  155. package/dist/eval/harness.d.ts +58 -0
  156. package/dist/extractors/adrImport.d.ts +59 -0
  157. package/dist/extractors/comments.d.ts +7 -0
  158. package/dist/extractors/correctionSources.d.ts +11 -0
  159. package/dist/extractors/diff.d.ts +40 -0
  160. package/dist/extractors/git.d.ts +304 -0
  161. package/dist/extractors/git.js +208 -20
  162. package/dist/extractors/helm.d.ts +31 -0
  163. package/dist/extractors/indexer.d.ts +55 -0
  164. package/dist/extractors/landscapeDiscovery.d.ts +41 -0
  165. package/dist/extractors/languages.d.ts +77 -0
  166. package/dist/extractors/nativeTreeSitter.d.ts +16 -0
  167. package/dist/extractors/parse.d.ts +54 -0
  168. package/dist/extractors/php.d.ts +26 -0
  169. package/dist/extractors/repoSource.d.ts +53 -0
  170. package/dist/extractors/testreport.d.ts +36 -0
  171. package/dist/integrations/ciAction.d.ts +8 -0
  172. package/dist/integrations/claudeConfig.d.ts +44 -0
  173. package/dist/integrations/claudemd.d.ts +13 -0
  174. package/dist/integrations/claudemd.js +11 -2
  175. package/dist/integrations/gitignore.d.ts +16 -0
  176. package/dist/integrations/gitignore.js +7 -0
  177. package/dist/integrations/health.d.ts +74 -0
  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 +114 -25
  194. package/dist/mcp/taskReportTools.d.ts +3 -0
  195. package/dist/mcp/taskReportTools.js +106 -0
  196. package/dist/serve/app.d.ts +36 -0
  197. package/dist/serve/app.js +20 -0
  198. package/dist/serve/config.d.ts +100 -0
  199. package/dist/serve/writelock.d.ts +22 -0
  200. package/dist/store/changeLedger.d.ts +132 -0
  201. package/dist/store/changeLedger.js +40 -9
  202. package/dist/store/compact.d.ts +33 -0
  203. package/dist/store/db.d.ts +9 -0
  204. package/dist/store/embedder.d.ts +32 -0
  205. package/dist/store/hunchStore.d.ts +624 -0
  206. package/dist/store/hunchStore.js +13 -5
  207. package/dist/store/jsonStore.d.ts +125 -0
  208. package/dist/store/jsonStore.js +15 -0
  209. package/dist/store/merge.d.ts +39 -0
  210. package/dist/store/privateMigrate.d.ts +24 -0
  211. package/dist/store/replay.d.ts +56 -0
  212. package/dist/store/schema.d.ts +17 -0
  213. package/dist/store/stateBinding.d.ts +145 -0
  214. package/dist/store/stateBinding.js +110 -15
  215. package/dist/store/stateCapture.d.ts +15 -0
  216. package/dist/store/stateCapture.js +145 -0
  217. package/dist/synthesis/cliAdapter.d.ts +22 -0
  218. package/dist/synthesis/initiator.d.ts +13 -0
  219. package/dist/synthesis/provider.d.ts +307 -0
  220. package/dist/synthesis/synthesize.d.ts +117 -0
  221. package/dist/synthesis/tripwires.d.ts +9 -0
  222. package/dist/taskReports.d.ts +76 -0
  223. package/dist/taskReports.js +67 -0
  224. package/dist/wiki/adopt.d.ts +22 -0
  225. package/dist/wiki/graph.d.ts +87 -0
  226. package/dist/wiki/wiki.d.ts +242 -0
  227. package/package.json +6 -5
  228. package/server.json +2 -2
@@ -0,0 +1,88 @@
1
+ /** `hunch stats` — the ONE data contract (dec_6253f7e6d6). A pure aggregation over
2
+ * the graph Hunch already builds plus the append-only catch-log (core/events.ts):
3
+ * STOCK (what's accumulated) → RETURN (what that stock caught) → COMPOUNDING (the
4
+ * ratio that should climb). Every surface — CLI receipt, VS Code extension, the
5
+ * public proof-curve — is a read-only pane of glass over this object; if a number
6
+ * can't come from here it doesn't exist.
7
+ *
8
+ * HONESTY (the red-team baked into the decision): nothing here fabricates a number
9
+ * the live graph can't produce. `coverage.pct` is 0 until decisions actually carry
10
+ * `related_components`; `bugs_reprevented` is 0 until a bug reaches `regressed`;
11
+ * catches come only from real gate events, never a hypothetical. A skeptic running
12
+ * this on a young graph SHOULD see zeros — that's the honest state, not a bug. */
13
+ import type { Bug, Constraint, Decision } from "./types.js";
14
+ import type { HunchEvent } from "./events.js";
15
+ export interface StatsInput {
16
+ decisions: Decision[];
17
+ constraints: Constraint[];
18
+ bugs: Bug[];
19
+ /** Component ids in the graph (for coverage = decisions-touching ÷ total). */
20
+ componentIds: string[];
21
+ runbooksCount: number;
22
+ events: HunchEvent[];
23
+ /** Count of constraints whose guarded code moved since last verified (from the
24
+ * store's staleness walk — passed in so this module stays pure). */
25
+ staleConstraints: number;
26
+ /** ms epoch "now" and the start of the recent window (now − since). */
27
+ now: number;
28
+ windowStart: number;
29
+ windowLabel: string;
30
+ }
31
+ export interface StatsReturn {
32
+ violations_caught: number;
33
+ drifts_flagged: number;
34
+ bugs_reprevented: number;
35
+ vetoes_fired: number;
36
+ }
37
+ export interface Stats {
38
+ schema: "hunch.stats/1";
39
+ generated_at: string;
40
+ window: {
41
+ since: string;
42
+ from: string;
43
+ to: string;
44
+ };
45
+ stock: {
46
+ decisions: {
47
+ total: number;
48
+ accepted: number;
49
+ superseded: number;
50
+ proposed: number;
51
+ rejected: number;
52
+ };
53
+ invariants: {
54
+ total: number;
55
+ locked: number;
56
+ advisory: number;
57
+ stale: number;
58
+ };
59
+ components: number;
60
+ bugs: {
61
+ total: number;
62
+ open: number;
63
+ investigating: number;
64
+ fixed: number;
65
+ regressed: number;
66
+ };
67
+ runbooks: number;
68
+ coverage: {
69
+ components_with_decision: number;
70
+ components_total: number;
71
+ pct: number;
72
+ };
73
+ };
74
+ return: {
75
+ window: StatsReturn;
76
+ lifetime: StatsReturn;
77
+ };
78
+ compounding: {
79
+ rules_recorded: number;
80
+ catches_lifetime: number;
81
+ payback_ratio: number;
82
+ };
83
+ }
84
+ export declare function computeStats(input: StatsInput): Stats;
85
+ /** Human-readable receipt for the terminal (the CLI's default, non-`--json` output).
86
+ * Same three blocks as the JSON: stock → return → compounding. Honest zeros are
87
+ * shown plainly, never hidden — a young graph reads as young, not as broken. */
88
+ export declare function formatStats(s: Stats): string;
@@ -0,0 +1,33 @@
1
+ export declare const STRICT_MIN_CONFIDENCE = 0.8;
2
+ /** Is a provenance source HUMAN-CONFIRMED? Token-aware, so a composite source like
3
+ * "llm_draft+human_confirmed" counts, but a lookalike ("not_human_confirmed",
4
+ * "human_confirmed_pending") does not. The sources Hunch writes are "+"-joined. */
5
+ export declare function isHumanConfirmed(source: string | undefined): boolean;
6
+ export interface StrictConstraint {
7
+ severity?: string;
8
+ provenance?: {
9
+ confidence?: number;
10
+ source?: string;
11
+ };
12
+ }
13
+ /** May this invariant FAIL a commit under --strict? Requires blocking severity,
14
+ * a fresh (non-stale) record, and either high provenance confidence or a
15
+ * human-confirmed source (a person vouched for it). Near/blast-radius hits never
16
+ * reach here — the caller passes only directly-scoped invariants. */
17
+ export declare function isStrictBlocker(c: StrictConstraint, stale: boolean): boolean;
18
+ export type VetoTier = "dep" | "symbol" | "pattern" | "semantic";
19
+ /** May a VETO fail a commit? Sibling of isStrictBlocker, but keys on the TRIPWIRE's
20
+ * trust — not the rejecting decision's — and uses ONE rule for every tier: only a
21
+ * `human_confirmed` tripwire blocks. An llm_draft tripwire never blocks regardless
22
+ * of confidence (an LLM self-score is not a licence to fail a commit); it only
23
+ * warns. Semantic similarity never blocks. In-force + non-stale gates run first.
24
+ * This is what makes the "day-one is advisory" DX true (dec_a466655539). */
25
+ export declare function isVetoBlocker(d: {
26
+ status?: string;
27
+ superseded_by?: string | null;
28
+ valid_to?: string | null;
29
+ }, tw: {
30
+ provenance?: {
31
+ source?: string;
32
+ };
33
+ }, tier: VetoTier, stale: boolean): boolean;
@@ -0,0 +1,226 @@
1
+ import { z } from "zod";
2
+ import { type DeliveryEnvelope } from "./delivery.js";
3
+ export declare const TASK_REPORT_SCHEMA: "hunch.task-report/1";
4
+ export declare const TaskIdSchema: z.ZodString;
5
+ export declare function reportHash(value: unknown): string;
6
+ export declare const ReportRecordSchema: z.ZodObject<{
7
+ record_id: z.ZodString;
8
+ kind: z.ZodString;
9
+ content_hash: z.ZodString;
10
+ title: z.ZodString;
11
+ lesson: z.ZodString;
12
+ recorded_at: z.ZodNullable<z.ZodString>;
13
+ }, z.core.$strict>;
14
+ export type ReportRecord = z.infer<typeof ReportRecordSchema>;
15
+ export declare const ReportClaimSchema: z.ZodObject<{
16
+ occurrence_id: z.ZodString;
17
+ record_id: z.ZodString;
18
+ content_hash: z.ZodString;
19
+ action: z.ZodString;
20
+ }, z.core.$strict>;
21
+ export type ReportClaim = z.infer<typeof ReportClaimSchema>;
22
+ export declare const ReportCheckSchema: z.ZodObject<{
23
+ check_id: z.ZodOptional<z.ZodString>;
24
+ label: z.ZodString;
25
+ command: z.ZodArray<z.ZodString>;
26
+ exit_code: z.ZodNullable<z.ZodNumber>;
27
+ output_hash: z.ZodString;
28
+ before_snapshot: z.ZodNullable<z.ZodString>;
29
+ after_snapshot: z.ZodNullable<z.ZodString>;
30
+ snapshot_limitations: z.ZodArray<z.ZodString>;
31
+ timed_out: z.ZodBoolean;
32
+ cancelled: z.ZodOptional<z.ZodBoolean>;
33
+ source: z.ZodLiteral<"local-command-runner">;
34
+ }, z.core.$strict>;
35
+ export type ReportCheck = z.infer<typeof ReportCheckSchema>;
36
+ export declare const ReportSaveSchema: z.ZodObject<{
37
+ source: z.ZodLiteral<"store-write">;
38
+ record: z.ZodObject<{
39
+ record_id: z.ZodString;
40
+ kind: z.ZodString;
41
+ content_hash: z.ZodString;
42
+ title: z.ZodString;
43
+ lesson: z.ZodString;
44
+ recorded_at: z.ZodNullable<z.ZodString>;
45
+ }, z.core.$strict>;
46
+ home: z.ZodEnum<{
47
+ public: "public";
48
+ private: "private";
49
+ }>;
50
+ operation: z.ZodEnum<{
51
+ updated: "updated";
52
+ created: "created";
53
+ }>;
54
+ }, z.core.$strict>;
55
+ export type ReportSave = z.infer<typeof ReportSaveSchema>;
56
+ export declare const ReportDurabilitySchema: z.ZodObject<{
57
+ save_id: z.ZodString;
58
+ durability: z.ZodEnum<{
59
+ committed: "committed";
60
+ pushed: "pushed";
61
+ }>;
62
+ commit: z.ZodString;
63
+ record_hash: z.ZodString;
64
+ source: z.ZodLiteral<"git-record-proof">;
65
+ publication: z.ZodOptional<z.ZodObject<{
66
+ ref: z.ZodString;
67
+ basis: z.ZodEnum<{
68
+ "push-status": "push-status";
69
+ "remote-ref-confirmed": "remote-ref-confirmed";
70
+ }>;
71
+ }, z.core.$strict>>;
72
+ }, z.core.$strict>;
73
+ export type ReportDurability = z.infer<typeof ReportDurabilitySchema>;
74
+ export declare const ReportRefusalSchema: z.ZodObject<{
75
+ source: z.ZodLiteral<"native-edit-gate">;
76
+ outcome: z.ZodLiteral<"denial-emitted">;
77
+ kind: z.ZodEnum<{
78
+ constraint: "constraint";
79
+ veto: "veto";
80
+ }>;
81
+ record_id: z.ZodString;
82
+ target: z.ZodString;
83
+ reason_hash: z.ZodString;
84
+ }, z.core.$strict>;
85
+ export type ReportRefusal = z.infer<typeof ReportRefusalSchema>;
86
+ /** Hunch's own deterministic evaluation of a delivered lesson's DECLARED rule
87
+ * (a constraint's forbids matcher or a decision's conformance predicate) against
88
+ * the files this task changed. Only the local runner writes it; an agent cannot
89
+ * submit one. File overlap alone never yields "satisfied": a lesson with no
90
+ * machine-checkable rule stays `unavailable`, and a rule whose scope this task
91
+ * never touched stays `not-exercised`. */
92
+ export declare const ReportConformanceSchema: z.ZodObject<{
93
+ source: z.ZodLiteral<"local-rule-check">;
94
+ record_id: z.ZodString;
95
+ kind: z.ZodEnum<{
96
+ decisions: "decisions";
97
+ constraints: "constraints";
98
+ }>;
99
+ content_hash: z.ZodString;
100
+ rule: z.ZodEnum<{
101
+ "constraint-forbids": "constraint-forbids";
102
+ "decision-conformance": "decision-conformance";
103
+ }>;
104
+ outcome: z.ZodEnum<{
105
+ satisfied: "satisfied";
106
+ violated: "violated";
107
+ "not-exercised": "not-exercised";
108
+ unavailable: "unavailable";
109
+ }>;
110
+ files: z.ZodArray<z.ZodString>;
111
+ snapshot: z.ZodNullable<z.ZodString>;
112
+ detail: z.ZodString;
113
+ }, z.core.$strict>;
114
+ export type ReportConformance = z.infer<typeof ReportConformanceSchema>;
115
+ declare const TaskSchema: z.ZodObject<{
116
+ task_id: z.ZodString;
117
+ scope: z.ZodString;
118
+ title: z.ZodString;
119
+ started_at: z.ZodString;
120
+ finished_at: z.ZodNullable<z.ZodString>;
121
+ state: z.ZodEnum<{
122
+ open: "open";
123
+ completed: "completed";
124
+ interrupted: "interrupted";
125
+ }>;
126
+ }, z.core.$strict>;
127
+ export type ReportTask = z.infer<typeof TaskSchema>;
128
+ export interface TaskDelivery {
129
+ occurrence_id: string;
130
+ at: string;
131
+ receipt_id: string;
132
+ envelope_hash: string;
133
+ envelope: DeliveryEnvelope;
134
+ records: ReportRecord[];
135
+ }
136
+ export interface TaskReport {
137
+ schema: typeof TASK_REPORT_SCHEMA;
138
+ task: ReportTask;
139
+ deliveries: TaskDelivery[];
140
+ /** `supported_by` names a current, satisfied rule evaluation of the SAME record
141
+ * revision; the attribution itself stays the agent's. */
142
+ claims: Array<ReportClaim & {
143
+ at: string;
144
+ attribution: "agent-reported";
145
+ supported_by: string | null;
146
+ }>;
147
+ checks: Array<ReportCheck & {
148
+ at: string;
149
+ current: boolean;
150
+ }>;
151
+ conformance: Array<ReportConformance & {
152
+ event_id: string;
153
+ at: string;
154
+ current: boolean;
155
+ }>;
156
+ saves: Array<ReportSave & {
157
+ event_id: string;
158
+ at: string;
159
+ durability: "local" | "committed" | "pushed";
160
+ proofs: Array<ReportDurability & {
161
+ at: string;
162
+ }>;
163
+ }>;
164
+ refusals: Array<ReportRefusal & {
165
+ event_id: string;
166
+ at: string;
167
+ }>;
168
+ coverage: "no-delivery-observed" | "no-relevant-memory" | "delivered";
169
+ unknowns: string[];
170
+ content_hash: string;
171
+ }
172
+ export declare const LessonReferenceSchema: z.ZodObject<{
173
+ kind: z.ZodString;
174
+ record_id: z.ZodString;
175
+ content_hash: z.ZodOptional<z.ZodString>;
176
+ }, z.core.$strict>;
177
+ export type LessonReference = z.infer<typeof LessonReferenceSchema>;
178
+ export interface LessonHistory {
179
+ schema: "hunch.lesson-history/1";
180
+ reference: LessonReference;
181
+ entries: Array<{
182
+ task: ReportTask;
183
+ event_id: string;
184
+ at: string;
185
+ event: "delivery" | "save";
186
+ record: ReportRecord;
187
+ receipt_id: string | null;
188
+ }>;
189
+ index_complete: boolean;
190
+ truncated: boolean;
191
+ next_before: number | null;
192
+ }
193
+ /** The lookup is derived, never evidence. Backfill at most 64 events and
194
+ * 512 KB per read. Parse outside the writer transaction so a history view cannot
195
+ * hold the writer lock while validating a large legacy ledger. */
196
+ export declare function readLessonHistory(root: string, reference: LessonReference, options?: {
197
+ limit?: number;
198
+ before?: number;
199
+ }): LessonHistory;
200
+ export declare function startReportTask(root: string, title: string, taskId?: string): ReportTask;
201
+ /** Strict operation for explicit callers. Passive integrations catch failure
202
+ * and disclose it without blocking context delivery. Empty envelopes count. */
203
+ export declare function recordTaskDelivery(root: string, taskId: string, envelope: DeliveryEnvelope, records: ReportRecord[], occurrenceId?: string): string;
204
+ export declare function recordReportClaim(root: string, taskId: string, claim: ReportClaim): string;
205
+ /** Internal write-path observers; no MCP endpoint accepts fabricated saves or
206
+ * publication claims. Retained observations never authorize memory mutations. */
207
+ export declare function recordReportSave(root: string, taskId: string, save: ReportSave): string;
208
+ export declare function recordReportDurability(root: string, taskId: string, proof: ReportDurability): string;
209
+ /** Internal observer of an actual emitted edit denial. This is not a model
210
+ * assertion and does not establish that the host honored the response. */
211
+ export declare function recordReportRefusal(root: string, taskId: string, refusal: ReportRefusal): string;
212
+ /** Only the local rule runner calls this; no MCP endpoint accepts a submitted
213
+ * outcome. The evaluated revision must be one this task actually received. */
214
+ export declare function recordReportConformance(root: string, taskId: string, conformance: ReportConformance): string;
215
+ /** Only the local runner calls this. MCP never accepts a claimed successful check. */
216
+ export declare function recordReportCheck(root: string, taskId: string, check: ReportCheck): string;
217
+ export declare function beginReportCheck(root: string, taskId: string, label: string): string;
218
+ export declare function finishReportTask(root: string, taskId: string, state?: "completed" | "interrupted"): ReportTask;
219
+ export declare function listReportTasks(root: string): ReportTask[];
220
+ export declare function reportActivity(root: string): string;
221
+ /** Exact task deletion is a user-invoked operation, never a memory deletion. */
222
+ export declare function forgetReportTask(root: string, taskId: string): void;
223
+ export declare function pruneReportHistory(root: string, olderThanDays?: number): number;
224
+ export declare function reportPresentationEnabled(root: string): boolean;
225
+ export declare function readTaskReport(root: string, taskId: string, currentSnapshot?: string | null): TaskReport;
226
+ export {};