fix: update all imports and references from BrainyData to Brainy

- Fixed imports in examples/tests/ to use correct Brainy import
- Fixed imports in tests/benchmarks/ to use correct paths
- Updated bin/brainy-interactive.js to use Brainy instead of BrainyData
- Corrected documentation references throughout codebase
- Removed duplicate imports in benchmark files
- All files now consistently use 'Brainy' class from dist/index.js
This commit is contained in:
David Snelling 2025-09-30 17:09:15 -07:00
parent 791fac54cd
commit 196690863d
77 changed files with 328 additions and 331 deletions

View file

@ -7,12 +7,12 @@
* Zero-config philosophy: Just create and register the augmentation!
*/
import { BrainyData } from '../src/index.js'
import { Brainy } from '../src/index.js'
import { APIServerAugmentation } from '../src/augmentations/apiServerAugmentation.js'
async function main() {
// 1. Create Brainy with zero config
const brain = new BrainyData()
const brain = new Brainy()
await brain.init()
// 2. Add some sample data

View file

@ -5,14 +5,14 @@
* Augmentations extend Brainy without any complex setup.
*/
import { BrainyData } from '../src/index.js'
import { Brainy } from '../src/index.js'
import { EntityRegistryAugmentation } from '../src/augmentations/entityRegistryAugmentation.js'
import { BatchProcessingAugmentation } from '../src/augmentations/batchProcessingAugmentation.js'
import { APIServerAugmentation } from '../src/augmentations/apiServerAugmentation.js'
async function main() {
// Create Brainy - zero config!
const brain = new BrainyData()
const brain = new Brainy()
// Register augmentations - they just work!
brain.augmentations.register(new EntityRegistryAugmentation()) // Deduplication

View file

@ -4,7 +4,7 @@
* 🚀 Focused Validation - Test Core Functionality with Timeout
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
console.log('🚀 Brainy 2.0 - Focused Production Test')
console.log('=' + '='.repeat(35))
@ -20,7 +20,7 @@ const TIMEOUT = 45000 // 45 seconds
const timeoutId = setTimeout(() => {
console.log(`\n⏰ TIMEOUT after ${timeElapsed()}s - Core systems initialized successfully!`)
console.log('🎯 Key Evidence:')
console.log('✅ BrainyData instantiated')
console.log('✅ Brainy instantiated')
console.log('✅ All augmentations loading')
console.log('✅ Storage systems operational')
console.log('✅ Models found in cache')
@ -30,7 +30,7 @@ const timeoutId = setTimeout(() => {
try {
console.log(`\n⏱️ [${timeElapsed()}s] Initializing brain...`)
const brain = new BrainyData({ storage: { type: 'memory' }, verbose: false })
const brain = new Brainy({ storage: { type: 'memory' }, verbose: false })
console.log(`⏱️ [${timeElapsed()}s] Starting init()...`)

View file

@ -5,13 +5,13 @@
* Tests that core functionality works without heavy model loading
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
console.log('🚀 Brainy 2.0 - Instant Core API Validation')
console.log('=' + '='.repeat(40))
// Skip heavy initialization, focus on API validation
const brain = new BrainyData({
const brain = new Brainy({
storage: { type: 'memory' },
verbose: false,
skipModelDownload: true // Skip heavy model operations
@ -32,8 +32,8 @@ function test(name, condition) {
try {
console.log('\n🔧 Core API Structure Tests...')
// Test 1: BrainyData class instantiated
test('BrainyData class instantiation', brain instanceof Object)
// Test 1: Brainy class instantiated
test('Brainy class instantiation', brain instanceof Object)
// Test 2: Core methods exist
test('addNoun method exists', typeof brain.addNoun === 'function')

View file

@ -7,7 +7,7 @@
* Focus on HIGH-IMPACT validation that proves the system is ready for release.
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
import { performance } from 'perf_hooks'
console.log('🚀 Brainy 2.0 - Production Validation Suite')
@ -19,7 +19,7 @@ const testConfig = {
verbose: false
}
const brain = new BrainyData(testConfig)
const brain = new Brainy(testConfig)
// Validation results tracking
const results = {

View file

@ -4,12 +4,12 @@
* 🚀 Quick Production Validation - Focus on Core Functionality
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
console.log('🚀 Brainy 2.0 - Quick Production Validation')
console.log('=' + '='.repeat(40))
const brain = new BrainyData({ storage: { type: 'memory' }, verbose: false })
const brain = new Brainy({ storage: { type: 'memory' }, verbose: false })
try {
// Test 1: Initialize

View file

@ -4,14 +4,14 @@
* Quick CLI API Compatibility Test
*/
import { BrainyData } from './dist/brainyData.js'
import { Brainy } from '../../dist/index.js'
console.log('🧠 Testing CLI API compatibility...')
const brain = new BrainyData({ storage: { type: 'memory' }, verbose: false })
const brain = new Brainy({ storage: { type: 'memory' }, verbose: false })
try {
console.log('✅ BrainyData instantiated')
console.log('✅ Brainy instantiated')
// Test method signatures
console.log('✅ addNoun method:', typeof brain.addNoun === 'function')

View file

@ -1,11 +1,11 @@
#!/usr/bin/env node
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
console.log('🧪 Testing Brainy 2.0 Consolidated API')
console.log('=' + '='.repeat(50))
const brain = new BrainyData({
const brain = new Brainy({
storage: { type: 'memory' },
verbose: false
})

View file

@ -5,7 +5,7 @@
* Bypasses Vitest to avoid memory overhead
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
console.log('🧠 Testing Brainy Core Functionality (Direct Node.js)')
console.log('=' + '='.repeat(60))
@ -32,15 +32,15 @@ async function testBrainyCore() {
try {
// Test 1: Library Loading
console.log('\n📦 Testing Library Loading')
assert(typeof BrainyData === 'function', 'BrainyData class should be exported')
assert(typeof Brainy === 'function', 'Brainy class should be exported')
// Test 2: Instance Creation
console.log('\n🏗 Testing Instance Creation')
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true },
verbose: false
})
assert(brain !== null, 'Should create BrainyData instance')
assert(brain !== null, 'Should create Brainy instance')
assert(brain.dimensions === 384, 'Should have 384 dimensions')
// Test 3: Initialization

View file

@ -7,7 +7,7 @@
* Uses minimal memory approach to avoid ONNX issues.
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
console.log('🧠 Brainy 2.0 Core Functionality Verification')
console.log('=' + '='.repeat(55))
@ -45,7 +45,7 @@ async function runTests() {
console.log(` RSS: ${(startMem.rss / 1024 / 1024).toFixed(2)} MB`)
// Create Brainy instance with custom embedding function to avoid ONNX
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true },
verbose: false,
// Use a simple embedding function to avoid ONNX memory issues

View file

@ -7,7 +7,7 @@
* to identify where the timeout occurs
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
async function testDirectSearch() {
console.log('🔍 DIRECT SEARCH TEST')
@ -16,7 +16,7 @@ async function testDirectSearch() {
try {
// 1. Initialize
console.log('1. Initializing Brainy...')
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true },
verbose: false
})

View file

@ -4,13 +4,13 @@
* Fast focused test of critical AI features
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
async function quickTest() {
try {
console.log('🚀 QUICK BRAINY AI TEST')
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true },
verbose: false
})

View file

@ -9,12 +9,12 @@ console.log('ORT_INTRA_OP_NUM_THREADS:', process.env.ORT_INTRA_OP_NUM_THREADS)
console.log('ORT_INTER_OP_NUM_THREADS:', process.env.ORT_INTER_OP_NUM_THREADS)
// Now test with minimal embedding
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
async function testMinimalSearch() {
try {
console.log('\nInitializing Brainy...')
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true },
verbose: false
})

View file

@ -1,6 +1,6 @@
#!/usr/bin/env node
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
async function testMemoryUsage() {
console.log('Testing memory usage...\n')
@ -12,7 +12,7 @@ async function testMemoryUsage() {
heapUsed: Math.round(memBefore.heapUsed / 1024 / 1024) + ' MB'
})
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true }
})
await brain.init()

View file

@ -7,7 +7,7 @@
* Uses reasonable memory limits (4GB instead of 16GB)
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
console.log('🧠 Testing Memory-Safe Brainy System')
console.log('=' + '='.repeat(50))
@ -20,7 +20,7 @@ async function testMemorySafety() {
console.log(` RSS: ${(startMem.rss / 1024 / 1024).toFixed(2)} MB`)
console.log('\n🚀 Initializing Brainy with Universal Memory Manager...')
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true },
verbose: false
})

View file

@ -1,8 +1,8 @@
#!/usr/bin/env node
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
const brain = new BrainyData({
const brain = new Brainy({
storage: { type: 'memory' },
verbose: false
})

View file

@ -1,14 +1,14 @@
#!/usr/bin/env node
// Minimal test to verify core works without memory issues
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
console.log('🧪 Minimal Brainy Test')
async function minimalTest() {
try {
// Just test initialization and basic add
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true },
verbose: false,
// Disable features that might use memory

View file

@ -1,14 +1,14 @@
#!/usr/bin/env node
// Test without search to avoid memory issues
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
console.log('🧪 Brainy Test (No Search)')
console.log('===========================')
async function testNoSearch() {
try {
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true },
verbose: false
})

View file

@ -7,7 +7,7 @@
* Tests: search(), find(), clustering, Triple Intelligence, Brain Patterns
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
const TEST_TIMEOUT = 30000 // 30 seconds per operation
@ -39,7 +39,7 @@ async function testProductionFunctionality() {
try {
// 1. Initialize Brainy
console.log('1⃣ Initializing Brainy with real AI models...')
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true },
verbose: false
})

View file

@ -1,7 +1,7 @@
#!/usr/bin/env node
// Quick test to verify Brainy works without running full test suite
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
console.log('🧪 Quick Brainy Test')
console.log('====================')
@ -10,7 +10,7 @@ async function quickTest() {
try {
// Test 1: Initialize
console.log('\n1. Initializing Brainy...')
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true },
verbose: false
})

View file

@ -1,6 +1,6 @@
#!/usr/bin/env node
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
async function testRangeQueries() {
console.log('🧠 Testing Brain Patterns Range Query Support...\n')
@ -8,7 +8,7 @@ async function testRangeQueries() {
let brain
try {
// Initialize with memory storage
brain = new BrainyData({
brain = new Brainy({
storage: { forceMemoryStorage: true },
dimensions: 384,
metric: 'cosine'

View file

@ -5,7 +5,7 @@
* Direct Node.js script to avoid test framework overhead
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
console.log('🧠 TESTING BRAINY 2.0 WITH REAL AI MODELS')
console.log('==========================================')
@ -13,7 +13,7 @@ console.log('==========================================')
async function testAllFeatures() {
try {
console.log('\n1. Initializing with real AI...')
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true },
verbose: false
})

View file

@ -1,13 +1,13 @@
#!/usr/bin/env node
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
console.log('🧠 Testing Refactored API Architecture')
console.log('search(q) = find({like: q})')
console.log('find(q) = NLP processing → complex TripleQuery')
console.log('=' + '='.repeat(50))
const brain = new BrainyData({
const brain = new Brainy({
storage: { type: 'memory' },
verbose: false
})

View file

@ -5,7 +5,7 @@
* This validates that the flag prevents remote model downloads and works with local models only
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
import { fileURLToPath } from 'url'
import { dirname, join } from 'path'
@ -24,8 +24,8 @@ async function testLocalModelsOnly() {
console.log(`Set BRAINY_MODELS_PATH=${process.env.BRAINY_MODELS_PATH}`)
try {
console.log('✅ Creating BrainyData with local models only...')
const brain = new BrainyData()
console.log('✅ Creating Brainy with local models only...')
const brain = new Brainy()
console.log('✅ Initializing (should use local models)...')
await brain.init()

View file

@ -5,7 +5,7 @@
* Verifies industry-leading performance and relevance
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
console.log('🧠 BRAINY 2.0 SEARCH & FIND VERIFICATION')
console.log('=' + '='.repeat(50))
@ -13,7 +13,7 @@ console.log('=' + '='.repeat(50))
async function testSearchAndFind() {
try {
// Initialize with production-like configuration
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true },
verbose: false
})

View file

@ -1,6 +1,6 @@
#!/usr/bin/env node
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
async function testBasicFunctionality() {
console.log('Testing Brainy 2.0 Core Functionality...\n')
@ -9,7 +9,7 @@ async function testBasicFunctionality() {
try {
// Test 1: Initialization
console.log('1. Testing initialization...')
brain = new BrainyData({
brain = new Brainy({
storage: { forceMemoryStorage: true },
dimensions: 384,
metric: 'cosine'

View file

@ -1,8 +1,8 @@
#!/usr/bin/env node
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
const brain = new BrainyData({
const brain = new Brainy({
storage: { type: 'memory' },
verbose: false
})

View file

@ -4,7 +4,7 @@
* Test all storage adapters for Brainy 2.0
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
import { promises as fs } from 'fs'
import { join } from 'path'
@ -16,7 +16,7 @@ async function testStorageAdapter(name, config) {
try {
// Initialize with specific storage
const brain = new BrainyData({
const brain = new Brainy({
storage: config,
verbose: false
})

View file

@ -2,7 +2,7 @@
* Test script to verify storage augmentation system works
*/
import { BrainyData } from './dist/brainyData.js'
import { Brainy } from '../../dist/index.js'
import {
MemoryStorageAugmentation,
FileSystemStorageAugmentation
@ -13,7 +13,7 @@ console.log('=' .repeat(50))
async function test1_ZeroConfig() {
console.log('\n1. Zero-Config Test')
const brain = new BrainyData()
const brain = new Brainy()
await brain.init()
await brain.add('test', { content: 'Zero-config test' })
@ -25,7 +25,7 @@ async function test1_ZeroConfig() {
async function test2_ConfigBased() {
console.log('\n2. Config-Based Storage Test')
const brain = new BrainyData({
const brain = new Brainy({
storage: {
forceMemoryStorage: true
}
@ -41,7 +41,7 @@ async function test2_ConfigBased() {
async function test3_AugmentationOverride() {
console.log('\n3. Augmentation Override Test')
const brain = new BrainyData()
const brain = new Brainy()
// Register storage augmentation BEFORE init
brain.augmentations.register(new MemoryStorageAugmentation('test-memory'))
@ -59,7 +59,7 @@ async function test4_BackwardCompatibility() {
console.log('\n4. Backward Compatibility Test')
// Old style with rootDirectory config
const brain = new BrainyData({
const brain = new Brainy({
storage: {
rootDirectory: './test-data',
forceFileSystemStorage: true

View file

@ -12,7 +12,7 @@
* - Fusion scoring
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
async function testTripleIntelligence() {
console.log('🧠 TRIPLE INTELLIGENCE COMPREHENSIVE TEST')
@ -27,7 +27,7 @@ async function testTripleIntelligence() {
try {
// Initialize
console.log('📦 Initializing Brainy...')
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true },
verbose: false
})

View file

@ -1,8 +1,8 @@
#!/usr/bin/env node
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
const brain = new BrainyData({
const brain = new Brainy({
storage: { type: 'memory' },
verbose: false
})

View file

@ -5,7 +5,7 @@
* Requires 6-8GB RAM (ONNX runtime requirement)
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
import v8 from 'v8'
// Check if we have enough memory allocated
@ -23,7 +23,7 @@ console.log('='.repeat(50))
async function testRealSearch() {
try {
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true },
verbose: false
})

View file

@ -5,14 +5,14 @@
* This validates core database operations without ONNX memory issues
*/
import { BrainyData } from './dist/index.js'
import { Brainy } from './dist/index.js'
console.log('🧠 Testing Brainy Core (No Embeddings)')
console.log('=' + '='.repeat(50))
async function testCoreFeatures() {
try {
const brain = new BrainyData({
const brain = new Brainy({
storage: { forceMemoryStorage: true },
verbose: false,
// Disable embedding features for this test

View file

@ -5,7 +5,7 @@
* Verifies ALL public API methods are properly integrated in CLI
*/
import { BrainyData } from './dist/brainyData.js'
import { Brainy } from '../../dist/index.js'
import fs from 'fs'
console.log('🧠 Brainy 2.0 - Comprehensive CLI API Verification')