MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / getMultiPromptProgress

Function getMultiPromptProgress

cli/src/utils/implementor-helpers.ts:650–680  ·  view source on GitHub ↗
(
  blocks: ContentBlock[] | undefined,
)

Source from the content-addressed store, hash-verified

648 * Returns counts of implementor agents and current phase.
649 */
650export 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 */
683interface MultiPromptSetOutputData {

Callers 2

getMultiPromptPreviewFunction · 0.85

Calls 1

isImplementorAgentFunction · 0.85

Tested by

no test coverage detected