@codingame/monaco-vscode-authentication-service-override 37.2.0 → 37.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageAccountPreferencesForExtensionAction.js +18 -18
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageAccountPreferencesForMcpServerAction.js +14 -14
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageAccountsAction.js +9 -9
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageDynamicAuthenticationProvidersAction.js +12 -12
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageTrustedExtensionsForAccountAction.js +20 -20
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageTrustedMcpServersForAccountAction.js +24 -22
- package/vscode/src/vs/workbench/contrib/authentication/browser/actions/signOutOfAccountAction.js +6 -6
- package/vscode/src/vs/workbench/contrib/authentication/browser/authentication.contribution.js +4 -4
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.js +13 -18
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationQueryService.js +19 -19
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationUsageService.js +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-authentication-service-override",
|
|
3
|
-
"version": "37.
|
|
3
|
+
"version": "37.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - authentication service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "37.
|
|
18
|
+
"@codingame/monaco-vscode-api": "37.3.0"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"module": "index.js",
|
|
@@ -16,8 +16,8 @@ class ManageAccountPreferencesForExtensionAction extends Action2 {
|
|
|
16
16
|
constructor() {
|
|
17
17
|
super({
|
|
18
18
|
id: "_manageAccountPreferencesForExtension",
|
|
19
|
-
title: ( localize2(
|
|
20
|
-
category: ( localize2(
|
|
19
|
+
title: ( localize2(7248, "Manage Extension Account Preferences...")),
|
|
20
|
+
category: ( localize2(7249, "Accounts")),
|
|
21
21
|
f1: true,
|
|
22
22
|
menu: [{
|
|
23
23
|
id: MenuId.AccountsContext,
|
|
@@ -52,12 +52,12 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
52
52
|
).sort(
|
|
53
53
|
(a, b) => (a.displayName ?? a.name).localeCompare((b.displayName ?? b.name))
|
|
54
54
|
);
|
|
55
|
-
const result = await this._quickInputService.pick(
|
|
55
|
+
const result = await this._quickInputService.pick(extensions.map(ext => ({
|
|
56
56
|
label: ext.displayName ?? ext.name,
|
|
57
57
|
id: ext.identifier.value
|
|
58
|
-
}))
|
|
59
|
-
placeHolder: ( localize(
|
|
60
|
-
title: ( localize(
|
|
58
|
+
})), {
|
|
59
|
+
placeHolder: ( localize(7250, "Select an extension to manage account preferences for")),
|
|
60
|
+
title: ( localize(7251, "Manage Extension Account Preferences"))
|
|
61
61
|
});
|
|
62
62
|
extensionId = result?.id;
|
|
63
63
|
}
|
|
@@ -72,20 +72,20 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
72
72
|
const extensionQuery = this._authenticationQueryService.extension(extensionId);
|
|
73
73
|
const providersWithAccess = await extensionQuery.getProvidersWithAccess();
|
|
74
74
|
if (!providersWithAccess.length) {
|
|
75
|
-
await this._dialogService.info(( localize(
|
|
75
|
+
await this._dialogService.info(( localize(7252, "This extension has not used any accounts yet.")));
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
providerId = providersWithAccess[0];
|
|
79
79
|
if (providersWithAccess.length > 1) {
|
|
80
|
-
const result = await this._quickInputService.pick(
|
|
80
|
+
const result = await this._quickInputService.pick(providersWithAccess.map(providerId => ({
|
|
81
81
|
label: this._authenticationService.getProvider(providerId).label,
|
|
82
82
|
id: providerId
|
|
83
|
-
}))
|
|
83
|
+
})), {
|
|
84
84
|
placeHolder: ( localize(
|
|
85
|
-
|
|
85
|
+
7253,
|
|
86
86
|
"Select an authentication provider to manage account preferences for"
|
|
87
87
|
)),
|
|
88
|
-
title: ( localize(
|
|
88
|
+
title: ( localize(7251, "Manage Extension Account Preferences"))
|
|
89
89
|
});
|
|
90
90
|
if (!result) {
|
|
91
91
|
return;
|
|
@@ -108,7 +108,7 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
108
108
|
items.push({
|
|
109
109
|
providerId,
|
|
110
110
|
scopes: lastUsedScopes,
|
|
111
|
-
label: ( localize(
|
|
111
|
+
label: ( localize(7254, "Use a new account..."))
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -134,12 +134,12 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
134
134
|
disposableStore.dispose();
|
|
135
135
|
}));
|
|
136
136
|
picker.placeholder = ( localize(
|
|
137
|
-
|
|
137
|
+
7255,
|
|
138
138
|
"Manage '{0}' account preferences for {1}...",
|
|
139
139
|
extensionLabel,
|
|
140
140
|
providerLabel
|
|
141
141
|
));
|
|
142
|
-
picker.title = ( localize(
|
|
142
|
+
picker.title = ( localize(7256, "'{0}' Account Preferences For This Workspace", extensionLabel));
|
|
143
143
|
picker.sortByLabel = false;
|
|
144
144
|
disposableStore.add(picker.onDidAccept(async () => {
|
|
145
145
|
picker.hide();
|
|
@@ -148,20 +148,20 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
|
|
|
148
148
|
return picker;
|
|
149
149
|
}
|
|
150
150
|
_getItems(accounts, providerId, currentAccountNamePreference) {
|
|
151
|
-
return
|
|
151
|
+
return accounts.map(a => currentAccountNamePreference === a.label ? {
|
|
152
152
|
label: a.label,
|
|
153
153
|
account: a,
|
|
154
154
|
providerId,
|
|
155
|
-
description: ( localize(
|
|
155
|
+
description: ( localize(7257, "Current account")),
|
|
156
156
|
picked: true
|
|
157
157
|
} : {
|
|
158
158
|
label: a.label,
|
|
159
159
|
account: a,
|
|
160
160
|
providerId
|
|
161
|
-
})
|
|
161
|
+
});
|
|
162
162
|
}
|
|
163
163
|
_handleNoAccounts(picker) {
|
|
164
|
-
picker.validationMessage = ( localize(
|
|
164
|
+
picker.validationMessage = ( localize(7258, "No accounts are currently used by this extension."));
|
|
165
165
|
picker.buttons = [this._quickInputService.backButton];
|
|
166
166
|
picker.show();
|
|
167
167
|
return Event.filter(picker.onDidTriggerButton, e => e === this._quickInputService.backButton)(() => this.run());
|
|
@@ -16,8 +16,8 @@ class ManageAccountPreferencesForMcpServerAction extends Action2 {
|
|
|
16
16
|
constructor() {
|
|
17
17
|
super({
|
|
18
18
|
id: "_manageAccountPreferencesForMcpServer",
|
|
19
|
-
title: ( localize2(
|
|
20
|
-
category: ( localize2(
|
|
19
|
+
title: ( localize2(7259, "Manage MCP Server Account Preferences")),
|
|
20
|
+
category: ( localize2(7260, "Accounts")),
|
|
21
21
|
f1: false
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -53,20 +53,20 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
53
53
|
const mcpServerQuery = this._authenticationQueryService.mcpServer(mcpServerId);
|
|
54
54
|
const providersWithAccess = await mcpServerQuery.getProvidersWithAccess();
|
|
55
55
|
if (!providersWithAccess.length) {
|
|
56
|
-
await this._dialogService.info(( localize(
|
|
56
|
+
await this._dialogService.info(( localize(7261, "This MCP server has not used any accounts yet.")));
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
providerId = providersWithAccess[0];
|
|
60
60
|
if (providersWithAccess.length > 1) {
|
|
61
|
-
const result = await this._quickInputService.pick(
|
|
61
|
+
const result = await this._quickInputService.pick(providersWithAccess.map(providerId => ({
|
|
62
62
|
label: this._authenticationService.getProvider(providerId).label,
|
|
63
63
|
id: providerId
|
|
64
|
-
}))
|
|
64
|
+
})), {
|
|
65
65
|
placeHolder: ( localize(
|
|
66
|
-
|
|
66
|
+
7262,
|
|
67
67
|
"Select an authentication provider to manage account preferences for"
|
|
68
68
|
)),
|
|
69
|
-
title: ( localize(
|
|
69
|
+
title: ( localize(7263, "Manage MCP Server Account Preferences"))
|
|
70
70
|
});
|
|
71
71
|
if (!result) {
|
|
72
72
|
return;
|
|
@@ -89,7 +89,7 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
89
89
|
items.push({
|
|
90
90
|
providerId: providerId,
|
|
91
91
|
scopes: lastUsedScopes,
|
|
92
|
-
label: ( localize(
|
|
92
|
+
label: ( localize(7264, "Use a new account..."))
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -110,12 +110,12 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
110
110
|
disposableStore.dispose();
|
|
111
111
|
}));
|
|
112
112
|
picker.placeholder = ( localize(
|
|
113
|
-
|
|
113
|
+
7265,
|
|
114
114
|
"Manage '{0}' account preferences for {1}...",
|
|
115
115
|
mcpServerLabel,
|
|
116
116
|
providerLabel
|
|
117
117
|
));
|
|
118
|
-
picker.title = ( localize(
|
|
118
|
+
picker.title = ( localize(7266, "'{0}' Account Preferences For This Workspace", mcpServerLabel));
|
|
119
119
|
picker.sortByLabel = false;
|
|
120
120
|
disposableStore.add(picker.onDidAccept(async () => {
|
|
121
121
|
picker.hide();
|
|
@@ -124,20 +124,20 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
|
|
|
124
124
|
return picker;
|
|
125
125
|
}
|
|
126
126
|
_getItems(accounts, providerId, currentAccountNamePreference) {
|
|
127
|
-
return
|
|
127
|
+
return accounts.map(a => currentAccountNamePreference === a.label ? {
|
|
128
128
|
label: a.label,
|
|
129
129
|
account: a,
|
|
130
130
|
providerId,
|
|
131
|
-
description: ( localize(
|
|
131
|
+
description: ( localize(7267, "Current account")),
|
|
132
132
|
picked: true
|
|
133
133
|
} : {
|
|
134
134
|
label: a.label,
|
|
135
135
|
account: a,
|
|
136
136
|
providerId
|
|
137
|
-
})
|
|
137
|
+
});
|
|
138
138
|
}
|
|
139
139
|
_handleNoAccounts(picker) {
|
|
140
|
-
picker.validationMessage = ( localize(
|
|
140
|
+
picker.validationMessage = ( localize(7268, "No accounts are currently used by this MCP server."));
|
|
141
141
|
picker.buttons = [this._quickInputService.backButton];
|
|
142
142
|
picker.show();
|
|
143
143
|
return Event.filter(picker.onDidTriggerButton, e => e === this._quickInputService.backButton)(() => this.run());
|
package/vscode/src/vs/workbench/contrib/authentication/browser/actions/manageAccountsAction.js
CHANGED
|
@@ -16,8 +16,8 @@ class ManageAccountsAction extends Action2 {
|
|
|
16
16
|
constructor() {
|
|
17
17
|
super({
|
|
18
18
|
id: "workbench.action.manageAccounts",
|
|
19
|
-
title: ( localize2(
|
|
20
|
-
category: ( localize2(
|
|
19
|
+
title: ( localize2(7269, "Manage Accounts")),
|
|
20
|
+
category: ( localize2(7270, "Accounts")),
|
|
21
21
|
f1: true
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -41,11 +41,11 @@ let ManageAccountsActionImpl = class ManageAccountsActionImpl {
|
|
|
41
41
|
this.productService = productService;
|
|
42
42
|
}
|
|
43
43
|
async run() {
|
|
44
|
-
const placeHolder = ( localize(
|
|
44
|
+
const placeHolder = ( localize(7271, "Select an account to manage"));
|
|
45
45
|
const accounts = await this.listAccounts();
|
|
46
46
|
if (!accounts.length) {
|
|
47
47
|
await this.quickInputService.pick([{
|
|
48
|
-
label: ( localize(
|
|
48
|
+
label: ( localize(7272, "There are no active accounts."))
|
|
49
49
|
}], {
|
|
50
50
|
placeHolder
|
|
51
51
|
});
|
|
@@ -98,11 +98,11 @@ let ManageAccountsActionImpl = class ManageAccountsActionImpl {
|
|
|
98
98
|
} = account;
|
|
99
99
|
const store = ( new DisposableStore());
|
|
100
100
|
const quickPick = store.add(this.quickInputService.createQuickPick());
|
|
101
|
-
quickPick.title = ( localize(
|
|
102
|
-
quickPick.placeholder = ( localize(
|
|
101
|
+
quickPick.title = ( localize(7273, "Manage '{0}'", accountLabel));
|
|
102
|
+
quickPick.placeholder = ( localize(7274, "Select an action"));
|
|
103
103
|
quickPick.buttons = [this.quickInputService.backButton];
|
|
104
104
|
const items = [{
|
|
105
|
-
label: ( localize(
|
|
105
|
+
label: ( localize(7275, "Manage Trusted Extensions")),
|
|
106
106
|
action: () => this.commandService.executeCommand("_manageTrustedExtensionsForAccount", {
|
|
107
107
|
providerId,
|
|
108
108
|
accountLabel
|
|
@@ -110,7 +110,7 @@ let ManageAccountsActionImpl = class ManageAccountsActionImpl {
|
|
|
110
110
|
}];
|
|
111
111
|
if (canUseMcp) {
|
|
112
112
|
items.push({
|
|
113
|
-
label: ( localize(
|
|
113
|
+
label: ( localize(7276, "Manage Trusted MCP Servers")),
|
|
114
114
|
action: () => this.commandService.executeCommand("_manageTrustedMCPServersForAccount", {
|
|
115
115
|
providerId,
|
|
116
116
|
accountLabel
|
|
@@ -119,7 +119,7 @@ let ManageAccountsActionImpl = class ManageAccountsActionImpl {
|
|
|
119
119
|
}
|
|
120
120
|
if (await canSignOut()) {
|
|
121
121
|
items.push({
|
|
122
|
-
label: ( localize(
|
|
122
|
+
label: ( localize(7277, "Sign Out")),
|
|
123
123
|
action: () => this.commandService.executeCommand("_signOutOfAccount", {
|
|
124
124
|
providerId,
|
|
125
125
|
accountLabel
|
|
@@ -13,8 +13,8 @@ class RemoveDynamicAuthenticationProvidersAction extends Action2 {
|
|
|
13
13
|
constructor() {
|
|
14
14
|
super({
|
|
15
15
|
id: RemoveDynamicAuthenticationProvidersAction.ID,
|
|
16
|
-
title: ( localize2(
|
|
17
|
-
category: ( localize2(
|
|
16
|
+
title: ( localize2(7278, "Remove Dynamic Authentication Providers")),
|
|
17
|
+
category: ( localize2(7279, "Authentication")),
|
|
18
18
|
f1: true
|
|
19
19
|
});
|
|
20
20
|
}
|
|
@@ -25,28 +25,28 @@ class RemoveDynamicAuthenticationProvidersAction extends Action2 {
|
|
|
25
25
|
const dialogService = accessor.get(IDialogService);
|
|
26
26
|
const interactedProviders = dynamicAuthStorageService.getInteractedProviders();
|
|
27
27
|
if (interactedProviders.length === 0) {
|
|
28
|
-
await dialogService.info(( localize(
|
|
28
|
+
await dialogService.info(( localize(7280, "No dynamic authentication providers")), ( localize(7281, "No dynamic authentication providers have been used yet.")));
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
const items =
|
|
31
|
+
const items = interactedProviders.map(provider => ({
|
|
32
32
|
label: provider.label,
|
|
33
|
-
description: ( localize(
|
|
33
|
+
description: ( localize(7282, "Client ID: {0}", provider.clientId)),
|
|
34
34
|
provider
|
|
35
|
-
}))
|
|
35
|
+
}));
|
|
36
36
|
const selected = await quickInputService.pick(items, {
|
|
37
|
-
placeHolder: ( localize(
|
|
37
|
+
placeHolder: ( localize(7283, "Select a dynamic authentication provider to remove")),
|
|
38
38
|
canPickMany: true
|
|
39
39
|
});
|
|
40
40
|
if (!selected || selected.length === 0) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
const providerNames =
|
|
43
|
+
const providerNames = selected.map(item => item.provider.label).join(", ");
|
|
44
44
|
const message = selected.length === 1 ? ( localize(
|
|
45
|
-
|
|
45
|
+
7284,
|
|
46
46
|
"Are you sure you want to remove the dynamic authentication provider \"{0}\"?",
|
|
47
47
|
providerNames
|
|
48
48
|
)) : ( localize(
|
|
49
|
-
|
|
49
|
+
7285,
|
|
50
50
|
"Are you sure you want to remove {0} dynamic authentication providers: {1}?",
|
|
51
51
|
selected.length,
|
|
52
52
|
providerNames
|
|
@@ -54,10 +54,10 @@ class RemoveDynamicAuthenticationProvidersAction extends Action2 {
|
|
|
54
54
|
const result = await dialogService.confirm({
|
|
55
55
|
message,
|
|
56
56
|
detail: ( localize(
|
|
57
|
-
|
|
57
|
+
7286,
|
|
58
58
|
"This will remove all stored authentication data for the selected provider(s). You will need to re-authenticate if you use these providers again."
|
|
59
59
|
)),
|
|
60
|
-
primaryButton: ( localize(
|
|
60
|
+
primaryButton: ( localize(7287, "Remove")),
|
|
61
61
|
type: "warning"
|
|
62
62
|
});
|
|
63
63
|
if (!result.confirmed) {
|
|
@@ -19,8 +19,8 @@ class ManageTrustedExtensionsForAccountAction extends Action2 {
|
|
|
19
19
|
constructor() {
|
|
20
20
|
super({
|
|
21
21
|
id: "_manageTrustedExtensionsForAccount",
|
|
22
|
-
title: ( localize2(
|
|
23
|
-
category: ( localize2(
|
|
22
|
+
title: ( localize2(7288, "Manage Trusted Extensions For Account")),
|
|
23
|
+
category: ( localize2(7289, "Accounts")),
|
|
24
24
|
f1: true
|
|
25
25
|
});
|
|
26
26
|
}
|
|
@@ -47,11 +47,11 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
47
47
|
this._commandService = _commandService;
|
|
48
48
|
this._extensionsWorkbenchService = _extensionsWorkbenchService;
|
|
49
49
|
this._viewDetailsButton = {
|
|
50
|
-
tooltip: ( localize(
|
|
50
|
+
tooltip: ( localize(7290, "View extension details")),
|
|
51
51
|
iconClass: ThemeIcon.asClassName(Codicon.info)
|
|
52
52
|
};
|
|
53
53
|
this._managePreferencesButton = {
|
|
54
|
-
tooltip: ( localize(
|
|
54
|
+
tooltip: ( localize(7291, "Manage account preferences for this extension")),
|
|
55
55
|
iconClass: ThemeIcon.asClassName(Codicon.settingsGear)
|
|
56
56
|
};
|
|
57
57
|
}
|
|
@@ -75,7 +75,7 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
75
75
|
}
|
|
76
76
|
const accounts = await this._getAllAvailableAccounts();
|
|
77
77
|
const pick = await this._quickInputService.pick(accounts, {
|
|
78
|
-
placeHolder: ( localize(
|
|
78
|
+
placeHolder: ( localize(7292, "Pick an account to manage trusted extensions for")),
|
|
79
79
|
matchOnDescription: true
|
|
80
80
|
});
|
|
81
81
|
return pick ? this._authenticationQueryService.provider(pick.providerId).account(pick.label) : undefined;
|
|
@@ -102,41 +102,41 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
102
102
|
async _getItems(accountQuery) {
|
|
103
103
|
const allowedExtensions = accountQuery.extensions().getAllowedExtensions();
|
|
104
104
|
const extensionIdToDisplayName = ( new Map());
|
|
105
|
-
const resolvedExtensions = await Promise.all(
|
|
105
|
+
const resolvedExtensions = await Promise.all(allowedExtensions.map(ext => this._extensionService.getExtension(ext.id)));
|
|
106
106
|
resolvedExtensions.forEach((resolved, i) => {
|
|
107
107
|
if (resolved) {
|
|
108
108
|
extensionIdToDisplayName.set(allowedExtensions[i].id, resolved.displayName || resolved.name);
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
|
-
const filteredExtensions =
|
|
111
|
+
const filteredExtensions = allowedExtensions.filter(ext => ( extensionIdToDisplayName.has(ext.id))).map(ext => {
|
|
112
112
|
const usage = accountQuery.extension(ext.id).getUsage();
|
|
113
113
|
return {
|
|
114
114
|
...ext,
|
|
115
115
|
name: extensionIdToDisplayName.get(ext.id),
|
|
116
|
-
lastUsed: usage.length > 0 ? Math.max(...
|
|
116
|
+
lastUsed: usage.length > 0 ? Math.max(...usage.map(u => u.lastUsed)) : ext.lastUsed
|
|
117
117
|
};
|
|
118
|
-
})
|
|
118
|
+
});
|
|
119
119
|
if (!filteredExtensions.length) {
|
|
120
|
-
this._dialogService.info(( localize(
|
|
120
|
+
this._dialogService.info(( localize(7293, "This account has not been used by any extensions.")));
|
|
121
121
|
return [];
|
|
122
122
|
}
|
|
123
123
|
const trustedExtensions = filteredExtensions.filter(e => e.trusted);
|
|
124
124
|
const otherExtensions = filteredExtensions.filter(e => !e.trusted);
|
|
125
125
|
const sortByLastUsed = (a, b) => (b.lastUsed || 0) - (a.lastUsed || 0);
|
|
126
126
|
const _toQuickPickItem = this._toQuickPickItem.bind(this);
|
|
127
|
-
return [...
|
|
127
|
+
return [...otherExtensions.sort(sortByLastUsed).map(_toQuickPickItem), {
|
|
128
128
|
type: "separator",
|
|
129
|
-
label: ( localize(
|
|
130
|
-
}, ...
|
|
129
|
+
label: ( localize(7294, "Trusted by Microsoft"))
|
|
130
|
+
}, ...trustedExtensions.sort(sortByLastUsed).map(_toQuickPickItem)];
|
|
131
131
|
}
|
|
132
132
|
_toQuickPickItem(extension) {
|
|
133
133
|
const lastUsed = extension.lastUsed;
|
|
134
|
-
const description = lastUsed ? ( localize(
|
|
134
|
+
const description = lastUsed ? ( localize(7295, "Last used this account {0}", fromNow(lastUsed, true))) : ( localize(7296, "Has not used this account"));
|
|
135
135
|
let tooltip;
|
|
136
136
|
let disabled;
|
|
137
137
|
if (extension.trusted) {
|
|
138
138
|
tooltip = ( localize(
|
|
139
|
-
|
|
139
|
+
7297,
|
|
140
140
|
"This extension is trusted by Microsoft and\nalways has access to this account"
|
|
141
141
|
));
|
|
142
142
|
disabled = true;
|
|
@@ -158,13 +158,13 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
|
|
|
158
158
|
}));
|
|
159
159
|
quickPick.canSelectMany = true;
|
|
160
160
|
quickPick.customButton = true;
|
|
161
|
-
quickPick.customLabel = ( localize(
|
|
161
|
+
quickPick.customLabel = ( localize(7298, "Cancel"));
|
|
162
162
|
quickPick.customButtonSecondary = true;
|
|
163
|
-
quickPick.title = ( localize(
|
|
164
|
-
quickPick.placeholder = ( localize(
|
|
163
|
+
quickPick.title = ( localize(7299, "Manage Trusted Extensions"));
|
|
164
|
+
quickPick.placeholder = ( localize(7300, "Choose which extensions can access this account"));
|
|
165
165
|
disposableStore.add(quickPick.onDidAccept(() => {
|
|
166
|
-
const updatedAllowedList =
|
|
167
|
-
const allowedExtensionsSet = ( new Set(
|
|
166
|
+
const updatedAllowedList = quickPick.items.filter(item => item.type !== "separator").map(i => i.extension);
|
|
167
|
+
const allowedExtensionsSet = ( new Set(quickPick.selectedItems.map(i => i.extension)));
|
|
168
168
|
for (const extension of updatedAllowedList) {
|
|
169
169
|
const allowed = ( allowedExtensionsSet.has(extension));
|
|
170
170
|
accountQuery.extension(extension.id).setAccessAllowed(allowed, extension.name);
|
|
@@ -20,8 +20,8 @@ class ManageTrustedMcpServersForAccountAction extends Action2 {
|
|
|
20
20
|
constructor() {
|
|
21
21
|
super({
|
|
22
22
|
id: "_manageTrustedMCPServersForAccount",
|
|
23
|
-
title: ( localize2(
|
|
24
|
-
category: ( localize2(
|
|
23
|
+
title: ( localize2(7301, "Manage Trusted MCP Servers For Account")),
|
|
24
|
+
category: ( localize2(7302, "Accounts")),
|
|
25
25
|
f1: true,
|
|
26
26
|
precondition: ( ContextKeyExpr.and(( ChatContextKeys.Setup.hidden.negate()), ( ChatContextKeys.Setup.disabledInWorkspace.negate())))
|
|
27
27
|
});
|
|
@@ -67,7 +67,7 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
67
67
|
}
|
|
68
68
|
const accounts = await this._getAllAvailableAccounts();
|
|
69
69
|
const pick = await this._quickInputService.pick(accounts, {
|
|
70
|
-
placeHolder: ( localize(
|
|
70
|
+
placeHolder: ( localize(7303, "Pick an account to manage trusted MCP servers for")),
|
|
71
71
|
matchOnDescription: true
|
|
72
72
|
});
|
|
73
73
|
return pick ? this._authenticationQueryService.provider(pick.providerId).account(pick.label) : undefined;
|
|
@@ -93,27 +93,29 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
93
93
|
}
|
|
94
94
|
async _getItems(accountQuery) {
|
|
95
95
|
const allowedMcpServers = accountQuery.mcpServers().getAllowedMcpServers();
|
|
96
|
-
const serverIdToLabel = ( new Map(
|
|
96
|
+
const serverIdToLabel = ( new Map(
|
|
97
|
+
this._mcpServerService.servers.get().map(s => [s.definition.id, s.definition.label])
|
|
98
|
+
));
|
|
97
99
|
const withLastUsed = server => {
|
|
98
100
|
const usage = accountQuery.mcpServer(server.id).getUsage();
|
|
99
101
|
return {
|
|
100
102
|
...server,
|
|
101
|
-
lastUsed: usage.length > 0 ? Math.max(...
|
|
103
|
+
lastUsed: usage.length > 0 ? Math.max(...usage.map(u => u.lastUsed)) : server.lastUsed
|
|
102
104
|
};
|
|
103
105
|
};
|
|
104
|
-
const agentHostServers =
|
|
105
|
-
const workbenchServers =
|
|
106
|
+
const agentHostServers = allowedMcpServers.filter(server => !!server.agentHost).map(withLastUsed);
|
|
107
|
+
const workbenchServers = allowedMcpServers.filter(server => !server.agentHost && ( serverIdToLabel.has(server.id))).map(server => withLastUsed({
|
|
106
108
|
...server,
|
|
107
109
|
name: serverIdToLabel.get(server.id)
|
|
108
|
-
}))
|
|
110
|
+
}));
|
|
109
111
|
if (!agentHostServers.length && !workbenchServers.length) {
|
|
110
|
-
this._dialogService.info(( localize(
|
|
112
|
+
this._dialogService.info(( localize(7304, "This account has not been used by any MCP servers.")));
|
|
111
113
|
return [];
|
|
112
114
|
}
|
|
113
115
|
const trustedServers = workbenchServers.filter(s => s.trusted);
|
|
114
116
|
const otherServers = workbenchServers.filter(s => !s.trusted);
|
|
115
117
|
const sortByLastUsed = (a, b) => (b.lastUsed || 0) - (a.lastUsed || 0);
|
|
116
|
-
const items = [...
|
|
118
|
+
const items = [...otherServers.sort(sortByLastUsed).map(this._toQuickPickItem)];
|
|
117
119
|
const byAuthority = ( new Map());
|
|
118
120
|
for (const server of agentHostServers) {
|
|
119
121
|
const group = byAuthority.get(server.agentHost.authority) ?? {
|
|
@@ -130,25 +132,25 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
130
132
|
} of sortedGroups) {
|
|
131
133
|
items.push({
|
|
132
134
|
type: "separator",
|
|
133
|
-
label: ( localize(
|
|
135
|
+
label: ( localize(7305, "MCP Servers in {0}", label))
|
|
134
136
|
});
|
|
135
|
-
items.push(...
|
|
137
|
+
items.push(...servers.sort(sortByLastUsed).map(this._toQuickPickItem));
|
|
136
138
|
}
|
|
137
139
|
items.push({
|
|
138
140
|
type: "separator",
|
|
139
|
-
label: ( localize(
|
|
141
|
+
label: ( localize(7306, "Trusted by Microsoft"))
|
|
140
142
|
});
|
|
141
|
-
items.push(...
|
|
143
|
+
items.push(...trustedServers.sort(sortByLastUsed).map(this._toQuickPickItem));
|
|
142
144
|
return items;
|
|
143
145
|
}
|
|
144
146
|
_toQuickPickItem(mcpServer) {
|
|
145
147
|
const lastUsed = mcpServer.lastUsed;
|
|
146
|
-
const description = lastUsed ? ( localize(
|
|
148
|
+
const description = lastUsed ? ( localize(7307, "Last used this account {0}", fromNow(lastUsed, true))) : ( localize(7308, "Has not used this account"));
|
|
147
149
|
let tooltip;
|
|
148
150
|
let disabled;
|
|
149
151
|
if (mcpServer.trusted) {
|
|
150
152
|
tooltip = ( localize(
|
|
151
|
-
|
|
153
|
+
7309,
|
|
152
154
|
"This MCP server is trusted by Microsoft and\nalways has access to this account"
|
|
153
155
|
));
|
|
154
156
|
disabled = true;
|
|
@@ -160,7 +162,7 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
160
162
|
tooltip,
|
|
161
163
|
disabled,
|
|
162
164
|
buttons: [{
|
|
163
|
-
tooltip: ( localize(
|
|
165
|
+
tooltip: ( localize(7310, "Manage account preferences for this MCP server")),
|
|
164
166
|
iconClass: ThemeIcon.asClassName(Codicon.settingsGear)
|
|
165
167
|
}],
|
|
166
168
|
picked: mcpServer.allowed === undefined || mcpServer.allowed
|
|
@@ -173,14 +175,14 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
|
|
|
173
175
|
}));
|
|
174
176
|
quickPick.canSelectMany = true;
|
|
175
177
|
quickPick.customButton = true;
|
|
176
|
-
quickPick.customLabel = ( localize(
|
|
178
|
+
quickPick.customLabel = ( localize(7311, "Cancel"));
|
|
177
179
|
quickPick.customButtonSecondary = true;
|
|
178
|
-
quickPick.title = ( localize(
|
|
179
|
-
quickPick.placeholder = ( localize(
|
|
180
|
+
quickPick.title = ( localize(7312, "Manage Trusted MCP Servers"));
|
|
181
|
+
quickPick.placeholder = ( localize(7313, "Choose which MCP servers can access this account"));
|
|
180
182
|
disposableStore.add(quickPick.onDidAccept(() => {
|
|
181
183
|
quickPick.hide();
|
|
182
|
-
const allServers =
|
|
183
|
-
const selectedServers = ( new Set(
|
|
184
|
+
const allServers = quickPick.items.filter(item => item.type !== "separator").map(i => i.mcpServer);
|
|
185
|
+
const selectedServers = ( new Set(quickPick.selectedItems.map(i => i.mcpServer)));
|
|
184
186
|
for (const mcpServer of allServers) {
|
|
185
187
|
const isAllowed = ( selectedServers.has(mcpServer));
|
|
186
188
|
accountQuery.mcpServer(mcpServer.id).setAccessAllowed(isAllowed, mcpServer.name);
|
package/vscode/src/vs/workbench/contrib/authentication/browser/actions/signOutOfAccountAction.js
CHANGED
|
@@ -11,7 +11,7 @@ class SignOutOfAccountAction extends Action2 {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super({
|
|
13
13
|
id: "_signOutOfAccount",
|
|
14
|
-
title: ( localize(
|
|
14
|
+
title: ( localize(7314, "Sign out of account")),
|
|
15
15
|
f1: false
|
|
16
16
|
});
|
|
17
17
|
}
|
|
@@ -39,15 +39,15 @@ class SignOutOfAccountAction extends Action2 {
|
|
|
39
39
|
} = await dialogService.confirm({
|
|
40
40
|
type: Severity.Info,
|
|
41
41
|
message: accountUsages.length ? ( localize(
|
|
42
|
-
|
|
42
|
+
7315,
|
|
43
43
|
"The account '{0}' has been used by: \n\n{1}\n\n Sign out from these extensions?",
|
|
44
44
|
accountLabel,
|
|
45
|
-
|
|
46
|
-
)) : ( localize(
|
|
47
|
-
primaryButton: ( localize(
|
|
45
|
+
accountUsages.map(usage => usage.extensionName).join("\n")
|
|
46
|
+
)) : ( localize(7316, "Sign out of '{0}'?", accountLabel)),
|
|
47
|
+
primaryButton: ( localize(7317, "&&Sign Out"))
|
|
48
48
|
});
|
|
49
49
|
if (confirmed) {
|
|
50
|
-
const removeSessionPromises =
|
|
50
|
+
const removeSessionPromises = sessions.map(session => authenticationService.removeSession(providerId, session.id));
|
|
51
51
|
await Promise.all(removeSessionPromises);
|
|
52
52
|
authenticationUsageService.removeAccountUsage(providerId, accountLabel);
|
|
53
53
|
authenticationAccessService.removeAllowedExtensions(providerId, accountLabel);
|
package/vscode/src/vs/workbench/contrib/authentication/browser/authentication.contribution.js
CHANGED
|
@@ -41,10 +41,10 @@ class AuthenticationDataRenderer extends Disposable {
|
|
|
41
41
|
dispose: () => {}
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
const headers = [( localize(
|
|
45
|
-
const rows =
|
|
44
|
+
const headers = [( localize(7318, "Label")), ( localize(7319, "ID")), ( localize(7320, "MCP Authorization Servers"))];
|
|
45
|
+
const rows = authentication.sort((a, b) => a.label.localeCompare(b.label)).map(auth => {
|
|
46
46
|
return [auth.label, auth.id, (auth.authorizationServerGlobs ?? []).join(",\n")];
|
|
47
|
-
})
|
|
47
|
+
});
|
|
48
48
|
return {
|
|
49
49
|
data: {
|
|
50
50
|
headers,
|
|
@@ -56,7 +56,7 @@ class AuthenticationDataRenderer extends Disposable {
|
|
|
56
56
|
}
|
|
57
57
|
const extensionFeature = ( Registry.as(Extensions.ExtensionFeaturesRegistry)).registerExtensionFeature({
|
|
58
58
|
id: "authentication",
|
|
59
|
-
label: ( localize(
|
|
59
|
+
label: ( localize(7321, "Authentication")),
|
|
60
60
|
access: {
|
|
61
61
|
canToggle: false
|
|
62
62
|
},
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.js
CHANGED
|
@@ -6,7 +6,7 @@ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
|
6
6
|
import { MenuRegistry, MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
7
7
|
import { CommandsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands';
|
|
8
8
|
import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
9
|
-
import
|
|
9
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
|
|
10
10
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification';
|
|
11
11
|
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
12
12
|
import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
@@ -16,7 +16,7 @@ import { IActivityService } from '@codingame/monaco-vscode-api/vscode/vs/workben
|
|
|
16
16
|
import { IAuthenticationAccessService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationAccessService.service';
|
|
17
17
|
import { IAuthenticationUsageService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationUsageService.service';
|
|
18
18
|
import { isAuthenticationWwwAuthenticateRequest } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication';
|
|
19
|
-
import { IAuthenticationService
|
|
19
|
+
import { IAuthenticationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service';
|
|
20
20
|
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
21
21
|
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
22
22
|
import { ExtensionIdentifier } from '@codingame/monaco-vscode-api/vscode/vs/platform/extensions/common/extensions';
|
|
@@ -121,7 +121,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
121
121
|
numberOfRequests += ( Object.keys(accessRequest)).length;
|
|
122
122
|
});
|
|
123
123
|
if (numberOfRequests > 0) {
|
|
124
|
-
const badge = ( new NumberBadge(numberOfRequests, () => ( localize(
|
|
124
|
+
const badge = ( new NumberBadge(numberOfRequests, () => ( localize(21556, "Sign in requested"))));
|
|
125
125
|
this._accountBadgeDisposable.value = this.activityService.showAccountsActivity({
|
|
126
126
|
badge
|
|
127
127
|
});
|
|
@@ -201,17 +201,17 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
201
201
|
} = await this.dialogService.prompt({
|
|
202
202
|
type: Severity.Info,
|
|
203
203
|
message: ( localize(
|
|
204
|
-
|
|
204
|
+
21557,
|
|
205
205
|
"The extension '{0}' wants to access the {1} account '{2}'.",
|
|
206
206
|
extensionName,
|
|
207
207
|
provider.label,
|
|
208
208
|
accountName
|
|
209
209
|
)),
|
|
210
210
|
buttons: [{
|
|
211
|
-
label: ( localize(
|
|
211
|
+
label: ( localize(21558, "&&Allow")),
|
|
212
212
|
run: () => SessionPromptChoice.Allow
|
|
213
213
|
}, {
|
|
214
|
-
label: ( localize(
|
|
214
|
+
label: ( localize(21559, "&&Deny")),
|
|
215
215
|
run: () => SessionPromptChoice.Deny
|
|
216
216
|
}],
|
|
217
217
|
cancelButton: {
|
|
@@ -243,13 +243,13 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
243
243
|
const quickPick = disposables.add(this.quickInputService.createQuickPick());
|
|
244
244
|
quickPick.ignoreFocusOut = true;
|
|
245
245
|
const accountsWithSessions = ( new Set());
|
|
246
|
-
const items =
|
|
246
|
+
const items =
|
|
247
247
|
availableSessions.filter(session => !( accountsWithSessions.has(session.account.label)) && accountsWithSessions.add(session.account.label)).map(session => {
|
|
248
248
|
return {
|
|
249
249
|
label: session.account.label,
|
|
250
250
|
session: session
|
|
251
251
|
};
|
|
252
|
-
})
|
|
252
|
+
});
|
|
253
253
|
allAccounts.forEach(account => {
|
|
254
254
|
if (!( accountsWithSessions.has(account.label))) {
|
|
255
255
|
items.push({
|
|
@@ -259,17 +259,17 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
259
259
|
}
|
|
260
260
|
});
|
|
261
261
|
items.push({
|
|
262
|
-
label: ( localize(
|
|
262
|
+
label: ( localize(21560, "Sign in to another account"))
|
|
263
263
|
});
|
|
264
264
|
quickPick.items = items;
|
|
265
265
|
quickPick.title = ( localize(
|
|
266
|
-
|
|
266
|
+
21561,
|
|
267
267
|
"The extension '{0}' wants to access a {1} account",
|
|
268
268
|
extensionName,
|
|
269
269
|
this._authenticationService.getProvider(providerId).label
|
|
270
270
|
));
|
|
271
271
|
quickPick.placeholder = ( localize(
|
|
272
|
-
|
|
272
|
+
21562,
|
|
273
273
|
"Select an account for '{0}' to use or Esc to cancel",
|
|
274
274
|
extensionName
|
|
275
275
|
));
|
|
@@ -361,7 +361,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
361
361
|
group: "3_accessRequests",
|
|
362
362
|
command: {
|
|
363
363
|
id: `${providerId}${extensionId}Access`,
|
|
364
|
-
title: ( localize(
|
|
364
|
+
title: ( localize(21563, "Grant access to {0} for {1}... (1)", provider.label, extensionName))
|
|
365
365
|
}
|
|
366
366
|
}));
|
|
367
367
|
const accessCommand = CommandsRegistry.registerCommand({
|
|
@@ -405,7 +405,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
405
405
|
group: "2_signInRequests",
|
|
406
406
|
command: {
|
|
407
407
|
id: commandId,
|
|
408
|
-
title: ( localize(
|
|
408
|
+
title: ( localize(21564, "Sign in with {0} to use {1} (1)", provider.label, extensionName))
|
|
409
409
|
}
|
|
410
410
|
}));
|
|
411
411
|
const signInCommand = CommandsRegistry.registerCommand({
|
|
@@ -443,10 +443,5 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
443
443
|
}
|
|
444
444
|
};
|
|
445
445
|
AuthenticationExtensionsService = ( __decorate([( __param(0, IActivityService)), ( __param(1, IStorageService)), ( __param(2, IDialogService)), ( __param(3, IQuickInputService)), ( __param(4, IProductService)), ( __param(5, IAuthenticationService)), ( __param(6, IAuthenticationUsageService)), ( __param(7, IAuthenticationAccessService))], AuthenticationExtensionsService));
|
|
446
|
-
( registerSingleton(
|
|
447
|
-
IAuthenticationExtensionsService,
|
|
448
|
-
AuthenticationExtensionsService,
|
|
449
|
-
InstantiationType.Delayed
|
|
450
|
-
));
|
|
451
446
|
|
|
452
447
|
export { AuthenticationExtensionsService };
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationQueryService.js
CHANGED
|
@@ -41,12 +41,12 @@ class AccountExtensionQuery extends BaseQuery {
|
|
|
41
41
|
}
|
|
42
42
|
getUsage() {
|
|
43
43
|
const allUsages = this.queryService.authenticationUsageService.readAccountUsages(this.providerId, this.accountName);
|
|
44
|
-
return
|
|
44
|
+
return allUsages.filter(usage => usage.extensionId === ExtensionIdentifier.toKey(this.extensionId)).map(usage => ({
|
|
45
45
|
extensionId: usage.extensionId,
|
|
46
46
|
extensionName: usage.extensionName,
|
|
47
47
|
scopes: usage.scopes || [],
|
|
48
48
|
lastUsed: usage.lastUsed
|
|
49
|
-
}))
|
|
49
|
+
}));
|
|
50
50
|
}
|
|
51
51
|
removeUsage() {
|
|
52
52
|
const allUsages = this.queryService.authenticationUsageService.readAccountUsages(this.providerId, this.accountName);
|
|
@@ -99,12 +99,12 @@ class AccountMcpServerQuery extends BaseQuery {
|
|
|
99
99
|
}
|
|
100
100
|
getUsage() {
|
|
101
101
|
const allUsages = this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId, this.accountName);
|
|
102
|
-
return
|
|
102
|
+
return allUsages.filter(usage => usage.mcpServerId === this.mcpServerId).map(usage => ({
|
|
103
103
|
mcpServerId: usage.mcpServerId,
|
|
104
104
|
mcpServerName: usage.mcpServerName,
|
|
105
105
|
scopes: usage.scopes || [],
|
|
106
106
|
lastUsed: usage.lastUsed
|
|
107
|
-
}))
|
|
107
|
+
}));
|
|
108
108
|
}
|
|
109
109
|
removeUsage() {
|
|
110
110
|
const allUsages = this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId, this.accountName);
|
|
@@ -144,9 +144,9 @@ class AccountExtensionsQuery extends BaseQuery {
|
|
|
144
144
|
getAllowedExtensions() {
|
|
145
145
|
const allowedExtensions = this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId, this.accountName);
|
|
146
146
|
const usages = this.queryService.authenticationUsageService.readAccountUsages(this.providerId, this.accountName);
|
|
147
|
-
return
|
|
147
|
+
return allowedExtensions.filter(ext => ext.allowed !== false).map(ext => {
|
|
148
148
|
const extensionUsages = usages.filter(usage => usage.extensionId === ext.id);
|
|
149
|
-
const lastUsed = extensionUsages.length > 0 ? Math.max(...
|
|
149
|
+
const lastUsed = extensionUsages.length > 0 ? Math.max(...extensionUsages.map(u => u.lastUsed)) : undefined;
|
|
150
150
|
const extensionQuery = ( new AccountExtensionQuery(this.providerId, this.accountName, ext.id, this.queryService));
|
|
151
151
|
const trusted = extensionQuery.isTrusted();
|
|
152
152
|
return {
|
|
@@ -156,22 +156,22 @@ class AccountExtensionsQuery extends BaseQuery {
|
|
|
156
156
|
lastUsed,
|
|
157
157
|
trusted
|
|
158
158
|
};
|
|
159
|
-
})
|
|
159
|
+
});
|
|
160
160
|
}
|
|
161
161
|
allowAccess(extensionIds) {
|
|
162
|
-
const extensionsToAllow =
|
|
162
|
+
const extensionsToAllow = extensionIds.map(id => ({
|
|
163
163
|
id,
|
|
164
164
|
name: id,
|
|
165
165
|
allowed: true
|
|
166
|
-
}))
|
|
166
|
+
}));
|
|
167
167
|
this.queryService.authenticationAccessService.updateAllowedExtensions(this.providerId, this.accountName, extensionsToAllow);
|
|
168
168
|
}
|
|
169
169
|
removeAccess(extensionIds) {
|
|
170
|
-
const extensionsToRemove =
|
|
170
|
+
const extensionsToRemove = extensionIds.map(id => ({
|
|
171
171
|
id,
|
|
172
172
|
name: id,
|
|
173
173
|
allowed: false
|
|
174
|
-
}))
|
|
174
|
+
}));
|
|
175
175
|
this.queryService.authenticationAccessService.updateAllowedExtensions(this.providerId, this.accountName, extensionsToRemove);
|
|
176
176
|
}
|
|
177
177
|
forEach(callback) {
|
|
@@ -195,19 +195,19 @@ class AccountMcpServersQuery extends BaseQuery {
|
|
|
195
195
|
return this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId, this.accountName).filter(server => server.allowed !== false);
|
|
196
196
|
}
|
|
197
197
|
allowAccess(mcpServerIds) {
|
|
198
|
-
const mcpServersToAllow =
|
|
198
|
+
const mcpServersToAllow = mcpServerIds.map(id => ({
|
|
199
199
|
id,
|
|
200
200
|
name: id,
|
|
201
201
|
allowed: true
|
|
202
|
-
}))
|
|
202
|
+
}));
|
|
203
203
|
this.queryService.authenticationMcpAccessService.updateAllowedMcpServers(this.providerId, this.accountName, mcpServersToAllow);
|
|
204
204
|
}
|
|
205
205
|
removeAccess(mcpServerIds) {
|
|
206
|
-
const mcpServersToRemove =
|
|
206
|
+
const mcpServersToRemove = mcpServerIds.map(id => ({
|
|
207
207
|
id,
|
|
208
208
|
name: id,
|
|
209
209
|
allowed: false
|
|
210
|
-
}))
|
|
210
|
+
}));
|
|
211
211
|
this.queryService.authenticationMcpAccessService.updateAllowedMcpServers(this.providerId, this.accountName, mcpServersToRemove);
|
|
212
212
|
}
|
|
213
213
|
forEach(callback) {
|
|
@@ -268,13 +268,13 @@ class AccountEntitiesQuery extends BaseQuery {
|
|
|
268
268
|
removeAllAccess() {
|
|
269
269
|
const extensionsQuery = ( new AccountExtensionsQuery(this.providerId, this.accountName, this.queryService));
|
|
270
270
|
const extensions = extensionsQuery.getAllowedExtensions();
|
|
271
|
-
const extensionIds =
|
|
271
|
+
const extensionIds = extensions.map(ext => ext.id);
|
|
272
272
|
if (extensionIds.length > 0) {
|
|
273
273
|
extensionsQuery.removeAccess(extensionIds);
|
|
274
274
|
}
|
|
275
275
|
const mcpServersQuery = ( new AccountMcpServersQuery(this.providerId, this.accountName, this.queryService));
|
|
276
276
|
const mcpServers = mcpServersQuery.getAllowedMcpServers();
|
|
277
|
-
const mcpServerIds =
|
|
277
|
+
const mcpServerIds = mcpServers.map(server => server.id);
|
|
278
278
|
if (mcpServerIds.length > 0) {
|
|
279
279
|
mcpServersQuery.removeAccess(mcpServerIds);
|
|
280
280
|
}
|
|
@@ -423,7 +423,7 @@ class ProviderQuery extends BaseQuery {
|
|
|
423
423
|
async getAccountNames() {
|
|
424
424
|
try {
|
|
425
425
|
const accounts = await this.queryService.authenticationService.getAccounts(this.providerId);
|
|
426
|
-
return
|
|
426
|
+
return accounts.map(account => account.label);
|
|
427
427
|
} catch {
|
|
428
428
|
return [];
|
|
429
429
|
}
|
|
@@ -440,7 +440,7 @@ class ProviderQuery extends BaseQuery {
|
|
|
440
440
|
const mcpUsages = this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId, account.label);
|
|
441
441
|
const allUsages = [...extensionUsages, ...mcpUsages];
|
|
442
442
|
const usageCount = allUsages.length;
|
|
443
|
-
const lastUsed = Math.max(...
|
|
443
|
+
const lastUsed = Math.max(...allUsages.map(u => u.lastUsed), 0);
|
|
444
444
|
if (usageCount > 0) {
|
|
445
445
|
recentActivity.push({
|
|
446
446
|
accountName: account.label,
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationUsageService.js
CHANGED
|
@@ -37,7 +37,9 @@ let AuthenticationUsageService = class AuthenticationUsageService extends Dispos
|
|
|
37
37
|
));
|
|
38
38
|
}
|
|
39
39
|
async initializeExtensionUsageCache() {
|
|
40
|
-
await this._queue.queue(() => Promise.all(
|
|
40
|
+
await this._queue.queue(() => Promise.all(
|
|
41
|
+
this._authenticationService.getProviderIds().map(providerId => this._addExtensionsToCache(providerId))
|
|
42
|
+
));
|
|
41
43
|
}
|
|
42
44
|
async extensionUsesAuth(extensionId) {
|
|
43
45
|
await this._queue.whenIdle();
|