Elffuss BraidHub

kikocis/continue public

Fetch URL Content tool
Changeset32d59361d5be584889a6c2be8eaaba6a7b6a0679a43e7c932ffeffd808b94ca4
AuthorDallin Romney <dallinromney@gmail.com> · 2025-06-12 10:40 -07:00
CommitterDallin Romney <dallinromney@gmail.com> · 2025-06-12 10:40 -07:00
Parents10d213467f74

Browse the files at this changeset

9 files changed

modified core/tools/builtIn.ts +1 −1
@@ -11,7 +11,7 @@
1111 LSTool = "builtin_ls",
1212 CreateRuleBlock = "builtin_create_rule_block",
1313 RequestRule = "builtin_request_rule",
14- ReadUrl = "builtin_read_url",
14+ FetchUrlContent = "builtin_fetch_url_content",
1515
1616 // excluded from allTools for now
1717 ViewRepoMap = "builtin_view_repo_map",
modified core/tools/callTool.ts +3 −3
@@ -5,12 +5,12 @@
55
66 import { createNewFileImpl } from "./implementations/createNewFile";
77 import { createRuleBlockImpl } from "./implementations/createRuleBlock";
8+import { fetchUrlContentImpl } from "./implementations/fetchUrlContent";
89 import { fileGlobSearchImpl } from "./implementations/globSearch";
910 import { grepSearchImpl } from "./implementations/grepSearch";
1011 import { lsToolImpl } from "./implementations/lsTool";
1112 import { readCurrentlyOpenFileImpl } from "./implementations/readCurrentlyOpenFile";
1213 import { readFileImpl } from "./implementations/readFile";
13-import { readUrlImpl } from "./implementations/readUrl";
1414 import { requestRuleImpl } from "./implementations/requestRule";
1515 import { runTerminalCommandImpl } from "./implementations/runTerminalCommand";
1616 import { searchWebImpl } from "./implementations/searchWeb";
@@ -152,8 +152,8 @@
152152 return await runTerminalCommandImpl(args, extras);
153153 case BuiltInToolNames.SearchWeb:
154154 return await searchWebImpl(args, extras);
155- case BuiltInToolNames.ReadUrl:
156- return await readUrlImpl(args, extras);
155+ case BuiltInToolNames.FetchUrlContent:
156+ return await fetchUrlContentImpl(args, extras);
157157 case BuiltInToolNames.ViewDiff:
158158 return await viewDiffImpl(args, extras);
159159 case BuiltInToolNames.LSTool:
added core/tools/definitions/fetchUrlContent.ts +28 −0
@@ -0,0 +1,28 @@
1+import { Tool } from "../..";
2+import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
3+
4+export const fetchUrlContentTool: Tool = {
5+ type: "function",
6+ displayTitle: "Read URL",
7+ wouldLikeTo: "fetch {{{ url }}}",
8+ isCurrently: "fetching {{{ url }}}",
9+ hasAlready: "viewed {{{ url }}}",
10+ readonly: true,
11+ isInstant: true,
12+ group: BUILT_IN_GROUP_NAME,
13+ function: {
14+ name: BuiltInToolNames.FetchUrlContent,
15+ description:
16+ "Can be used to view the contents of a website using a URL. Do NOT use this for files.",
17+ parameters: {
18+ type: "object",
19+ required: ["url"],
20+ properties: {
21+ url: {
22+ type: "string",
23+ description: "The URL to read",
24+ },
25+ },
26+ },
27+ },
28+};
deleted core/tools/definitions/readURL.ts +0 −28
@@ -1,28 +0,0 @@
1-import { Tool } from "../..";
2-import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
3-
4-export const readUrlTool: Tool = {
5- type: "function",
6- displayTitle: "Read URL",
7- wouldLikeTo: "fetch {{{ url }}}",
8- isCurrently: "fetching {{{ url }}}",
9- hasAlready: "viewed {{{ url }}}",
10- readonly: true,
11- isInstant: true,
12- group: BUILT_IN_GROUP_NAME,
13- function: {
14- name: BuiltInToolNames.ReadUrl,
15- description:
16- "Can be used to view the contents of a website using a URL. Do NOT use this for files.",
17- parameters: {
18- type: "object",
19- required: ["url"],
20- properties: {
21- url: {
22- type: "string",
23- description: "The URL to read",
24- },
25- },
26- },
27- },
28-};
added core/tools/implementations/fetchUrlContent.ts +6 −0
@@ -0,0 +1,6 @@
1+import { ToolImpl } from ".";
2+import { getUrlContextItems } from "../../context/providers/URLContextProvider";
3+
4+export const fetchUrlContentImpl: ToolImpl = async (args, extras) => {
5+ return getUrlContextItems(args.url, extras.fetch);
6+};
deleted core/tools/implementations/readUrl.ts +0 −6
@@ -1,6 +0,0 @@
1-import { ToolImpl } from ".";
2-import { getUrlContextItems } from "../../context/providers/URLContextProvider";
3-
4-export const readUrlImpl: ToolImpl = async (args, extras) => {
5- return getUrlContextItems(args.url, extras.fetch);
6-};
modified core/tools/index.ts +2 −2
@@ -2,12 +2,12 @@
22 import { createNewFileTool } from "./definitions/createNewFile";
33 import { createRuleBlock } from "./definitions/createRuleBlock";
44 import { editFileTool } from "./definitions/editFile";
5+import { fetchUrlContentTool } from "./definitions/fetchUrlContent";
56 import { globSearchTool } from "./definitions/globSearch";
67 import { grepSearchTool } from "./definitions/grepSearch";
78 import { lsTool } from "./definitions/lsTool";
89 import { readCurrentlyOpenFileTool } from "./definitions/readCurrentlyOpenFile";
910 import { readFileTool } from "./definitions/readFile";
10-import { readUrlTool } from "./definitions/readURL";
1111 import { requestRuleTool } from "./definitions/requestRule";
1212 import { runTerminalCommandTool } from "./definitions/runTerminalCommand";
1313 import { searchWebTool } from "./definitions/searchWeb";
@@ -25,7 +25,7 @@
2525 readCurrentlyOpenFileTool,
2626 lsTool,
2727 createRuleBlock,
28- readUrlTool,
28+ fetchUrlContentTool,
2929 // replacing with ls tool for now
3030 // viewSubdirectoryTool,
3131 // viewRepoMapTool,
modified gui/src/pages/gui/ToolCallDiv/index.tsx +1 −1
@@ -41,7 +41,7 @@
4141 [BuiltInToolNames.LSTool]: FolderIcon,
4242 [BuiltInToolNames.ReadCurrentlyOpenFile]: DocumentTextIcon,
4343 [BuiltInToolNames.ReadFile]: DocumentIcon,
44- [BuiltInToolNames.ReadUrl]: GlobeAltIcon,
44+ [BuiltInToolNames.FetchUrlContent]: GlobeAltIcon,
4545 [BuiltInToolNames.SearchWeb]: GlobeAltIcon,
4646 [BuiltInToolNames.ViewDiff]: CodeBracketIcon,
4747 [BuiltInToolNames.ViewRepoMap]: MapIcon,
modified gui/src/redux/slices/uiSlice.ts +1 −1
@@ -53,7 +53,7 @@
5353 [BuiltInToolNames.GrepSearch]: "allowedWithoutPermission",
5454 [BuiltInToolNames.FileGlobSearch]: "allowedWithoutPermission",
5555 [BuiltInToolNames.SearchWeb]: "allowedWithoutPermission",
56- [BuiltInToolNames.ReadUrl]: "allowedWithPermission",
56+ [BuiltInToolNames.FetchUrlContent]: "allowedWithPermission",
5757 [BuiltInToolNames.ViewDiff]: "allowedWithoutPermission",
5858 [BuiltInToolNames.LSTool]: "allowedWithoutPermission",
5959 [BuiltInToolNames.CreateRuleBlock]: "allowedWithPermission",