2983
*/
2984
private _createAgentSession(launchPlan: CopilotSessionLaunchPlan, customizationDirectory: URI | undefined, activeClient: ActiveClient, identity?: ICopilotAgentSessionIdentity): CopilotAgentSession {
2985
>
const sessionUri = identity?.sessionUri ?? AgentSession.uri(this.id, launchPlan.sessionId);
copilotAgent.ts
2986
>
const chatChannelUri = identity?.chatChannelUri ?? URI.parse(buildDefaultChatUri(sessionUri));
2987
>
2988
>
const agentSession = this._instantiationService.createInstance(
2989
>
CopilotAgentSession,
2990
>
{
2991
>
sessionUri,
2992
>
chatChannelUri,
2993
>
rawSessionId: launchPlan.sessionId,
2994
>
onDidSessionProgress: this._onDidSessionProgress,
2995
>
sessionLauncher: this._sessionLauncher,
2996
>
launchPlan,
2997
>
shellManager: launchPlan.shellManager,
2998
>
workingDirectory: launchPlan.workingDirectory,
2999
>
customizationDirectory,
3000
>
clientSnapshot: launchPlan.snapshot,
3001
>
activeClientToolSet: launchPlan.activeClientToolSet,
3002
>
resolveMcpChildId: name => findMcpChildId(activeClient.pluginController.getCustomizations(), name),
3003
>
serverToolHost: this._serverToolHost,
3004
>
isLaunchTokenCurrent: () => this._githubToken === launchPlan.githubToken,
3005
>
},
3006
>
);
3007
>
3008
>
this._mcpNotificationSubs.set(launchPlan.sessionId, combinedDisposable(
3009
>
agentSession.onMcpNotification(n => this._onMcpNotification.fire(n)),
3010
>
autorun(r => activeClient.pluginController.mcpServerStates.set(agentSession.mcpServerStates.read(r), undefined)),
3011
>
));
3012
>
3013
>
return agentSession;
3014
>
}
3015
3016
/**