




















@@ -9,6 +9,7 @@ import { logConfigUpdated } from "../config/logging.js";
99import { ConfigMutationConflictError } from "../config/mutate.js";
1010import type { OpenClawConfig } from "../config/types.openclaw.js";
1111import { ensureControlUiAssetsBuilt } from "../infra/control-ui-assets.js";
12+import { resolvePluginContributionOwners } from "../plugins/plugin-registry.js";
1213import type { RuntimeEnv } from "../runtime.js";
1314import { defaultRuntime } from "../runtime.js";
1415import { normalizeOptionalString } from "../shared/string-coerce.js";
@@ -199,9 +200,13 @@ async function promptWebToolsConfig(
199200type WebSearchConfig = NonNullable<NonNullable<OpenClawConfig["tools"]>["web"]>["search"];
200201const existingSearch = nextConfig.tools?.web?.search;
201202const existingFetch = nextConfig.tools?.web?.fetch;
202-const { resolveSearchProviderOptions, setupSearch } = await import("./onboard-search.js");
203203const { isCodexNativeWebSearchRelevant } = await import("../agents/codex-native-web-search.js");
204-const searchProviderOptions = resolveSearchProviderOptions(nextConfig);
204+const hasManagedSearchProviders =
205+resolvePluginContributionOwners({
206+config: nextConfig,
207+contribution: "contracts",
208+matches: "webSearchProviders",
209+}).length > 0;
205210206211note(
207212[
@@ -215,7 +220,7 @@ async function promptWebToolsConfig(
215220const enableSearch = guardCancel(
216221await confirm({
217222message: "Enable web_search?",
218-initialValue: existingSearch?.enabled ?? searchProviderOptions.length > 0,
223+initialValue: existingSearch?.enabled ?? hasManagedSearchProviders,
219224}),
220225runtime,
221226);
@@ -297,8 +302,10 @@ async function promptWebToolsConfig(
297302}
298303}
299304300-if (searchProviderOptions.length === 0) {
301-if (configureManagedProvider) {
305+if (configureManagedProvider) {
306+const { resolveSearchProviderOptions, setupSearch } = await import("./onboard-search.js");
307+const searchProviderOptions = resolveSearchProviderOptions(nextConfig);
308+if (searchProviderOptions.length === 0) {
302309note(
303310[
304311"No web search providers are currently available under this plugin policy.",
@@ -307,23 +314,23 @@ async function promptWebToolsConfig(
307314].join("\n"),
308315"Web search",
309316);
310-}
311-if (nextSearch.openaiCodex?.enabled !== true) {
317+if (nextSearch.openaiCodex?.enabled !== true) {
318+nextSearch = {
319+ ...existingSearch,
320+enabled: false,
321+};
322+}
323+} else {
324+workingConfig = await setupSearch(workingConfig, runtime, prompter);
312325nextSearch = {
313- ...existingSearch,
314-enabled: false,
326+ ...workingConfig.tools?.web?.search,
327+enabled: workingConfig.tools?.web?.search?.provider ? true : existingSearch?.enabled,
328+openaiCodex: {
329+ ...existingSearch?.openaiCodex,
330+ ...(nextSearch.openaiCodex as Record<string, unknown> | undefined),
331+},
315332};
316333}
317-} else if (configureManagedProvider) {
318-workingConfig = await setupSearch(workingConfig, runtime, prompter);
319-nextSearch = {
320- ...workingConfig.tools?.web?.search,
321-enabled: workingConfig.tools?.web?.search?.provider ? true : existingSearch?.enabled,
322-openaiCodex: {
323- ...existingSearch?.openaiCodex,
324- ...(nextSearch.openaiCodex as Record<string, unknown> | undefined),
325-},
326-};
327334}
328335}
329336此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。