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
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
/**
|
|
* Request Deduplicator Augmentation
|
|
*
|
|
* Prevents duplicate concurrent requests to improve performance by 3x
|
|
* Automatically deduplicates identical operations
|
|
*/
|
|
import { BaseAugmentation } from './brainyAugmentation.js';
|
|
interface DeduplicatorConfig {
|
|
enabled?: boolean;
|
|
ttl?: number;
|
|
maxSize?: number;
|
|
}
|
|
export declare class RequestDeduplicatorAugmentation extends BaseAugmentation {
|
|
name: string;
|
|
timing: "around";
|
|
metadata: "none";
|
|
operations: ("search" | "find" | "similar" | "searchText" | "searchByNounTypes" | "findSimilar" | "get")[];
|
|
priority: number;
|
|
private pendingRequests;
|
|
protected config: Required<DeduplicatorConfig>;
|
|
private cleanupInterval?;
|
|
constructor(config?: DeduplicatorConfig);
|
|
protected onInitialize(): Promise<void>;
|
|
shouldExecute(operation: string, params: any): boolean;
|
|
execute<T = any>(operation: string, params: any, next: () => Promise<T>): Promise<T>;
|
|
/**
|
|
* Create a unique key for the request based on operation and parameters
|
|
*/
|
|
private createRequestKey;
|
|
/**
|
|
* Serialize parameters to a consistent string
|
|
*/
|
|
private serializeParams;
|
|
/**
|
|
* Clean up expired requests
|
|
*/
|
|
private cleanup;
|
|
/**
|
|
* Get statistics about request deduplication
|
|
*/
|
|
getStats(): {
|
|
activePendingRequests: number;
|
|
totalDeduplicationHits: number;
|
|
memoryUsage: string;
|
|
efficiency: string;
|
|
};
|
|
/**
|
|
* Force clear all pending requests (for testing)
|
|
*/
|
|
clear(): void;
|
|
protected onShutdown(): Promise<void>;
|
|
}
|
|
export {};
|