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:
parent
f65455fb22
commit
8ff382ca3b
895 changed files with 143654 additions and 28268 deletions
159
.recovery-workspace/dist-backup-20250910-141917/triple/TripleIntelligenceSystem.d.ts
vendored
Normal file
159
.recovery-workspace/dist-backup-20250910-141917/triple/TripleIntelligenceSystem.d.ts
vendored
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
/**
|
||||
* Triple Intelligence System - Consolidated, Production-Ready Implementation
|
||||
*
|
||||
* NO FALLBACKS - NO MOCKS - NO STUBS - REAL PERFORMANCE
|
||||
*
|
||||
* This is the single source of truth for Triple Intelligence operations.
|
||||
* All operations MUST use fast paths or FAIL LOUDLY.
|
||||
*
|
||||
* Performance Guarantees:
|
||||
* - Vector search: O(log n) via HNSW
|
||||
* - Range queries: O(log n) via B-tree indexes
|
||||
* - Graph traversal: O(1) adjacency list lookups
|
||||
* - Fusion: O(k log k) where k = result count
|
||||
*/
|
||||
import { HNSWIndex } from '../hnsw/hnswIndex.js';
|
||||
import { MetadataIndexManager } from '../utils/metadataIndex.js';
|
||||
import { Vector } from '../coreTypes.js';
|
||||
export interface TripleQuery {
|
||||
similar?: string;
|
||||
like?: string;
|
||||
vector?: Vector;
|
||||
where?: Record<string, any>;
|
||||
connected?: {
|
||||
from?: string;
|
||||
to?: string;
|
||||
type?: string;
|
||||
direction?: 'in' | 'out' | 'both';
|
||||
depth?: number;
|
||||
};
|
||||
limit?: number;
|
||||
}
|
||||
export interface TripleOptions {
|
||||
fusion?: {
|
||||
strategy?: 'rrf' | 'weighted' | 'adaptive';
|
||||
weights?: Record<string, number>;
|
||||
k?: number;
|
||||
};
|
||||
}
|
||||
interface GraphAdjacencyIndex {
|
||||
getNeighbors(id: string, direction?: 'in' | 'out' | 'both'): Promise<string[]>;
|
||||
size(): number;
|
||||
}
|
||||
/**
|
||||
* Performance metrics for monitoring and assertions
|
||||
*/
|
||||
export declare class PerformanceMetrics {
|
||||
private operations;
|
||||
private slowQueries;
|
||||
private totalItems;
|
||||
recordOperation(type: string, elapsed: number, itemCount?: number): void;
|
||||
private getExpectedTime;
|
||||
setTotalItems(count: number): void;
|
||||
getReport(): PerformanceReport;
|
||||
reset(): void;
|
||||
}
|
||||
/**
|
||||
* The main Triple Intelligence System
|
||||
*/
|
||||
export declare class TripleIntelligenceSystem {
|
||||
private metadataIndex;
|
||||
private hnswIndex;
|
||||
private graphIndex;
|
||||
private metrics;
|
||||
private planner;
|
||||
private embedder;
|
||||
private storage;
|
||||
constructor(metadataIndex: MetadataIndexManager, hnswIndex: HNSWIndex, graphIndex: GraphAdjacencyIndex, embedder: (text: string) => Promise<Vector>, storage: any);
|
||||
/**
|
||||
* Main find method - executes Triple Intelligence queries
|
||||
*/
|
||||
find(query: TripleQuery, options?: TripleOptions): Promise<TripleResult[]>;
|
||||
/**
|
||||
* Vector search using HNSW for O(log n) performance
|
||||
*/
|
||||
private vectorSearch;
|
||||
/**
|
||||
* Field filtering using MetadataIndex for O(log n) performance
|
||||
*/
|
||||
private fieldFilter;
|
||||
/**
|
||||
* Graph traversal using adjacency lists for O(1) lookups
|
||||
*/
|
||||
private graphTraversal;
|
||||
/**
|
||||
* Execute the query plan
|
||||
*/
|
||||
private executeQueryPlan;
|
||||
/**
|
||||
* Fuse results using Reciprocal Rank Fusion (RRF)
|
||||
*/
|
||||
private fuseResults;
|
||||
/**
|
||||
* Validate query parameters
|
||||
*/
|
||||
private validateQuery;
|
||||
/**
|
||||
* Verify required indexes are available
|
||||
*/
|
||||
private verifyIndexes;
|
||||
/**
|
||||
* Assert performance guarantees
|
||||
*/
|
||||
private assertPerformance;
|
||||
/**
|
||||
* Check if where clause has range operators
|
||||
*/
|
||||
private hasRangeOperators;
|
||||
/**
|
||||
* Update item count for metrics
|
||||
*/
|
||||
private updateItemCount;
|
||||
/**
|
||||
* Get total item count across all indexes
|
||||
*/
|
||||
private getTotalItems;
|
||||
/**
|
||||
* Get performance metrics
|
||||
*/
|
||||
getMetrics(): PerformanceMetrics;
|
||||
/**
|
||||
* Reset performance metrics
|
||||
*/
|
||||
resetMetrics(): void;
|
||||
}
|
||||
interface QueryLog {
|
||||
type: string;
|
||||
elapsed: number;
|
||||
expectedTime: number;
|
||||
timestamp: number;
|
||||
itemCount: number;
|
||||
}
|
||||
interface PerformanceReport {
|
||||
operations: Record<string, {
|
||||
avgTime: number;
|
||||
maxTime: number;
|
||||
minTime: number;
|
||||
violations: number;
|
||||
violationRate: number;
|
||||
totalCalls: number;
|
||||
}>;
|
||||
violations: Array<{
|
||||
type: string;
|
||||
count: number;
|
||||
rate: number;
|
||||
}>;
|
||||
slowQueries: QueryLog[];
|
||||
}
|
||||
interface TripleResult {
|
||||
id: string;
|
||||
score: number;
|
||||
entity: any;
|
||||
metadata: Record<string, any>;
|
||||
vectorScore?: number;
|
||||
fieldScore?: number;
|
||||
graphScore?: number;
|
||||
fusionScore?: number;
|
||||
depth?: number;
|
||||
}
|
||||
export {};
|
||||
Loading…
Add table
Add a link
Reference in a new issue