From 390bd2b01cc6fbd0f691307a0a239c2392648938 Mon Sep 17 00:00:00 2001 From: Ariane Emory Date: Sat, 28 Mar 2026 17:01:52 -0400 Subject: [PATCH] feat: add experimental.enable_exa config setting Add experimental.enable_exa to opencode.json config schema. This allows enabling Exa experimental features via config file in addition to the OPENCODE_EXPERIMENTAL_EXA environment variable. Changes: - Add enable_exa to experimental config schema - Add experimentalEnableExa() helper function - Update tool/registry.ts to check config in addition to env var Follows the same pattern as experimental.plan_mode. --- packages/opencode/src/config/config.ts | 11 +++++++++++ packages/opencode/src/tool/registry.ts | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index c464fcb64ab8..5d9a043d1798 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -1225,6 +1225,10 @@ export namespace Config { .positive() .optional() .describe("Timeout in milliseconds for model context protocol (MCP) requests"), + enable_exa: z + .boolean() + .optional() + .describe("Enable experimental Exa features"), }) .optional(), }) @@ -1459,6 +1463,13 @@ export namespace Config { export async function directories() { return state().then((x) => x.directories) } + + export async function experimentalEnableExa(): Promise { + // Environment variable takes precedence + if (Flag.OPENCODE_ENABLE_EXA) return true + const config = await get() + return config.experimental?.enable_exa === true + } } Filesystem.write Filesystem.write diff --git a/packages/opencode/src/tool/registry.ts b/packages/opencode/src/tool/registry.ts index 6381fcfbc0c2..9f8521474d88 100644 --- a/packages/opencode/src/tool/registry.ts +++ b/packages/opencode/src/tool/registry.ts @@ -158,13 +158,14 @@ export namespace ToolRegistry { ) { const state = yield* InstanceState.get(cache) const allTools = yield* Effect.promise(() => all(state.custom)) + const enableExa = yield* Effect.promise(() => Config.experimentalEnableExa()) return yield* Effect.promise(() => Promise.all( allTools .filter((tool) => { // Enable websearch/codesearch for zen users OR via enable flag if (tool.id === "codesearch" || tool.id === "websearch") { - return model.providerID === ProviderID.opencode || Flag.OPENCODE_ENABLE_EXA + return model.providerID === ProviderID.opencode || enableExa } // use apply tool in same format as codex