import { AppendOnlyRetentionScheduler } from './retention/append-only-registry.js'; import { StoreSnapshotScheduler } from '../state/store-snapshots.js'; import { UserPermissionRuleStore } from '../permissions/user-rule-store.js'; import type { SessionSurface } from './session-surface.js'; export interface DurabilityServicesInput { readonly configManager: { getControlPlaneConfigDir(): string; get(key: never): unknown; watchConfigFiles(options?: { intervalMs?: number; }): () => void; }; readonly secretsManager: { onDidChange(listener: (key: string) => void): () => void; }; readonly providerRegistry: { refreshProviderCredentials(): Promise; }; readonly memoryDbPath: string; readonly codeIndexDbPath: string; /** * The product's declare-once storage handle. The retention-sweep roots below * are read straight off it rather than re-declared here, so the janitor can * never sweep a different scope than the one sessions and recovery * snapshots are actually written to. */ readonly surface: SessionSurface; readonly shellPaths: { resolveUserPath(...segments: string[]): string; }; /** * The session id this process is currently using, read at each sweep. When * omitted the crash-residue reap still protects live artefacts through its * age and liveness rules, this is the explicit belt-and-braces guard. */ /** * Resolves the live session id, read fresh on every crash-residue sweep so * the running session's own transcript journal and liveness marker are * exempt from reaping. * * A getter, not a value: the id is reassigned in place when a recovery * snapshot is accepted, and this sweep repeats for the life of the process. * * Omitting it is not merely untidy. The journal reaper's other guard is the * liveness marker, and that marker goes stale after 150 seconds, so a host * that passes nothing here is trusting a heartbeat that a single long * blocking turn can outrun, and an in-process sweep landing in that window * would delete the journal of the session currently writing it. Passing this * makes the exemption unconditional instead of timing-dependent. */ readonly currentSessionId?: () => string | null; } export interface DurabilityServices { readonly storeSnapshotScheduler: StoreSnapshotScheduler; /** * Re-sweeps every registered append-only store on a cadence. The start-time * sweep alone never prunes again in a process that stays up, which is the * window in which those stores grow. Unref'd timers; teardown stop()s it. */ readonly appendOnlyRetentionScheduler: AppendOnlyRetentionScheduler; readonly userPermissionRuleStore: UserPermissionRuleStore; /** * Stops the repeating crash-residue sweep. The timer is unref'd, so a host * that never calls this is not held open by it; teardown calls it to stop * the work rather than to release the loop. */ readonly stopDurabilityHousekeeping: () => void; /** Stops the live config-file watch this factory started. */ readonly stopConfigWatch: () => void; } export declare function createDurabilityServices(input: DurabilityServicesInput): DurabilityServices; //# sourceMappingURL=durability-services.d.ts.map