import { ProviderModule } from "../types/index.ts"; import { ProviderManagerConfig, ProvidersManifest } from "../types/models/Manager.ts"; export type ProviderMetrics = { errors: number; successes: number; lastOperation: Date; }; export type ProviderHealthReport = { moduleName: string; errors: number; successes: number; totalOperations: number; errorRate: number; active: boolean; lastOperation: Date; }; /** Module manager to handle loading, caching, and refreshing of provider modules based on the specified configuration. */ export declare abstract class ModuleManager { protected config: ProviderManagerConfig; protected isRemote: boolean; protected meta: ProvidersManifest | null; protected loadedModules: ProviderModule[]; protected metrics: Map; protected updateInrterval: NodeJS.Timeout | null; private logger; protected constructor(config: ProviderManagerConfig); /** Start the auto-update mechanism to periodically refresh provider modules */ protected startAutoUpdateService(): void; /** Stop the auto-update interval if it is running */ protected stopAutoUpdateService(): void; /** Initialize provider modules based on the configuration source. * This method is responsible for initializing provider modules based on the configuration provided to the ScrapePluginManager. It supports various sources such as GitHub, npm registry, or local file system. The method will utilize the provided module resolver to dynamically import provider modules and store them in the manager for later use when handling media requests. */ protected initializeModules(): Promise; /** Load provider modules from cache if available and not expired */ protected loadModules(): boolean; /** Refresh provider modules if version is changed or cache is expired */ protected refreshModules(): Promise; /** Save the currently loaded provider modules to cache with the appropriate TTL */ protected saveModules(): void; /** Resolve a scheme identifier to the corresponding loaded module, or `null` if not found / inactive */ protected moduleByScheme(scheme: string): ProviderModule | null; /** Evaluate a module's health metrics against the configured error threshold. * Returns `true` when the module should be disabled. */ protected shouldDisableModule(metrics: ProviderMetrics): boolean; /** Restore persisted provider health metrics from cache and re-evaluate thresholds */ protected restoreMetrics(): void; /** Persist the current provider health metrics to cache */ protected saveMetrics(): void; /** Record one operation outcome for a module and auto-disable it when its * error rate exceeds the configured threshold (after the minimum sample size). */ protected recordMetrics(moduleScheme: string, success: boolean): void; }