(state: EventHandlerState, delta: TextDelta)
| 119 | } |
| 120 | |
| 121 | const 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 | |
| 149 | const updateStreamingAgents = ( |
| 150 | state: EventHandlerState, |
no test coverage detected