chore: recovery checkpoint - v3.0 API successfully recovered

CRITICAL CHECKPOINT - DO NOT PUSH TO GITHUB

Recovery Status:
- Successfully recovered brainy.ts from compiled JavaScript
- All core v3.0 API methods functional (add, get, update, delete, relate, find, etc.)
- Neural subsystem intact (562KB embedded patterns, NLP working)
- Augmentation pipeline operational (20+ augmentations)
- HNSW clustering system complete
- Triple Intelligence compiled (needs constructor fix)
- Test suite validates functionality

Changes preserved:
- 898 files with changes from last 3 days
- 144,475 insertions
- All augmentation improvements
- All test coverage enhancements
- Complete v3.0 feature set

This is a LOCAL checkpoint only - contains recovered work after corruption incident.
Created backup in .backups/brainy-full-20250910-151314.tar.gz

Branch: recovery-checkpoint-20250910-151433
Date: Wed Sep 10 03:18:04 PM PDT 2025
This commit is contained in:
David Snelling 2025-09-10 15:18:04 -07:00
parent f65455fb22
commit 8ff382ca3b
895 changed files with 143654 additions and 28268 deletions

View file

@ -0,0 +1,94 @@
/**
* Storage Augmentation Base Classes
*
* Unifies storage adapters and augmentations into a single system.
* All storage backends are now augmentations for consistency and extensibility.
*/
import { BaseAugmentation } from './brainyAugmentation.js';
/**
* Base class for all storage augmentations
* Provides the storage adapter to the brain during initialization
*/
export class StorageAugmentation extends BaseAugmentation {
// Storage augmentations must provide their name via readonly property
constructor(config) {
super(config);
this.timing = 'replace';
this.metadata = 'none'; // Storage doesn't directly access metadata
this.operations = ['storage']; // Make mutable for TypeScript compatibility
this.priority = 100; // High priority for storage
this.storageAdapter = null;
}
/**
* Initialize the augmentation with context
* Called after storage has been resolved
*/
async initialize(context) {
await super.initialize(context);
// Storage adapter should already be provided
if (!this.storageAdapter) {
this.storageAdapter = await this.provideStorage();
}
}
/**
* Execute storage operations
* For storage augmentations, this replaces the default storage
*/
async execute(operation, params, next) {
if (operation === 'storage') {
// Return our storage adapter
return this.storageAdapter;
}
// Pass through all other operations
return next();
}
/**
* Shutdown and cleanup
*/
async shutdown() {
// Cleanup storage adapter if needed
if (this.storageAdapter && typeof this.storageAdapter.close === 'function') {
await this.storageAdapter.close();
}
await super.shutdown();
}
}
/**
* Dynamic storage augmentation that wraps any storage adapter
* Used for backward compatibility and zero-config
*/
export class DynamicStorageAugmentation extends StorageAugmentation {
constructor(adapter) {
super();
this.adapter = adapter;
this.name = 'dynamic-storage';
this.storageAdapter = adapter;
}
async provideStorage() {
return this.adapter;
}
async onInitialize() {
// Adapter is already provided in constructor
await this.adapter.init();
this.log(`${this.name} initialized`);
}
}
/**
* Create a storage augmentation from configuration
* Maintains backward compatibility with existing storage config
*/
export async function createStorageAugmentationFromConfig(config) {
// Import storage factory dynamically to avoid circular deps
const { createStorage } = await import('../storage/storageFactory.js');
try {
// Create storage adapter from config
const adapter = await createStorage(config);
// Wrap in augmentation
return new DynamicStorageAugmentation(adapter);
}
catch (error) {
console.warn('Failed to create storage augmentation from config:', error);
return null;
}
}
//# sourceMappingURL=storageAugmentation.js.map