( line: string, )
| 941 | * which case the caller treats the bytes as ordinary JSON-RPC. |
| 942 | */ |
| 943 | export 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 |
no test coverage detected