@@ -533,26 +533,34 @@ export function getMultiPromptProgress(
533533 }
534534}
535535
536- /** Expected shape of the set_output input from editor-multi-prompt */
537- interface MultiPromptSetOutputInput {
536+ /** Expected shape of the set_output data from editor-multi-prompt */
537+ interface MultiPromptSetOutputData {
538+ implementationId ?: string
538539 chosenStrategy ?: string
539540 reason ?: string
540541 suggestedImprovements ?: string
541542 toolResults ?: unknown [ ]
542543 error ?: string
543544}
544545
545- /** Type guard for MultiPromptSetOutputInput */
546- function isMultiPromptSetOutput ( input : unknown ) : input is MultiPromptSetOutputInput {
546+ /** Expected shape of the set_output input (data is wrapped in a 'data' property) */
547+ interface SetOutputInput {
548+ data ?: MultiPromptSetOutputData
549+ }
550+
551+ /** Type guard for set_output input with data property */
552+ function hasSetOutputData ( input : unknown ) : input is SetOutputInput {
547553 return (
548554 typeof input === 'object' &&
549555 input !== null &&
550- ( 'reason' in input || 'chosenStrategy' in input || 'error' in input )
556+ 'data' in input &&
557+ typeof ( input as SetOutputInput ) . data === 'object'
551558 )
552559}
553560
554561/**
555562 * Extract the selection reason from multi-prompt agent's set_output block.
563+ * set_output wraps data in a 'data' property, so we need to access input.data.reason
556564 */
557565function extractSelectionReason ( blocks : ContentBlock [ ] | undefined ) : string | null {
558566 if ( ! blocks || blocks . length === 0 ) return null
@@ -561,15 +569,15 @@ function extractSelectionReason(blocks: ContentBlock[] | undefined): string | nu
561569 ( block ) : block is ToolContentBlock =>
562570 block . type === 'tool' &&
563571 block . toolName === 'set_output' &&
564- isMultiPromptSetOutput ( block . input ) &&
565- typeof block . input . reason === 'string' ,
572+ hasSetOutputData ( block . input ) &&
573+ typeof block . input . data ?. reason === 'string' ,
566574 )
567575
568- if ( ! setOutputBlock || ! isMultiPromptSetOutput ( setOutputBlock . input ) ) {
576+ if ( ! setOutputBlock || ! hasSetOutputData ( setOutputBlock . input ) ) {
569577 return null
570578 }
571579
572- return setOutputBlock . input . reason ?? null
580+ return setOutputBlock . input . data ?. reason ?? null
573581}
574582
575583/**
0 commit comments