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
72 lines
3.1 KiB
TypeScript
72 lines
3.1 KiB
TypeScript
import { AugmentationType, IMemoryAugmentation, AugmentationResponse } from '../types/augmentations.js';
|
|
import { StorageAdapter } from '../coreTypes.js';
|
|
/**
|
|
* Base class for memory augmentations that wrap a StorageAdapter
|
|
*/
|
|
declare abstract class BaseMemoryAugmentation implements IMemoryAugmentation {
|
|
readonly name: string;
|
|
readonly description: string;
|
|
enabled: boolean;
|
|
protected storage: StorageAdapter;
|
|
protected isInitialized: boolean;
|
|
constructor(name: string, storage: StorageAdapter);
|
|
initialize(): Promise<void>;
|
|
shutDown(): Promise<void>;
|
|
getStatus(): Promise<'active' | 'inactive' | 'error'>;
|
|
storeData(key: string, data: unknown, options?: Record<string, unknown>): Promise<AugmentationResponse<boolean>>;
|
|
retrieveData(key: string, options?: Record<string, unknown>): Promise<AugmentationResponse<unknown>>;
|
|
updateData(key: string, data: unknown, options?: Record<string, unknown>): Promise<AugmentationResponse<boolean>>;
|
|
deleteData(key: string, options?: Record<string, unknown>): Promise<AugmentationResponse<boolean>>;
|
|
listDataKeys(pattern?: string, options?: Record<string, unknown>): Promise<AugmentationResponse<string[]>>;
|
|
/**
|
|
* Searches for data in the storage using vector similarity.
|
|
* Implements the findNearest functionality by calculating distances client-side.
|
|
* @param query The query vector or data to search for
|
|
* @param k Number of results to return (default: 10)
|
|
* @param options Optional search options
|
|
*/
|
|
search(query: unknown, k?: number, options?: Record<string, unknown>): Promise<AugmentationResponse<Array<{
|
|
id: string;
|
|
score: number;
|
|
data: unknown;
|
|
}>>>;
|
|
protected ensureInitialized(): Promise<void>;
|
|
}
|
|
/**
|
|
* Memory augmentation that uses in-memory storage
|
|
*/
|
|
export declare class MemoryStorageAugmentation extends BaseMemoryAugmentation {
|
|
readonly description = "Memory augmentation that stores data in memory";
|
|
enabled: boolean;
|
|
constructor(name: string);
|
|
getType(): AugmentationType;
|
|
}
|
|
/**
|
|
* Memory augmentation that uses file system storage
|
|
*/
|
|
export declare class FileSystemStorageAugmentation extends BaseMemoryAugmentation {
|
|
readonly description = "Memory augmentation that stores data in the file system";
|
|
enabled: boolean;
|
|
private rootDirectory;
|
|
constructor(name: string, rootDirectory?: string);
|
|
initialize(): Promise<void>;
|
|
getType(): AugmentationType;
|
|
}
|
|
/**
|
|
* Memory augmentation that uses OPFS (Origin Private File System) storage
|
|
*/
|
|
export declare class OPFSStorageAugmentation extends BaseMemoryAugmentation {
|
|
readonly description = "Memory augmentation that stores data in the Origin Private File System";
|
|
enabled: boolean;
|
|
constructor(name: string);
|
|
getType(): AugmentationType;
|
|
}
|
|
/**
|
|
* Factory function to create the appropriate memory augmentation based on the environment
|
|
*/
|
|
export declare function createMemoryAugmentation(name: string, options?: {
|
|
storageType?: 'memory' | 'filesystem' | 'opfs';
|
|
rootDirectory?: string;
|
|
requestPersistentStorage?: boolean;
|
|
}): Promise<IMemoryAugmentation>;
|
|
export {};
|