MCPcopy Create free account
hub / github.com/github/copilot-sdk / getOrCreate

Function getOrCreate

nodejs/src/copilotRequestHandler.ts:341–353  ·  view source on GitHub ↗
(requestId: string)

Source from the content-addressed store, hash-verified

339 const pending = new Map<string, CopilotRequestExchange>();
340
341 function getOrCreate(requestId: string): CopilotRequestExchange {
342 // The runtime dispatches httpRequestStart and httpRequestChunk frames
343 // independently. get-or-create keeps the adapter correct regardless of
344 // arrival order: a body chunk (including the terminal end frame) that
345 // races ahead of its start frame is buffered into the same exchange
346 // rather than dropped, which would otherwise hang the body drain.
347 let exchange = pending.get(requestId);
348 if (!exchange) {
349 exchange = new CopilotRequestExchange(requestId, getServerRpc);
350 pending.set(requestId, exchange);
351 }
352 return exchange;
353 }
354
355 async function run(exchange: CopilotRequestExchange): Promise<void> {
356 try {

Callers 2

httpRequestStartFunction · 0.85
httpRequestChunkFunction · 0.85

Calls 2

getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…