import type { ITransportAdapter } from '../../engine/remoting/ITransportAdapter';
import type { IRequestReplyEnvelope } from '../../engine/remoting/IRequestReplyEnvelope';
import { isRequestReplyEnvelope } from '../../engine/remoting/IRequestReplyEnvelope';
import type { IRequestReplyResponse } from '../../engine/remoting/IRequestReplyResponse';
export type { IRequestReplyEnvelope, IRequestReplyResponse };
export { isRequestReplyEnvelope };
/**
 * Helper for Request/Reply pattern (internal RPC).
 *
 * Eliminates duplicate R/R handling code throughout MatrixActor.
 * Provides a single source of truth for request/reply semantics.
 *
 * NOTE: This uses the simplified IRequestReplyEnvelope format.
 * For cross-root federation, see MxEnvelopeV1 in packages/matrix-transport.
 */
export declare class RequestReplyHelper {
    /**
     * Check if payload is a request/reply envelope.
     * Delegates to the canonical type guard in ITransportAdapter.
     */
    static isEnvelope(payload: unknown): payload is IRequestReplyEnvelope;
    /**
     * Execute handler with automatic reply handling.
     *
     * If payload is a RequestReplyEnvelope:
     * - Extracts params from IRequestReplyEnvelope.params or MxEnvelope.payload
     * - Calls handler with params
     * - Publishes success/error to replyTo
     *
     * If payload is plain:
     * - Calls handler with payload directly
     *
     * @param transport - Transport adapter for publishing replies
     * @param payload - The incoming message payload
     * @param handler - The handler function to execute
     * @returns The handler result (or void for fire-and-forget)
     */
    static executeWithReply<T>(transport: ITransportAdapter, payload: unknown, handler: (params: unknown) => Promise<T>): Promise<T | void>;
    /**
     * Execute handler with reply, but don't rethrow errors.
     *
     * Same as executeWithReply but catches errors and returns undefined.
     * Use when the caller doesn't need to handle errors.
     */
    static executeWithReplySafe<T>(transport: ITransportAdapter, payload: unknown, handler: (params: unknown) => Promise<T>): Promise<T | void>;
    /**
     * Send a request and wait for reply.
     *
     * Creates a temporary subscription for the reply, sends the request
     * as MxEnvelope to the target's $inbox, and returns a promise that
     * resolves with the response.
     *
     * @param transport - Transport adapter for pub/sub
     * @param targetMount - The mount path of the target component
     * @param op - The command name (operation)
     * @param params - Request parameters (payload)
     * @param timeoutMs - Timeout in milliseconds (default 5000)
     * @returns Promise resolving to the result
     */
    static request<T>(transport: ITransportAdapter, targetMount: string, op: string, params?: unknown, timeoutMs?: number): Promise<T>;
    /**
     * Send a success reply for a request/reply envelope.
     *
     * @param transport - Transport adapter
     * @param envelope - The original request envelope
     * @param result - The result to send
     */
    static sendSuccessReply<T>(transport: ITransportAdapter, envelope: IRequestReplyEnvelope, result: T): void;
    /**
     * Send an error reply for a request/reply envelope.
     *
     * @param transport - Transport adapter
     * @param envelope - The original request envelope
     * @param error - The error to send
     */
    static sendErrorReply(transport: ITransportAdapter, envelope: IRequestReplyEnvelope, error: Error | string): void;
}
//# sourceMappingURL=RequestReplyHelper.d.ts.map