/** * Cross-tick GitHub API response cache — reduces redundant requests across * `pr-shepherd` poll ticks. * * Two entry kinds, both keyed by a caller-chosen logical `name` (hashed to a * filesystem-safe filename, mirroring seen-comments.mts): * * - "etag" entries back conditional REST requests (`If-None-Match`). A 200 * response overwrites the entry; a 304 leaves it untouched. Used for list * endpoints whose content can change from tick to tick (job lists, run * lists). * - "derived" entries cache a value computed from a response that is * immutable once identified by its key — job-log excerpts once a job is * terminal, check-run annotations once the check is COMPLETED. No ETag * applies; the cache is keyed on an immutable identity instead. * * Entries live under `$PR_SHEPHERD_STATE_DIR/-//rest-cache/` * and are removed for free when `pr-shepherd clean` deletes the PR's state * directory — there is no separate pruning routine. */ export interface StateKey { owner: string; repo: string; pr: number; } export interface EtagCacheEntry { kind: "etag"; name: string; etag: string; body: unknown; storedAt: number; headSha?: string; } export interface DerivedCacheEntry { kind: "derived"; name: string; value: T; storedAt: number; headSha?: string; } export declare function loadEtagEntry(key: StateKey, name: string): Promise; export declare function storeEtagEntry(key: StateKey, name: string, fields: { etag: string; body: unknown; headSha?: string; }): Promise; export declare function loadDerived(key: StateKey, name: string): Promise | null>; export declare function storeDerived(key: StateKey, name: string, value: T, headSha?: string): Promise;