@codingame/monaco-vscode-authentication-service-override 37.6.1 → 38.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-authentication-service-override",
3
- "version": "37.6.1",
3
+ "version": "38.0.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.6.1"
18
+ "@codingame/monaco-vscode-api": "38.0.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(7369, "Manage Extension Account Preferences...")),
20
- category: ( localize2(7370, "Accounts")),
19
+ title: ( localize2(8801, "Manage Extension Account Preferences...")),
20
+ category: ( localize2(8802, "Accounts")),
21
21
  f1: true,
22
22
  menu: [{
23
23
  id: MenuId.AccountsContext,
@@ -56,8 +56,8 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
56
56
  label: ext.displayName ?? ext.name,
57
57
  id: ext.identifier.value
58
58
  })), {
59
- placeHolder: ( localize(7371, "Select an extension to manage account preferences for")),
60
- title: ( localize(7372, "Manage Extension Account Preferences"))
59
+ placeHolder: ( localize(8803, "Select an extension to manage account preferences for")),
60
+ title: ( localize(8804, "Manage Extension Account Preferences"))
61
61
  });
62
62
  extensionId = result?.id;
63
63
  }
@@ -72,7 +72,7 @@ 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(7373, "This extension has not used any accounts yet.")));
75
+ await this._dialogService.info(( localize(8805, "This extension has not used any accounts yet.")));
76
76
  return;
77
77
  }
78
78
  providerId = providersWithAccess[0];
@@ -82,10 +82,10 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
82
82
  id: providerId
83
83
  })), {
84
84
  placeHolder: ( localize(
85
- 7374,
85
+ 8806,
86
86
  "Select an authentication provider to manage account preferences for"
87
87
  )),
88
- title: ( localize(7372, "Manage Extension Account Preferences"))
88
+ title: ( localize(8804, "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(7375, "Use a new account..."))
111
+ label: ( localize(8807, "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
- 7376,
137
+ 8808,
138
138
  "Manage '{0}' account preferences for {1}...",
139
139
  extensionLabel,
140
140
  providerLabel
141
141
  ));
142
- picker.title = ( localize(7377, "'{0}' Account Preferences For This Workspace", extensionLabel));
142
+ picker.title = ( localize(8809, "'{0}' Account Preferences For This Workspace", extensionLabel));
143
143
  picker.sortByLabel = false;
144
144
  disposableStore.add(picker.onDidAccept(async () => {
145
145
  picker.hide();
@@ -152,7 +152,7 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
152
152
  label: a.label,
153
153
  account: a,
154
154
  providerId,
155
- description: ( localize(7378, "Current account")),
155
+ description: ( localize(8810, "Current account")),
156
156
  picked: true
157
157
  } : {
158
158
  label: a.label,
@@ -161,7 +161,7 @@ let ManageAccountPreferenceForExtensionActionImpl = class ManageAccountPreferenc
161
161
  });
162
162
  }
163
163
  _handleNoAccounts(picker) {
164
- picker.validationMessage = ( localize(7379, "No accounts are currently used by this extension."));
164
+ picker.validationMessage = ( localize(8811, "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(7380, "Manage MCP Server Account Preferences")),
20
- category: ( localize2(7381, "Accounts")),
19
+ title: ( localize2(8812, "Manage MCP Server Account Preferences")),
20
+ category: ( localize2(8813, "Accounts")),
21
21
  f1: false
22
22
  });
23
23
  }
@@ -53,7 +53,7 @@ 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(7382, "This MCP server has not used any accounts yet.")));
56
+ await this._dialogService.info(( localize(8814, "This MCP server has not used any accounts yet.")));
57
57
  return;
58
58
  }
59
59
  providerId = providersWithAccess[0];
@@ -63,10 +63,10 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
63
63
  id: providerId
64
64
  })), {
65
65
  placeHolder: ( localize(
66
- 7383,
66
+ 8815,
67
67
  "Select an authentication provider to manage account preferences for"
68
68
  )),
69
- title: ( localize(7384, "Manage MCP Server Account Preferences"))
69
+ title: ( localize(8816, "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(7385, "Use a new account..."))
92
+ label: ( localize(8817, "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
- 7386,
113
+ 8818,
114
114
  "Manage '{0}' account preferences for {1}...",
115
115
  mcpServerLabel,
116
116
  providerLabel
117
117
  ));
118
- picker.title = ( localize(7387, "'{0}' Account Preferences For This Workspace", mcpServerLabel));
118
+ picker.title = ( localize(8819, "'{0}' Account Preferences For This Workspace", mcpServerLabel));
119
119
  picker.sortByLabel = false;
120
120
  disposableStore.add(picker.onDidAccept(async () => {
121
121
  picker.hide();
@@ -128,7 +128,7 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
128
128
  label: a.label,
129
129
  account: a,
130
130
  providerId,
131
- description: ( localize(7388, "Current account")),
131
+ description: ( localize(8820, "Current account")),
132
132
  picked: true
133
133
  } : {
134
134
  label: a.label,
@@ -137,7 +137,7 @@ let ManageAccountPreferenceForMcpServerActionImpl = class ManageAccountPreferenc
137
137
  });
138
138
  }
139
139
  _handleNoAccounts(picker) {
140
- picker.validationMessage = ( localize(7389, "No accounts are currently used by this MCP server."));
140
+ picker.validationMessage = ( localize(8821, "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());
@@ -16,8 +16,8 @@ class ManageAccountsAction extends Action2 {
16
16
  constructor() {
17
17
  super({
18
18
  id: "workbench.action.manageAccounts",
19
- title: ( localize2(7390, "Manage Accounts")),
20
- category: ( localize2(7391, "Accounts")),
19
+ title: ( localize2(8822, "Manage Accounts")),
20
+ category: ( localize2(8823, "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(7392, "Select an account to manage"));
44
+ const placeHolder = ( localize(8824, "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(7393, "There are no active accounts."))
48
+ label: ( localize(8825, "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(7394, "Manage '{0}'", accountLabel));
102
- quickPick.placeholder = ( localize(7395, "Select an action"));
101
+ quickPick.title = ( localize(8826, "Manage '{0}'", accountLabel));
102
+ quickPick.placeholder = ( localize(8827, "Select an action"));
103
103
  quickPick.buttons = [this.quickInputService.backButton];
104
104
  const items = [{
105
- label: ( localize(7396, "Manage Trusted Extensions")),
105
+ label: ( localize(8828, "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(7397, "Manage Trusted MCP Servers")),
113
+ label: ( localize(8829, "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(7398, "Sign Out")),
122
+ label: ( localize(8830, "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(7399, "Remove Dynamic Authentication Providers")),
17
- category: ( localize2(7400, "Authentication")),
16
+ title: ( localize2(8831, "Remove Dynamic Authentication Providers")),
17
+ category: ( localize2(8832, "Authentication")),
18
18
  f1: true
19
19
  });
20
20
  }
@@ -25,16 +25,16 @@ 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(7401, "No dynamic authentication providers")), ( localize(7402, "No dynamic authentication providers have been used yet.")));
28
+ await dialogService.info(( localize(8833, "No dynamic authentication providers")), ( localize(8834, "No dynamic authentication providers have been used yet.")));
29
29
  return;
30
30
  }
31
31
  const items = interactedProviders.map(provider => ({
32
32
  label: provider.label,
33
- description: ( localize(7403, "Client ID: {0}", provider.clientId)),
33
+ description: ( localize(8835, "Client ID: {0}", provider.clientId)),
34
34
  provider
35
35
  }));
36
36
  const selected = await quickInputService.pick(items, {
37
- placeHolder: ( localize(7404, "Select a dynamic authentication provider to remove")),
37
+ placeHolder: ( localize(8836, "Select a dynamic authentication provider to remove")),
38
38
  canPickMany: true
39
39
  });
40
40
  if (!selected || selected.length === 0) {
@@ -42,11 +42,11 @@ class RemoveDynamicAuthenticationProvidersAction extends Action2 {
42
42
  }
43
43
  const providerNames = selected.map(item => item.provider.label).join(", ");
44
44
  const message = selected.length === 1 ? ( localize(
45
- 7405,
45
+ 8837,
46
46
  "Are you sure you want to remove the dynamic authentication provider \"{0}\"?",
47
47
  providerNames
48
48
  )) : ( localize(
49
- 7406,
49
+ 8838,
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
- 7407,
57
+ 8839,
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(7408, "Remove")),
60
+ primaryButton: ( localize(8840, "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(7409, "Manage Trusted Extensions For Account")),
23
- category: ( localize2(7410, "Accounts")),
22
+ title: ( localize2(8841, "Manage Trusted Extensions For Account")),
23
+ category: ( localize2(8842, "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(7411, "View extension details")),
50
+ tooltip: ( localize(8843, "View extension details")),
51
51
  iconClass: ThemeIcon.asClassName(Codicon.info)
52
52
  };
53
53
  this._managePreferencesButton = {
54
- tooltip: ( localize(7412, "Manage account preferences for this extension")),
54
+ tooltip: ( localize(8844, "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(7413, "Pick an account to manage trusted extensions for")),
78
+ placeHolder: ( localize(8845, "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;
@@ -117,7 +117,7 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
117
117
  };
118
118
  });
119
119
  if (!filteredExtensions.length) {
120
- this._dialogService.info(( localize(7414, "This account has not been used by any extensions.")));
120
+ this._dialogService.info(( localize(8846, "This account has not been used by any extensions.")));
121
121
  return [];
122
122
  }
123
123
  const trustedExtensions = filteredExtensions.filter(e => e.trusted);
@@ -126,17 +126,17 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
126
126
  const _toQuickPickItem = this._toQuickPickItem.bind(this);
127
127
  return [...otherExtensions.sort(sortByLastUsed).map(_toQuickPickItem), {
128
128
  type: "separator",
129
- label: ( localize(7415, "Trusted by Microsoft"))
129
+ label: ( localize(8847, "Trusted by Microsoft"))
130
130
  }, ...trustedExtensions.sort(sortByLastUsed).map(_toQuickPickItem)];
131
131
  }
132
132
  _toQuickPickItem(extension) {
133
133
  const lastUsed = extension.lastUsed;
134
- const description = lastUsed ? ( localize(7416, "Last used this account {0}", fromNow(lastUsed, true))) : ( localize(7417, "Has not used this account"));
134
+ const description = lastUsed ? ( localize(8848, "Last used this account {0}", fromNow(lastUsed, true))) : ( localize(8849, "Has not used this account"));
135
135
  let tooltip;
136
136
  let disabled;
137
137
  if (extension.trusted) {
138
138
  tooltip = ( localize(
139
- 7418,
139
+ 8850,
140
140
  "This extension is trusted by Microsoft and\nalways has access to this account"
141
141
  ));
142
142
  disabled = true;
@@ -158,10 +158,10 @@ let ManageTrustedExtensionsForAccountActionImpl = class ManageTrustedExtensionsF
158
158
  }));
159
159
  quickPick.canSelectMany = true;
160
160
  quickPick.customButton = true;
161
- quickPick.customLabel = ( localize(7419, "Cancel"));
161
+ quickPick.customLabel = ( localize(8851, "Cancel"));
162
162
  quickPick.customButtonSecondary = true;
163
- quickPick.title = ( localize(7420, "Manage Trusted Extensions"));
164
- quickPick.placeholder = ( localize(7421, "Choose which extensions can access this account"));
163
+ quickPick.title = ( localize(8852, "Manage Trusted Extensions"));
164
+ quickPick.placeholder = ( localize(8853, "Choose which extensions can access this account"));
165
165
  disposableStore.add(quickPick.onDidAccept(() => {
166
166
  const updatedAllowedList = quickPick.items.filter(item => item.type !== "separator").map(i => i.extension);
167
167
  const allowedExtensionsSet = ( new Set(quickPick.selectedItems.map(i => i.extension)));
@@ -20,8 +20,8 @@ class ManageTrustedMcpServersForAccountAction extends Action2 {
20
20
  constructor() {
21
21
  super({
22
22
  id: "_manageTrustedMCPServersForAccount",
23
- title: ( localize2(7422, "Manage Trusted MCP Servers For Account")),
24
- category: ( localize2(7423, "Accounts")),
23
+ title: ( localize2(8854, "Manage Trusted MCP Servers For Account")),
24
+ category: ( localize2(8855, "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(7424, "Pick an account to manage trusted MCP servers for")),
70
+ placeHolder: ( localize(8856, "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;
@@ -109,7 +109,7 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
109
109
  name: serverIdToLabel.get(server.id)
110
110
  }));
111
111
  if (!agentHostServers.length && !workbenchServers.length) {
112
- this._dialogService.info(( localize(7425, "This account has not been used by any MCP servers.")));
112
+ this._dialogService.info(( localize(8857, "This account has not been used by any MCP servers.")));
113
113
  return [];
114
114
  }
115
115
  const trustedServers = workbenchServers.filter(s => s.trusted);
@@ -132,25 +132,25 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
132
132
  } of sortedGroups) {
133
133
  items.push({
134
134
  type: "separator",
135
- label: ( localize(7426, "MCP Servers in {0}", label))
135
+ label: ( localize(8858, "MCP Servers in {0}", label))
136
136
  });
137
137
  items.push(...servers.sort(sortByLastUsed).map(this._toQuickPickItem));
138
138
  }
139
139
  items.push({
140
140
  type: "separator",
141
- label: ( localize(7427, "Trusted by Microsoft"))
141
+ label: ( localize(8859, "Trusted by Microsoft"))
142
142
  });
143
143
  items.push(...trustedServers.sort(sortByLastUsed).map(this._toQuickPickItem));
144
144
  return items;
145
145
  }
146
146
  _toQuickPickItem(mcpServer) {
147
147
  const lastUsed = mcpServer.lastUsed;
148
- const description = lastUsed ? ( localize(7428, "Last used this account {0}", fromNow(lastUsed, true))) : ( localize(7429, "Has not used this account"));
148
+ const description = lastUsed ? ( localize(8860, "Last used this account {0}", fromNow(lastUsed, true))) : ( localize(8861, "Has not used this account"));
149
149
  let tooltip;
150
150
  let disabled;
151
151
  if (mcpServer.trusted) {
152
152
  tooltip = ( localize(
153
- 7430,
153
+ 8862,
154
154
  "This MCP server is trusted by Microsoft and\nalways has access to this account"
155
155
  ));
156
156
  disabled = true;
@@ -162,7 +162,7 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
162
162
  tooltip,
163
163
  disabled,
164
164
  buttons: [{
165
- tooltip: ( localize(7431, "Manage account preferences for this MCP server")),
165
+ tooltip: ( localize(8863, "Manage account preferences for this MCP server")),
166
166
  iconClass: ThemeIcon.asClassName(Codicon.settingsGear)
167
167
  }],
168
168
  picked: mcpServer.allowed === undefined || mcpServer.allowed
@@ -175,10 +175,10 @@ let ManageTrustedMcpServersForAccountActionImpl = class ManageTrustedMcpServersF
175
175
  }));
176
176
  quickPick.canSelectMany = true;
177
177
  quickPick.customButton = true;
178
- quickPick.customLabel = ( localize(7432, "Cancel"));
178
+ quickPick.customLabel = ( localize(8864, "Cancel"));
179
179
  quickPick.customButtonSecondary = true;
180
- quickPick.title = ( localize(7433, "Manage Trusted MCP Servers"));
181
- quickPick.placeholder = ( localize(7434, "Choose which MCP servers can access this account"));
180
+ quickPick.title = ( localize(8865, "Manage Trusted MCP Servers"));
181
+ quickPick.placeholder = ( localize(8866, "Choose which MCP servers can access this account"));
182
182
  disposableStore.add(quickPick.onDidAccept(() => {
183
183
  quickPick.hide();
184
184
  const allServers = quickPick.items.filter(item => item.type !== "separator").map(i => i.mcpServer);
@@ -11,7 +11,7 @@ class SignOutOfAccountAction extends Action2 {
11
11
  constructor() {
12
12
  super({
13
13
  id: "_signOutOfAccount",
14
- title: ( localize(7435, "Sign out of account")),
14
+ title: ( localize(8867, "Sign out of account")),
15
15
  f1: false
16
16
  });
17
17
  }
@@ -39,12 +39,12 @@ class SignOutOfAccountAction extends Action2 {
39
39
  } = await dialogService.confirm({
40
40
  type: Severity.Info,
41
41
  message: accountUsages.length ? ( localize(
42
- 7436,
42
+ 8868,
43
43
  "The account '{0}' has been used by: \n\n{1}\n\n Sign out from these extensions?",
44
44
  accountLabel,
45
45
  accountUsages.map(usage => usage.extensionName).join("\n")
46
- )) : ( localize(7437, "Sign out of '{0}'?", accountLabel)),
47
- primaryButton: ( localize(7438, "&&Sign Out"))
46
+ )) : ( localize(8869, "Sign out of '{0}'?", accountLabel)),
47
+ primaryButton: ( localize(8870, "&&Sign Out"))
48
48
  });
49
49
  if (confirmed) {
50
50
  const removeSessionPromises = sessions.map(session => authenticationService.removeSession(providerId, session.id));
@@ -41,7 +41,7 @@ class AuthenticationDataRenderer extends Disposable {
41
41
  dispose: () => {}
42
42
  };
43
43
  }
44
- const headers = [( localize(7439, "Label")), ( localize(7440, "ID")), ( localize(7441, "MCP Authorization Servers"))];
44
+ const headers = [( localize(8871, "Label")), ( localize(8872, "ID")), ( localize(8873, "MCP Authorization Servers"))];
45
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
  });
@@ -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(7442, "Authentication")),
59
+ label: ( localize(8874, "Authentication")),
60
60
  access: {
61
61
  canToggle: false
62
62
  },
@@ -5,10 +5,11 @@ import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform
5
5
  import { IActivityService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/activity/common/activity.service";
6
6
  import { IAuthenticationAccessService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationAccessService.service";
7
7
  import { IAuthenticationUsageService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationUsageService.service";
8
- import { AuthenticationSession, AuthenticationSessionAccount, IAuthenticationWwwAuthenticateRequest } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication";
8
+ import { AuthenticationSession, AuthenticationSessionAccount, IAuthenticationWwwAuthenticateRequest, IAuthenticationProviderSessionOptions } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication";
9
9
  import { IAuthenticationExtensionsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service";
10
10
  import { IAuthenticationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service";
11
11
  import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service";
12
+ import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
12
13
  export declare class AuthenticationExtensionsService extends Disposable implements IAuthenticationExtensionsService {
13
14
  private readonly activityService;
14
15
  private readonly storageService;
@@ -18,8 +19,10 @@ export declare class AuthenticationExtensionsService extends Disposable implemen
18
19
  private readonly _authenticationService;
19
20
  private readonly _authenticationUsageService;
20
21
  private readonly _authenticationAccessService;
22
+ private readonly _logService;
21
23
  readonly _serviceBrand: undefined;
22
24
  private _signInRequestItems;
25
+ private readonly _signInRequestUpdates;
23
26
  private _sessionAccessRequestItems;
24
27
  private readonly _accountBadgeDisposable;
25
28
  private _onDidAccountPreferenceChange;
@@ -29,12 +32,20 @@ export declare class AuthenticationExtensionsService extends Disposable implemen
29
32
  }>;
30
33
  private _inheritAuthAccountPreferenceParentToChildren;
31
34
  private _inheritAuthAccountPreferenceChildToParent;
32
- constructor(activityService: IActivityService, storageService: IStorageService, dialogService: IDialogService, quickInputService: IQuickInputService, _productService: IProductService, _authenticationService: IAuthenticationService, _authenticationUsageService: IAuthenticationUsageService, _authenticationAccessService: IAuthenticationAccessService);
35
+ constructor(activityService: IActivityService, storageService: IStorageService, dialogService: IDialogService, quickInputService: IQuickInputService, _productService: IProductService, _authenticationService: IAuthenticationService, _authenticationUsageService: IAuthenticationUsageService, _authenticationAccessService: IAuthenticationAccessService, _logService: ILogService);
33
36
  private registerListeners;
34
- updateNewSessionRequests(providerId: string, addedSessions: readonly AuthenticationSession[]): void;
37
+ dispose(): void;
38
+ private clearProviderRequests;
39
+ updateNewSessionRequests(providerId: string, addedSessions: readonly AuthenticationSession[]): Promise<void>;
40
+ private isCurrentSignInRequest;
41
+ private revalidateSignInRequest;
42
+ private hasSessionForRequest;
43
+ private completeSignInRequest;
35
44
  private updateAccessRequests;
36
45
  private updateBadgeCount;
46
+ private accessRequestKey;
37
47
  private removeAccessRequest;
48
+ private removeAllowedAccessRequests;
38
49
  updateAccountPreference(extensionId: string, providerId: string, account: AuthenticationSessionAccount): void;
39
50
  getAccountPreference(extensionId: string, providerId: string): string | undefined;
40
51
  removeAccountPreference(extensionId: string, providerId: string): void;
@@ -47,8 +58,8 @@ export declare class AuthenticationExtensionsService extends Disposable implemen
47
58
  /**
48
59
  * This function should be used only when there are sessions to disambiguate.
49
60
  */
50
- selectSession(providerId: string, extensionId: string, extensionName: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationWwwAuthenticateRequest, availableSessions: AuthenticationSession[]): Promise<AuthenticationSession>;
61
+ selectSession(providerId: string, extensionId: string, extensionName: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationWwwAuthenticateRequest, availableSessions: readonly AuthenticationSession[], options?: IAuthenticationProviderSessionOptions): Promise<AuthenticationSession>;
51
62
  private completeSessionAccessRequest;
52
- requestSessionAccess(providerId: string, extensionId: string, extensionName: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationWwwAuthenticateRequest, possibleSessions: AuthenticationSession[]): void;
53
- requestNewSession(providerId: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationWwwAuthenticateRequest, extensionId: string, extensionName: string): Promise<void>;
63
+ requestSessionAccess(providerId: string, extensionId: string, extensionName: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationWwwAuthenticateRequest, possibleSessions: readonly AuthenticationSession[], options?: IAuthenticationProviderSessionOptions): void;
64
+ requestNewSession(providerId: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationWwwAuthenticateRequest, extensionId: string, extensionName: string, options?: IAuthenticationProviderSessionOptions): Promise<void>;
54
65
  }
@@ -1,7 +1,10 @@
1
1
 
2
2
  import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
3
  import { Disposable, MutableDisposable, dispose, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
+ import { SequencerByKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
5
+ import { onUnexpectedError, CancellationError, isCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
4
6
  import { scopesMatch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/oauth';
7
+ import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
5
8
  import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
6
9
  import { MenuRegistry, MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
7
10
  import { CommandsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands';
@@ -15,11 +18,12 @@ import { NumberBadge } from '@codingame/monaco-vscode-api/vscode/vs/workbench/se
15
18
  import { IActivityService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/activity/common/activity.service';
16
19
  import { IAuthenticationAccessService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationAccessService.service';
17
20
  import { IAuthenticationUsageService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationUsageService.service';
18
- import { isAuthenticationWwwAuthenticateRequest } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication';
21
+ import { isAuthenticationWwwAuthenticateRequest, getAuthenticationSessionRequestKey } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication';
19
22
  import { IAuthenticationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service';
20
23
  import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
21
24
  import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
22
25
  import { ExtensionIdentifier } from '@codingame/monaco-vscode-api/vscode/vs/platform/extensions/common/extensions';
26
+ import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
23
27
  import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
24
28
 
25
29
  const SCOPESLIST_SEPARATOR = " ";
@@ -32,7 +36,8 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
32
36
  _productService,
33
37
  _authenticationService,
34
38
  _authenticationUsageService,
35
- _authenticationAccessService
39
+ _authenticationAccessService,
40
+ _logService
36
41
  ) {
37
42
  super();
38
43
  this.activityService = activityService;
@@ -43,7 +48,9 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
43
48
  this._authenticationService = _authenticationService;
44
49
  this._authenticationUsageService = _authenticationUsageService;
45
50
  this._authenticationAccessService = _authenticationAccessService;
51
+ this._logService = _logService;
46
52
  this._signInRequestItems = ( new Map());
53
+ this._signInRequestUpdates = ( new SequencerByKey());
47
54
  this._sessionAccessRequestItems = ( new Map());
48
55
  this._accountBadgeDisposable = this._register(( new MutableDisposable()));
49
56
  this._onDidAccountPreferenceChange = this._register(( new Emitter()));
@@ -60,51 +67,94 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
60
67
  registerListeners() {
61
68
  this._register(this._authenticationService.onDidChangeSessions(e => {
62
69
  if (e.event.added?.length) {
63
- this.updateNewSessionRequests(e.providerId, e.event.added);
70
+ void this.updateNewSessionRequests(e.providerId, e.event.added).catch(onUnexpectedError);
64
71
  }
65
72
  if (e.event.removed?.length) {
66
73
  this.updateAccessRequests(e.providerId, e.event.removed);
67
74
  }
68
75
  }));
69
76
  this._register(this._authenticationService.onDidUnregisterAuthenticationProvider(e => {
70
- const accessRequests = this._sessionAccessRequestItems.get(e.id) || {};
71
- ( Object.keys(accessRequests)).forEach(extensionId => {
72
- this.removeAccessRequest(e.id, extensionId);
73
- });
77
+ this.clearProviderRequests(e.id);
78
+ this.updateBadgeCount();
74
79
  }));
75
80
  }
81
+ dispose() {
82
+ for (const providerId of ( new Set([...( this._signInRequestItems.keys()), ...( this._sessionAccessRequestItems.keys())]))) {
83
+ this.clearProviderRequests(providerId);
84
+ }
85
+ super.dispose();
86
+ }
87
+ clearProviderRequests(providerId) {
88
+ for (const request of [...( Object.values(this._signInRequestItems.get(providerId) ?? {})), ...( Object.values(this._sessionAccessRequestItems.get(providerId) ?? {}))]) {
89
+ dispose(request.disposables);
90
+ }
91
+ this._signInRequestItems.delete(providerId);
92
+ this._sessionAccessRequestItems.delete(providerId);
93
+ }
76
94
  updateNewSessionRequests(providerId, addedSessions) {
77
- const existingRequestsForProvider = this._signInRequestItems.get(providerId);
78
- if (!existingRequestsForProvider) {
95
+ const providerRequests = this._signInRequestItems.get(providerId);
96
+ if (!providerRequests || this._store.isDisposed) {
97
+ return Promise.resolve();
98
+ }
99
+ const requests = Object.entries(providerRequests);
100
+ return this._signInRequestUpdates.queue(providerRequests, async () => {
101
+ for (const [requestKey, request] of requests) {
102
+ await this.revalidateSignInRequest(providerId, providerRequests, requestKey, request, addedSessions);
103
+ }
104
+ });
105
+ }
106
+ isCurrentSignInRequest(providerId, providerRequests, requestKey, request) {
107
+ return !this._store.isDisposed && this._signInRequestItems.get(providerId) === providerRequests && providerRequests[requestKey] === request;
108
+ }
109
+ async revalidateSignInRequest(providerId, providerRequests, requestKey, request, addedSessions) {
110
+ if (!this.isCurrentSignInRequest(providerId, providerRequests, requestKey, request)) {
79
111
  return;
80
112
  }
81
- ( Object.keys(existingRequestsForProvider)).forEach(requestedScopes => {
82
- const requestedScopesArray = requestedScopes.split(SCOPESLIST_SEPARATOR);
83
- if (( addedSessions.some(session => scopesMatch(session.scopes, requestedScopesArray)))) {
84
- const sessionRequest = existingRequestsForProvider[requestedScopes];
85
- sessionRequest?.disposables.forEach(item => item.dispose());
86
- delete existingRequestsForProvider[requestedScopes];
87
- if (( Object.keys(existingRequestsForProvider)).length === 0) {
88
- this._signInRequestItems.delete(providerId);
89
- } else {
90
- this._signInRequestItems.set(providerId, existingRequestsForProvider);
91
- }
92
- this.updateBadgeCount();
113
+ try {
114
+ if (await this.hasSessionForRequest(providerId, request, addedSessions)) {
115
+ this.completeSignInRequest(providerId, providerRequests, requestKey, request);
93
116
  }
117
+ } catch (error) {
118
+ if (this.isCurrentSignInRequest(providerId, providerRequests, requestKey, request)) {
119
+ this._logService.warn(
120
+ `Failed to check a pending authentication request for '${providerId}'.`,
121
+ error
122
+ );
123
+ }
124
+ }
125
+ }
126
+ async hasSessionForRequest(providerId, request, addedSessions) {
127
+ const {
128
+ scopeListOrRequest,
129
+ options
130
+ } = request;
131
+ if (!isAuthenticationWwwAuthenticateRequest(scopeListOrRequest) && !( addedSessions.some(session => scopesMatch(session.scopes, scopeListOrRequest)))) {
132
+ return false;
133
+ }
134
+ const sessions = await this._authenticationService.getSessions(providerId, scopeListOrRequest, {
135
+ ...options,
136
+ silent: true
94
137
  });
138
+ return sessions.length > 0;
139
+ }
140
+ completeSignInRequest(providerId, providerRequests, requestKey, request) {
141
+ if (!this.isCurrentSignInRequest(providerId, providerRequests, requestKey, request)) {
142
+ return;
143
+ }
144
+ delete providerRequests[requestKey];
145
+ if (( Object.keys(providerRequests)).length === 0) {
146
+ this._signInRequestItems.delete(providerId);
147
+ }
148
+ dispose(request.disposables);
149
+ this.updateBadgeCount();
95
150
  }
96
151
  updateAccessRequests(providerId, removedSessions) {
97
152
  const providerRequests = this._sessionAccessRequestItems.get(providerId);
98
153
  if (providerRequests) {
99
- ( Object.keys(providerRequests)).forEach(extensionId => {
100
- removedSessions.forEach(removed => {
101
- const indexOfSession = providerRequests[extensionId].possibleSessions.findIndex(session => session.id === removed.id);
102
- if (indexOfSession) {
103
- providerRequests[extensionId].possibleSessions.splice(indexOfSession, 1);
104
- }
105
- });
106
- if (!providerRequests[extensionId].possibleSessions.length) {
107
- this.removeAccessRequest(providerId, extensionId);
154
+ Object.entries(providerRequests).forEach(([requestKey, request]) => {
155
+ request.possibleSessions = request.possibleSessions.filter(session => !( removedSessions.some(removed => removed.id === session.id)));
156
+ if (!request.possibleSessions.length) {
157
+ this.removeAccessRequest(providerId, requestKey);
108
158
  }
109
159
  });
110
160
  }
@@ -121,20 +171,39 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
121
171
  numberOfRequests += ( Object.keys(accessRequest)).length;
122
172
  });
123
173
  if (numberOfRequests > 0) {
124
- const badge = ( new NumberBadge(numberOfRequests, () => ( localize(21678, "Sign in requested"))));
174
+ const badge = ( new NumberBadge(numberOfRequests, () => ( localize(24253, "Sign in requested"))));
125
175
  this._accountBadgeDisposable.value = this.activityService.showAccountsActivity({
126
176
  badge
127
177
  });
128
178
  }
129
179
  }
130
- removeAccessRequest(providerId, extensionId) {
180
+ accessRequestKey(extensionId, scopeListOrRequest, options) {
181
+ return JSON.stringify([
182
+ extensionId,
183
+ getAuthenticationSessionRequestKey(scopeListOrRequest, options)
184
+ ]);
185
+ }
186
+ removeAccessRequest(providerId, requestKey) {
131
187
  const providerRequests = this._sessionAccessRequestItems.get(providerId) || {};
132
- if (providerRequests[extensionId]) {
133
- dispose(providerRequests[extensionId].disposables);
134
- delete providerRequests[extensionId];
188
+ if (providerRequests[requestKey]) {
189
+ dispose(providerRequests[requestKey].disposables);
190
+ delete providerRequests[requestKey];
191
+ if (( Object.keys(providerRequests)).length === 0) {
192
+ this._sessionAccessRequestItems.delete(providerId);
193
+ }
135
194
  this.updateBadgeCount();
136
195
  }
137
196
  }
197
+ removeAllowedAccessRequests(providerId, extensionId, accountName) {
198
+ if (!this._authenticationAccessService.isAccessAllowed(providerId, accountName, extensionId)) {
199
+ return;
200
+ }
201
+ for (const [requestKey, request] of Object.entries(this._sessionAccessRequestItems.get(providerId) ?? {})) {
202
+ if (request.extensionId === extensionId && ( request.possibleSessions.some(session => session.account.label === accountName))) {
203
+ this.removeAccessRequest(providerId, requestKey);
204
+ }
205
+ }
206
+ }
138
207
  updateAccountPreference(extensionId, providerId, account) {
139
208
  const realExtensionId = ExtensionIdentifier.toKey(extensionId);
140
209
  const parentExtensionId = this._inheritAuthAccountPreferenceChildToParent[realExtensionId] ?? realExtensionId;
@@ -143,6 +212,9 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
143
212
  this.storageService.store(key, account.label, StorageScope.APPLICATION, StorageTarget.MACHINE);
144
213
  const childrenExtensions = this._inheritAuthAccountPreferenceParentToChildren[parentExtensionId];
145
214
  const extensionIds = childrenExtensions ? [parentExtensionId, ...childrenExtensions] : [parentExtensionId];
215
+ for (const id of extensionIds) {
216
+ this.removeAllowedAccessRequests(providerId, id, account.label);
217
+ }
146
218
  this._onDidAccountPreferenceChange.fire({
147
219
  extensionIds,
148
220
  providerId
@@ -189,7 +261,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
189
261
  this.updateAccountPreference(extensionId, providerId, session.account);
190
262
  this.updateSessionPreference(providerId, extensionId, session);
191
263
  }
192
- async showGetSessionPrompt(provider, accountName, extensionId, extensionName) {
264
+ async showGetSessionPrompt(provider, accountName, extensionId, extensionName, requestKey) {
193
265
  let SessionPromptChoice;
194
266
  (function(SessionPromptChoice) {
195
267
  SessionPromptChoice[SessionPromptChoice["Allow"] = 0] = "Allow";
@@ -201,17 +273,17 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
201
273
  } = await this.dialogService.prompt({
202
274
  type: Severity.Info,
203
275
  message: ( localize(
204
- 21679,
276
+ 24254,
205
277
  "The extension '{0}' wants to access the {1} account '{2}'.",
206
278
  extensionName,
207
279
  provider.label,
208
280
  accountName
209
281
  )),
210
282
  buttons: [{
211
- label: ( localize(21680, "&&Allow")),
283
+ label: ( localize(24255, "&&Allow")),
212
284
  run: () => SessionPromptChoice.Allow
213
285
  }, {
214
- label: ( localize(21681, "&&Deny")),
286
+ label: ( localize(24256, "&&Deny")),
215
287
  run: () => SessionPromptChoice.Deny
216
288
  }],
217
289
  cancelButton: {
@@ -224,7 +296,10 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
224
296
  name: extensionName,
225
297
  allowed: result === SessionPromptChoice.Allow
226
298
  }]);
227
- this.removeAccessRequest(provider.id, extensionId);
299
+ this.removeAccessRequest(provider.id, requestKey);
300
+ if (result === SessionPromptChoice.Allow) {
301
+ this.removeAllowedAccessRequests(provider.id, extensionId, accountName);
302
+ }
228
303
  }
229
304
  return result === SessionPromptChoice.Allow;
230
305
  }
@@ -233,7 +308,8 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
233
308
  extensionId,
234
309
  extensionName,
235
310
  scopeListOrRequest,
236
- availableSessions
311
+ availableSessions,
312
+ options = {}
237
313
  ) {
238
314
  const allAccounts = await this._authenticationService.getAccounts(providerId);
239
315
  if (!allAccounts.length) {
@@ -259,17 +335,17 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
259
335
  }
260
336
  });
261
337
  items.push({
262
- label: ( localize(21682, "Sign in to another account"))
338
+ label: ( localize(24257, "Sign in to another account"))
263
339
  });
264
340
  quickPick.items = items;
265
341
  quickPick.title = ( localize(
266
- 21683,
342
+ 24258,
267
343
  "The extension '{0}' wants to access a {1} account",
268
344
  extensionName,
269
345
  this._authenticationService.getProvider(providerId).label
270
346
  ));
271
347
  quickPick.placeholder = ( localize(
272
- 21684,
348
+ 24259,
273
349
  "Select an account for '{0}' to use or Esc to cancel",
274
350
  extensionName
275
351
  ));
@@ -281,6 +357,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
281
357
  const account = quickPick.selectedItems[0].account;
282
358
  try {
283
359
  session = await this._authenticationService.createSession(providerId, scopeListOrRequest, {
360
+ ...options,
284
361
  account
285
362
  });
286
363
  } catch (e) {
@@ -295,28 +372,36 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
295
372
  allowed: true
296
373
  }]);
297
374
  this._updateAccountAndSessionPreferences(providerId, extensionId, session);
298
- this.removeAccessRequest(providerId, extensionId);
375
+ this.removeAccessRequest(
376
+ providerId,
377
+ this.accessRequestKey(extensionId, scopeListOrRequest, options)
378
+ );
299
379
  resolve(session);
300
380
  }));
301
381
  disposables.add(quickPick.onDidHide(_ => {
302
382
  if (!quickPick.selectedItems[0]) {
303
- reject("User did not consent to account access");
383
+ reject(( new CancellationError()));
304
384
  }
305
385
  disposables.dispose();
306
386
  }));
307
387
  quickPick.show();
308
388
  }));
309
389
  }
310
- async completeSessionAccessRequest(provider, extensionId, extensionName, scopeListOrRequest) {
390
+ async completeSessionAccessRequest(provider, requestKey, extensionName) {
311
391
  const providerRequests = this._sessionAccessRequestItems.get(provider.id) || {};
312
- const existingRequest = providerRequests[extensionId];
392
+ const existingRequest = providerRequests[requestKey];
313
393
  if (!existingRequest) {
314
394
  return;
315
395
  }
316
396
  if (!provider) {
317
397
  return;
318
398
  }
319
- const possibleSessions = existingRequest.possibleSessions;
399
+ const {
400
+ possibleSessions,
401
+ extensionId,
402
+ scopeListOrRequest,
403
+ options
404
+ } = existingRequest;
320
405
  let session;
321
406
  if (provider.supportsMultipleAccounts) {
322
407
  try {
@@ -325,11 +410,22 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
325
410
  extensionId,
326
411
  extensionName,
327
412
  scopeListOrRequest,
328
- possibleSessions
413
+ possibleSessions,
414
+ options
329
415
  );
330
- } catch (_) {}
416
+ } catch (error) {
417
+ if (!isCancellationError(error)) {
418
+ throw error;
419
+ }
420
+ }
331
421
  } else {
332
- const approved = await this.showGetSessionPrompt(provider, possibleSessions[0].account.label, extensionId, extensionName);
422
+ const approved = await this.showGetSessionPrompt(
423
+ provider,
424
+ possibleSessions[0].account.label,
425
+ extensionId,
426
+ extensionName,
427
+ requestKey
428
+ );
333
429
  if (approved) {
334
430
  session = possibleSessions[0];
335
431
  }
@@ -342,6 +438,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
342
438
  extensionId,
343
439
  extensionName
344
440
  );
441
+ this.removeAccessRequest(provider.id, requestKey);
345
442
  }
346
443
  }
347
444
  requestSessionAccess(
@@ -349,35 +446,39 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
349
446
  extensionId,
350
447
  extensionName,
351
448
  scopeListOrRequest,
352
- possibleSessions
449
+ possibleSessions,
450
+ options = {}
353
451
  ) {
354
452
  const providerRequests = this._sessionAccessRequestItems.get(providerId) || {};
355
- const hasExistingRequest = providerRequests[extensionId];
453
+ const requestKey = this.accessRequestKey(extensionId, scopeListOrRequest, options);
454
+ const hasExistingRequest = providerRequests[requestKey];
356
455
  if (hasExistingRequest) {
357
456
  return;
358
457
  }
359
458
  const provider = this._authenticationService.getProvider(providerId);
459
+ const commandId = `${providerId}:${extensionId}:access:${generateUuid()}`;
360
460
  const menuItem = ( MenuRegistry.appendMenuItem(MenuId.AccountsContext, {
361
461
  group: "3_accessRequests",
362
462
  command: {
363
- id: `${providerId}${extensionId}Access`,
364
- title: ( localize(21685, "Grant access to {0} for {1}... (1)", provider.label, extensionName))
463
+ id: commandId,
464
+ title: ( localize(24260, "Grant access to {0} for {1}... (1)", provider.label, extensionName))
365
465
  }
366
466
  }));
367
467
  const accessCommand = CommandsRegistry.registerCommand({
368
- id: `${providerId}${extensionId}Access`,
369
- handler: async accessor => {
370
- this.completeSessionAccessRequest(provider, extensionId, extensionName, scopeListOrRequest);
371
- }
468
+ id: commandId,
469
+ handler: () => this.completeSessionAccessRequest(provider, requestKey, extensionName)
372
470
  });
373
- providerRequests[extensionId] = {
374
- possibleSessions,
471
+ providerRequests[requestKey] = {
472
+ extensionId,
473
+ scopeListOrRequest,
474
+ options,
475
+ possibleSessions: [...possibleSessions],
375
476
  disposables: [menuItem, accessCommand]
376
477
  };
377
478
  this._sessionAccessRequestItems.set(providerId, providerRequests);
378
479
  this.updateBadgeCount();
379
480
  }
380
- async requestNewSession(providerId, scopeListOrRequest, extensionId, extensionName) {
481
+ async requestNewSession(providerId, scopeListOrRequest, extensionId, extensionName, options = {}) {
381
482
  if (!this._authenticationService.isAuthenticationProviderRegistered(providerId)) {
382
483
  await ( new Promise((resolve, _) => {
383
484
  const dispose = this._authenticationService.onDidRegisterAuthenticationProvider(e => {
@@ -394,54 +495,46 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
394
495
  } catch (_e) {
395
496
  return;
396
497
  }
397
- const providerRequests = this._signInRequestItems.get(providerId);
398
- const signInRequestKey = isAuthenticationWwwAuthenticateRequest(scopeListOrRequest) ? `${scopeListOrRequest.wwwAuthenticate}:${scopeListOrRequest.fallbackScopes?.join(SCOPESLIST_SEPARATOR) ?? ""}` : `${scopeListOrRequest.join(SCOPESLIST_SEPARATOR)}`;
399
- const extensionHasExistingRequest = providerRequests && providerRequests[signInRequestKey] && providerRequests[signInRequestKey].requestingExtensionIds.includes(extensionId);
400
- if (extensionHasExistingRequest) {
498
+ const providerRequests = this._signInRequestItems.get(providerId) ?? {};
499
+ const signInRequestKey = getAuthenticationSessionRequestKey(scopeListOrRequest, options);
500
+ if (providerRequests[signInRequestKey]?.requestingExtensionIds.includes(extensionId)) {
401
501
  return;
402
502
  }
403
- const commandId = `${providerId}:${extensionId}:signIn${( Object.keys(providerRequests || [])).length}`;
503
+ const request = providerRequests[signInRequestKey] ?? {
504
+ scopeListOrRequest,
505
+ options,
506
+ disposables: [],
507
+ requestingExtensionIds: []
508
+ };
509
+ const commandId = `${providerId}:${extensionId}:signIn:${generateUuid()}`;
404
510
  const menuItem = ( MenuRegistry.appendMenuItem(MenuId.AccountsContext, {
405
511
  group: "2_signInRequests",
406
512
  command: {
407
513
  id: commandId,
408
- title: ( localize(21686, "Sign in with {0} to use {1} (1)", provider.label, extensionName))
514
+ title: ( localize(24261, "Sign in with {0} to use {1} (1)", provider.label, extensionName))
409
515
  }
410
516
  }));
411
517
  const signInCommand = CommandsRegistry.registerCommand({
412
518
  id: commandId,
413
- handler: async accessor => {
414
- const authenticationService = accessor.get(IAuthenticationService);
415
- const session = await authenticationService.createSession(providerId, scopeListOrRequest);
519
+ handler: async () => {
520
+ const session = await this._authenticationService.createSession(providerId, scopeListOrRequest, options);
416
521
  this._authenticationAccessService.updateAllowedExtensions(providerId, session.account.label, [{
417
522
  id: extensionId,
418
523
  name: extensionName,
419
524
  allowed: true
420
525
  }]);
421
526
  this._updateAccountAndSessionPreferences(providerId, extensionId, session);
527
+ this.completeSignInRequest(providerId, providerRequests, signInRequestKey, request);
528
+ void this.updateNewSessionRequests(providerId, [session]).catch(onUnexpectedError);
422
529
  }
423
530
  });
424
- if (providerRequests) {
425
- const existingRequest = providerRequests[signInRequestKey] || {
426
- disposables: [],
427
- requestingExtensionIds: []
428
- };
429
- providerRequests[signInRequestKey] = {
430
- disposables: [...existingRequest.disposables, menuItem, signInCommand],
431
- requestingExtensionIds: [...existingRequest.requestingExtensionIds, extensionId]
432
- };
433
- this._signInRequestItems.set(providerId, providerRequests);
434
- } else {
435
- this._signInRequestItems.set(providerId, {
436
- [signInRequestKey]: {
437
- disposables: [menuItem, signInCommand],
438
- requestingExtensionIds: [extensionId]
439
- }
440
- });
441
- }
531
+ request.disposables.push(menuItem, signInCommand);
532
+ request.requestingExtensionIds.push(extensionId);
533
+ providerRequests[signInRequestKey] = request;
534
+ this._signInRequestItems.set(providerId, providerRequests);
442
535
  this.updateBadgeCount();
443
536
  }
444
537
  };
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));
538
+ 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)), ( __param(8, ILogService))], AuthenticationExtensionsService));
446
539
 
447
540
  export { AuthenticationExtensionsService };