@aaswe/codebase-ai
Version:
AI-Assisted Software Engineering (AASWE) - Rich codebase context for IDE LLMs
136 lines • 4.06 kB
TypeScript
/**
* TTL Context Loader for MCP Server
*
* Enhanced TTL context loading service that integrates with the automatic
* analysis system to provide rich, concrete codebase context to LLMs.
*/
import { EventEmitter } from 'events';
import { KnowledgeGraphPopulator } from '../project-analysis/KnowledgeGraphPopulator';
import { EnhancedRDFGenerator } from '../layer1/rdf-generator/EnhancedRDFGenerator';
import { ConcreteInformationExtractor } from '../layer1/rdf-generator/ConcreteInformationExtractor';
import { TTLFile, ContextRequest, ContextResponse, TTLContextLoaderConfig, TTLContextLoaderMetrics } from './types';
/**
* Enhanced TTL Context Loader
*
* Provides intelligent context loading from TTL files generated by
* the automatic analysis system, with concrete code information
* and business context preservation.
*/
export declare class TTLContextLoader extends EventEmitter {
private config;
private _knowledgeGraphPopulator;
private _rdfGenerator;
private _informationExtractor;
private ttlFiles;
private contextCache;
private fileWatcher;
private loadingQueue;
private metrics;
private cacheCleanupInterval?;
constructor(config: TTLContextLoaderConfig, knowledgeGraphPopulator: KnowledgeGraphPopulator, rdfGenerator: EnhancedRDFGenerator, informationExtractor: ConcreteInformationExtractor);
/**
* Initialize metrics
*/
private initializeMetrics;
/**
* Start the TTL context loader
*/
start(): Promise<void>;
/**
* Stop the TTL context loader
*/
stop(): Promise<void>;
/**
* Load context for a specific request
*/
loadContext(request: ContextRequest): Promise<ContextResponse>;
/**
* Get all loaded TTL files
*/
getTTLFiles(): Map<string, TTLFile>;
/**
* Get TTL file by path
*/
getTTLFile(path: string): TTLFile | undefined;
/**
* Refresh TTL file from disk
*/
refreshTTLFile(path: string): Promise<void>;
/**
* Get loader metrics
*/
getMetrics(): TTLContextLoaderMetrics;
/**
* Initialize file watcher
*/
private initializeFileWatcher;
/**
* Handle file system events
*/
private handleFileEvent;
/**
* Load all TTL files from the project
*/
private loadAllTTLFiles;
/**
* Load a single TTL file
*/
private loadTTLFile;
/**
* Extract enhanced TTL metadata
*/
private extractTTLMetadata;
/**
* Extract concrete code context
*/
private extractConcreteContext;
/**
* Select relevant TTL files for context request
*/
private selectRelevantTTLFiles;
/**
* Load concrete sources from selected files
*/
private loadConcreteSources;
/**
* Generate enhanced context with business insights
*/
private generateEnhancedContext;
/**
* Format TTL file for LLM consumption
*/
private formatTTLForLLM;
private extractClasses;
private extractMethods;
private extractProperties;
private extractRelationships;
private extractImports;
private extractCodeStructure;
private extractBusinessDomain;
private extractArchitecturalPatterns;
private extractQualityMetrics;
private calculateComplexity;
private calculateMaintainability;
private calculateTestability;
private extractModuleName;
private extractLanguage;
private extractDependencies;
private extractBusinessContext;
private extractVersion;
private parseTTLContent;
private detectLanguageFromPath;
private calculateIntentScore;
private calculateConcreteContextScore;
private estimateTokens;
private calculateAverageRelevance;
private getCachedContext;
private cacheContext;
private generateCacheKey;
private clearRelatedCache;
private updateMetrics;
private chunkArray;
private generateFollowUpQueries;
private generateImprovements;
private startCacheCleanup;
}
//# sourceMappingURL=TTLContextLoader.d.ts.map