A desktop coding agent with free access to frontier models.
TypeScript
feat: web search switch in Settings
ogsamrat742599a83e14
diff --git a/apps/app/src/app/lib/omnirush-server.ts b/apps/app/src/app/lib/omnirush-server.tsindex e3f42c22..90801df4 100644--- a/apps/app/src/app/lib/omnirush-server.ts+++ b/apps/app/src/app/lib/omnirush-server.ts@@ -607,6 +607,9 @@ export type OmniRushGoodSession = {messages?: Record<string, string>;};+/** The user's web search switch (GET/PUT /omnirush/web-search): `enabled` = on and allowed by the server. */+export type OmniRushWebSearchState = { enabled: boolean; user: boolean; serverAllows: boolean };+export type OmniRushSubagentModelState = {setting: OmniRushSubagentModelSetting;/** Whether an omnirush.ai account is signed in (its models can run). */@@ -2262,6 +2265,16 @@ export function createOmniRushServerClient(options: { baseUrl: string; token?: sbody: setting,timeoutMs: timeouts.config,}),+ getWebSearch: () =>+ requestJson<OmniRushWebSearchState>(baseUrl, "/omnirush/web-search", { token, hostToken, timeoutMs: timeouts.config }),+ setWebSearch: (enabled: boolean) =>+ requestJson<OmniRushWebSearchState & { ok: boolean }>(baseUrl, "/omnirush/web-search", {+ token,+ hostToken,+ method: "PUT",+ body: { enabled },+ timeoutMs: timeouts.config,+ }),patchConfig: (workspaceId: string, payload: { opencode?: Record<string, unknown>; omnirush?: Record<string, unknown> }) =>requestJson<{ updatedAt?: number | null }>(baseUrl, `/workspace/${workspaceId}/config`, {token,diff --git a/apps/app/src/react-app/domains/settings/pages/preferences-view.tsx b/apps/app/src/react-app/domains/settings/pages/preferences-view.tsxindex 5374998b..1b6416ad 100644--- a/apps/app/src/react-app/domains/settings/pages/preferences-view.tsx+++ b/apps/app/src/react-app/domains/settings/pages/preferences-view.tsx@@ -30,6 +30,7 @@ import {} from "../settings-layout";import { DesktopIntegrationSection } from "../desktop-integration-section";import { SubagentModelSettings } from "../subagent-model-settings";+import { WebSearchSetting, type WebSearchClient } from "../web-search-setting";import type { SubagentModelClient } from "../subagent-model";export type PreferencesViewProps = {@@ -46,6 +47,8 @@ export type PreferencesViewProps = {onDesktopNotificationsChange: (value: DesktopNotificationPreference) => void;/** The server whose sub-agent model setting the Model section shows; hidden without one. */subagentModelClient?: SubagentModelClient | null;+ /** The server whose web search switch the Model section shows; hidden without one. */+ webSearchClient?: WebSearchClient | null;};function desktopNotificationPreferenceLabel(value: DesktopNotificationPreference) {@@ -104,6 +107,9 @@ export function PreferencesView(props: PreferencesViewProps) {</LayoutSectionItemHeader></LayoutSectionItem>+ {/* Web search */}+ <WebSearchSetting client={props.webSearchClient ?? null} busy={props.busy} />+{/* Show reasoning */}<LayoutSectionItem><LayoutSectionItemHeader>diff --git a/apps/app/src/react-app/domains/settings/web-search-setting.tsx b/apps/app/src/react-app/domains/settings/web-search-setting.tsxnew file mode 100644index 00000000..38ec9dd0--- /dev/null+++ b/apps/app/src/react-app/domains/settings/web-search-setting.tsx@@ -0,0 +1,64 @@+/** @jsxImportSource react */+import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";++import { Switch } from "@/components/ui/switch";+import { toast } from "@/components/ui/sonner";+import type { OmniRushServerClient, OmniRushWebSearchState } from "@/app/lib/omnirush-server";+import { useDesktopRestriction } from "@/react-app/domains/cloud/desktop-config-provider";++import {+ LayoutSectionItem,+ LayoutSectionItemDescription,+ LayoutSectionItemHeader,+ LayoutSectionItemHeaderActions,+ LayoutSectionItemTitle,+} from "./settings-layout";++export type WebSearchClient = Pick<OmniRushServerClient, "getWebSearch" | "setWebSearch"> & { baseUrl?: string };++export const WEB_SEARCH_TITLE = "Web search";+export const WEB_SEARCH_HELP = "Lets the agent search the web. Off: the agent gets no web search tool from the next message on. It can still open a web page you give it.";+export const WEB_SEARCH_SERVER_OFF = "Web search is turned off for your account.";++/**+ * Settings > Preferences > Model: "Web search" (on by default). The server's switch wins: while it+ * is off the switch shows off and cannot be turned on (GET/PUT /omnirush/web-search).+ */+export function WebSearchSetting(props: { client: WebSearchClient | null; busy?: boolean }) {+ const policyLocked = useDesktopRestriction("allowControlSettings");+ const queryClient = useQueryClient();+ const key = ["omnirush-web-search", props.client?.baseUrl?.trim() || "default"];+ const query = useQuery({+ queryKey: key,+ queryFn: () => props.client!.getWebSearch(),+ enabled: Boolean(props.client),+ });+ const mutation = useMutation({+ mutationFn: (enabled: boolean) => props.client!.setWebSearch(enabled),+ onSuccess: (state) => queryClient.setQueryData<OmniRushWebSearchState>(key, { enabled: state.enabled, user: state.user, serverAllows: state.serverAllows }),+ onError: (reason: unknown) => toast.error(reason instanceof Error ? reason.message : "The web search setting could not be saved."),+ });+ if (!props.client) return null;+ const state = query.data;+ const serverOff = state ? !state.serverAllows : false;+ return (+ <LayoutSectionItem>+ <LayoutSectionItemHeader>+ <LayoutSectionItemTitle>{WEB_SEARCH_TITLE}</LayoutSectionItemTitle>+ <LayoutSectionItemDescription>+ {WEB_SEARCH_HELP}+ {serverOff ? <span className="mt-1 block" data-testid="settings-web-search-status">{WEB_SEARCH_SERVER_OFF}</span> : null}+ </LayoutSectionItemDescription>+ <LayoutSectionItemHeaderActions>+ <Switch+ aria-label={WEB_SEARCH_TITLE}+ data-testid="settings-web-search"+ checked={state ? state.enabled : true}+ disabled={Boolean(props.busy) || policyLocked || !state || serverOff || mutation.isPending}+ onCheckedChange={(checked: boolean) => mutation.mutate(checked)}+ />+ </LayoutSectionItemHeaderActions>+ </LayoutSectionItemHeader>+ </LayoutSectionItem>+ );+}diff --git a/apps/app/src/react-app/shell/settings-route.tsx b/apps/app/src/react-app/shell/settings-route.tsxindex f07873c9..9402a2ec 100644--- a/apps/app/src/react-app/shell/settings-route.tsx+++ b/apps/app/src/react-app/shell/settings-route.tsx@@ -2380,6 +2380,7 @@ function SettingsRouteContent(props: SettingsSurfaceProps = {}) {local.setPrefs((previous) => ({ ...previous, desktopNotifications }));}}subagentModelClient={omnirushClient}+ webSearchClient={omnirushClient}/>);case "extensions":diff --git a/apps/app/tests/settings-default-model.test.tsx b/apps/app/tests/settings-default-model.test.tsxindex fef407f5..837ef6df 100644--- a/apps/app/tests/settings-default-model.test.tsx+++ b/apps/app/tests/settings-default-model.test.tsx@@ -24,12 +24,16 @@ describe("settings default model", () => {onToggleAutoCompactContext={() => {}}desktopNotifications="important"onDesktopNotificationsChange={() => {}}+ webSearchClient={{ getWebSearch: async () => ({ enabled: true, user: true, serverAllows: true }), setWebSearch: async () => ({ ok: true, enabled: true, user: true, serverAllows: true }) }}/></QueryClientProvider>,);expect(markup).toContain("Default model");expect(markup).toMatch(/data-testid="settings-default-model">OmniRush - GPT 6 Astra</);expect(markup).toMatch(/<button[^>]*data-testid="settings-default-model-change"[^>]*>Change<\/button>/);+ // Web search sits in the same section, on by default until the server answers.+ expect(markup).toContain("Web search");+ expect(markup).toMatch(/data-testid="settings-web-search"/);});});diff --git a/apps/server/src/engine-v2-preview.ts b/apps/server/src/engine-v2-preview.tsindex 4b30a1fe..a86fa567 100644--- a/apps/server/src/engine-v2-preview.ts+++ b/apps/server/src/engine-v2-preview.ts@@ -553,6 +553,7 @@ export function createEngineV2Preview(options: {},permissions: async () => executionRules((await readGlobalRuntimeOpencodeConfig(config)).managedPolicy?.execution),webSearch: () => webSearchSetting({ env: process.env, stateDir: runtimeStorageDir(config) }).enabled,+ webSearchOff: () => webSearchSetting({ env: process.env, stateDir: runtimeStorageDir(config) }).source === "user",// The Linux sandbox (box/): the shell and box plugin follow BoxService.engineBits on every config write.box: async () => v2BoxBits(await boxServiceFor(config).engineBits()),titleModel: () => omnirushTitleModel(config),diff --git a/apps/server/src/managed-opencode-v2.env.test.ts b/apps/server/src/managed-opencode-v2.env.test.tsindex 1480da3b..e790e13c 100644--- a/apps/server/src/managed-opencode-v2.env.test.ts+++ b/apps/server/src/managed-opencode-v2.env.test.ts@@ -105,3 +105,30 @@ test("the Claude provider is an AI SDK file package of the catalog's Claude modeexpect(spec?.package).toMatch(/^aisdk:file:\/\/.*claude-provider\/index\.js$/);expect(spec?.models.map((model) => [model.id, model.name])).toEqual([["claude-opus-5-5", "Claude Opus 5.5"]]);});++posix("web search off in Settings: the engine offers no websearch tool, in normal and in stock mode", async () => {+ const dir = await mkdtemp(join(tmpdir(), "v2-wsoff-"));+ const farm = process.env.OMNIRUSH_FARM;+ try {+ const bin = join(dir, "fake-v2");+ await writeFile(bin, "#!/bin/sh\nexit 3\n");+ await chmod(bin, 0o755);+ const deny = { action: "websearch", resource: "*", effect: "deny" };+ for (const stock of [false, true]) {+ if (stock) process.env.OMNIRUSH_FARM = "1"; else delete process.env.OMNIRUSH_FARM;+ for (const off of [false, true]) {+ const rootDir = join(dir, `${stock}-${off}`);+ await createManagedOpencodeV2Server({ bin, rootDir, bootTimeoutMs: 5_000, webSearch: () => true, webSearchOff: () => off, permissions: async () => [{ action: "shell", resource: "rm", effect: "deny" }] })+ .then((server) => server.close(), () => undefined);+ const config = JSON.parse(await readFile(join(rootDir, "config", "opencode.json"), "utf8"));+ // The engine leaves out a tool whose action is denied on "*" (its whollyDisabled), whatever the agent.+ expect(config.permissions.some((rule: unknown) => JSON.stringify(rule) === JSON.stringify(deny))).toBe(off);+ expect(config.permissions[0]).toEqual({ action: "shell", resource: "rm", effect: "deny" });+ expect(config.websearch).toEqual(!off && !stock ? { provider: "exa" } : undefined);+ }+ }+ } finally {+ if (farm === undefined) delete process.env.OMNIRUSH_FARM; else process.env.OMNIRUSH_FARM = farm;+ await rm(dir, { recursive: true, force: true });+ }+});diff --git a/apps/server/src/managed-opencode-v2.ts b/apps/server/src/managed-opencode-v2.tsindex 44d52c8c..7688a9c3 100644--- a/apps/server/src/managed-opencode-v2.ts+++ b/apps/server/src/managed-opencode-v2.ts@@ -73,6 +73,8 @@ export interface ManagedOpencodeV2ServerOptions {permissions?: () => Promise<EnginePermissionRule[]>;/** Whether the server's web-search switch is on (web-search.ts): the stock websearch tool then searches. */webSearch?: () => boolean;+ /** Whether the user turned web search off in Settings (web-search.ts): no websearch tool is offered at all. */+ webSearchOff?: () => boolean;/** The MCP servers the engine's gate allows (engine-v2-mcp.ts); none when absent. */mcpGate?: string[];/** The Linux sandbox's engine bits (engine-v2-preview.ts v2BoxBits): the box shell and the 2.x box plugin; null: none. */@@ -161,6 +163,11 @@ export function engineV2SpawnEnv(env: Record<string, string>, mcp: readonly strireturn assertEngineGates({ ...env, ...gateEnv({ provider: GATEWAY_PROVIDER_ID, mcp: stock ? [] : mcp }), OMNIRUSH_GATE_PROVIDERS: stock ? STOCK_PROVIDER : APP_PROVIDER_IDS.join(",") });}+/** Web search off in Settings: the engine leaves a tool out of the model's list when its action is denied on "*" (stock mode too). */+export function webSearchOffRules(off: boolean): EnginePermissionRule[] {+ return off ? [{ action: "websearch", resource: "*", effect: "deny" }] : [];+}+export function assertEngineGates(env: Record<string, string | undefined>): Record<string, string> {if (!env.OMNIRUSH_GATE_PROVIDERS || env.OMNIRUSH_NO_SYSTEM_CONFIG !== "1" || typeof env.OMNIRUSH_GATE_MCP !== "string") {throw new Error("The OmniRush engine's gates are missing; it was not started.");@@ -323,6 +330,7 @@ export async function createManagedOpencodeV2Server(models,};}+ const webSearchOff = options.webSearchOff?.() === true;const titleModel = providerConfig[CLAUDE_PROVIDER_ID] ? await options.titleModel?.().catch(() => null) : null;const target = join(configDir, "opencode.json");// The box shell runs each command in its project's box (boxsh; natively for a project without one).@@ -341,11 +349,11 @@ export async function createManagedOpencodeV2Server(],// Titles on the gateway's default model while Claude is listed: a Claude turn is a Claude Code run, never a title....(titleModel ? { agents: { title: { model: titleModel } } } : {}),- ...(options.permissions ? { permissions: await options.permissions() } : {}),+ ...(options.permissions || webSearchOff ? { permissions: [...(await options.permissions?.() ?? []), ...webSearchOffRules(webSearchOff)] } : {}),// On: the stock websearch tool searches through Exa (the engine's keyless default), like the CLI.// Off: no provider is picked (never `false`, which would take the tool out of the stock list).// shortcut: Exa until the gateway serves a search integration of its own.- ...(!stock && options.webSearch?.() ? { websearch: { provider: "exa" } } : {}),+ ...(!stock && !webSearchOff && options.webSearch?.() ? { websearch: { provider: "exa" } } : {}),...(box ? { shell: box.shell } : {}),plugins: await pluginDirectories(join(options.rootDir, "plugins"), [sessionNextPluginPath(), ...(options.env?.OMNIRUSH_SERVER_URL ? [managedPolicyPluginPath(true)] : []), ...(box ? [box.plugin] : [])]),}, null, 2)}\n`, (file, text) => writeFileAtomic(file, text, { mode: 0o600 }));diff --git a/apps/server/src/managed-policy-rules.ts b/apps/server/src/managed-policy-rules.tsindex f363b44f..4c76db30 100644--- a/apps/server/src/managed-policy-rules.ts+++ b/apps/server/src/managed-policy-rules.ts@@ -197,7 +197,7 @@ export function policyRequestActions(method: string, path: string): ManagedPolicif (/^\/workspaces\/(local|remote)$/.test(path)) actions.push("workspace");if (/^\/runtime-config\/providers$/.test(path)) actions.push("provider");if (/^\/runtime-config\/(?:approvals|best-practices)$/.test(path)) actions.push("settings");- if (path === "/omnirush/subagent-model") actions.push("settings");+ if (path === "/omnirush/subagent-model" || path === "/omnirush/web-search") actions.push("settings");if (/^\/workspace\/[^/]+\/(?:cloud-plugins|claude-plugins|plugins|skills|commands|mcp)(?:\/|$)/.test(path)&& !/\/mcp\/[^/]+\/(?:auth|managed\/connect)$/.test(path)) actions.push("extensions");if (/^\/workspace\/[^/]+\/(?:config|opencode-config|runtime-config|permissions|authorized-folders|box)(?:\/|$)/.test(path)) actions.push("settings");diff --git a/apps/server/src/server.ts b/apps/server/src/server.tsindex d08d6e9f..0b703e91 100644--- a/apps/server/src/server.ts+++ b/apps/server/src/server.ts@@ -188,7 +188,7 @@ import { boxHome } from "./box/common.js";import { buildathonProjectsFile, reproStateFromBody, writeReproState } from "./buildathon-repro.js";import { prepareBoxInstallLog } from "./box/install-log.js";import { rememberServerDefault, watchServerDefault } from "./box/launch.js";-import { rememberWebSearchSwitch, watchWebSearchSwitch, webSearchSetting } from "./web-search.js";+import { rememberWebSearchSwitch, serverWebSearchEnabled, userWebSearchEnabled, watchWebSearchSwitch, webSearchSetting, writeUserWebSearch } from "./web-search.js";import { askSideQuestion, brokerSideCall } from "./side-question.js";import { createChatTracker, rememberComputerUseSwitch } from "./computer-use/desktop.js";import { registerComputerUseRoutes } from "./computer-use/routes.js";@@ -4908,6 +4908,32 @@ function createRoutes(return jsonResponse(providerLockStatus(currentProviderLockPolicy(), userPlugins));});+ // The user's web search switch (Settings > Preferences; web-search.ts). Off: no web search tool is offered+ // (the model's hosted one, or stock OpenCode's in stock mode). The server's switch wins: while it is off+ // (outside stock mode) the switch shows off and cannot be turned on.+ const webSearchState = () => {+ const stateDir = runtimeStorageDir(config);+ const user = userWebSearchEnabled(stateDir);+ const serverAllows = stockMode() || serverWebSearchEnabled(stateDir);+ return { enabled: user && serverAllows, user, serverAllows };+ };+ addRoute(routes, "GET", "/omnirush/web-search", "client", async () => jsonResponse(webSearchState()));+ addRoute(routes, "PUT", "/omnirush/web-search", "client", async (ctx) => {+ ensureWritable(config);+ requireClientScope(ctx, "collaborator");+ const body = await readJsonBody(ctx.request);+ if (typeof body.enabled !== "boolean") throw new ApiError(400, "invalid_payload", "enabled must be true or false");+ if (body.enabled && !webSearchState().serverAllows) throw new ApiError(409, "web_search_off_on_server", "Web search is turned off for your account.");+ try {+ writeUserWebSearch(runtimeStorageDir(config), body.enabled);+ } catch (error) {+ throw new ApiError(500, "settings_write_failed", `The web search setting could not be saved: ${errorCode(error)}`, { code: errorCode(error) });+ }+ // The engine config is written again: the next turn has (or lacks) the tool, no restart.+ await applyBoxEngineConfig(config, "web_search");+ return jsonResponse({ ok: true, ...webSearchState() });+ });+// Sub-agent model and effort (omnirush-subagent-model.ts). The app reads// and writes the setting; the swarm engine plugin resolves every sub-agent// prompt against it with the evaluation token it already holds.diff --git a/apps/server/src/web-search.test.ts b/apps/server/src/web-search.test.tsindex 137bfd8d..4d2b1820 100644--- a/apps/server/src/web-search.test.ts+++ b/apps/server/src/web-search.test.ts@@ -17,6 +17,7 @@ import {watchWebSearchSwitch,webSearchServerSwitch,webSearchSetting,+ writeUserWebSearch,} from "./web-search.js";const dirs: string[] = [];@@ -130,3 +131,22 @@ describe("engine config", () => {expect(strip(on)).toBe(strip(off));});});++describe("the user's Settings switch", () => {+ test("off: no hosted web search on any model even with the server's switch on; on: the server decides", () => {+ const dir = tmp();+ rememberWebSearchSwitch(dir, { web_search: { ...serverBlock, enabled: true } });+ const hosted = (setting: ReturnType<typeof webSearchSetting>) =>+ Object.entries(engineModelsFromCatalog(catalog, setting)).filter(([, model]) => (model.options as Record<string, unknown> | undefined)?.hostedWebSearch).map(([id]) => id);+ expect(webSearchSetting({ env: {}, stateDir: dir })).toMatchObject({ enabled: true, source: "server" });+ expect(hosted(webSearchSetting({ env: {}, stateDir: dir }))).toEqual(serverBlock.models);+ writeUserWebSearch(dir, false);+ expect(webSearchSetting({ env: {}, stateDir: dir })).toMatchObject({ enabled: false, source: "user" });+ expect(hosted(webSearchSetting({ env: {}, stateDir: dir }))).toEqual([]);+ writeUserWebSearch(dir, true);+ expect(hosted(webSearchSetting({ env: {}, stateDir: dir }))).toEqual(serverBlock.models);+ // The server's switch off wins over the user's on.+ rememberWebSearchSwitch(dir, { web_search: { ...serverBlock, enabled: false } });+ expect(hosted(webSearchSetting({ env: {}, stateDir: dir }))).toEqual([]);+ });+});diff --git a/apps/server/src/web-search.ts b/apps/server/src/web-search.tsindex 49a72b9b..7f5eca55 100644--- a/apps/server/src/web-search.ts+++ b/apps/server/src/web-search.ts@@ -5,7 +5,8 @@** Off unless something turns it on, in this order:* 1. OMNIRUSH_WEB_SEARCH=1/on or 0/off in the server environment;- * 2. the server's switch: GET /collect/capabilities `web_search`+ * 2. the user's Settings switch (<runtimeStorageDir>/web-search-user.json): off is off; on leaves it to the server;+ * 3. the server's switch: GET /collect/capabilities `web_search`* ({ enabled, search_context_size, models, clients, rollout_percent }),* as last seen (<runtimeStorageDir>/web-search-server.json). No block (an* older server), or enabled false, is off. The server answers for this@@ -26,13 +27,14 @@ import { join } from "node:path";import type { OmniRushCatalogModel } from "./omnirush-model-catalog.js";export const WEB_SEARCH_SERVER_FILE = "web-search-server.json";+export const WEB_SEARCH_USER_FILE = "web-search-user.json";export const SEARCH_CONTEXT_SIZES = ["low", "medium", "high"] as const;export type SearchContextSize = (typeof SEARCH_CONTEXT_SIZES)[number];export const DEFAULT_SEARCH_CONTEXT_SIZE: SearchContextSize = "medium";const MODEL_ID = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;export type WebSearchSwitch = { enabled: boolean; searchContextSize: SearchContextSize; models: string[] | null };-export type WebSearchSetting = WebSearchSwitch & { source: "env" | "server" | "default" };+export type WebSearchSetting = WebSearchSwitch & { source: "env" | "user" | "server" | "default" };function isRecord(value: unknown): value is Record<string, unknown> {return typeof value === "object" && value !== null && !Array.isArray(value);@@ -87,6 +89,23 @@ export function rememberWebSearchSwitch(stateDir: string, capabilities: unknown)return JSON.stringify(before ?? webSearchServerSwitch(null)) !== JSON.stringify(value);}+/** The user's Settings switch: on unless turned off. */+export function userWebSearchEnabled(stateDir: string | undefined): boolean {+ const saved = stateDir ? readJson(join(stateDir, WEB_SEARCH_USER_FILE)) : null;+ return !(isRecord(saved) && saved.enabled === false);+}++/** Saves the user's Settings switch (throws when it cannot be written: the app keeps the previous one). */+export function writeUserWebSearch(stateDir: string, enabled: boolean): void {+ mkdirSync(stateDir, { recursive: true });+ writeFileSync(join(stateDir, WEB_SEARCH_USER_FILE), JSON.stringify({ enabled, at: Date.now() }), { mode: 0o600 });+}++/** The server's switch as last seen (off when never seen). */+export function serverWebSearchEnabled(stateDir: string | undefined): boolean {+ return Boolean(stateDir && rememberedSwitch(stateDir)?.enabled);+}+/** Web search for the engine config; `models` (null: every model with the capability) comes from the server. */export function webSearchSetting({ env = process.env, stateDir }: { env?: NodeJS.ProcessEnv; stateDir?: string } = {}): WebSearchSetting {const server = stateDir ? rememberedSwitch(stateDir) : null;@@ -94,6 +113,7 @@ export function webSearchSetting({ env = process.env, stateDir }: { env?: NodeJSconst asked = String(env.OMNIRUSH_WEB_SEARCH ?? "").trim().toLowerCase();if (["0", "off", "false", "no"].includes(asked)) return { enabled: false, source: "env", searchContextSize: size, models: null };if (["1", "on", "true", "yes"].includes(asked)) return { enabled: true, source: "env", searchContextSize: size, models: null };+ if (!userWebSearchEnabled(stateDir)) return { enabled: false, source: "user", searchContextSize: size, models: null };if (server) return { ...server, source: "server" };return { enabled: false, source: "default", searchContextSize: size, models: null };}