2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { isEqual } from '../../../../base/common/resources.js';
7
>
import { URI } from '../../../../base/common/uri.js';
8
>
import { McpServerStatus } from '../../../../platform/agentHost/common/state/protocol/state.js';
9
>
import { isAgentHostTarget } from '../../chat/common/chatSessionsService.js';
10
>
import { getChatSessionType } from '../../chat/common/model/chatUri.js';
11
>
12
>
export interface IMcpEditorAgentHostServer {
13
>
readonly name: string;
14
>
readonly enabled: boolean;
15
>
readonly status: McpServerStatus;
16
>
}
17
>
18
>
export interface IMcpEditorAgentHostSessionServers {
19
>
readonly resource: URI;
20
>
readonly servers: readonly IMcpEditorAgentHostServer[];
21
>
}
22
>
23
>
export function getActiveAgentHostMcpSessionResource(sessionResource: URI | undefined): URI | undefined {
24
return sessionResource && isAgentHostTarget(getChatSessionType(sessionResource))
25
? sessionResource
26
: undefined;
27
}
29
>
export function countRunningMcpServersInOtherSessions(currentSession: URI, sessions: readonly IMcpEditorAgentHostSessionServers[]): Map<string, number> {
30
const counts = new Map<string, number>();
31
for (const session of sessions) {