/** * Process-local half of execution ownership. Different run ids may overlap; one run id may have only * one execution in this process. The durable store lease enforces that same rule across processes. */ import type { RunExecutionLease } from "./types.ts"; export interface ActiveRun { readonly runId: string; readonly lease: RunExecutionLease; readonly controller: AbortController; readonly cancellationRecorded: boolean; /** False once cancellation persistence begins, closing the late-event race before the disk write. */ acceptsEvents(): boolean; /** Persist cancellation once, then abort. Concurrent callers share the same durable operation. */ cancel(persist: () => Promise): Promise<"accepted" | "already-recorded" | "already-settled">; /** Atomically close cancellation admission, waiting for an already-admitted cancellation if needed. */ settle(): Promise; } export interface ActiveRuns { /** Every execution currently owned by this process, in start order. */ readonly active: readonly ActiveRun[]; /** Register an acquired execution. Rejects a duplicate execution of the same run id. */ start(lease: RunExecutionLease): ActiveRun; /** Remove this exact execution. */ finish(run: ActiveRun): void; /** The local execution of `runId` (an array for compatibility with existing resolution code). */ find(runId: string): readonly ActiveRun[]; } export declare function createActiveRuns(): ActiveRuns; //# sourceMappingURL=active-runs.d.ts.map