@hivelore/core 0.59.0 → 0.61.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.
- package/dist/index.d.ts +83 -41
- package/dist/index.js +99 -47
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -64,6 +64,14 @@ declare const SensorSchema: z.ZodObject<{
|
|
|
64
64
|
timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
65
65
|
/** Glob-ish path prefixes the sensor applies to. Falls back to the memory's anchor paths when empty. */
|
|
66
66
|
paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
67
|
+
/**
|
|
68
|
+
* Glob-ish paths the sensor must NOT fire on, even when they fall inside `paths`. Lets a
|
|
69
|
+
* production-only lesson (e.g. "no `any`") skip test doubles and fixtures without narrowing its
|
|
70
|
+
* scope file by file — the missing negation that made `paths: ['**']` fire on every `.test.ts`
|
|
71
|
+
* (field report 2026-09-02 §3.2). A lesson that IS about tests (e.g. "no `LocalDate.now()` in a
|
|
72
|
+
* test") simply leaves this empty, so it still fires there.
|
|
73
|
+
*/
|
|
74
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
67
75
|
/** LLM-facing self-correction message: what was done wrong and what to do instead. */
|
|
68
76
|
message: z.ZodString;
|
|
69
77
|
/**
|
|
@@ -108,6 +116,7 @@ declare const SensorSchema: z.ZodObject<{
|
|
|
108
116
|
require_present?: boolean | undefined;
|
|
109
117
|
command?: string | undefined;
|
|
110
118
|
timeout_ms?: number | undefined;
|
|
119
|
+
exclude?: string[] | undefined;
|
|
111
120
|
incident?: string | undefined;
|
|
112
121
|
red_proven?: boolean | undefined;
|
|
113
122
|
promoted_at?: string | undefined;
|
|
@@ -123,6 +132,7 @@ declare const SensorSchema: z.ZodObject<{
|
|
|
123
132
|
require_present?: boolean | undefined;
|
|
124
133
|
command?: string | undefined;
|
|
125
134
|
timeout_ms?: number | undefined;
|
|
135
|
+
exclude?: string[] | undefined;
|
|
126
136
|
incident?: string | undefined;
|
|
127
137
|
red_proven?: boolean | undefined;
|
|
128
138
|
severity?: "warn" | "block" | undefined;
|
|
@@ -213,6 +223,14 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
213
223
|
timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
214
224
|
/** Glob-ish path prefixes the sensor applies to. Falls back to the memory's anchor paths when empty. */
|
|
215
225
|
paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
226
|
+
/**
|
|
227
|
+
* Glob-ish paths the sensor must NOT fire on, even when they fall inside `paths`. Lets a
|
|
228
|
+
* production-only lesson (e.g. "no `any`") skip test doubles and fixtures without narrowing its
|
|
229
|
+
* scope file by file — the missing negation that made `paths: ['**']` fire on every `.test.ts`
|
|
230
|
+
* (field report 2026-09-02 §3.2). A lesson that IS about tests (e.g. "no `LocalDate.now()` in a
|
|
231
|
+
* test") simply leaves this empty, so it still fires there.
|
|
232
|
+
*/
|
|
233
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
216
234
|
/** LLM-facing self-correction message: what was done wrong and what to do instead. */
|
|
217
235
|
message: z.ZodString;
|
|
218
236
|
/**
|
|
@@ -257,6 +275,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
257
275
|
require_present?: boolean | undefined;
|
|
258
276
|
command?: string | undefined;
|
|
259
277
|
timeout_ms?: number | undefined;
|
|
278
|
+
exclude?: string[] | undefined;
|
|
260
279
|
incident?: string | undefined;
|
|
261
280
|
red_proven?: boolean | undefined;
|
|
262
281
|
promoted_at?: string | undefined;
|
|
@@ -272,6 +291,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
272
291
|
require_present?: boolean | undefined;
|
|
273
292
|
command?: string | undefined;
|
|
274
293
|
timeout_ms?: number | undefined;
|
|
294
|
+
exclude?: string[] | undefined;
|
|
275
295
|
incident?: string | undefined;
|
|
276
296
|
red_proven?: boolean | undefined;
|
|
277
297
|
severity?: "warn" | "block" | undefined;
|
|
@@ -370,6 +390,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
370
390
|
require_present?: boolean | undefined;
|
|
371
391
|
command?: string | undefined;
|
|
372
392
|
timeout_ms?: number | undefined;
|
|
393
|
+
exclude?: string[] | undefined;
|
|
373
394
|
incident?: string | undefined;
|
|
374
395
|
red_proven?: boolean | undefined;
|
|
375
396
|
promoted_at?: string | undefined;
|
|
@@ -407,6 +428,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
407
428
|
require_present?: boolean | undefined;
|
|
408
429
|
command?: string | undefined;
|
|
409
430
|
timeout_ms?: number | undefined;
|
|
431
|
+
exclude?: string[] | undefined;
|
|
410
432
|
incident?: string | undefined;
|
|
411
433
|
red_proven?: boolean | undefined;
|
|
412
434
|
severity?: "warn" | "block" | undefined;
|
|
@@ -468,6 +490,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
468
490
|
require_present?: boolean | undefined;
|
|
469
491
|
command?: string | undefined;
|
|
470
492
|
timeout_ms?: number | undefined;
|
|
493
|
+
exclude?: string[] | undefined;
|
|
471
494
|
incident?: string | undefined;
|
|
472
495
|
red_proven?: boolean | undefined;
|
|
473
496
|
promoted_at?: string | undefined;
|
|
@@ -505,6 +528,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
505
528
|
require_present?: boolean | undefined;
|
|
506
529
|
command?: string | undefined;
|
|
507
530
|
timeout_ms?: number | undefined;
|
|
531
|
+
exclude?: string[] | undefined;
|
|
508
532
|
incident?: string | undefined;
|
|
509
533
|
red_proven?: boolean | undefined;
|
|
510
534
|
severity?: "warn" | "block" | undefined;
|
|
@@ -1023,6 +1047,7 @@ declare const PROCESS_GATE_CODES: Set<string>;
|
|
|
1023
1047
|
* being committed. These are the findings the gate is entitled to refuse on.
|
|
1024
1048
|
*/
|
|
1025
1049
|
declare const CONTENT_CATCH_CODES: Set<string>;
|
|
1050
|
+
/** Every code that describes the diff rather than the repo's standing state. */
|
|
1026
1051
|
/** Setup/baseline gates — about the repo's knowledge layer being cold, not the change just made. */
|
|
1027
1052
|
declare const SETUP_GATE_CODES: Set<string>;
|
|
1028
1053
|
/**
|
|
@@ -1037,14 +1062,12 @@ interface GatePolicyInput {
|
|
|
1037
1062
|
mode?: "off" | "advisory" | "strict";
|
|
1038
1063
|
processGate?: "warn" | "block";
|
|
1039
1064
|
humanCommits?: "relaxed" | "strict";
|
|
1040
|
-
scoreThreshold?: number;
|
|
1041
1065
|
}
|
|
1042
1066
|
interface GatePolicy {
|
|
1043
1067
|
posture: GatePosture;
|
|
1044
1068
|
mode: "off" | "advisory" | "strict";
|
|
1045
1069
|
processGate: "warn" | "block";
|
|
1046
1070
|
humanCommits: "relaxed" | "strict";
|
|
1047
|
-
scoreThreshold: number;
|
|
1048
1071
|
/** Which fields the user pinned explicitly, so `doctor` can show posture vs. override. */
|
|
1049
1072
|
overrides: string[];
|
|
1050
1073
|
}
|
|
@@ -1060,40 +1083,15 @@ interface GateVerdictInput {
|
|
|
1060
1083
|
/** Env signals that identified the agent, for the actor label. */
|
|
1061
1084
|
agentSignals?: string[];
|
|
1062
1085
|
}
|
|
1063
|
-
interface BaselineHealth {
|
|
1064
|
-
/**
|
|
1065
|
-
* Health of the repo's KNOWLEDGE LAYER, 0–100. Deliberately not a verdict on the change: content
|
|
1066
|
-
* catches are excluded, because a number that moves both when the repo is cold and when this
|
|
1067
|
-
* particular diff repeated a lesson cannot be tracked over time — it never means one thing.
|
|
1068
|
-
*/
|
|
1069
|
-
score: number;
|
|
1070
|
-
threshold: number;
|
|
1071
|
-
checks: {
|
|
1072
|
-
total: number;
|
|
1073
|
-
ok: number;
|
|
1074
|
-
warn: number;
|
|
1075
|
-
error: number;
|
|
1076
|
-
};
|
|
1077
|
-
}
|
|
1078
1086
|
interface GateVerdict {
|
|
1079
1087
|
findings: GateFinding[];
|
|
1080
1088
|
should_block: boolean;
|
|
1081
1089
|
actor: string;
|
|
1082
|
-
baseline_health: BaselineHealth;
|
|
1083
1090
|
/** Content catches that refuse this change, one entry per memory (never the same lesson twice). */
|
|
1084
1091
|
refusals: GateFinding[];
|
|
1085
1092
|
/** Why process gates did or did not bind on this run. */
|
|
1086
1093
|
process_gate_reason: string;
|
|
1087
1094
|
}
|
|
1088
|
-
/**
|
|
1089
|
-
* Baseline health, computed from the repo's STANDING STATE only.
|
|
1090
|
-
*
|
|
1091
|
-
* Content catches are excluded on purpose. They are a verdict about one diff; folding them into a
|
|
1092
|
-
* health percentage meant the number dropped because of a change under review and rose again when
|
|
1093
|
-
* that change was fixed, while also encoding "the corpus is cold". One number, two meanings, and so
|
|
1094
|
-
* no meaning at all — nobody could act on a trend in it.
|
|
1095
|
-
*/
|
|
1096
|
-
declare function computeBaselineHealth(findings: GateFinding[], threshold: number): BaselineHealth;
|
|
1097
1095
|
/**
|
|
1098
1096
|
* Collapse content catches so one lesson is reported once.
|
|
1099
1097
|
*
|
|
@@ -1108,13 +1106,6 @@ declare function dedupeRefusals(findings: GateFinding[]): GateFinding[];
|
|
|
1108
1106
|
* Decide the whole verdict in one pass. Pure: same inputs, same answer, anywhere.
|
|
1109
1107
|
*/
|
|
1110
1108
|
declare function decideVerdict(input: GateVerdictInput): GateVerdict;
|
|
1111
|
-
/**
|
|
1112
|
-
* The health finding, emitted only when it is worth reading: below target, and nothing else refused.
|
|
1113
|
-
*
|
|
1114
|
-
* When a documented lesson refuses a change, that lesson is the message. Appending "health 2% — top
|
|
1115
|
-
* penalties: …" underneath buries the one line the developer needs.
|
|
1116
|
-
*/
|
|
1117
|
-
declare function buildBaselineHealthFinding(findings: GateFinding[], health: BaselineHealth, shouldBlock: boolean): GateFinding | null;
|
|
1118
1109
|
|
|
1119
1110
|
/**
|
|
1120
1111
|
* How much does an anchor actually TELL US?
|
|
@@ -1227,7 +1218,7 @@ declare function compareVersions(a: string, b: string): number;
|
|
|
1227
1218
|
*
|
|
1228
1219
|
* Pure: the registry lookup and the tag listing happen in the caller.
|
|
1229
1220
|
*/
|
|
1230
|
-
type NpmPublicationCode = "npm-published" | "npm-publish-pending" | "npm-releases-skipped" | "npm-publication-unverified";
|
|
1221
|
+
type NpmPublicationCode = "npm-published" | "npm-publish-pending" | "npm-releases-skipped" | "npm-publication-incoherent" | "npm-publication-unverified";
|
|
1231
1222
|
interface NpmPublicationInput {
|
|
1232
1223
|
packageName: string;
|
|
1233
1224
|
/** Version in the working tree (the lockstep version). */
|
|
@@ -1246,6 +1237,37 @@ interface NpmPublicationVerdict {
|
|
|
1246
1237
|
fix?: string;
|
|
1247
1238
|
}
|
|
1248
1239
|
declare function classifyNpmPublication(input: NpmPublicationInput): NpmPublicationVerdict;
|
|
1240
|
+
/** One lockstep package as seen from the registry. */
|
|
1241
|
+
interface LockstepPackageState {
|
|
1242
|
+
packageName: string;
|
|
1243
|
+
/** Latest version on the registry, or null when it could not be reached. */
|
|
1244
|
+
publishedVersion: string | null;
|
|
1245
|
+
/** Tagged versions strictly between `publishedVersion` and the local version. */
|
|
1246
|
+
taggedBetween?: readonly string[];
|
|
1247
|
+
}
|
|
1248
|
+
interface LockstepPublicationInput {
|
|
1249
|
+
/** The lockstep version in the working tree — every package should end up here. */
|
|
1250
|
+
localVersion: string;
|
|
1251
|
+
packages: readonly LockstepPackageState[];
|
|
1252
|
+
publishHint?: string;
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Judge the WHOLE lockstep set, not one representative package.
|
|
1256
|
+
*
|
|
1257
|
+
* Checking a single package assumes publication is atomic. It is not: `publish:all` runs one
|
|
1258
|
+
* `pnpm publish` per package, so any of them can fail on its own (an expired OTP, a 403) while the
|
|
1259
|
+
* others land. That produces the one state nobody was watching — a PARTIAL publish, where the
|
|
1260
|
+
* registry holds a set that cannot install itself. It happened on 0.60.0: core, cli and embeddings
|
|
1261
|
+
* shipped, `@hivelore/mcp` did not, and since cli pins its siblings exactly, every
|
|
1262
|
+
* `npm i -g @hivelore/cli` failed with `ETARGET No matching version found for @hivelore/mcp@0.60.0`.
|
|
1263
|
+
* `finish` said `npm-publish-pending` about core and nothing at all about the break.
|
|
1264
|
+
*
|
|
1265
|
+
* The severity split of {@link classifyNpmPublication} is preserved and extended:
|
|
1266
|
+
* - nothing published yet → informational (the normal state before publishing),
|
|
1267
|
+
* - some published, some not → WARN, because dependents are broken right now,
|
|
1268
|
+
* - a tagged version the registry skipped entirely → WARN, as before.
|
|
1269
|
+
*/
|
|
1270
|
+
declare function classifyLockstepPublication(input: LockstepPublicationInput): NpmPublicationVerdict;
|
|
1249
1271
|
|
|
1250
1272
|
/**
|
|
1251
1273
|
* Did the tags that were meant to be releases become GitHub Releases?
|
|
@@ -2176,8 +2198,6 @@ interface HaiveConfig {
|
|
|
2176
2198
|
* Default: 180.
|
|
2177
2199
|
*/
|
|
2178
2200
|
decayAfterDays?: number;
|
|
2179
|
-
/** Minimum score required for strict enforcement gates. */
|
|
2180
|
-
scoreThreshold?: number;
|
|
2181
2201
|
/** Remove generated Hivelore runtime/cache files during cleanup gates. */
|
|
2182
2202
|
cleanupGeneratedArtifacts?: boolean;
|
|
2183
2203
|
/**
|
|
@@ -2725,6 +2745,11 @@ interface SensorTarget {
|
|
|
2725
2745
|
* Does this sensor apply to `path`? A sensor with no explicit `paths` (and whose
|
|
2726
2746
|
* memory has no anchor paths) applies everywhere. Otherwise it applies to the exact
|
|
2727
2747
|
* file, a directory prefix, or a glob (`**` / `*.controller.ts` style) scope.
|
|
2748
|
+
*
|
|
2749
|
+
* Two guards keep a rule from firing where it can only be a false positive: an explicit `exclude`
|
|
2750
|
+
* glob list (a production-only lesson skips its own test doubles), and a built-in skip of
|
|
2751
|
+
* DOCUMENTATION files for content sensors — example code in a `.md`/`.rst` is never shipped, so a
|
|
2752
|
+
* regex/ast match there is always wrong unless the sensor names that exact file.
|
|
2728
2753
|
*/
|
|
2729
2754
|
declare function sensorAppliesToPath(sensor: Sensor, anchorPaths: string[], path: string): boolean;
|
|
2730
2755
|
/**
|
|
@@ -2751,18 +2776,35 @@ declare function compileRegexSensor(sensor: Sensor): RegExp | null;
|
|
|
2751
2776
|
* Returns `content` unchanged for unknown file types. Pure.
|
|
2752
2777
|
*/
|
|
2753
2778
|
declare function stripCommentsForScan(content: string, path: string): string;
|
|
2779
|
+
/**
|
|
2780
|
+
* An inline waiver a developer wrote to excuse ONE line from ONE sensor, recorded so the exception
|
|
2781
|
+
* is auditable rather than silent. Field report 2026-09-04 §3.1: a false positive had no outlet
|
|
2782
|
+
* other than rewriting correct code or deleting the sensor — and "a linter with no exception
|
|
2783
|
+
* mechanism ends up disabled", which costs the whole rule, not one line.
|
|
2784
|
+
*/
|
|
2785
|
+
interface SensorWaiver {
|
|
2786
|
+
memory_id: string;
|
|
2787
|
+
/** Project-relative file the waiver was used in. */
|
|
2788
|
+
file?: string;
|
|
2789
|
+
/** The waived line, trimmed and capped. */
|
|
2790
|
+
line: string;
|
|
2791
|
+
/** The reason the author gave after the slug. Never empty — a reasonless waiver does not apply. */
|
|
2792
|
+
reason: string;
|
|
2793
|
+
}
|
|
2794
|
+
declare function sensorWaiverOnLine(memoryId: string, rawLine: string): string | null;
|
|
2754
2795
|
/**
|
|
2755
2796
|
* Run a single regex sensor over one target. Returns the first matching line as a hit,
|
|
2756
|
-
* or null. Deterministic and side-effect-free
|
|
2797
|
+
* or null. Deterministic and side-effect-free — waivers found along the way are pushed into the
|
|
2798
|
+
* optional `waivers` sink so the caller can journal them (the exception stays visible).
|
|
2757
2799
|
*/
|
|
2758
|
-
declare function runRegexSensor(memoryId: string, sensor: Sensor, target: SensorTarget): SensorHit | null;
|
|
2800
|
+
declare function runRegexSensor(memoryId: string, sensor: Sensor, target: SensorTarget, waivers?: SensorWaiver[]): SensorHit | null;
|
|
2759
2801
|
/**
|
|
2760
2802
|
* Run every memory's regex sensor against every applicable target.
|
|
2761
2803
|
*
|
|
2762
2804
|
* Memories without a sensor, or with a non-regex sensor, are skipped (non-regex kinds
|
|
2763
2805
|
* are the CLI's responsibility). At most one hit per (memory, file) pair is returned.
|
|
2764
2806
|
*/
|
|
2765
|
-
declare function runSensors(memories: Memory[], targets: SensorTarget[]): SensorHit[];
|
|
2807
|
+
declare function runSensors(memories: Memory[], targets: SensorTarget[], waivers?: SensorWaiver[]): SensorHit[];
|
|
2766
2808
|
/**
|
|
2767
2809
|
* Parse every touched file path out of a unified diff (`diff --git a/X b/X` headers), including
|
|
2768
2810
|
* files changed by pure DELETIONS — the case a presence sensor exists for. Pure.
|
|
@@ -4192,4 +4234,4 @@ interface ReviewDraftOptions {
|
|
|
4192
4234
|
/** Template review learnings into proposed-memory drafts (reuses the scanner-ingest draft shape). */
|
|
4193
4235
|
declare function reviewLearningsToDrafts(learnings: ReviewLearning[], options?: ReviewDraftOptions): MemoryDraft[];
|
|
4194
4236
|
|
|
4195
|
-
export { ADAPTIVE_FLOOR_MIN_SAMPLES, 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, type GithubReleaseCode, type GithubReleaseInput, type GithubReleaseVerdict, 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, type NpmPublicationCode, type NpmPublicationInput, type NpmPublicationVerdict, 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, RECAP_HISTORY_HEADING, RECAP_HISTORY_MAX, 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, adaptiveSemanticFloor, 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, buildRecapWithHistory, buildReport, bumpRead, changedPathsFromDiff, churnForAnchors, classifyGithubRelease, classifyMemoryPriority, classifyNpmPublication, codeMapContentHash, codeMapPath, collectTimelineEntries, compactAutoRecapBody, compareEvalReports, compareGatePrecision, compareImpact, compareVersions, 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, recapBriefingExcerpt, recommendFeedbackAdjustment, recordApplied, recordGateReminder, recordPrevention, recordPreventionHits, recordProjectContextEmission, recordRejection, relPathFrom, renderBehaviourCoverageLine, renderBootstrapChecklist, renderCaughtForYou, renderPreventionComment, renderPreventionReceipt, renderPreventionReceiptShare, resolveBriefingBudget, resolveConfigPath, resolveGatePolicy, resolveHaivePaths, resolveManifestFiles, resolveProjectInfo, retirementSignal, revertedShaFromCommit, reviewLearningsToDrafts, runPresenceSensors, 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, stripCommentsForScan, stripPrivate, suggestGate, suggestSensorFromMemory, suggestSensorSeed, suggestTopicKey, summarizeCaughtForYou, summarizeImpact, synthesizeSelfEvalCases, tallyHotFiles, titleFromBody, tokenizeQuery, tokenizeWords, trackDependencies, trackReads, truncateToTokens, usageLogPath, usageLogSize, usagePath, verifyAnchor, watchContracts, withQuarantineNote, withoutQuarantineNote, writeBriefingMarker, writeSessionHandoff };
|
|
4237
|
+
export { ADAPTIVE_FLOOR_MIN_SAMPLES, 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 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, type GithubReleaseCode, type GithubReleaseInput, type GithubReleaseVerdict, 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, type LockstepPackageState, type LockstepPublicationInput, 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, type NpmPublicationCode, type NpmPublicationInput, type NpmPublicationVerdict, 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, RECAP_HISTORY_HEADING, RECAP_HISTORY_MAX, 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 SensorWaiver, 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, adaptiveSemanticFloor, 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, buildCodeMap, buildCoverageIndex, buildDashboard, buildDocFrequency, buildFrontmatter, buildHandoffMarkdown, buildPreventionReceipt, buildProposeCommand, buildRecapWithHistory, buildReport, bumpRead, changedPathsFromDiff, churnForAnchors, classifyGithubRelease, classifyLockstepPublication, classifyMemoryPriority, classifyNpmPublication, codeMapContentHash, codeMapPath, collectTimelineEntries, compactAutoRecapBody, compareEvalReports, compareGatePrecision, compareImpact, compareVersions, compileRegexSensor, componentOf, 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, recapBriefingExcerpt, recommendFeedbackAdjustment, recordApplied, recordGateReminder, recordPrevention, recordPreventionHits, recordProjectContextEmission, recordRejection, relPathFrom, renderBehaviourCoverageLine, renderBootstrapChecklist, renderCaughtForYou, renderPreventionComment, renderPreventionReceipt, renderPreventionReceiptShare, resolveBriefingBudget, resolveConfigPath, resolveGatePolicy, resolveHaivePaths, resolveManifestFiles, resolveProjectInfo, retirementSignal, revertedShaFromCommit, reviewLearningsToDrafts, runPresenceSensors, runRegexSensor, runSensors, runTierContract, runValidationContract, runtimeJournalPath, saveCodeMap, saveConfig, saveFrictionState, saveUsageIndex, scaffoldPostIncidentTest, scannableSensorTargets, scoreRetrievalCase, scoreSensorCase, scrubbedCommandEnv, selectCommandSensors, sensorAppliesToPath, sensorLedgerPath, sensorPatternBrittleness, sensorPromotedAtMap, sensorSelfCheck, sensorTargetsFromDiff, sensorWaiverOnLine, serializeCodeMap, serializeMemory, setFrictionStatus, shouldExpandGateReminder, snapshotContract, specificityScore, stripCommentsForScan, stripPrivate, suggestGate, suggestSensorFromMemory, suggestSensorSeed, suggestTopicKey, summarizeCaughtForYou, summarizeImpact, synthesizeSelfEvalCases, tallyHotFiles, titleFromBody, tokenizeQuery, tokenizeWords, trackDependencies, trackReads, truncateToTokens, usageLogPath, usageLogSize, usagePath, verifyAnchor, watchContracts, withQuarantineNote, withoutQuarantineNote, writeBriefingMarker, writeSessionHandoff };
|
package/dist/index.js
CHANGED
|
@@ -64,6 +64,14 @@ var SensorSchema = z.object({
|
|
|
64
64
|
timeout_ms: z.number().int().positive().optional(),
|
|
65
65
|
/** Glob-ish path prefixes the sensor applies to. Falls back to the memory's anchor paths when empty. */
|
|
66
66
|
paths: z.array(z.string()).default([]),
|
|
67
|
+
/**
|
|
68
|
+
* Glob-ish paths the sensor must NOT fire on, even when they fall inside `paths`. Lets a
|
|
69
|
+
* production-only lesson (e.g. "no `any`") skip test doubles and fixtures without narrowing its
|
|
70
|
+
* scope file by file — the missing negation that made `paths: ['**']` fire on every `.test.ts`
|
|
71
|
+
* (field report 2026-09-02 §3.2). A lesson that IS about tests (e.g. "no `LocalDate.now()` in a
|
|
72
|
+
* test") simply leaves this empty, so it still fires there.
|
|
73
|
+
*/
|
|
74
|
+
exclude: z.array(z.string()).optional(),
|
|
67
75
|
/** LLM-facing self-correction message: what was done wrong and what to do instead. */
|
|
68
76
|
message: z.string().min(1),
|
|
69
77
|
/**
|
|
@@ -1320,10 +1328,8 @@ var PROCESS_GATE_CODES = /* @__PURE__ */ new Set([
|
|
|
1320
1328
|
"bootstrap-incomplete"
|
|
1321
1329
|
]);
|
|
1322
1330
|
var CONTENT_CATCH_CODES = /* @__PURE__ */ new Set(["sensor-block", "precommit-policy-block"]);
|
|
1323
|
-
var CONTENT_CODES = /* @__PURE__ */ new Set([...CONTENT_CATCH_CODES, "sensor-warn"]);
|
|
1324
1331
|
var SETUP_GATE_CODES = /* @__PURE__ */ new Set([
|
|
1325
|
-
...PROCESS_GATE_CODES
|
|
1326
|
-
"enforcement-score-below-threshold"
|
|
1332
|
+
...PROCESS_GATE_CODES
|
|
1327
1333
|
]);
|
|
1328
1334
|
var DEFAULT_POSTURE = "balanced";
|
|
1329
1335
|
var POSTURE_DEFAULTS = {
|
|
@@ -1347,7 +1353,6 @@ function resolveGatePolicy(input) {
|
|
|
1347
1353
|
mode: cfg.mode ?? base.mode,
|
|
1348
1354
|
processGate: cfg.processGate ?? base.processGate,
|
|
1349
1355
|
humanCommits: cfg.humanCommits ?? base.humanCommits,
|
|
1350
|
-
scoreThreshold: cfg.scoreThreshold ?? 80,
|
|
1351
1356
|
overrides
|
|
1352
1357
|
};
|
|
1353
1358
|
}
|
|
@@ -1377,25 +1382,6 @@ function processGateDecision(policy, stage, isAgent) {
|
|
|
1377
1382
|
}
|
|
1378
1383
|
return { refuses: true, reason: "enforced: process gates bind at this sharing point." };
|
|
1379
1384
|
}
|
|
1380
|
-
function penaltyOf(finding) {
|
|
1381
|
-
if (finding.severity === "error") return finding.impact ?? 25;
|
|
1382
|
-
if (finding.severity === "warn") return finding.impact ?? 8;
|
|
1383
|
-
return 0;
|
|
1384
|
-
}
|
|
1385
|
-
function computeBaselineHealth(findings, threshold) {
|
|
1386
|
-
const baseline = findings.filter((f) => !CONTENT_CODES.has(f.code));
|
|
1387
|
-
const penalty = baseline.reduce((sum, f) => sum + penaltyOf(f), 0);
|
|
1388
|
-
return {
|
|
1389
|
-
score: Math.max(0, Math.min(100, 100 - penalty)),
|
|
1390
|
-
threshold,
|
|
1391
|
-
checks: {
|
|
1392
|
-
total: findings.length,
|
|
1393
|
-
ok: findings.filter((f) => f.severity === "ok").length,
|
|
1394
|
-
warn: findings.filter((f) => f.severity === "warn").length,
|
|
1395
|
-
error: findings.filter((f) => f.severity === "error").length
|
|
1396
|
-
}
|
|
1397
|
-
};
|
|
1398
|
-
}
|
|
1399
1385
|
function dedupeRefusals(findings) {
|
|
1400
1386
|
const byMemory = /* @__PURE__ */ new Map();
|
|
1401
1387
|
const out = [];
|
|
@@ -1426,29 +1412,16 @@ function decideVerdict(input) {
|
|
|
1426
1412
|
message: `${finding.message} (${process2.reason})`
|
|
1427
1413
|
};
|
|
1428
1414
|
});
|
|
1429
|
-
const baselineHealth = computeBaselineHealth(findings, policy.scoreThreshold);
|
|
1430
1415
|
const refusals = dedupeRefusals(findings);
|
|
1431
1416
|
const hasErrors = findings.some((f) => f.severity === "error");
|
|
1432
1417
|
return {
|
|
1433
1418
|
findings,
|
|
1434
1419
|
should_block: policy.mode === "strict" && hasErrors,
|
|
1435
1420
|
actor: isAgent ? `agent (${(input.agentSignals ?? []).join(", ")})` : process2.refuses ? "human \u2014 strict (enforcement.humanCommits)" : "human \u2014 process gates relaxed",
|
|
1436
|
-
baseline_health: baselineHealth,
|
|
1437
1421
|
refusals,
|
|
1438
1422
|
process_gate_reason: process2.reason
|
|
1439
1423
|
};
|
|
1440
1424
|
}
|
|
1441
|
-
function buildBaselineHealthFinding(findings, health, shouldBlock) {
|
|
1442
|
-
if (shouldBlock || health.score >= health.threshold) return null;
|
|
1443
|
-
const topPenalties = findings.filter((f) => !CONTENT_CODES.has(f.code)).map((f) => ({ code: f.code, penalty: penaltyOf(f) })).filter((p) => p.penalty > 0).sort((a, b) => b.penalty - a.penalty).slice(0, 3);
|
|
1444
|
-
return {
|
|
1445
|
-
severity: "warn",
|
|
1446
|
-
code: "enforcement-score-below-threshold",
|
|
1447
|
-
message: `Repo knowledge-layer health ${health.score}% is below the ${health.threshold}% target` + (topPenalties.length > 0 ? ` \u2014 top gaps: ${topPenalties.map((p) => `${p.code} (\u2212${p.penalty})`).join(", ")}` : "") + ". This measures the repo's baseline, not this change; it never blocks.",
|
|
1448
|
-
fix: "Fill the gaps above (bootstrap, briefing, recap), then rerun `hivelore enforce check`.",
|
|
1449
|
-
impact: 0
|
|
1450
|
-
};
|
|
1451
|
-
}
|
|
1452
1425
|
|
|
1453
1426
|
// src/anchor-specificity.ts
|
|
1454
1427
|
var WEAK_ANCHOR_CHURN_RATIO = 0.35;
|
|
@@ -1562,6 +1535,51 @@ function classifyNpmPublication(input) {
|
|
|
1562
1535
|
fix: hint
|
|
1563
1536
|
};
|
|
1564
1537
|
}
|
|
1538
|
+
function classifyLockstepPublication(input) {
|
|
1539
|
+
const { localVersion } = input;
|
|
1540
|
+
const hint = input.publishHint ?? `publish the lockstep packages at ${localVersion}`;
|
|
1541
|
+
const reachable = input.packages.filter((pkg) => pkg.publishedVersion !== null);
|
|
1542
|
+
if (reachable.length === 0) {
|
|
1543
|
+
return {
|
|
1544
|
+
code: "npm-publication-unverified",
|
|
1545
|
+
severity: "info",
|
|
1546
|
+
message: `Could not reach the registry to check whether the ${input.packages.length} lockstep package(s) are published at ${localVersion}.`
|
|
1547
|
+
};
|
|
1548
|
+
}
|
|
1549
|
+
const behind = reachable.filter((pkg) => compareVersions(pkg.publishedVersion, localVersion) < 0);
|
|
1550
|
+
if (behind.length === 0) {
|
|
1551
|
+
return {
|
|
1552
|
+
code: "npm-published",
|
|
1553
|
+
severity: "ok",
|
|
1554
|
+
message: `All ${reachable.length} lockstep package(s) are on npm at ${localVersion}.`
|
|
1555
|
+
};
|
|
1556
|
+
}
|
|
1557
|
+
const names = behind.map((pkg) => `${pkg.packageName} (${pkg.publishedVersion})`).join(", ");
|
|
1558
|
+
if (behind.length < reachable.length) {
|
|
1559
|
+
const ahead = reachable.filter((pkg) => !behind.includes(pkg));
|
|
1560
|
+
return {
|
|
1561
|
+
code: "npm-publication-incoherent",
|
|
1562
|
+
severity: "warn",
|
|
1563
|
+
message: `npm holds an INCOHERENT lockstep set: ${ahead.length} package(s) are at ${localVersion} but ${behind.length} are behind \u2014 ${names}. Packages that pin their siblings exactly cannot be installed at all (ETARGET), so this breaks users right now.`,
|
|
1564
|
+
fix: `Publish the missing package(s) at ${localVersion}: ${hint}. If a publish step reports success while the registry stays behind, its credentials are missing \u2014 a workflow that SKIPS publishing still reports green.`
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
const skipped = [...new Set(behind.flatMap((pkg) => [...pkg.taggedBetween ?? []]))].sort(compareVersions);
|
|
1568
|
+
if (skipped.length > 0) {
|
|
1569
|
+
return {
|
|
1570
|
+
code: "npm-releases-skipped",
|
|
1571
|
+
severity: "warn",
|
|
1572
|
+
message: `${skipped.length} tagged release(s) never reached npm \u2014 the lockstep packages are behind: ${names}. Skipped: ${skipped.map((v) => `v${v}`).join(", ")}.`,
|
|
1573
|
+
fix: `Registry versions are not cumulative, so publishing the newest is enough: ${hint}. If the release workflow keeps skipping, its publish credentials are missing.`
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
return {
|
|
1577
|
+
code: "npm-publish-pending",
|
|
1578
|
+
severity: "info",
|
|
1579
|
+
message: `The ${behind.length} lockstep package(s) are not on npm at ${localVersion} yet (${names}) \u2014 expected at this point; publish is the next step.`,
|
|
1580
|
+
fix: hint
|
|
1581
|
+
};
|
|
1582
|
+
}
|
|
1565
1583
|
|
|
1566
1584
|
// src/github-release.ts
|
|
1567
1585
|
var MAX_LISTED = 5;
|
|
@@ -1748,6 +1766,10 @@ function renderSensorsBlock(blockSensors) {
|
|
|
1748
1766
|
"",
|
|
1749
1767
|
"The patterns below are blocked by the repo enforcement gate.",
|
|
1750
1768
|
"Introducing them will fail the pre-commit check (`hivelore enforce check`).",
|
|
1769
|
+
"",
|
|
1770
|
+
"Wrong about one specific line? Waive that line \u2014 `// hivelore:allow <memory-id> \u2014 <reason>` at",
|
|
1771
|
+
"end of line \u2014 instead of deleting the rule or rewriting correct code. It covers that line only",
|
|
1772
|
+
"and is reported. Repeating it means the scope is wrong: narrow `paths`/`exclude`/`absent`.",
|
|
1751
1773
|
""
|
|
1752
1774
|
];
|
|
1753
1775
|
for (const s of blockSensors) {
|
|
@@ -1827,15 +1849,26 @@ function normalizeProjectPath(value) {
|
|
|
1827
1849
|
return value.replace(/\\/g, "/").replace(/^\.\//, "").replace(/^[ab]\//, "").replace(/\/+$/g, "");
|
|
1828
1850
|
}
|
|
1829
1851
|
function sensorAppliesToPath(sensor, anchorPaths, path22) {
|
|
1830
|
-
const scopes = sensor.paths.length > 0 ? sensor.paths : anchorPaths;
|
|
1831
|
-
if (scopes.length === 0) return true;
|
|
1832
1852
|
const target = normalizeProjectPath(path22);
|
|
1833
|
-
|
|
1853
|
+
const matchesScope = (rawScope) => {
|
|
1834
1854
|
const scope = normalizeProjectPath(rawScope);
|
|
1835
1855
|
if (!scope) return false;
|
|
1836
1856
|
if (isGlobPath(scope)) return globToRegExp(scope).test(target);
|
|
1837
1857
|
return target === scope || target.startsWith(`${scope}/`);
|
|
1838
|
-
}
|
|
1858
|
+
};
|
|
1859
|
+
if (sensor.exclude?.some(matchesScope)) return false;
|
|
1860
|
+
const scopes = sensor.paths.length > 0 ? sensor.paths : anchorPaths;
|
|
1861
|
+
if ((sensor.kind === "regex" || sensor.kind === "ast") && isDocumentationPath(target)) {
|
|
1862
|
+
return scopes.map(normalizeProjectPath).includes(target);
|
|
1863
|
+
}
|
|
1864
|
+
if (scopes.length === 0) return true;
|
|
1865
|
+
return scopes.some(matchesScope);
|
|
1866
|
+
}
|
|
1867
|
+
var DOCUMENTATION_EXTENSIONS = /* @__PURE__ */ new Set(["md", "mdx", "markdown", "rst", "txt", "adoc"]);
|
|
1868
|
+
function isDocumentationPath(target) {
|
|
1869
|
+
const base = target.split("/").pop() ?? "";
|
|
1870
|
+
const dot = base.lastIndexOf(".");
|
|
1871
|
+
return dot >= 0 && DOCUMENTATION_EXTENSIONS.has(base.slice(dot + 1).toLowerCase());
|
|
1839
1872
|
}
|
|
1840
1873
|
var SENSOR_ABSENT_WINDOW = 6;
|
|
1841
1874
|
var SENSOR_ABSENT_LOOKBACK = 2;
|
|
@@ -1990,7 +2023,18 @@ function stripCommentsForScan(content, path22) {
|
|
|
1990
2023
|
}
|
|
1991
2024
|
return out.join("\n");
|
|
1992
2025
|
}
|
|
1993
|
-
|
|
2026
|
+
var WAIVER_MARKER = /hivelore:allow\s+([A-Za-z0-9._/-]+)(?=\s|$)\s*[—–:-]*\s*(.*)$/i;
|
|
2027
|
+
function sensorWaiverOnLine(memoryId, rawLine) {
|
|
2028
|
+
const m = WAIVER_MARKER.exec(rawLine);
|
|
2029
|
+
if (!m) return null;
|
|
2030
|
+
const slug = (m[1] ?? "").toLowerCase();
|
|
2031
|
+
const reason = (m[2] ?? "").replace(/(?:\*\/|-->|#>)\s*$/, "").trim();
|
|
2032
|
+
if (!slug || !reason) return null;
|
|
2033
|
+
const id = memoryId.toLowerCase();
|
|
2034
|
+
if (id !== slug && !id.includes(slug)) return null;
|
|
2035
|
+
return reason;
|
|
2036
|
+
}
|
|
2037
|
+
function runRegexSensor(memoryId, sensor, target, waivers) {
|
|
1994
2038
|
const re = compileRegexSensor(sensor);
|
|
1995
2039
|
if (!re) return null;
|
|
1996
2040
|
const absentRe = compileAbsentRegex(sensor);
|
|
@@ -2007,6 +2051,16 @@ function runRegexSensor(memoryId, sensor, target) {
|
|
|
2007
2051
|
absentRe.lastIndex = 0;
|
|
2008
2052
|
if (absentRe.test(scanLines.slice(from, to).join("\n"))) continue;
|
|
2009
2053
|
}
|
|
2054
|
+
const waivedReason = sensorWaiverOnLine(memoryId, rawLine);
|
|
2055
|
+
if (waivedReason) {
|
|
2056
|
+
waivers?.push({
|
|
2057
|
+
memory_id: memoryId,
|
|
2058
|
+
file: target.path,
|
|
2059
|
+
line: rawLine.trim().slice(0, 200),
|
|
2060
|
+
reason: waivedReason
|
|
2061
|
+
});
|
|
2062
|
+
continue;
|
|
2063
|
+
}
|
|
2010
2064
|
const brittle = sensor.kind === "regex" && sensor.pattern ? sensorPatternBrittleness(sensor.pattern) : null;
|
|
2011
2065
|
const severity = brittle ? "warn" : sensor.severity;
|
|
2012
2066
|
return {
|
|
@@ -2020,7 +2074,7 @@ function runRegexSensor(memoryId, sensor, target) {
|
|
|
2020
2074
|
}
|
|
2021
2075
|
return null;
|
|
2022
2076
|
}
|
|
2023
|
-
function runSensors(memories, targets) {
|
|
2077
|
+
function runSensors(memories, targets, waivers) {
|
|
2024
2078
|
const hits = [];
|
|
2025
2079
|
for (const memory of memories) {
|
|
2026
2080
|
const sensor = memory.frontmatter.sensor;
|
|
@@ -2029,7 +2083,7 @@ function runSensors(memories, targets) {
|
|
|
2029
2083
|
const anchorPaths = memory.frontmatter.anchor.paths;
|
|
2030
2084
|
for (const target of targets) {
|
|
2031
2085
|
if (!sensorAppliesToPath(sensor, anchorPaths, target.path)) continue;
|
|
2032
|
-
const hit = runRegexSensor(memory.frontmatter.id, sensor, target);
|
|
2086
|
+
const hit = runRegexSensor(memory.frontmatter.id, sensor, target, waivers);
|
|
2033
2087
|
if (hit) hits.push(hit);
|
|
2034
2088
|
}
|
|
2035
2089
|
}
|
|
@@ -4167,7 +4221,6 @@ var DEFAULT_CONFIG = {
|
|
|
4167
4221
|
humanCommits: "relaxed",
|
|
4168
4222
|
commandSensorUnrunnable: "warn",
|
|
4169
4223
|
sensorWeakeningGate: "warn",
|
|
4170
|
-
scoreThreshold: 80,
|
|
4171
4224
|
cleanupGeneratedArtifacts: true,
|
|
4172
4225
|
toolProfile: "enforcement",
|
|
4173
4226
|
policyPacks: ["architecture", "gotchas", "security", "domain", "release"],
|
|
@@ -4203,7 +4256,6 @@ var AUTOPILOT_DEFAULTS = {
|
|
|
4203
4256
|
humanCommits: "relaxed",
|
|
4204
4257
|
commandSensorUnrunnable: "warn",
|
|
4205
4258
|
sensorWeakeningGate: "warn",
|
|
4206
|
-
scoreThreshold: 85,
|
|
4207
4259
|
cleanupGeneratedArtifacts: true,
|
|
4208
4260
|
toolProfile: "enforcement",
|
|
4209
4261
|
policyPacks: ["architecture", "gotchas", "security", "domain", "release"],
|
|
@@ -7691,7 +7743,6 @@ export {
|
|
|
7691
7743
|
briefingMarkerPath,
|
|
7692
7744
|
briefingMarkersDir,
|
|
7693
7745
|
briefingProofLine,
|
|
7694
|
-
buildBaselineHealthFinding,
|
|
7695
7746
|
buildCodeMap,
|
|
7696
7747
|
buildCoverageIndex,
|
|
7697
7748
|
buildDashboard,
|
|
@@ -7706,6 +7757,7 @@ export {
|
|
|
7706
7757
|
changedPathsFromDiff,
|
|
7707
7758
|
churnForAnchors,
|
|
7708
7759
|
classifyGithubRelease,
|
|
7760
|
+
classifyLockstepPublication,
|
|
7709
7761
|
classifyMemoryPriority,
|
|
7710
7762
|
classifyNpmPublication,
|
|
7711
7763
|
codeMapContentHash,
|
|
@@ -7718,7 +7770,6 @@ export {
|
|
|
7718
7770
|
compareVersions,
|
|
7719
7771
|
compileRegexSensor,
|
|
7720
7772
|
componentOf,
|
|
7721
|
-
computeBaselineHealth,
|
|
7722
7773
|
computeEvalTrend,
|
|
7723
7774
|
computeGatePrecision,
|
|
7724
7775
|
computeImpact,
|
|
@@ -7912,6 +7963,7 @@ export {
|
|
|
7912
7963
|
sensorPromotedAtMap,
|
|
7913
7964
|
sensorSelfCheck,
|
|
7914
7965
|
sensorTargetsFromDiff,
|
|
7966
|
+
sensorWaiverOnLine,
|
|
7915
7967
|
serializeCodeMap,
|
|
7916
7968
|
serializeMemory,
|
|
7917
7969
|
setFrictionStatus,
|