MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / sendClientHello

Function sendClientHello

src/mcp/proxy.ts:179–186  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

177 * host pid if set, else our own parent (the host, on a no-relaunch bundle).
178 */
179function sendClientHello(socket: net.Socket): void {
180 const clientHello: DaemonClientHello = {
181 codegraph_client: 1,
182 pid: process.pid,
183 hostPid: parseHostPpid(process.env[HOST_PPID_ENV]) ?? EARLY_PPID,
184 };
185 try { socket.write(JSON.stringify(clientHello) + '\n'); } catch { /* best-effort */ }
186}
187
188type JsonRpc = Record<string, unknown>;
189

Callers 2

runProxyFunction · 0.85
connectWithHelloFunction · 0.85

Calls 2

parseHostPpidFunction · 0.70
writeMethod · 0.45

Tested by

no test coverage detected