import type { BackgroundAgentTaskHandle, BackgroundUnyieldableReason, BackgroundYieldOptions, DurableAgentCore, RegisteredTaskHandle, TaskAccess, WorkflowTaskHandle } from "./task-registry-shared.js";
/** The handles a yield reaches: background agents and workflow runs. */
export type YieldableHandle = BackgroundAgentTaskHandle | WorkflowTaskHandle;
/**
 * Hand ONE running agent or workflow run the yield. Answers why it cannot yield, or undefined when it was handed it (its
 * leg parks at its own next clean boundary; a leg that has not reported yet is handed it at its report — a workflow run
 * hands it to each of its legs the same way).
 */
export declare function requestYieldLane(core: DurableAgentCore, handle: YieldableHandle, opts: BackgroundYieldOptions): BackgroundUnyieldableReason | undefined;
/** Whether a request already reached this handle (a whole-registry request covers a late joiner once). */
export declare function yieldRequested(handle: YieldableHandle): boolean;
/**
 * A leg's prepare report: the leg's own yield controller and whether it can suspend durably. Replaces the previous leg's
 * (every leg reports its own); an intent already set is handed to this leg now.
 */
export declare function attachYieldLegLane(core: DurableAgentCore, id: string, controller: AbortController, ready: boolean): void;
/** Whether a request covers this handle — the ONE reading the request's first population and every late joiner of a
 *  whole-registry request share. A running background agent the request's `access` reaches (every one when absent); a
 *  running workflow run only for the whole registry (a run is never its launching leg's to decide: it outlives that leg,
 *  whose end does not reap it either); session-scoped work skipped when asked. */
export declare function yieldCovers(handle: RegisteredTaskHandle, access: TaskAccess | undefined, opts: BackgroundYieldOptions): handle is YieldableHandle;
/** The running work a request covers (see {@link yieldCovers}). */
export declare function yieldPopulationLane(core: DurableAgentCore, access: TaskAccess | undefined, opts: BackgroundYieldOptions): YieldableHandle[];
/** Whether every handle in `ids` has left `running` (a vanished handle has); the durable writes are awaited separately. A
 *  workflow run leaves `running` when it ends, after its terminal record write. */
export declare function yieldPopulationLeftRunning(core: DurableAgentCore, ids: ReadonlySet<string>): boolean;
/** Settle the durable writes queued for `ids` so far, and answer the agents whose latest write did NOT land — the store
 *  refused it through every retry (the heartbeat keeps re-driving it), so the row still reads its previous state. An agent's
 *  writes are its row chain (a park's or a settle's write is queued in the same synchronous stretch as the transition, so it
 *  is in the chain by the time the transition's poke is observed); a workflow run's are its run's end (`done` settles after
 *  its terminal record is written — a stopped run reads `cancelled` before that). Never rejects. */
export declare function yieldPopulationWrites(core: DurableAgentCore, ids: ReadonlySet<string>): Promise<string[]>;
