UNPKG

mnemos-coder

Version:

CLI-based coding agent with graph-based execution loop and terminal UI

81 lines 2.4 kB
/** * New semantic search engine using API embeddings and Vectra * Replaces the old TF-IDF based search */ import { VectraDatabase } from './VectraDatabase.js'; import { ApiEmbedder } from './ApiEmbedder.js'; export interface SearchOptions { limit?: number; threshold?: number; includeContent?: boolean; fileTypes?: string[]; chunkTypes?: string[]; hybridWeight?: number; } export interface SearchContext { filePath?: string; language?: string; recentFiles?: string[]; currentFunction?: string; } export interface EnhancedSearchResult { chunk: any; similarity_score: number; text_score?: number; combined_score: number; relevance_type: 'semantic' | 'text' | 'hybrid' | 'contextual'; file_context?: string[]; related_chunks?: string[]; } export declare class SearchEngine { private db; private embedder; private defaultOptions; constructor(db: VectraDatabase, embedder: ApiEmbedder); /** * Hybrid search combining vector similarity and text search */ search(query: string, options?: SearchOptions, context?: SearchContext): Promise<EnhancedSearchResult[]>; /** * Pure vector similarity search */ vectorSearch(query: string, options: SearchOptions): Promise<EnhancedSearchResult[]>; /** * Text-based search using FTS5 */ textSearch(query: string, options: SearchOptions): Promise<EnhancedSearchResult[]>; /** * Quick search for exact matches and patterns */ quickSearch(pattern: string, options?: SearchOptions): Promise<EnhancedSearchResult[]>; /** * Suggest context based on current code location */ suggestContext(filePath: string, lineNumber?: number, options?: SearchOptions): Promise<EnhancedSearchResult[]>; /** * Combine vector and text search results */ private combineResults; /** * Apply contextual boosting based on search context */ private applyContextualBoosting; /** * Get file context for a chunk */ private getFileContext; /** * Get related chunks for a chunk */ private getRelatedChunks; /** * Get search statistics */ getStats(): { totalChunks: number; totalEmbeddings: number; embeddingModel: string; embeddingDimension: number; }; } //# sourceMappingURL=SearchEngine.d.ts.map