@hivelore/core 0.59.0 → 0.60.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 +50 -4
- package/dist/index.js +52 -7
- 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;
|
|
@@ -2725,6 +2749,11 @@ interface SensorTarget {
|
|
|
2725
2749
|
* Does this sensor apply to `path`? A sensor with no explicit `paths` (and whose
|
|
2726
2750
|
* memory has no anchor paths) applies everywhere. Otherwise it applies to the exact
|
|
2727
2751
|
* file, a directory prefix, or a glob (`**` / `*.controller.ts` style) scope.
|
|
2752
|
+
*
|
|
2753
|
+
* Two guards keep a rule from firing where it can only be a false positive: an explicit `exclude`
|
|
2754
|
+
* glob list (a production-only lesson skips its own test doubles), and a built-in skip of
|
|
2755
|
+
* DOCUMENTATION files for content sensors — example code in a `.md`/`.rst` is never shipped, so a
|
|
2756
|
+
* regex/ast match there is always wrong unless the sensor names that exact file.
|
|
2728
2757
|
*/
|
|
2729
2758
|
declare function sensorAppliesToPath(sensor: Sensor, anchorPaths: string[], path: string): boolean;
|
|
2730
2759
|
/**
|
|
@@ -2751,18 +2780,35 @@ declare function compileRegexSensor(sensor: Sensor): RegExp | null;
|
|
|
2751
2780
|
* Returns `content` unchanged for unknown file types. Pure.
|
|
2752
2781
|
*/
|
|
2753
2782
|
declare function stripCommentsForScan(content: string, path: string): string;
|
|
2783
|
+
/**
|
|
2784
|
+
* An inline waiver a developer wrote to excuse ONE line from ONE sensor, recorded so the exception
|
|
2785
|
+
* is auditable rather than silent. Field report 2026-09-04 §3.1: a false positive had no outlet
|
|
2786
|
+
* other than rewriting correct code or deleting the sensor — and "a linter with no exception
|
|
2787
|
+
* mechanism ends up disabled", which costs the whole rule, not one line.
|
|
2788
|
+
*/
|
|
2789
|
+
interface SensorWaiver {
|
|
2790
|
+
memory_id: string;
|
|
2791
|
+
/** Project-relative file the waiver was used in. */
|
|
2792
|
+
file?: string;
|
|
2793
|
+
/** The waived line, trimmed and capped. */
|
|
2794
|
+
line: string;
|
|
2795
|
+
/** The reason the author gave after the slug. Never empty — a reasonless waiver does not apply. */
|
|
2796
|
+
reason: string;
|
|
2797
|
+
}
|
|
2798
|
+
declare function sensorWaiverOnLine(memoryId: string, rawLine: string): string | null;
|
|
2754
2799
|
/**
|
|
2755
2800
|
* Run a single regex sensor over one target. Returns the first matching line as a hit,
|
|
2756
|
-
* or null. Deterministic and side-effect-free
|
|
2801
|
+
* or null. Deterministic and side-effect-free — waivers found along the way are pushed into the
|
|
2802
|
+
* optional `waivers` sink so the caller can journal them (the exception stays visible).
|
|
2757
2803
|
*/
|
|
2758
|
-
declare function runRegexSensor(memoryId: string, sensor: Sensor, target: SensorTarget): SensorHit | null;
|
|
2804
|
+
declare function runRegexSensor(memoryId: string, sensor: Sensor, target: SensorTarget, waivers?: SensorWaiver[]): SensorHit | null;
|
|
2759
2805
|
/**
|
|
2760
2806
|
* Run every memory's regex sensor against every applicable target.
|
|
2761
2807
|
*
|
|
2762
2808
|
* Memories without a sensor, or with a non-regex sensor, are skipped (non-regex kinds
|
|
2763
2809
|
* are the CLI's responsibility). At most one hit per (memory, file) pair is returned.
|
|
2764
2810
|
*/
|
|
2765
|
-
declare function runSensors(memories: Memory[], targets: SensorTarget[]): SensorHit[];
|
|
2811
|
+
declare function runSensors(memories: Memory[], targets: SensorTarget[], waivers?: SensorWaiver[]): SensorHit[];
|
|
2766
2812
|
/**
|
|
2767
2813
|
* Parse every touched file path out of a unified diff (`diff --git a/X b/X` headers), including
|
|
2768
2814
|
* files changed by pure DELETIONS — the case a presence sensor exists for. Pure.
|
|
@@ -4192,4 +4238,4 @@ interface ReviewDraftOptions {
|
|
|
4192
4238
|
/** Template review learnings into proposed-memory drafts (reuses the scanner-ingest draft shape). */
|
|
4193
4239
|
declare function reviewLearningsToDrafts(learnings: ReviewLearning[], options?: ReviewDraftOptions): MemoryDraft[];
|
|
4194
4240
|
|
|
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 };
|
|
4241
|
+
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 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, 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, 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
|
/**
|
|
@@ -1748,6 +1756,10 @@ function renderSensorsBlock(blockSensors) {
|
|
|
1748
1756
|
"",
|
|
1749
1757
|
"The patterns below are blocked by the repo enforcement gate.",
|
|
1750
1758
|
"Introducing them will fail the pre-commit check (`hivelore enforce check`).",
|
|
1759
|
+
"",
|
|
1760
|
+
"Wrong about one specific line? Waive that line \u2014 `// hivelore:allow <memory-id> \u2014 <reason>` at",
|
|
1761
|
+
"end of line \u2014 instead of deleting the rule or rewriting correct code. It covers that line only",
|
|
1762
|
+
"and is reported. Repeating it means the scope is wrong: narrow `paths`/`exclude`/`absent`.",
|
|
1751
1763
|
""
|
|
1752
1764
|
];
|
|
1753
1765
|
for (const s of blockSensors) {
|
|
@@ -1827,15 +1839,26 @@ function normalizeProjectPath(value) {
|
|
|
1827
1839
|
return value.replace(/\\/g, "/").replace(/^\.\//, "").replace(/^[ab]\//, "").replace(/\/+$/g, "");
|
|
1828
1840
|
}
|
|
1829
1841
|
function sensorAppliesToPath(sensor, anchorPaths, path22) {
|
|
1830
|
-
const scopes = sensor.paths.length > 0 ? sensor.paths : anchorPaths;
|
|
1831
|
-
if (scopes.length === 0) return true;
|
|
1832
1842
|
const target = normalizeProjectPath(path22);
|
|
1833
|
-
|
|
1843
|
+
const matchesScope = (rawScope) => {
|
|
1834
1844
|
const scope = normalizeProjectPath(rawScope);
|
|
1835
1845
|
if (!scope) return false;
|
|
1836
1846
|
if (isGlobPath(scope)) return globToRegExp(scope).test(target);
|
|
1837
1847
|
return target === scope || target.startsWith(`${scope}/`);
|
|
1838
|
-
}
|
|
1848
|
+
};
|
|
1849
|
+
if (sensor.exclude?.some(matchesScope)) return false;
|
|
1850
|
+
const scopes = sensor.paths.length > 0 ? sensor.paths : anchorPaths;
|
|
1851
|
+
if ((sensor.kind === "regex" || sensor.kind === "ast") && isDocumentationPath(target)) {
|
|
1852
|
+
return scopes.map(normalizeProjectPath).includes(target);
|
|
1853
|
+
}
|
|
1854
|
+
if (scopes.length === 0) return true;
|
|
1855
|
+
return scopes.some(matchesScope);
|
|
1856
|
+
}
|
|
1857
|
+
var DOCUMENTATION_EXTENSIONS = /* @__PURE__ */ new Set(["md", "mdx", "markdown", "rst", "txt", "adoc"]);
|
|
1858
|
+
function isDocumentationPath(target) {
|
|
1859
|
+
const base = target.split("/").pop() ?? "";
|
|
1860
|
+
const dot = base.lastIndexOf(".");
|
|
1861
|
+
return dot >= 0 && DOCUMENTATION_EXTENSIONS.has(base.slice(dot + 1).toLowerCase());
|
|
1839
1862
|
}
|
|
1840
1863
|
var SENSOR_ABSENT_WINDOW = 6;
|
|
1841
1864
|
var SENSOR_ABSENT_LOOKBACK = 2;
|
|
@@ -1990,7 +2013,18 @@ function stripCommentsForScan(content, path22) {
|
|
|
1990
2013
|
}
|
|
1991
2014
|
return out.join("\n");
|
|
1992
2015
|
}
|
|
1993
|
-
|
|
2016
|
+
var WAIVER_MARKER = /hivelore:allow\s+([A-Za-z0-9._/-]+)(?=\s|$)\s*[—–:-]*\s*(.*)$/i;
|
|
2017
|
+
function sensorWaiverOnLine(memoryId, rawLine) {
|
|
2018
|
+
const m = WAIVER_MARKER.exec(rawLine);
|
|
2019
|
+
if (!m) return null;
|
|
2020
|
+
const slug = (m[1] ?? "").toLowerCase();
|
|
2021
|
+
const reason = (m[2] ?? "").replace(/(?:\*\/|-->|#>)\s*$/, "").trim();
|
|
2022
|
+
if (!slug || !reason) return null;
|
|
2023
|
+
const id = memoryId.toLowerCase();
|
|
2024
|
+
if (id !== slug && !id.includes(slug)) return null;
|
|
2025
|
+
return reason;
|
|
2026
|
+
}
|
|
2027
|
+
function runRegexSensor(memoryId, sensor, target, waivers) {
|
|
1994
2028
|
const re = compileRegexSensor(sensor);
|
|
1995
2029
|
if (!re) return null;
|
|
1996
2030
|
const absentRe = compileAbsentRegex(sensor);
|
|
@@ -2007,6 +2041,16 @@ function runRegexSensor(memoryId, sensor, target) {
|
|
|
2007
2041
|
absentRe.lastIndex = 0;
|
|
2008
2042
|
if (absentRe.test(scanLines.slice(from, to).join("\n"))) continue;
|
|
2009
2043
|
}
|
|
2044
|
+
const waivedReason = sensorWaiverOnLine(memoryId, rawLine);
|
|
2045
|
+
if (waivedReason) {
|
|
2046
|
+
waivers?.push({
|
|
2047
|
+
memory_id: memoryId,
|
|
2048
|
+
file: target.path,
|
|
2049
|
+
line: rawLine.trim().slice(0, 200),
|
|
2050
|
+
reason: waivedReason
|
|
2051
|
+
});
|
|
2052
|
+
continue;
|
|
2053
|
+
}
|
|
2010
2054
|
const brittle = sensor.kind === "regex" && sensor.pattern ? sensorPatternBrittleness(sensor.pattern) : null;
|
|
2011
2055
|
const severity = brittle ? "warn" : sensor.severity;
|
|
2012
2056
|
return {
|
|
@@ -2020,7 +2064,7 @@ function runRegexSensor(memoryId, sensor, target) {
|
|
|
2020
2064
|
}
|
|
2021
2065
|
return null;
|
|
2022
2066
|
}
|
|
2023
|
-
function runSensors(memories, targets) {
|
|
2067
|
+
function runSensors(memories, targets, waivers) {
|
|
2024
2068
|
const hits = [];
|
|
2025
2069
|
for (const memory of memories) {
|
|
2026
2070
|
const sensor = memory.frontmatter.sensor;
|
|
@@ -2029,7 +2073,7 @@ function runSensors(memories, targets) {
|
|
|
2029
2073
|
const anchorPaths = memory.frontmatter.anchor.paths;
|
|
2030
2074
|
for (const target of targets) {
|
|
2031
2075
|
if (!sensorAppliesToPath(sensor, anchorPaths, target.path)) continue;
|
|
2032
|
-
const hit = runRegexSensor(memory.frontmatter.id, sensor, target);
|
|
2076
|
+
const hit = runRegexSensor(memory.frontmatter.id, sensor, target, waivers);
|
|
2033
2077
|
if (hit) hits.push(hit);
|
|
2034
2078
|
}
|
|
2035
2079
|
}
|
|
@@ -7912,6 +7956,7 @@ export {
|
|
|
7912
7956
|
sensorPromotedAtMap,
|
|
7913
7957
|
sensorSelfCheck,
|
|
7914
7958
|
sensorTargetsFromDiff,
|
|
7959
|
+
sensorWaiverOnLine,
|
|
7915
7960
|
serializeCodeMap,
|
|
7916
7961
|
serializeMemory,
|
|
7917
7962
|
setFrictionStatus,
|