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