Elffuss BraidHub

kikocis/continue public

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

Simplify tool names
Changeset6d82571f343fd116549140e5b66af7f58af6f1cee98893075dac09e5bd033ccc
AuthorDallin Romney <dallinromney@gmail.com> · 2025-07-02 11:29 -07:00
CommitterGitHub <noreply@github.com> · 2025-07-02 11:29 -07:00
Parents579e987b4d40, 85def0438284

Browse the files at this changeset

10 files changed

modified core/tools/builtIn.ts +17 −17
@@ -1,23 +1,23 @@
11 export enum BuiltInToolNames {
2- ReadFile = "builtin_read_file",
3- EditExistingFile = "builtin_edit_existing_file",
4- SearchAndReplaceInFile = "builtin_search_and_replace_in_file",
5- ReadCurrentlyOpenFile = "builtin_read_currently_open_file",
6- CreateNewFile = "builtin_create_new_file",
7- RunTerminalCommand = "builtin_run_terminal_command",
8- GrepSearch = "builtin_grep_search",
9- FileGlobSearch = "builtin_file_glob_search",
10- SearchWeb = "builtin_search_web",
11- ViewDiff = "builtin_view_diff",
12- LSTool = "builtin_ls",
13- CreateRuleBlock = "builtin_create_rule_block",
14- RequestRule = "builtin_request_rule",
15- FetchUrlContent = "builtin_fetch_url_content",
16- CodebaseTool = "builtin_codebase",
2+ ReadFile = "read_file",
3+ EditExistingFile = "edit_existing_file",
4+ SearchAndReplaceInFile = "search_and_replace_in_file",
5+ ReadCurrentlyOpenFile = "read_currently_open_file",
6+ CreateNewFile = "create_new_file",
7+ RunTerminalCommand = "run_terminal_command",
8+ GrepSearch = "grep_search",
9+ FileGlobSearch = "file_glob_search",
10+ SearchWeb = "search_web",
11+ ViewDiff = "view_diff",
12+ LSTool = "ls",
13+ CreateRuleBlock = "create_rule_block",
14+ RequestRule = "request_rule",
15+ FetchUrlContent = "fetch_url_content",
16+ CodebaseTool = "codebase",
1717
1818 // excluded from allTools for now
19- ViewRepoMap = "builtin_view_repo_map",
20- ViewSubdirectory = "builtin_view_subdirectory",
19+ ViewRepoMap = "view_repo_map",
20+ ViewSubdirectory = "view_subdirectory",
2121 }
2222
2323 export const BUILT_IN_GROUP_NAME = "Built-In";
modified docs/docs/agent/how-it-works.md +9 −11
@@ -28,14 +28,12 @@
2828
2929 Continue includes several built-in tools which provide the model access to IDE functionality:
3030
31-- **Read file** (`builtin_read_file`): read the contents of a file within the project
32-- **Read currently open file** (`builtin_read_currently_open_file`): read the contents of the currently open file
33-- **Create new file** (`builtin_create_new_file`): Create a new file within the project, with path and contents specified by the model
34-- **Exact search** (`builtin_exact_search`): perform a `ripgrep` search within the project
35-- **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.
36-- **Run terminal command** (`builtin_run_terminal_command`): run a terminal command from the workspace root
37-- **Search web** (`builtin_search_web`): Perform a web search to get top results
38-- **View diff** (`builtin_view_diff`): View the current working git diff
39-- **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)
40-- **View subdirectory** (`builtin_view_subdirectory`): request a copy of a repo map for a specific directory within the project
41-- **Create Rule Block** (`builtin_create_rule_block`): creates a new rule block in `.continue/rules` based on the contents of the conversation
31+- **Read file** (`read_file`): read the contents of a file within the project
32+- **Read currently open file** (`read_currently_open_file`): read the contents of the currently open file
33+- **Create new file** (`create_new_file`): Create a new file within the project, with path and contents specified by the model
34+- **Exact search** (`exact_search`): perform a `ripgrep` search within the project
35+- **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.
36+- **Run terminal command** (`run_terminal_command`): run a terminal command from the workspace root
37+- **Search web** (`search_web`): Perform a web search to get top results
38+- **View diff** (`view_diff`): View the current working git diff
39+- **Create Rule Block** (`create_rule_block`): creates a new rule block in `.continue/rules` based on the contents of the conversation
modified docs/docs/customize/deep-dives/rules.mdx +1 −1
@@ -48,7 +48,7 @@
4848 ![add local rules button](/img/add-local-rules.png)
4949
5050 :::info Automatically create local rule blocks
51-When in Agent mode, you can prompt the agent to create a rule for you using the `builtin_create_rule_block` tool if enabled.
51+When in Agent mode, you can prompt the agent to create a rule for you using the `create_rule_block` tool if enabled.
5252
5353 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.
5454 :::
modified extensions/vscode/e2e/test-continue-yaml/config.yaml +1 −1
@@ -37,7 +37,7 @@
3737 - id: test_id
3838 type: function
3939 function:
40- name: builtin_view_diff
40+ name: view_diff
4141 - REPEAT_LAST_MSG
4242 roles:
4343 - chat
modified extensions/vscode/e2e/test-continue/config.json +1 −1
@@ -36,7 +36,7 @@
3636 "id": "test_id",
3737 "type": "function",
3838 "function": {
39- "name": "builtin_view_diff"
39+ "name": "view_diff"
4040 }
4141 }
4242 ]
modified extensions/vscode/e2e/tests/GUI.test.ts +2 −2
@@ -304,7 +304,7 @@
304304 }).timeout(DEFAULT_TIMEOUT.MD * 100);
305305
306306 it("should call tool after approval", async () => {
307- await GUIActions.toggleToolPolicy(view, "builtin_view_diff", 2);
307+ await GUIActions.toggleToolPolicy(view, "view_diff", 2);
308308
309309 const [messageInput] = await GUISelectors.getMessageInputFields(view);
310310 await messageInput.sendKeys("Hello");
@@ -325,7 +325,7 @@
325325 }).timeout(DEFAULT_TIMEOUT.XL);
326326
327327 it("should cancel tool", async () => {
328- await GUIActions.toggleToolPolicy(view, "builtin_view_diff", 2);
328+ await GUIActions.toggleToolPolicy(view, "view_diff", 2);
329329
330330 const [messageInput] = await GUISelectors.getMessageInputFields(view);
331331 await messageInput.sendKeys("Hello");
modified gui/src/hooks/ParallelListeners.tsx +5 −0
@@ -38,6 +38,7 @@
3838 } from "../styles/theme";
3939 import { isJetBrains } from "../util";
4040 import { setLocalStorage } from "../util/localStorage";
41+import { migrateLocalStorage } from "../util/migrateLocalStorage";
4142 import { useWebviewListener } from "./useWebviewListener";
4243
4344 function ParallelListeners() {
@@ -310,6 +311,10 @@
310311 }
311312 }, [isInEdit, history]);
312313
314+ useEffect(() => {
315+ migrateLocalStorage(dispatch);
316+ }, []);
317+
313318 return <></>;
314319 }
315320
modified gui/src/pages/gui/ToolCallDiv/index.tsx +3 −3
@@ -46,9 +46,9 @@
4646 [BuiltInToolNames.ViewRepoMap]: MapIcon,
4747 [BuiltInToolNames.ViewSubdirectory]: FolderOpenIcon,
4848 [BuiltInToolNames.CreateRuleBlock]: PencilIcon,
49- // EditExistingFile = "builtin_edit_existing_file",
50- // CreateNewFile = "builtin_create_new_file",
51- // RunTerminalCommand = "builtin_run_terminal_command",
49+ // EditExistingFile
50+ // CreateNewFile
51+ // RunTerminalCommand
5252 };
5353
5454 function getStatusIcon(state: ToolStatus) {
modified gui/src/redux/slices/uiSlice.ts +14 −0
@@ -106,6 +106,18 @@
106106 state.toolSettings[action.payload.function.name] =
107107 "allowedWithPermission";
108108 },
109+ setToolPolicy: (
110+ state,
111+ action: PayloadAction<{
112+ toolName: string;
113+ policy: ToolPolicy;
114+ }>,
115+ ) => {
116+ state.toolSettings[action.payload.toolName] = action.payload.policy;
117+ },
118+ clearToolPolicy: (state, action: PayloadAction<string>) => {
119+ delete state.toolSettings[action.payload];
120+ },
109121 toggleToolSetting: (state, action: PayloadAction<string>) => {
110122 const setting = state.toolSettings[action.payload];
111123
@@ -166,6 +178,8 @@
166178 setIsExploreDialogOpen,
167179 setHasDismissedExploreDialog,
168180 toggleToolSetting,
181+ setToolPolicy,
182+ clearToolPolicy,
169183 toggleToolGroupSetting,
170184 addTool,
171185 addRule,
added gui/src/util/migrateLocalStorage.ts +74 −0
@@ -0,0 +1,74 @@
1+import { BuiltInToolNames } from "core/tools/builtIn";
2+import {
3+ clearToolPolicy,
4+ setToolPolicy,
5+ ToolPolicy,
6+} from "../redux/slices/uiSlice";
7+import { AppDispatch } from "../redux/store";
8+
9+const validPolicyValues: ToolPolicy[] = [
10+ "allowedWithPermission",
11+ "allowedWithoutPermission",
12+ "disabled",
13+];
14+function migrateToolPolicies(dispatch: AppDispatch) {
15+ const toFromMap: Record<string, string[]> = {
16+ [BuiltInToolNames.ReadFile]: ["builtin_read_file"],
17+ [BuiltInToolNames.EditExistingFile]: ["builtin_edit_existing_file"],
18+ [BuiltInToolNames.SearchAndReplaceInFile]: [
19+ "builtin_search_and_replace_in_file",
20+ ],
21+ [BuiltInToolNames.ReadCurrentlyOpenFile]: [
22+ "builtin_read_currently_open_file",
23+ ],
24+ [BuiltInToolNames.CreateNewFile]: ["builtin_create_new_file"],
25+ [BuiltInToolNames.RunTerminalCommand]: ["builtin_run_terminal_command"],
26+ [BuiltInToolNames.GrepSearch]: ["builtin_grep_search"],
27+ [BuiltInToolNames.FileGlobSearch]: ["builtin_file_glob_search"],
28+ [BuiltInToolNames.SearchWeb]: ["builtin_search_web"],
29+ [BuiltInToolNames.ViewDiff]: ["builtin_view_diff"],
30+ [BuiltInToolNames.LSTool]: ["builtin_ls"],
31+ [BuiltInToolNames.CreateRuleBlock]: ["builtin_create_rule_block"],
32+ [BuiltInToolNames.RequestRule]: ["builtin_request_rule"],
33+ [BuiltInToolNames.FetchUrlContent]: ["builtin_fetch_url_content"],
34+ [BuiltInToolNames.CodebaseTool]: ["builtin_codebase"],
35+ [BuiltInToolNames.ViewRepoMap]: ["builtin_view_repo_map"],
36+ [BuiltInToolNames.ViewSubdirectory]: ["builtin_view_subdirectory"],
37+ };
38+ const persistedRedux = localStorage.getItem("persist:root");
39+ if (persistedRedux) {
40+ const uiState = JSON.parse(persistedRedux)?.ui;
41+ if (uiState) {
42+ const parsedSettings = JSON.parse(uiState)?.toolSettings;
43+ if (parsedSettings) {
44+ let migratedToolSettings = 0;
45+ Object.entries(toFromMap).forEach(([newToolName, oldToolNames]) => {
46+ for (const tool of oldToolNames) {
47+ if (
48+ tool in parsedSettings &&
49+ validPolicyValues.includes(parsedSettings[tool])
50+ ) {
51+ dispatch(
52+ setToolPolicy({
53+ toolName: newToolName,
54+ policy: parsedSettings[tool],
55+ }),
56+ );
57+ dispatch(clearToolPolicy(tool));
58+ migratedToolSettings++;
59+ }
60+ }
61+ });
62+ if (migratedToolSettings > 0) {
63+ console.log(
64+ `Migrated ${migratedToolSettings} tool policies successfully.`,
65+ );
66+ }
67+ }
68+ }
69+ }
70+}
71+
72+export function migrateLocalStorage(dispatch: AppDispatch) {
73+ migrateToolPolicies(dispatch);
74+}