Elffuss BraidHub

kikocis/continue public

cfc91aa76b54 · 1.5 KiBRawPermalink
1import { Tool } from "../..";
2import { EDIT_CODE_INSTRUCTIONS } from "../../llm/defaultSystemMessages";
3import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
4import { NO_PARALLEL_TOOL_CALLING_INSRUCTION } from "./searchAndReplaceInFile";
5
6export interface EditToolArgs {
7 filepath: string;
8 changes: string;
9}
10
11export const editFileTool: Tool = {
12 type: "function",
13 displayTitle: "Edit File",
14 wouldLikeTo: "edit {{{ filepath }}}",
15 isCurrently: "editing {{{ filepath }}}",
16 hasAlready: "edited {{{ filepath }}}",
17 group: BUILT_IN_GROUP_NAME,
18 readonly: false,
19 isInstant: false,
20 function: {
21 name: BuiltInToolNames.EditExistingFile,
22 description: `Use this tool to edit an existing file. If you don't know the contents of the file, read it first.\n${EDIT_CODE_INSTRUCTIONS}\n${NO_PARALLEL_TOOL_CALLING_INSRUCTION}`,
23 parameters: {
24 type: "object",
25 required: ["filepath", "changes"],
26 properties: {
27 filepath: {
28 type: "string",
29 description:
30 "The path of the file to edit, relative to the root of the workspace.",
31 },
32 changes: {
33 type: "string",
34 description:
35 "Any modifications to the file, showing only needed changes. Do NOT wrap this in a codeblock or write anything besides the code changes. In larger files, use brief language-appropriate placeholders for large unmodified sections, e.g. '// ... existing code ...'",
36 },
37 },
38 },
39 },
40};