@@ -19,7 +19,7 @@ import { asTempStorageURI, fromPRUri, fromReviewUri, Schemes, toPRUri } from './
1919import { formatError } from './common/utils' ;
2020import { EXTENSION_ID } from './constants' ;
2121import { ICopilotRemoteAgentCommandArgs } from './github/common' ;
22- import { ChatSessionWithPR } from './github/copilotApi' ;
22+ import { ChatSessionWithPR , CrossChatSessionWithPR } from './github/copilotApi' ;
2323import { CopilotRemoteAgentManager } from './github/copilotRemoteAgent' ;
2424import { FolderRepositoryManager } from './github/folderRepositoryManager' ;
2525import { GitHubRepository } from './github/githubRepository' ;
@@ -198,6 +198,11 @@ function isChatSessionWithPR(value: any): value is ChatSessionWithPR {
198198 return ! ! asChatSessionWithPR . pullRequest ;
199199}
200200
201+ function isCrossChatSessionWithPR ( value : any ) : value is CrossChatSessionWithPR {
202+ const asCrossChatSessionWithPR = value as Partial < CrossChatSessionWithPR > ;
203+ return ! ! asCrossChatSessionWithPR . pullRequestDetails ;
204+ }
205+
201206export function registerCommands (
202207 context : vscode . ExtensionContext ,
203208 reposManager : RepositoriesManager ,
@@ -700,6 +705,14 @@ export function registerCommands(
700705 pullRequestModel = pr ;
701706 } else if ( isChatSessionWithPR ( pr ) ) {
702707 pullRequestModel = pr . pullRequest ;
708+ } else if ( isCrossChatSessionWithPR ( pr ) ) {
709+ const resolved = await resolvePr ( {
710+ owner : pr . pullRequestDetails . repository . owner . login ,
711+ repo : pr . pullRequestDetails . repository . name ,
712+ number : pr . pullRequestDetails . number ,
713+ preventDefaultContextMenuItems : true ,
714+ } ) ;
715+ pullRequestModel = resolved ?. pr ;
703716 } else {
704717 const resolved = await resolvePr ( pr as OverviewContext ) ;
705718 pullRequestModel = resolved ?. pr ;
@@ -963,8 +976,14 @@ export function registerCommands(
963976 await openDescription ( telemetry , issueModel , descriptionNode , folderManager , revealDescription , ! ( argument instanceof RepositoryChangesNode ) ) ;
964977 }
965978
966- async function checkoutChatSessionPullRequest ( argument : ChatSessionWithPR ) {
967- const pr = argument . pullRequest ;
979+ async function checkoutChatSessionPullRequest ( argument : ChatSessionWithPR | CrossChatSessionWithPR ) {
980+ const pr = isChatSessionWithPR ( argument ) ? argument . pullRequest : await resolvePr ( {
981+ owner : argument . pullRequestDetails . repository . owner . login ,
982+ repo : argument . pullRequestDetails . repository . name ,
983+ number : argument . pullRequestDetails . number ,
984+ preventDefaultContextMenuItems : true ,
985+ } ) . then ( resolved => resolved ?. pr ) ;
986+
968987 if ( ! pr ) {
969988 Logger . warn ( `No pull request found in chat session` , logId ) ;
970989 return ;
@@ -979,8 +998,13 @@ export function registerCommands(
979998 return switchToPr ( folderManager , pr , folderManager . repository , false ) ;
980999 }
9811000
982- async function closeChatSessionPullRequest ( argument : ChatSessionWithPR ) {
983- const pr = argument . pullRequest ;
1001+ async function closeChatSessionPullRequest ( argument : ChatSessionWithPR | CrossChatSessionWithPR ) {
1002+ const pr = isChatSessionWithPR ( argument ) ? argument . pullRequest : await resolvePr ( {
1003+ owner : argument . pullRequestDetails . repository . owner . login ,
1004+ repo : argument . pullRequestDetails . repository . name ,
1005+ number : argument . pullRequestDetails . number ,
1006+ preventDefaultContextMenuItems : true ,
1007+ } ) . then ( resolved => resolved ?. pr ) ;
9841008 if ( ! pr ) {
9851009 Logger . warn ( `No pull request found in chat session` , logId ) ;
9861010 return ;
@@ -989,8 +1013,13 @@ export function registerCommands(
9891013 copilotRemoteAgentManager . refreshChatSessions ( ) ;
9901014 }
9911015
992- async function cancelCodingAgent ( argument : ChatSessionWithPR ) {
993- const pr = argument . pullRequest ;
1016+ async function cancelCodingAgent ( argument : ChatSessionWithPR | CrossChatSessionWithPR ) {
1017+ const pr = isChatSessionWithPR ( argument ) ? argument . pullRequest : await resolvePr ( {
1018+ owner : argument . pullRequestDetails . repository . owner . login ,
1019+ repo : argument . pullRequestDetails . repository . name ,
1020+ number : argument . pullRequestDetails . number ,
1021+ preventDefaultContextMenuItems : true ,
1022+ } ) . then ( resolved => resolved ?. pr ) ;
9941023 if ( ! pr ) {
9951024 Logger . warn ( `No pull request found in chat session` , logId ) ;
9961025 return ;
0 commit comments