import type { XailTransportAdapter, EnvelopeHandler } from './transport.js';
import type { TransportEnvelope } from './envelope.js';
/**
 * In-memory loopback transport for testing send/receive flows.
 *
 * LoopbackTransport enables testing Agent communication without network dependencies.
 * Messages sent through this transport are immediately delivered to all registered handlers
 * within the same process.
 *
 * **Use Cases:**
 * - Unit testing Agent send/receive functionality
 * - Integration testing multi-agent workflows (Alice → Bob)
 * - Development/debugging of Agent communication patterns
 * - CI/CD pipelines (no external dependencies)
 *
 * **Features:**
 * - Zero network latency (synchronous delivery)
 * - Message history tracking (`.sent` array)
 * - Multiple handler support (broadcast to all receivers)
 * - Clean disposal (removes all handlers)
 *
 * @example
 * ```typescript
 * import { Agent, MemoryTrustRegistry, LoopbackTransport } from '@private.me/xbind';
 *
 * const registry = new MemoryTrustRegistry();
 * const transport = new LoopbackTransport();
 *
 * // Create two agents sharing the same transport
 * const alice = await Agent.quickstart({ name: 'Alice', registry, transport });
 * const bob = await Agent.quickstart({ name: 'Bob', registry, transport });
 *
 * // Alice sends to Bob
 * await alice.send({
 *   to: bob.did,
 *   payload: { type: 'greeting', text: 'Hello Bob!' },
 *   scope: 'chat',
 * });
 *
 * // Bob receives (via transport.onReceive handler)
 * const envelope = transport.sent[0]!;
 * const msg = await bob.receive(envelope);
 * console.log(msg.value.payload); // { type: 'greeting', text: 'Hello Bob!' }
 * ```
 *
 * @see {@link https://private.me/docs/xbind.html#getting-started} - Getting Started guide
 * @see {@link Agent.quickstart} - Zero-config Agent creation
 * @see {@link MemoryTrustRegistry} - In-memory trust registry for testing
 */
export declare class LoopbackTransport implements XailTransportAdapter {
    /**
     * Array of all envelopes sent through this transport.
     * Useful for testing/debugging to inspect message history.
     */
    readonly sent: {
        envelope: TransportEnvelope;
        to: string;
    }[];
    private handlers;
    /**
     * Sends an envelope to a recipient DID.
     *
     * In LoopbackTransport, this immediately delivers the envelope to all registered
     * handlers (via `onReceive`). The envelope is also stored in the `.sent` array.
     *
     * @param envelope - The transport envelope to send
     * @param recipientDid - The DID of the recipient
     * @returns Always succeeds with `ok(undefined)`
     */
    send(envelope: TransportEnvelope, recipientDid: string): Promise<import("@private.me/shared").Result<undefined, never>>;
    /**
     * Registers a handler to be called when envelopes are received.
     *
     * Multiple handlers can be registered. All handlers will be called
     * for each envelope sent through this transport.
     *
     * @param handler - Function to call with received envelopes
     */
    onReceive(handler: EnvelopeHandler): void;
    /**
     * Cleans up the transport by removing all handlers.
     *
     * Call this method when done with the transport to prevent memory leaks
     * in long-running test suites.
     */
    dispose(): void;
}
