/** * Cross-run memoization: fingerprint resolver + persistent phase-result cache. * * See docs/rfc-cross-run-memoization.md. The cache lets a phase reuse the result * of an identical-input phase from ANY prior run (scope: "cross-run"), for $0.00. * Freshness is guarded by: * - the existing content-addressed inputHash (declared inputs) * - optional `fingerprint` entries folded into the key (git/glob/file/env) * - optional TTL * - default `run-only` scope (this module is only consulted for cross-run) * * Zero runtime dependencies: Node built-ins only (fs.globSync requires Node >=22, * which the project already targets). */ import { type PhaseState } from "./store.ts"; /** * Resolve a phase's `fingerprint` list into a single deterministic string to be * folded into the cache key. Returns "" when there are no entries (so the key is * unchanged for phases that declare no fingerprint). */ export declare function resolveFingerprint(entries: string[] | undefined, cwd: string): string; /** @internal */ export interface CacheEntry { /** The full cache key (== phase inputHash incl. fingerprint). */ key: string; createdAt: number; /** Trimmed phase result surface that downstream phases consume. */ output?: string; json?: unknown; model?: string; /** Full PhaseState payload preserved so cross-run reuse is semantically * equivalent to within-run resume. Storing only output/json would drop * `gate`, `approval`, `reads`, `loop`, `tournament`, `warnings`, etc., * breaking recompute soundness and gate-block detection. */ state?: PhaseState; /** Provenance for audit / cleanup. */ flowName?: string; phaseId?: string; runId?: string; } /** * The cross-run cache, scoped to a working directory. Cheap to construct; all IO * is lazy and failure-tolerant (a broken cache must never break a run). */ export declare class CacheStore { private dir; constructor(cwd: string); /** Look up a fresh entry. Returns null on miss, malformed key, or TTL expiry. */ get(key: string, ttlMs?: number): CacheEntry | null; /** Store an entry (best-effort; never throws into the run). */ put(entry: CacheEntry): void; /** Remove all cache entries. Returns the number removed. */ clear(): number; /** Opportunistic eviction: drop expired/oversized entries. Best-effort. */ private cleanup; } //# sourceMappingURL=cache.d.ts.map