( blocks: ContentBlock[], targetId: string, )
| 390 | * Checks if a block with the given targetId exists anywhere in the children of the blocks. |
| 391 | */ |
| 392 | const findBlockInChildren = ( |
| 393 | blocks: ContentBlock[], |
| 394 | targetId: string, |
| 395 | ): boolean => { |
| 396 | for (const block of blocks) { |
| 397 | if (block.type === 'agent' && block.agentId === targetId) { |
| 398 | return true |
| 399 | } |
| 400 | if (block.type === 'agent' && block.blocks) { |
| 401 | if (findBlockInChildren(block.blocks, targetId)) { |
| 402 | return true |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | return false |
| 407 | } |
| 408 | |
| 409 | /** |
| 410 | * Checks if a block with the given agentId is already nested under the specified parent. |
no outgoing calls
no test coverage detected