import { CacheResult } from './SemanticCache'; import { EventEmitter } from 'events'; /** * Configuration options for SubconsciousEngine. */ export interface SubconsciousConfig { chromaUrl?: string; ollamaUrl?: string; model?: string; collectionName?: string; threshold?: number; enableBackgroundVectorization?: boolean; } /** * Task to be processed by the engine. */ export interface Task { id: string; description: string; metadata?: Record; } /** * Result of task processing. */ export interface TaskResult { taskId: string; result: any; fromCache: boolean; similarity?: number; latencyMs: number; timestamp: string; } /** * Engine metrics for monitoring performance. */ export interface EngineMetrics { totalTasks: number; cacheHits: number; cacheMisses: number; hitRate: number; avgCacheLatencyMs: number; avgMissLatencyMs: number; totalCachedTasks: number; backgroundQueueSize: number; } /** * SubconsciousEngine is the main orchestrator for semantic caching. * It intercepts tasks, checks for cached results, and manages background vectorization. */ export declare class SubconsciousEngine extends EventEmitter { private vectorStore; private embeddingService; private semanticCache; private config; private isInitialized; private backgroundQueue; private isProcessingQueue; private cacheLatencies; private missLatencies; constructor(config?: SubconsciousConfig); /** * Initialize the Subconscious Engine. * Must be called before using the engine. */ initialize(): Promise; /** * Intercept a task and check for cached results. * This is the main entry point for the semantic short-circuit. * * @param task - Task to intercept * @returns CacheResult indicating if a cached result was found */ interceptTask(task: Task): Promise; /** * Store a task result for future caching. * If background vectorization is enabled, queues the task for async processing. * * @param task - Original task * @param result - Result to cache */ storeResult(task: Task, result: any): Promise; /** * Process the background vectorization queue. * Runs asynchronously without blocking the main thread. */ private processBackgroundQueue; /** * Get comprehensive engine metrics. */ getMetrics(): Promise; /** * Reset all metrics. */ resetMetrics(): void; /** * Update the similarity threshold. */ setThreshold(threshold: number): void; /** * Get the current configuration. */ getConfig(): Required; /** * Clear all cached tasks and reset metrics. */ clear(): Promise; /** * Shutdown the engine gracefully. * Waits for background queue to finish processing. */ shutdown(): Promise; /** * Check if the engine is ready to use. */ isReady(): boolean; /** * Sleep for specified milliseconds. */ private sleep; } //# sourceMappingURL=SubconsciousEngine.d.ts.map