brainy/src/utils/version.ts

86 lines
3.2 KiB
TypeScript
Raw Normal View History

🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ MAJOR RELEASE: Complete evolution of Brainy with groundbreaking features and performance. 🎯 KEY FEATURES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✨ Triple Intelligence™ Engine - Unified Vector + Metadata + Graph search - O(log n) performance on all operations - 3ms average search latency at any scale ✨ API Consolidation - 15+ search methods → 2 clean APIs - search() for vector similarity - find() for natural language queries ✨ Natural Language Processing - 220+ pre-computed NLP patterns - Instant context understanding - "Show me recent React components with tests" ✨ Zero Configuration - Works instantly, no setup required - Built-in embedding models (no API keys) - Smart defaults for everything - Automatic optimization ✨ Enterprise Features (Free for Everyone) - Scales to 10M+ items - Write-Ahead Logging (WAL) for durability - Distributed architecture with sharding - Read/write separation - Connection pooling & request deduplication - Built-in monitoring & health checks ✨ Universal Compatibility - Node.js, Browser, Edge Workers - 4 Storage Adapters (Memory, FileSystem, OPFS, S3) - TypeScript with full type safety - Worker-based embeddings 📦 WHAT'S INCLUDED: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Core AI Database with HNSW indexing • 19 Production-ready augmentations • Universal Memory Manager • Complete CLI with all commands • Brain Cloud integration (soulcraft.com) • Comprehensive documentation • 52 test files with 400+ tests • Migration guide from 1.x 📊 PERFORMANCE: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Initialize: 450ms (24MB memory) • Search: 3ms average (up to 10M items) • Metadata Filter: 0.8ms (O(log n)) • Bulk Import: 2.3s per 1000 items • Production Scale: 5.8ms at 10M items 🔧 TECHNICAL IMPROVEMENTS: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • TypeScript compilation: 153 errors → 0 • Memory usage: 200MB → 24MB baseline • Circular dependencies resolved • Worker thread communication fixed • Storage adapter consistency • Request coalescing for 3x performance 🛠️ CLI FEATURES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • brainy add - Smart data ingestion • brainy find - Natural language search • brainy search - Vector similarity • brainy chat - AI conversation mode • brainy cloud - Brain Cloud integration • brainy augment - Manage extensions • 100% API compatibility 📚 DOCUMENTATION: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Professional README with examples • Quick Start guide (5 minutes) • Enterprise Features guide • Migration guide from 1.x • API reference • Architecture documentation 🌟 USE CASES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • AI memory layer for chatbots • Semantic document search • Code intelligence platforms • Knowledge management systems • Real-time recommendation engines • Customer support automation MIT License - Enterprise features included free for everyone. No premium tiers, no paywalls, no limits. Built with ❤️ by the Brainy community. Visit https://soulcraft.com for Brain Cloud integration.
2025-08-26 12:32:21 -07:00
/**
fix(8.0): close GA-blocking correctness gaps from the readiness audit - Version-coupling cold-init: getBrainyVersion() returned a stale build-time default ('3.14.0') on the FIRST synchronous call — the one loadPlugins() makes to build context.version — because the package.json read was async. A native provider declaring a realistic `>=8.0.0` range was therefore rejected on cold init. version.ts now reads package.json synchronously (8.0 targets Node-like runtimes only); added a cold-init coupling regression with a `^8.0.0` plugin. - No-silent-failures on the highest-fan-in read path: getNouns()/getVerbs() converted a storage read failure into a success-shaped empty page, which the cold-start rebuild then read as "store empty" and skipped the rebuild — booting a permanently-empty index with no signal (the same silent-failure class as the phantom bug). Both now re-throw a named BrainyError; the rebuild path re-throws read failures (fail loud) and records a queryable degraded state, surfaced via checkHealth(), for non-fatal rebuild hiccups. - LSM SSTable leak: graph compaction wrote a merged SSTable but only dropped the old ones from the manifest, orphaning their payloads forever ("In production we'd add a cleanup mechanism"). Added StorageAdapter.deleteMetadata() and now reclaim each compacted-away SSTable. - Documented the two headline methods add() and find() (the only undocumented public methods on the class). Full gate green: build, unit 1512, integration 607. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 10:03:38 -07:00
* @module utils/version
* @description Resolves the running `@soulcraft/brainy` package version. Brainy 8.0
* targets Node-like runtimes only (Node.js, Bun, Deno all expose `node:fs`), so the
* version is read **synchronously** from `package.json` on first call and cached.
*
* The synchronous read is load-bearing: `loadPlugins()` is the first step of `init()`
* and reads the version to drive the brainyprovider version-coupling guard
* (`plugin.ts` `pluginRangeSatisfies`). A deferred/async value would return a stale
* default on that first synchronous call and spuriously reject a correctly-matched
* native provider (e.g. cor 3.x declaring `>=8.0.0`). Reading synchronously removes
* that window entirely.
🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ MAJOR RELEASE: Complete evolution of Brainy with groundbreaking features and performance. 🎯 KEY FEATURES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✨ Triple Intelligence™ Engine - Unified Vector + Metadata + Graph search - O(log n) performance on all operations - 3ms average search latency at any scale ✨ API Consolidation - 15+ search methods → 2 clean APIs - search() for vector similarity - find() for natural language queries ✨ Natural Language Processing - 220+ pre-computed NLP patterns - Instant context understanding - "Show me recent React components with tests" ✨ Zero Configuration - Works instantly, no setup required - Built-in embedding models (no API keys) - Smart defaults for everything - Automatic optimization ✨ Enterprise Features (Free for Everyone) - Scales to 10M+ items - Write-Ahead Logging (WAL) for durability - Distributed architecture with sharding - Read/write separation - Connection pooling & request deduplication - Built-in monitoring & health checks ✨ Universal Compatibility - Node.js, Browser, Edge Workers - 4 Storage Adapters (Memory, FileSystem, OPFS, S3) - TypeScript with full type safety - Worker-based embeddings 📦 WHAT'S INCLUDED: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Core AI Database with HNSW indexing • 19 Production-ready augmentations • Universal Memory Manager • Complete CLI with all commands • Brain Cloud integration (soulcraft.com) • Comprehensive documentation • 52 test files with 400+ tests • Migration guide from 1.x 📊 PERFORMANCE: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Initialize: 450ms (24MB memory) • Search: 3ms average (up to 10M items) • Metadata Filter: 0.8ms (O(log n)) • Bulk Import: 2.3s per 1000 items • Production Scale: 5.8ms at 10M items 🔧 TECHNICAL IMPROVEMENTS: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • TypeScript compilation: 153 errors → 0 • Memory usage: 200MB → 24MB baseline • Circular dependencies resolved • Worker thread communication fixed • Storage adapter consistency • Request coalescing for 3x performance 🛠️ CLI FEATURES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • brainy add - Smart data ingestion • brainy find - Natural language search • brainy search - Vector similarity • brainy chat - AI conversation mode • brainy cloud - Brain Cloud integration • brainy augment - Manage extensions • 100% API compatibility 📚 DOCUMENTATION: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Professional README with examples • Quick Start guide (5 minutes) • Enterprise Features guide • Migration guide from 1.x • API reference • Architecture documentation 🌟 USE CASES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • AI memory layer for chatbots • Semantic document search • Code intelligence platforms • Knowledge management systems • Real-time recommendation engines • Customer support automation MIT License - Enterprise features included free for everyone. No premium tiers, no paywalls, no limits. Built with ❤️ by the Brainy community. Visit https://soulcraft.com for Brain Cloud integration.
2025-08-26 12:32:21 -07:00
*/
fix(8.0): close GA-blocking correctness gaps from the readiness audit - Version-coupling cold-init: getBrainyVersion() returned a stale build-time default ('3.14.0') on the FIRST synchronous call — the one loadPlugins() makes to build context.version — because the package.json read was async. A native provider declaring a realistic `>=8.0.0` range was therefore rejected on cold init. version.ts now reads package.json synchronously (8.0 targets Node-like runtimes only); added a cold-init coupling regression with a `^8.0.0` plugin. - No-silent-failures on the highest-fan-in read path: getNouns()/getVerbs() converted a storage read failure into a success-shaped empty page, which the cold-start rebuild then read as "store empty" and skipped the rebuild — booting a permanently-empty index with no signal (the same silent-failure class as the phantom bug). Both now re-throw a named BrainyError; the rebuild path re-throws read failures (fail loud) and records a queryable degraded state, surfaced via checkHealth(), for non-fatal rebuild hiccups. - LSM SSTable leak: graph compaction wrote a merged SSTable but only dropped the old ones from the manifest, orphaning their payloads forever ("In production we'd add a cleanup mechanism"). Added StorageAdapter.deleteMetadata() and now reclaim each compacted-away SSTable. - Documented the two headline methods add() and find() (the only undocumented public methods on the class). Full gate green: build, unit 1512, integration 607. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 10:03:38 -07:00
import { readFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { isNode } from './environment.js'
fix(8.0): close GA-blocking correctness gaps from the readiness audit - Version-coupling cold-init: getBrainyVersion() returned a stale build-time default ('3.14.0') on the FIRST synchronous call — the one loadPlugins() makes to build context.version — because the package.json read was async. A native provider declaring a realistic `>=8.0.0` range was therefore rejected on cold init. version.ts now reads package.json synchronously (8.0 targets Node-like runtimes only); added a cold-init coupling regression with a `^8.0.0` plugin. - No-silent-failures on the highest-fan-in read path: getNouns()/getVerbs() converted a storage read failure into a success-shaped empty page, which the cold-start rebuild then read as "store empty" and skipped the rebuild — booting a permanently-empty index with no signal (the same silent-failure class as the phantom bug). Both now re-throw a named BrainyError; the rebuild path re-throws read failures (fail loud) and records a queryable degraded state, surfaced via checkHealth(), for non-fatal rebuild hiccups. - LSM SSTable leak: graph compaction wrote a merged SSTable but only dropped the old ones from the manifest, orphaning their payloads forever ("In production we'd add a cleanup mechanism"). Added StorageAdapter.deleteMetadata() and now reclaim each compacted-away SSTable. - Documented the two headline methods add() and find() (the only undocumented public methods on the class). Full gate green: build, unit 1512, integration 607. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 10:03:38 -07:00
/**
* Last-resort sentinel, returned only if `package.json` cannot be read at all
* (a non-Node runtime, or a genuinely broken install). It is intentionally an
* "unknown" `0.0.0` rather than a plausible-looking release, so a real read
* failure can never masquerade as a valid version and silently satisfy a
* coupling range it will fail loud instead.
*/
const UNKNOWN_VERSION = '0.0.0'
let cachedVersion: string | null = null
/**
fix(8.0): close GA-blocking correctness gaps from the readiness audit - Version-coupling cold-init: getBrainyVersion() returned a stale build-time default ('3.14.0') on the FIRST synchronous call — the one loadPlugins() makes to build context.version — because the package.json read was async. A native provider declaring a realistic `>=8.0.0` range was therefore rejected on cold init. version.ts now reads package.json synchronously (8.0 targets Node-like runtimes only); added a cold-init coupling regression with a `^8.0.0` plugin. - No-silent-failures on the highest-fan-in read path: getNouns()/getVerbs() converted a storage read failure into a success-shaped empty page, which the cold-start rebuild then read as "store empty" and skipped the rebuild — booting a permanently-empty index with no signal (the same silent-failure class as the phantom bug). Both now re-throw a named BrainyError; the rebuild path re-throws read failures (fail loud) and records a queryable degraded state, surfaced via checkHealth(), for non-fatal rebuild hiccups. - LSM SSTable leak: graph compaction wrote a merged SSTable but only dropped the old ones from the manifest, orphaning their payloads forever ("In production we'd add a cleanup mechanism"). Added StorageAdapter.deleteMetadata() and now reclaim each compacted-away SSTable. - Documented the two headline methods add() and find() (the only undocumented public methods on the class). Full gate green: build, unit 1512, integration 607. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 10:03:38 -07:00
* Synchronously read `version` from the package's own `package.json`. The path
* `../../package.json` resolves to the package root from both `src/utils/` (dev)
* and `dist/utils/` (published).
*/
fix(8.0): close GA-blocking correctness gaps from the readiness audit - Version-coupling cold-init: getBrainyVersion() returned a stale build-time default ('3.14.0') on the FIRST synchronous call — the one loadPlugins() makes to build context.version — because the package.json read was async. A native provider declaring a realistic `>=8.0.0` range was therefore rejected on cold init. version.ts now reads package.json synchronously (8.0 targets Node-like runtimes only); added a cold-init coupling regression with a `^8.0.0` plugin. - No-silent-failures on the highest-fan-in read path: getNouns()/getVerbs() converted a storage read failure into a success-shaped empty page, which the cold-start rebuild then read as "store empty" and skipped the rebuild — booting a permanently-empty index with no signal (the same silent-failure class as the phantom bug). Both now re-throw a named BrainyError; the rebuild path re-throws read failures (fail loud) and records a queryable degraded state, surfaced via checkHealth(), for non-fatal rebuild hiccups. - LSM SSTable leak: graph compaction wrote a merged SSTable but only dropped the old ones from the manifest, orphaning their payloads forever ("In production we'd add a cleanup mechanism"). Added StorageAdapter.deleteMetadata() and now reclaim each compacted-away SSTable. - Documented the two headline methods add() and find() (the only undocumented public methods on the class). Full gate green: build, unit 1512, integration 607. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 10:03:38 -07:00
function readVersionSync(): string {
if (!isNode()) return UNKNOWN_VERSION
try {
fix(8.0): close GA-blocking correctness gaps from the readiness audit - Version-coupling cold-init: getBrainyVersion() returned a stale build-time default ('3.14.0') on the FIRST synchronous call — the one loadPlugins() makes to build context.version — because the package.json read was async. A native provider declaring a realistic `>=8.0.0` range was therefore rejected on cold init. version.ts now reads package.json synchronously (8.0 targets Node-like runtimes only); added a cold-init coupling regression with a `^8.0.0` plugin. - No-silent-failures on the highest-fan-in read path: getNouns()/getVerbs() converted a storage read failure into a success-shaped empty page, which the cold-start rebuild then read as "store empty" and skipped the rebuild — booting a permanently-empty index with no signal (the same silent-failure class as the phantom bug). Both now re-throw a named BrainyError; the rebuild path re-throws read failures (fail loud) and records a queryable degraded state, surfaced via checkHealth(), for non-fatal rebuild hiccups. - LSM SSTable leak: graph compaction wrote a merged SSTable but only dropped the old ones from the manifest, orphaning their payloads forever ("In production we'd add a cleanup mechanism"). Added StorageAdapter.deleteMetadata() and now reclaim each compacted-away SSTable. - Documented the two headline methods add() and find() (the only undocumented public methods on the class). Full gate green: build, unit 1512, integration 607. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 10:03:38 -07:00
const here = dirname(fileURLToPath(import.meta.url))
const pkg = JSON.parse(readFileSync(join(here, '../../package.json'), 'utf8'))
return typeof pkg.version === 'string' && pkg.version.length > 0
? pkg.version
: UNKNOWN_VERSION
} catch {
return UNKNOWN_VERSION
}
}
🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ MAJOR RELEASE: Complete evolution of Brainy with groundbreaking features and performance. 🎯 KEY FEATURES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✨ Triple Intelligence™ Engine - Unified Vector + Metadata + Graph search - O(log n) performance on all operations - 3ms average search latency at any scale ✨ API Consolidation - 15+ search methods → 2 clean APIs - search() for vector similarity - find() for natural language queries ✨ Natural Language Processing - 220+ pre-computed NLP patterns - Instant context understanding - "Show me recent React components with tests" ✨ Zero Configuration - Works instantly, no setup required - Built-in embedding models (no API keys) - Smart defaults for everything - Automatic optimization ✨ Enterprise Features (Free for Everyone) - Scales to 10M+ items - Write-Ahead Logging (WAL) for durability - Distributed architecture with sharding - Read/write separation - Connection pooling & request deduplication - Built-in monitoring & health checks ✨ Universal Compatibility - Node.js, Browser, Edge Workers - 4 Storage Adapters (Memory, FileSystem, OPFS, S3) - TypeScript with full type safety - Worker-based embeddings 📦 WHAT'S INCLUDED: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Core AI Database with HNSW indexing • 19 Production-ready augmentations • Universal Memory Manager • Complete CLI with all commands • Brain Cloud integration (soulcraft.com) • Comprehensive documentation • 52 test files with 400+ tests • Migration guide from 1.x 📊 PERFORMANCE: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Initialize: 450ms (24MB memory) • Search: 3ms average (up to 10M items) • Metadata Filter: 0.8ms (O(log n)) • Bulk Import: 2.3s per 1000 items • Production Scale: 5.8ms at 10M items 🔧 TECHNICAL IMPROVEMENTS: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • TypeScript compilation: 153 errors → 0 • Memory usage: 200MB → 24MB baseline • Circular dependencies resolved • Worker thread communication fixed • Storage adapter consistency • Request coalescing for 3x performance 🛠️ CLI FEATURES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • brainy add - Smart data ingestion • brainy find - Natural language search • brainy search - Vector similarity • brainy chat - AI conversation mode • brainy cloud - Brain Cloud integration • brainy augment - Manage extensions • 100% API compatibility 📚 DOCUMENTATION: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Professional README with examples • Quick Start guide (5 minutes) • Enterprise Features guide • Migration guide from 1.x • API reference • Architecture documentation 🌟 USE CASES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • AI memory layer for chatbots • Semantic document search • Code intelligence platforms • Knowledge management systems • Real-time recommendation engines • Customer support automation MIT License - Enterprise features included free for everyone. No premium tiers, no paywalls, no limits. Built with ❤️ by the Brainy community. Visit https://soulcraft.com for Brain Cloud integration.
2025-08-26 12:32:21 -07:00
/**
fix(8.0): close GA-blocking correctness gaps from the readiness audit - Version-coupling cold-init: getBrainyVersion() returned a stale build-time default ('3.14.0') on the FIRST synchronous call — the one loadPlugins() makes to build context.version — because the package.json read was async. A native provider declaring a realistic `>=8.0.0` range was therefore rejected on cold init. version.ts now reads package.json synchronously (8.0 targets Node-like runtimes only); added a cold-init coupling regression with a `^8.0.0` plugin. - No-silent-failures on the highest-fan-in read path: getNouns()/getVerbs() converted a storage read failure into a success-shaped empty page, which the cold-start rebuild then read as "store empty" and skipped the rebuild — booting a permanently-empty index with no signal (the same silent-failure class as the phantom bug). Both now re-throw a named BrainyError; the rebuild path re-throws read failures (fail loud) and records a queryable degraded state, surfaced via checkHealth(), for non-fatal rebuild hiccups. - LSM SSTable leak: graph compaction wrote a merged SSTable but only dropped the old ones from the manifest, orphaning their payloads forever ("In production we'd add a cleanup mechanism"). Added StorageAdapter.deleteMetadata() and now reclaim each compacted-away SSTable. - Documented the two headline methods add() and find() (the only undocumented public methods on the class). Full gate green: build, unit 1512, integration 607. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 10:03:38 -07:00
* @description The running Brainy package version, read synchronously from
* `package.json` and cached. Correct on the **first** call including the
* version-coupling check during `init()` with no async warm-up.
* @returns The semver version string (e.g. `"8.0.0"`).
* @example
* const v = getBrainyVersion() // "8.0.0"
🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ MAJOR RELEASE: Complete evolution of Brainy with groundbreaking features and performance. 🎯 KEY FEATURES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✨ Triple Intelligence™ Engine - Unified Vector + Metadata + Graph search - O(log n) performance on all operations - 3ms average search latency at any scale ✨ API Consolidation - 15+ search methods → 2 clean APIs - search() for vector similarity - find() for natural language queries ✨ Natural Language Processing - 220+ pre-computed NLP patterns - Instant context understanding - "Show me recent React components with tests" ✨ Zero Configuration - Works instantly, no setup required - Built-in embedding models (no API keys) - Smart defaults for everything - Automatic optimization ✨ Enterprise Features (Free for Everyone) - Scales to 10M+ items - Write-Ahead Logging (WAL) for durability - Distributed architecture with sharding - Read/write separation - Connection pooling & request deduplication - Built-in monitoring & health checks ✨ Universal Compatibility - Node.js, Browser, Edge Workers - 4 Storage Adapters (Memory, FileSystem, OPFS, S3) - TypeScript with full type safety - Worker-based embeddings 📦 WHAT'S INCLUDED: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Core AI Database with HNSW indexing • 19 Production-ready augmentations • Universal Memory Manager • Complete CLI with all commands • Brain Cloud integration (soulcraft.com) • Comprehensive documentation • 52 test files with 400+ tests • Migration guide from 1.x 📊 PERFORMANCE: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Initialize: 450ms (24MB memory) • Search: 3ms average (up to 10M items) • Metadata Filter: 0.8ms (O(log n)) • Bulk Import: 2.3s per 1000 items • Production Scale: 5.8ms at 10M items 🔧 TECHNICAL IMPROVEMENTS: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • TypeScript compilation: 153 errors → 0 • Memory usage: 200MB → 24MB baseline • Circular dependencies resolved • Worker thread communication fixed • Storage adapter consistency • Request coalescing for 3x performance 🛠️ CLI FEATURES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • brainy add - Smart data ingestion • brainy find - Natural language search • brainy search - Vector similarity • brainy chat - AI conversation mode • brainy cloud - Brain Cloud integration • brainy augment - Manage extensions • 100% API compatibility 📚 DOCUMENTATION: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Professional README with examples • Quick Start guide (5 minutes) • Enterprise Features guide • Migration guide from 1.x • API reference • Architecture documentation 🌟 USE CASES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • AI memory layer for chatbots • Semantic document search • Code intelligence platforms • Knowledge management systems • Real-time recommendation engines • Customer support automation MIT License - Enterprise features included free for everyone. No premium tiers, no paywalls, no limits. Built with ❤️ by the Brainy community. Visit https://soulcraft.com for Brain Cloud integration.
2025-08-26 12:32:21 -07:00
*/
export function getBrainyVersion(): string {
fix(8.0): close GA-blocking correctness gaps from the readiness audit - Version-coupling cold-init: getBrainyVersion() returned a stale build-time default ('3.14.0') on the FIRST synchronous call — the one loadPlugins() makes to build context.version — because the package.json read was async. A native provider declaring a realistic `>=8.0.0` range was therefore rejected on cold init. version.ts now reads package.json synchronously (8.0 targets Node-like runtimes only); added a cold-init coupling regression with a `^8.0.0` plugin. - No-silent-failures on the highest-fan-in read path: getNouns()/getVerbs() converted a storage read failure into a success-shaped empty page, which the cold-start rebuild then read as "store empty" and skipped the rebuild — booting a permanently-empty index with no signal (the same silent-failure class as the phantom bug). Both now re-throw a named BrainyError; the rebuild path re-throws read failures (fail loud) and records a queryable degraded state, surfaced via checkHealth(), for non-fatal rebuild hiccups. - LSM SSTable leak: graph compaction wrote a merged SSTable but only dropped the old ones from the manifest, orphaning their payloads forever ("In production we'd add a cleanup mechanism"). Added StorageAdapter.deleteMetadata() and now reclaim each compacted-away SSTable. - Documented the two headline methods add() and find() (the only undocumented public methods on the class). Full gate green: build, unit 1512, integration 607. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 10:03:38 -07:00
if (cachedVersion === null) cachedVersion = readVersionSync()
return cachedVersion
}
/**
fix(8.0): close GA-blocking correctness gaps from the readiness audit - Version-coupling cold-init: getBrainyVersion() returned a stale build-time default ('3.14.0') on the FIRST synchronous call — the one loadPlugins() makes to build context.version — because the package.json read was async. A native provider declaring a realistic `>=8.0.0` range was therefore rejected on cold init. version.ts now reads package.json synchronously (8.0 targets Node-like runtimes only); added a cold-init coupling regression with a `^8.0.0` plugin. - No-silent-failures on the highest-fan-in read path: getNouns()/getVerbs() converted a storage read failure into a success-shaped empty page, which the cold-start rebuild then read as "store empty" and skipped the rebuild — booting a permanently-empty index with no signal (the same silent-failure class as the phantom bug). Both now re-throw a named BrainyError; the rebuild path re-throws read failures (fail loud) and records a queryable degraded state, surfaced via checkHealth(), for non-fatal rebuild hiccups. - LSM SSTable leak: graph compaction wrote a merged SSTable but only dropped the old ones from the manifest, orphaning their payloads forever ("In production we'd add a cleanup mechanism"). Added StorageAdapter.deleteMetadata() and now reclaim each compacted-away SSTable. - Documented the two headline methods add() and find() (the only undocumented public methods on the class). Full gate green: build, unit 1512, integration 607. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 10:03:38 -07:00
* @description Async accessor retained for API compatibility. The version is
* resolved synchronously, so this returns the same value as
* {@link getBrainyVersion} there is no longer any deferred state.
* @returns A promise resolving to the version string.
*/
export async function getBrainyVersionAsync(): Promise<string> {
fix(8.0): close GA-blocking correctness gaps from the readiness audit - Version-coupling cold-init: getBrainyVersion() returned a stale build-time default ('3.14.0') on the FIRST synchronous call — the one loadPlugins() makes to build context.version — because the package.json read was async. A native provider declaring a realistic `>=8.0.0` range was therefore rejected on cold init. version.ts now reads package.json synchronously (8.0 targets Node-like runtimes only); added a cold-init coupling regression with a `^8.0.0` plugin. - No-silent-failures on the highest-fan-in read path: getNouns()/getVerbs() converted a storage read failure into a success-shaped empty page, which the cold-start rebuild then read as "store empty" and skipped the rebuild — booting a permanently-empty index with no signal (the same silent-failure class as the phantom bug). Both now re-throw a named BrainyError; the rebuild path re-throws read failures (fail loud) and records a queryable degraded state, surfaced via checkHealth(), for non-fatal rebuild hiccups. - LSM SSTable leak: graph compaction wrote a merged SSTable but only dropped the old ones from the manifest, orphaning their payloads forever ("In production we'd add a cleanup mechanism"). Added StorageAdapter.deleteMetadata() and now reclaim each compacted-away SSTable. - Documented the two headline methods add() and find() (the only undocumented public methods on the class). Full gate green: build, unit 1512, integration 607. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 10:03:38 -07:00
return getBrainyVersion()
🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ MAJOR RELEASE: Complete evolution of Brainy with groundbreaking features and performance. 🎯 KEY FEATURES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✨ Triple Intelligence™ Engine - Unified Vector + Metadata + Graph search - O(log n) performance on all operations - 3ms average search latency at any scale ✨ API Consolidation - 15+ search methods → 2 clean APIs - search() for vector similarity - find() for natural language queries ✨ Natural Language Processing - 220+ pre-computed NLP patterns - Instant context understanding - "Show me recent React components with tests" ✨ Zero Configuration - Works instantly, no setup required - Built-in embedding models (no API keys) - Smart defaults for everything - Automatic optimization ✨ Enterprise Features (Free for Everyone) - Scales to 10M+ items - Write-Ahead Logging (WAL) for durability - Distributed architecture with sharding - Read/write separation - Connection pooling & request deduplication - Built-in monitoring & health checks ✨ Universal Compatibility - Node.js, Browser, Edge Workers - 4 Storage Adapters (Memory, FileSystem, OPFS, S3) - TypeScript with full type safety - Worker-based embeddings 📦 WHAT'S INCLUDED: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Core AI Database with HNSW indexing • 19 Production-ready augmentations • Universal Memory Manager • Complete CLI with all commands • Brain Cloud integration (soulcraft.com) • Comprehensive documentation • 52 test files with 400+ tests • Migration guide from 1.x 📊 PERFORMANCE: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Initialize: 450ms (24MB memory) • Search: 3ms average (up to 10M items) • Metadata Filter: 0.8ms (O(log n)) • Bulk Import: 2.3s per 1000 items • Production Scale: 5.8ms at 10M items 🔧 TECHNICAL IMPROVEMENTS: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • TypeScript compilation: 153 errors → 0 • Memory usage: 200MB → 24MB baseline • Circular dependencies resolved • Worker thread communication fixed • Storage adapter consistency • Request coalescing for 3x performance 🛠️ CLI FEATURES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • brainy add - Smart data ingestion • brainy find - Natural language search • brainy search - Vector similarity • brainy chat - AI conversation mode • brainy cloud - Brain Cloud integration • brainy augment - Manage extensions • 100% API compatibility 📚 DOCUMENTATION: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Professional README with examples • Quick Start guide (5 minutes) • Enterprise Features guide • Migration guide from 1.x • API reference • Architecture documentation 🌟 USE CASES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • AI memory layer for chatbots • Semantic document search • Code intelligence platforms • Knowledge management systems • Real-time recommendation engines • Customer support automation MIT License - Enterprise features included free for everyone. No premium tiers, no paywalls, no limits. Built with ❤️ by the Brainy community. Visit https://soulcraft.com for Brain Cloud integration.
2025-08-26 12:32:21 -07:00
}
/**
fix(8.0): close GA-blocking correctness gaps from the readiness audit - Version-coupling cold-init: getBrainyVersion() returned a stale build-time default ('3.14.0') on the FIRST synchronous call — the one loadPlugins() makes to build context.version — because the package.json read was async. A native provider declaring a realistic `>=8.0.0` range was therefore rejected on cold init. version.ts now reads package.json synchronously (8.0 targets Node-like runtimes only); added a cold-init coupling regression with a `^8.0.0` plugin. - No-silent-failures on the highest-fan-in read path: getNouns()/getVerbs() converted a storage read failure into a success-shaped empty page, which the cold-start rebuild then read as "store empty" and skipped the rebuild — booting a permanently-empty index with no signal (the same silent-failure class as the phantom bug). Both now re-throw a named BrainyError; the rebuild path re-throws read failures (fail loud) and records a queryable degraded state, surfaced via checkHealth(), for non-fatal rebuild hiccups. - LSM SSTable leak: graph compaction wrote a merged SSTable but only dropped the old ones from the manifest, orphaning their payloads forever ("In production we'd add a cleanup mechanism"). Added StorageAdapter.deleteMetadata() and now reclaim each compacted-away SSTable. - Documented the two headline methods add() and find() (the only undocumented public methods on the class). Full gate green: build, unit 1512, integration 607. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 10:03:38 -07:00
* @description Build the version-metadata object stamped onto augmentation /
* provenance records.
* @param service - The augmentation or service name to record.
* @returns `{ augmentation, version }` carrying the current package version.
* @example
* getAugmentationVersion('aggregation') // { augmentation: 'aggregation', version: '8.0.0' }
🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ MAJOR RELEASE: Complete evolution of Brainy with groundbreaking features and performance. 🎯 KEY FEATURES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✨ Triple Intelligence™ Engine - Unified Vector + Metadata + Graph search - O(log n) performance on all operations - 3ms average search latency at any scale ✨ API Consolidation - 15+ search methods → 2 clean APIs - search() for vector similarity - find() for natural language queries ✨ Natural Language Processing - 220+ pre-computed NLP patterns - Instant context understanding - "Show me recent React components with tests" ✨ Zero Configuration - Works instantly, no setup required - Built-in embedding models (no API keys) - Smart defaults for everything - Automatic optimization ✨ Enterprise Features (Free for Everyone) - Scales to 10M+ items - Write-Ahead Logging (WAL) for durability - Distributed architecture with sharding - Read/write separation - Connection pooling & request deduplication - Built-in monitoring & health checks ✨ Universal Compatibility - Node.js, Browser, Edge Workers - 4 Storage Adapters (Memory, FileSystem, OPFS, S3) - TypeScript with full type safety - Worker-based embeddings 📦 WHAT'S INCLUDED: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Core AI Database with HNSW indexing • 19 Production-ready augmentations • Universal Memory Manager • Complete CLI with all commands • Brain Cloud integration (soulcraft.com) • Comprehensive documentation • 52 test files with 400+ tests • Migration guide from 1.x 📊 PERFORMANCE: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Initialize: 450ms (24MB memory) • Search: 3ms average (up to 10M items) • Metadata Filter: 0.8ms (O(log n)) • Bulk Import: 2.3s per 1000 items • Production Scale: 5.8ms at 10M items 🔧 TECHNICAL IMPROVEMENTS: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • TypeScript compilation: 153 errors → 0 • Memory usage: 200MB → 24MB baseline • Circular dependencies resolved • Worker thread communication fixed • Storage adapter consistency • Request coalescing for 3x performance 🛠️ CLI FEATURES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • brainy add - Smart data ingestion • brainy find - Natural language search • brainy search - Vector similarity • brainy chat - AI conversation mode • brainy cloud - Brain Cloud integration • brainy augment - Manage extensions • 100% API compatibility 📚 DOCUMENTATION: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Professional README with examples • Quick Start guide (5 minutes) • Enterprise Features guide • Migration guide from 1.x • API reference • Architecture documentation 🌟 USE CASES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • AI memory layer for chatbots • Semantic document search • Code intelligence platforms • Knowledge management systems • Real-time recommendation engines • Customer support automation MIT License - Enterprise features included free for everyone. No premium tiers, no paywalls, no limits. Built with ❤️ by the Brainy community. Visit https://soulcraft.com for Brain Cloud integration.
2025-08-26 12:32:21 -07:00
*/
export function getAugmentationVersion(service: string): { augmentation: string; version: string } {
return {
augmentation: service,
version: getBrainyVersion()
}
fix(8.0): close GA-blocking correctness gaps from the readiness audit - Version-coupling cold-init: getBrainyVersion() returned a stale build-time default ('3.14.0') on the FIRST synchronous call — the one loadPlugins() makes to build context.version — because the package.json read was async. A native provider declaring a realistic `>=8.0.0` range was therefore rejected on cold init. version.ts now reads package.json synchronously (8.0 targets Node-like runtimes only); added a cold-init coupling regression with a `^8.0.0` plugin. - No-silent-failures on the highest-fan-in read path: getNouns()/getVerbs() converted a storage read failure into a success-shaped empty page, which the cold-start rebuild then read as "store empty" and skipped the rebuild — booting a permanently-empty index with no signal (the same silent-failure class as the phantom bug). Both now re-throw a named BrainyError; the rebuild path re-throws read failures (fail loud) and records a queryable degraded state, surfaced via checkHealth(), for non-fatal rebuild hiccups. - LSM SSTable leak: graph compaction wrote a merged SSTable but only dropped the old ones from the manifest, orphaning their payloads forever ("In production we'd add a cleanup mechanism"). Added StorageAdapter.deleteMetadata() and now reclaim each compacted-away SSTable. - Documented the two headline methods add() and find() (the only undocumented public methods on the class). Full gate green: build, unit 1512, integration 607. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 10:03:38 -07:00
}