




























@@ -14,10 +14,7 @@ import {
1414import type { OpenClawConfig } from "../config/types.openclaw.js";
1515import { logVerbose } from "../globals.js";
1616import { resolveManifestContractOwnerPluginId } from "../plugins/plugin-registry-contributions.js";
17-import type {
18-PluginWebSearchProviderEntry,
19-WebSearchProviderToolDefinition,
20-} from "../plugins/types.js";
17+import type { PluginWebSearchProviderEntry } from "../plugins/types.js";
2118import {
2219resolvePluginWebSearchProviders,
2320resolveRuntimeWebSearchProviders,
@@ -30,7 +27,6 @@ import {
3027providerRequiresCredential,
3128readWebProviderEnvValue,
3229resolveWebProviderConfig,
33-resolveWebProviderDefinition,
3430} from "../web/provider-runtime-shared.js";
3531import type {
3632ResolveWebSearchDefinitionParams,
@@ -239,28 +235,6 @@ function resolveRuntimePreferredWebSearchProviderId(params: {
239235 : undefined;
240236}
241237242-function resolveTrustedRuntimeWebSearchMetadata(params: {
243-config?: OpenClawConfig;
244-search?: WebSearchConfig;
245-runtimeWebSearch?: RuntimeWebSearchMetadata;
246-providers?: PluginWebSearchProviderEntry[];
247-agentDir?: string;
248-}): RuntimeWebSearchMetadata | undefined {
249-const runtimeWebSearch = params.runtimeWebSearch;
250-if (!runtimeWebSearch) {
251-return undefined;
252-}
253-const trustedProviderId = resolveRuntimePreferredWebSearchProviderId(params);
254-const runtimeProviderId = normalizeOptionalLowercaseString(
255-runtimeWebSearch.selectedProvider ?? runtimeWebSearch.providerConfigured,
256-);
257-if (trustedProviderId && trustedProviderId === runtimeProviderId) {
258-return runtimeWebSearch;
259-}
260-const { selectedProvider: _selectedProvider, ...metadataWithoutSelection } = runtimeWebSearch;
261-return metadataWithoutSelection;
262-}
263-264238function resolveExplicitWebSearchProviderId(params: {
265239search?: WebSearchConfig;
266240runtimeWebSearch?: RuntimeWebSearchMetadata;
@@ -370,61 +344,6 @@ function loadSortedWebSearchProviders(
370344);
371345}
372346373-/** Resolves the executable web_search provider tool definition. */
374-function resolveWebSearchDefinition(
375-options?: ResolveWebSearchDefinitionParams,
376-): { provider: PluginWebSearchProviderEntry; definition: WebSearchProviderToolDefinition } | null {
377-const { config, search, runtimeWebSearch } = resolveWebSearchRequestContext(options);
378-const providers = loadSortedWebSearchProviders({
379- config,
380- search,
381- runtimeWebSearch,
382-providerId: options?.providerId,
383-preferRuntimeProviders: options?.preferRuntimeProviders,
384-});
385-const trustedRuntimeWebSearch = resolveTrustedRuntimeWebSearchMetadata({
386- config,
387- search,
388- runtimeWebSearch,
389- providers,
390-agentDir: options?.agentDir,
391-});
392-return resolveWebProviderDefinition({
393- config,
394-toolConfig: search as Record<string, unknown> | undefined,
395-runtimeMetadata: trustedRuntimeWebSearch,
396-sandboxed: options?.sandboxed,
397-providerId: options?.providerId,
398- providers,
399-resolveEnabled: ({ toolConfig, sandboxed }) =>
400-resolveWebSearchEnabled({
401-search: toolConfig as WebSearchConfig | undefined,
402- sandboxed,
403-}),
404-resolveAutoProviderId: ({ config: configResult, toolConfig, providers: providersValue }) =>
405-resolveWebSearchProviderId({
406-config: configResult,
407-agentDir: options?.agentDir,
408-search: toolConfig as WebSearchConfig | undefined,
409-providers: providersValue,
410-}),
411-resolveFallbackProviderId: ({ config: configValue, toolConfig, providers: providersLocal }) =>
412-resolveWebSearchProviderId({
413-config: configValue,
414-agentDir: options?.agentDir,
415-search: toolConfig as WebSearchConfig | undefined,
416-providers: providersLocal,
417-}),
418-createTool: ({ provider, config: configLocal, toolConfig, runtimeMetadata }) =>
419-provider.createTool({
420-config: configLocal,
421-agentDir: options?.agentDir,
422-searchConfig: toolConfig,
423- runtimeMetadata,
424-}),
425-});
426-}
427-428347function resolveWebSearchCandidates(
429348options?: ResolveWebSearchDefinitionParams,
430349): PluginWebSearchProviderEntry[] {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。