MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / cancelStream

Function cancelStream

packages/kosong/src/generate.ts:254–264  ·  view source on GitHub ↗
(stream: StreamedMessage)

Source from the content-addressed store, hash-verified

252}
253
254async function cancelStream(stream: StreamedMessage): Promise<void> {
255 const cancelable = stream as CancelableStream;
256
257 try {
258 await cancelable.cancel?.();
259 } catch {}
260
261 try {
262 await cancelable.return?.();
263 } catch {}
264}
265
266async function throwIfAborted(signal?: AbortSignal, stream?: StreamedMessage): Promise<void> {
267 if (!signal?.aborted) {

Callers 1

throwIfAbortedFunction · 0.85

Calls 1

cancelMethod · 0.65

Tested by

no test coverage detected