UNPKG

bc-code-intelligence-mcp

Version:

BC Code Intelligence MCP Server - Complete Specialist Bundle with AI-driven expert consultation, seamless handoffs, and context-preserving workflows

133 lines 4.65 kB
/** * Base Knowledge Layer * * Abstract base class providing common functionality for all knowledge layer implementations. * ALL layers support three content types: topics, specialists, and methodologies. */ import { AtomicTopic } from '../types/bc-knowledge.js'; import { SpecialistDefinition } from '../services/specialist-loader.js'; import { IKnowledgeLayer, LayerPriority, LayerLoadResult, LayerStatistics } from '../types/layer-types.js'; import { LayerContentType } from '../types/enhanced-layer-types.js'; export declare abstract class BaseKnowledgeLayer implements IKnowledgeLayer { readonly name: string; readonly priority: LayerPriority; readonly enabled: boolean; readonly supported_content_types: LayerContentType[]; protected topics: Map<string, AtomicTopic>; protected specialists: Map<string, SpecialistDefinition>; protected methodologies: Map<string, any>; protected indexes: Map<string, any>; 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<LayerLoadResult>; /** * Load topics from the layer source - must be implemented by subclasses */ protected abstract loadTopics(): Promise<number>; /** * Load specialists from the layer source - must be implemented by subclasses */ protected abstract loadSpecialists(): Promise<number>; /** * Load methodologies from the layer source - must be implemented by subclasses */ protected abstract loadMethodologies(): Promise<number>; /** * Load indexes from the layer source - must be implemented by subclasses */ protected abstract loadIndexes(): Promise<number>; /** * Check if the layer has a specific topic */ hasTopic(topicId: string): boolean; /** * Get a topic from this layer */ getTopic(topicId: string): Promise<AtomicTopic | null>; /** * 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[]; /** * Generic content access methods (for MultiContentLayerService compatibility) */ /** * Check if layer has specific content by type and ID */ hasContent<T extends LayerContentType>(type: T, id: string): boolean; /** * Get content by type and ID */ getContent<T extends LayerContentType>(type: T, id: string): Promise<any | null>; /** * Get all content IDs for a specific type */ getContentIds<T extends LayerContentType>(type: T): string[]; /** * Search content by type */ searchContent<T extends LayerContentType>(type: T, query: string, limit?: number): any[]; /** * Search specialists within this layer */ protected searchSpecialists(query: string, limit?: number): SpecialistDefinition[]; /** * Search methodologies within this layer */ protected searchMethodologies(query: string, limit?: number): any[]; /** * Get layer statistics */ getStatistics(): LayerStatistics; /** * Cleanup resources */ dispose(): Promise<void>; /** * 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; /** * Get layer statistics with content type breakdown */ getEnhancedStatistics(): { name: string; priority: number; content_counts: Record<string, number>; load_time_ms?: number; initialized: boolean; }; } //# sourceMappingURL=base-layer.d.ts.map