/** * package-outdated-watcher — Periodically checks installed packages for outdated * versions and notifies the agent that originally added each package. * * Architecture: * 1. Polls the mailbox for `assign` messages from the tech-stack agent * containing outdated package results. * 2. For each outdated package, looks up the original author via * `package-author-tracker`. * 3. Sends a high-priority `note` message to the original author (or * broadcasts to `*` if the author is unknown or no longer online). * * The watcher can also be triggered directly via `checkOutdated` for * on-demand checks (e.g. on a timer, or when the user requests it). * * Usage: * const dispose = startPackageOutdatedWatcher({ * mailbox, * storageDir: wpaths.globalDir, * projectRoot, * pollIntervalMs: 60 * 60 * 1000, // 1 hour * onNotify: async (msg) => mailbox.send(msg), * onLog: (m) => console.log(`[pkg-outdated-watcher] ${m}`), * }); * * @module package-outdated-watcher */ import type { Mailbox } from './mailbox-types.js'; import { type PackageAuthorTrackerOptions } from './package-author-tracker.js'; export interface PackageOutdatedEntry { /** Package name. */ name: string; /** Currently installed version. */ currentVersion: string; /** Latest stable version available. */ latestVersion: string; /** semver major.minor.patch wanted range (from lockfile). */ wantedVersion: string; /** Manifest file this package belongs to. */ manifestPath: string; /** Ecosystem: 'npm', 'cargo', 'go', etc. */ ecosystem: string; } export interface PackageOutdatedResult { /** All outdated entries. */ outdated: PackageOutdatedEntry[]; /** Packages that are up-to-date. */ upToDate: string[]; /** Whether the check failed. */ checkFailed: boolean; } export interface PackageOutdatedWatcherOptions { /** The mailbox for sending notifications and receiving tech-stack results. */ mailbox: Mailbox; /** Package-author-tracker options. */ packageTrackerOpts: Pick; /** Polling interval in ms. Default: 60 * 60 * 1000 (1 hour). */ pollIntervalMs?: number | undefined; /** Agent id that runs this watcher. Default: 'pkg-outdated-watcher'. */ watcherAgentId?: string | undefined; /** Agent id of the tech-stack agent to watch for results. Default: 'tech-stack'. */ techStackAgentId?: string | undefined; /** Called to send a notification to an agent. */ onNotify: (msg: OutdatedNotifyMessage) => Promise; /** Called for log output. */ onLog?: ((msg: string) => void) | undefined; /** Called on errors. */ onError?: ((err: unknown) => void) | undefined; } export interface OutdatedNotifyMessage { from: string; to: string; subject: string; body: string; priority: 'high' | 'normal' | 'low'; } /** * Start the package outdated watcher. * * Returns a dispose function that stops polling and cleans up. */ export declare function startPackageOutdatedWatcher(opts: PackageOutdatedWatcherOptions): () => void; //# sourceMappingURL=package-outdated-watcher.d.ts.map