From aedbb88a8025851067be9f77ec406b29d65599a8 Mon Sep 17 00:00:00 2001 From: amankumarsingh77 Date: Tue, 28 Jul 2026 21:47:21 +0530 Subject: refactor: delete exports and knobs that nothing calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit isInternalUrl, SPECIAL_KEYS, andThen and mapErr had no callers in src or test. BrowserState.remoteBrowserId was parsed on restore and never written — the field that is actually read lives on DaemonStatus. IpcServer.disconnectClient and IpcServer.clients() were unreachable, as was EventRouter.allClients and a write-only lineCount counter. DAEMON_STALE_SOCKET_CLEANUP was a hardcoded true with an if around it, so the unlink now runs unconditionally. CdpBridge.isAlive and getSessionOwner look equally dead from src/ alone, but test/manual/bridge-test.ts drives both — they are the only seams that suite has, so they stay. Co-Authored-By: Claude Opus 5 (1M context) --- src/daemon/server.ts | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'src/daemon/server.ts') diff --git a/src/daemon/server.ts b/src/daemon/server.ts index 7c78372..142bddb 100644 --- a/src/daemon/server.ts +++ b/src/daemon/server.ts @@ -7,7 +7,6 @@ import { isWireMessage, DAEMON_SOCKET_PATH, DAEMON_MAX_CLIENTS, - DAEMON_STALE_SOCKET_CLEANUP, } from "./protocol"; export type ClientSocket = { @@ -29,8 +28,6 @@ export type IpcServer = { onDisconnect(handler: ConnectionHandler): void; send(clientId: string, msg: WireMessage): void; broadcast(msg: WireMessage): void; - disconnectClient(clientId: string): void; - clients(): ReadonlyMap; clientCount(): number; }; @@ -45,11 +42,9 @@ export const createIpcServer = (): IpcServer => { const start = (): Promise => new Promise((resolve, reject) => { - if (DAEMON_STALE_SOCKET_CLEANUP) { - try { - unlinkSync(DAEMON_SOCKET_PATH); - } catch {} - } + try { + unlinkSync(DAEMON_SOCKET_PATH); + } catch {} server = createServer({ pauseOnConnect: false }, (socket: Socket) => { if (clients.size >= DAEMON_MAX_CLIENTS) { @@ -63,10 +58,7 @@ export const createIpcServer = (): IpcServer => { sockets.set(tempId, currentClient); - let lineCount = 0; - rl.on("line", (line: string) => { - lineCount++; let msg: WireMessage | null; try { const parsed: unknown = JSON.parse(line); @@ -178,12 +170,6 @@ export const createIpcServer = (): IpcServer => { this.send(clientId, msg); } }, - disconnectClient(clientId) { - const client = clients.get(clientId); - if (!client) return; - client.socket.destroy(); - }, - clients: (): ReadonlyMap => clients, clientCount: (): number => clients.size, }; }; -- cgit v1.2.3