MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / onResponseChunk

Function onResponseChunk

sdk/src/run.ts:337–362  ·  view source on GitHub ↗
(
    action: ServerAction<'response-chunk'>,
  )

Source from the content-addressed store, hash-verified

335 }
336
337 const onResponseChunk = async (
338 action: ServerAction<'response-chunk'>,
339 ): Promise<void> => {
340 if (signal?.aborted) {
341 return
342 }
343 const { chunk } = action
344
345 if (typeof chunk !== 'string') {
346 if (chunk.type === 'reasoning_delta') {
347 handleStreamChunk?.({
348 type: 'reasoning_chunk',
349 chunk: chunk.text,
350 agentId: chunk.runId,
351 ancestorRunIds: chunk.ancestorRunIds,
352 })
353 } else {
354 await handleEvent?.(chunk)
355 }
356 return
357 }
358
359 if (handleStreamChunk) {
360 await handleStreamChunk(chunk)
361 }
362 }
363 const onSubagentResponseChunk = async (
364 action: ServerAction<'subagent-response-chunk'>,
365 ) => {

Callers 1

runOnceFunction · 0.70

Calls 1

handleStreamChunkFunction · 0.50

Tested by

no test coverage detected