import type { SymiConfig } from "../../config/config.js";
import { type PayloadMiddleware } from "./payload-middleware.js";
export interface WithChannelRoutingOptions {
    /** Originating channel from the inbound message context. */
    originatingChannel?: string;
    /** Originating recipient (the inbound message's `To` field). */
    originatingTo?: string;
    /** Surface this dispatch is currently running on (e.g. "telegram"). */
    currentSurface?: string;
    sessionKey?: string;
    accountId?: string;
    threadId?: string | number;
    cfg: SymiConfig;
    /**
     * Optional notification when route-reply fails. Production logs
     * via `logVerbose`; this lets callers wire their own logger.
     */
    onRouteFailed?: (info: {
        kind: string;
        error: string;
    }) => void;
}
/** Compute `shouldRouteToOriginating` exactly as the chain does. */
export declare function shouldRouteToOriginating(opts: {
    originatingChannel?: string;
    originatingTo?: string;
    currentSurface?: string;
}): boolean;
/**
 * Returns a PayloadMiddleware that routes payloads to the originating
 * channel when applicable. Otherwise falls through to the inner handler.
 *
 * When routing fires:
 *   - call routeReply(...)
 *   - on success: return PayloadDelivery.deliver(payload, "delivered:routed")
 *   - on failure: fire onRouteFailed, return PayloadDelivery.drop(payload, "drop:route-failed")
 *
 * When routing does NOT apply: pass through to next(payload, ctx).
 *
 * The middleware respects `ctx.abortSignal` — if aborted before the
 * route call, it drops with "drop:aborted-before-route".
 */
export declare function withChannelRouting(opts: WithChannelRoutingOptions): PayloadMiddleware;
