( blocks: ContentBlock[], )
| 232 | * text block or adding a new one. |
| 233 | */ |
| 234 | export const appendInterruptionNotice = ( |
| 235 | blocks: ContentBlock[], |
| 236 | ): ContentBlock[] => { |
| 237 | const lastBlock = blocks[blocks.length - 1] |
| 238 | |
| 239 | if (lastBlock && lastBlock.type === 'text') { |
| 240 | const interruptedBlock: ContentBlock = { |
| 241 | ...lastBlock, |
| 242 | content: `${lastBlock.content}\n\n[response interrupted]`, |
| 243 | } |
| 244 | return [...blocks.slice(0, -1), interruptedBlock] |
| 245 | } |
| 246 | |
| 247 | const interruptionNotice: ContentBlock = { |
| 248 | type: 'text', |
| 249 | content: '[response interrupted]', |
| 250 | } |
| 251 | return [...blocks, interruptionNotice] |
| 252 | } |
| 253 | |
| 254 | /** |
| 255 | * Recursively finds an agent block by ID and returns its agent type. |
no outgoing calls
no test coverage detected