/** * Constants and helpers for the Hivemind plugin server port allocation. * * The plugin server tries a fixed list of ports in order and uses the * first one that successfully binds. This allows multiple OpenCode * instances to coexist (each gets a unique port in the pool) without * the race condition that occurred when every instance wrote to a * single shared port file. * * Companion: `sidecar/src/lib/plugin-client.ts` (Wave 2) probes the * same port list to discover the active plugin server. * * Override precedence (highest first): * 1. `HIVEMIND_PLUGIN_PORT` — single explicit port * 2. `HIVEMIND_PLUGIN_PORT_LIST` — comma-separated list * 3. `HIVEMIND_PLUGIN_PORT_LIST` default constant * * @see /Users/apple/hivemind-plugin-private/.planning//plugin-port-pool-2026-06-07/00-landscape.md * @module sidecar/server/constants */ /** * Default port pool for the Hivemind plugin server. * * Ten consecutive ports starting at 4096. The first port that the OS * allows the server to bind to on `127.0.0.1` wins. */ export declare const HIVEMIND_PLUGIN_PORT_LIST: readonly number[]; /** * Parse the `HIVEMIND_PLUGIN_PORT_LIST` environment variable into a * list of TCP port numbers. Falls back to {@link HIVEMIND_PLUGIN_PORT_LIST} * when the variable is unset, empty, or contains no valid entries. * * @returns A list of valid TCP port numbers (1 < n < 65536). */ export declare function parsePortList(): readonly number[]; /** * Try each port in order; return the first one that successfully binds * to `127.0.0.1`. The probe server is closed before returning so the * port is free for the caller to bind. * * @param ports - Port candidates in priority order. * @param hostname - Bind hostname (default `127.0.0.1`). * @returns The first port that was free at probe time. * @throws `[Hivemind]` error when every port is taken. */ export declare function findAvailablePort(ports: readonly number[], hostname?: string): Promise; //# sourceMappingURL=constants.d.ts.map