chore: remove codesearch tool (#27019)
This commit is contained in:
@@ -206,7 +206,6 @@ export const layer = Layer.effect(
|
|||||||
glob: "allow",
|
glob: "allow",
|
||||||
webfetch: "allow",
|
webfetch: "allow",
|
||||||
websearch: "allow",
|
websearch: "allow",
|
||||||
codesearch: "allow",
|
|
||||||
read: "allow",
|
read: "allow",
|
||||||
repo_clone: "allow",
|
repo_clone: "allow",
|
||||||
repo_overview: "allow",
|
repo_overview: "allow",
|
||||||
|
|||||||
@@ -438,9 +438,6 @@ function AssistantTool(props: { part: SessionMessageAssistantTool; sessionID: st
|
|||||||
<Match when={props.part.name === "webfetch"}>
|
<Match when={props.part.name === "webfetch"}>
|
||||||
<WebFetch {...toolprops} />
|
<WebFetch {...toolprops} />
|
||||||
</Match>
|
</Match>
|
||||||
<Match when={props.part.name === "codesearch"}>
|
|
||||||
<CodeSearch {...toolprops} />
|
|
||||||
</Match>
|
|
||||||
<Match when={props.part.name === "websearch"}>
|
<Match when={props.part.name === "websearch"}>
|
||||||
<WebSearch {...toolprops} />
|
<WebSearch {...toolprops} />
|
||||||
</Match>
|
</Match>
|
||||||
@@ -773,15 +770,6 @@ function WebFetch(props: ToolProps) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function CodeSearch(props: ToolProps) {
|
|
||||||
return (
|
|
||||||
<InlineTool icon="◇" pending="Searching code..." complete={toolComplete(props.part)} part={props.part}>
|
|
||||||
Exa Code Search "{stringValue(props.input.query) ?? pendingInput(props.part)}"{" "}
|
|
||||||
<Show when={numberValue(props.metadata.results)}>{(results) => <>({results()} results)</>}</Show>
|
|
||||||
</InlineTool>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function WebSearch(props: ToolProps) {
|
function WebSearch(props: ToolProps) {
|
||||||
const label = createMemo(() => webSearchProviderLabel(props.metadata.provider))
|
const label = createMemo(() => webSearchProviderLabel(props.metadata.provider))
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ const InputObject = Schema.StructWithRest(
|
|||||||
question: Schema.optional(Action),
|
question: Schema.optional(Action),
|
||||||
webfetch: Schema.optional(Action),
|
webfetch: Schema.optional(Action),
|
||||||
websearch: Schema.optional(Action),
|
websearch: Schema.optional(Action),
|
||||||
codesearch: Schema.optional(Action),
|
|
||||||
repo_clone: Schema.optional(Rule),
|
repo_clone: Schema.optional(Rule),
|
||||||
repo_overview: Schema.optional(Rule),
|
repo_overview: Schema.optional(Rule),
|
||||||
lsp: Schema.optional(Rule),
|
lsp: Schema.optional(Rule),
|
||||||
|
|||||||
@@ -335,9 +335,9 @@ rules last.
|
|||||||
everything" and is rarely what the user wants.
|
everything" and is rarely what the user wants.
|
||||||
|
|
||||||
Known permission keys: `read, edit, glob, grep, list, bash, task,
|
Known permission keys: `read, edit, glob, grep, list, bash, task,
|
||||||
external_directory, todowrite, question, webfetch, websearch, codesearch,
|
external_directory, todowrite, question, webfetch, websearch, repo_clone,
|
||||||
repo_clone, repo_overview, lsp, doom_loop, skill`. Some of these (`todowrite,
|
repo_overview, lsp, doom_loop, skill`. Some of these (`todowrite,
|
||||||
question, webfetch, websearch, codesearch, doom_loop`) only accept a flat
|
question, webfetch, websearch, doom_loop`) only accept a flat
|
||||||
action, not a per-pattern object.
|
action, not a per-pattern object.
|
||||||
|
|
||||||
`external_directory` patterns are filesystem paths (use `~/`, absolute paths,
|
`external_directory` patterns are filesystem paths (use `~/`, absolute paths,
|
||||||
|
|||||||
@@ -1,63 +0,0 @@
|
|||||||
import { Effect, Schema } from "effect"
|
|
||||||
import { HttpClient } from "effect/unstable/http"
|
|
||||||
import * as Tool from "./tool"
|
|
||||||
import * as McpWebSearch from "./mcp-websearch"
|
|
||||||
import DESCRIPTION from "./codesearch.txt"
|
|
||||||
|
|
||||||
export const Parameters = Schema.Struct({
|
|
||||||
query: Schema.String.annotate({
|
|
||||||
description:
|
|
||||||
"Search query to find relevant context for APIs, Libraries, and SDKs. For example, 'React useState hook examples', 'Python pandas dataframe filtering', 'Express.js middleware', 'Next js partial prerendering configuration'",
|
|
||||||
}),
|
|
||||||
tokensNum: Schema.Number.check(Schema.isGreaterThanOrEqualTo(1000))
|
|
||||||
.check(Schema.isLessThanOrEqualTo(50000))
|
|
||||||
.pipe(Schema.optional, Schema.withDecodingDefault(Effect.succeed(5000)))
|
|
||||||
.annotate({
|
|
||||||
description:
|
|
||||||
"Number of tokens to return (1000-50000). Default is 5000 tokens. Adjust this value based on how much context you need - use lower values for focused queries and higher values for comprehensive documentation.",
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const CodeSearchTool = Tool.define(
|
|
||||||
"codesearch",
|
|
||||||
Effect.gen(function* () {
|
|
||||||
const http = yield* HttpClient.HttpClient
|
|
||||||
|
|
||||||
return {
|
|
||||||
description: DESCRIPTION,
|
|
||||||
parameters: Parameters,
|
|
||||||
execute: (params: { query: string; tokensNum: number }, ctx: Tool.Context) =>
|
|
||||||
Effect.gen(function* () {
|
|
||||||
yield* ctx.ask({
|
|
||||||
permission: "codesearch",
|
|
||||||
patterns: [params.query],
|
|
||||||
always: ["*"],
|
|
||||||
metadata: {
|
|
||||||
query: params.query,
|
|
||||||
tokensNum: params.tokensNum,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const result = yield* McpWebSearch.call(
|
|
||||||
http,
|
|
||||||
McpWebSearch.EXA_URL,
|
|
||||||
"get_code_context_exa",
|
|
||||||
McpWebSearch.CodeArgs,
|
|
||||||
{
|
|
||||||
query: params.query,
|
|
||||||
tokensNum: params.tokensNum,
|
|
||||||
},
|
|
||||||
"30 seconds",
|
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
|
||||||
output:
|
|
||||||
result ??
|
|
||||||
"No code snippets or documentation found. Please try a different query, be more specific about the library or programming concept, or check the spelling of framework names.",
|
|
||||||
title: `Code search: ${params.query}`,
|
|
||||||
metadata: {},
|
|
||||||
}
|
|
||||||
}).pipe(Effect.orDie),
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
- Search and get relevant context for any programming task using Exa Code API
|
|
||||||
- Provides the highest quality and freshest context for libraries, SDKs, and APIs
|
|
||||||
- Use this tool for ANY question or task related to programming
|
|
||||||
- Returns comprehensive code examples, documentation, and API references
|
|
||||||
- Optimized for finding specific programming patterns and solutions
|
|
||||||
|
|
||||||
Usage notes:
|
|
||||||
- Adjustable token count (1000-50000) for focused or comprehensive results
|
|
||||||
- Default 5000 tokens provides balanced context for most queries
|
|
||||||
- Use lower values for specific questions, higher values for comprehensive documentation
|
|
||||||
- Supports queries about frameworks, libraries, APIs, and programming concepts
|
|
||||||
- Examples: 'React useState hook examples', 'Python pandas dataframe filtering', 'Express.js middleware'
|
|
||||||
@@ -48,11 +48,6 @@ export const SearchArgs = Schema.Struct({
|
|||||||
contextMaxCharacters: Schema.optional(Schema.Number),
|
contextMaxCharacters: Schema.optional(Schema.Number),
|
||||||
})
|
})
|
||||||
|
|
||||||
export const CodeArgs = Schema.Struct({
|
|
||||||
query: Schema.String,
|
|
||||||
tokensNum: Schema.Number,
|
|
||||||
})
|
|
||||||
|
|
||||||
export const ParallelSearchArgs = Schema.Struct({
|
export const ParallelSearchArgs = Schema.Struct({
|
||||||
objective: Schema.String,
|
objective: Schema.String,
|
||||||
search_queries: Schema.Array(Schema.String),
|
search_queries: Schema.Array(Schema.String),
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import { Plugin } from "../plugin"
|
|||||||
import { Provider } from "@/provider/provider"
|
import { Provider } from "@/provider/provider"
|
||||||
import { ProviderID, type ModelID } from "../provider/schema"
|
import { ProviderID, type ModelID } from "../provider/schema"
|
||||||
import { WebSearchTool } from "./websearch"
|
import { WebSearchTool } from "./websearch"
|
||||||
import { CodeSearchTool } from "./codesearch"
|
|
||||||
import { RepoCloneTool } from "./repo_clone"
|
import { RepoCloneTool } from "./repo_clone"
|
||||||
import { RepoOverviewTool } from "./repo_overview"
|
import { RepoOverviewTool } from "./repo_overview"
|
||||||
import { Flag } from "@opencode-ai/core/flag/flag"
|
import { Flag } from "@opencode-ai/core/flag/flag"
|
||||||
@@ -120,7 +119,6 @@ export const layer: Layer.Layer<
|
|||||||
const plan = yield* PlanExitTool
|
const plan = yield* PlanExitTool
|
||||||
const webfetch = yield* WebFetchTool
|
const webfetch = yield* WebFetchTool
|
||||||
const websearch = yield* WebSearchTool
|
const websearch = yield* WebSearchTool
|
||||||
const codesearch = yield* CodeSearchTool
|
|
||||||
const repoClone = yield* RepoCloneTool
|
const repoClone = yield* RepoCloneTool
|
||||||
const repoOverview = yield* RepoOverviewTool
|
const repoOverview = yield* RepoOverviewTool
|
||||||
const shell = yield* ShellTool
|
const shell = yield* ShellTool
|
||||||
@@ -224,7 +222,6 @@ export const layer: Layer.Layer<
|
|||||||
fetch: Tool.init(webfetch),
|
fetch: Tool.init(webfetch),
|
||||||
todo: Tool.init(todo),
|
todo: Tool.init(todo),
|
||||||
search: Tool.init(websearch),
|
search: Tool.init(websearch),
|
||||||
code: Tool.init(codesearch),
|
|
||||||
repo_clone: Tool.init(repoClone),
|
repo_clone: Tool.init(repoClone),
|
||||||
repo_overview: Tool.init(repoOverview),
|
repo_overview: Tool.init(repoOverview),
|
||||||
skill: Tool.init(skilltool),
|
skill: Tool.init(skilltool),
|
||||||
@@ -249,7 +246,7 @@ export const layer: Layer.Layer<
|
|||||||
tool.fetch,
|
tool.fetch,
|
||||||
tool.todo,
|
tool.todo,
|
||||||
tool.search,
|
tool.search,
|
||||||
...(Flag.OPENCODE_EXPERIMENTAL_SCOUT ? [tool.code, tool.repo_clone, tool.repo_overview] : []),
|
...(Flag.OPENCODE_EXPERIMENTAL_SCOUT ? [tool.repo_clone, tool.repo_overview] : []),
|
||||||
tool.skill,
|
tool.skill,
|
||||||
tool.patch,
|
tool.patch,
|
||||||
...(Flag.OPENCODE_EXPERIMENTAL_LSP_TOOL ? [tool.lsp] : []),
|
...(Flag.OPENCODE_EXPERIMENTAL_LSP_TOOL ? [tool.lsp] : []),
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ describe("tool.registry", () => {
|
|||||||
const registry = yield* ToolRegistry.Service
|
const registry = yield* ToolRegistry.Service
|
||||||
const ids = yield* registry.ids()
|
const ids = yield* registry.ids()
|
||||||
|
|
||||||
expect(ids).not.toContain("codesearch")
|
|
||||||
expect(ids).not.toContain("repo_clone")
|
expect(ids).not.toContain("repo_clone")
|
||||||
expect(ids).not.toContain("repo_overview")
|
expect(ids).not.toContain("repo_overview")
|
||||||
}),
|
}),
|
||||||
@@ -84,7 +83,6 @@ describe("tool.registry", () => {
|
|||||||
const registry = yield* ToolRegistry.Service
|
const registry = yield* ToolRegistry.Service
|
||||||
const ids = yield* registry.ids()
|
const ids = yield* registry.ids()
|
||||||
|
|
||||||
expect(ids).toContain("codesearch")
|
|
||||||
expect(ids).toContain("repo_clone")
|
expect(ids).toContain("repo_clone")
|
||||||
expect(ids).toContain("repo_overview")
|
expect(ids).toContain("repo_overview")
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -955,7 +955,6 @@ export type PermissionConfig =
|
|||||||
question?: PermissionActionConfig
|
question?: PermissionActionConfig
|
||||||
webfetch?: PermissionActionConfig
|
webfetch?: PermissionActionConfig
|
||||||
websearch?: PermissionActionConfig
|
websearch?: PermissionActionConfig
|
||||||
codesearch?: PermissionActionConfig
|
|
||||||
repo_clone?: PermissionRuleConfig
|
repo_clone?: PermissionRuleConfig
|
||||||
repo_overview?: PermissionRuleConfig
|
repo_overview?: PermissionRuleConfig
|
||||||
lsp?: PermissionRuleConfig
|
lsp?: PermissionRuleConfig
|
||||||
|
|||||||
@@ -11631,9 +11631,6 @@
|
|||||||
"websearch": {
|
"websearch": {
|
||||||
"$ref": "#/components/schemas/PermissionActionConfig"
|
"$ref": "#/components/schemas/PermissionActionConfig"
|
||||||
},
|
},
|
||||||
"codesearch": {
|
|
||||||
"$ref": "#/components/schemas/PermissionActionConfig"
|
|
||||||
},
|
|
||||||
"repo_clone": {
|
"repo_clone": {
|
||||||
"$ref": "#/components/schemas/PermissionRuleConfig"
|
"$ref": "#/components/schemas/PermissionRuleConfig"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user