Merge pull request #6396 from continuedev/dallin/simpler-tool-names

Simplify tool names
This commit is contained in:
Dallin Romney 2025-07-02 11:29:07 -07:00 • committed by GitHub
commit 312fe0a2fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 127 additions and 36 deletions

View file

@ -1,23 +1,23 @@
export enum BuiltInToolNames {
ReadFile = "builtin_read_file",
EditExistingFile = "builtin_edit_existing_file",
SearchAndReplaceInFile = "builtin_search_and_replace_in_file",
ReadCurrentlyOpenFile = "builtin_read_currently_open_file",
CreateNewFile = "builtin_create_new_file",
RunTerminalCommand = "builtin_run_terminal_command",
GrepSearch = "builtin_grep_search",
FileGlobSearch = "builtin_file_glob_search",
SearchWeb = "builtin_search_web",
ViewDiff = "builtin_view_diff",
LSTool = "builtin_ls",
CreateRuleBlock = "builtin_create_rule_block",
RequestRule = "builtin_request_rule",
FetchUrlContent = "builtin_fetch_url_content",
CodebaseTool = "builtin_codebase",
ReadFile = "read_file",
EditExistingFile = "edit_existing_file",
SearchAndReplaceInFile = "search_and_replace_in_file",
ReadCurrentlyOpenFile = "read_currently_open_file",
CreateNewFile = "create_new_file",
RunTerminalCommand = "run_terminal_command",
GrepSearch = "grep_search",
FileGlobSearch = "file_glob_search",
SearchWeb = "search_web",
ViewDiff = "view_diff",
LSTool = "ls",
CreateRuleBlock = "create_rule_block",
RequestRule = "request_rule",
FetchUrlContent = "fetch_url_content",
CodebaseTool = "codebase",
// excluded from allTools for now
ViewRepoMap = "builtin_view_repo_map",
ViewSubdirectory = "builtin_view_subdirectory",
ViewRepoMap = "view_repo_map",
ViewSubdirectory = "view_subdirectory",
}
export const BUILT_IN_GROUP_NAME = "Built-In";

View file

@ -28,14 +28,12 @@ In [Chat mode](../chat/how-to-use-it.md), tools are **not** included in the requ
Continue includes several built-in tools which provide the model access to IDE functionality:
- **Read file** (`builtin_read_file`): read the contents of a file within the project
- **Read currently open file** (`builtin_read_currently_open_file`): read the contents of the currently open file
- **Create new file** (`builtin_create_new_file`): Create a new file within the project, with path and contents specified by the model
- **Exact search** (`builtin_exact_search`): perform a `ripgrep` search within the project
- **Glob search** (`builtin_file_glob_search`): perform a glob search on files in the project. Currently limits to 100 output and warns the Agent if limit reached.
- **Run terminal command** (`builtin_run_terminal_command`): run a terminal command from the workspace root
- **Search web** (`builtin_search_web`): Perform a web search to get top results
- **View diff** (`builtin_view_diff`): View the current working git diff
- **View repo map** (`builtin_view_repo_map`): request a copy of the repository map—same as the [Repo Map Context Provider](../customize/context-providers.mdx#repository-map)
- **View subdirectory** (`builtin_view_subdirectory`): request a copy of a repo map for a specific directory within the project
- **Create Rule Block** (`builtin_create_rule_block`): creates a new rule block in `.continue/rules` based on the contents of the conversation
- **Read file** (`read_file`): read the contents of a file within the project
- **Read currently open file** (`read_currently_open_file`): read the contents of the currently open file
- **Create new file** (`create_new_file`): Create a new file within the project, with path and contents specified by the model
- **Exact search** (`exact_search`): perform a `ripgrep` search within the project
- **Glob search** (`file_glob_search`): perform a glob search on files in the project. Currently limits to 100 output and warns the Agent if limit reached.
- **Run terminal command** (`run_terminal_command`): run a terminal command from the workspace root
- **Search web** (`search_web`): Perform a web search to get top results
- **View diff** (`view_diff`): View the current working git diff
- **Create Rule Block** (`create_rule_block`): creates a new rule block in `.continue/rules` based on the contents of the conversation

View file

@ -48,7 +48,7 @@ Rules can be added locally using the "Add Rules" button while viewing the Local
![add local rules button](/img/add-local-rules.png)
:::info Automatically create local rule blocks
When in Agent mode, you can prompt the agent to create a rule for you using the `builtin_create_rule_block` tool if enabled.
When in Agent mode, you can prompt the agent to create a rule for you using the `create_rule_block` tool if enabled.
For example, you can say "Create a rule for this", and a rule will be created for you in `.continue/rules` based on your conversation.
:::

View file

@ -37,7 +37,7 @@ models:
- id: test_id
type: function
function:
name: builtin_view_diff
name: view_diff
- REPEAT_LAST_MSG
roles:
- chat

View file

@ -36,7 +36,7 @@
"id": "test_id",
"type": "function",
"function": {
"name": "builtin_view_diff"
"name": "view_diff"
}
}
]

View file

@ -304,7 +304,7 @@ describe("GUI Test", () => {
}).timeout(DEFAULT_TIMEOUT.MD * 100);
it("should call tool after approval", async () => {
await GUIActions.toggleToolPolicy(view, "builtin_view_diff", 2);
await GUIActions.toggleToolPolicy(view, "view_diff", 2);
const [messageInput] = await GUISelectors.getMessageInputFields(view);
await messageInput.sendKeys("Hello");
@ -325,7 +325,7 @@ describe("GUI Test", () => {
}).timeout(DEFAULT_TIMEOUT.XL);
it("should cancel tool", async () => {
await GUIActions.toggleToolPolicy(view, "builtin_view_diff", 2);
await GUIActions.toggleToolPolicy(view, "view_diff", 2);
const [messageInput] = await GUISelectors.getMessageInputFields(view);
await messageInput.sendKeys("Hello");

View file

@ -38,6 +38,7 @@ import {
} from "../styles/theme";
import { isJetBrains } from "../util";
import { setLocalStorage } from "../util/localStorage";
import { migrateLocalStorage } from "../util/migrateLocalStorage";
import { useWebviewListener } from "./useWebviewListener";
function ParallelListeners() {
@ -310,6 +311,10 @@ function ParallelListeners() {
}
}, [isInEdit, history]);
useEffect(() => {
migrateLocalStorage(dispatch);
}, []);
return <></>;
}

View file

@ -46,9 +46,9 @@ const toolCallIcons: Record<string, ComponentType> = {
[BuiltInToolNames.ViewRepoMap]: MapIcon,
[BuiltInToolNames.ViewSubdirectory]: FolderOpenIcon,
[BuiltInToolNames.CreateRuleBlock]: PencilIcon,
// EditExistingFile = "builtin_edit_existing_file",
// CreateNewFile = "builtin_create_new_file",
// RunTerminalCommand = "builtin_run_terminal_command",
// EditExistingFile
// CreateNewFile
// RunTerminalCommand
};
function getStatusIcon(state: ToolStatus) {

View file

@ -106,6 +106,18 @@ export const uiSlice = createSlice({
state.toolSettings[action.payload.function.name] =
"allowedWithPermission";
},
setToolPolicy: (
state,
action: PayloadAction<{
toolName: string;
policy: ToolPolicy;
}>,
) => {
state.toolSettings[action.payload.toolName] = action.payload.policy;
},
clearToolPolicy: (state, action: PayloadAction<string>) => {
delete state.toolSettings[action.payload];
},
toggleToolSetting: (state, action: PayloadAction<string>) => {
const setting = state.toolSettings[action.payload];
@ -166,6 +178,8 @@ export const {
setIsExploreDialogOpen,
setHasDismissedExploreDialog,
toggleToolSetting,
setToolPolicy,
clearToolPolicy,
toggleToolGroupSetting,
addTool,
addRule,

View file

@ -0,0 +1,74 @@
import { BuiltInToolNames } from "core/tools/builtIn";
import {
clearToolPolicy,
setToolPolicy,
ToolPolicy,
} from "../redux/slices/uiSlice";
import { AppDispatch } from "../redux/store";
const validPolicyValues: ToolPolicy[] = [
"allowedWithPermission",
"allowedWithoutPermission",
"disabled",
];
function migrateToolPolicies(dispatch: AppDispatch) {
const toFromMap: Record<string, string[]> = {
[BuiltInToolNames.ReadFile]: ["builtin_read_file"],
[BuiltInToolNames.EditExistingFile]: ["builtin_edit_existing_file"],
[BuiltInToolNames.SearchAndReplaceInFile]: [
"builtin_search_and_replace_in_file",
],
[BuiltInToolNames.ReadCurrentlyOpenFile]: [
"builtin_read_currently_open_file",
],
[BuiltInToolNames.CreateNewFile]: ["builtin_create_new_file"],
[BuiltInToolNames.RunTerminalCommand]: ["builtin_run_terminal_command"],
[BuiltInToolNames.GrepSearch]: ["builtin_grep_search"],
[BuiltInToolNames.FileGlobSearch]: ["builtin_file_glob_search"],
[BuiltInToolNames.SearchWeb]: ["builtin_search_web"],
[BuiltInToolNames.ViewDiff]: ["builtin_view_diff"],
[BuiltInToolNames.LSTool]: ["builtin_ls"],
[BuiltInToolNames.CreateRuleBlock]: ["builtin_create_rule_block"],
[BuiltInToolNames.RequestRule]: ["builtin_request_rule"],
[BuiltInToolNames.FetchUrlContent]: ["builtin_fetch_url_content"],
[BuiltInToolNames.CodebaseTool]: ["builtin_codebase"],
[BuiltInToolNames.ViewRepoMap]: ["builtin_view_repo_map"],
[BuiltInToolNames.ViewSubdirectory]: ["builtin_view_subdirectory"],
};
const persistedRedux = localStorage.getItem("persist:root");
if (persistedRedux) {
const uiState = JSON.parse(persistedRedux)?.ui;
if (uiState) {
const parsedSettings = JSON.parse(uiState)?.toolSettings;
if (parsedSettings) {
let migratedToolSettings = 0;
Object.entries(toFromMap).forEach(([newToolName, oldToolNames]) => {
for (const tool of oldToolNames) {
if (
tool in parsedSettings &&
validPolicyValues.includes(parsedSettings[tool])
) {
dispatch(
setToolPolicy({
toolName: newToolName,
policy: parsedSettings[tool],
}),
);
dispatch(clearToolPolicy(tool));
migratedToolSettings++;
}
}
});
if (migratedToolSettings > 0) {
console.log(
`Migrated ${migratedToolSettings} tool policies successfully.`,
);
}
}
}
}
}
export function migrateLocalStorage(dispatch: AppDispatch) {
migrateToolPolicies(dispatch);
}