@@ -28,7 +28,7 @@ import { toChatHistoryContent } from '../../common/chatModel.js';
28
28
import { IChatMode , IChatModeService } from '../../common/chatModes.js' ;
29
29
import { chatVariableLeader } from '../../common/chatParserTypes.js' ;
30
30
import { ChatRequestParser } from '../../common/chatRequestParser.js' ;
31
- import { IChatService } from '../../common/chatService.js' ;
31
+ import { IChatPullRequestContent , IChatService } from '../../common/chatService.js' ;
32
32
import { ChatAgentLocation , ChatConfiguration , ChatModeKind , } from '../../common/constants.js' ;
33
33
import { ILanguageModelChatMetadata } from '../../common/languageModels.js' ;
34
34
import { ILanguageModelToolsService } from '../../common/languageModelToolsService.js' ;
@@ -658,31 +658,36 @@ export class CreateRemoteAgentJobAction extends Action2 {
658
658
} ) ;
659
659
660
660
// Execute the remote command
661
- const resultMarkdown : string | undefined = await commandService . executeCommand ( agent . command , {
661
+ const result : Omit < IChatPullRequestContent , 'kind' > | string | undefined = await commandService . executeCommand ( agent . command , {
662
662
userPrompt,
663
663
summary : summary || userPrompt ,
664
664
followup,
665
+ _version : 2 , // Signal that we support the new response format
665
666
} ) ;
666
667
667
- let content = new MarkdownString (
668
- resultMarkdown ,
669
- CreateRemoteAgentJobAction . markdownStringTrustedOptions
670
- ) ;
671
- if ( ! resultMarkdown ) {
672
- content = new MarkdownString (
673
- localize ( 'remoteAgentError' , "Coding agent session cancelled." ) ,
674
- CreateRemoteAgentJobAction . markdownStringTrustedOptions
675
- ) ;
668
+ if ( result && typeof result === 'object' ) { /* _version === 2 */
669
+ chatModel . acceptResponseProgress ( addedRequest , { kind : 'pullRequest' , ...result } ) ;
670
+ } else if ( typeof result === 'string' ) {
671
+ chatModel . acceptResponseProgress ( addedRequest , {
672
+ kind : 'markdownContent' ,
673
+ content : new MarkdownString (
674
+ localize ( 'remoteAgentResponse' , "Coding agent response: {0}" , result ) ,
675
+ CreateRemoteAgentJobAction . markdownStringTrustedOptions
676
+ )
677
+ } ) ;
678
+ // Extension will open up the pull request in another view
679
+ widget . clear ( ) ;
680
+ } else {
681
+ chatModel . acceptResponseProgress ( addedRequest , {
682
+ kind : 'markdownContent' ,
683
+ content : new MarkdownString (
684
+ localize ( 'remoteAgentError' , "Coding agent session cancelled." ) ,
685
+ CreateRemoteAgentJobAction . markdownStringTrustedOptions
686
+ )
687
+ } ) ;
676
688
}
677
-
678
- chatModel . acceptResponseProgress ( addedRequest , { content, kind : 'markdownContent' } ) ;
679
689
chatModel . setResponse ( addedRequest , { } ) ;
680
690
chatModel . completeResponse ( addedRequest ) ;
681
-
682
- // Clear chat (start a new chat)
683
- if ( resultMarkdown ) {
684
- widget . clear ( ) ;
685
- }
686
691
} finally {
687
692
remoteJobCreatingKey . set ( false ) ;
688
693
}
0 commit comments