/** * Bridge client — communicates with the x64dbg bridge plugin over TCP. * * Protocol (newline-delimited JSON): * → { id, method, params } * ← { id, success, data?, error? } * ← [Event] { event, data, sessionId, timestamp } (push from bridge) * * The bridge plugin (plugin/x64dbg_mcp_bridge.py) runs inside x64dbg via * x64dbgpy and listens on a local TCP port. * * T14 — Lifecycle events: * - 'connected-result' → connect() attempt finished (with optional Error) * - 'ready' → probe handshake passed; safe to call methods * - 'disconnected' → max reconnect attempts reached; session should terminate * - 'bridge-event' → push event from bridge (stateChange, debugEvent, etc.) */ import { EventEmitter } from "events"; import type { BridgeResponse } from "./types.js"; export declare class BridgeClient extends EventEmitter { private readonly host; private readonly port; private socket; private buffer; private pending; private connected; private connecting; private reconnectAttempts; private reconnectTimer; constructor(host?: string, port?: number); get isConnected(): boolean; get bridgePort(): number; connect(): Promise; /** * Disconnect from the bridge. Returns a Promise that resolves only after * the underlying socket emits its `close` event (or after a 500 ms safety * timeout), so callers can be certain the file descriptor is released * before the process exits. */ disconnect(): Promise; private cleanup; private scheduleReconnect; private onData; private handleResponse; private handleEvent; private doProbeHandshake; private rejectAllPending; /** * Wait for all in-flight requests to settle or until the timeout expires. * Call this before disconnect() during graceful shutdown to avoid rejecting * requests that are still being processed by the bridge. */ drain(timeoutMs?: number): Promise; request(method: string, params?: Record, timeoutMs?: number): Promise; /** * Convenience: send a request and return only the data payload, * throwing on bridge-level errors. */ call(method: string, params?: Record, timeoutMs?: number): Promise; /** * Ensure the bridge is connected. If not, try connecting once. * Throws if the connection fails. */ ensureConnected(): Promise; /** * Launch x64dbg with a target executable and connect to the bridge. * Auto-detects PE architecture (x86/x64) and spawns the correct debugger. * Waits for the bridge plugin to become available, then connects. * * @returns The detected architecture. */ launchAndConnect(targetExe: string): Promise<"x86" | "x64">; } //# sourceMappingURL=bridge.d.ts.map