/** * Probes the npm registry for a package's available versions and selects * the newest one that satisfies AFT's supply-chain grace window. * * Threat model: defends against typosquat/compromise attacks where a * malicious version is published, then yanked within hours when caught. * By default, AFT only installs versions that have been on the registry * for at least 7 days, giving the community time to detect and respond. * * Grace days are configurable via `lsp.grace_days` (default 7). User * pins via `lsp.versions: { "package": "X.Y.Z" }` bypass the filter. */ /** Per-version publish times indexed by version string. */ type VersionTimes = Record; interface RegistryResponse { /** Map: version → ISO publish time. Also contains "created" / "modified". */ time?: VersionTimes; /** dist-tags such as "latest", "next". */ "dist-tags"?: { latest?: string; }; } export interface VersionPickResult { /** The chosen version, or null if none qualifies. */ version: string | null; /** True when the registry has versions but none is older than `graceDays`. */ blockedByGrace: boolean; /** All eligible versions sorted by publish date (newest first). For tests/logs. */ eligible: ReadonlyArray<{ version: string; publishedAt: string; }>; } /** * Pick a version from the registry response that: * 1. is published at least `graceDays` ago * 2. is the newest such version (per ISO publish time) * * Pre-release versions (semver "-" tags) are skipped. */ export declare function pickEligibleVersion(response: RegistryResponse, graceDays: number, now?: number): VersionPickResult; /** * Fetch the registry document for `npmPackage` and apply the grace filter. * * Returns `null` on HTTP/network failure (logs a warning) so callers can * fall back to "use whatever's currently installed". */ export declare function probeRegistry(npmPackage: string, graceDays: number, fetchImpl?: typeof fetch): Promise; export {}; //# sourceMappingURL=lsp-registry-probe.d.ts.map