/** * @fileoverview Service for the NVD source dictionary (`/rest/json/source/2.0`). * Resolves the identifiers NVD stamps on weaknesses and references to their published * contributor names, cached so the dictionary costs one upstream request a day rather than one * per record, per reference, or per call. * @module services/nvd-source/nvd-source-service */ import type { Context } from '@cyanheads/mcp-ts-core'; import type { AppConfig } from '@cyanheads/mcp-ts-core/config'; import type { StorageService } from '@cyanheads/mcp-ts-core/storage'; /** * Maps an NVD source identifier to its published contributor name, returning the identifier * unchanged when the dictionary holds no entry for it. */ export type SourceNameResolver = (identifier: string) => string; /** Returns every identifier untouched — for surfaces that emit no `source` field at all. */ export declare const passthroughSourceNames: SourceNameResolver; export declare class NvdSourceService { private names; private expiresAt; private inFlight; constructor(_config: AppConfig, _storage: StorageService); /** * A resolver over the cached dictionary, loading it first when the cache is cold or stale. * * The dictionary is one small document every record resolves against, and it turns over by a * handful of entries a year, so it is fetched on the cadence of {@link CACHE_TTL_MS} rather * than per CVE, per reference, or per call. Concurrent first callers share the single in-flight * request: a burst of tool calls must not stampede the endpoint. */ getResolver(ctx: Context): Promise; /** * Load the dictionary, degrading to whatever is already cached when NVD cannot serve it. A CVE * lookup must not start failing because a secondary metadata endpoint is down, so this never * throws — an unresolvable identifier reaching the caller raw is the documented fallback. */ private load; } export declare function initNvdSourceService(config: AppConfig, storage: StorageService): void; export declare function getNvdSourceService(): NvdSourceService; //# sourceMappingURL=nvd-source-service.d.ts.map