import type { PayloadHandler, PayloadMiddleware } from "./payload-middleware.js";
import type { ReplyDispatcher } from "./reply-dispatcher.js";
/**
 * Returns a PayloadHandler that dispatches the payload via the given
 * ReplyDispatcher. Suitable as the LEAF (innermost) handler of a payload
 * middleware stack.
 *
 * Per kind:
 *   tool  → dispatcher.sendToolResult(payload)
 *   block → dispatcher.sendBlockReply(payload)
 *   final → dispatcher.sendFinalReply(payload)
 *   delta → drop with "drop:dispatcher-no-delta" (the dispatcher doesn't
 *           queue streaming tokens — they go through onPartialReply
 *           outside this stack)
 *
 * The dispatcher's boolean return value (queued vs not — false means
 * the payload was normalized into nothing, e.g. NO_REPLY) maps to the
 * delivery verdict:
 *   true  → delivered: true,  reason: "delivered:queued"
 *   false → delivered: false, reason: "drop:dispatcher-rejected"
 */
export declare function createReplyDispatcherHandler(dispatcher: ReplyDispatcher): PayloadHandler;
/**
 * Returns a PayloadMiddleware that delegates to the dispatcher AND falls
 * through to the inner handler. Useful when callers want both behaviours
 * (e.g. queue AND log) at the same layer.
 *
 * Stack semantics:
 *   - Calls dispatcher first (per createReplyDispatcherHandler rules)
 *   - On dispatcher success: returns "delivered:queued" without calling
 *     `next` (the inner handler is bypassed because the payload is now
 *     in the queue)
 *   - On dispatcher rejection: passes through to `next` so the inner
 *     handler can decide what to do
 *
 * Production callers typically use createReplyDispatcherHandler instead;
 * this exists for unusual stacks.
 */
export declare function withReplyDispatcher(dispatcher: ReplyDispatcher): PayloadMiddleware;
