(requestLine: string | undefined, response: JsonRpc)
| 302 | // local just as MCPSession does when the shared daemon is available. |
| 303 | const indexVersionWarnings = new IndexVersionWarningState(); |
| 304 | const recordDaemonWarning = (requestLine: string | undefined, response: JsonRpc): void => { |
| 305 | if (!requestLine) return; |
| 306 | const result = response.result as { content?: Array<{ type?: unknown; text?: unknown }> } | undefined; |
| 307 | const first = result?.content?.[0]; |
| 308 | if (first?.type !== 'text' || typeof first.text !== 'string') return; |
| 309 | if (!first.text.startsWith(INDEX_VERSION_WARNING_PREFIX)) return; |
| 310 | |
| 311 | let request: JsonRpc; |
| 312 | try { request = JSON.parse(requestLine) as JsonRpc; } catch { return; } |
| 313 | const params = request.params as { |
| 314 | arguments?: { projectPath?: unknown }; |
| 315 | } | undefined; |
| 316 | const requestedPath = params?.arguments?.projectPath; |
| 317 | let root = deps.root; |
| 318 | if (typeof requestedPath === 'string') { |
| 319 | const resolved = findNearestCodeGraphRoot(requestedPath); |
| 320 | if (!resolved) return; |
| 321 | root = resolved; |
| 322 | } |
| 323 | indexVersionWarnings.claim(root); |
| 324 | }; |
| 325 | const trackInflight = (line: string): void => { |
| 326 | try { |
| 327 | const m = JSON.parse(line) as JsonRpc; |
no test coverage detected