@hivelore/core 0.57.7 → 0.58.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 +41 -1
- package/dist/index.js +67 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1600,6 +1600,23 @@ declare function pathsOverlap(a: string, b: string): boolean;
|
|
|
1600
1600
|
declare function memoryMatchesAnchorPaths(memory: LoadedMemory["memory"], inputPaths: string[]): boolean;
|
|
1601
1601
|
declare function isGlobPath(p: string): boolean;
|
|
1602
1602
|
declare function globToRegExp(pattern: string): RegExp;
|
|
1603
|
+
/** Below this many semantic hits a distribution is not meaningful — behave exactly as before. */
|
|
1604
|
+
declare const ADAPTIVE_FLOOR_MIN_SAMPLES = 12;
|
|
1605
|
+
/**
|
|
1606
|
+
* A distribution-aware floor for semantic-only hits.
|
|
1607
|
+
*
|
|
1608
|
+
* Field report 2026-09-01 §4.1: on a broad corpus (~40 memories) cosine scores compress into a
|
|
1609
|
+
* narrow band (everything > 0.55), so an ABSOLUTE `min_semantic_score` sorts nothing — the same
|
|
1610
|
+
* three or four unrelated memories surface for every task at ~0.6. The fix the report asks for is
|
|
1611
|
+
* to judge a score against the corpus distribution rather than in the absolute.
|
|
1612
|
+
*
|
|
1613
|
+
* This returns `mean + halfStdDev`, which self-adjusts: on a compressed distribution it rises toward
|
|
1614
|
+
* the mean and trims the undifferentiated mass; on a discriminating one it sits between the winner
|
|
1615
|
+
* and the noise. It NEVER drops below the caller's explicit floor, NEVER excludes the single top
|
|
1616
|
+
* hit, and does nothing at all below {@link ADAPTIVE_FLOOR_MIN_SAMPLES} samples (so small corpora —
|
|
1617
|
+
* and the retrieval eval — are unaffected). Pure.
|
|
1618
|
+
*/
|
|
1619
|
+
declare function adaptiveSemanticFloor(scores: number[], explicitFloor?: number): number;
|
|
1603
1620
|
declare function relPathFrom(root: string, abs: string): string;
|
|
1604
1621
|
|
|
1605
1622
|
/**
|
|
@@ -3981,6 +3998,29 @@ declare function isAutoRecap(body: string): boolean;
|
|
|
3981
3998
|
* returned unchanged.
|
|
3982
3999
|
*/
|
|
3983
4000
|
declare function compactAutoRecapBody(body: string, maxChars?: number): string;
|
|
4001
|
+
/**
|
|
4002
|
+
* The excerpt of a recap that belongs at the TOP of every briefing: only what the next session must
|
|
4003
|
+
* act on — the goal in one line and the next steps.
|
|
4004
|
+
*
|
|
4005
|
+
* A full human/post_task recap (goal + accomplished + discoveries + next steps) ran ~3000 tokens and
|
|
4006
|
+
* was re-emitted at the head of EVERY briefing, so a session with five briefings paid five times to
|
|
4007
|
+
* re-read a wall the agent had just written (field report 2026-09-01 §5.6). The full body stays in
|
|
4008
|
+
* the corpus — reachable with `mem_get <id>` — this only trims what the briefing head carries. Auto
|
|
4009
|
+
* recaps still route through {@link compactAutoRecapBody}. Pure.
|
|
4010
|
+
*/
|
|
4011
|
+
declare function recapBriefingExcerpt(body: string, maxChars?: number): string;
|
|
4012
|
+
/** Heading that separates the current recap from the archived per-session history. */
|
|
4013
|
+
declare const RECAP_HISTORY_HEADING = "## Session history";
|
|
4014
|
+
/** How many past sessions to retain — bounded so the recap file cannot grow without limit. */
|
|
4015
|
+
declare const RECAP_HISTORY_MAX = 6;
|
|
4016
|
+
/**
|
|
4017
|
+
* Fold the previous recap into a bounded per-session history so a topic-upsert stops destroying the
|
|
4018
|
+
* record of earlier sessions (field report 2026-09-01 §5.6: "I can't know what the last three
|
|
4019
|
+
* sessions did"). The NEW session's full recap stays at the top — so `recapBriefingExcerpt` still
|
|
4020
|
+
* surfaces only the latest goal + next steps — with the previous session archived as one compact
|
|
4021
|
+
* entry beneath a `## Session history` heading, capped at {@link RECAP_HISTORY_MAX} entries. Pure.
|
|
4022
|
+
*/
|
|
4023
|
+
declare function buildRecapWithHistory(newMainBody: string, previousBody: string | null, previousDateISO: string | null, maxEntries?: number): string;
|
|
3984
4024
|
|
|
3985
4025
|
/** Filename of the ephemeral handoff at the repo root. */
|
|
3986
4026
|
declare const HANDOFF_FILENAME = "NEXT.md";
|
|
@@ -4149,4 +4189,4 @@ interface ReviewDraftOptions {
|
|
|
4149
4189
|
/** Template review learnings into proposed-memory drafts (reuses the scanner-ingest draft shape). */
|
|
4150
4190
|
declare function reviewLearningsToDrafts(learnings: ReviewLearning[], options?: ReviewDraftOptions): MemoryDraft[];
|
|
4151
4191
|
|
|
4152
|
-
export { AUTOPILOT_DEFAULTS, type Activation, type ActivationContext, ActivationSchema, type AgentContext, type Anchor, type AnchorAuditRow, type AnchorChurn, AnchorSchema, type AntiPatternGate, type AppendFrictionInput, type AppendFrictionResult, type AppliedConflictResolution, type AstExport, type AutoPromoteRule, BRIDGE_MARKERS, BRIDGE_TARGETS, BRIDGE_TARGET_PATH, BRIEFING_MARKER_TTL_MS, BRIEFING_PRESET_DEFAULTS, type BaselineHealth, type BehaviourCoverageInput, type BehaviourCoverageMetrics, type BehaviourOracleInfo, type BootstrapAssessment, type BootstrapGap, type BootstrapGate, type BootstrapMetrics, type BootstrapState, type BootstrapStateInput, type BreakingChange, type BridgeFileOutput, type BridgeMemoryEntry, type BridgeSensor, type BridgeTarget, type BriefingBudgetNumbers, type BriefingBudgetPreset, type BriefingMarker, type BriefingProofLineOptions, type BudgetPart, type BudgetSlice, type BuildCodeMapOptions, CHARS_PER_TOKEN, CODE_MAP_DEFAULT_EXCLUDE, CODE_MAP_DEFAULT_INCLUDE, CODE_MAP_FILE, CODE_STOPWORDS, CONFIG_FILE, CONTENT_CATCH_CODES, type CaughtForYouOptions, type CaughtForYouRow, type CaughtForYouSummary, type CodeExport, type CodeExportKind, type CodeFileEntry, type CodeMap, type CodeMapQueryOptions, type CollectTimelineOpts, type CommandSensorSpec, type ConfidenceLevel, type ConfidenceThresholds, type ConflictCandidatePair, type ConflictCandidatesOpts, type ConflictResolution, type ContractCheck, type ContractDiffResult, type ContractFile, type ContractSnapshot, type CoverageGap, type CoverageOptions, CrossRepoProvenanceSchema, type CrossRepoReport, type CrossRepoSource, DECAY_DAYS, DEFAULT_AUTO_PROMOTE_RULE, DEFAULT_BRIEFING_EXCLUDE_TAGS, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CONFIG, DEFAULT_DORMANT_DAYS, DEFAULT_POSTURE, DEFAULT_PRIORITY_SIGNALS, DEFAULT_SPECIFICITY, type DashboardOptions, type DashboardReport, type DepChange, type DepTrackResult, type DependencySnapshot, type DetectStacksInput, type DetectableStack, type DistilledFailureLesson, type DocFrequency, type DormantRow, type DraftOptions, type DraftsOptions, ENV_WORKAROUND_TAGS, type EvalDelta, type EvalHistoryEntry, type EvalReport, type EvalSpec, type EvalTrend, FRICTION_FIELD_MAX, FRICTION_LOG_FILE, FRICTION_STATE_FILE, type FailureCoverageOptions, type FailureObservation, type FeedbackAdjustment, type FeedbackAdjustmentAction, type FeedbackAdjustmentOptions, type Finding, type FindingFormat, type FindingSeverity, type FrictionGroup, type FrictionKind, type FrictionReport, type FrictionState, type FrictionStateEntry, type FrictionStatus, GATE_REMINDER_WINDOW_MS, GUESSABLE_THRESHOLD, type GateFinding, type GateMissProposal, type GatePolicy, type GatePolicyInput, type GatePosture, type GatePrecision, type GatePrecisionDelta, type GatePrecisionMetricDelta, type GateSeverity, type GateStage, type GateTuningSuggestion, type GateVerdict, type GateVerdictInput, type GenerateBridgesOptions, type GitCommit, type GitWatchPlan, type GitWatchState, 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, REVIEW_LEARNING_MARKER, RUNTIME_JOURNAL_FILENAME, type RecurrenceReport, type RecurrenceRow, type ResolveProjectInfo, type RetirementSignal, type RetrievalAggregate, type RetrievalCase, type RetrievalCaseResult, type ReviewDraftOptions, type ReviewLearning, type RuntimeJournalEntry, SCAFFOLD_MARKER_RE, SEED_QUALITY_FLOOR, SENSOR_ABSENT_LOOKBACK, SENSOR_ABSENT_WINDOW, SESSION_RECAP_TTL_MS, SETUP_GATE_CODES, STACK_PACK_TAG, type ScaffoldLoopGap, type ScaffoldOptions, type ScaffoldStyle, type SeedProposal, type SelfEvalOptions, type Sensor, type SensorAggregate, type SensorCase, type SensorCaseResult, type SensorEvaluation, type SensorEvaluationOutcome, type SensorEvaluationStage, type SensorFlap, type SensorHealth, type SensorHit, type SensorRow, SensorSchema, type SensorSeed, type SensorSelfCheck, type SensorSuggestionOptions, type SensorTarget, type SensorWeakening, type SessionHandoffData, type SkillActivation, TEST_FRAMEWORKS, type TestFramework, type TestScaffold, type TierContractCheck, type TimelineEntry, type TopicStatusPair, type TruncateOptions, type TruncateResult, USAGE_FILE, USAGE_LOG_DIR, USAGE_LOG_FILE, type UncapturedFailure, type UncoveredAreaSuggestion, type UsageAggregate, type UsageEvent, type UsageIndex, type VerifyOptions, type VerifyResult, WEAK_ANCHOR_CHURN_RATIO, addedLineNumbersFromDiff, addedLinesFromDiff, aggregateRetrieval, aggregateSensors, aggregateUsage, allocateBudget, anchorMatchesComponent, anchorSpecificity, antiPatternGateParams, appendEvalHistory, appendFrictionReport, appendPreventionEvent, appendProposedRetrievalCases, appendRuntimeJournalEntry, appendSensorEvaluations, appendUsageEvent, applyConflictResolution, applyFeedbackAdjustment, approveProposedCases, assessBehaviourCoverage, assessBootstrapState, assessScaffoldLoop, assessSensorHealth, auditAnchorSpecificity, bridgeMemorySummary, briefingMarkerPath, briefingMarkersDir, briefingProofLine, buildBaselineHealthFinding, buildCodeMap, buildCoverageIndex, buildDashboard, buildDocFrequency, buildFrontmatter, buildHandoffMarkdown, buildPreventionReceipt, buildProposeCommand, buildReport, bumpRead, 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, 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 };
|
|
4192
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -517,6 +517,22 @@ function globLiteralPrefix(pattern) {
|
|
|
517
517
|
const slash = norm.slice(0, firstGlob).lastIndexOf("/");
|
|
518
518
|
return slash < 0 ? "" : norm.slice(0, slash);
|
|
519
519
|
}
|
|
520
|
+
var ADAPTIVE_FLOOR_MIN_SAMPLES = 12;
|
|
521
|
+
function adaptiveSemanticFloor(scores, explicitFloor = 0) {
|
|
522
|
+
if (scores.length < ADAPTIVE_FLOOR_MIN_SAMPLES) return explicitFloor;
|
|
523
|
+
let sum = 0;
|
|
524
|
+
let top = -Infinity;
|
|
525
|
+
for (const s of scores) {
|
|
526
|
+
sum += s;
|
|
527
|
+
if (s > top) top = s;
|
|
528
|
+
}
|
|
529
|
+
const mean = sum / scores.length;
|
|
530
|
+
let variance = 0;
|
|
531
|
+
for (const s of scores) variance += (s - mean) ** 2;
|
|
532
|
+
const std = Math.sqrt(variance / scores.length);
|
|
533
|
+
const distributional = mean + 0.5 * std;
|
|
534
|
+
return Math.max(explicitFloor, Math.min(distributional, top - 1e-6));
|
|
535
|
+
}
|
|
520
536
|
function relPathFrom(root, abs) {
|
|
521
537
|
return path3.relative(root, abs).replace(/\\/g, "/");
|
|
522
538
|
}
|
|
@@ -1096,6 +1112,7 @@ function renderPreventionReceiptShare(receipt) {
|
|
|
1096
1112
|
var PREVENTION_RECEIPT_MARKER = "<!-- haive:prevention-receipt -->";
|
|
1097
1113
|
function renderPreventionComment(receipt, findings = []) {
|
|
1098
1114
|
const fired = findings.filter((f) => f.code === "sensor-block" || f.code === "sensor-warn");
|
|
1115
|
+
if (fired.length === 0 && receipt.total === 0) return "";
|
|
1099
1116
|
const lines = [PREVENTION_RECEIPT_MARKER, "", "## Hivelore prevention receipt", ""];
|
|
1100
1117
|
if (fired.length === 0) {
|
|
1101
1118
|
lines.push("No documented sensor fired on this PR.", "");
|
|
@@ -1803,7 +1820,7 @@ function generateBridges(memories, sensors, opts) {
|
|
|
1803
1820
|
|
|
1804
1821
|
// src/sensors.ts
|
|
1805
1822
|
function sensorPatternBrittleness(pattern) {
|
|
1806
|
-
const literal = pattern.replace(/\\[a-zA-Z]/g, " ").replace(/\[[^\]]*\]/g, " ").replace(/\{[^}]*\}/g, " ").replace(/\b\d{1,3}(?:\s*\\?\.\s*\d{1,3}){2,3}\b/g, " ");
|
|
1823
|
+
const literal = pattern.replace(/(?:\/|%|\\[/*]|\[[^\]]*[/*][^\]]*\])[^\d]{0,4}\d{3,}/g, " ").replace(/\\[a-zA-Z]/g, " ").replace(/\[[^\]]*\]/g, " ").replace(/\{[^}]*\}/g, " ").replace(/\b\d{1,3}(?:\s*\\?\.\s*\d{1,3}){2,3}\b/g, " ");
|
|
1807
1824
|
const range = literal.match(/\d{2,}\s*-\s*\d{2,}/);
|
|
1808
1825
|
if (range) return `hardcoded line/number range "${range[0].replace(/\s+/g, "")}" \u2014 rots when code shifts`;
|
|
1809
1826
|
const numeric = literal.match(/\d{3,}/);
|
|
@@ -7209,10 +7226,7 @@ Subject: ${seed.what}
|
|
|
7209
7226
|
**Why it failed / do NOT use:** ${seed.why_failed}
|
|
7210
7227
|
`;
|
|
7211
7228
|
const gateLine = gatePassed ? "\nThe gate PASSED this commit \u2014 a validated sensor here upgrades the harness.\n" : "";
|
|
7212
|
-
const
|
|
7213
|
-
const sensorHint = candidate ? `
|
|
7214
|
-
proposed_sensor_seed: ${JSON.stringify(candidate)}
|
|
7215
|
-
` : "\nproposed_sensor_seed: inspect the revert diff, then author a deterministic candidate with `hivelore sensors propose <id>`.\n";
|
|
7229
|
+
const sensorHint = "\nproposed_sensor_seed: inspect the revert diff, then author a deterministic candidate with `hivelore sensors propose --from-fix <revert-sha>` (it mines the fix diff and validates).\n";
|
|
7216
7230
|
out.push({
|
|
7217
7231
|
slug: `gate-miss-${failedSha.slice(0, 12)}`,
|
|
7218
7232
|
reverted_sha: failedSha,
|
|
@@ -7349,6 +7363,48 @@ _No notable discoveries captured. Run post_task / \`mem_session_end\` for a rich
|
|
|
7349
7363
|
**Discoveries:**
|
|
7350
7364
|
${trimmed}`;
|
|
7351
7365
|
}
|
|
7366
|
+
function recapBriefingExcerpt(body, maxChars = 700) {
|
|
7367
|
+
if (isAutoRecap(body)) return compactAutoRecapBody(body);
|
|
7368
|
+
const section = (name) => body.match(name)?.[1]?.trim() ?? "";
|
|
7369
|
+
const goal = section(/##+\s*Goal[^\n]*\n+([\s\S]*?)(?=\n##+\s|\n*$)/i);
|
|
7370
|
+
const next = section(/##+\s*Next steps?[^\n]*\n([\s\S]*?)(?=\n##+\s|\n*$)/i);
|
|
7371
|
+
if (!goal && !next) return body.length > maxChars ? body.slice(0, maxChars).trimEnd() + "\u2026" : body;
|
|
7372
|
+
const parts = [];
|
|
7373
|
+
if (goal) parts.push(`_${goal.split("\n")[0].trim()}_`);
|
|
7374
|
+
parts.push(next ? `**Next steps:**
|
|
7375
|
+
${next}` : "_No next steps recorded \u2014 `mem_get <id>` for the full recap._");
|
|
7376
|
+
let out = parts.join("\n\n");
|
|
7377
|
+
if (out.length > maxChars) out = out.slice(0, maxChars).trimEnd() + "\u2026";
|
|
7378
|
+
return out;
|
|
7379
|
+
}
|
|
7380
|
+
var RECAP_HISTORY_HEADING = "## Session history";
|
|
7381
|
+
var RECAP_HISTORY_MAX = 6;
|
|
7382
|
+
function summarizeRecapForHistory(mainBody, dateISO) {
|
|
7383
|
+
const goal = mainBody.match(/##+\s*Goal[^\n]*\n+([^\n]+)/i)?.[1]?.trim() ?? "";
|
|
7384
|
+
const next = mainBody.match(/##+\s*Next steps?[^\n]*\n([\s\S]*?)(?=\n##+\s|$)/i)?.[1]?.trim() ?? "";
|
|
7385
|
+
const date = /^\d{4}-\d{2}-\d{2}/.test(dateISO) ? dateISO.slice(0, 10) : dateISO;
|
|
7386
|
+
const lines = [`### ${date}`];
|
|
7387
|
+
if (goal) lines.push(goal);
|
|
7388
|
+
if (next) lines.push(`**Next:** ${next.replace(/\s*\n+\s*/g, " ").slice(0, 300)}`);
|
|
7389
|
+
return lines.join("\n");
|
|
7390
|
+
}
|
|
7391
|
+
function buildRecapWithHistory(newMainBody, previousBody, previousDateISO, maxEntries = RECAP_HISTORY_MAX) {
|
|
7392
|
+
if (!previousBody?.trim()) return newMainBody;
|
|
7393
|
+
const marker = `
|
|
7394
|
+
${RECAP_HISTORY_HEADING}`;
|
|
7395
|
+
const idx = previousBody.indexOf(marker);
|
|
7396
|
+
const prevMain = (idx >= 0 ? previousBody.slice(0, idx) : previousBody).trimEnd();
|
|
7397
|
+
const prevHistory = idx >= 0 ? previousBody.slice(idx + marker.length).replace(/^\s+/, "").trimEnd() : "";
|
|
7398
|
+
const archived = summarizeRecapForHistory(prevMain, previousDateISO ?? (/* @__PURE__ */ new Date()).toISOString());
|
|
7399
|
+
const combined = [archived, prevHistory].filter(Boolean).join("\n\n");
|
|
7400
|
+
const kept = combined.split(/\n(?=### )/).slice(0, maxEntries).join("\n");
|
|
7401
|
+
return `${newMainBody.trimEnd()}
|
|
7402
|
+
|
|
7403
|
+
${RECAP_HISTORY_HEADING}
|
|
7404
|
+
|
|
7405
|
+
${kept}
|
|
7406
|
+
`;
|
|
7407
|
+
}
|
|
7352
7408
|
|
|
7353
7409
|
// src/handoff.ts
|
|
7354
7410
|
import { writeFile as writeFile13, readFile as readFile18, stat as stat4 } from "fs/promises";
|
|
@@ -7529,6 +7585,7 @@ ${learning.instruction}
|
|
|
7529
7585
|
return drafts;
|
|
7530
7586
|
}
|
|
7531
7587
|
export {
|
|
7588
|
+
ADAPTIVE_FLOOR_MIN_SAMPLES,
|
|
7532
7589
|
AUTOPILOT_DEFAULTS,
|
|
7533
7590
|
ActivationSchema,
|
|
7534
7591
|
AnchorSchema,
|
|
@@ -7576,6 +7633,8 @@ export {
|
|
|
7576
7633
|
PROCESS_GATE_CODES,
|
|
7577
7634
|
PROJECT_CONTEXT_FILE,
|
|
7578
7635
|
PROJECT_CONTEXT_THROTTLE_MS,
|
|
7636
|
+
RECAP_HISTORY_HEADING,
|
|
7637
|
+
RECAP_HISTORY_MAX,
|
|
7579
7638
|
REVIEW_LEARNING_MARKER,
|
|
7580
7639
|
RUNTIME_JOURNAL_FILENAME,
|
|
7581
7640
|
SCAFFOLD_MARKER_RE,
|
|
@@ -7591,6 +7650,7 @@ export {
|
|
|
7591
7650
|
USAGE_LOG_DIR,
|
|
7592
7651
|
USAGE_LOG_FILE,
|
|
7593
7652
|
WEAK_ANCHOR_CHURN_RATIO,
|
|
7653
|
+
adaptiveSemanticFloor,
|
|
7594
7654
|
addedLineNumbersFromDiff,
|
|
7595
7655
|
addedLinesFromDiff,
|
|
7596
7656
|
aggregateRetrieval,
|
|
@@ -7628,6 +7688,7 @@ export {
|
|
|
7628
7688
|
buildHandoffMarkdown,
|
|
7629
7689
|
buildPreventionReceipt,
|
|
7630
7690
|
buildProposeCommand,
|
|
7691
|
+
buildRecapWithHistory,
|
|
7631
7692
|
buildReport,
|
|
7632
7693
|
bumpRead,
|
|
7633
7694
|
changedPathsFromDiff,
|
|
@@ -7793,6 +7854,7 @@ export {
|
|
|
7793
7854
|
readRuntimeJournalTail,
|
|
7794
7855
|
readSessionHandoff,
|
|
7795
7856
|
readUsageEvents,
|
|
7857
|
+
recapBriefingExcerpt,
|
|
7796
7858
|
recommendFeedbackAdjustment,
|
|
7797
7859
|
recordApplied,
|
|
7798
7860
|
recordGateReminder,
|