import type { WorkstreamDraft } from './workstream-draft-types.js'; /** * Age TTL for an abandoned draft. A proposal that has sat un-launched and * un-cancelled this long is not a plan the user is still reviewing; it is * litter. Measured from the draft's own `createdAt`. */ export declare const WORKSTREAM_DRAFT_TTL_MS: number; /** * Count cap on retained drafts: the newest this many survive, older ones are * reclaimed oldest-first. Bounds the directory even if every draft is recent. */ export declare const WORKSTREAM_DRAFT_CAP = 50; /** * Minimum gap between reaps triggered by `save()`. `loadAll()` is the recovery * point but runs once per session, so a session that stays open for days would * otherwise never reap again. Every `save()` (draft created, reshaped, or * approved) re-checks the bounds, throttled to this interval so the directory * is not re-scanned on every keystroke-driven save. */ export declare const WORKSTREAM_DRAFT_SWEEP_INTERVAL_MS: number; /** What one `loadAll()` reclaimed. Counts only, never draft text. */ export interface WorkstreamDraftReclaim { /** Unix ms of the sweep. */ readonly at: number; /** Valid drafts removed because they aged past the TTL. */ readonly expired: number; /** Valid drafts removed because they fell outside the count cap. */ readonly overCap: number; /** Torn/malformed snapshots removed once they were older than the TTL. */ readonly unreadable: number; } export interface WorkstreamDraftStoreOptions { /** * Called after a `loadAll()` that reclaimed at least one file, so the count * can be surfaced to the operator. Receives counts only. Never throws out of * `loadAll()`, a failing hook is swallowed like every other side effect here. */ readonly onReclaim?: (summary: WorkstreamDraftReclaim) => void; /** Clock seam (tests). Defaults to Date.now. */ readonly now?: () => number; /** Override the age TTL (tests / embedders). Defaults to WORKSTREAM_DRAFT_TTL_MS. */ readonly ttlMs?: number; /** Override the count cap (tests / embedders). Defaults to WORKSTREAM_DRAFT_CAP. */ readonly cap?: number; /** * Throttle for the reap that `save()` triggers. 0 or less means every save * reaps (tests); defaults to WORKSTREAM_DRAFT_SWEEP_INTERVAL_MS. */ readonly sweepIntervalMs?: number; } export interface WorkstreamDraftStore { /** * Every valid draft on disk, oldest first, after reaping abandoned ones. A * directory that doesn't exist yet ⇒ []. Malformed files are skipped, never * fatal, and are only deleted once older than the TTL. */ loadAll(): WorkstreamDraft[]; /** Write (or overwrite) one draft's snapshot atomically. Silently no-ops on any I/O failure, a lost journal write must never break the in-memory flow. */ save(draft: WorkstreamDraft): void; /** Delete one draft's snapshot (on launch or cancel). Missing file ⇒ no-op. */ remove(id: string): void; /** Summary of the most recent `loadAll()` that reclaimed something; null otherwise. */ readonly lastReclaim: WorkstreamDraftReclaim | null; } /** Human-readable, content-free disclosure line for a reclaim summary. */ export declare function formatWorkstreamDraftReclaim(summary: WorkstreamDraftReclaim): string; export declare function createWorkstreamDraftStore(projectRoot: string, options?: WorkstreamDraftStoreOptions): WorkstreamDraftStore; //# sourceMappingURL=workstream-draft-store.d.ts.map