@codai/cbd
Version:
Codai Better Database - High-Performance Vector Memory System with HPKV-inspired architecture and MCP server
83 lines • 2.54 kB
TypeScript
/**
* CBD Memory Engine
* Core engine for conversation exchange management and semantic search
*/
import { ConversationExchange, MemorySearchResult, MemorySummary, CBDConfig } from '../types/index.js';
export declare class CBDMemoryEngine {
private vectorStore;
private embeddingModel;
private storageAdapter;
private config;
private initialized;
constructor(config: CBDConfig);
/**
* Initialize the CBD engine
*/
initialize(): Promise<void>;
/**
* HPKV API: Store a conversation exchange
*/
store_memory(userRequest: string, assistantResponse: string, metadata: {
projectName: string;
sessionName: string;
agentId: string;
sequenceNumber?: number;
[key: string]: any;
}): Promise<string>;
/**
* HPKV API: Semantic search with AI-powered summarization
*/
search_memory(query: string, limit?: number, confidenceThreshold?: number): Promise<{
summary: MemorySummary;
memories: MemorySearchResult[];
}>;
/**
* HPKV API: Search for memory keys using vector similarity
*/
search_keys(query: string, topK?: number, minScore?: number): Promise<{
key: string;
score: number;
metadata?: any;
}[]>;
/**
* HPKV API: Get memory by exact structured key
*/
get_memory(structuredKey: string): Promise<ConversationExchange | null>;
/**
* HPKV API: Delete memory by structured key
*/
delete_memory(structuredKey: string): Promise<boolean>;
/**
* HPKV API: Vector search with raw embeddings
*/
vector_search(vector: number[], limit?: number, threshold?: number): Promise<MemorySearchResult[]>;
/**
* HPKV API: Get database statistics
*/
get_statistics(): Promise<{
totalMemories: number;
totalVectors: number;
storageSize: number;
averageConfidence: number;
projectStats: Record<string, number>;
}>;
/**
* Migration utility: Import existing memories with vector generation
*/
migrateFromLegacy(legacyMemories: any[]): Promise<void>;
/**
* Private helper methods
*/
private ensureInitialized;
private getNextSequenceNumber;
private buildConversationContext;
private generateMemorySummary;
private generateAISummary;
private generateSimpleSummary;
private extractTopics;
/**
* Cleanup and shutdown
*/
shutdown(): Promise<void>;
}
//# sourceMappingURL=MemoryEngine.d.ts.map