/** * @pwngh/economy-lab * * Copyright (c) Preston Neal * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ import type { OrphanSweepCtx } from './orphans.js'; import type { Store } from '../ports.js'; export interface RetentionSweepInput { now: number; /** Per-lane cap: idempotency rows deleted, and sessions inspected, per run. */ limit: number; /** Delete idempotency rows older than this; a deleted key re-executes on a duplicate. */ idempotencyOlderThanMs?: number; /** Prune settled sessions whose newest movement is older than this. */ sessionsOlderThanMs?: number; } export interface RetentionSweepSummary { /** `skipped` when the lane's horizon is unset or the store offers no delete surface. */ idempotency: { deleted: number; skipped?: true; }; sessions: { /** Session ids inspected this run (bounded by `limit`). */ scanned: number; pruned: Array<{ sessionId: string; movements: number; }>; /** Escrow remainders returned before pruning (the orphan sweep's own idempotent repair). */ escrowRefunds: Array<{ sessionId: string; userId: string; minor: string; }>; failed: Array<{ sessionId: string; code: string; }>; skipped?: true; }; } /** One retention pass; each lane runs only under its horizon opt-in. */ export declare function sweepRetention(store: Store, ctx: OrphanSweepCtx, input: RetentionSweepInput): Promise;