@openclaw/brave-plugin 2026.5.12 → 2026.5.14-beta.2
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.
- package/dist/{brave-web-search-provider-D4rkKZuh.js → brave-web-search-provider-DlBesQRV.js} +17 -1
- package/dist/{brave-web-search-provider.runtime-rJWyMAze.js → brave-web-search-provider.runtime-Dd_WB4kT.js} +3 -2
- package/dist/index.js +1 -1
- package/dist/web-search-contract-api.js +27 -0
- package/dist/web-search-provider.js +1 -1
- package/package.json +4 -4
package/dist/{brave-web-search-provider-D4rkKZuh.js → brave-web-search-provider-DlBesQRV.js}
RENAMED
|
@@ -4,7 +4,7 @@ import { createWebSearchProviderContractFields } from "openclaw/plugin-sdk/provi
|
|
|
4
4
|
const BRAVE_CREDENTIAL_PATH = "plugins.entries.brave.config.webSearch.apiKey";
|
|
5
5
|
let braveWebSearchRuntimePromise;
|
|
6
6
|
function loadBraveWebSearchRuntime() {
|
|
7
|
-
braveWebSearchRuntimePromise ??= import("./brave-web-search-provider.runtime-
|
|
7
|
+
braveWebSearchRuntimePromise ??= import("./brave-web-search-provider.runtime-Dd_WB4kT.js");
|
|
8
8
|
return braveWebSearchRuntimePromise;
|
|
9
9
|
}
|
|
10
10
|
const BraveSearchSchema = {
|
|
@@ -61,6 +61,20 @@ function resolveProviderWebSearchPluginConfig(config, pluginId) {
|
|
|
61
61
|
const pluginConfig = isRecord(entry?.config) ? entry.config : void 0;
|
|
62
62
|
return isRecord(pluginConfig?.webSearch) ? pluginConfig.webSearch : void 0;
|
|
63
63
|
}
|
|
64
|
+
function resolveLegacyTopLevelBraveCredential(config) {
|
|
65
|
+
if (!isRecord(config)) return;
|
|
66
|
+
const tools = isRecord(config.tools) ? config.tools : void 0;
|
|
67
|
+
const web = isRecord(tools?.web) ? tools.web : void 0;
|
|
68
|
+
const search = isRecord(web?.search) ? web.search : void 0;
|
|
69
|
+
if (!search || !("apiKey" in search)) return;
|
|
70
|
+
return {
|
|
71
|
+
path: "tools.web.search.apiKey",
|
|
72
|
+
value: search.apiKey
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function resolveConfiguredBraveCredential(config) {
|
|
76
|
+
return resolveProviderWebSearchPluginConfig(config, "brave")?.apiKey ?? resolveLegacyTopLevelBraveCredential(config)?.value;
|
|
77
|
+
}
|
|
64
78
|
function mergeScopedSearchConfig(searchConfig, key, pluginConfig, options) {
|
|
65
79
|
if (!pluginConfig) return searchConfig;
|
|
66
80
|
const currentScoped = isRecord(searchConfig?.[key]) ? searchConfig?.[key] : {};
|
|
@@ -107,6 +121,8 @@ function createBraveWebSearchProvider() {
|
|
|
107
121
|
searchCredential: { type: "top-level" },
|
|
108
122
|
configuredCredential: { pluginId: "brave" }
|
|
109
123
|
}),
|
|
124
|
+
getConfiguredCredentialValue: resolveConfiguredBraveCredential,
|
|
125
|
+
getConfiguredCredentialFallback: resolveLegacyTopLevelBraveCredential,
|
|
110
126
|
createTool: (ctx) => createBraveToolDefinition(mergeScopedSearchConfig(ctx.searchConfig, "brave", resolveProviderWebSearchPluginConfig(ctx.config, "brave"), { mirrorApiKeyToTopLevel: true }), ctx.config)
|
|
111
127
|
};
|
|
112
128
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { a as resolveBraveMode, i as resolveBraveConfig, n as normalizeBraveCountry, r as normalizeBraveLanguageParams, t as mapBraveLlmContextResults } from "./brave-web-search-provider.shared-B1wyGWiH.js";
|
|
2
|
+
import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
|
|
2
3
|
import { DEFAULT_SEARCH_COUNT, buildSearchCacheKey, formatCliCommand, normalizeFreshness, parseIsoDateRange, readCachedSearchPayload, readConfiguredSecretString, readNumberParam, readProviderEnvValue, readStringParam, resolveSearchCacheTtlMs, resolveSearchCount, resolveSearchTimeoutSeconds, resolveSiteName, withSelfHostedWebSearchEndpoint, withTrustedWebSearchEndpoint, wrapWebContent, writeCachedSearchPayload } from "openclaw/plugin-sdk/provider-web-search";
|
|
3
4
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
|
4
5
|
import { assertHttpUrlTargetsPrivateNetwork, isBlockedHostnameOrIp, isPrivateIpAddress, resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
@@ -102,7 +103,7 @@ async function runBraveLlmContextSearch(params) {
|
|
|
102
103
|
const detail = await response.text();
|
|
103
104
|
throw new Error(`Brave LLM Context API error (${response.status}): ${detail || response.statusText}`);
|
|
104
105
|
}
|
|
105
|
-
const data = await response
|
|
106
|
+
const data = await readProviderJsonResponse(response, "Brave LLM Context API error");
|
|
106
107
|
return {
|
|
107
108
|
results: mapBraveLlmContextResults(data),
|
|
108
109
|
sources: data.sources
|
|
@@ -149,7 +150,7 @@ async function runBraveWebSearch(params) {
|
|
|
149
150
|
const detail = await response.text();
|
|
150
151
|
throw new Error(`Brave Search API error (${response.status}): ${detail || response.statusText}`);
|
|
151
152
|
}
|
|
152
|
-
const data = await response
|
|
153
|
+
const data = await readProviderJsonResponse(response, "Brave Search API error");
|
|
153
154
|
return (Array.isArray(data.web?.results) ? data.web?.results ?? [] : []).map((entry) => {
|
|
154
155
|
const description = entry.description ?? "";
|
|
155
156
|
const title = entry.title ?? "";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createBraveWebSearchProvider } from "./brave-web-search-provider-
|
|
1
|
+
import { t as createBraveWebSearchProvider } from "./brave-web-search-provider-DlBesQRV.js";
|
|
2
2
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
3
3
|
//#region extensions/brave/index.ts
|
|
4
4
|
var brave_default = definePluginEntry({
|
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import { createWebSearchProviderContractFields } from "openclaw/plugin-sdk/provider-web-search-config-contract";
|
|
2
2
|
//#region extensions/brave/web-search-contract-api.ts
|
|
3
|
+
function isRecord(value) {
|
|
4
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
|
+
}
|
|
6
|
+
function resolveLegacyTopLevelBraveCredential(config) {
|
|
7
|
+
if (!isRecord(config)) return;
|
|
8
|
+
const tools = isRecord(config.tools) ? config.tools : void 0;
|
|
9
|
+
const web = isRecord(tools?.web) ? tools.web : void 0;
|
|
10
|
+
const search = isRecord(web?.search) ? web.search : void 0;
|
|
11
|
+
if (!search || !("apiKey" in search)) return;
|
|
12
|
+
return {
|
|
13
|
+
path: "tools.web.search.apiKey",
|
|
14
|
+
value: search.apiKey
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function resolveProviderWebSearchPluginConfig(config, pluginId) {
|
|
18
|
+
if (!isRecord(config)) return;
|
|
19
|
+
const plugins = isRecord(config.plugins) ? config.plugins : void 0;
|
|
20
|
+
const entries = isRecord(plugins?.entries) ? plugins.entries : void 0;
|
|
21
|
+
const entry = isRecord(entries?.[pluginId]) ? entries[pluginId] : void 0;
|
|
22
|
+
const pluginConfig = isRecord(entry?.config) ? entry.config : void 0;
|
|
23
|
+
return isRecord(pluginConfig?.webSearch) ? pluginConfig.webSearch : void 0;
|
|
24
|
+
}
|
|
25
|
+
function resolveConfiguredBraveCredential(config) {
|
|
26
|
+
return resolveProviderWebSearchPluginConfig(config, "brave")?.apiKey ?? resolveLegacyTopLevelBraveCredential(config)?.value;
|
|
27
|
+
}
|
|
3
28
|
function createBraveWebSearchProvider() {
|
|
4
29
|
const credentialPath = "plugins.entries.brave.config.webSearch.apiKey";
|
|
5
30
|
return {
|
|
@@ -19,6 +44,8 @@ function createBraveWebSearchProvider() {
|
|
|
19
44
|
searchCredential: { type: "top-level" },
|
|
20
45
|
configuredCredential: { pluginId: "brave" }
|
|
21
46
|
}),
|
|
47
|
+
getConfiguredCredentialValue: resolveConfiguredBraveCredential,
|
|
48
|
+
getConfiguredCredentialFallback: resolveLegacyTopLevelBraveCredential,
|
|
22
49
|
createTool: () => null
|
|
23
50
|
};
|
|
24
51
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createBraveWebSearchProvider } from "./brave-web-search-provider-
|
|
1
|
+
import { t as createBraveWebSearchProvider } from "./brave-web-search-provider-DlBesQRV.js";
|
|
2
2
|
export { createBraveWebSearchProvider };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/brave-plugin",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.14-beta.2",
|
|
4
4
|
"description": "OpenClaw Brave plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"minHostVersion": ">=2026.4.10"
|
|
21
21
|
},
|
|
22
22
|
"compat": {
|
|
23
|
-
"pluginApi": ">=2026.5.
|
|
23
|
+
"pluginApi": ">=2026.5.14-beta.2"
|
|
24
24
|
},
|
|
25
25
|
"build": {
|
|
26
|
-
"openclawVersion": "2026.5.
|
|
26
|
+
"openclawVersion": "2026.5.14-beta.2"
|
|
27
27
|
},
|
|
28
28
|
"release": {
|
|
29
29
|
"publishToClawHub": true,
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"openclaw.plugin.json"
|
|
39
39
|
],
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"openclaw": ">=2026.5.
|
|
41
|
+
"openclaw": ">=2026.5.14-beta.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"openclaw": {
|