@@ -65,6 +65,7 @@ export interface ICopilotCLISessionItem {
6565export type ExtendedChatRequest = ChatRequest & { prompt : string } ;
6666export type ISessionOptions = {
6767 model ?: string ;
68+ reasoningEffort ?: string ;
6869 workspace : IWorkspaceInfo ;
6970 agent ?: SweCustomAgent ;
7071 debugTargetSessionIds ?: readonly string [ ] ;
@@ -526,34 +527,33 @@ export class CopilotCLISessionService extends Disposable implements ICopilotCLIS
526527 }
527528 }
528529
529- public async createSession ( { model , workspace , agent , sessionId , debugTargetSessionIds , mcpServerMappings } : ICreateSessionOptions , token : CancellationToken ) : Promise < RefCountedSession > {
530+ public async createSession ( options : ICreateSessionOptions , token : CancellationToken ) : Promise < RefCountedSession > {
530531 const { mcpConfig : mcpServers , disposable : mcpGateway } = await this . mcpHandler . loadMcpConfig ( ) ;
531532 try {
532- const copilotUrl = this . configurationService . getConfig ( ConfigKey . Shared . DebugOverrideProxyUrl ) || undefined ;
533- const { agentName, sessionOptions } = await this . createSessionsOptions ( { model, workspace, mcpServers, agent, copilotUrl, sessionId, debugTargetSessionIds, mcpServerMappings } ) ;
533+ const sessionOptions = await this . createSessionsOptions ( { ...options , mcpServers } ) ;
534534 const sessionManager = await raceCancellationError ( this . getSessionManager ( ) , token ) ;
535- const sdkSession = await sessionManager . createSession ( { ...sessionOptions , sessionId } ) ;
535+ const sdkSession = await sessionManager . createSession ( { ...sessionOptions , sessionId : options . sessionId } ) ;
536536 this . _newSessionIds . delete ( sdkSession . sessionId ) ;
537537 // After the first session creation, the SDK's OTel TracerProvider is
538538 // initialized. Install the bridge processor so SDK-native spans flow
539539 // to the debug panel.
540540 this . _installBridgeIfNeeded ( ) ;
541541
542- if ( copilotUrl ) {
542+ if ( sessionOptions . copilotUrl ) {
543543 sdkSession . setAuthInfo ( {
544544 type : 'hmac' ,
545545 hmac : 'empty' ,
546546 host : 'https://github.com' ,
547547 copilotUser : {
548548 endpoints : {
549- api : copilotUrl
549+ api : sessionOptions . copilotUrl
550550 }
551551 }
552552 } ) ;
553553 }
554554 this . logService . trace ( `[CopilotCLISession] Created new CopilotCLI session ${ sdkSession . sessionId } .` ) ;
555555
556- const session = this . createCopilotSession ( sdkSession , workspace , agentName , sessionManager ) ;
556+ const session = this . createCopilotSession ( sdkSession , options . workspace , options . agent ?. name , sessionManager ) ;
557557 session . object . add ( mcpGateway ) ;
558558 return session ;
559559 }
@@ -638,7 +638,7 @@ export class CopilotCLISessionService extends Disposable implements ICopilotCLIS
638638 return false ;
639639 }
640640
641- protected async createSessionsOptions ( options : { model ?: string ; workspace : IWorkspaceInfo ; mcpServers ?: SessionOptions [ 'mcpServers' ] ; agent : SweCustomAgent | undefined ; copilotUrl ?: string ; sessionId ?: string ; debugTargetSessionIds ?: readonly string [ ] ; mcpServerMappings ?: McpServerMappings } ) : Promise < { readonly sessionOptions : Readonly < SessionOptions > ; readonly agentName : string | undefined } > {
641+ protected async createSessionsOptions ( options : ICreateSessionOptions & { mcpServers ?: SessionOptions [ 'mcpServers' ] } ) : Promise < Readonly < SessionOptions > > {
642642 const [ agentInfos , skillLocations ] = await Promise . all ( [
643643 this . agents . getAgents ( ) ,
644644 this . copilotCLISkills . getSkillsLocations ( ) ,
@@ -680,34 +680,35 @@ export class CopilotCLISessionService extends Disposable implements ICopilotCLIS
680680 allOptions . customAgents = customAgents ;
681681 }
682682 allOptions . enableStreaming = true ;
683- if ( options . copilotUrl ) {
684- allOptions . copilotUrl = options . copilotUrl ;
683+ const copilotUrl = this . configurationService . getConfig ( ConfigKey . Shared . DebugOverrideProxyUrl ) || undefined ;
684+ if ( copilotUrl ) {
685+ allOptions . copilotUrl = copilotUrl ;
685686 }
686687 if ( systemMessage ) {
687688 allOptions . systemMessage = systemMessage ;
688689 }
689690 allOptions . sessionCapabilities = new Set ( [ 'plan-mode' , 'memory' , 'cli-documentation' , 'ask-user' , 'interactive-mode' , 'system-notifications' ] ) ;
691+ if ( options . reasoningEffort ) {
692+ allOptions . reasoningEffort = options . reasoningEffort ;
693+ }
690694
691- return {
692- sessionOptions : allOptions as Readonly < SessionOptions > ,
693- agentName : options . agent ?. name ,
694- } ;
695+ return allOptions as Readonly < SessionOptions > ;
695696 }
696697
697- public async getSession ( { sessionId , model , workspace , agent , debugTargetSessionIds , mcpServerMappings } : IGetSessionOptions , token : CancellationToken ) : Promise < RefCountedSession | undefined > {
698+ public async getSession ( options : IGetSessionOptions , token : CancellationToken ) : Promise < RefCountedSession | undefined > {
698699 // https://github.com/microsoft/vscode/issues/276573
699- const lock = this . sessionMutexForGetSession . get ( sessionId ) ?? new Mutex ( ) ;
700- this . sessionMutexForGetSession . set ( sessionId , lock ) ;
700+ const lock = this . sessionMutexForGetSession . get ( options . sessionId ) ?? new Mutex ( ) ;
701+ this . sessionMutexForGetSession . set ( options . sessionId , lock ) ;
701702 const lockDisposable = await lock . acquire ( token ) ;
702703 try {
703704 {
704- const session = this . _sessionWrappers . get ( sessionId ) ;
705+ const session = this . _sessionWrappers . get ( options . sessionId ) ;
705706 if ( session ) {
706- this . logService . trace ( `[CopilotCLISession] Reusing CopilotCLI session ${ sessionId } .` ) ;
707- this . _partialSessionHistories . delete ( sessionId ) ;
707+ this . logService . trace ( `[CopilotCLISession] Reusing CopilotCLI session ${ options . sessionId } .` ) ;
708+ this . _partialSessionHistories . delete ( options . sessionId ) ;
708709 session . acquire ( ) ;
709- if ( agent ) {
710- await session . object . sdkSession . selectCustomAgent ( agent . name ) ;
710+ if ( options . agent ) {
711+ await session . object . sdkSession . selectCustomAgent ( options . agent . name ) ;
711712 } else {
712713 session . object . sdkSession . clearCustomAgent ( ) ;
713714 }
@@ -720,16 +721,15 @@ export class CopilotCLISessionService extends Disposable implements ICopilotCLIS
720721 this . mcpHandler . loadMcpConfig ( ) ,
721722 ] ) ;
722723 try {
723- const copilotUrl = this . configurationService . getConfig ( ConfigKey . Shared . DebugOverrideProxyUrl ) || undefined ;
724- const { agentName, sessionOptions } = await this . createSessionsOptions ( { model, agent, workspace : workspace , mcpServers, copilotUrl, sessionId, debugTargetSessionIds, mcpServerMappings } ) ;
724+ const sessionOptions = await this . createSessionsOptions ( { ...options , mcpServers } ) ;
725725
726- const sdkSession = await sessionManager . getSession ( { ...sessionOptions , sessionId } , true ) ;
726+ const sdkSession = await sessionManager . getSession ( { ...sessionOptions , sessionId : options . sessionId } , true ) ;
727727 if ( ! sdkSession ) {
728- this . logService . error ( `[CopilotCLISession] CopilotCLI failed to get session ${ sessionId } .` ) ;
728+ this . logService . error ( `[CopilotCLISession] CopilotCLI failed to get session ${ options . sessionId } .` ) ;
729729 return undefined ;
730730 }
731731
732- const session = this . createCopilotSession ( sdkSession , workspace , agentName , sessionManager ) ;
732+ const session = this . createCopilotSession ( sdkSession , options . workspace , options . agent ?. name , sessionManager ) ;
733733 session . object . add ( mcpGateway ) ;
734734 return session ;
735735 }
@@ -875,12 +875,11 @@ export class CopilotCLISessionService extends Disposable implements ICopilotCLIS
875875 const newSessionId = generateUuid ( ) ;
876876 this . _sessionsBeingCreatedViaFork . add ( newSessionId ) ;
877877 try {
878- const copilotUrl = this . configurationService . getConfig ( ConfigKey . Shared . DebugOverrideProxyUrl ) || undefined ;
879- const [ sessionManager , title , { history, events : originalSessionEvents } , { sessionOptions } ] = await Promise . all ( [
878+ const [ sessionManager , title , { history, events : originalSessionEvents } , sessionOptions ] = await Promise . all ( [
880879 raceCancellationError ( this . getSessionManager ( ) , token ) ,
881880 this . getSessionTitle ( sessionId , token ) ,
882881 requestId ? this . getChatHistoryImpl ( { sessionId, workspace } , token ) : Promise . resolve ( { history : [ ] , events : [ ] } ) ,
883- this . createSessionsOptions ( { workspace, mcpServers : undefined , copilotUrl , agent : undefined , sessionId : newSessionId } ) ,
882+ this . createSessionsOptions ( { workspace, mcpServers : undefined , agent : undefined , sessionId : newSessionId } ) ,
884883 copySessionFilesForForking ( sessionId , newSessionId , workspace , this . _chatSessionMetadataStore , token ) ,
885884 ] ) ;
886885
0 commit comments