Skip to content

Commit 4643e65

Browse files
fix(opencode): enable web search for Go (anomalyco#42630)
Co-authored-by: Aiden Cline <rekram1-node@users.noreply.github.com>
1 parent e23586a commit 4643e65

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎packages/opencode/src/tool/registry.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ import { PermissionV1 } from "@opencode-ai/core/v1/permission"
5656
import { McpCatalog } from "@/mcp/catalog"
5757

5858
export function webSearchEnabled(providerID: ProviderV2.ID, flags = { exa: false, parallel: false }) {
59-
return providerID === ProviderV2.ID.opencode || flags.exa || flags.parallel
59+
return (
60+
providerID === ProviderV2.ID.opencode ||
61+
providerID === ProviderV2.ID.make("opencode-go") ||
62+
flags.exa ||
63+
flags.parallel
64+
)
6065
}
6166

6267
type TaskDef = Tool.InferDef<typeof TaskTool>

‎packages/opencode/test/tool/websearch.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ describe("websearch provider", () => {
3737
expect(selectWebSearchProvider(SESSION_ID, { exa: false, parallel: true })).toBe("parallel")
3838
})
3939

40-
test("is only enabled for opencode or explicit websearch provider flags", () => {
40+
test("is enabled for OpenCode providers or explicit websearch provider flags", () => {
4141
expect(webSearchEnabled(ProviderV2.ID.opencode, { exa: false, parallel: false })).toBe(true)
42+
expect(webSearchEnabled(ProviderV2.ID.make("opencode-go"), { exa: false, parallel: false })).toBe(true)
4243
expect(webSearchEnabled(ProviderV2.ID.openai, { exa: false, parallel: false })).toBe(false)
4344
expect(webSearchEnabled(ProviderV2.ID.openai, { exa: true, parallel: false })).toBe(true)
4445
expect(webSearchEnabled(ProviderV2.ID.openai, { exa: false, parallel: true })).toBe(true)

‎packages/web/src/content/docs/tools.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ Allows the LLM to fetch and read web pages. Useful for looking up documentation
257257
Search the web for information.
258258

259259
:::note
260-
This tool is only available when using the OpenCode provider or when the `OPENCODE_ENABLE_EXA` environment variable is set to any truthy value (e.g., `true` or `1`).
260+
This tool is only available when using the OpenCode or OpenCode Go provider, or when the `OPENCODE_ENABLE_EXA` environment variable is set to any truthy value (e.g., `true` or `1`).
261261

262262
To enable when launching OpenCode:
263263

0 commit comments

Comments
 (0)