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,95 @@
/**
* Singleton Model Manager - THE ONLY SOURCE OF EMBEDDING MODELS
*
* This is the SINGLE, UNIFIED model initialization system that ensures:
* - Only ONE model instance exists across the entire system
* - Precision is configured once and locked
* - All components share the same model
* - No possibility of mixed precisions
*
* CRITICAL: This manager is used by EVERYTHING:
* - Storage operations (add, update)
* - Search operations (search, find)
* - Public API (embed, cluster)
* - Neural API (all neural.* methods)
* - Internal operations (deduplication, indexing)
*/
import { TransformerEmbedding } from '../utils/embedding.js';
import { EmbeddingFunction, Vector } from '../coreTypes.js';
/**
* Statistics for monitoring
*/
interface ModelStats {
initialized: boolean;
precision: string;
initCount: number;
embedCount: number;
lastUsed: Date | null;
memoryFootprint?: number;
}
/**
* The ONE TRUE model manager
*/
export declare class SingletonModelManager {
private static instance;
private stats;
private constructor();
/**
* Get the singleton instance
*/
static getInstance(): SingletonModelManager;
/**
* Get the model instance - creates if needed, reuses if exists
* This is THE ONLY way to get a model in the entire system
*/
getModel(): Promise<TransformerEmbedding>;
/**
* Initialize the model - happens exactly once
*/
private initializeModel;
/**
* Get embedding function that uses the singleton model
*/
getEmbeddingFunction(): Promise<EmbeddingFunction>;
/**
* Direct embed method for convenience
*/
embed(data: string | string[]): Promise<Vector>;
/**
* Check if model is initialized
*/
isInitialized(): boolean;
/**
* Get current statistics
*/
getStats(): ModelStats;
/**
* Validate precision consistency
* Throws error if attempting to use different precision
*/
validatePrecision(requestedPrecision?: string): void;
/**
* Force cleanup (for testing only)
* WARNING: This will break consistency - use only in tests
*/
_testOnlyCleanup(): Promise<void>;
}
export declare const singletonModelManager: SingletonModelManager;
/**
* THE ONLY embedding function that should be used anywhere
* This ensures all operations use the same model instance
*/
export declare function getUnifiedEmbeddingFunction(): Promise<EmbeddingFunction>;
/**
* Direct embed function for convenience
*/
export declare function unifiedEmbed(data: string | string[]): Promise<Vector>;
/**
* Check if model is ready
*/
export declare function isModelReady(): boolean;
/**
* Get model statistics
*/
export declare function getModelStats(): ModelStats;
export {};