@codingame/monaco-vscode-mcp-service-override 23.2.2 → 24.1.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.
Files changed (67) hide show
  1. package/index.js +19 -19
  2. package/package.json +2 -15
  3. package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.d.ts +1 -1
  4. package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.js +2 -2
  5. package/vscode/src/vs/platform/mcp/common/mcpGalleryService.d.ts +2 -2
  6. package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +4 -8
  7. package/vscode/src/vs/platform/mcp/common/mcpManagementIpc.d.ts +2 -2
  8. package/vscode/src/vs/platform/mcp/common/mcpManagementService.d.ts +2 -2
  9. package/vscode/src/vs/platform/mcp/common/mcpManagementService.js +3 -3
  10. package/vscode/src/vs/platform/mcp/common/mcpResourceScannerService.d.ts +2 -2
  11. package/vscode/src/vs/platform/mcp/common/mcpResourceScannerService.js +1 -1
  12. package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +8 -8
  13. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.d.ts +3 -2
  14. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +43 -27
  15. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +70 -70
  16. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpDiscovery.js +1 -1
  17. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.d.ts +10 -4
  18. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js +198 -35
  19. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +21 -21
  20. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpMigration.js +9 -9
  21. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.d.ts +24 -5
  22. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.js +178 -51
  23. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.d.ts +1 -1
  24. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.js +35 -35
  25. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.d.ts +2 -2
  26. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +37 -37
  27. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.js +2 -2
  28. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.js +5 -5
  29. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.d.ts +1 -1
  30. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.js +7 -7
  31. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.d.ts +3 -3
  32. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +26 -26
  33. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.d.ts +3 -3
  34. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +12 -12
  35. package/vscode/src/vs/workbench/contrib/mcp/browser/openPanelChatAndGetWidget.d.ts +1 -1
  36. package/vscode/src/vs/workbench/contrib/mcp/browser/openPanelChatAndGetWidget.js +1 -1
  37. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +5 -5
  38. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/installedMcpServersDiscovery.js +1 -1
  39. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.d.ts +1 -1
  40. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +2 -2
  41. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.d.ts +1 -1
  42. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.js +1 -1
  43. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpRemoteDiscovery.js +1 -1
  44. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceMcpDiscoveryAdapter.js +1 -1
  45. package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.js +4 -4
  46. package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.js +4 -2
  47. package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +20 -14
  48. package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +14 -14
  49. package/vscode/src/vs/workbench/contrib/mcp/common/mcpResourceFilesystem.d.ts +3 -1
  50. package/vscode/src/vs/workbench/contrib/mcp/common/mcpResourceFilesystem.js +19 -3
  51. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.js +2 -2
  52. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.d.ts +1 -1
  53. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js +21 -20
  54. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.d.ts +6 -2
  55. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.js +79 -47
  56. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.d.ts +3 -1
  57. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +8 -6
  58. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.d.ts +47 -2
  59. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.js +229 -14
  60. package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.js +2 -2
  61. package/vscode/src/vs/workbench/contrib/mcp/common/mcpTaskManager.d.ts +68 -0
  62. package/vscode/src/vs/workbench/contrib/mcp/common/mcpTaskManager.js +168 -0
  63. package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +10 -10
  64. package/vscode/src/vs/workbench/services/mcp/browser/mcpGalleryManifestService.d.ts +17 -2
  65. package/vscode/src/vs/workbench/services/mcp/browser/mcpGalleryManifestService.js +60 -10
  66. package/vscode/src/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.d.ts +1 -1
  67. package/vscode/src/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.js +2 -2
@@ -2,42 +2,89 @@
2
2
  import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
3
  import { Action } from '@codingame/monaco-vscode-api/vscode/vs/base/common/actions';
4
4
  import { assertNever } from '@codingame/monaco-vscode-api/vscode/vs/base/common/assert';
5
+ import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
6
+ import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
5
7
  import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
8
+ import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
9
+ import { isDefined } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
10
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
6
11
  import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
7
12
  import '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification';
8
13
  import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
14
+ import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
9
15
  import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
10
- import { ChatElicitationRequestPart } from '@codingame/monaco-vscode-dc3fa21d-a483-5b99-a7ab-173235644a34-common/vscode/vs/workbench/contrib/chat/browser/chatElicitationRequestPart';
11
- import { ChatModel } from '@codingame/monaco-vscode-2339d6ac-d6bb-53cd-95ee-81911735d1c7-common/vscode/vs/workbench/contrib/chat/common/chatModel';
16
+ import { ChatElicitationRequestPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatElicitationRequestPart';
17
+ import { ChatModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModel';
18
+ import { ElicitationState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService';
12
19
  import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service';
13
20
  import { LocalChatSessionUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatUri';
14
- import { mcpServerToSourceData } from '@codingame/monaco-vscode-08fd81c0-7fd8-5f7c-9776-f918dd532714-common/vscode/vs/workbench/contrib/mcp/common/mcpTypesUtils';
21
+ import { MpcResponseError, ElicitationKind, McpConnectionState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
22
+ import { mcpServerToSourceData } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypesUtils';
23
+ import { MCP } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/modelContextProtocol';
15
24
  import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
25
+ import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
16
26
 
17
- const noneItem = { id: undefined, label: ( localize(8677, 'None')), description: ( localize(8678, 'No selection')), alwaysShow: true };
27
+ const noneItem = { id: undefined, label: ( localize(8803, 'None')), description: ( localize(8804, 'No selection')), alwaysShow: true };
28
+ function isFormElicitation(params) {
29
+ return params.mode === 'form' || (params.mode === undefined && !!params.requestedSchema);
30
+ }
31
+ function isUrlElicitation(params) {
32
+ return params.mode === 'url';
33
+ }
34
+ function isLegacyTitledEnumSchema(schema) {
35
+ const cast = schema;
36
+ return cast.type === 'string' && Array.isArray(cast.enum) && Array.isArray(cast.enumNames);
37
+ }
38
+ function isUntitledEnumSchema(schema) {
39
+ const cast = schema;
40
+ return cast.type === 'string' && Array.isArray(cast.enum);
41
+ }
42
+ function isTitledSingleEnumSchema(schema) {
43
+ const cast = schema;
44
+ return cast.type === 'string' && Array.isArray(cast.oneOf);
45
+ }
46
+ function isUntitledMultiEnumSchema(schema) {
47
+ const cast = schema;
48
+ return cast.type === 'array' && !!cast.items?.enum;
49
+ }
50
+ function isTitledMultiEnumSchema(schema) {
51
+ const cast = schema;
52
+ return cast.type === 'array' && !!cast.items?.anyOf;
53
+ }
18
54
  let McpElicitationService = class McpElicitationService {
19
- constructor(_notificationService, _quickInputService, _chatService) {
55
+ constructor(_notificationService, _quickInputService, _chatService, _openerService) {
20
56
  this._notificationService = _notificationService;
21
57
  this._quickInputService = _quickInputService;
22
58
  this._chatService = _chatService;
59
+ this._openerService = _openerService;
23
60
  }
24
61
  elicit(server, context, elicitation, token) {
62
+ if (isFormElicitation(elicitation)) {
63
+ return this._elicitForm(server, context, elicitation, token);
64
+ }
65
+ else if (isUrlElicitation(elicitation)) {
66
+ return this._elicitUrl(server, context, elicitation, token);
67
+ }
68
+ else {
69
+ return Promise.reject(( new MpcResponseError('Unsupported elicitation type', MCP.INVALID_PARAMS, undefined)));
70
+ }
71
+ }
72
+ async _elicitForm(server, context, elicitation, token) {
25
73
  const store = ( new DisposableStore());
26
- return ( new Promise(resolve => {
74
+ const value = await ( new Promise(resolve => {
27
75
  const chatModel = context?.chatSessionId && this._chatService.getSession(LocalChatSessionUri.forSession(context.chatSessionId));
28
76
  if (chatModel instanceof ChatModel) {
29
77
  const request = chatModel.getRequests().at(-1);
30
78
  if (request) {
31
- const part = ( new ChatElicitationRequestPart(( localize(8679, 'Request for Input')), elicitation.message, ( localize(8680, "{0} (MCP Server)", server.definition.label)), ( localize(8681, 'Respond')), ( localize(8682, 'Cancel')), async () => {
32
- const p = this._doElicit(elicitation, token);
79
+ const part = ( new ChatElicitationRequestPart(( localize(8805, 'Request for Input')), elicitation.message, ( localize(8806, "{0} (MCP Server)", server.definition.label)), ( localize(8807, 'Respond')), ( localize(8808, 'Cancel')), async () => {
80
+ const p = this._doElicitForm(elicitation, token);
33
81
  resolve(p);
34
82
  const result = await p;
35
- part.state = result.action === 'accept' ? 'accepted' : 'rejected';
36
83
  part.acceptedResult = result.content;
84
+ return result.action === 'accept' ? ElicitationState.Accepted : ElicitationState.Rejected;
37
85
  }, () => {
38
86
  resolve({ action: 'decline' });
39
- part.state = 'rejected';
40
- return Promise.resolve();
87
+ return Promise.resolve(ElicitationState.Rejected);
41
88
  }, mcpServerToSourceData(server)));
42
89
  chatModel.acceptResponseProgress(request, part);
43
90
  }
@@ -45,19 +92,93 @@ let McpElicitationService = class McpElicitationService {
45
92
  else {
46
93
  const handle = this._notificationService.notify({
47
94
  message: elicitation.message,
48
- source: ( localize(8683, 'MCP Server ({0})', server.definition.label)),
95
+ source: ( localize(8809, 'MCP Server ({0})', server.definition.label)),
96
+ severity: Severity.Info,
97
+ actions: {
98
+ primary: [store.add(( new Action('mcp.elicit.give', ( localize(8810, 'Respond')), undefined, true, () => resolve(this._doElicitForm(elicitation, token)))))],
99
+ secondary: [store.add(( new Action('mcp.elicit.cancel', ( localize(8811, 'Cancel')), undefined, true, () => resolve({ action: 'decline' }))))],
100
+ }
101
+ });
102
+ store.add(handle.onDidClose(() => resolve({ action: 'cancel' })));
103
+ store.add(token.onCancellationRequested(() => resolve({ action: 'cancel' })));
104
+ }
105
+ })).finally(() => store.dispose());
106
+ return { kind: ElicitationKind.Form, value, dispose: () => { } };
107
+ }
108
+ async _elicitUrl(server, context, elicitation, token) {
109
+ const promiseStore = ( new DisposableStore());
110
+ const completePromise = ( new Promise((resolve, reject) => {
111
+ promiseStore.add(token.onCancellationRequested(() => reject(( new CancellationError()))));
112
+ promiseStore.add(autorun(reader => {
113
+ const cnx = server.connection.read(reader);
114
+ const handler = cnx?.handler.read(reader);
115
+ if (handler) {
116
+ reader.store.add(handler.onDidReceiveElicitationCompleteNotification(e => {
117
+ if (e.params.elicitationId === elicitation.elicitationId) {
118
+ resolve();
119
+ }
120
+ }));
121
+ }
122
+ else if (!McpConnectionState.isRunning(server.connectionState.read(reader))) {
123
+ reject(( new CancellationError()));
124
+ }
125
+ }));
126
+ })).finally(() => promiseStore.dispose());
127
+ const store = ( new DisposableStore());
128
+ const value = await ( new Promise(resolve => {
129
+ const chatModel = context?.chatSessionId && this._chatService.getSession(LocalChatSessionUri.forSession(context.chatSessionId));
130
+ if (chatModel instanceof ChatModel) {
131
+ const request = chatModel.getRequests().at(-1);
132
+ if (request) {
133
+ const part = ( new ChatElicitationRequestPart(( localize(8812, 'Authorization Required')), ( new MarkdownString()).appendText(elicitation.message)
134
+ .appendMarkdown('\n\n' + ( localize(8813, 'Open this URL?')))
135
+ .appendCodeblock('', elicitation.url), ( localize(8806, "{0} (MCP Server)", server.definition.label)), ( localize(8814, 'Open {0}', ( URI.parse(elicitation.url)).authority)), ( localize(8808, 'Cancel')), async () => {
136
+ const result = await this._doElicitUrl(elicitation, token);
137
+ resolve(result);
138
+ completePromise.then(() => part.hide());
139
+ return result.action === 'accept' ? ElicitationState.Accepted : ElicitationState.Rejected;
140
+ }, () => {
141
+ resolve({ action: 'decline' });
142
+ return Promise.resolve(ElicitationState.Rejected);
143
+ }, mcpServerToSourceData(server)));
144
+ chatModel.acceptResponseProgress(request, part);
145
+ }
146
+ }
147
+ else {
148
+ const handle = this._notificationService.notify({
149
+ message: elicitation.message + ' ' + ( localize(8815, 'This will open {0}', elicitation.url)),
150
+ source: ( localize(8809, 'MCP Server ({0})', server.definition.label)),
49
151
  severity: Severity.Info,
50
152
  actions: {
51
- primary: [store.add(( new Action('mcp.elicit.give', ( localize(8684, 'Respond')), undefined, true, () => resolve(this._doElicit(elicitation, token)))))],
52
- secondary: [store.add(( new Action('mcp.elicit.cancel', ( localize(8685, 'Cancel')), undefined, true, () => resolve({ action: 'decline' }))))],
153
+ primary: [store.add(( new Action('mcp.elicit.url.open2', ( localize(8816, 'Open URL')), undefined, true, () => resolve(this._doElicitUrl(elicitation, token)))))],
154
+ secondary: [store.add(( new Action('mcp.elicit.cancel', ( localize(8811, 'Cancel')), undefined, true, () => resolve({ action: 'decline' }))))],
53
155
  }
54
156
  });
55
157
  store.add(handle.onDidClose(() => resolve({ action: 'cancel' })));
56
158
  store.add(token.onCancellationRequested(() => resolve({ action: 'cancel' })));
57
159
  }
58
160
  })).finally(() => store.dispose());
161
+ return {
162
+ kind: ElicitationKind.URL,
163
+ value,
164
+ wait: completePromise,
165
+ dispose: () => promiseStore.dispose(),
166
+ };
167
+ }
168
+ async _doElicitUrl(elicitation, token) {
169
+ if (token.isCancellationRequested) {
170
+ return { action: 'cancel' };
171
+ }
172
+ try {
173
+ if (await this._openerService.open(elicitation.url, { allowCommands: false })) {
174
+ return { action: 'accept' };
175
+ }
176
+ }
177
+ catch {
178
+ }
179
+ return { action: 'decline' };
59
180
  }
60
- async _doElicit(elicitation, token) {
181
+ async _doElicitForm(elicitation, token) {
61
182
  const quickPick = this._quickInputService.createQuickPick();
62
183
  const store = ( new DisposableStore());
63
184
  try {
@@ -81,13 +202,25 @@ let McpElicitationService = class McpElicitationService {
81
202
  quickPick.buttons = i > 0 ? [this._quickInputService.backButton] : [];
82
203
  let result;
83
204
  if (schema.type === 'boolean') {
84
- result = await this._handleEnumField(quickPick, { ...schema, type: 'string', enum: ['true', 'false'], default: schema.default ? String(schema.default) : undefined }, isRequired, store, token);
205
+ result = await this._handleEnumField(quickPick, { enum: [{ const: 'true' }, { const: 'false' }], default: schema.default ? String(schema.default) : undefined }, isRequired, store, token);
85
206
  if (result.type === 'value') {
86
207
  result.value = result.value === 'true' ? true : false;
87
208
  }
88
209
  }
89
- else if (schema.type === 'string' && 'enum' in schema) {
90
- result = await this._handleEnumField(quickPick, schema, isRequired, store, token);
210
+ else if (isLegacyTitledEnumSchema(schema)) {
211
+ result = await this._handleEnumField(quickPick, { enum: ( schema.enum.map((v, i) => ({ const: v, title: schema.enumNames[i] }))), default: schema.default }, isRequired, store, token);
212
+ }
213
+ else if (isUntitledEnumSchema(schema)) {
214
+ result = await this._handleEnumField(quickPick, { enum: ( schema.enum.map(v => ({ const: v }))), default: schema.default }, isRequired, store, token);
215
+ }
216
+ else if (isTitledSingleEnumSchema(schema)) {
217
+ result = await this._handleEnumField(quickPick, { enum: schema.oneOf, default: schema.default }, isRequired, store, token);
218
+ }
219
+ else if (isTitledMultiEnumSchema(schema)) {
220
+ result = await this._handleMultiEnumField(quickPick, { enum: schema.items.anyOf, default: schema.default }, isRequired, store, token);
221
+ }
222
+ else if (isUntitledMultiEnumSchema(schema)) {
223
+ result = await this._handleMultiEnumField(quickPick, { enum: ( schema.items.enum.map(v => ({ const: v }))), default: schema.default }, isRequired, store, token);
91
224
  }
92
225
  else {
93
226
  result = await this._handleInputField(quickPick, schema, isRequired, store, token);
@@ -123,21 +256,21 @@ let McpElicitationService = class McpElicitationService {
123
256
  _getFieldPlaceholder(schema, required) {
124
257
  let placeholder = schema.description || '';
125
258
  if (!required) {
126
- placeholder = placeholder ? `${placeholder} (${( localize(8686, 'Optional'))})` : ( localize(8686, 'Optional'));
259
+ placeholder = placeholder ? `${placeholder} (${( localize(8817, 'Optional'))})` : ( localize(8817, 'Optional'));
127
260
  }
128
261
  return placeholder;
129
262
  }
130
263
  async _handleEnumField(quickPick, schema, required, store, token) {
131
- const items = ( schema.enum.map((value, index) => ({
264
+ const items = ( schema.enum.map(({ const: value, title }) => ({
132
265
  id: value,
133
266
  label: value,
134
- description: schema.enumNames?.[index],
267
+ description: title,
135
268
  })));
136
269
  if (!required) {
137
270
  items.push(noneItem);
138
271
  }
139
- quickPick.items = items;
140
272
  quickPick.canSelectMany = false;
273
+ quickPick.items = items;
141
274
  if (schema.default !== undefined) {
142
275
  quickPick.activeItems = items.filter(item => item.id === schema.default);
143
276
  }
@@ -154,6 +287,35 @@ let McpElicitationService = class McpElicitationService {
154
287
  quickPick.show();
155
288
  }));
156
289
  }
290
+ async _handleMultiEnumField(quickPick, schema, required, store, token) {
291
+ const items = ( schema.enum.map(({ const: value, title }) => ({
292
+ id: value,
293
+ label: value,
294
+ description: title,
295
+ picked: !!schema.default?.includes(value),
296
+ pickable: true,
297
+ })));
298
+ if (!required) {
299
+ items.push(noneItem);
300
+ }
301
+ quickPick.canSelectMany = true;
302
+ quickPick.items = items;
303
+ return ( new Promise(resolve => {
304
+ store.add(token.onCancellationRequested(() => resolve({ type: 'cancel' })));
305
+ store.add(quickPick.onDidAccept(() => {
306
+ const selected = quickPick.selectedItems[0];
307
+ if (selected.id === undefined) {
308
+ resolve({ type: 'value', value: undefined });
309
+ }
310
+ else {
311
+ resolve({ type: 'value', value: ( quickPick.selectedItems.map(i => i.id)).filter(isDefined) });
312
+ }
313
+ }));
314
+ store.add(quickPick.onDidTriggerButton(() => resolve({ type: 'back' })));
315
+ store.add(quickPick.onDidHide(() => resolve({ type: 'cancel' })));
316
+ quickPick.show();
317
+ }));
318
+ }
157
319
  async _handleInputField(quickPick, schema, required, store, token) {
158
320
  quickPick.canSelectMany = false;
159
321
  const updateItems = () => {
@@ -168,7 +330,7 @@ let McpElicitationService = class McpElicitationService {
168
330
  else {
169
331
  quickPick.validationMessage = '';
170
332
  if (schema.default) {
171
- items.push({ id: '$default', label: `${schema.default}`, description: ( localize(8687, 'Default value')) });
333
+ items.push({ id: '$default', label: `${schema.default}`, description: ( localize(8818, 'Default value')) });
172
334
  }
173
335
  }
174
336
  if (quickPick.validationMessage) {
@@ -220,10 +382,10 @@ let McpElicitationService = class McpElicitationService {
220
382
  }
221
383
  _validateString(value, schema) {
222
384
  if (schema.minLength && value.length < schema.minLength) {
223
- return { isValid: false, message: ( localize(8688, 'Minimum length is {0}', schema.minLength)) };
385
+ return { isValid: false, message: ( localize(8819, 'Minimum length is {0}', schema.minLength)) };
224
386
  }
225
387
  if (schema.maxLength && value.length > schema.maxLength) {
226
- return { isValid: false, message: ( localize(8689, 'Maximum length is {0}', schema.maxLength)) };
388
+ return { isValid: false, message: ( localize(8820, 'Maximum length is {0}', schema.maxLength)) };
227
389
  }
228
390
  if (schema.format) {
229
391
  const formatValid = this._validateStringFormat(value, schema.format);
@@ -238,29 +400,29 @@ let McpElicitationService = class McpElicitationService {
238
400
  case 'email':
239
401
  return value.includes('@')
240
402
  ? { isValid: true }
241
- : { isValid: false, message: ( localize(8690, 'Please enter a valid email address')) };
403
+ : { isValid: false, message: ( localize(8821, 'Please enter a valid email address')) };
242
404
  case 'uri':
243
405
  if (URL.canParse(value)) {
244
406
  return { isValid: true };
245
407
  }
246
408
  else {
247
- return { isValid: false, message: ( localize(8691, 'Please enter a valid URI')) };
409
+ return { isValid: false, message: ( localize(8822, 'Please enter a valid URI')) };
248
410
  }
249
411
  case 'date': {
250
412
  const dateRegex = /^\d{4}-\d{2}-\d{2}$/;
251
413
  if (!dateRegex.test(value)) {
252
- return { isValid: false, message: ( localize(8692, 'Please enter a valid date (YYYY-MM-DD)')) };
414
+ return { isValid: false, message: ( localize(8823, 'Please enter a valid date (YYYY-MM-DD)')) };
253
415
  }
254
416
  const date = ( new Date(value));
255
417
  return !isNaN(date.getTime())
256
418
  ? { isValid: true }
257
- : { isValid: false, message: ( localize(8692, 'Please enter a valid date (YYYY-MM-DD)')) };
419
+ : { isValid: false, message: ( localize(8823, 'Please enter a valid date (YYYY-MM-DD)')) };
258
420
  }
259
421
  case 'date-time': {
260
422
  const dateTime = ( new Date(value));
261
423
  return !isNaN(dateTime.getTime())
262
424
  ? { isValid: true }
263
- : { isValid: false, message: ( localize(8693, 'Please enter a valid date-time')) };
425
+ : { isValid: false, message: ( localize(8824, 'Please enter a valid date-time')) };
264
426
  }
265
427
  default:
266
428
  return { isValid: true };
@@ -269,16 +431,16 @@ let McpElicitationService = class McpElicitationService {
269
431
  _validateNumber(value, schema) {
270
432
  const parsed = Number(value);
271
433
  if (isNaN(parsed)) {
272
- return { isValid: false, message: ( localize(8694, 'Please enter a valid number')) };
434
+ return { isValid: false, message: ( localize(8825, 'Please enter a valid number')) };
273
435
  }
274
436
  if (schema.type === 'integer' && !Number.isInteger(parsed)) {
275
- return { isValid: false, message: ( localize(8695, 'Please enter a valid integer')) };
437
+ return { isValid: false, message: ( localize(8826, 'Please enter a valid integer')) };
276
438
  }
277
439
  if (schema.minimum !== undefined && parsed < schema.minimum) {
278
- return { isValid: false, message: ( localize(8696, 'Minimum value is {0}', schema.minimum)) };
440
+ return { isValid: false, message: ( localize(8827, 'Minimum value is {0}', schema.minimum)) };
279
441
  }
280
442
  if (schema.maximum !== undefined && parsed > schema.maximum) {
281
- return { isValid: false, message: ( localize(8697, 'Maximum value is {0}', schema.maximum)) };
443
+ return { isValid: false, message: ( localize(8828, 'Maximum value is {0}', schema.maximum)) };
282
444
  }
283
445
  return { isValid: true, parsedValue: parsed };
284
446
  }
@@ -286,7 +448,8 @@ let McpElicitationService = class McpElicitationService {
286
448
  McpElicitationService = ( __decorate([
287
449
  ( __param(0, INotificationService)),
288
450
  ( __param(1, IQuickInputService)),
289
- ( __param(2, IChatService))
451
+ ( __param(2, IChatService)),
452
+ ( __param(3, IOpenerService))
290
453
  ], McpElicitationService));
291
454
 
292
455
  export { McpElicitationService };
@@ -2,7 +2,7 @@
2
2
  import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
3
  import { computeLevenshteinDistance } from '@codingame/monaco-vscode-api/vscode/vs/base/common/diff/diff';
4
4
  import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
5
- import { MarkdownString, markdownCommandLink } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
5
+ import { MarkdownString, createMarkdownCommandLink } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
6
6
  import { parseTree, findNodeAtLocation } from '@codingame/monaco-vscode-api/vscode/vs/base/common/json';
7
7
  import { Disposable, MutableDisposable, dispose, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
8
8
  import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
@@ -13,8 +13,8 @@ import { MarkerSeverity } from '@codingame/monaco-vscode-api/vscode/vs/platform/
13
13
  import { IMarkerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers.service';
14
14
  import { IConfigurationResolverService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/configurationResolver/common/configurationResolver.service';
15
15
  import { ConfigurationResolverExpression } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/configurationResolver/common/configurationResolverExpression';
16
- import { McpCommandIds } from '@codingame/monaco-vscode-08fd81c0-7fd8-5f7c-9776-f918dd532714-common/vscode/vs/workbench/contrib/mcp/common/mcpCommandIds';
17
- import { mcpConfigurationSection } from '@codingame/monaco-vscode-dc3fa21d-a483-5b99-a7ab-173235644a34-common/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration';
16
+ import { McpCommandIds } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpCommandIds';
17
+ import { mcpConfigurationSection } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration';
18
18
  import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
19
19
  import { McpConnectionState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
20
20
  import { IMcpWorkbenchService, IMcpService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service';
@@ -101,7 +101,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
101
101
  diagnostics.push({
102
102
  severity: MarkerSeverity.Warning,
103
103
  message: ( localize(
104
- 8698,
104
+ 8829,
105
105
  'Variable `{0}` not found, did you mean ${{1}}?',
106
106
  name,
107
107
  getClosestMatchingVariable(name) + (arg ? `:${arg}` : '')
@@ -162,14 +162,14 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
162
162
  range,
163
163
  command: {
164
164
  id: McpCommandIds.ShowOutput,
165
- title: '$(error) ' + ( localize(8699, 'Error')),
165
+ title: '$(error) ' + ( localize(8830, 'Error')),
166
166
  arguments: [server.definition.id],
167
167
  },
168
168
  }, {
169
169
  range,
170
170
  command: {
171
171
  id: McpCommandIds.RestartServer,
172
- title: ( localize(8700, "Restart")),
172
+ title: ( localize(8831, "Restart")),
173
173
  arguments: [server.definition.id, { autoTrustChanges: true }],
174
174
  },
175
175
  });
@@ -178,7 +178,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
178
178
  range,
179
179
  command: {
180
180
  id: McpCommandIds.RestartServer,
181
- title: ( localize(8701, "Debug")),
181
+ title: ( localize(8832, "Debug")),
182
182
  arguments: [server.definition.id, { debug: true, autoTrustChanges: true }],
183
183
  },
184
184
  });
@@ -189,14 +189,14 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
189
189
  range,
190
190
  command: {
191
191
  id: McpCommandIds.ShowOutput,
192
- title: '$(loading~spin) ' + ( localize(8702, 'Starting')),
192
+ title: '$(loading~spin) ' + ( localize(8833, 'Starting')),
193
193
  arguments: [server.definition.id],
194
194
  },
195
195
  }, {
196
196
  range,
197
197
  command: {
198
198
  id: McpCommandIds.StopServer,
199
- title: ( localize(8703, "Cancel")),
199
+ title: ( localize(8834, "Cancel")),
200
200
  arguments: [server.definition.id],
201
201
  },
202
202
  });
@@ -206,21 +206,21 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
206
206
  range,
207
207
  command: {
208
208
  id: McpCommandIds.ShowOutput,
209
- title: '$(check) ' + ( localize(8704, 'Running')),
209
+ title: '$(check) ' + ( localize(8835, 'Running')),
210
210
  arguments: [server.definition.id],
211
211
  },
212
212
  }, {
213
213
  range,
214
214
  command: {
215
215
  id: McpCommandIds.StopServer,
216
- title: ( localize(8705, "Stop")),
216
+ title: ( localize(8836, "Stop")),
217
217
  arguments: [server.definition.id],
218
218
  },
219
219
  }, {
220
220
  range,
221
221
  command: {
222
222
  id: McpCommandIds.RestartServer,
223
- title: ( localize(8700, "Restart")),
223
+ title: ( localize(8831, "Restart")),
224
224
  arguments: [server.definition.id, { autoTrustChanges: true }],
225
225
  },
226
226
  });
@@ -229,7 +229,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
229
229
  range,
230
230
  command: {
231
231
  id: McpCommandIds.RestartServer,
232
- title: ( localize(8701, "Debug")),
232
+ title: ( localize(8832, "Debug")),
233
233
  arguments: [server.definition.id, { autoTrustChanges: true, debug: true }],
234
234
  },
235
235
  });
@@ -240,7 +240,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
240
240
  range,
241
241
  command: {
242
242
  id: McpCommandIds.StartServer,
243
- title: '$(debug-start) ' + ( localize(8706, "Start")),
243
+ title: '$(debug-start) ' + ( localize(8837, "Start")),
244
244
  arguments: [server.definition.id, { autoTrustChanges: true }],
245
245
  },
246
246
  });
@@ -249,7 +249,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
249
249
  range,
250
250
  command: {
251
251
  id: McpCommandIds.StartServer,
252
- title: ( localize(8701, "Debug")),
252
+ title: ( localize(8832, "Debug")),
253
253
  arguments: [server.definition.id, { autoTrustChanges: true, debug: true }],
254
254
  },
255
255
  });
@@ -262,7 +262,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
262
262
  range,
263
263
  command: {
264
264
  id: '',
265
- title: ( localize(8707, '{0} tools', toolCount)),
265
+ title: ( localize(8838, '{0} tools', toolCount)),
266
266
  }
267
267
  });
268
268
  }
@@ -272,7 +272,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
272
272
  range,
273
273
  command: {
274
274
  id: McpCommandIds.StartPromptForServer,
275
- title: ( localize(8708, '{0} prompts', promptCount)),
275
+ title: ( localize(8839, '{0} prompts', promptCount)),
276
276
  arguments: [server],
277
277
  }
278
278
  });
@@ -281,7 +281,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
281
281
  range,
282
282
  command: {
283
283
  id: McpCommandIds.ServerOptions,
284
- title: ( localize(8709, 'More...')),
284
+ title: ( localize(8840, 'More...')),
285
285
  arguments: [server.definition.id],
286
286
  }
287
287
  });
@@ -347,9 +347,9 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
347
347
  }
348
348
  function pushAnnotation(savedId, offset, saved) {
349
349
  const tooltip = ( new MarkdownString([
350
- markdownCommandLink({ id: McpCommandIds.EditStoredInput, title: ( localize(8710, 'Edit')), arguments: [savedId, model.uri, mcpConfigurationSection, inConfig.target] }),
351
- markdownCommandLink({ id: McpCommandIds.RemoveStoredInput, title: ( localize(8711, 'Clear')), arguments: [inConfig.scope, savedId] }),
352
- markdownCommandLink({ id: McpCommandIds.RemoveStoredInput, title: ( localize(8712, 'Clear All')), arguments: [inConfig.scope] }),
350
+ createMarkdownCommandLink({ id: McpCommandIds.EditStoredInput, title: ( localize(8841, 'Edit')), arguments: [savedId, model.uri, mcpConfigurationSection, inConfig.target] }),
351
+ createMarkdownCommandLink({ id: McpCommandIds.RemoveStoredInput, title: ( localize(8842, 'Clear')), arguments: [inConfig.scope, savedId] }),
352
+ createMarkdownCommandLink({ id: McpCommandIds.RemoveStoredInput, title: ( localize(8843, 'Clear All')), arguments: [inConfig.scope] }),
353
353
  ].join(' | '), { isTrusted: true }));
354
354
  const hint = {
355
355
  label: '= ' + (saved.input?.type === 'promptString' && saved.input.password ? '*'.repeat(10) : (saved.value || '')),
@@ -3,20 +3,20 @@ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib
3
3
  import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
4
  import { ConfigurationTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
5
5
  import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
6
- import { McpServerType } from '@codingame/monaco-vscode-dc3fa21d-a483-5b99-a7ab-173235644a34-common/vscode/vs/platform/mcp/common/mcpPlatformTypes';
7
- import { mcpConfigurationSection } from '@codingame/monaco-vscode-dc3fa21d-a483-5b99-a7ab-173235644a34-common/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration';
6
+ import { McpServerType } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpPlatformTypes';
7
+ import { mcpConfigurationSection } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration';
8
8
  import { IWorkbenchMcpManagementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.service';
9
9
  import { IUserDataProfileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
10
10
  import { toFileOperationResult, FileOperationResult } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
11
11
  import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
12
- import { parse } from '@codingame/monaco-vscode-dc3fa21d-a483-5b99-a7ab-173235644a34-common/vscode/vs/base/common/jsonc';
12
+ import { parse } from '@codingame/monaco-vscode-api/vscode/vs/base/common/jsonc';
13
13
  import { isObject } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
14
14
  import { IRemoteAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
15
15
  import { IJSONEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/configuration/common/jsonEditing.service';
16
16
  import '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification';
17
17
  import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
18
18
  import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
19
- import { McpCommandIds } from '@codingame/monaco-vscode-08fd81c0-7fd8-5f7c-9776-f918dd532714-common/vscode/vs/workbench/contrib/mcp/common/mcpCommandIds';
19
+ import { McpCommandIds } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpCommandIds';
20
20
  import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
21
21
  import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
22
22
 
@@ -86,19 +86,19 @@ let McpConfigMigrationContribution = class McpConfigMigrationContribution extend
86
86
  showMcpConfigErrorNotification(isRemote) {
87
87
  const message = isRemote
88
88
  ? ( localize(
89
- 8713,
89
+ 8844,
90
90
  'MCP servers should no longer be configured in remote user settings. Use the dedicated MCP configuration instead.'
91
91
  ))
92
92
  : ( localize(
93
- 8714,
93
+ 8845,
94
94
  'MCP servers should no longer be configured in user settings. Use the dedicated MCP configuration instead.'
95
95
  ));
96
96
  const openConfigLabel = isRemote
97
- ? ( localize(8715, 'Open Remote User MCP Configuration'))
98
- : ( localize(8716, 'Open User MCP Configuration'));
97
+ ? ( localize(8846, 'Open Remote User MCP Configuration'))
98
+ : ( localize(8847, 'Open User MCP Configuration'));
99
99
  const commandId = isRemote ? McpCommandIds.OpenRemoteUserMcp : McpCommandIds.OpenUserMcp;
100
100
  this.notificationService.prompt(Severity.Error, message, [{
101
- label: ( localize(8717, 'Update Now')),
101
+ label: ( localize(8848, 'Update Now')),
102
102
  run: async () => {
103
103
  await this.migrateMcpConfig();
104
104
  await this.commandService.executeCommand(commandId);