/** * Base Knowledge Layer * * Abstract base class providing common functionality for all knowledge layer implementations. * Handles topic caching, statistics tracking, and common operations. */ import { AtomicTopic } from '../types/bc-knowledge.js'; import { IKnowledgeLayer, LayerPriority, LayerLoadResult, LayerStatistics } from '../types/layer-types.js'; export declare abstract class BaseKnowledgeLayer implements IKnowledgeLayer { readonly name: string; readonly priority: LayerPriority; readonly enabled: boolean; protected topics: Map; protected indexes: Map; protected loadResult: LayerLoadResult | null; protected initialized: boolean; constructor(name: string, priority: LayerPriority, enabled?: boolean); /** * Initialize the layer - must be implemented by subclasses */ abstract initialize(): Promise; /** * Load topics from the layer source - must be implemented by subclasses */ protected abstract loadTopics(): Promise; /** * Load indexes from the layer source - must be implemented by subclasses */ protected abstract loadIndexes(): Promise; /** * Check if the layer has a specific topic */ hasTopic(topicId: string): boolean; /** * Get a topic from this layer */ getTopic(topicId: string): Promise; /** * Get a topic from this layer synchronously (for already loaded topics) */ getTopicSync(topicId: string): AtomicTopic | null; /** * Get all topic IDs available in this layer */ getTopicIds(): string[]; /** * Search for topics within this layer using simple text matching */ searchTopics(query: string, limit?: number): AtomicTopic[]; /** * Get layer statistics */ getStatistics(): LayerStatistics; /** * Cleanup resources */ dispose(): Promise; /** * Helper to create successful load result */ protected createLoadResult(topicsLoaded: number, indexesLoaded: number, loadTimeMs: number): LayerLoadResult; /** * Helper to create error load result */ protected createErrorResult(error: string, loadTimeMs: number): LayerLoadResult; /** * Estimate memory usage of loaded topics */ private estimateTopicsMemoryUsage; /** * Estimate memory usage of loaded indexes */ private estimateIndexesMemoryUsage; /** * Validate that a topic has required structure */ protected validateTopic(topic: AtomicTopic): boolean; /** * Normalize topic ID for consistent lookup */ protected normalizeTopicId(filePath: string, basePath: string): string; } //# sourceMappingURL=base-layer.d.ts.map