@codingame/monaco-vscode-chat-service-override 10.1.4 → 11.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.
Files changed (50) hide show
  1. package/chat.js +6 -3
  2. package/package.json +6 -2
  3. package/vscode/src/vs/editor/common/diff/documentDiffProvider.js +8 -0
  4. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +84 -38
  5. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +265 -20
  6. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +20 -39
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +373 -216
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +4 -5
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +1 -1
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -5
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +54 -0
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -7
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +12 -11
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +14 -42
  15. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +82 -50
  16. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +326 -0
  17. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js +448 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +507 -0
  19. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +76 -0
  20. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +4 -4
  21. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorActions.js +109 -0
  22. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorController.js +284 -0
  23. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipantContributions.js +116 -77
  24. package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +100 -9
  25. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +3 -3
  26. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +1 -1
  27. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +7 -9
  28. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +61 -42
  29. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +5 -5
  30. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
  31. package/vscode/src/vs/workbench/contrib/chat/{common → browser}/languageModelToolsService.js +28 -31
  32. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeContributions.js +75 -0
  33. package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.js +120 -1
  34. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +10 -8
  35. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +33 -18
  36. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +1 -1
  37. package/vscode/src/vs/workbench/contrib/chat/common/ignoredFiles.js +21 -0
  38. package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +2 -2
  39. package/vscode/src/vs/workbench/contrib/chat/common/languageModels.js +6 -6
  40. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +68 -47
  41. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.js +250 -0
  42. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
  43. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +7 -8
  44. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +1 -1
  45. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +1 -1
  46. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +3 -3
  47. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +2 -2
  48. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +65 -128
  49. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +0 -170
  50. package/vscode/src/vs/workbench/contrib/chat/browser/chatGettingStarted.js +0 -131
@@ -23,9 +23,9 @@ import { IWorkbenchAssignmentService } from 'vscode/vscode/vs/workbench/services
23
23
  import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
24
24
  import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
25
25
  import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
26
- import { normalizeSerializableChatData, ChatModel, updateRanges, toChatHistoryContent, ChatRequestModel } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatModel';
27
- import { ChatRequestAgentPart, ChatRequestAgentSubcommandPart, chatSubcommandLeader, chatAgentLeader, ChatRequestSlashCommandPart, getPromptText } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
28
- import { ChatRequestParser } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatRequestParser';
26
+ import { normalizeSerializableChatData, ChatModel, updateRanges, toChatHistoryContent, ChatRequestModel } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/common/chatModel';
27
+ import { ChatRequestAgentPart, ChatRequestAgentSubcommandPart, chatSubcommandLeader, chatAgentLeader, ChatRequestSlashCommandPart, getPromptText } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
28
+ import { ChatRequestParser } from '@codingame/monaco-vscode-chat-extensions-notebook-common/vscode/vs/workbench/contrib/chat/common/chatRequestParser';
29
29
  import { ChatServiceTelemetry } from './chatServiceTelemetry.js';
30
30
  import { IChatSlashCommandService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatSlashCommands.service';
31
31
  import { IChatVariablesService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatVariables.service';
@@ -233,7 +233,7 @@ let ChatService = class ChatService extends Disposable {
233
233
  .filter(session => session.requests.length > 0)
234
234
  .filter(session => !( (this._sessionModels.has(session.sessionId))));
235
235
  const persistedSessionItems = ( (persistedSessions
236
- .filter(session => !session.isImported)
236
+ .filter(session => !session.isImported && session.initialLocation !== ChatAgentLocation.EditingSession)
237
237
  .map(session => {
238
238
  const title = session.customTitle ?? ChatModel.getDefaultTitle(session.requests);
239
239
  return {
@@ -244,9 +244,9 @@ let ChatService = class ChatService extends Disposable {
244
244
  };
245
245
  })));
246
246
  const liveSessionItems = ( (Array.from(( (this._sessionModels.values())))
247
- .filter(session => !session.isImported)
247
+ .filter(session => !session.isImported && session.initialLocation !== ChatAgentLocation.EditingSession)
248
248
  .map(session => {
249
- const title = session.title || ( localize(3154, "New Chat"));
249
+ const title = session.title || ( localize(2698, "New Chat"));
250
250
  return {
251
251
  sessionId: session.sessionId,
252
252
  title,
@@ -344,6 +344,7 @@ let ChatService = class ChatService extends Disposable {
344
344
  ...options,
345
345
  locationData: request.locationData,
346
346
  attachedContext: request.attachedContext,
347
+ workingSet: request.workingSet,
347
348
  };
348
349
  await this._sendRequestAsync(model, model.sessionId, request.message, attempt, enableCommandDetection, defaultAgent, location, resendOptions).responseCompletePromise;
349
350
  }
@@ -400,7 +401,7 @@ let ChatService = class ChatService extends Disposable {
400
401
  const agentPart = 'kind' in parsedRequest ? undefined : parsedRequest.parts.find((r) => r instanceof ChatRequestAgentPart);
401
402
  const agentSlashCommandPart = 'kind' in parsedRequest ? undefined : parsedRequest.parts.find((r) => r instanceof ChatRequestAgentSubcommandPart);
402
403
  const commandPart = 'kind' in parsedRequest ? undefined : parsedRequest.parts.find((r) => r instanceof ChatRequestSlashCommandPart);
403
- const requests = [...model.getRequests()];
404
+ const requests = [...model.getRequests(false)];
404
405
  let gotProgress = false;
405
406
  const requestType = commandPart ? 'slashCommand' : 'string';
406
407
  const responseCreated = ( (new DeferredPromise()));
@@ -457,18 +458,32 @@ let ChatService = class ChatService extends Disposable {
457
458
  if (agentPart || (defaultAgent && !commandPart)) {
458
459
  const prepareChatAgentRequest = async (agent, command, enableCommandDetection, chatRequest, isParticipantDetected) => {
459
460
  const initVariableData = { variables: [] };
460
- request = chatRequest ?? model.addRequest(parsedRequest, initVariableData, attempt, agent, command, options?.confirmation, options?.locationData, options?.attachedContext);
461
- const variableData = await this.chatVariablesService.resolveVariables(parsedRequest, request.attachedContext, model, progressCallback, token);
462
- model.updateRequest(request, variableData);
463
- const promptTextResult = getPromptText(request.message);
464
- const updatedVariableData = updateRanges(variableData, promptTextResult.diff);
461
+ request = chatRequest ?? model.addRequest(parsedRequest, initVariableData, attempt, agent, command, options?.confirmation, options?.locationData, options?.attachedContext, options?.workingSet);
462
+ let variableData;
463
+ let message;
464
+ if (chatRequest) {
465
+ variableData = chatRequest.variableData;
466
+ message = getPromptText(request.message).message;
467
+ }
468
+ else {
469
+ variableData = await this.chatVariablesService.resolveVariables(parsedRequest, request.attachedContext, model, progressCallback, token);
470
+ for (const variable of variableData.variables) {
471
+ if (request.workingSet && variable.isFile && URI.isUri(variable.value)) {
472
+ request.workingSet.push(variable.value);
473
+ }
474
+ }
475
+ model.updateRequest(request, variableData);
476
+ const promptTextResult = getPromptText(request.message);
477
+ variableData = updateRanges(variableData, promptTextResult.diff);
478
+ message = promptTextResult.message;
479
+ }
465
480
  return {
466
481
  sessionId,
467
482
  requestId: request.id,
468
483
  agentId: agent.id,
469
- message: promptTextResult.message,
484
+ message,
470
485
  command: command?.name,
471
- variables: updatedVariableData,
486
+ variables: variableData,
472
487
  enableCommandDetection,
473
488
  isParticipantDetected,
474
489
  attempt,
@@ -502,13 +517,13 @@ let ChatService = class ChatService extends Disposable {
502
517
  const agentResult = await this.chatAgentService.invokeAgent(agent.id, requestProps, progressCallback, history, token);
503
518
  rawResult = agentResult;
504
519
  agentOrCommandFollowups = this.chatAgentService.getFollowups(agent.id, requestProps, agentResult, history, followupsCancelToken);
505
- chatTitlePromise = model.getRequests().length === 1 && !model.customTitle ? this.chatAgentService.getChatTitle(defaultAgent.id, this.getHistoryEntriesFromModel(model.getRequests(), model.sessionId, location, agent.id), CancellationToken.None) : undefined;
520
+ chatTitlePromise = model.getRequests(false).length === 1 && !model.customTitle ? this.chatAgentService.getChatTitle(defaultAgent.id, this.getHistoryEntriesFromModel(model.getRequests(false), model.sessionId, location, agent.id), CancellationToken.None) : undefined;
506
521
  }
507
522
  else if (commandPart && this.chatSlashCommandService.hasCommand(commandPart.slashCommand.command)) {
508
523
  request = model.addRequest(parsedRequest, { variables: [] }, attempt);
509
524
  completeResponseCreated();
510
525
  const history = [];
511
- for (const request of model.getRequests()) {
526
+ for (const request of model.getRequests(false)) {
512
527
  if (!request.response) {
513
528
  continue;
514
529
  }
@@ -531,7 +546,7 @@ let ChatService = class ChatService extends Disposable {
531
546
  else {
532
547
  if (!rawResult) {
533
548
  this.trace('sendRequest', `Provider returned no response for session ${model.sessionId}`);
534
- rawResult = { errorDetails: { message: ( localize(3155, "Provider returned null response")) } };
549
+ rawResult = { errorDetails: { message: ( localize(2699, "Provider returned null response")) } };
535
550
  }
536
551
  const result = rawResult.errorDetails?.responseIsFiltered ? 'filtered' :
537
552
  rawResult.errorDetails && gotProgress ? 'errorWithOutput' :
@@ -675,7 +690,7 @@ let ChatService = class ChatService extends Disposable {
675
690
  const parsedRequest = typeof message === 'string' ?
676
691
  this.instantiationService.createInstance(ChatRequestParser).parseChatRequest(sessionId, message) :
677
692
  message;
678
- const request = model.addRequest(parsedRequest, variableData || { variables: [] }, attempt ?? 0);
693
+ const request = model.addRequest(parsedRequest, variableData || { variables: [] }, attempt ?? 0, undefined, undefined, undefined, undefined, undefined, undefined, true);
679
694
  if (typeof response.message === 'string') {
680
695
  model.acceptResponseProgress(request, { content: ( (new MarkdownString(response.message))), kind: 'markdownContent' });
681
696
  }
@@ -3,7 +3,7 @@ import { Emitter } from 'vscode/vscode/vs/base/common/event';
3
3
  import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
4
4
  import { Memento } from 'vscode/vscode/vs/workbench/common/memento';
5
5
  import { ChatAgentLocation } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
6
- import { CHAT_PROVIDER_ID } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatParticipantContribTypes';
6
+ import { CHAT_PROVIDER_ID } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/common/chatParticipantContribTypes';
7
7
 
8
8
  let ChatWidgetHistoryService = class ChatWidgetHistoryService {
9
9
  constructor(storageService) {
@@ -0,0 +1,21 @@
1
+ import { toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
2
+
3
+ class LanguageModelIgnoredFilesService {
4
+ constructor() {
5
+ this._providers = ( new Set());
6
+ }
7
+ async fileIsIgnored(uri, token) {
8
+ const provider = ( this._providers.values()).next().value;
9
+ return provider ?
10
+ provider.isFileIgnored(uri, token) :
11
+ false;
12
+ }
13
+ registerIgnoredFileProvider(provider) {
14
+ this._providers.add(provider);
15
+ return toDisposable(() => {
16
+ this._providers.delete(provider);
17
+ });
18
+ }
19
+ }
20
+
21
+ export { LanguageModelIgnoredFilesService };
@@ -120,8 +120,8 @@ LanguageModelStatsService = LanguageModelStatsService_1 = ( (__decorate([
120
120
  ], LanguageModelStatsService)));
121
121
  ( (Registry.as(Extensions.ExtensionFeaturesRegistry))).registerExtensionFeature({
122
122
  id: 'languageModels',
123
- label: ( localize(3164, "Language Models")),
124
- description: ( localize(3165, "Language models usage statistics of this extension.")),
123
+ label: ( localize(2712, "Language Models")),
124
+ description: ( localize(2713, "Language models usage statistics of this extension.")),
125
125
  access: {
126
126
  canToggle: false
127
127
  },
@@ -17,14 +17,14 @@ const languageModelType = {
17
17
  properties: {
18
18
  vendor: {
19
19
  type: 'string',
20
- description: ( localize(3156, "A globally unique vendor of language models."))
20
+ description: ( localize(2700, "A globally unique vendor of language models."))
21
21
  }
22
22
  }
23
23
  };
24
24
  const languageModelExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
25
25
  extensionPoint: 'languageModels',
26
26
  jsonSchema: {
27
- description: ( localize(3157, "Contribute language models of a specific vendor.")),
27
+ description: ( localize(2701, "Contribute language models of a specific vendor.")),
28
28
  oneOf: [
29
29
  languageModelType,
30
30
  {
@@ -54,24 +54,24 @@ let LanguageModelsService = class LanguageModelsService {
54
54
  this._vendors.clear();
55
55
  for (const extension of extensions) {
56
56
  if (!isProposedApiEnabled(extension.description, 'chatProvider')) {
57
- extension.collector.error(( localize(3158, "This contribution point requires the 'chatProvider' proposal.")));
57
+ extension.collector.error(( localize(2702, "This contribution point requires the 'chatProvider' proposal.")));
58
58
  continue;
59
59
  }
60
60
  for (const item of Iterable.wrap(extension.value)) {
61
61
  if (( (this._vendors.has(item.vendor)))) {
62
62
  extension.collector.error(( localize(
63
- 3159,
63
+ 2703,
64
64
  "The vendor '{0}' is already registered and cannot be registered twice",
65
65
  item.vendor
66
66
  )));
67
67
  continue;
68
68
  }
69
69
  if (isFalsyOrWhitespace(item.vendor)) {
70
- extension.collector.error(( localize(3160, "The vendor field cannot be empty.")));
70
+ extension.collector.error(( localize(2704, "The vendor field cannot be empty.")));
71
71
  continue;
72
72
  }
73
73
  if (item.vendor.trim() !== item.vendor) {
74
- extension.collector.error(( localize(3161, "The vendor field cannot start or end with whitespace.")));
74
+ extension.collector.error(( localize(2705, "The vendor field cannot start or end with whitespace.")));
75
75
  continue;
76
76
  }
77
77
  this._vendors.add(item.vendor);
@@ -7,68 +7,95 @@ import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/cont
7
7
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
8
8
  import { ILanguageModelToolsService } from 'vscode/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service';
9
9
  import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
10
+ import { toolsParametersSchemaSchemaId } from './languageModelToolsParametersSchema.js';
10
11
 
11
12
  const languageModelToolsExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
12
13
  extensionPoint: 'languageModelTools',
13
14
  activationEventsGenerator: (contributions, result) => {
14
15
  for (const contrib of contributions) {
15
- result.push(`onLanguageModelTool:${contrib.id}`);
16
+ result.push(`onLanguageModelTool:${contrib.name}`);
16
17
  }
17
18
  },
18
19
  jsonSchema: {
19
- description: ( localize(7251, 'Contributes a tool that can be invoked by a language model.')),
20
+ description: ( localize(
21
+ 7480,
22
+ 'Contributes a tool that can be invoked by a language model in a chat session, or from a standalone command. Registered tools can be used by all extensions.'
23
+ )),
20
24
  type: 'array',
21
25
  items: {
22
26
  additionalProperties: false,
23
27
  type: 'object',
24
- defaultSnippets: [{ body: { name: '', description: '' } }],
25
- required: ['id', 'modelDescription'],
28
+ defaultSnippets: [{
29
+ body: {
30
+ name: '${1}',
31
+ modelDescription: '${2}',
32
+ inputSchema: {
33
+ type: 'object',
34
+ properties: {
35
+ '${3:name}': {
36
+ type: 'string',
37
+ description: '${4:description}'
38
+ }
39
+ }
40
+ },
41
+ }
42
+ }],
43
+ required: ['name', 'displayName', 'modelDescription'],
26
44
  properties: {
27
- id: {
28
- description: ( localize(7252, "A unique id for this tool.")),
45
+ name: {
46
+ description: ( localize(
47
+ 7481,
48
+ "A unique name for this tool. This name must be a globally unique identifier, and is also used as a name when presenting this tool to a language model."
49
+ )),
29
50
  type: 'string',
30
51
  pattern: '^[\\w-]+$'
31
52
  },
32
- name: {
33
- description: ( localize(
34
- 7253,
53
+ toolReferenceName: {
54
+ markdownDescription: ( localize(
55
+ 7482,
35
56
  "If {0} is enabled for this tool, the user may use '#' with this name to invoke the tool in a query. Otherwise, the name is not required. Name must not contain whitespace.",
36
- '`canBeInvokedManually`'
57
+ '`canBeReferencedInPrompt`'
37
58
  )),
38
59
  type: 'string',
39
60
  pattern: '^[\\w-]+$'
40
61
  },
41
62
  displayName: {
42
63
  description: ( localize(
43
- 7254,
64
+ 7483,
44
65
  "A human-readable name for this tool that may be used to describe it in the UI."
45
66
  )),
46
67
  type: 'string'
47
68
  },
48
69
  userDescription: {
49
- description: ( localize(7255, "A description of this tool that may be shown to the user.")),
70
+ description: ( localize(7484, "A description of this tool that may be shown to the user.")),
50
71
  type: 'string'
51
72
  },
52
73
  modelDescription: {
53
- description: ( localize(7256, "A description of this tool that may be passed to a language model.")),
74
+ description: ( localize(
75
+ 7485,
76
+ "A description of this tool that may be used by a language model to select it."
77
+ )),
54
78
  type: 'string'
55
79
  },
56
- parametersSchema: {
57
- description: ( localize(7257, "A JSON schema for the parameters this tool accepts.")),
58
- type: 'object',
59
- $ref: 'http://json-schema.org/draft-07/schema#'
60
- },
61
- canBeInvokedManually: {
80
+ inputSchema: {
62
81
  description: ( localize(
63
- 7258,
64
- "Whether this tool can be invoked manually by the user through the chat UX."
82
+ 7486,
83
+ "A JSON schema for the input this tool accepts. The input must be an object at the top level. A particular language model may not support all JSON schema features. See the documentation for the language model family you are using for more information."
84
+ )),
85
+ $ref: toolsParametersSchemaSchemaId,
86
+ },
87
+ canBeReferencedInPrompt: {
88
+ markdownDescription: ( localize(
89
+ 7487,
90
+ "If true, this tool shows up as an attachment that the user can add manually to their request. Chat participants will receive the tool in {0}.",
91
+ '`ChatRequest#toolReferences`'
65
92
  )),
66
93
  type: 'boolean'
67
94
  },
68
95
  icon: {
69
- description: ( localize(
70
- 7259,
71
- "An icon that represents this tool. Either a file path, an object with file paths for dark and light themes, or a theme icon reference, like `\\$(zap)`"
96
+ markdownDescription: ( localize(
97
+ 7488,
98
+ "An icon that represents this tool. Either a file path, an object with file paths for dark and light themes, or a theme icon reference, like `$(zap)`"
72
99
  )),
73
100
  anyOf: [{
74
101
  type: 'string'
@@ -77,11 +104,11 @@ const languageModelToolsExtensionPoint = ExtensionsRegistry.registerExtensionPoi
77
104
  type: 'object',
78
105
  properties: {
79
106
  light: {
80
- description: ( localize(7260, 'Icon path when a light theme is used')),
107
+ description: ( localize(7489, 'Icon path when a light theme is used')),
81
108
  type: 'string'
82
109
  },
83
110
  dark: {
84
- description: ( localize(7261, 'Icon path when a dark theme is used')),
111
+ description: ( localize(7490, 'Icon path when a dark theme is used')),
85
112
  type: 'string'
86
113
  }
87
114
  }
@@ -89,27 +116,20 @@ const languageModelToolsExtensionPoint = ExtensionsRegistry.registerExtensionPoi
89
116
  },
90
117
  when: {
91
118
  markdownDescription: ( localize(
92
- 7262,
119
+ 7491,
93
120
  "Condition which must be true for this tool to be enabled. Note that a tool may still be invoked by another extension even when its `when` condition is false."
94
121
  )),
95
122
  type: 'string'
96
123
  },
97
- supportedContentTypes: {
98
- markdownDescription: ( localize(
99
- 7263,
100
- "The list of content types that this tool can return. It's required that tools support `text/plain`, and that is assumed even if not specified here. Another example could be the contentType exported by the `@vscode/prompt-tsx` library."
124
+ tags: {
125
+ description: ( localize(
126
+ 7492,
127
+ "A set of tags that roughly describe the tool's capabilities. A tool user may use these to filter the set of tools to just ones that are relevant for the task at hand, or they may want to pick a tag that can be used to identify just the tools contributed by this extension."
101
128
  )),
102
129
  type: 'array',
103
130
  items: {
104
131
  type: 'string'
105
132
  }
106
- },
107
- requiresConfirmation: {
108
- description: ( localize(
109
- 7264,
110
- "Whether this tool requires user confirmation before being executed."
111
- )),
112
- type: 'boolean'
113
133
  }
114
134
  }
115
135
  }
@@ -125,16 +145,16 @@ let LanguageModelToolsExtensionPointHandler = class LanguageModelToolsExtensionP
125
145
  languageModelToolsExtensionPoint.setHandler((extensions, delta) => {
126
146
  for (const extension of delta.added) {
127
147
  for (const rawTool of extension.value) {
128
- if (!rawTool.id || !rawTool.modelDescription) {
129
- logService.error(`Extension '${extension.description.identifier.value}' CANNOT register tool without name and modelDescription: ${JSON.stringify(rawTool)}`);
148
+ if (!rawTool.name || !rawTool.modelDescription || !rawTool.displayName) {
149
+ logService.error(`Extension '${extension.description.identifier.value}' CANNOT register tool without name, modelDescription, and displayName: ${JSON.stringify(rawTool)}`);
130
150
  continue;
131
151
  }
132
- if (!rawTool.id.match(/^[\w-]+$/)) {
133
- logService.error(`Extension '${extension.description.identifier.value}' CANNOT register tool with invalid id: ${rawTool.id}. The id must match /^[\\w-]+$/.`);
152
+ if (!rawTool.name.match(/^[\w-]+$/)) {
153
+ logService.error(`Extension '${extension.description.identifier.value}' CANNOT register tool with invalid id: ${rawTool.name}. The id must match /^[\\w-]+$/.`);
134
154
  continue;
135
155
  }
136
- if (rawTool.canBeInvokedManually && !rawTool.name) {
137
- logService.error(`Extension '${extension.description.identifier.value}' CANNOT register tool with 'canBeInvokedManually' set without a name: ${JSON.stringify(rawTool)}`);
156
+ if (rawTool.canBeReferencedInPrompt && !rawTool.toolReferenceName) {
157
+ logService.error(`Extension '${extension.description.identifier.value}' CANNOT register tool with 'canBeReferencedInPrompt' set without a 'toolReferenceName': ${JSON.stringify(rawTool)}`);
138
158
  continue;
139
159
  }
140
160
  const rawIcon = rawTool.icon;
@@ -153,17 +173,18 @@ let LanguageModelToolsExtensionPointHandler = class LanguageModelToolsExtensionP
153
173
  }
154
174
  const tool = {
155
175
  ...rawTool,
176
+ inputSchema: rawTool.inputSchema ?? rawTool.parametersSchema,
177
+ id: rawTool.name,
156
178
  icon,
157
179
  when: rawTool.when ? ContextKeyExpr.deserialize(rawTool.when) : undefined,
158
- supportedContentTypes: rawTool.supportedContentTypes ? rawTool.supportedContentTypes : [],
159
180
  };
160
181
  const disposable = languageModelToolsService.registerToolData(tool);
161
- this._registrationDisposables.set(toToolKey(extension.description.identifier, rawTool.id), disposable);
182
+ this._registrationDisposables.set(toToolKey(extension.description.identifier, rawTool.name), disposable);
162
183
  }
163
184
  }
164
185
  for (const extension of delta.removed) {
165
186
  for (const tool of extension.value) {
166
- this._registrationDisposables.deleteAndDispose(toToolKey(extension.description.identifier, tool.id));
187
+ this._registrationDisposables.deleteAndDispose(toToolKey(extension.description.identifier, tool.name));
167
188
  }
168
189
  }
169
190
  });