import { type Json, type Target, type StartingTarget } from "./protocol.js";
import type { HandOffQueue } from "./hand-off-queue.js";
import { type Receipt } from "./dispatch.js";
type ClosedTarget = Target | StartingTarget;
export declare function markWorkerClosed(target: ClosedTarget, terminal: string): Promise<void>;
export declare function intentionallyClosed(target: ClosedTarget): Promise<boolean>;
export declare function markPaneClosed(server: string, pane: Json): Promise<void>;
/** Whether this pane still runs the session (or starting binding) the dispatch recorded. */
export type PaneBinding = "match" | "different" | "unknown";
/** The exact recorded binding: the session id, or a starting target's starting token. */
export declare function paneBinding(target: Target | StartingTarget, pane: Json | undefined, chat: Json): PaneBinding;
export declare function paneRunsTarget(target: Target | StartingTarget, pane: Json | undefined, chat: Json): boolean;
/**
 * Cancel a running dispatch by id or idempotency key. The intent is recorded
 * first; the pane is closed only while it still runs the recorded session, and
 * the terminal `cancelled` return is written only after the pane is confirmed
 * gone. A close that cannot be confirmed leaves the intent for a later retry.
 */
export declare function cancelDispatch(input: unknown): Promise<Json>;
/** The one close path: exact binding, confirmed snapshot, terminal return only after it is gone. */
export declare function closeVerifiedWorker(receipt: Receipt): Promise<Json>;
/** Called on the worker's computer only after the sender read the done return.
 * Recheck this exact ended turn and skip any new work, background work or inbox. */
export declare function closeFinishedWorker(input: unknown, queue?: HandOffQueue): Promise<Json>;
/** Injectable timing for the close-self tests: how often a deferred close
 * rechecks its pane, and how long it keeps rechecking before it leaves the
 * pane open. A bare number is the recheck interval; each path keeps its own
 * default (15 s for a dispatched pane, 10 s otherwise). */
export interface CloseSelfTiming {
    recheckMs?: number;
    deadlineMs?: number;
}
/** An agent closing the pane it runs in, once its work is committed and reported:
 * the sanctioned form of `herdr pane close`, which an agent's auto mode refuses.
 * Only the caller's own pane (named by its terminal variables) is ever closed,
 * and never on the spot: the reply returns first, and the pane closes only
 * after the turn that called has ended with nothing still running, so the
 * report the agent writes after this reply lands before the close. A dispatched
 * pane also waits for this turn's recorded return; either path stops the
 * moment the pane is gone, replaced, or has taken new work, and leaves the pane
 * open past its bound rather than force the close. */
export declare function closeOwnPane(input: unknown, timing?: number | CloseSelfTiming, queue?: HandOffQueue): Promise<Json>;
export {};
