/**
 * Session Completion Handler — the "phone home" delivery engine.
 *
 * Subscribes once to the global session registry. Whenever ANY session reaches a
 * terminal state (the registry emits `session_stopped` from the sendMessage
 * `finally` block, covering success, max_turns, max_budget, abort, and error),
 * this handler:
 *
 *   1. Marks any callbacks waiting on that session (as a child) "ready".
 *   2. Attempts delivery to every parent that has ready callbacks and is now idle.
 *      A stopped session is itself a candidate parent — this is how a callback
 *      that was deferred while the parent was busy gets delivered once the parent
 *      finishes its own turn.
 *
 * Delivery re-invokes the parent as a fresh turn with a lightweight notification;
 * the parent reads the child transcript itself. If the parent chat was deleted
 * and it was an agent, a brand-new agent chat is spawned to pick up instead.
 *
 * Dependencies (sendMessage, getActiveSession) are injected from claude.ts to
 * avoid a circular import, mirroring the setMessageSender pattern used elsewhere.
 */
import type { EventEmitter } from "events";
type MessageSender = (opts: {
    prompt: string | AsyncIterable<unknown>;
    chatId?: string;
    maxTurns?: number;
}) => Promise<EventEmitter>;
type ActiveSessionLookup = (chatId: string) => unknown | undefined;
/**
 * Wire up the global completion listener. Safe to call once; subsequent calls
 * only refresh the injected dependencies.
 */
export declare function initSessionCompletionHandler(deps: {
    sendMessage: MessageSender;
    getActiveSession: ActiveSessionLookup;
}): void;
export {};
//# sourceMappingURL=session-completion-handler.d.ts.map