MCPcopy Create free account
hub / github.com/tiann/hapi / handleResponse

Method handleResponse

cli/src/codex/codexAppServerClient.ts:452–477  ·  view source on GitHub ↗
(response: JsonRpcLiteResponse)

Source from the content-addressed store, hash-verified

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);

Callers 1

handleLineMethod · 0.95

Calls 4

debugMethod · 0.80
getMethod · 0.80
rejectMethod · 0.80
resolveMethod · 0.80

Tested by

no test coverage detected