@hivelore/core 0.35.0 → 0.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +48 -3
- package/dist/index.js +25 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -55,6 +55,13 @@ declare const SensorSchema: z.ZodObject<{
|
|
|
55
55
|
autogen: z.ZodDefault<z.ZodBoolean>;
|
|
56
56
|
/** ISO timestamp of the last time this sensor matched a diff. */
|
|
57
57
|
last_fired: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
/**
|
|
59
|
+
* ISO timestamp of the last manual `sensors promote` back to block. Health assessment ignores
|
|
60
|
+
* ledger evaluations older than this — without it, a promoted sensor whose oracle was FIXED is
|
|
61
|
+
* re-quarantined on the next commit for up to 30 days (the stale flaps are still in the window),
|
|
62
|
+
* making the promotion promised by the quarantine note a no-op.
|
|
63
|
+
*/
|
|
64
|
+
promoted_at: z.ZodOptional<z.ZodString>;
|
|
58
65
|
}, "strip", z.ZodTypeAny, {
|
|
59
66
|
message: string;
|
|
60
67
|
paths: string[];
|
|
@@ -67,6 +74,7 @@ declare const SensorSchema: z.ZodObject<{
|
|
|
67
74
|
flags?: string | undefined;
|
|
68
75
|
command?: string | undefined;
|
|
69
76
|
timeout_ms?: number | undefined;
|
|
77
|
+
promoted_at?: string | undefined;
|
|
70
78
|
}, {
|
|
71
79
|
message: string;
|
|
72
80
|
paths?: string[] | undefined;
|
|
@@ -79,6 +87,7 @@ declare const SensorSchema: z.ZodObject<{
|
|
|
79
87
|
severity?: "warn" | "block" | undefined;
|
|
80
88
|
autogen?: boolean | undefined;
|
|
81
89
|
last_fired?: string | null | undefined;
|
|
90
|
+
promoted_at?: string | undefined;
|
|
82
91
|
}>;
|
|
83
92
|
/**
|
|
84
93
|
* Progressive-disclosure activation triggers for a `skill` memory.
|
|
@@ -154,6 +163,13 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
154
163
|
autogen: z.ZodDefault<z.ZodBoolean>;
|
|
155
164
|
/** ISO timestamp of the last time this sensor matched a diff. */
|
|
156
165
|
last_fired: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
166
|
+
/**
|
|
167
|
+
* ISO timestamp of the last manual `sensors promote` back to block. Health assessment ignores
|
|
168
|
+
* ledger evaluations older than this — without it, a promoted sensor whose oracle was FIXED is
|
|
169
|
+
* re-quarantined on the next commit for up to 30 days (the stale flaps are still in the window),
|
|
170
|
+
* making the promotion promised by the quarantine note a no-op.
|
|
171
|
+
*/
|
|
172
|
+
promoted_at: z.ZodOptional<z.ZodString>;
|
|
157
173
|
}, "strip", z.ZodTypeAny, {
|
|
158
174
|
message: string;
|
|
159
175
|
paths: string[];
|
|
@@ -166,6 +182,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
166
182
|
flags?: string | undefined;
|
|
167
183
|
command?: string | undefined;
|
|
168
184
|
timeout_ms?: number | undefined;
|
|
185
|
+
promoted_at?: string | undefined;
|
|
169
186
|
}, {
|
|
170
187
|
message: string;
|
|
171
188
|
paths?: string[] | undefined;
|
|
@@ -178,6 +195,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
178
195
|
severity?: "warn" | "block" | undefined;
|
|
179
196
|
autogen?: boolean | undefined;
|
|
180
197
|
last_fired?: string | null | undefined;
|
|
198
|
+
promoted_at?: string | undefined;
|
|
181
199
|
}>>;
|
|
182
200
|
/** Optional progressive-disclosure triggers — only meaningful for `type: skill`. */
|
|
183
201
|
activation: z.ZodOptional<z.ZodObject<{
|
|
@@ -257,6 +275,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
257
275
|
flags?: string | undefined;
|
|
258
276
|
command?: string | undefined;
|
|
259
277
|
timeout_ms?: number | undefined;
|
|
278
|
+
promoted_at?: string | undefined;
|
|
260
279
|
} | undefined;
|
|
261
280
|
activation?: {
|
|
262
281
|
keywords: string[];
|
|
@@ -290,6 +309,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
290
309
|
severity?: "warn" | "block" | undefined;
|
|
291
310
|
autogen?: boolean | undefined;
|
|
292
311
|
last_fired?: string | null | undefined;
|
|
312
|
+
promoted_at?: string | undefined;
|
|
293
313
|
} | undefined;
|
|
294
314
|
activation?: {
|
|
295
315
|
keywords?: string[] | undefined;
|
|
@@ -341,6 +361,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
341
361
|
flags?: string | undefined;
|
|
342
362
|
command?: string | undefined;
|
|
343
363
|
timeout_ms?: number | undefined;
|
|
364
|
+
promoted_at?: string | undefined;
|
|
344
365
|
} | undefined;
|
|
345
366
|
activation?: {
|
|
346
367
|
keywords: string[];
|
|
@@ -374,6 +395,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
374
395
|
severity?: "warn" | "block" | undefined;
|
|
375
396
|
autogen?: boolean | undefined;
|
|
376
397
|
last_fired?: string | null | undefined;
|
|
398
|
+
promoted_at?: string | undefined;
|
|
377
399
|
} | undefined;
|
|
378
400
|
activation?: {
|
|
379
401
|
keywords?: string[] | undefined;
|
|
@@ -2036,7 +2058,22 @@ declare function computeScopeHash(root: string, scopedFiles: string[]): string;
|
|
|
2036
2058
|
* Deterministic health assessment. A flap is an adjacent fired/silent outcome change for the same
|
|
2037
2059
|
* memory and identical scope hash inside the 30-day window. `unrunnable` rows never participate.
|
|
2038
2060
|
*/
|
|
2039
|
-
declare function assessSensorHealth(evaluations: SensorEvaluation[], now?: Date
|
|
2061
|
+
declare function assessSensorHealth(evaluations: SensorEvaluation[], now?: Date, opts?: {
|
|
2062
|
+
/**
|
|
2063
|
+
* memory_id → ISO timestamp of the sensor's last manual promotion back to block
|
|
2064
|
+
* (sensor.promoted_at). Evaluations at or before it are ignored: the promotion is the
|
|
2065
|
+
* human's assertion that the oracle was fixed, so pre-promotion flaps must not
|
|
2066
|
+
* re-quarantine it.
|
|
2067
|
+
*/
|
|
2068
|
+
promotedAt?: ReadonlyMap<string, string>;
|
|
2069
|
+
}): SensorHealth[];
|
|
2070
|
+
/** Build the promoted_at map for {@link assessSensorHealth} from memory frontmatters. */
|
|
2071
|
+
declare function sensorPromotedAtMap(frontmatters: Iterable<{
|
|
2072
|
+
id: string;
|
|
2073
|
+
sensor?: {
|
|
2074
|
+
promoted_at?: string;
|
|
2075
|
+
} | null;
|
|
2076
|
+
}>): Map<string, string>;
|
|
2040
2077
|
declare function quarantineNote(at: string, flapCount: number): string;
|
|
2041
2078
|
/** Add or replace the single quarantine note. */
|
|
2042
2079
|
declare function withQuarantineNote(body: string, at: string, flapCount: number): string;
|
|
@@ -2671,7 +2708,15 @@ declare function revertedShaFromCommit(commit: GitCommit): string | null;
|
|
|
2671
2708
|
declare function existingGateMissShas(memories: LoadedMemory[]): Set<string>;
|
|
2672
2709
|
declare function gatePassedShas(evaluations: SensorEvaluation[]): Set<string>;
|
|
2673
2710
|
/** Build proposed, never-validated lessons from incremental revert/hotfix signals. */
|
|
2674
|
-
declare function proposeGateMissDrafts(commits: GitCommit[], existingRevertedShas: Set<string>, passedShas: Set<string
|
|
2711
|
+
declare function proposeGateMissDrafts(commits: GitCommit[], existingRevertedShas: Set<string>, passedShas: Set<string>, opts?: {
|
|
2712
|
+
/**
|
|
2713
|
+
* Returns true when a repo-relative path still exists on disk. Anchor candidates come from
|
|
2714
|
+
* the REVERT commit's file list — files the revert often just deleted. Anchoring a draft to
|
|
2715
|
+
* a deleted path makes the very next `sync` mark it stale, so the learning loop eats its own
|
|
2716
|
+
* drafts before anyone reviews them. When omitted, paths are kept (pure callers/tests).
|
|
2717
|
+
*/
|
|
2718
|
+
pathExists?: (rel: string) => boolean;
|
|
2719
|
+
}): GateMissProposal[];
|
|
2675
2720
|
|
|
2676
2721
|
/**
|
|
2677
2722
|
* Pure stack-detection helpers for cold-start seeding.
|
|
@@ -2924,4 +2969,4 @@ interface AgentContext {
|
|
|
2924
2969
|
}
|
|
2925
2970
|
declare function detectAgentContext(env?: Record<string, string | undefined>): AgentContext;
|
|
2926
2971
|
|
|
2927
|
-
export { AUTOPILOT_DEFAULTS, type Activation, type ActivationContext, ActivationSchema, type AgentContext, type Anchor, AnchorSchema, type AntiPatternGate, type AppliedConflictResolution, type AstExport, type AutoPromoteRule, BRIDGE_MARKERS, BRIDGE_TARGETS, BRIDGE_TARGET_PATH, BRIEFING_MARKER_TTL_MS, BRIEFING_PRESET_DEFAULTS, type BootstrapAssessment, type BootstrapGap, type BootstrapGate, type BootstrapMetrics, type BootstrapState, type BootstrapStateInput, type BreakingChange, type BridgeFileOutput, type BridgeMemoryEntry, type BridgeSensor, type BridgeTarget, type BriefingBudgetNumbers, type BriefingBudgetPreset, type BriefingMarker, type BriefingProofLineOptions, type BudgetPart, type BudgetSlice, type BuildCodeMapOptions, CHARS_PER_TOKEN, CODE_MAP_DEFAULT_EXCLUDE, CODE_MAP_DEFAULT_INCLUDE, CODE_MAP_FILE, CODE_STOPWORDS, CONFIG_FILE, type CaughtForYouOptions, type CaughtForYouRow, type CaughtForYouSummary, type CodeExport, type CodeExportKind, type CodeFileEntry, type CodeMap, type CodeMapQueryOptions, type CollectTimelineOpts, type CommandSensorSpec, type ConfidenceLevel, type ConfidenceThresholds, type ConflictCandidatePair, type ConflictCandidatesOpts, type ConflictResolution, type ContractDiffResult, type ContractFile, type ContractSnapshot, type CoverageGap, type CoverageOptions, CrossRepoProvenanceSchema, type CrossRepoReport, type CrossRepoSource, DECAY_DAYS, DEFAULT_AUTO_PROMOTE_RULE, DEFAULT_BRIEFING_EXCLUDE_TAGS, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CONFIG, DEFAULT_DORMANT_DAYS, DEFAULT_PRIORITY_SIGNALS, type DashboardOptions, type DashboardReport, type DepChange, type DepTrackResult, type DependencySnapshot, type DetectStacksInput, type DetectableStack, type DocFrequency, type DormantRow, type DraftOptions, type DraftsOptions, ENV_WORKAROUND_TAGS, type EvalDelta, type EvalHistoryEntry, type EvalReport, type EvalSpec, type EvalTrend, type FailureCoverageOptions, type FailureObservation, type FeedbackAdjustment, type FeedbackAdjustmentAction, type FeedbackAdjustmentOptions, type Finding, type FindingFormat, type FindingSeverity, GUESSABLE_THRESHOLD, type GateMissProposal, type GatePrecision, type GatePrecisionDelta, type GatePrecisionMetricDelta, type GateTuningSuggestion, type GenerateBridgesOptions, type GitCommit, type GitWatchPlan, type GitWatchState, HAIVE_DIR, HAIVE_OWNED_FILES, HANDOFF_FILENAME, type HaiveConfig, type HaivePaths, type HotFile, type HotFileSource, type ImpactOptions, type ImpactRow, type ImpactScore, type ImpactSummary, type ImpactTier, type InvalidMemoryFile, type LexicalRankResult, type LoadedMemory, MEMORIES_DIR, MIN_WORD_LEN, type Memory, type MemoryDraft, type MemoryFrontmatter, MemoryFrontmatterSchema, type MemoryPriority, type MemoryScope, MemoryScopeSchema, type MemoryStatus, MemoryStatusSchema, type MemoryType, MemoryTypeSchema, type MemoryUsage, type MergeResult, type MetricDelta, PREVENTION_DEBOUNCE_MS, PROJECT_CONTEXT_FILE, PROJECT_CONTEXT_THROTTLE_MS, type PreventionEvent, type PreventionEventDetail, type PreventionReceipt, type PreventionReceiptRow, type PreventionRow, type PreventionSource, type PreventionTrend, type PrioritySignals, type ProposedSensorVerdict, RUNTIME_JOURNAL_FILENAME, type RecurrenceReport, type RecurrenceRow, type ResolveProjectInfo, type RetirementSignal, type RetrievalAggregate, type RetrievalCase, type RetrievalCaseResult, type RuntimeJournalEntry, SEED_QUALITY_FLOOR, SENSOR_ABSENT_LOOKBACK, SENSOR_ABSENT_WINDOW, SESSION_RECAP_TTL_MS, STACK_PACK_TAG, 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 SessionHandoffData, type SkillActivation, type TimelineEntry, type TopicStatusPair, type TruncateOptions, type TruncateResult, USAGE_FILE, USAGE_LOG_DIR, USAGE_LOG_FILE, type UncapturedFailure, type UsageAggregate, type UsageEvent, type UsageIndex, type VerifyOptions, type VerifyResult, addedLinesFromDiff, aggregateRetrieval, aggregateSensors, aggregateUsage, allocateBudget, antiPatternGateParams, appendEvalHistory, appendPreventionEvent, appendRuntimeJournalEntry, appendSensorEvaluations, appendUsageEvent, applyConflictResolution, applyFeedbackAdjustment, assessBootstrapState, assessSensorHealth, bridgeMemorySummary, briefingMarkerPath, briefingMarkersDir, briefingProofLine, buildCodeMap, buildCoverageIndex, buildDashboard, buildDocFrequency, buildFrontmatter, buildHandoffMarkdown, buildPreventionReceipt, buildReport, bumpRead, classifyMemoryPriority, codeMapPath, collectTimelineEntries, compactAutoRecapBody, compareEvalReports, compareGatePrecision, compareImpact, compileRegexSensor, componentOf, computeEvalTrend, computeGatePrecision, computeImpact, computePreventionTrend, computeRecurrence, computeScopeHash, configPath, contractLockPath, countSourceFilesOnDisk, deriveConfidence, detectAgentContext, detectStacksFromManifests, diffContract, diffHasDistinctiveOverlap, distinctiveCap, draftsFromFindings, emptyUsage, emptyUsageIndex, enforcementDir, estimateTokens, evalHistoryPath, evaluateSkillActivation, existingGateMissShas, extractActionsBriefBody, extractReferencedPaths, extractSensorExamples, extractSnippet, filterNewDrafts, findCoverageGaps, findLexicalConflictPairs, findProjectRoot, findTopicStatusConflictPairs, findUncapturedFailures, findingBody, findingToDraft, firstMemoryOneLine, gatePassedShas, generateBridges, getUsage, globToRegExp, handoffAgeMs, handoffFilePath, hasRecentBriefingMarker, hashProjectContext, inferModulesFromPaths, isAutoPromoteEligible, isAutoRecap, isCovered, isDecaying, isDistinctiveToken, isEnvWorkaroundMemory, isFreshIsoDate, isGlobPath, isLikelyGuessable, isNoiseSubject, isRetiredMemory, isSensorScannablePath, isSkill, isSkillSuppressed, isStackPackSeed, isStylisticRule, isTemplateProjectContext, judgeProposedSensor, listMarkdownFilesRecursive, literalMatchesAllTokens, literalMatchesAnyToken, loadCodeMap, loadConfig, loadConfigSync, loadEvalHistory, loadMemoriesFromDir, loadMemoriesFromDirDetailed, loadMemory, loadPreventionEvents, loadSensorLedger, loadUsageIndex, looksLikeGenericAdvice, meetsSeedQualityFloor, memoryFilePath, memoryHasExcludedTag, memoryMatchesAnchorPaths, mergeHotFiles, mergeMemoryVersions, moduleNameOf, newMemoryId, normalizeFindingSeverity, normalizeSessionId, overallScore, parseEslintJson, parseFileAst, parseFindings, parseMemory, parseNpmAudit, parseSarif, parseSince, parseSonar, pathsOverlap, pickSnippetNeedle, planConflictResolution, planGitWatch, prepareBridgeData, preventionLogPath, priorityRank, prioritySignals, projectContextRecentlyEmitted, proposeGateMissDrafts, proposeSeedsFromCommits, pullCrossRepoSources, quarantineNote, queryCodeMap, rankMemoriesLexical, readRecentBriefingMarker, readRuntimeJournalTail, readSessionHandoff, readUsageEvents, recommendFeedbackAdjustment, recordApplied, recordPrevention, recordPreventionHits, recordProjectContextEmission, recordRejection, relPathFrom, renderBootstrapChecklist, renderCaughtForYou, renderPreventionReceipt, resolveBriefingBudget, resolveHaivePaths, resolveManifestFiles, resolveProjectInfo, retirementSignal, revertedShaFromCommit, runRegexSensor, runSensors, runtimeJournalPath, saveCodeMap, saveConfig, saveUsageIndex, scannableSensorTargets, scoreRetrievalCase, scoreSensorCase, selectCommandSensors, sensorAppliesToPath, sensorLedgerPath, sensorPatternBrittleness, sensorSelfCheck, sensorTargetsFromDiff, serializeMemory, snapshotContract, specificityScore, stripPrivate, suggestGate, suggestSensorFromMemory, suggestSensorSeed, suggestTopicKey, summarizeCaughtForYou, summarizeImpact, synthesizeSelfEvalCases, tallyHotFiles, titleFromBody, tokenizeQuery, tokenizeWords, trackDependencies, trackReads, truncateToTokens, usageLogPath, usageLogSize, usagePath, verifyAnchor, watchContracts, withQuarantineNote, withoutQuarantineNote, writeBriefingMarker, writeSessionHandoff };
|
|
2972
|
+
export { AUTOPILOT_DEFAULTS, type Activation, type ActivationContext, ActivationSchema, type AgentContext, type Anchor, AnchorSchema, type AntiPatternGate, type AppliedConflictResolution, type AstExport, type AutoPromoteRule, BRIDGE_MARKERS, BRIDGE_TARGETS, BRIDGE_TARGET_PATH, BRIEFING_MARKER_TTL_MS, BRIEFING_PRESET_DEFAULTS, type BootstrapAssessment, type BootstrapGap, type BootstrapGate, type BootstrapMetrics, type BootstrapState, type BootstrapStateInput, type BreakingChange, type BridgeFileOutput, type BridgeMemoryEntry, type BridgeSensor, type BridgeTarget, type BriefingBudgetNumbers, type BriefingBudgetPreset, type BriefingMarker, type BriefingProofLineOptions, type BudgetPart, type BudgetSlice, type BuildCodeMapOptions, CHARS_PER_TOKEN, CODE_MAP_DEFAULT_EXCLUDE, CODE_MAP_DEFAULT_INCLUDE, CODE_MAP_FILE, CODE_STOPWORDS, CONFIG_FILE, type CaughtForYouOptions, type CaughtForYouRow, type CaughtForYouSummary, type CodeExport, type CodeExportKind, type CodeFileEntry, type CodeMap, type CodeMapQueryOptions, type CollectTimelineOpts, type CommandSensorSpec, type ConfidenceLevel, type ConfidenceThresholds, type ConflictCandidatePair, type ConflictCandidatesOpts, type ConflictResolution, type ContractDiffResult, type ContractFile, type ContractSnapshot, type CoverageGap, type CoverageOptions, CrossRepoProvenanceSchema, type CrossRepoReport, type CrossRepoSource, DECAY_DAYS, DEFAULT_AUTO_PROMOTE_RULE, DEFAULT_BRIEFING_EXCLUDE_TAGS, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CONFIG, DEFAULT_DORMANT_DAYS, DEFAULT_PRIORITY_SIGNALS, type DashboardOptions, type DashboardReport, type DepChange, type DepTrackResult, type DependencySnapshot, type DetectStacksInput, type DetectableStack, type DocFrequency, type DormantRow, type DraftOptions, type DraftsOptions, ENV_WORKAROUND_TAGS, type EvalDelta, type EvalHistoryEntry, type EvalReport, type EvalSpec, type EvalTrend, type FailureCoverageOptions, type FailureObservation, type FeedbackAdjustment, type FeedbackAdjustmentAction, type FeedbackAdjustmentOptions, type Finding, type FindingFormat, type FindingSeverity, GUESSABLE_THRESHOLD, type GateMissProposal, type GatePrecision, type GatePrecisionDelta, type GatePrecisionMetricDelta, type GateTuningSuggestion, type GenerateBridgesOptions, type GitCommit, type GitWatchPlan, type GitWatchState, HAIVE_DIR, HAIVE_OWNED_FILES, HANDOFF_FILENAME, type HaiveConfig, type HaivePaths, type HotFile, type HotFileSource, type ImpactOptions, type ImpactRow, type ImpactScore, type ImpactSummary, type ImpactTier, type InvalidMemoryFile, type LexicalRankResult, type LoadedMemory, MEMORIES_DIR, MIN_WORD_LEN, type Memory, type MemoryDraft, type MemoryFrontmatter, MemoryFrontmatterSchema, type MemoryPriority, type MemoryScope, MemoryScopeSchema, type MemoryStatus, MemoryStatusSchema, type MemoryType, MemoryTypeSchema, type MemoryUsage, type MergeResult, type MetricDelta, PREVENTION_DEBOUNCE_MS, PROJECT_CONTEXT_FILE, PROJECT_CONTEXT_THROTTLE_MS, type PreventionEvent, type PreventionEventDetail, type PreventionReceipt, type PreventionReceiptRow, type PreventionRow, type PreventionSource, type PreventionTrend, type PrioritySignals, type ProposedSensorVerdict, RUNTIME_JOURNAL_FILENAME, type RecurrenceReport, type RecurrenceRow, type ResolveProjectInfo, type RetirementSignal, type RetrievalAggregate, type RetrievalCase, type RetrievalCaseResult, type RuntimeJournalEntry, SEED_QUALITY_FLOOR, SENSOR_ABSENT_LOOKBACK, SENSOR_ABSENT_WINDOW, SESSION_RECAP_TTL_MS, STACK_PACK_TAG, 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 SessionHandoffData, type SkillActivation, type TimelineEntry, type TopicStatusPair, type TruncateOptions, type TruncateResult, USAGE_FILE, USAGE_LOG_DIR, USAGE_LOG_FILE, type UncapturedFailure, type UsageAggregate, type UsageEvent, type UsageIndex, type VerifyOptions, type VerifyResult, addedLinesFromDiff, aggregateRetrieval, aggregateSensors, aggregateUsage, allocateBudget, antiPatternGateParams, appendEvalHistory, appendPreventionEvent, appendRuntimeJournalEntry, appendSensorEvaluations, appendUsageEvent, applyConflictResolution, applyFeedbackAdjustment, assessBootstrapState, assessSensorHealth, bridgeMemorySummary, briefingMarkerPath, briefingMarkersDir, briefingProofLine, buildCodeMap, buildCoverageIndex, buildDashboard, buildDocFrequency, buildFrontmatter, buildHandoffMarkdown, buildPreventionReceipt, buildReport, bumpRead, classifyMemoryPriority, codeMapPath, collectTimelineEntries, compactAutoRecapBody, compareEvalReports, compareGatePrecision, compareImpact, compileRegexSensor, componentOf, computeEvalTrend, computeGatePrecision, computeImpact, computePreventionTrend, computeRecurrence, computeScopeHash, configPath, contractLockPath, countSourceFilesOnDisk, deriveConfidence, detectAgentContext, detectStacksFromManifests, diffContract, diffHasDistinctiveOverlap, distinctiveCap, draftsFromFindings, emptyUsage, emptyUsageIndex, enforcementDir, estimateTokens, evalHistoryPath, evaluateSkillActivation, existingGateMissShas, extractActionsBriefBody, extractReferencedPaths, extractSensorExamples, extractSnippet, filterNewDrafts, findCoverageGaps, findLexicalConflictPairs, findProjectRoot, findTopicStatusConflictPairs, findUncapturedFailures, findingBody, findingToDraft, firstMemoryOneLine, gatePassedShas, generateBridges, getUsage, globToRegExp, handoffAgeMs, handoffFilePath, hasRecentBriefingMarker, hashProjectContext, inferModulesFromPaths, isAutoPromoteEligible, isAutoRecap, isCovered, isDecaying, isDistinctiveToken, isEnvWorkaroundMemory, isFreshIsoDate, isGlobPath, isLikelyGuessable, isNoiseSubject, isRetiredMemory, isSensorScannablePath, isSkill, isSkillSuppressed, isStackPackSeed, isStylisticRule, isTemplateProjectContext, judgeProposedSensor, listMarkdownFilesRecursive, literalMatchesAllTokens, literalMatchesAnyToken, loadCodeMap, loadConfig, loadConfigSync, loadEvalHistory, loadMemoriesFromDir, loadMemoriesFromDirDetailed, loadMemory, loadPreventionEvents, loadSensorLedger, loadUsageIndex, looksLikeGenericAdvice, meetsSeedQualityFloor, memoryFilePath, memoryHasExcludedTag, memoryMatchesAnchorPaths, mergeHotFiles, mergeMemoryVersions, moduleNameOf, newMemoryId, normalizeFindingSeverity, normalizeSessionId, overallScore, parseEslintJson, parseFileAst, parseFindings, parseMemory, parseNpmAudit, parseSarif, parseSince, parseSonar, pathsOverlap, pickSnippetNeedle, planConflictResolution, planGitWatch, prepareBridgeData, preventionLogPath, priorityRank, prioritySignals, projectContextRecentlyEmitted, proposeGateMissDrafts, proposeSeedsFromCommits, pullCrossRepoSources, quarantineNote, queryCodeMap, rankMemoriesLexical, readRecentBriefingMarker, readRuntimeJournalTail, readSessionHandoff, readUsageEvents, recommendFeedbackAdjustment, recordApplied, recordPrevention, recordPreventionHits, recordProjectContextEmission, recordRejection, relPathFrom, renderBootstrapChecklist, renderCaughtForYou, renderPreventionReceipt, resolveBriefingBudget, resolveHaivePaths, resolveManifestFiles, resolveProjectInfo, retirementSignal, revertedShaFromCommit, runRegexSensor, runSensors, runtimeJournalPath, saveCodeMap, saveConfig, saveUsageIndex, scannableSensorTargets, scoreRetrievalCase, scoreSensorCase, selectCommandSensors, sensorAppliesToPath, sensorLedgerPath, sensorPatternBrittleness, sensorPromotedAtMap, sensorSelfCheck, sensorTargetsFromDiff, serializeMemory, snapshotContract, specificityScore, stripPrivate, suggestGate, suggestSensorFromMemory, suggestSensorSeed, suggestTopicKey, summarizeCaughtForYou, summarizeImpact, synthesizeSelfEvalCases, tallyHotFiles, titleFromBody, tokenizeQuery, tokenizeWords, trackDependencies, trackReads, truncateToTokens, usageLogPath, usageLogSize, usagePath, verifyAnchor, watchContracts, withQuarantineNote, withoutQuarantineNote, writeBriefingMarker, writeSessionHandoff };
|
package/dist/index.js
CHANGED
|
@@ -54,7 +54,14 @@ var SensorSchema = z.object({
|
|
|
54
54
|
/** True when Hivelore generated this sensor automatically (vs. hand-authored). */
|
|
55
55
|
autogen: z.boolean().default(false),
|
|
56
56
|
/** ISO timestamp of the last time this sensor matched a diff. */
|
|
57
|
-
last_fired: z.string().nullable().default(null)
|
|
57
|
+
last_fired: z.string().nullable().default(null),
|
|
58
|
+
/**
|
|
59
|
+
* ISO timestamp of the last manual `sensors promote` back to block. Health assessment ignores
|
|
60
|
+
* ledger evaluations older than this — without it, a promoted sensor whose oracle was FIXED is
|
|
61
|
+
* re-quarantined on the next commit for up to 30 days (the stale flaps are still in the window),
|
|
62
|
+
* making the promotion promised by the quarantine note a no-op.
|
|
63
|
+
*/
|
|
64
|
+
promoted_at: z.string().optional()
|
|
58
65
|
});
|
|
59
66
|
var ActivationSchema = z.object({
|
|
60
67
|
/** Case-insensitive substrings matched against the task text. */
|
|
@@ -4113,11 +4120,16 @@ function computeScopeHash(root, scopedFiles) {
|
|
|
4113
4120
|
return "";
|
|
4114
4121
|
}
|
|
4115
4122
|
}
|
|
4116
|
-
function assessSensorHealth(evaluations, now = /* @__PURE__ */ new Date()) {
|
|
4123
|
+
function assessSensorHealth(evaluations, now = /* @__PURE__ */ new Date(), opts = {}) {
|
|
4117
4124
|
const cutoff = now.getTime() - 30 * DAY_MS;
|
|
4118
4125
|
const byMemory = /* @__PURE__ */ new Map();
|
|
4119
4126
|
for (const e of evaluations) {
|
|
4120
4127
|
if (e.memory_id === "__gate__" || e.kind !== "shell" && e.kind !== "test") continue;
|
|
4128
|
+
const promotedAtIso = opts.promotedAt?.get(e.memory_id);
|
|
4129
|
+
if (promotedAtIso) {
|
|
4130
|
+
const promoted = Date.parse(promotedAtIso);
|
|
4131
|
+
if (Number.isFinite(promoted) && Date.parse(e.at) <= promoted) continue;
|
|
4132
|
+
}
|
|
4121
4133
|
const list = byMemory.get(e.memory_id) ?? [];
|
|
4122
4134
|
list.push(e);
|
|
4123
4135
|
byMemory.set(e.memory_id, list);
|
|
@@ -4157,6 +4169,13 @@ function assessSensorHealth(evaluations, now = /* @__PURE__ */ new Date()) {
|
|
|
4157
4169
|
}
|
|
4158
4170
|
return out.sort((a, b) => a.memory_id.localeCompare(b.memory_id));
|
|
4159
4171
|
}
|
|
4172
|
+
function sensorPromotedAtMap(frontmatters) {
|
|
4173
|
+
const out = /* @__PURE__ */ new Map();
|
|
4174
|
+
for (const fm of frontmatters) {
|
|
4175
|
+
if (fm.sensor?.promoted_at) out.set(fm.id, fm.sensor.promoted_at);
|
|
4176
|
+
}
|
|
4177
|
+
return out;
|
|
4178
|
+
}
|
|
4160
4179
|
function quarantineNote(at, flapCount) {
|
|
4161
4180
|
return `> Quarantined ${at}: oracle flapped ${flapCount}\xD7 on identical inputs \u2014 demoted block\u2192warn. Fix the test, then re-promote with \`hivelore sensors promote <id>\`.`;
|
|
4162
4181
|
}
|
|
@@ -5349,7 +5368,7 @@ function shaMatches(set, sha) {
|
|
|
5349
5368
|
}
|
|
5350
5369
|
return false;
|
|
5351
5370
|
}
|
|
5352
|
-
function proposeGateMissDrafts(commits, existingRevertedShas, passedShas) {
|
|
5371
|
+
function proposeGateMissDrafts(commits, existingRevertedShas, passedShas, opts = {}) {
|
|
5353
5372
|
const seeds = proposeSeedsFromCommits(commits, commits.length);
|
|
5354
5373
|
const bySha = new Map(commits.map((commit) => [commit.sha, commit]));
|
|
5355
5374
|
const seen = new Set(existingRevertedShas);
|
|
@@ -5361,7 +5380,7 @@ function proposeGateMissDrafts(commits, existingRevertedShas, passedShas) {
|
|
|
5361
5380
|
if (shaMatches(seen, failedSha)) continue;
|
|
5362
5381
|
seen.add(failedSha);
|
|
5363
5382
|
const gatePassed = shaMatches(passedShas, failedSha);
|
|
5364
|
-
const paths = (commit.files ?? []).slice(0, 8);
|
|
5383
|
+
const paths = (commit.files ?? []).filter((p) => !p.startsWith(".ai/")).filter((p) => opts.pathExists?.(p) ?? true).slice(0, 8);
|
|
5365
5384
|
const base = `# Gate miss: ${seed.what}
|
|
5366
5385
|
|
|
5367
5386
|
A git ${seed.kind} indicates that a change escaped the existing harness. This is a proposed lesson only; review the actual regression before validating it.
|
|
@@ -5374,7 +5393,7 @@ Subject: ${seed.what}
|
|
|
5374
5393
|
**Why it failed / do NOT use:** ${seed.why_failed}
|
|
5375
5394
|
`;
|
|
5376
5395
|
const gateLine = gatePassed ? "\nThe gate PASSED this commit \u2014 a validated sensor here upgrades the harness.\n" : "";
|
|
5377
|
-
const candidate = suggestSensorSeed(
|
|
5396
|
+
const candidate = suggestSensorSeed(seed.what, paths);
|
|
5378
5397
|
const sensorHint = candidate ? `
|
|
5379
5398
|
proposed_sensor_seed: ${JSON.stringify(candidate)}
|
|
5380
5399
|
` : "\nproposed_sensor_seed: inspect the revert diff, then author a deterministic candidate with `hivelore sensors propose <id>`.\n";
|
|
@@ -5869,6 +5888,7 @@ export {
|
|
|
5869
5888
|
sensorAppliesToPath,
|
|
5870
5889
|
sensorLedgerPath,
|
|
5871
5890
|
sensorPatternBrittleness,
|
|
5891
|
+
sensorPromotedAtMap,
|
|
5872
5892
|
sensorSelfCheck,
|
|
5873
5893
|
sensorTargetsFromDiff,
|
|
5874
5894
|
serializeMemory,
|