brainy/.recovery-workspace/dist-backup-20250910-141917/critical/model-guardian.d.ts
David Snelling 8ff382ca3b 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
2025-09-10 15:18:04 -07:00

60 lines
1.6 KiB
TypeScript

/**
* MODEL GUARDIAN - CRITICAL PATH
*
* THIS IS THE MOST CRITICAL COMPONENT OF BRAINY
* Without the exact model, users CANNOT access their data
*
* Requirements:
* 1. Model MUST be Xenova/all-MiniLM-L6-v2 (never changes)
* 2. Model MUST be available at runtime
* 3. Model MUST produce consistent 384-dim embeddings
* 4. System MUST fail fast if model unavailable in production
*/
export declare class ModelGuardian {
private static instance;
private isVerified;
private modelPath;
private lastVerification;
private constructor();
static getInstance(): ModelGuardian;
/**
* CRITICAL: Verify model availability and integrity
* This MUST be called before any embedding operations
*/
ensureCriticalModel(): Promise<void>;
/**
* Verify the local model files exist and are correct
*/
private verifyLocalModel;
/**
* Compute SHA256 hash of a file
*/
private computeFileHash;
/**
* Download model from a fallback source
*/
private downloadFromSource;
/**
* Configure transformers.js to use verified local model
*/
private configureTransformers;
/**
* Detect where models should be stored
*/
private detectModelPath;
/**
* Get model status for diagnostics
*/
getStatus(): Promise<{
verified: boolean;
path: string;
lastVerification: Date | null;
modelName: string;
dimensions: number;
}>;
/**
* Force re-verification (for testing)
*/
forceReverify(): Promise<void>;
}
export declare const modelGuardian: ModelGuardian;