Skip to content

Commit 2c19ac0

Browse files
authored
Add languageModelToolsForAgent proposal (#243105)
To have a cleaner proposal to enable the tag for extensions to contribute tools to agent mode
1 parent 4e8d266 commit 2c19ac0

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/vs/platform/extensions/common/extensionsApiProposals.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ const _allApiProposals = {
226226
languageModelSystem: {
227227
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelSystem.d.ts',
228228
},
229+
languageModelToolsForAgent: {
230+
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelToolsForAgent.d.ts',
231+
},
229232
languageStatusText: {
230233
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageStatusText.d.ts',
231234
},

src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ function toToolKey(extensionIdentifier: ExtensionIdentifier, toolName: string) {
135135
return `${extensionIdentifier.value}/${toolName}`;
136136
}
137137

138+
const CopilotAgentModeTag = 'vscode_editing';
139+
138140
export class LanguageModelToolsExtensionPointHandler implements IWorkbenchContribution {
139141
static readonly ID = 'workbench.contrib.toolsExtensionPointHandler';
140142

@@ -167,7 +169,14 @@ export class LanguageModelToolsExtensionPointHandler implements IWorkbenchContri
167169
continue;
168170
}
169171

170-
if (rawTool.tags?.some(tag => tag.startsWith('copilot_') || tag.startsWith('vscode_')) && !isProposedApiEnabled(extension.description, 'chatParticipantPrivate')) {
172+
if (rawTool.tags?.includes(CopilotAgentModeTag)) {
173+
if (!isProposedApiEnabled(extension.description, 'languageModelToolsForAgent') && !isProposedApiEnabled(extension.description, 'chatParticipantPrivate')) {
174+
logService.error(`Extension '${extension.description.identifier.value}' CANNOT register tool with tag "${CopilotAgentModeTag}" without enabling 'languageModelToolsForAgent' proposal`);
175+
continue;
176+
}
177+
}
178+
179+
if (rawTool.tags?.some(tag => tag !== CopilotAgentModeTag && (tag.startsWith('copilot_') || tag.startsWith('vscode_'))) && !isProposedApiEnabled(extension.description, 'chatParticipantPrivate')) {
171180
logService.error(`Extension '${extension.description.identifier.value}' CANNOT register tool with tags starting with "vscode_" or "copilot_"`);
172181
continue;
173182
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
declare module 'vscode' {
7+
// Enables access to providing language model tools to agent mode
8+
}

0 commit comments

Comments
 (0)