INNER CODE UNIT · TypeScript
waitForProxy
lidge-jun/opencodex · src/cli/index.ts:254
async function waitForProxy(timeoutMs = 8_000, keepWaiting?: () => boolean): Promise<LiveProxy | null> {
// Runtime-state-first with identity: finds the proxy even when it started on a
// fallback port, and never mistakes a foreign 200 for our proxy.
return waitForLiveProxy({ find: findLiveProxy, timeoutMs, keepWaiting });
}
class StartCommandExit extends Error {
constructor(readonly exitCode: number) {
super(`start command exited with code ${exitCode}`);
this.name = "StartCommandExit";
}
}
async function chooseListenPort(
requestedPort?: number,
options: { sibling?: boolean } = {},
): Promise<number> {
const config = loadConfig();