/**
 * LocalTransport — In-process SQLite transport for fully offline agent messaging.
 *
 * Reads and writes messages directly to signaldock.db via node:sqlite.
 * No network calls. Works fully offline. Messages are stored in the
 * same schema that the Rust signaldock-storage crate manages, so both
 * the local CLI and the cloud backend see the same data.
 *
 * Priority: LocalTransport is preferred over HttpTransport when
 * signaldock.db is available (see factory.ts).
 *
 * @see docs/specs/SIGNALDOCK-UNIFIED-AGENT-REGISTRY.md Section 4.4
 * @task T213
 */
import type { ConduitMessage, Transport, TransportConnectConfig } from '@cleocode/contracts';
/** In-process SQLite transport for fully offline agent messaging. */
export declare class LocalTransport implements Transport {
    readonly name = "local";
    private state;
    /**
     * Connect to signaldock.db for in-process messaging.
     *
     * Opens the database, sets WAL mode pragmas, and verifies
     * the messages table exists. Throws if signaldock.db is missing
     * or uninitialized (run `cleo init` first).
     */
    connect(config: TransportConnectConfig): Promise<void>;
    /** Close the database connection and stop any subscriber polling. */
    disconnect(): Promise<void>;
    /**
     * Store a message in signaldock.db.
     *
     * Inserts into the messages table with status 'pending'.
     * For conversation messages, also links via conversation_participants
     * if not already present.
     */
    push(to: string, content: string, options?: {
        conversationId?: string;
        replyTo?: string;
    }): Promise<{
        messageId: string;
    }>;
    /**
     * Poll for messages addressed to this agent.
     *
     * Returns messages with status 'pending' where to_agent_id matches
     * the connected agent. Messages are returned oldest-first.
     */
    poll(options?: {
        limit?: number;
        since?: string;
    }): Promise<ConduitMessage[]>;
    /**
     * Acknowledge messages by marking them as 'delivered'.
     *
     * Updates the status and delivered_at timestamp for each message ID.
     */
    ack(messageIds: string[]): Promise<void>;
    /**
     * Subscribe to real-time local messages.
     *
     * Since this is in-process, subscribers are notified synchronously
     * when push() is called. Additionally, a polling interval checks
     * for messages inserted by other processes (e.g., Rust CLI).
     *
     * @returns Unsubscribe function.
     */
    subscribe(handler: (message: ConduitMessage) => void): () => void;
    /**
     * Check whether signaldock.db is available for local transport.
     *
     * Used by factory.ts to decide whether to use LocalTransport.
     */
    static isAvailable(cwd?: string): boolean;
    /** Poll for new messages and notify subscribers (cross-process sync). */
    private pollAndNotify;
    /** Notify all active subscribers of a new message. */
    private notifySubscribers;
    /**
     * Ensure a DM conversation exists between two agents.
     *
     * Conversations store participants as a comma-separated TEXT field.
     * We search for existing private conversations containing both agents.
     *
     * @returns The conversation ID.
     */
    private ensureDmConversation;
    /** Throw if not connected. */
    private ensureConnected;
}
//# sourceMappingURL=local-transport.d.ts.map