(response: JsonRpcLiteResponse)
| 450 | } |
| 451 | |
| 452 | private handleResponse(response: JsonRpcLiteResponse): void { |
| 453 | if (response.id === null || response.id === undefined) { |
| 454 | logger.debug('[CodexAppServer] Received response without id'); |
| 455 | return; |
| 456 | } |
| 457 | |
| 458 | if (typeof response.id !== 'number') { |
| 459 | logger.debug('[CodexAppServer] Received response with non-numeric id', response.id); |
| 460 | return; |
| 461 | } |
| 462 | |
| 463 | const pending = this.pending.get(response.id); |
| 464 | if (!pending) { |
| 465 | logger.debug('[CodexAppServer] Received response with no pending request', response.id); |
| 466 | return; |
| 467 | } |
| 468 | |
| 469 | this.pending.delete(response.id); |
| 470 | |
| 471 | if (response.error) { |
| 472 | pending.reject(new Error(response.error.message)); |
| 473 | return; |
| 474 | } |
| 475 | |
| 476 | pending.resolve(response.result); |
| 477 | } |
| 478 | |
| 479 | private writePayload(payload: JsonRpcLiteRequest | JsonRpcLiteNotification | JsonRpcLiteResponse): void { |
| 480 | const serialized = JSON.stringify(payload); |
no test coverage detected