/** * media.ts — The download cache under `~/.pi/wechat/media`. * * Both processes touch it: the worker sweeps it at startup and hourly, and * the extension reports on it (`/wechat media`) and empties it * (`/wechat clean`). Those were separate implementations that disagreed * about what "old" means — one deleted files over 24 h, the other deleted * everything without asking. * * Not pure, but self-contained and testable against a temp directory, the * way `log.ts` is. `nowMs` is a parameter rather than a clock read so the * age arithmetic can be tested without waiting a day. No relative imports, * so it loads under node's native type stripper. */ /** How long a download is worth keeping. Both processes must agree. */ export declare const MEDIA_MAX_AGE_MS: number; export interface MediaSurvey { count: number; totalSize: number; /** How many are older than the age handed in. */ old: number; } /** * Count and measure the cache, or null when there is no directory. * * Files that cannot be stat'd are counted but contribute no size: a listing * is a report, and refusing to produce one because of a single unreadable * entry would be worse than a slightly low total. */ export declare function surveyMedia(dir: string, oldAgeMs: number, nowMs: number): MediaSurvey | null; /** * Delete cached downloads, keeping anything younger than `minAgeMs`. * * `minAgeMs = 0` removes everything — the `/wechat clean` case, which is why * that call site confirms first: these files are what the `[Image: …]` paths * already handed to the agent point at. * * Never throws: this runs from a worker timer where an exception would be an * unhandled rejection, and from a command where it would surface as a crash. */ export declare function sweepMedia(dir: string, minAgeMs: number, nowMs: number): number; //# sourceMappingURL=media.d.ts.map