* Tell the daemon our pids right after we verify its hello, so its liveness * sweep can reap this client if our process dies without the socket ever * signalling close (the Windows named-pipe hazard behind #692). Best-effort: * sent before any piped bytes so it's always the daemon's first line fr
(socket: net.Socket, challenge?: string)
| 217 | * host pid if set, else our own parent (the host, on a no-relaunch bundle). |
| 218 | */ |
| 219 | function sendClientHello(socket: net.Socket, challenge?: string): void { |
| 220 | const clientHello: DaemonClientHello = { |
| 221 | codegraph_client: 1, |
| 222 | pid: process.pid, |
| 223 | hostPid: parseHostPpid(process.env[HOST_PPID_ENV]) ?? EARLY_PPID, |
| 224 | ...(challenge !== undefined ? { challenge } : {}), |
| 225 | }; |
| 226 | try { socket.write(JSON.stringify(clientHello) + '\n'); } catch { /* best-effort */ } |
| 227 | } |
| 228 | |
| 229 | type JsonRpc = Record<string, unknown>; |
| 230 |
no test coverage detected