( blocks: ContentBlock[] | undefined, )
| 648 | * Returns counts of implementor agents and current phase. |
| 649 | */ |
| 650 | export function getMultiPromptProgress( |
| 651 | blocks: ContentBlock[] | undefined, |
| 652 | ): MultiPromptProgress | null { |
| 653 | if (!blocks || blocks.length === 0) return null |
| 654 | |
| 655 | const implementors = blocks.filter( |
| 656 | (block): block is AgentContentBlock => |
| 657 | block.type === 'agent' && isImplementorAgent(block), |
| 658 | ) |
| 659 | |
| 660 | if (implementors.length === 0) return null |
| 661 | |
| 662 | const completed = implementors.filter((a) => a.status === 'complete').length |
| 663 | const failed = implementors.filter( |
| 664 | (a) => a.status === 'failed' || a.status === 'cancelled', |
| 665 | ).length |
| 666 | |
| 667 | const selectorAgent = blocks.find( |
| 668 | (block): block is AgentContentBlock => |
| 669 | block.type === 'agent' && block.agentType.includes('best-of-n-selector'), |
| 670 | ) |
| 671 | const isSelecting = selectorAgent?.status === 'running' |
| 672 | |
| 673 | return { |
| 674 | total: implementors.length, |
| 675 | completed, |
| 676 | failed, |
| 677 | isSelecting, |
| 678 | isSelectorComplete: selectorAgent?.status === 'complete', |
| 679 | } |
| 680 | } |
| 681 | |
| 682 | /** Expected shape of the set_output data from editor-multi-prompt */ |
| 683 | interface MultiPromptSetOutputData { |
no test coverage detected