export interface ReservedPort { port: number; project_dir: string; service_name: string | null; assigned_at: number; } export interface ReservePortOptions { projectDir: string; serviceName?: string; } export interface ReleasePortsOptions { projectDir: string; serviceName?: string; } /** * Check if a port is actually available by attempting to bind to it */ export declare function isPortActuallyAvailable(port: number): Promise; /** * Check if a port is already reserved in the database */ export declare function isPortReserved(port: number): boolean; /** * Get the reserved port for a specific service */ export declare function getReservedPortForService(projectDir: string, serviceName: string): ReservedPort | null; /** * Get all reserved ports for a project directory */ export declare function getReservedPortsForProject(projectDir: string): ReservedPort[]; /** * Get all reserved ports */ export declare function getAllReservedPorts(): ReservedPort[]; /** * Release a specific port */ export declare function releasePort(port: number): boolean; /** * Release all ports for a project directory */ export declare function releasePortsForProject(projectDir: string): number; /** * Release the port for a specific service */ export declare function releasePortForService(projectDir: string, serviceName: string): boolean; /** * Reserve an unused port. * * This function: * 1. Gets the next port from the tracking table (or initializes at MIN_PORT) * 2. Checks if the port is already reserved in the database * 3. Verifies the port is actually available on the system * 4. If not available, keeps trying with incremented values * 5. Assigns the port in the database * 6. Returns the port number * * @param options - Configuration options for reserving a port * @returns The reserved port number */ export declare function reservePort(options: ReservePortOptions): Promise; /** * Reset for testing - clears all port reservations */ export declare function resetPortReservationsForTesting(): void; //# sourceMappingURL=index.d.ts.map