mushcode-mcp-server
Version:
A specialized Model Context Protocol server for MUSHCODE development assistance. Provides AI-powered code generation, validation, optimization, and examples for MUD development.
142 lines • 4.07 kB
TypeScript
/**
* Optimized knowledge base with caching and lazy loading
* Extends the base knowledge base with performance optimizations
*/
import { MushcodePattern, ServerDialect, SecurityRule, CodeExample, KnowledgeQuery, KnowledgeSearchResult } from '../types/knowledge.js';
import { MushcodeKnowledgeBase } from './base.js';
/**
* Optimized knowledge base with caching and lazy loading
*/
export declare class OptimizedKnowledgeBase extends MushcodeKnowledgeBase {
private searchCache;
private patternCache;
private exampleCache;
private dialectCache;
private securityRuleCache;
private dialectsLoaded;
private categoriesLoaded;
private securityCategoriesLoaded;
private searchIndex;
private tagIndex;
private functionIndex;
constructor();
/**
* Enhanced search with caching and optimized algorithms
*/
search(query: KnowledgeQuery): KnowledgeSearchResult;
/**
* Get patterns by category with caching
*/
getPatternsByCategory(category: string): MushcodePattern[];
/**
* Get patterns by server with lazy loading
*/
getPatternsByServer(serverName: string): MushcodePattern[];
/**
* Get examples by category with caching
*/
getExamplesByCategory(category: string): CodeExample[];
/**
* Get server dialect with caching and lazy loading
*/
getDialect(name: string): ServerDialect | undefined;
/**
* Get security rules by category with caching
*/
getSecurityRulesByCategory(category: string): SecurityRule[];
/**
* Fast pattern lookup by function name using pre-built index
*/
findPatternsByFunction(functionName: string): MushcodePattern[];
/**
* Fast tag-based search using pre-built index
*/
findByTags(tags: string[]): {
patterns: MushcodePattern[];
examples: CodeExample[];
};
/**
* Invalidate caches when data is updated
*/
addPattern(pattern: MushcodePattern): void;
addExample(example: CodeExample): void;
addDialect(dialect: ServerDialect): void;
addSecurityRule(rule: SecurityRule): void;
/**
* Get cache statistics for monitoring
*/
getCacheStats(): Record<string, any>;
/**
* Warm up caches with frequently accessed data
*/
warmupCaches(): void;
/**
* Perform optimized search using indexes and caching
*/
private performOptimizedSearch;
/**
* Score and filter pattern candidates
*/
private scoreAndFilterPatterns;
/**
* Score and filter example candidates
*/
private scoreAndFilterExamples;
/**
* Optimized pattern relevance calculation with weighted scoring
*/
private calculateOptimizedPatternRelevance;
/**
* Optimized example relevance calculation
*/
private calculateOptimizedExampleRelevance;
/**
* Build search indexes for faster lookups
*/
private buildSearchIndexes;
/**
* Update search indexes when adding a pattern
*/
private updateSearchIndexes;
/**
* Update example indexes when adding an example
*/
private updateExampleIndexes;
/**
* Extract search terms from text
*/
private extractSearchTerms;
/**
* Check if a term is a stop word
*/
private isStopWord;
/**
* Generate cache key for search queries
*/
private generateSearchCacheKey;
/**
* Ensure dialect is loaded (lazy loading)
*/
private ensureDialectLoaded;
/**
* Ensure category is loaded (lazy loading)
*/
private ensureCategoryLoaded;
/**
* Ensure security category is loaded (lazy loading)
*/
private ensureSecurityCategoryLoaded;
/**
* Invalidate pattern-related caches
*/
private invalidatePatternCaches;
/**
* Invalidate example-related caches
*/
private invalidateExampleCaches;
/**
* Invalidate security rule caches
*/
private invalidateSecurityRuleCaches;
}
//# sourceMappingURL=optimized-base.d.ts.map