import type { FactoryRunBindingRecord, WorkItemsStorage } from '../storage/domains/work-items/base.js'; export interface TerminalStageCleanupOptions { workItems: Pick; /** Final ingest of trailing tool results before the binding is revoked. */ reconcileBinding?: (binding: FactoryRunBindingRecord) => Promise; /** Release the item's session sandboxes back to the reuse pool. */ releaseSandboxes?: (args: TerminalStageCleanupArgs) => Promise; } export interface TerminalStageCleanupArgs { orgId: string; factoryProjectId: string; workItemId: string; /** Revision produced by the terminal transition that scheduled this cleanup. */ revision?: number; } /** * Terminal-stage cleanup for a work item: ingest any trailing tool results * from the item's bound threads, revoke its active run bindings so completed * items leave the reconcile walk (the active set otherwise grows forever), * dismiss the runs still parked on it, then release its sandboxes. Every step * is best-effort — a committed transition never fails on cleanup; leaked * bindings are drained by the staleness sweep. */ export declare function createTerminalStageCleanup(options: TerminalStageCleanupOptions): (args: TerminalStageCleanupArgs) => Promise; //# sourceMappingURL=terminal-cleanup.d.ts.map