( line: string, )
| 756 | * which case the caller treats the bytes as ordinary JSON-RPC. |
| 757 | */ |
| 758 | export function parseClientHelloLine( |
| 759 | line: string, |
| 760 | ): { pid: number; hostPid: number | null } | null { |
| 761 | let parsed: unknown; |
| 762 | try { parsed = JSON.parse(line); } catch { return null; } |
| 763 | if (!parsed || typeof parsed !== 'object') return null; |
| 764 | const o = parsed as Record<string, unknown>; |
| 765 | if (o.codegraph_client !== 1 || typeof o.pid !== 'number') return null; |
| 766 | return { pid: o.pid, hostPid: typeof o.hostPid === 'number' ? o.hostPid : null }; |
| 767 | } |
| 768 | |
| 769 | /** |
| 770 | * A client's peer is dead when its proxy process is gone, or when its known |
no outgoing calls
no test coverage detected