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

Function parseClientHelloLine

src/mcp/daemon.ts:943–952  ·  view source on GitHub ↗
(
  line: string,
)

Source from the content-addressed store, hash-verified

941 * which case the caller treats the bytes as ordinary JSON-RPC.
942 */
943export function parseClientHelloLine(
944 line: string,
945): { pid: number; hostPid: number | null } | null {
946 let parsed: unknown;
947 try { parsed = JSON.parse(line); } catch { return null; }
948 if (!parsed || typeof parsed !== 'object') return null;
949 const o = parsed as Record<string, unknown>;
950 if (o.codegraph_client !== 1 || typeof o.pid !== 'number') return null;
951 return { pid: o.pid, hostPid: typeof o.hostPid === 'number' ? o.hostPid : null };
952}
953
954/**
955 * A client's peer is dead when its proxy process is gone, or when its known

Callers 2

onDataFunction · 0.85

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected