@openclaw/brave-plugin 2026.6.1 → 2026.6.5-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,9 +3,13 @@ import { isDiagnosticFlagEnabled } from "openclaw/plugin-sdk/diagnostic-runtime"
3
3
  import { mergeScopedSearchConfig, resolveProviderWebSearchPluginConfig } from "openclaw/plugin-sdk/provider-web-search-config-contract";
4
4
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  //#region extensions/brave/src/brave-web-search-provider.ts
6
+ /**
7
+ * Brave web-search provider factory. It builds the agent tool definition and
8
+ * lazy-loads HTTP execution only when a search is run.
9
+ */
6
10
  let braveWebSearchRuntimePromise;
7
11
  function loadBraveWebSearchRuntime() {
8
- braveWebSearchRuntimePromise ??= import("./brave-web-search-provider.runtime-SKsUJmbH.js");
12
+ braveWebSearchRuntimePromise ??= import("./brave-web-search-provider.runtime-D_z2neAi.js");
9
13
  return braveWebSearchRuntimePromise;
10
14
  }
11
15
  const BraveSearchSchema = {
@@ -66,6 +70,7 @@ function createBraveToolDefinition(searchConfig, config) {
66
70
  }
67
71
  };
68
72
  }
73
+ /** Create the runtime Brave Search provider descriptor. */
69
74
  function createBraveWebSearchProvider() {
70
75
  return {
71
76
  ...buildBraveWebSearchProviderBase(),
@@ -4,6 +4,10 @@ import { DEFAULT_SEARCH_COUNT, MAX_SEARCH_COUNT, buildSearchCacheKey, formatCliC
4
4
  import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
5
5
  import { assertHttpUrlTargetsPrivateNetwork, isBlockedHostnameOrIp, isPrivateIpAddress, resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
6
6
  //#region extensions/brave/src/brave-web-search-provider.shared.ts
7
+ /**
8
+ * Brave Search request normalization and result mapping. It validates Brave
9
+ * country/language params and converts LLM-context responses into web results.
10
+ */
7
11
  const BRAVE_COUNTRY_CODES = new Set([
8
12
  "AR",
9
13
  "AU",
@@ -115,6 +119,7 @@ function normalizeBraveSearchLang(value) {
115
119
  if (!BRAVE_SEARCH_LANG_CODES.has(canonical)) return;
116
120
  return canonical;
117
121
  }
122
+ /** Normalize Brave country filter values. */
118
123
  function normalizeBraveCountry(value) {
119
124
  if (!value) return;
120
125
  const trimmed = value.trim();
@@ -131,13 +136,16 @@ function normalizeBraveUiLang(value) {
131
136
  const [, language, region] = match;
132
137
  return `${normalizeLowercaseStringOrEmpty(language)}-${region.toUpperCase()}`;
133
138
  }
139
+ /** Resolve Brave-specific web-search config from scoped search config. */
134
140
  function resolveBraveConfig(searchConfig) {
135
141
  const brave = searchConfig?.brave;
136
142
  return brave && typeof brave === "object" && !Array.isArray(brave) ? brave : {};
137
143
  }
144
+ /** Resolve whether Brave should use web search or LLM Context API mode. */
138
145
  function resolveBraveMode(brave) {
139
146
  return brave?.mode === "llm-context" ? "llm-context" : "web";
140
147
  }
148
+ /** Normalize Brave search and UI language params, detecting swapped fields. */
141
149
  function normalizeBraveLanguageParams(params) {
142
150
  const rawSearchLang = normalizeOptionalString(params.search_lang);
143
151
  const rawUiLang = normalizeOptionalString(params.ui_lang);
@@ -164,6 +172,7 @@ function resolveSiteName$1(url) {
164
172
  return;
165
173
  }
166
174
  }
175
+ /** Map Brave LLM Context API grounding results into web-search result rows. */
167
176
  function mapBraveLlmContextResults(data) {
168
177
  return (Array.isArray(data.grounding?.generic) ? data.grounding.generic : []).map((entry) => ({
169
178
  url: entry.url ?? "",
@@ -174,6 +183,10 @@ function mapBraveLlmContextResults(data) {
174
183
  }
175
184
  //#endregion
176
185
  //#region extensions/brave/src/brave-web-search-provider.runtime.ts
186
+ /**
187
+ * Brave Search HTTP runtime. It resolves credentials, enforces endpoint safety,
188
+ * applies caching, and maps Brave web/LLM-context API responses.
189
+ */
177
190
  const DEFAULT_BRAVE_BASE_URL = "https://api.search.brave.com";
178
191
  const BRAVE_SEARCH_ENDPOINT_PATH = "/res/v1/web/search";
179
192
  const BRAVE_LLM_CONTEXT_ENDPOINT_PATH = "/res/v1/llm/context";
@@ -326,6 +339,7 @@ async function runBraveWebSearch(params) {
326
339
  };
327
340
  });
328
341
  }
342
+ /** Execute one Brave Search request using web or LLM-context mode. */
329
343
  async function executeBraveSearch(args, searchConfig, options) {
330
344
  const apiKey = resolveBraveApiKey(searchConfig);
331
345
  if (!apiKey) return missingBraveKeyPayload();
package/dist/index.js CHANGED
@@ -1,6 +1,11 @@
1
- import { t as createBraveWebSearchProvider } from "./brave-web-search-provider-BzuOscZC.js";
1
+ import { t as createBraveWebSearchProvider } from "./brave-web-search-provider-6mNi77fe.js";
2
2
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
3
3
  //#region extensions/brave/index.ts
4
+ /**
5
+ * Brave Search plugin entry. It registers the Brave web-search provider and
6
+ * keeps runtime HTTP execution lazy.
7
+ */
8
+ /** Plugin entry for Brave Search. */
4
9
  var brave_default = definePluginEntry({
5
10
  id: "brave",
6
11
  name: "Brave Plugin",
@@ -1,5 +1,6 @@
1
1
  import { buildBraveWebSearchProviderBase } from "./web-search-shared.js";
2
2
  //#region extensions/brave/web-search-contract-api.ts
3
+ /** Create the Brave provider descriptor for contract checks. */
3
4
  function createBraveWebSearchProvider() {
4
5
  return {
5
6
  ...buildBraveWebSearchProviderBase(),
@@ -1,2 +1,2 @@
1
- import { t as createBraveWebSearchProvider } from "./brave-web-search-provider-BzuOscZC.js";
1
+ import { t as createBraveWebSearchProvider } from "./brave-web-search-provider-6mNi77fe.js";
2
2
  export { createBraveWebSearchProvider };
@@ -1,7 +1,13 @@
1
1
  import { createWebSearchProviderContractFields } from "openclaw/plugin-sdk/provider-web-search-config-contract";
2
2
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  //#region extensions/brave/web-search-shared.ts
4
+ /**
5
+ * Shared Brave Search provider metadata and credential lookup. Contract tests
6
+ * and runtime provider creation both use this lightweight descriptor.
7
+ */
8
+ /** Canonical config path for the Brave Search API key. */
4
9
  const BRAVE_CREDENTIAL_PATH = "plugins.entries.brave.config.webSearch.apiKey";
10
+ /** Resolve legacy top-level Brave credentials from old web-search config. */
5
11
  function resolveLegacyTopLevelBraveCredential(config) {
6
12
  if (!isRecord(config)) return;
7
13
  const tools = isRecord(config.tools) ? config.tools : void 0;
@@ -21,9 +27,11 @@ function resolveBraveWebSearchPluginConfig(config) {
21
27
  const pluginConfig = isRecord(entry?.config) ? entry.config : void 0;
22
28
  return isRecord(pluginConfig?.webSearch) ? pluginConfig.webSearch : void 0;
23
29
  }
30
+ /** Resolve Brave credentials from current plugin config or legacy fallback. */
24
31
  function resolveConfiguredBraveCredential(config) {
25
32
  return resolveBraveWebSearchPluginConfig(config)?.apiKey ?? resolveLegacyTopLevelBraveCredential(config)?.value;
26
33
  }
34
+ /** Build the common Brave provider metadata without the runtime tool executor. */
27
35
  function buildBraveWebSearchProviderBase() {
28
36
  return {
29
37
  id: "brave",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@openclaw/brave-plugin",
3
- "version": "2026.6.1",
3
+ "version": "2026.6.5-beta.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/brave-plugin",
9
- "version": "2026.6.1"
9
+ "version": "2026.6.5-beta.1"
10
10
  }
11
11
  }
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/brave-plugin",
3
- "version": "2026.6.1",
3
+ "version": "2026.6.5-beta.1",
4
4
  "description": "OpenClaw Brave Search provider plugin for web search.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,10 +18,10 @@
18
18
  "allowInvalidConfigRecovery": true
19
19
  },
20
20
  "compat": {
21
- "pluginApi": ">=2026.6.1"
21
+ "pluginApi": ">=2026.6.5-beta.1"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.6.1"
24
+ "openclawVersion": "2026.6.5-beta.1"
25
25
  },
26
26
  "release": {
27
27
  "publishToClawHub": true,
@@ -38,7 +38,7 @@
38
38
  "README.md"
39
39
  ],
40
40
  "peerDependencies": {
41
- "openclaw": ">=2026.6.1"
41
+ "openclaw": ">=2026.6.5-beta.1"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "openclaw": {