Shoubhit Dash 3 месяцев назад
Родитель
Сommit
2481dde36d

+ 0 - 1
packages/opencode/src/agent/agent.ts

@@ -206,7 +206,6 @@ export const layer = Layer.effect(
                       glob: "allow",
                       webfetch: "allow",
                       websearch: "allow",
-                      codesearch: "allow",
                       read: "allow",
                       repo_clone: "allow",
                       repo_overview: "allow",

+ 0 - 12
packages/opencode/src/cli/cmd/tui/feature-plugins/system/session-v2.tsx

@@ -438,9 +438,6 @@ function AssistantTool(props: { part: SessionMessageAssistantTool; sessionID: st
       <Match when={props.part.name === "webfetch"}>
         <WebFetch {...toolprops} />
       </Match>
-      <Match when={props.part.name === "codesearch"}>
-        <CodeSearch {...toolprops} />
-      </Match>
       <Match when={props.part.name === "websearch"}>
         <WebSearch {...toolprops} />
       </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) {
   const label = createMemo(() => webSearchProviderLabel(props.metadata.provider))
   return (

+ 0 - 1
packages/opencode/src/config/permission.ts

@@ -27,7 +27,6 @@ const InputObject = Schema.StructWithRest(
     question: Schema.optional(Action),
     webfetch: Schema.optional(Action),
     websearch: Schema.optional(Action),
-    codesearch: Schema.optional(Action),
     repo_clone: Schema.optional(Rule),
     repo_overview: Schema.optional(Rule),
     lsp: Schema.optional(Rule),

+ 3 - 3
packages/opencode/src/skill/prompt/customize-opencode.md

@@ -335,9 +335,9 @@ rules last.
 everything" and is rarely what the user wants.
 
 Known permission keys: `read, edit, glob, grep, list, bash, task,
-external_directory, todowrite, question, webfetch, websearch, codesearch,
-repo_clone, repo_overview, lsp, doom_loop, skill`. Some of these (`todowrite,
-question, webfetch, websearch, codesearch, doom_loop`) only accept a flat
+external_directory, todowrite, question, webfetch, websearch, repo_clone,
+repo_overview, lsp, doom_loop, skill`. Some of these (`todowrite,
+question, webfetch, websearch, doom_loop`) only accept a flat
 action, not a per-pattern object.
 
 `external_directory` patterns are filesystem paths (use `~/`, absolute paths,

+ 0 - 63
packages/opencode/src/tool/codesearch.ts

@@ -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),
-    }
-  }),
-)

+ 0 - 12
packages/opencode/src/tool/codesearch.txt

@@ -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'

+ 0 - 5
packages/opencode/src/tool/mcp-websearch.ts

@@ -48,11 +48,6 @@ export const SearchArgs = Schema.Struct({
   contextMaxCharacters: Schema.optional(Schema.Number),
 })
 
-export const CodeArgs = Schema.Struct({
-  query: Schema.String,
-  tokensNum: Schema.Number,
-})
-
 export const ParallelSearchArgs = Schema.Struct({
   objective: Schema.String,
   search_queries: Schema.Array(Schema.String),

+ 1 - 4
packages/opencode/src/tool/registry.ts

@@ -22,7 +22,6 @@ import { Plugin } from "../plugin"
 import { Provider } from "@/provider/provider"
 import { ProviderID, type ModelID } from "../provider/schema"
 import { WebSearchTool } from "./websearch"
-import { CodeSearchTool } from "./codesearch"
 import { RepoCloneTool } from "./repo_clone"
 import { RepoOverviewTool } from "./repo_overview"
 import { Flag } from "@opencode-ai/core/flag/flag"
@@ -120,7 +119,6 @@ export const layer: Layer.Layer<
     const plan = yield* PlanExitTool
     const webfetch = yield* WebFetchTool
     const websearch = yield* WebSearchTool
-    const codesearch = yield* CodeSearchTool
     const repoClone = yield* RepoCloneTool
     const repoOverview = yield* RepoOverviewTool
     const shell = yield* ShellTool
@@ -224,7 +222,6 @@ export const layer: Layer.Layer<
           fetch: Tool.init(webfetch),
           todo: Tool.init(todo),
           search: Tool.init(websearch),
-          code: Tool.init(codesearch),
           repo_clone: Tool.init(repoClone),
           repo_overview: Tool.init(repoOverview),
           skill: Tool.init(skilltool),
@@ -249,7 +246,7 @@ export const layer: Layer.Layer<
             tool.fetch,
             tool.todo,
             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.patch,
             ...(Flag.OPENCODE_EXPERIMENTAL_LSP_TOOL ? [tool.lsp] : []),

+ 0 - 2
packages/opencode/test/tool/registry.test.ts

@@ -72,7 +72,6 @@ describe("tool.registry", () => {
       const registry = yield* ToolRegistry.Service
       const ids = yield* registry.ids()
 
-      expect(ids).not.toContain("codesearch")
       expect(ids).not.toContain("repo_clone")
       expect(ids).not.toContain("repo_overview")
     }),
@@ -84,7 +83,6 @@ describe("tool.registry", () => {
       const registry = yield* ToolRegistry.Service
       const ids = yield* registry.ids()
 
-      expect(ids).toContain("codesearch")
       expect(ids).toContain("repo_clone")
       expect(ids).toContain("repo_overview")
     }),

+ 0 - 1
packages/sdk/js/src/v2/gen/types.gen.ts

@@ -955,7 +955,6 @@ export type PermissionConfig =
       question?: PermissionActionConfig
       webfetch?: PermissionActionConfig
       websearch?: PermissionActionConfig
-      codesearch?: PermissionActionConfig
       repo_clone?: PermissionRuleConfig
       repo_overview?: PermissionRuleConfig
       lsp?: PermissionRuleConfig

+ 0 - 3
packages/sdk/openapi.json

@@ -11631,9 +11631,6 @@
               "websearch": {
                 "$ref": "#/components/schemas/PermissionActionConfig"
               },
-              "codesearch": {
-                "$ref": "#/components/schemas/PermissionActionConfig"
-              },
               "repo_clone": {
                 "$ref": "#/components/schemas/PermissionRuleConfig"
               },