Skip to content

Always enable new tools #256569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { IConfigurationService } from '../../../../../platform/configuration/com
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
import { registerWorkbenchContribution2, WorkbenchPhase, type IWorkbenchContribution } from '../../../../common/contributions.js';
import { ILanguageModelToolsService } from '../../../chat/common/languageModelToolsService.js';
import { TerminalChatAgentToolsSettingId } from '../common/terminalChatAgentToolsConfiguration.js';
import { GetTerminalOutputTool, GetTerminalOutputToolData } from './getTerminalOutputTool.js';
import { RunInTerminalTool, RunInTerminalToolData } from './runInTerminalTool.js';

Expand All @@ -25,15 +24,13 @@ class ChatAgentToolsContribution extends Disposable implements IWorkbenchContrib
) {
super();

if (configurationService.getValue(TerminalChatAgentToolsSettingId.CoreToolsEnabled)) {
const runInTerminalTool = instantiationService.createInstance(RunInTerminalTool);
this._register(toolsService.registerToolData(RunInTerminalToolData));
this._register(toolsService.registerToolImplementation(RunInTerminalToolData.id, runInTerminalTool));
const runInTerminalTool = instantiationService.createInstance(RunInTerminalTool);
this._register(toolsService.registerToolData(RunInTerminalToolData));
this._register(toolsService.registerToolImplementation(RunInTerminalToolData.id, runInTerminalTool));

const getTerminalOutputTool = instantiationService.createInstance(GetTerminalOutputTool);
this._register(toolsService.registerToolData(GetTerminalOutputToolData));
this._register(toolsService.registerToolImplementation(GetTerminalOutputToolData.id, getTerminalOutputTool));
}
const getTerminalOutputTool = instantiationService.createInstance(GetTerminalOutputTool);
this._register(toolsService.registerToolData(GetTerminalOutputToolData));
this._register(toolsService.registerToolImplementation(GetTerminalOutputToolData.id, getTerminalOutputTool));
}
}
registerWorkbenchContribution2(ChatAgentToolsContribution.ID, ChatAgentToolsContribution, WorkbenchPhase.AfterRestored);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,16 @@ import { localize } from '../../../../../nls.js';
import type { IConfigurationPropertySchema } from '../../../../../platform/configuration/common/configurationRegistry.js';

export const enum TerminalChatAgentToolsSettingId {
CoreToolsEnabled = 'chat.agent.terminal.coreToolsEnabled',
AllowList = 'chat.agent.terminal.allowList',
DenyList = 'chat.agent.terminal.denyList',
}

export interface ITerminalChatAgentToolsConfiguration {
coreToolsEnabled: boolean;
allowList: { [key: string]: string };
denyList: { [key: string]: string };
}

export const terminalChatAgentToolsConfiguration: IStringDictionary<IConfigurationPropertySchema> = {
[TerminalChatAgentToolsSettingId.CoreToolsEnabled]: {
description: localize('coreToolsEnabled', "Whether the experimental core tools are enabled. This required VS Code to be restarted."),
type: 'boolean',
tags: [
'experimental'
],
default: true,
},
[TerminalChatAgentToolsSettingId.AllowList]: {
markdownDescription: localize('allowList', "A list of commands or regular expressions that allow the run in terminal tool commands to run without explicit approval. These will be matched against the start of a command. A regular expression can be provided by wrapping the string in `/` characters.\n\nExamples:\n- `\"mkdir\"` Will allow all command lines starting with `mkdir`\n- `\"npm run build\"` Will allow all command lines starting with `npm run build`\n- `\"/^git (status|show\\b.*)$/\"` will allow `git status` and all command lines starting with `git show`\n- `\"/.*/\"` will allow all command lines\n\nThis will be overridden by anything that matches an entry in `#chat.agent.terminal.denyList#`."),
type: 'object',
Expand Down
Loading