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

Function appendRootChunk

cli/src/utils/sdk-event-handlers.ts:121–147  ·  view source on GitHub ↗
(state: EventHandlerState, delta: TextDelta)

Source from the content-addressed store, hash-verified

119}
120
121const appendRootChunk = (state: EventHandlerState, delta: TextDelta) => {
122 if (!delta.text) {
123 return
124 }
125
126 state.message.updater.updateAiMessageBlocks((blocks) =>
127 appendTextToRootStream(blocks, delta),
128 )
129
130 if (
131 state.mode.agentMode === 'PLAN' &&
132 delta.type === 'text' &&
133 !state.streaming.streamRefs.state.planExtracted &&
134 state.streaming.streamRefs.state.rootStreamBuffer.includes('</PLAN>')
135 ) {
136 const rawPlan = extractPlanFromBuffer(
137 state.streaming.streamRefs.state.rootStreamBuffer,
138 )
139 if (rawPlan !== null) {
140 state.streaming.streamRefs.setters.setPlanExtracted(true)
141 state.mode.setHasReceivedPlanResponse(true)
142 state.message.updater.updateAiMessageBlocks((blocks) =>
143 insertPlanBlock(blocks, rawPlan),
144 )
145 }
146 }
147}
148
149const updateStreamingAgents = (
150 state: EventHandlerState,

Callers 1

createStreamChunkHandlerFunction · 0.85

Calls 3

appendTextToRootStreamFunction · 0.90
extractPlanFromBufferFunction · 0.90
insertPlanBlockFunction · 0.90

Tested by

no test coverage detected