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

Function destinationFromChunkEvent

cli/src/utils/stream-chunk-processor.ts:19–38  ·  view source on GitHub ↗
(
  event: StreamChunkEvent,
)

Source from the content-addressed store, hash-verified

17}
18
19export const destinationFromChunkEvent = (
20 event: StreamChunkEvent,
21): ChunkDestination | null => {
22 if (typeof event === 'string') {
23 return { type: 'root', textType: 'text' }
24 }
25
26 if (event.type === 'subagent_chunk') {
27 return { type: 'agent', agentId: event.agentId, textType: 'text' }
28 }
29
30 if (event.type === 'reasoning_chunk') {
31 if (event.ancestorRunIds.length === 0) {
32 return { type: 'root', textType: 'reasoning' }
33 }
34 return { type: 'agent', agentId: event.agentId, textType: 'reasoning' }
35 }
36
37 return null
38}
39
40export const processTextChunk = (
41 blocks: ContentBlock[],

Callers 1

createStreamChunkHandlerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected