@hivelore/core 0.31.0 → 0.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -43,6 +43,8 @@ declare const SensorSchema: z.ZodObject<{
43
43
  flags: z.ZodOptional<z.ZodString>;
44
44
  /** Shell/test command to run (for kind=shell|test). Executed by the CLI, never by core. */
45
45
  command: z.ZodOptional<z.ZodString>;
46
+ /** Max runtime for kind=shell|test commands (default 120000). The executor kills on expiry. */
47
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
46
48
  /** Glob-ish path prefixes the sensor applies to. Falls back to the memory's anchor paths when empty. */
47
49
  paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
48
50
  /** LLM-facing self-correction message: what was done wrong and what to do instead. */
@@ -64,6 +66,7 @@ declare const SensorSchema: z.ZodObject<{
64
66
  absent?: string | undefined;
65
67
  flags?: string | undefined;
66
68
  command?: string | undefined;
69
+ timeout_ms?: number | undefined;
67
70
  }, {
68
71
  message: string;
69
72
  paths?: string[] | undefined;
@@ -72,6 +75,7 @@ declare const SensorSchema: z.ZodObject<{
72
75
  absent?: string | undefined;
73
76
  flags?: string | undefined;
74
77
  command?: string | undefined;
78
+ timeout_ms?: number | undefined;
75
79
  severity?: "warn" | "block" | undefined;
76
80
  autogen?: boolean | undefined;
77
81
  last_fired?: string | null | undefined;
@@ -138,6 +142,8 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
138
142
  flags: z.ZodOptional<z.ZodString>;
139
143
  /** Shell/test command to run (for kind=shell|test). Executed by the CLI, never by core. */
140
144
  command: z.ZodOptional<z.ZodString>;
145
+ /** Max runtime for kind=shell|test commands (default 120000). The executor kills on expiry. */
146
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
141
147
  /** Glob-ish path prefixes the sensor applies to. Falls back to the memory's anchor paths when empty. */
142
148
  paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
143
149
  /** LLM-facing self-correction message: what was done wrong and what to do instead. */
@@ -159,6 +165,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
159
165
  absent?: string | undefined;
160
166
  flags?: string | undefined;
161
167
  command?: string | undefined;
168
+ timeout_ms?: number | undefined;
162
169
  }, {
163
170
  message: string;
164
171
  paths?: string[] | undefined;
@@ -167,6 +174,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
167
174
  absent?: string | undefined;
168
175
  flags?: string | undefined;
169
176
  command?: string | undefined;
177
+ timeout_ms?: number | undefined;
170
178
  severity?: "warn" | "block" | undefined;
171
179
  autogen?: boolean | undefined;
172
180
  last_fired?: string | null | undefined;
@@ -248,6 +256,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
248
256
  absent?: string | undefined;
249
257
  flags?: string | undefined;
250
258
  command?: string | undefined;
259
+ timeout_ms?: number | undefined;
251
260
  } | undefined;
252
261
  activation?: {
253
262
  keywords: string[];
@@ -277,6 +286,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
277
286
  absent?: string | undefined;
278
287
  flags?: string | undefined;
279
288
  command?: string | undefined;
289
+ timeout_ms?: number | undefined;
280
290
  severity?: "warn" | "block" | undefined;
281
291
  autogen?: boolean | undefined;
282
292
  last_fired?: string | null | undefined;
@@ -330,6 +340,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
330
340
  absent?: string | undefined;
331
341
  flags?: string | undefined;
332
342
  command?: string | undefined;
343
+ timeout_ms?: number | undefined;
333
344
  } | undefined;
334
345
  activation?: {
335
346
  keywords: string[];
@@ -359,6 +370,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
359
370
  absent?: string | undefined;
360
371
  flags?: string | undefined;
361
372
  command?: string | undefined;
373
+ timeout_ms?: number | undefined;
362
374
  severity?: "warn" | "block" | undefined;
363
375
  autogen?: boolean | undefined;
364
376
  last_fired?: string | null | undefined;
@@ -459,6 +471,19 @@ interface LoadedMemory {
459
471
  declare function listMarkdownFilesRecursive(dir: string): Promise<string[]>;
460
472
  declare function loadMemory(filePath: string): Promise<LoadedMemory>;
461
473
  declare function loadMemoriesFromDir(dir: string): Promise<LoadedMemory[]>;
474
+ interface InvalidMemoryFile {
475
+ filePath: string;
476
+ error: string;
477
+ }
478
+ /**
479
+ * Like loadMemoriesFromDir, but also reports files that failed to parse instead of
480
+ * dropping them silently — a corrupt frontmatter otherwise makes a team lesson
481
+ * vanish without any signal. Surfaced by `hivelore doctor`.
482
+ */
483
+ declare function loadMemoriesFromDirDetailed(dir: string): Promise<{
484
+ loaded: LoadedMemory[];
485
+ invalid: InvalidMemoryFile[];
486
+ }>;
462
487
 
463
488
  declare function tokenizeQuery(query: string): string[];
464
489
  declare function literalMatchesAllTokens(memory: Memory, tokens: string[]): boolean;
@@ -1138,6 +1163,8 @@ interface BuildCodeMapOptions {
1138
1163
  /** Include untracked files that are not ignored by git. Default: false when the root is a git repo. */
1139
1164
  includeUntracked?: boolean;
1140
1165
  }
1166
+ declare const CODE_MAP_DEFAULT_INCLUDE: string[];
1167
+ declare const CODE_MAP_DEFAULT_EXCLUDE: string[];
1141
1168
  declare function codeMapPath(paths: HaivePaths): string;
1142
1169
  declare function loadCodeMap(paths: HaivePaths): Promise<CodeMap | null>;
1143
1170
  declare function saveCodeMap(paths: HaivePaths, map: CodeMap): Promise<void>;
@@ -1851,6 +1878,8 @@ interface CommandSensorSpec {
1851
1878
  message: string;
1852
1879
  /** Anchor/scoped paths this sensor cares about (for reporting). */
1853
1880
  paths: string[];
1881
+ /** Max runtime in ms (executor default applies when unset). */
1882
+ timeout_ms?: number;
1854
1883
  }
1855
1884
  /**
1856
1885
  * Select the shell/test sensors that apply to `changedPaths`. With no changed paths (or a sensor
@@ -2782,4 +2811,4 @@ interface AgentContext {
2782
2811
  }
2783
2812
  declare function detectAgentContext(env?: Record<string, string | undefined>): AgentContext;
2784
2813
 
2785
- 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_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 GatePrecision, type GatePrecisionDelta, type GatePrecisionMetricDelta, type GateTuningSuggestion, type GenerateBridgesOptions, type GitCommit, 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 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 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 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, appendUsageEvent, applyConflictResolution, applyFeedbackAdjustment, assessBootstrapState, bridgeMemorySummary, briefingMarkerPath, briefingMarkersDir, briefingProofLine, buildCodeMap, buildCoverageIndex, buildDashboard, buildDocFrequency, buildFrontmatter, buildHandoffMarkdown, buildReport, bumpRead, classifyMemoryPriority, codeMapPath, collectTimelineEntries, compactAutoRecapBody, compareEvalReports, compareGatePrecision, compareImpact, compileRegexSensor, componentOf, computeEvalTrend, computeGatePrecision, computeImpact, computePreventionTrend, computeRecurrence, configPath, contractLockPath, countSourceFilesOnDisk, deriveConfidence, detectAgentContext, detectStacksFromManifests, diffContract, diffHasDistinctiveOverlap, distinctiveCap, draftsFromFindings, emptyUsage, emptyUsageIndex, enforcementDir, estimateTokens, evalHistoryPath, evaluateSkillActivation, extractActionsBriefBody, extractReferencedPaths, extractSensorExamples, extractSnippet, filterNewDrafts, findCoverageGaps, findLexicalConflictPairs, findProjectRoot, findTopicStatusConflictPairs, findUncapturedFailures, findingBody, findingToDraft, firstMemoryOneLine, 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, loadMemory, loadPreventionEvents, loadUsageIndex, looksLikeGenericAdvice, meetsSeedQualityFloor, memoryFilePath, memoryHasExcludedTag, memoryMatchesAnchorPaths, mergeHotFiles, mergeMemoryVersions, moduleNameOf, newMemoryId, normalizeFindingSeverity, normalizeSessionId, overallScore, parseEslintJson, parseFileAst, parseFindings, parseMemory, parseNpmAudit, parseSarif, parseSince, parseSonar, pathsOverlap, pickSnippetNeedle, planConflictResolution, prepareBridgeData, preventionLogPath, priorityRank, prioritySignals, projectContextRecentlyEmitted, proposeSeedsFromCommits, pullCrossRepoSources, queryCodeMap, rankMemoriesLexical, readRecentBriefingMarker, readRuntimeJournalTail, readSessionHandoff, readUsageEvents, recommendFeedbackAdjustment, recordApplied, recordPrevention, recordPreventionHits, recordProjectContextEmission, recordRejection, relPathFrom, renderBootstrapChecklist, renderCaughtForYou, resolveBriefingBudget, resolveHaivePaths, resolveManifestFiles, resolveProjectInfo, retirementSignal, runRegexSensor, runSensors, runtimeJournalPath, saveCodeMap, saveConfig, saveUsageIndex, scannableSensorTargets, scoreRetrievalCase, scoreSensorCase, selectCommandSensors, sensorAppliesToPath, 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, writeBriefingMarker, writeSessionHandoff };
2814
+ 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 GatePrecision, type GatePrecisionDelta, type GatePrecisionMetricDelta, type GateTuningSuggestion, type GenerateBridgesOptions, type GitCommit, 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 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 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, appendUsageEvent, applyConflictResolution, applyFeedbackAdjustment, assessBootstrapState, bridgeMemorySummary, briefingMarkerPath, briefingMarkersDir, briefingProofLine, buildCodeMap, buildCoverageIndex, buildDashboard, buildDocFrequency, buildFrontmatter, buildHandoffMarkdown, buildReport, bumpRead, classifyMemoryPriority, codeMapPath, collectTimelineEntries, compactAutoRecapBody, compareEvalReports, compareGatePrecision, compareImpact, compileRegexSensor, componentOf, computeEvalTrend, computeGatePrecision, computeImpact, computePreventionTrend, computeRecurrence, configPath, contractLockPath, countSourceFilesOnDisk, deriveConfidence, detectAgentContext, detectStacksFromManifests, diffContract, diffHasDistinctiveOverlap, distinctiveCap, draftsFromFindings, emptyUsage, emptyUsageIndex, enforcementDir, estimateTokens, evalHistoryPath, evaluateSkillActivation, extractActionsBriefBody, extractReferencedPaths, extractSensorExamples, extractSnippet, filterNewDrafts, findCoverageGaps, findLexicalConflictPairs, findProjectRoot, findTopicStatusConflictPairs, findUncapturedFailures, findingBody, findingToDraft, firstMemoryOneLine, 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, loadUsageIndex, looksLikeGenericAdvice, meetsSeedQualityFloor, memoryFilePath, memoryHasExcludedTag, memoryMatchesAnchorPaths, mergeHotFiles, mergeMemoryVersions, moduleNameOf, newMemoryId, normalizeFindingSeverity, normalizeSessionId, overallScore, parseEslintJson, parseFileAst, parseFindings, parseMemory, parseNpmAudit, parseSarif, parseSince, parseSonar, pathsOverlap, pickSnippetNeedle, planConflictResolution, prepareBridgeData, preventionLogPath, priorityRank, prioritySignals, projectContextRecentlyEmitted, proposeSeedsFromCommits, pullCrossRepoSources, queryCodeMap, rankMemoriesLexical, readRecentBriefingMarker, readRuntimeJournalTail, readSessionHandoff, readUsageEvents, recommendFeedbackAdjustment, recordApplied, recordPrevention, recordPreventionHits, recordProjectContextEmission, recordRejection, relPathFrom, renderBootstrapChecklist, renderCaughtForYou, resolveBriefingBudget, resolveHaivePaths, resolveManifestFiles, resolveProjectInfo, retirementSignal, runRegexSensor, runSensors, runtimeJournalPath, saveCodeMap, saveConfig, saveUsageIndex, scannableSensorTargets, scoreRetrievalCase, scoreSensorCase, selectCommandSensors, sensorAppliesToPath, 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, writeBriefingMarker, writeSessionHandoff };
package/dist/index.js CHANGED
@@ -43,6 +43,8 @@ var SensorSchema = z.object({
43
43
  flags: z.string().optional(),
44
44
  /** Shell/test command to run (for kind=shell|test). Executed by the CLI, never by core. */
45
45
  command: z.string().optional(),
46
+ /** Max runtime for kind=shell|test commands (default 120000). The executor kills on expiry. */
47
+ timeout_ms: z.number().int().positive().optional(),
46
48
  /** Glob-ish path prefixes the sensor applies to. Falls back to the memory's anchor paths when empty. */
47
49
  paths: z.array(z.string()).default([]),
48
50
  /** LLM-facing self-correction message: what was done wrong and what to do instead. */
@@ -248,15 +250,20 @@ async function loadMemory(filePath) {
248
250
  return { memory: parseMemory(raw), filePath };
249
251
  }
250
252
  async function loadMemoriesFromDir(dir) {
253
+ return (await loadMemoriesFromDirDetailed(dir)).loaded;
254
+ }
255
+ async function loadMemoriesFromDirDetailed(dir) {
251
256
  const files = await listMarkdownFilesRecursive(dir);
252
- const out = [];
257
+ const loaded = [];
258
+ const invalid = [];
253
259
  for (const file of files) {
254
260
  try {
255
- out.push(await loadMemory(file));
256
- } catch {
261
+ loaded.push(await loadMemory(file));
262
+ } catch (err) {
263
+ invalid.push({ filePath: file, error: err instanceof Error ? err.message.split("\n")[0] : String(err) });
257
264
  }
258
265
  }
259
- return out;
266
+ return { loaded, invalid };
260
267
  }
261
268
 
262
269
  // src/search.ts
@@ -1883,7 +1890,7 @@ function childIsKeyword(node, keyword) {
1883
1890
 
1884
1891
  // src/code-map.ts
1885
1892
  var CODE_MAP_FILE = "code-map.json";
1886
- var DEFAULT_INCLUDE = [
1893
+ var CODE_MAP_DEFAULT_INCLUDE = [
1887
1894
  ".ts",
1888
1895
  ".tsx",
1889
1896
  ".js",
@@ -1901,7 +1908,7 @@ var DEFAULT_INCLUDE = [
1901
1908
  ".cs",
1902
1909
  ".php"
1903
1910
  ];
1904
- var DEFAULT_EXCLUDE = [
1911
+ var CODE_MAP_DEFAULT_EXCLUDE = [
1905
1912
  "node_modules",
1906
1913
  "dist",
1907
1914
  "build",
@@ -1938,8 +1945,8 @@ async function saveCodeMap(paths, map) {
1938
1945
  await writeFile3(file, JSON.stringify(map, null, 2), "utf8");
1939
1946
  }
1940
1947
  async function buildCodeMap(root, options = {}) {
1941
- const include = new Set(options.includeExtensions ?? DEFAULT_INCLUDE);
1942
- const exclude = new Set(options.excludeDirs ?? DEFAULT_EXCLUDE);
1948
+ const include = new Set(options.includeExtensions ?? CODE_MAP_DEFAULT_INCLUDE);
1949
+ const exclude = new Set(options.excludeDirs ?? CODE_MAP_DEFAULT_EXCLUDE);
1943
1950
  const files = {};
1944
1951
  for await (const abs of collectSourceFiles(root, include, exclude, options.includeUntracked)) {
1945
1952
  const rel = path8.relative(root, abs).replace(/\\/g, "/");
@@ -1957,8 +1964,8 @@ async function buildCodeMap(root, options = {}) {
1957
1964
  };
1958
1965
  }
1959
1966
  async function countSourceFilesOnDisk(root, options = {}) {
1960
- const include = new Set(DEFAULT_INCLUDE);
1961
- const exclude = /* @__PURE__ */ new Set([...DEFAULT_EXCLUDE, ...options.excludeDirs ?? []]);
1967
+ const include = new Set(CODE_MAP_DEFAULT_INCLUDE);
1968
+ const exclude = /* @__PURE__ */ new Set([...CODE_MAP_DEFAULT_EXCLUDE, ...options.excludeDirs ?? []]);
1962
1969
  let count = 0;
1963
1970
  for await (const _file of walkSourceFiles(root, include, exclude)) count++;
1964
1971
  return count;
@@ -3865,7 +3872,8 @@ function selectCommandSensors(memories, changedPaths) {
3865
3872
  kind: sensor.kind,
3866
3873
  severity: sensor.severity,
3867
3874
  message: sensor.message,
3868
- paths: sensor.paths.length > 0 ? sensor.paths : anchorPaths
3875
+ paths: sensor.paths.length > 0 ? sensor.paths : anchorPaths,
3876
+ ...sensor.timeout_ms ? { timeout_ms: sensor.timeout_ms } : {}
3869
3877
  });
3870
3878
  }
3871
3879
  return specs;
@@ -5375,6 +5383,8 @@ export {
5375
5383
  BRIEFING_MARKER_TTL_MS,
5376
5384
  BRIEFING_PRESET_DEFAULTS,
5377
5385
  CHARS_PER_TOKEN,
5386
+ CODE_MAP_DEFAULT_EXCLUDE,
5387
+ CODE_MAP_DEFAULT_INCLUDE,
5378
5388
  CODE_MAP_FILE,
5379
5389
  CODE_STOPWORDS,
5380
5390
  CONFIG_FILE,
@@ -5512,6 +5522,7 @@ export {
5512
5522
  loadConfigSync,
5513
5523
  loadEvalHistory,
5514
5524
  loadMemoriesFromDir,
5525
+ loadMemoriesFromDirDetailed,
5515
5526
  loadMemory,
5516
5527
  loadPreventionEvents,
5517
5528
  loadUsageIndex,