fix(web-search): restore build after plugin rebase

This commit is contained in:
Peter Steinberger
2026-03-16 00:40:42 +00:00
parent e8156c8281
commit 3aa5f2703c
2 changed files with 12 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ import {
} from "./web-shared.js";
const SEARCH_PROVIDERS = ["brave", "gemini", "grok", "kimi", "perplexity"] as const;
type SearchProvider = (typeof SEARCH_PROVIDERS)[number];
const DEFAULT_SEARCH_COUNT = 5;
const MAX_SEARCH_COUNT = 10;
@@ -614,6 +615,10 @@ function missingSearchKeyPayload(provider: (typeof SEARCH_PROVIDERS)[number]) {
};
}
function isSearchProvider(value: string): value is SearchProvider {
return SEARCH_PROVIDERS.includes(value as SearchProvider);
}
function resolveSearchProvider(search?: WebSearchConfig): (typeof SEARCH_PROVIDERS)[number] {
const raw =
search && "provider" in search && typeof search.provider === "string"
@@ -1911,10 +1916,12 @@ export function createWebSearchTool(options?: {
return null;
}
const runtimeProviderCandidate =
options?.runtimeWebSearch?.selectedProvider ?? options?.runtimeWebSearch?.providerConfigured;
const provider =
options?.runtimeWebSearch?.selectedProvider ??
options?.runtimeWebSearch?.providerConfigured ??
resolveSearchProvider(search);
runtimeProviderCandidate && isSearchProvider(runtimeProviderCandidate)
? runtimeProviderCandidate
: resolveSearchProvider(search);
const perplexityConfig = resolvePerplexityConfig(search);
const perplexitySchemaTransportHint =
options?.runtimeWebSearch?.perplexityTransport ??

View File

@@ -1,3 +1,4 @@
import type { PluginEntryConfig } from "../config/types.plugins.js";
import { createSubsystemLogger } from "../logging/subsystem.js";
import { loadOpenClawPlugins, type PluginLoadOptions } from "./loader.js";
import { createPluginLoaderLogger } from "./logger.js";
@@ -48,7 +49,7 @@ function withBundledWebSearchEnablementCompat(
): PluginLoadOptions["config"] {
const existingEntries = config?.plugins?.entries ?? {};
let changed = false;
const nextEntries: Record<string, unknown> = { ...existingEntries };
const nextEntries: Record<string, PluginEntryConfig> = { ...existingEntries };
for (const pluginId of BUNDLED_WEB_SEARCH_ALLOWLIST_COMPAT_PLUGIN_IDS) {
if (existingEntries[pluginId] !== undefined) {