/** * package-author-tracker — Tracks which agent added which package to which manifest. * * Stores a per-project JSON log in the global project directory: * ~/.wrongstack/projects//package-authors.json * * Each entry records: manifest path, package name, version range at time of add, * agent id/name, timestamp, and session id. * * Used by the tech-stack agent and outdated-watcher to route outdated-package * notifications back to the agent that originally added the package. * * @module package-author-tracker */ export interface PackageAuthorEntry { /** Absolute or relative path to the manifest (package.json, go.mod, etc.). */ manifestPath: string; /** Exact package name as it appears in the manifest. */ packageName: string; /** Version specifier at time of install (e.g. "^1.2.0", "latest", "file:..."). */ versionSpec: string; /** Ecosystem: 'npm', 'cargo', 'go', 'pip', 'gem', 'composer', 'nuget', etc. */ ecosystem: string; /** Agent id that performed the install (e.g. 'leader', 'executor', 'tech-stack'). */ agentId: string; /** Human-readable agent name. */ agentName?: string | undefined; /** Session that performed the install. */ sessionId?: string | undefined; /** ISO8601 timestamp. */ timestamp: string; /** Whether this package is currently flagged as outdated. */ outdated?: boolean | undefined; /** Latest version available (set by outdated checker). */ latestVersion?: string | undefined; } export interface PackageAuthorLog { /** Project root this log belongs to. */ projectRoot: string; /** All entries, newest last. */ entries: PackageAuthorEntry[]; /** Last time the log was compacted. */ lastCompactedAt?: string | undefined; } export interface PackageAuthorTrackerOptions { /** Directory where the JSON log is stored. Usually the global project dir. */ storageDir: string; /** Project root for reference. */ projectRoot: string; /** Max entries before auto-compaction. Default: 10000. */ maxEntries?: number | undefined; } /** * Detect the ecosystem from a manifest filename. */ export declare function detectEcosystem(manifestPath: string): string; /** * Record that an agent added (or updated) a package to a manifest file. * * If the same (manifestPath, packageName) entry already exists, the previous * entry is kept (for audit trail) and a new entry is appended. */ export declare function recordPackageAction(opts: PackageAuthorTrackerOptions, entry: Omit): Promise; /** * Get the most recent author entry for a given (manifest, package) pair. * Returns undefined if no entry exists. */ export declare function getPackageAuthor(opts: Pick, manifestPath: string, packageName: string): Promise; /** * Get all packages in a manifest that have an author on record. */ export declare function getManifestPackages(opts: Pick, manifestPath: string): Promise; /** * Get all packages last tracked by a specific agent. * Returns a Map from (manifestPath, packageName) → entry. */ export declare function getPackagesByAgent(opts: Pick, agentId: string): Promise>; /** * Update the outdated status of a package entry (adds or replaces the entry * for the given manifest+package, appending to the log for audit). */ export declare function updatePackageOutdatedStatus(opts: PackageAuthorTrackerOptions, manifestPath: string, packageName: string, outdated: boolean, latestVersion?: string | undefined): Promise; /** * Return the full log (for debugging/auditing). */ export declare function getFullPackageLog(opts: Pick): Promise; //# sourceMappingURL=package-author-tracker.d.ts.map