/** * Extension Diagnostics System * * Extension lifecycle enhancement with diagnostics. * Provides caching, diagnostics, and performance tracking. */ export type DiagnosticLevel = 'info' | 'warn' | 'error'; export interface ExtensionDiagnostic { level: DiagnosticLevel; extensionId?: string; source?: string; message: string; timestamp: number; code?: string; details?: Record; } export interface CacheEntry { value: T; expiresAt: number; } export interface ExtensionLoaderCache { /** Cache key builder */ buildKey(options: unknown, enabledIds?: string[]): string; /** Get cached value */ get(key: string): T | undefined; /** Set cached value with TTL (in ms) */ set(key: string, value: T, ttl?: number): void; /** Invalidate cache */ invalidate(key?: string): void; /** Check if cache exists */ has(key: string): boolean; } /** * Simple in-memory cache with TTL support */ export declare class ExtensionLoaderCacheImpl implements ExtensionLoaderCache { private cache; /** * Build a cache key from loader options */ buildKey(options: { workspaceDir?: string; globalDir?: string; bundledDir?: string; }, enabledIds?: string[]): string; /** * Get cached value */ get(key: string): T | undefined; /** * Set cached value with TTL */ set(key: string, value: T, ttl?: number): void; /** * Invalidate cache */ invalidate(key?: string): void; /** * Check if cache exists and is valid */ has(key: string): boolean; /** * Get cache stats */ getStats(): { size: number; keys: string[]; }; } /** * Extension diagnostics collector */ export declare class ExtensionDiagnostics { private diagnostics; private maxDiagnostics; /** * Add a diagnostic */ addDiagnostic(diagnostic: ExtensionDiagnostic): void; /** * Add info diagnostic */ info(extensionId: string, message: string, details?: Record): void; /** * Add warning diagnostic */ warn(extensionId: string, message: string, details?: Record): void; /** * Add error diagnostic */ error(extensionId: string, message: string, details?: Record): void; /** * Get all diagnostics */ getAll(): ExtensionDiagnostic[]; /** * Get diagnostics for a specific extension */ getForExtension(extensionId: string): ExtensionDiagnostic[]; /** * Get diagnostics by level */ getByLevel(level: DiagnosticLevel): ExtensionDiagnostic[]; /** * Get errors */ getErrors(): ExtensionDiagnostic[]; /** * Get warnings */ getWarnings(): ExtensionDiagnostic[]; /** * Clear diagnostics */ clear(): void; /** * Get summary */ getSummary(): { errorCount: number; warnCount: number; infoCount: number; }; } export declare function getExtensionCache(): ExtensionLoaderCacheImpl; export declare function getExtensionDiagnostics(): ExtensionDiagnostics; export declare function setExtensionCache(cache: ExtensionLoaderCacheImpl): void; export declare function setExtensionDiagnostics(diagnostics: ExtensionDiagnostics): void;