import { type Server } from "node:http";
import type { BridgeConfig } from "./config.js";
import { type ExtensionManager } from "./extensions/registry.js";
import type { Logger } from "./logger.js";
import { ModelRegistry } from "./models/registry.js";
import { type CursorProto } from "./proto.js";
import { type LocalAgentRunDecision } from "./services/agentRun.js";
export interface BridgeRuntime {
    config: BridgeConfig;
    logger: Logger;
    proto: CursorProto;
    models: ModelRegistry;
    extensions: ExtensionManager;
    pendingAgentRuns: Map<string, PendingAgentRun>;
    pendingAgentContextRuns: Map<string, PendingAgentContextRun>;
    /**
     * Tool-result mailboxes for the SSE + BidiAppend Agent Run transport (used by
     * the real cursor-agent CLI). The streaming Connect path reads ExecClientMessage
     * tool results inline from the duplex request body; over SSE the results arrive
     * on separate BidiAppend POSTs, so the SSE tool loop awaits them here, keyed by
     * the Bidi request id.
     */
    toolResultMailboxes: Map<string, ToolResultMailbox>;
    nextAgentExecId: number;
}
/**
 * A single-consumer queue of ExecClientMessage payload buffers (each a binary
 * AgentClientMessage) delivered out-of-band via BidiAppend. Exposes an
 * AsyncIterator so the shared Cursor tool loop can await tool results exactly as
 * it does on the inline duplex stream.
 */
export declare class ToolResultMailbox {
    #private;
    push(payload: Buffer): void;
    close(): void;
    iterator(): AsyncIterator<Buffer>;
}
interface PendingAgentRun {
    decision: LocalAgentRunDecision;
    createdAt: number;
}
interface PendingAgentContextRun {
    execId: string;
    id: number;
    decision: LocalAgentRunDecision;
    createdAt: number;
}
export declare function createBridgeRuntime(config: BridgeConfig, logger: Logger): Promise<BridgeRuntime>;
export declare function startServer(runtime: BridgeRuntime): Promise<Server>;
export {};
