/** * Smart Symbols Tool - Symbol Extraction with Caching * * Extracts and analyzes TypeScript/JavaScript symbols with intelligent caching: * - Identifies all declarations (variables, functions, classes, interfaces, types, enums) * - Tracks scope, exports, and documentation * - Counts references using TypeScript's language service * - Git-aware cache invalidation * - 75-85% token reduction through summarization */ import { CacheEngine } from '../../core/cache-engine.js'; import { MetricsCollector } from '../../core/metrics.js'; import { TokenCounter } from '../../core/token-counter.js'; export interface SmartSymbolsOptions { /** * File path to analyze */ filePath: string; /** * Types of symbols to extract (default: all) */ symbolTypes?: Array<'variable' | 'function' | 'class' | 'interface' | 'type' | 'enum'>; /** * Include only exported symbols */ includeExported?: boolean; /** * Include imported symbols */ includeImported?: boolean; /** * Project root directory */ projectRoot?: string; /** * Force re-extraction (ignore cache) */ force?: boolean; /** * Maximum cache age in seconds (default: 300) */ maxCacheAge?: number; } export interface SymbolInfo { name: string; kind: 'variable' | 'function' | 'class' | 'interface' | 'type' | 'enum' | 'method' | 'property' | 'parameter'; location: { line: number; column: number; }; scope: 'global' | 'module' | 'block' | 'function' | 'class'; exported: boolean; type?: string; documentation?: string; references: number; } export interface SmartSymbolsResult { /** * Summary information */ summary: { file: string; totalSymbols: number; byKind: Record; exportedCount: number; fromCache: boolean; duration: number; }; /** * Extracted symbols */ symbols: SymbolInfo[]; /** * Import information (if includeImported is true) */ imports?: Array<{ module: string; symbols: string[]; }>; /** * Token reduction metrics */ metrics: { originalTokens: number; compactedTokens: number; reductionPercentage: number; }; } export declare class SmartSymbolsTool { private cache; private metrics; private cacheNamespace; private projectRoot; constructor(cache: CacheEngine, _tokenCounter: TokenCounter, metrics: MetricsCollector, projectRoot?: string); /** * Extract symbols from a TypeScript/JavaScript file */ run(options: SmartSymbolsOptions): Promise; /** * Create language service host for reference counting */ private createLanguageServiceHost; /** * Extract symbols from source file */ private extractSymbols; /** * Create symbol info from identifier */ private createSymbolInfo; /** * Extract imports from source file */ private extractImports; /** * Calculate token reduction metrics */ private calculateMetrics; /** * Generate cache key */ private generateCacheKey; /** * Get cached result if available and fresh */ private getCachedResult; /** * Cache result */ private cacheResult; /** * Close cache and cleanup */ close(): void; } /** * Factory function for getting tool instance */ export declare function getSmartSymbolsTool(cache: CacheEngine, tokenCounter: TokenCounter, metrics: MetricsCollector): SmartSymbolsTool; /** * Standalone function for symbol extraction */ export declare function runSmartSymbols(options: SmartSymbolsOptions, cache?: CacheEngine, tokenCounter?: TokenCounter, metrics?: MetricsCollector): Promise; export declare const SMART_SYMBOLS_TOOL_DEFINITION: { name: string; description: string; inputSchema: { type: string; properties: { filePath: { type: string; description: string; }; symbolTypes: { type: string; description: string; items: { type: string; enum: string[]; }; }; includeExported: { type: string; description: string; default: boolean; }; includeImported: { type: string; description: string; default: boolean; }; projectRoot: { type: string; description: string; }; force: { type: string; description: string; default: boolean; }; maxCacheAge: { type: string; description: string; default: number; }; }; required: string[]; }; }; //# sourceMappingURL=smart-symbols.d.ts.map