/**
 * Cross-platform TCP port discovery for child processes.
 *
 * Polls the kernel's per-process socket table until a listening TCP port
 * is found for the given PID, or until the timeout elapses.
 *
 * Platform implementations:
 *   - Linux: /proc/<pid>/net/tcp + /proc/<pid>/fd/* (no external binary)
 *   - macOS: lsof -nP -iTCP -sTCP:LISTEN -a -p <pid>
 *   - Windows: Get-NetTCPConnection PowerShell; falls back to netstat -ano
 */
export declare const PORT_DISCOVERY_TIMEOUT_MS = 15000;
export interface GetListeningPortOptions {
    timeoutMs?: number;
    pollIntervalMs?: number;
}
type PortDiscoverySpawnOptions = {
    cmd: string[];
    stdout: "pipe";
    stderr: "pipe";
};
type PortDiscoverySpawnResult = {
    stdout: {
        toString(): string;
    };
    stderr: {
        toString(): string;
    };
    success: boolean;
};
type PortDiscoverySpawnSync = (options: PortDiscoverySpawnOptions) => PortDiscoverySpawnResult;
export declare function _setPortDiscoverySpawnSyncForTest(nextSpawnSync: PortDiscoverySpawnSync): () => void;
/**
 * Discover the TCP port that a given process is listening on.
 *
 * Polls the kernel's per-process socket table at ~500ms intervals until
 * a listening port is found or the timeout elapses. Returns null on
 * timeout (caller is responsible for throwing if that's an error).
 */
export declare function getListeningPortForPid(pid: number, options?: GetListeningPortOptions): Promise<number | null>;
export declare function _readListeningPortForPid(pid: number): number | null;
export declare function _isProcessAlive(pid: number): boolean;
/**
 * Parse a single /proc/net/tcp or /proc/net/tcp6 line.
 * Returns {inode, port} for LISTEN sockets (state 0A), or null otherwise.
 */
export declare function _parseLinuxTcpLine(line: string): {
    inode: number;
    port: number;
} | null;
/** Parse /proc/net/tcp or /proc/net/tcp6 content. Returns map of inode -> port for LISTEN sockets. */
export declare function _parseLinuxTcpTable(content: string): Map<number, number>;
/** Get socket inodes owned by a PID via /proc/<pid>/fd/* symlinks. */
export declare function _getLinuxPidSocketInodes(pid: number): Set<number>;
export declare function _linuxGetListeningPort(tcpContent: string, tcp6Content: string, socketInodes: Set<number>): number | null;
export declare function _linuxGetChildren(pid: number): number[];
/**
 * Parse lsof tabular output.
 * Returns the first listening port, preferring loopback/any addresses.
 */
export declare function _parseMacosLsofOutput(output: string): number | null;
export declare function _macosReadListeningPort(pid: number, depth: number): number | null;
export declare function _macosGetChildren(pid: number): number[];
/** Parse PowerShell Get-NetTCPConnection JSON output. */
export declare function _parseWindowsPowerShellOutput(json: string): number | null;
/** Parse netstat -ano tabular output for a given PID. */
export declare function _parseWindowsNetstatOutput(output: string, pid: number): number | null;
export declare function _windowsReadListeningPort(pid: number, depth: number): number | null;
export declare function _windowsGetChildren(pid: number): number[];
export {};
//# sourceMappingURL=port-discovery.d.ts.map