@hivelore/core 0.54.0 → 0.57.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.
package/dist/index.d.ts CHANGED
@@ -830,6 +830,26 @@ declare const HIVELORE_ATTRIBUTION = "\uD83D\uDEE1\uFE0F Generated by [Hivelore]
830
830
  * so the receipt is useful on day one, before any prevention has been recorded.
831
831
  */
832
832
  declare function renderPreventionReceiptShare(receipt: PreventionReceipt): string;
833
+ /** Stable marker the CI job greps for to update its own comment instead of posting a new one. */
834
+ declare const PREVENTION_RECEIPT_MARKER = "<!-- haive:prevention-receipt -->";
835
+ interface PreventionCommentFinding {
836
+ code?: string;
837
+ message?: string;
838
+ memory_ids?: string[];
839
+ file?: string;
840
+ /** The exact source line that matched — what makes the receipt actionable rather than a tally. */
841
+ matched_line?: string;
842
+ }
843
+ /**
844
+ * Full PR-comment body: marker + what fired on THIS pull request + the rolling receipt.
845
+ *
846
+ * This used to be assembled by a multi-line `jq -nr` program embedded in the generated
847
+ * `hivelore-enforcement.yml`. Its literal newlines terminated the surrounding YAML scalar, so the
848
+ * workflow every user got from `hivelore init` did not parse and GitHub refused to run it at all
849
+ * ("This run likely failed because of a workflow file issue"). Rendering the body here means the
850
+ * generated YAML holds a plain command and never a program — the defect class cannot come back.
851
+ */
852
+ declare function renderPreventionComment(receipt: PreventionReceipt, findings?: PreventionCommentFinding[]): string;
833
853
  /** Read all catch events (skips malformed lines). */
834
854
  declare function loadPreventionEvents(paths: HaivePaths): Promise<PreventionEvent[]>;
835
855
  interface PreventionTrend {
@@ -907,6 +927,238 @@ declare function projectContextRecentlyEmitted(paths: HaivePaths, hash: string,
907
927
  /** Record that this exact project-context body was just emitted. Best-effort. */
908
928
  declare function recordProjectContextEmission(paths: HaivePaths, hash: string, now?: number): Promise<void>;
909
929
 
930
+ /** One full reminder per working day: long enough to stop nagging, short enough to still land. */
931
+ declare const GATE_REMINDER_WINDOW_MS: number;
932
+ /**
933
+ * Should this reminder be shown in full right now? True the first time in the window, and again
934
+ * once the window lapses. Recording is the caller's job (see {@link recordGateReminder}) so a
935
+ * reminder that was never actually rendered does not consume the window.
936
+ */
937
+ declare function shouldExpandGateReminder(paths: HaivePaths, key: string, now?: number, windowMs?: number): Promise<boolean>;
938
+ /** Record that the full reminder was just shown. Best-effort: telemetry never breaks a commit. */
939
+ declare function recordGateReminder(paths: HaivePaths, key: string, now?: number): Promise<void>;
940
+
941
+ /**
942
+ * The gate's decision layer — pure, and the only place that decides what refuses.
943
+ *
944
+ * ## Why this module exists
945
+ *
946
+ * This logic used to live inside `packages/cli/src/commands/enforce.ts`, a 3300-line file, as
947
+ * THREE separate downgrade passes applied one after another: one relaxing process gates for human
948
+ * commits, one making them advisory by default, one making them advisory again at commit stage.
949
+ * Each arrived with a different bug fix; none knew about the others. The verdict therefore depended
950
+ * on their execution order, which was never written down anywhere, and adding a fourth pass was the
951
+ * obvious way to fix the next report. That is how a gate becomes unpredictable.
952
+ *
953
+ * There is now ONE pass. Each finding's severity is decided once, from an explicit policy, with the
954
+ * reason recorded on the finding. It is a pure function: no filesystem, no git, no config loading —
955
+ * so "why was this push refused?" is answerable by reading one file and provable by a unit test that
956
+ * runs in a millisecond instead of an 88-second integration suite.
957
+ */
958
+ /** Severity as reported by a gate check, before policy is applied. */
959
+ type GateSeverity = "ok" | "info" | "warn" | "error";
960
+ interface GateFinding {
961
+ severity: GateSeverity;
962
+ code: string;
963
+ message: string;
964
+ fix?: string;
965
+ impact?: number;
966
+ reason?: string;
967
+ affected_files?: string[];
968
+ memory_ids?: string[];
969
+ /** Project-relative file a deterministic finding fired on, when one is known. */
970
+ file?: string;
971
+ /** The exact source line that matched — what makes a refusal actionable. */
972
+ matched_line?: string;
973
+ /** Collapsed rendering for a repeated advisory; `message` always holds the full text. */
974
+ short_message?: string;
975
+ }
976
+ type GateStage = "local" | "pre-commit" | "pre-push" | "ci";
977
+ /**
978
+ * PROCESS gates describe the AGENT WORKFLOW around a change — "was team knowledge consulted?",
979
+ * "was the session recapped?" — never the change itself.
980
+ */
981
+ declare const PROCESS_GATE_CODES: Set<string>;
982
+ /**
983
+ * CONTENT catches are deterministic statements about THIS diff: a documented lesson matched the code
984
+ * being committed. These are the findings the gate is entitled to refuse on.
985
+ */
986
+ declare const CONTENT_CATCH_CODES: Set<string>;
987
+ /** Setup/baseline gates — about the repo's knowledge layer being cold, not the change just made. */
988
+ declare const SETUP_GATE_CODES: Set<string>;
989
+ /**
990
+ * A named posture, so a team picks ONE thing instead of reasoning about how two dozen independent
991
+ * switches interact. Individual knobs still win when set explicitly — the posture only supplies the
992
+ * defaults for the three that decide whether anything refuses.
993
+ */
994
+ type GatePosture = "advisory" | "balanced" | "strict";
995
+ declare const DEFAULT_POSTURE: GatePosture;
996
+ interface GatePolicyInput {
997
+ posture?: GatePosture;
998
+ mode?: "off" | "advisory" | "strict";
999
+ processGate?: "warn" | "block";
1000
+ humanCommits?: "relaxed" | "strict";
1001
+ scoreThreshold?: number;
1002
+ }
1003
+ interface GatePolicy {
1004
+ posture: GatePosture;
1005
+ mode: "off" | "advisory" | "strict";
1006
+ processGate: "warn" | "block";
1007
+ humanCommits: "relaxed" | "strict";
1008
+ scoreThreshold: number;
1009
+ /** Which fields the user pinned explicitly, so `doctor` can show posture vs. override. */
1010
+ overrides: string[];
1011
+ }
1012
+ declare function resolveGatePolicy(input: GatePolicyInput | undefined): GatePolicy;
1013
+ /** One sentence describing what a posture actually does, for `doctor` and `--explain`. */
1014
+ declare function describePosture(policy: GatePolicy): string;
1015
+ interface GateVerdictInput {
1016
+ findings: GateFinding[];
1017
+ policy: GatePolicy;
1018
+ stage: GateStage;
1019
+ /** True when an agent harness was detected in the environment. */
1020
+ isAgent: boolean;
1021
+ /** Env signals that identified the agent, for the actor label. */
1022
+ agentSignals?: string[];
1023
+ }
1024
+ interface BaselineHealth {
1025
+ /**
1026
+ * Health of the repo's KNOWLEDGE LAYER, 0–100. Deliberately not a verdict on the change: content
1027
+ * catches are excluded, because a number that moves both when the repo is cold and when this
1028
+ * particular diff repeated a lesson cannot be tracked over time — it never means one thing.
1029
+ */
1030
+ score: number;
1031
+ threshold: number;
1032
+ checks: {
1033
+ total: number;
1034
+ ok: number;
1035
+ warn: number;
1036
+ error: number;
1037
+ };
1038
+ }
1039
+ interface GateVerdict {
1040
+ findings: GateFinding[];
1041
+ should_block: boolean;
1042
+ actor: string;
1043
+ baseline_health: BaselineHealth;
1044
+ /** Content catches that refuse this change, one entry per memory (never the same lesson twice). */
1045
+ refusals: GateFinding[];
1046
+ /** Why process gates did or did not bind on this run. */
1047
+ process_gate_reason: string;
1048
+ }
1049
+ /**
1050
+ * Baseline health, computed from the repo's STANDING STATE only.
1051
+ *
1052
+ * Content catches are excluded on purpose. They are a verdict about one diff; folding them into a
1053
+ * health percentage meant the number dropped because of a change under review and rose again when
1054
+ * that change was fixed, while also encoding "the corpus is cold". One number, two meanings, and so
1055
+ * no meaning at all — nobody could act on a trend in it.
1056
+ */
1057
+ declare function computeBaselineHealth(findings: GateFinding[], threshold: number): BaselineHealth;
1058
+ /**
1059
+ * Collapse content catches so one lesson is reported once.
1060
+ *
1061
+ * Two independent diff-scan layers exist — the anti-pattern matcher and the sensor runner — and they
1062
+ * legitimately both fire on the same memory. Reported separately, a single lesson on a single line
1063
+ * of code produced four lines of output (two in the headline, two in the findings list), at exactly
1064
+ * the moment the reader's attention is most worth spending. Grouped by memory id, keeping the
1065
+ * richest entry: the one that knows which line matched.
1066
+ */
1067
+ declare function dedupeRefusals(findings: GateFinding[]): GateFinding[];
1068
+ /**
1069
+ * Decide the whole verdict in one pass. Pure: same inputs, same answer, anywhere.
1070
+ */
1071
+ declare function decideVerdict(input: GateVerdictInput): GateVerdict;
1072
+ /**
1073
+ * The health finding, emitted only when it is worth reading: below target, and nothing else refused.
1074
+ *
1075
+ * When a documented lesson refuses a change, that lesson is the message. Appending "health 2% — top
1076
+ * penalties: …" underneath buries the one line the developer needs.
1077
+ */
1078
+ declare function buildBaselineHealthFinding(findings: GateFinding[], health: BaselineHealth, shouldBlock: boolean): GateFinding | null;
1079
+
1080
+ /**
1081
+ * How much does an anchor actually TELL US?
1082
+ *
1083
+ * A memory anchored to a file matched by the change is treated as `must_read` — the strongest
1084
+ * ranking signal there is, ahead of anything semantic. That is right when the anchor is specific.
1085
+ * It is wrong when the anchor is a file every commit touches.
1086
+ *
1087
+ * Measured on this repository (60 commits, 116 anchored memories):
1088
+ *
1089
+ * - the MEDIAN memory claims relevance on 12 of 60 commits (20%)
1090
+ * - the p90 memory claims 36 of 60 (60%)
1091
+ * - the worst claim 37–42, and every one of them is anchored to a `package.json`
1092
+ *
1093
+ * A version bump touches `package.json`, so a lesson about cross-package dependency ranges declares
1094
+ * itself `must_read` on every release commit. On a typical commit here, ~34 memories all claimed the
1095
+ * top rank at once and the briefing had 8 slots: recall@8 was pinned near its arithmetic ceiling,
1096
+ * and the slots went to whichever plausible memory sorted first rather than to the one that mattered.
1097
+ * That is the mechanism behind a field report scoring briefing usefulness 30/100 while the eval
1098
+ * harness reported 98% recall — the eval asks "given a query written to find memory X, does X
1099
+ * surface?", which never exposes anchors competing with each other.
1100
+ *
1101
+ * The correction is the oldest one in information retrieval: weight a match by how rare it is.
1102
+ * An anchor on a file touched by 3% of commits is strong evidence; the same match on a file touched
1103
+ * by 60% of them is nearly none, and must be corroborated before it outranks everything else.
1104
+ *
1105
+ * Pure: churn is measured elsewhere (git), scored here.
1106
+ */
1107
+ /** How many of the sampled commits touched each project-relative path. */
1108
+ type AnchorChurn = ReadonlyMap<string, number>;
1109
+ /**
1110
+ * Anchors touched by more than this share of recent commits carry too little information to
1111
+ * promote a memory on their own. 0.35 keeps genuinely component-scoped anchors (a module a third of
1112
+ * the work touches is still a real signal) while demoting repo-wide files like `package.json`,
1113
+ * lockfiles and CI config.
1114
+ */
1115
+ declare const WEAK_ANCHOR_CHURN_RATIO = 0.35;
1116
+ /** Unknown churn must never penalise: a repo with no git history ranks exactly as it did before. */
1117
+ declare const DEFAULT_SPECIFICITY = 1;
1118
+ /**
1119
+ * Specificity of the BEST anchor that matched, in 0..1.
1120
+ *
1121
+ * 1 = this path is barely ever touched, so matching it is strong evidence.
1122
+ * 0 = every commit touches it, so matching it says nothing.
1123
+ *
1124
+ * The best (rarest) matching anchor wins: a memory anchored to both `package.json` and one precise
1125
+ * file is precise when the precise file is what changed.
1126
+ */
1127
+ declare function anchorSpecificity(matchedPaths: readonly string[], churn: AnchorChurn, totalCommits: number): number;
1128
+ /** True when this anchor is too common in this repo to promote a memory by itself. */
1129
+ declare function isWeakAnchor(specificity: number): boolean;
1130
+ declare function normalizeChurnPath(value: string): string;
1131
+ /**
1132
+ * Roll per-file commit counts up to the anchor paths a memory actually declares, so a directory or
1133
+ * glob anchor inherits the churn of everything under it. Without this, `packages/cli/` would look
1134
+ * unknown (no commit touches a directory) and silently keep the strong default.
1135
+ */
1136
+ declare function churnForAnchors(anchorPaths: readonly string[], fileChurn: AnchorChurn): AnchorChurn;
1137
+ interface AnchorAuditRow {
1138
+ id: string;
1139
+ /** Specificity of this memory's most discriminating anchor, 0..1. */
1140
+ specificity: number;
1141
+ /** The anchors that make it broad, with the share of commits touching each. */
1142
+ broad: Array<{
1143
+ path: string;
1144
+ ratio: number;
1145
+ }>;
1146
+ }
1147
+ /**
1148
+ * Which memories claim relevance on nearly every change?
1149
+ *
1150
+ * A memory anchored only to high-churn files is not wrong — the lesson really is about that file —
1151
+ * but it cannot help a briefing choose. It occupies a slot on every commit and displaces the lesson
1152
+ * that is actually about the work in hand. Surfacing the list turns an invisible ranking problem
1153
+ * into a corpus-hygiene task with an obvious fix: add the precise path the lesson is really about.
1154
+ *
1155
+ * Pure. Sorted worst-first so a report can take the head.
1156
+ */
1157
+ declare function auditAnchorSpecificity(memories: ReadonlyArray<{
1158
+ id: string;
1159
+ anchorPaths: readonly string[];
1160
+ }>, fileChurn: AnchorChurn, totalCommits: number): AnchorAuditRow[];
1161
+
910
1162
  type MemoryPriority = "must_read" | "useful" | "background";
911
1163
  /**
912
1164
  * Normalized priority evidence. A caller fills only the signals it can compute; unknown ones default
@@ -934,6 +1186,12 @@ interface PrioritySignals {
934
1186
  moduleOrDomainMatch: boolean;
935
1187
  /** A memory tag matched a task token. */
936
1188
  tagTaskMatch: boolean;
1189
+ /**
1190
+ * How much information the matched anchor carries in THIS repo, 0..1 (see `anchor-specificity.ts`).
1191
+ * 1 (the default) means "unknown or highly specific" and preserves the historical behaviour
1192
+ * exactly, so a repo without git history ranks as it always did.
1193
+ */
1194
+ anchorSpecificity?: number;
937
1195
  }
938
1196
  declare const DEFAULT_PRIORITY_SIGNALS: PrioritySignals;
939
1197
  /** Convenience: build a full signal set from a partial one. */
@@ -1396,8 +1654,20 @@ interface CodeFileEntry {
1396
1654
  }
1397
1655
  interface CodeMap {
1398
1656
  version: 1;
1657
+ /**
1658
+ * When this map was last WRITTEN — i.e. when its content last changed, since an unchanged scan
1659
+ * no longer rewrites the file (see `saveCodeMap`). Back-filled on load from the runtime sidecar
1660
+ * or the file mtime; it is deliberately NOT part of the committed payload, because a per-run
1661
+ * timestamp made every `sync` produce a diff and conflict on every `pull` for every developer.
1662
+ */
1399
1663
  generated_at: string;
1664
+ /**
1665
+ * Absolute project root, back-filled on load. Never serialized: it embedded one developer's
1666
+ * home directory in a shared file, so no two machines could produce the same bytes.
1667
+ */
1400
1668
  root: string;
1669
+ /** Digest of the serialized payload — the staleness key, replacing "was it regenerated?". */
1670
+ content_hash?: string;
1401
1671
  files: Record<string, CodeFileEntry>;
1402
1672
  }
1403
1673
  interface BuildCodeMapOptions {
@@ -1409,7 +1679,23 @@ interface BuildCodeMapOptions {
1409
1679
  declare const CODE_MAP_DEFAULT_INCLUDE: string[];
1410
1680
  declare const CODE_MAP_DEFAULT_EXCLUDE: string[];
1411
1681
  declare function codeMapPath(paths: HaivePaths): string;
1682
+ /**
1683
+ * Serialize a code-map so that the same source tree always produces the SAME BYTES, on any machine.
1684
+ *
1685
+ * Two fields used to break that and made the file unversionable: an absolute `root` (one developer's
1686
+ * home directory) and a `generated_at` stamped on every run. Together they guaranteed a conflicting
1687
+ * diff on every `sync` for every developer — the file could neither be committed nor ignored
1688
+ * (`doctor` asks for it). Both now live outside the payload, and `files` keys are sorted so readdir
1689
+ * order cannot reshuffle 500 KB of JSON.
1690
+ */
1691
+ declare function serializeCodeMap(map: CodeMap): string;
1692
+ declare function codeMapContentHash(map: CodeMap): string;
1412
1693
  declare function loadCodeMap(paths: HaivePaths): Promise<CodeMap | null>;
1694
+ /**
1695
+ * Write the map only when its content actually changed. An unchanged scan is a no-op, so the file
1696
+ * mtime — and therefore every "is the index stale?" check downstream — moves on content change
1697
+ * rather than on "did someone run sync?".
1698
+ */
1413
1699
  declare function saveCodeMap(paths: HaivePaths, map: CodeMap): Promise<void>;
1414
1700
  declare function buildCodeMap(root: string, options?: BuildCodeMapOptions): Promise<CodeMap>;
1415
1701
  /**
@@ -1577,6 +1863,26 @@ interface HaiveConfig {
1577
1863
  * treat Hivelore as infrastructure, not an optional convention.
1578
1864
  */
1579
1865
  enforcement?: {
1866
+ /**
1867
+ * ONE knob that decides whether the gate refuses, and for whom. Pick this; leave the rest alone.
1868
+ *
1869
+ * - "advisory" — reports everything, refuses nothing. For adopting Hivelore on a live repo.
1870
+ * - "balanced" (default) — refuses only on deterministic, code-bound findings: block sensors,
1871
+ * anti-pattern blocks, stale anchors on files the change touches, artifact hygiene.
1872
+ * - "strict" — the above, plus process gates (briefing, session recap, decision coverage,
1873
+ * bootstrap) refusing at the sharing points (pre-push, CI) for agents and humans alike.
1874
+ *
1875
+ * `mode`, `processGate` and `humanCommits` below are the individual switches the posture sets;
1876
+ * setting one explicitly overrides the posture for that switch only. This field exists because
1877
+ * this object had grown to two dozen interacting knobs and the resulting verdict could not be
1878
+ * predicted from the config by anyone, including the people who wrote it. `hivelore doctor`
1879
+ * prints the effective posture and any overrides.
1880
+ *
1881
+ * One rule is not a posture knob and is not negotiable: process gates never refuse a local
1882
+ * commit, at any posture. Blocking them on every pre-commit is what trained the `--no-verify`
1883
+ * reflex on cold repos, and a bypassed gate protects nothing.
1884
+ */
1885
+ posture?: "advisory" | "balanced" | "strict";
1580
1886
  /** Enforcement posture: advisory reports only, warn in hooks, or block workflow gates. */
1581
1887
  mode?: "off" | "advisory" | "strict";
1582
1888
  /** Require get_briefing / mem_relevant_to before state-changing MCP tools. */
@@ -1637,6 +1943,24 @@ interface HaiveConfig {
1637
1943
  * block humans too.
1638
1944
  */
1639
1945
  humanCommits?: "relaxed" | "strict";
1946
+ /**
1947
+ * Whether the PROCESS gates (briefing-loaded, session-recap, decision-coverage, bootstrap) may
1948
+ * REFUSE a push, or only report.
1949
+ *
1950
+ * - "warn" (default): they are always advisory. Only deterministic, code-bound findings —
1951
+ * block sensors, anti-pattern blocks, stale anchors, artifact hygiene — can refuse.
1952
+ * - "block": the pre-v0.55.0 behaviour, where an agent's push is refused for not having
1953
+ * written a session recap.
1954
+ *
1955
+ * The default changed in v0.55.0 on field evidence. A user pushing tested code with a green
1956
+ * SonarQube gate and zero violations was refused twice, both times entirely on process
1957
+ * penalties: `briefing-missing (−35)`, `session-recap-missing (−20)`, `bootstrap-incomplete (−5)`.
1958
+ * Not one penalty was about the code. The predictable response to that is `--no-verify`, which
1959
+ * costs the developer the WHOLE gate — including the sensors, the part that actually protects.
1960
+ * A gate routinely bypassed protects nothing, so the gate now spends its refusals only where it
1961
+ * has deterministic evidence, and asks for the rest.
1962
+ */
1963
+ processGate?: "warn" | "block";
1640
1964
  /**
1641
1965
  * Pre-commit/pre-push decision-coverage behaviour. When true (default), the gate SURFACES the
1642
1966
  * relevant anchored decisions/policies itself and records them in the session marker at commit
@@ -2389,6 +2713,22 @@ declare function judgeProposedSensor(sensor: Sensor, input: {
2389
2713
  badExamples: string[];
2390
2714
  correctExamples?: string[];
2391
2715
  }): ProposedSensorVerdict;
2716
+ /**
2717
+ * One wording for every sensor rejection, shared by the CLI (`sensors propose`) and the MCP
2718
+ * (`propose_sensor`) so the two façades cannot drift.
2719
+ *
2720
+ * `fires-on-current` in particular used to say only "add or tighten `absent`", which assumes the
2721
+ * pattern is imprecise. There is a second, very common cause the message never named: the pattern is
2722
+ * exactly right and **the faulty code is still in the tree** — which is the normal state at the
2723
+ * moment you document the problem. Requiring silence-on-current then makes arming a `block` sensor
2724
+ * impossible precisely when you want to arm it. A field report hit this and had to infer the
2725
+ * sequence (write the lesson → fix the code → come back and arm) from a bare refusal. Both causes
2726
+ * are now named, and the warn-first path out is spelled with the exact command.
2727
+ */
2728
+ declare function explainSensorRejection(verdict: ProposedSensorVerdict, context: {
2729
+ style: "cli" | "mcp";
2730
+ memoryId?: string;
2731
+ }): string;
2392
2732
  /**
2393
2733
  * A command oracle that exits non-zero has either FAILED an assertion (a real signal) or errored
2394
2734
  * before it could reach one — a missing module, an import/collection failure, a syntax error, or
@@ -3636,4 +3976,4 @@ interface ReviewDraftOptions {
3636
3976
  /** Template review learnings into proposed-memory drafts (reuses the scanner-ingest draft shape). */
3637
3977
  declare function reviewLearningsToDrafts(learnings: ReviewLearning[], options?: ReviewDraftOptions): MemoryDraft[];
3638
3978
 
3639
- export { AUTOPILOT_DEFAULTS, type Activation, type ActivationContext, ActivationSchema, type AgentContext, type Anchor, AnchorSchema, type AntiPatternGate, type AppendFrictionInput, type AppendFrictionResult, type AppliedConflictResolution, type AstExport, type AutoPromoteRule, BRIDGE_MARKERS, BRIDGE_TARGETS, BRIDGE_TARGET_PATH, BRIEFING_MARKER_TTL_MS, BRIEFING_PRESET_DEFAULTS, type BehaviourCoverageInput, type BehaviourCoverageMetrics, type BehaviourOracleInfo, type BootstrapAssessment, type BootstrapGap, type BootstrapGate, type BootstrapMetrics, type BootstrapState, type BootstrapStateInput, type BreakingChange, type BridgeFileOutput, type BridgeMemoryEntry, type BridgeSensor, type BridgeTarget, type BriefingBudgetNumbers, type BriefingBudgetPreset, type BriefingMarker, type BriefingProofLineOptions, type BudgetPart, type BudgetSlice, type BuildCodeMapOptions, CHARS_PER_TOKEN, CODE_MAP_DEFAULT_EXCLUDE, CODE_MAP_DEFAULT_INCLUDE, CODE_MAP_FILE, CODE_STOPWORDS, CONFIG_FILE, type CaughtForYouOptions, type CaughtForYouRow, type CaughtForYouSummary, type CodeExport, type CodeExportKind, type CodeFileEntry, type CodeMap, type CodeMapQueryOptions, type CollectTimelineOpts, type CommandSensorSpec, type ConfidenceLevel, type ConfidenceThresholds, type ConflictCandidatePair, type ConflictCandidatesOpts, type ConflictResolution, type ContractCheck, type ContractDiffResult, type ContractFile, type ContractSnapshot, type CoverageGap, type CoverageOptions, CrossRepoProvenanceSchema, type CrossRepoReport, type CrossRepoSource, DECAY_DAYS, DEFAULT_AUTO_PROMOTE_RULE, DEFAULT_BRIEFING_EXCLUDE_TAGS, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CONFIG, DEFAULT_DORMANT_DAYS, DEFAULT_PRIORITY_SIGNALS, type DashboardOptions, type DashboardReport, type DepChange, type DepTrackResult, type DependencySnapshot, type DetectStacksInput, type DetectableStack, type DistilledFailureLesson, type DocFrequency, type DormantRow, type DraftOptions, type DraftsOptions, ENV_WORKAROUND_TAGS, type EvalDelta, type EvalHistoryEntry, type EvalReport, type EvalSpec, type EvalTrend, FRICTION_FIELD_MAX, FRICTION_LOG_FILE, FRICTION_STATE_FILE, type FailureCoverageOptions, type FailureObservation, type FeedbackAdjustment, type FeedbackAdjustmentAction, type FeedbackAdjustmentOptions, type Finding, type FindingFormat, type FindingSeverity, type FrictionGroup, type FrictionKind, type FrictionReport, type FrictionState, type FrictionStateEntry, type FrictionStatus, GUESSABLE_THRESHOLD, type GateMissProposal, type GatePrecision, type GatePrecisionDelta, type GatePrecisionMetricDelta, type GateTuningSuggestion, type GenerateBridgesOptions, type GitCommit, type GitWatchPlan, type GitWatchState, HAIVE_DIR, HAIVE_OWNED_FILES, HANDOFF_FILENAME, HIVELORE_ATTRIBUTION, type HaiveConfig, type HaivePaths, type HotFile, type HotFileSource, type ImpactOptions, type ImpactRow, type ImpactScore, type ImpactSummary, type ImpactTier, type IncidentHints, type InvalidMemoryFile, LEGACY_CONFIG_FILE, type LexicalRankResult, type LoadedMemory, MEMORIES_DIR, MIN_WORD_LEN, type Memory, type MemoryDraft, type MemoryFrontmatter, MemoryFrontmatterSchema, type MemoryPriority, type MemoryScope, MemoryScopeSchema, type MemoryStatus, MemoryStatusSchema, type MemoryType, MemoryTypeSchema, type MemoryUsage, type MergeResult, type MetricDelta, PREVENTION_DEBOUNCE_MS, PROJECT_CONTEXT_FILE, PROJECT_CONTEXT_THROTTLE_MS, type PostIncidentLesson, type PreventionEvent, type PreventionEventDetail, type PreventionReceipt, type PreventionReceiptRow, type PreventionRow, type PreventionSource, type PreventionTrend, type PrioritySignals, type ProposedEvalSpec, type ProposedSensorVerdict, REVIEW_LEARNING_MARKER, RUNTIME_JOURNAL_FILENAME, type RecurrenceReport, type RecurrenceRow, type ResolveProjectInfo, type RetirementSignal, type RetrievalAggregate, type RetrievalCase, type RetrievalCaseResult, type ReviewDraftOptions, type ReviewLearning, type RuntimeJournalEntry, SCAFFOLD_MARKER_RE, SEED_QUALITY_FLOOR, SENSOR_ABSENT_LOOKBACK, SENSOR_ABSENT_WINDOW, SESSION_RECAP_TTL_MS, STACK_PACK_TAG, type ScaffoldLoopGap, type ScaffoldOptions, type ScaffoldStyle, type SeedProposal, type SelfEvalOptions, type Sensor, type SensorAggregate, type SensorCase, type SensorCaseResult, type SensorEvaluation, type SensorEvaluationOutcome, type SensorEvaluationStage, type SensorFlap, type SensorHealth, type SensorHit, type SensorRow, SensorSchema, type SensorSeed, type SensorSelfCheck, type SensorSuggestionOptions, type SensorTarget, type SensorWeakening, type SessionHandoffData, type SkillActivation, TEST_FRAMEWORKS, type TestFramework, type TestScaffold, type TierContractCheck, type TimelineEntry, type TopicStatusPair, type TruncateOptions, type TruncateResult, USAGE_FILE, USAGE_LOG_DIR, USAGE_LOG_FILE, type UncapturedFailure, type UncoveredAreaSuggestion, type UsageAggregate, type UsageEvent, type UsageIndex, type VerifyOptions, type VerifyResult, addedLineNumbersFromDiff, addedLinesFromDiff, aggregateRetrieval, aggregateSensors, aggregateUsage, allocateBudget, anchorMatchesComponent, antiPatternGateParams, appendEvalHistory, appendFrictionReport, appendPreventionEvent, appendProposedRetrievalCases, appendRuntimeJournalEntry, appendSensorEvaluations, appendUsageEvent, applyConflictResolution, applyFeedbackAdjustment, approveProposedCases, assessBehaviourCoverage, assessBootstrapState, assessScaffoldLoop, assessSensorHealth, bridgeMemorySummary, briefingMarkerPath, briefingMarkersDir, briefingProofLine, buildCodeMap, buildCoverageIndex, buildDashboard, buildDocFrequency, buildFrontmatter, buildHandoffMarkdown, buildPreventionReceipt, buildProposeCommand, buildReport, bumpRead, classifyMemoryPriority, codeMapPath, collectTimelineEntries, compactAutoRecapBody, compareEvalReports, compareGatePrecision, compareImpact, compileRegexSensor, componentOf, computeEvalTrend, computeGatePrecision, computeImpact, computePreventionTrend, computeRecurrence, computeScopeHash, configPath, contractLockPath, countSourceFilesOnDisk, deriveConfidence, deriveMainAreas, detectAgentContext, detectSensorWeakening, detectStacksFromManifests, diffContract, diffHasDistinctiveOverlap, distillFailureObservations, distinctiveCap, draftsFromFindings, emptyUsage, emptyUsageIndex, enforcementDir, estimateTokens, evalHistoryPath, evaluateSkillActivation, existingGateMissShas, extractActionsBriefBody, extractCorrectApproachExamples, extractReferencedPaths, extractReviewLearnings, extractSensorExamples, extractSnippet, extractTestFilePathsFromCommand, filterNewDrafts, findCoverageGaps, findLexicalConflictPairs, findProjectRoot, findTopicStatusConflictPairs, findUncapturedFailures, findingBody, findingToDraft, firstMemoryOneLine, formatFrictionIssue, frictionFingerprint, frictionLogPath, frictionStatePath, gatePassedShas, generateBridges, getUsage, globToRegExp, groupFriction, handoffAgeMs, handoffFilePath, hasPendingTestMarker, hasRecentBriefingMarker, hashProjectContext, incidentHintsFromDiff, incidentSuffix, inferModulesFromPaths, isAutoPromoteEligible, isAutoRecap, isCovered, isDecaying, isDistinctiveToken, isEnvWorkaroundMemory, isFreshIsoDate, isGlobPath, isHarnessErrorOutput, isLikelyGuessable, isNoiseSubject, isProductionCodeFile, isRetiredMemory, isSensorScannablePath, isSkill, isSkillSuppressed, isStackPackSeed, isStylisticRule, isTemplateProjectContext, judgeProposedSensor, lessonShortName, listMarkdownFilesRecursive, literalMatchesAllTokens, literalMatchesAnyToken, loadCodeMap, loadConfig, loadConfigSync, loadEvalHistory, loadFrictionState, loadMemoriesFromDir, loadMemoriesFromDirDetailed, loadMemory, loadPreventionEvents, loadSensorLedger, loadUsageIndex, looksLikeGenericAdvice, meetsSeedQualityFloor, memoryFilePath, memoryHasExcludedTag, memoryMatchesAnchorPaths, mergeHotFiles, mergeMemoryVersions, mineSensorSeedFromDiff, moduleNameOf, newMemoryId, normalizeFindingSeverity, normalizeFramework, normalizeFrictionSummary, normalizeKind, normalizeScaffoldStyle, normalizeSessionId, overallScore, parseEslintJson, parseFileAst, parseFindings, parseLessonFields, parseMemory, parseNpmAudit, parseSarif, parseSince, parseSonar, pathsOverlap, pickSnippetNeedle, pickTestFramework, planConflictResolution, planGitWatch, prepareBridgeData, preventionLogPath, priorityRank, prioritySignals, projectContextRecentlyEmitted, proposeGateMissDrafts, proposeSeedsFromCommits, pullCrossRepoSources, quarantineNote, queryCodeMap, rankMemoriesLexical, readFrictionReports, readRecentBriefingMarker, readRuntimeJournalTail, readSessionHandoff, readUsageEvents, recommendFeedbackAdjustment, recordApplied, recordPrevention, recordPreventionHits, recordProjectContextEmission, recordRejection, relPathFrom, renderBehaviourCoverageLine, renderBootstrapChecklist, renderCaughtForYou, renderPreventionReceipt, renderPreventionReceiptShare, resolveBriefingBudget, resolveConfigPath, resolveHaivePaths, resolveManifestFiles, resolveProjectInfo, retirementSignal, revertedShaFromCommit, reviewLearningsToDrafts, runRegexSensor, runSensors, runTierContract, runValidationContract, runtimeJournalPath, saveCodeMap, saveConfig, saveFrictionState, saveUsageIndex, scaffoldPostIncidentTest, scannableSensorTargets, scoreRetrievalCase, scoreSensorCase, scrubbedCommandEnv, selectCommandSensors, sensorAppliesToPath, sensorLedgerPath, sensorPatternBrittleness, sensorPromotedAtMap, sensorSelfCheck, sensorTargetsFromDiff, serializeMemory, setFrictionStatus, snapshotContract, specificityScore, stripPrivate, suggestGate, suggestSensorFromMemory, suggestSensorSeed, suggestTopicKey, summarizeCaughtForYou, summarizeImpact, synthesizeSelfEvalCases, tallyHotFiles, titleFromBody, tokenizeQuery, tokenizeWords, trackDependencies, trackReads, truncateToTokens, usageLogPath, usageLogSize, usagePath, verifyAnchor, watchContracts, withQuarantineNote, withoutQuarantineNote, writeBriefingMarker, writeSessionHandoff };
3979
+ export { AUTOPILOT_DEFAULTS, type Activation, type ActivationContext, ActivationSchema, type AgentContext, type Anchor, type AnchorAuditRow, type AnchorChurn, AnchorSchema, type AntiPatternGate, type AppendFrictionInput, type AppendFrictionResult, type AppliedConflictResolution, type AstExport, type AutoPromoteRule, BRIDGE_MARKERS, BRIDGE_TARGETS, BRIDGE_TARGET_PATH, BRIEFING_MARKER_TTL_MS, BRIEFING_PRESET_DEFAULTS, type BaselineHealth, type BehaviourCoverageInput, type BehaviourCoverageMetrics, type BehaviourOracleInfo, type BootstrapAssessment, type BootstrapGap, type BootstrapGate, type BootstrapMetrics, type BootstrapState, type BootstrapStateInput, type BreakingChange, type BridgeFileOutput, type BridgeMemoryEntry, type BridgeSensor, type BridgeTarget, type BriefingBudgetNumbers, type BriefingBudgetPreset, type BriefingMarker, type BriefingProofLineOptions, type BudgetPart, type BudgetSlice, type BuildCodeMapOptions, CHARS_PER_TOKEN, CODE_MAP_DEFAULT_EXCLUDE, CODE_MAP_DEFAULT_INCLUDE, CODE_MAP_FILE, CODE_STOPWORDS, CONFIG_FILE, CONTENT_CATCH_CODES, type CaughtForYouOptions, type CaughtForYouRow, type CaughtForYouSummary, type CodeExport, type CodeExportKind, type CodeFileEntry, type CodeMap, type CodeMapQueryOptions, type CollectTimelineOpts, type CommandSensorSpec, type ConfidenceLevel, type ConfidenceThresholds, type ConflictCandidatePair, type ConflictCandidatesOpts, type ConflictResolution, type ContractCheck, type ContractDiffResult, type ContractFile, type ContractSnapshot, type CoverageGap, type CoverageOptions, CrossRepoProvenanceSchema, type CrossRepoReport, type CrossRepoSource, DECAY_DAYS, DEFAULT_AUTO_PROMOTE_RULE, DEFAULT_BRIEFING_EXCLUDE_TAGS, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CONFIG, DEFAULT_DORMANT_DAYS, DEFAULT_POSTURE, DEFAULT_PRIORITY_SIGNALS, DEFAULT_SPECIFICITY, type DashboardOptions, type DashboardReport, type DepChange, type DepTrackResult, type DependencySnapshot, type DetectStacksInput, type DetectableStack, type DistilledFailureLesson, type DocFrequency, type DormantRow, type DraftOptions, type DraftsOptions, ENV_WORKAROUND_TAGS, type EvalDelta, type EvalHistoryEntry, type EvalReport, type EvalSpec, type EvalTrend, FRICTION_FIELD_MAX, FRICTION_LOG_FILE, FRICTION_STATE_FILE, type FailureCoverageOptions, type FailureObservation, type FeedbackAdjustment, type FeedbackAdjustmentAction, type FeedbackAdjustmentOptions, type Finding, type FindingFormat, type FindingSeverity, type FrictionGroup, type FrictionKind, type FrictionReport, type FrictionState, type FrictionStateEntry, type FrictionStatus, GATE_REMINDER_WINDOW_MS, GUESSABLE_THRESHOLD, type GateFinding, type GateMissProposal, type GatePolicy, type GatePolicyInput, type GatePosture, type GatePrecision, type GatePrecisionDelta, type GatePrecisionMetricDelta, type GateSeverity, type GateStage, type GateTuningSuggestion, type GateVerdict, type GateVerdictInput, type GenerateBridgesOptions, type GitCommit, type GitWatchPlan, type GitWatchState, HAIVE_DIR, HAIVE_OWNED_FILES, HANDOFF_FILENAME, HIVELORE_ATTRIBUTION, type HaiveConfig, type HaivePaths, type HotFile, type HotFileSource, type ImpactOptions, type ImpactRow, type ImpactScore, type ImpactSummary, type ImpactTier, type IncidentHints, type InvalidMemoryFile, LEGACY_CONFIG_FILE, type LexicalRankResult, type LoadedMemory, MEMORIES_DIR, MIN_WORD_LEN, type Memory, type MemoryDraft, type MemoryFrontmatter, MemoryFrontmatterSchema, type MemoryPriority, type MemoryScope, MemoryScopeSchema, type MemoryStatus, MemoryStatusSchema, type MemoryType, MemoryTypeSchema, type MemoryUsage, type MergeResult, type MetricDelta, PREVENTION_DEBOUNCE_MS, PREVENTION_RECEIPT_MARKER, PROCESS_GATE_CODES, PROJECT_CONTEXT_FILE, PROJECT_CONTEXT_THROTTLE_MS, type PostIncidentLesson, type PreventionCommentFinding, type PreventionEvent, type PreventionEventDetail, type PreventionReceipt, type PreventionReceiptRow, type PreventionRow, type PreventionSource, type PreventionTrend, type PrioritySignals, type ProposedEvalSpec, type ProposedSensorVerdict, REVIEW_LEARNING_MARKER, RUNTIME_JOURNAL_FILENAME, type RecurrenceReport, type RecurrenceRow, type ResolveProjectInfo, type RetirementSignal, type RetrievalAggregate, type RetrievalCase, type RetrievalCaseResult, type ReviewDraftOptions, type ReviewLearning, type RuntimeJournalEntry, SCAFFOLD_MARKER_RE, SEED_QUALITY_FLOOR, SENSOR_ABSENT_LOOKBACK, SENSOR_ABSENT_WINDOW, SESSION_RECAP_TTL_MS, SETUP_GATE_CODES, STACK_PACK_TAG, type ScaffoldLoopGap, type ScaffoldOptions, type ScaffoldStyle, type SeedProposal, type SelfEvalOptions, type Sensor, type SensorAggregate, type SensorCase, type SensorCaseResult, type SensorEvaluation, type SensorEvaluationOutcome, type SensorEvaluationStage, type SensorFlap, type SensorHealth, type SensorHit, type SensorRow, SensorSchema, type SensorSeed, type SensorSelfCheck, type SensorSuggestionOptions, type SensorTarget, type SensorWeakening, type SessionHandoffData, type SkillActivation, TEST_FRAMEWORKS, type TestFramework, type TestScaffold, type TierContractCheck, type TimelineEntry, type TopicStatusPair, type TruncateOptions, type TruncateResult, USAGE_FILE, USAGE_LOG_DIR, USAGE_LOG_FILE, type UncapturedFailure, type UncoveredAreaSuggestion, type UsageAggregate, type UsageEvent, type UsageIndex, type VerifyOptions, type VerifyResult, WEAK_ANCHOR_CHURN_RATIO, addedLineNumbersFromDiff, addedLinesFromDiff, aggregateRetrieval, aggregateSensors, aggregateUsage, allocateBudget, anchorMatchesComponent, anchorSpecificity, antiPatternGateParams, appendEvalHistory, appendFrictionReport, appendPreventionEvent, appendProposedRetrievalCases, appendRuntimeJournalEntry, appendSensorEvaluations, appendUsageEvent, applyConflictResolution, applyFeedbackAdjustment, approveProposedCases, assessBehaviourCoverage, assessBootstrapState, assessScaffoldLoop, assessSensorHealth, auditAnchorSpecificity, bridgeMemorySummary, briefingMarkerPath, briefingMarkersDir, briefingProofLine, buildBaselineHealthFinding, buildCodeMap, buildCoverageIndex, buildDashboard, buildDocFrequency, buildFrontmatter, buildHandoffMarkdown, buildPreventionReceipt, buildProposeCommand, buildReport, bumpRead, churnForAnchors, classifyMemoryPriority, codeMapContentHash, codeMapPath, collectTimelineEntries, compactAutoRecapBody, compareEvalReports, compareGatePrecision, compareImpact, compileRegexSensor, componentOf, computeBaselineHealth, computeEvalTrend, computeGatePrecision, computeImpact, computePreventionTrend, computeRecurrence, computeScopeHash, configPath, contractLockPath, countSourceFilesOnDisk, decideVerdict, dedupeRefusals, deriveConfidence, deriveMainAreas, describePosture, detectAgentContext, detectSensorWeakening, detectStacksFromManifests, diffContract, diffHasDistinctiveOverlap, distillFailureObservations, distinctiveCap, draftsFromFindings, emptyUsage, emptyUsageIndex, enforcementDir, estimateTokens, evalHistoryPath, evaluateSkillActivation, existingGateMissShas, explainSensorRejection, extractActionsBriefBody, extractCorrectApproachExamples, extractReferencedPaths, extractReviewLearnings, extractSensorExamples, extractSnippet, extractTestFilePathsFromCommand, filterNewDrafts, findCoverageGaps, findLexicalConflictPairs, findProjectRoot, findTopicStatusConflictPairs, findUncapturedFailures, findingBody, findingToDraft, firstMemoryOneLine, formatFrictionIssue, frictionFingerprint, frictionLogPath, frictionStatePath, gatePassedShas, generateBridges, getUsage, globToRegExp, groupFriction, handoffAgeMs, handoffFilePath, hasPendingTestMarker, hasRecentBriefingMarker, hashProjectContext, incidentHintsFromDiff, incidentSuffix, inferModulesFromPaths, isAutoPromoteEligible, isAutoRecap, isCovered, isDecaying, isDistinctiveToken, isEnvWorkaroundMemory, isFreshIsoDate, isGlobPath, isHarnessErrorOutput, isLikelyGuessable, isNoiseSubject, isProductionCodeFile, isRetiredMemory, isSensorScannablePath, isSkill, isSkillSuppressed, isStackPackSeed, isStylisticRule, isTemplateProjectContext, isWeakAnchor, judgeProposedSensor, lessonShortName, listMarkdownFilesRecursive, literalMatchesAllTokens, literalMatchesAnyToken, loadCodeMap, loadConfig, loadConfigSync, loadEvalHistory, loadFrictionState, loadMemoriesFromDir, loadMemoriesFromDirDetailed, loadMemory, loadPreventionEvents, loadSensorLedger, loadUsageIndex, looksLikeGenericAdvice, meetsSeedQualityFloor, memoryFilePath, memoryHasExcludedTag, memoryMatchesAnchorPaths, mergeHotFiles, mergeMemoryVersions, mineSensorSeedFromDiff, moduleNameOf, newMemoryId, normalizeChurnPath, normalizeFindingSeverity, normalizeFramework, normalizeFrictionSummary, normalizeKind, normalizeScaffoldStyle, normalizeSessionId, overallScore, parseEslintJson, parseFileAst, parseFindings, parseLessonFields, parseMemory, parseNpmAudit, parseSarif, parseSince, parseSonar, pathsOverlap, pickSnippetNeedle, pickTestFramework, planConflictResolution, planGitWatch, prepareBridgeData, preventionLogPath, priorityRank, prioritySignals, projectContextRecentlyEmitted, proposeGateMissDrafts, proposeSeedsFromCommits, pullCrossRepoSources, quarantineNote, queryCodeMap, rankMemoriesLexical, readFrictionReports, readRecentBriefingMarker, readRuntimeJournalTail, readSessionHandoff, readUsageEvents, recommendFeedbackAdjustment, recordApplied, recordGateReminder, recordPrevention, recordPreventionHits, recordProjectContextEmission, recordRejection, relPathFrom, renderBehaviourCoverageLine, renderBootstrapChecklist, renderCaughtForYou, renderPreventionComment, renderPreventionReceipt, renderPreventionReceiptShare, resolveBriefingBudget, resolveConfigPath, resolveGatePolicy, resolveHaivePaths, resolveManifestFiles, resolveProjectInfo, retirementSignal, revertedShaFromCommit, reviewLearningsToDrafts, runRegexSensor, runSensors, runTierContract, runValidationContract, runtimeJournalPath, saveCodeMap, saveConfig, saveFrictionState, saveUsageIndex, scaffoldPostIncidentTest, scannableSensorTargets, scoreRetrievalCase, scoreSensorCase, scrubbedCommandEnv, selectCommandSensors, sensorAppliesToPath, sensorLedgerPath, sensorPatternBrittleness, sensorPromotedAtMap, sensorSelfCheck, sensorTargetsFromDiff, serializeCodeMap, serializeMemory, setFrictionStatus, shouldExpandGateReminder, snapshotContract, specificityScore, stripPrivate, suggestGate, suggestSensorFromMemory, suggestSensorSeed, suggestTopicKey, summarizeCaughtForYou, summarizeImpact, synthesizeSelfEvalCases, tallyHotFiles, titleFromBody, tokenizeQuery, tokenizeWords, trackDependencies, trackReads, truncateToTokens, usageLogPath, usageLogSize, usagePath, verifyAnchor, watchContracts, withQuarantineNote, withoutQuarantineNote, writeBriefingMarker, writeSessionHandoff };