brainy/src/utils
David Snelling c540d63b69 fix: a bare script now exits cleanly after close() — release every process keep-alive
A consumer report on the GA pair: any minimal add/find/close script hangs
forever. Root cause was FOUR ref'd keep-alives brainy never released:

1+2. The global SIGTERM/SIGINT shutdown hooks (registered once at init) were
   anonymous and never removed — a process.on signal listener holds a ref'd
   signal handle. They are now named statics, deregistered when the LAST live
   instance closes (Brainy.instances also stopped leaking closed instances);
   a later init re-registers them.
3. UnifiedCache.startFairnessMonitor() created an interval it never stored,
   cleared, or unref'd — unclearable by construction. Now stored + unref'd
   (same posture as the existing memory-pressure timer): a cache monitor must
   never keep the host process alive.
4. brainy.close() never called VirtualFileSystem.close(), stranding the VFS
   background-maintenance interval and the PathResolver maintenance interval.
   close() now shuts the VFS down.

Proof: a bare script (init/add/close, no process.exit) exits 1 ms after
close() returns; before the fix it hung until killed. 3 new lifecycle tests
pin the hook semantics (once globally, survive while other instances live,
removed on last close, re-register after).
2026-07-02 16:39:16 -07:00
..
roaring docs: rename the native provider to @soulcraft/cor across public docs and JSDoc 2026-07-02 15:11:41 -07:00
adaptiveBackpressure.ts fix: prevent circuit breaker activation and data loss during bulk imports 2025-10-30 08:54:04 -07:00
brainyTypes.ts refactor: remove augmentation system and semantic type matching 2026-02-01 10:48:56 -08:00
callerLocation.ts chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase 2026-06-11 14:51:00 -07:00
collation.ts docs: rename the native provider to @soulcraft/cor across public docs and JSDoc 2026-07-02 15:11:41 -07:00
contentExtractor.ts feat: expand ContentCategory to universal 6-category set for highlight() 2026-01-27 13:44:58 -08:00
distance.ts perf(8.0): allocation-free distance loops (6x cosine) — evidence-revised Fork X 2026-07-01 10:55:04 -07:00
embedding.ts chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase 2026-06-11 14:51:00 -07:00
entityIdMapper.ts docs: rename the native provider to @soulcraft/cor across public docs and JSDoc 2026-07-02 15:11:41 -07:00
environment.ts chore(8.0)!: drop browser support, cloud SDKs, legacy pipeline, dead threading 2026-06-09 16:38:30 -07:00
fieldNameTracking.ts 🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ 2025-08-26 12:32:21 -07:00
fieldTypeInference.ts chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase 2026-06-11 14:51:00 -07:00
idNormalization.ts feat(8.0): id-normalization (#18) + aggregation min/max delete-safety + RC-safe release 2026-06-20 14:46:40 -07:00
import-progress-tracker.ts fix: exclude __words__ keyword index from corruption detection and getStats() 2026-01-27 15:38:21 -08:00
index.ts chore(8.0)!: drop browser support, cloud SDKs, legacy pipeline, dead threading 2026-06-09 16:38:30 -07:00
jsonProcessing.ts 🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ 2025-08-26 12:32:21 -07:00
logger.ts feat: add complete silent mode for TUI applications 2025-09-16 13:18:49 -07:00
memoryDetection.ts fix: exclude __words__ keyword index from corruption detection and getStats() 2026-01-27 15:38:21 -08:00
metadataFilter.ts refactor(8.0): remove the 4 deprecated query-operator aliases (clean break) 2026-06-29 10:29:20 -07:00
metadataIndex.ts docs: rename the native provider to @soulcraft/cor across public docs and JSDoc 2026-07-02 15:11:41 -07:00
metadataIndexCache.ts 🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ 2025-08-26 12:32:21 -07:00
metadataIndexChunking.ts chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase 2026-06-11 14:51:00 -07:00
metadataWriteBuffer.ts fix: eliminate cloud storage write amplification and rate limiting 2026-01-31 09:09:36 -08:00
mutex.ts chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase 2026-06-11 14:51:00 -07:00
operationUtils.ts 🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ 2025-08-26 12:32:21 -07:00
paramValidation.ts chore(8.0): modernize toolchain + position Bun as a runtime 2026-07-01 09:16:46 -07:00
performanceMonitor.ts chore(8.0)!: drop browser support, cloud SDKs, legacy pipeline, dead threading 2026-06-09 16:38:30 -07:00
rebuildCounts.ts feat(8.0): visibility field (public/internal/system) on nouns + verbs 2026-06-16 15:20:26 -07:00
recallPreset.ts docs: rename the native provider to @soulcraft/cor across public docs and JSDoc 2026-07-02 15:11:41 -07:00
resultRanking.ts docs: rename the native provider to @soulcraft/cor across public docs and JSDoc 2026-07-02 15:11:41 -07:00
statisticsCollector.ts refactor(8.0)!: remove distributed clustering subsystem — inert/orphaned, scale is single-process + native provider 2026-06-15 10:37:39 -07:00
typeUtils.ts 🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ 2025-08-26 12:32:21 -07:00
typeValidation.ts docs(8.0): add module JSDoc to typeValidation.ts (the one file missing a module block) 2026-07-01 15:37:25 -07:00
unifiedCache.ts fix: a bare script now exits cleanly after close() — release every process keep-alive 2026-07-02 16:39:16 -07:00
version.ts fix(8.0): close GA-blocking correctness gaps from the readiness audit 2026-06-29 10:03:38 -07:00