| 232 | } |
| 233 | |
| 234 | const appendFinalPlanBlock = (plan: PlanContentBlock) => { |
| 235 | const planBlock = JSON.parse(JSON.stringify(plan)) as PlanContentBlock |
| 236 | for (let index = contentBlocks.length - 1; index >= 0; index--) { |
| 237 | const block = contentBlocks[index] |
| 238 | if (block?.type === 'plan_draft') { |
| 239 | const displayText = block.text.trim() |
| 240 | if (displayText) planBlock.displayText = displayText |
| 241 | contentBlocks[index] = planBlock |
| 242 | hasReplayContentBlocks = true |
| 243 | return |
| 244 | } |
| 245 | } |
| 246 | contentBlocks.push(planBlock) |
| 247 | hasReplayContentBlocks = true |
| 248 | } |
| 249 | |
| 250 | await runAgentStream( |
| 251 | { |