export type RunState = "idle" | "running" | "cancelling";
export type CancelResult = {
    status: "cancelled";
    generation: number;
} | {
    status: "idle";
    generation: number;
} | {
    status: "failed";
    generation: number;
    reason: "timeout";
};
export interface RunLease {
    generation: number;
}
export declare class RunBusyError extends Error {
    constructor(state: RunState);
}
/** Generation-safe ownership and acknowledged bounded cancellation. */
export declare class RunLifecycle {
    private readonly onStateChange?;
    private currentState;
    private nextGeneration;
    private active?;
    constructor(onStateChange?: ((state: RunState) => void) | undefined);
    get state(): RunState;
    get running(): boolean;
    get generation(): number;
    begin(abort: () => void): RunLease;
    isCancellationRequested(generation: number): boolean;
    /** Settle only the matching owner; stale generations cannot release a new run. */
    settle(generation: number): {
        settled: boolean;
        cancelled: boolean;
    };
    /** Abort once, then acknowledge only after the owning operation settles. */
    cancel(timeoutMs: number): Promise<CancelResult>;
    private setState;
}
//# sourceMappingURL=run-lifecycle.d.ts.map