(requestId: string)
| 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 { |
no test coverage detected
searching dependent graphs…