@openclaw/parallel-plugin 2026.9.7 → 2026.10.1-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.
- package/dist/.setup/{parallel-free-web-search-provider-DVjfPmlG.mjs → parallel-free-web-search-provider-ComsnjrF.mjs} +23 -31
- package/dist/.setup/{parallel-free-web-search-provider.runtime-C2wHlx8V.mjs → parallel-free-web-search-provider.runtime-B86EH2xy.mjs} +25 -48
- package/dist/.setup/{parallel-search-normalize-CP1w5YdR.mjs → parallel-search-normalize-DCF3dT4s.mjs} +26 -59
- package/dist/.setup/{parallel-web-search-provider.runtime-BO11rmJ6.mjs → parallel-web-search-provider.runtime-WBGCIoY9.mjs} +38 -49
- package/dist/index.js +1 -1
- package/dist/web-search-contract-api.js +1 -1
- package/dist/web-search-provider.js +1 -1
- package/package.json +4 -4
|
@@ -26,42 +26,15 @@ function createParallelFreeWebSearchProviderBase() {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
|
-
//#region extensions/parallel/src/parallel-web-search-provider.shared.ts
|
|
30
|
-
const PARALLEL_CREDENTIAL_PATH = "plugins.entries.parallel.config.webSearch.apiKey";
|
|
31
|
-
const PARALLEL_ONBOARDING_SCOPES = ["text-inference"];
|
|
32
|
-
function createParallelWebSearchProviderBase() {
|
|
33
|
-
return {
|
|
34
|
-
id: "parallel",
|
|
35
|
-
label: "Parallel Search",
|
|
36
|
-
hint: "LLM-optimized dense excerpts from web sources",
|
|
37
|
-
onboardingScopes: [...PARALLEL_ONBOARDING_SCOPES],
|
|
38
|
-
credentialLabel: "Parallel API key",
|
|
39
|
-
envVars: ["PARALLEL_API_KEY"],
|
|
40
|
-
placeholder: "par-...",
|
|
41
|
-
signupUrl: "https://platform.parallel.ai",
|
|
42
|
-
docsUrl: "https://docs.openclaw.ai/tools/parallel-search",
|
|
43
|
-
autoDetectOrder: 75,
|
|
44
|
-
credentialPath: PARALLEL_CREDENTIAL_PATH,
|
|
45
|
-
...createWebSearchProviderContractFields({
|
|
46
|
-
credentialPath: PARALLEL_CREDENTIAL_PATH,
|
|
47
|
-
searchCredential: {
|
|
48
|
-
type: "scoped",
|
|
49
|
-
scopeId: "parallel"
|
|
50
|
-
},
|
|
51
|
-
configuredCredential: { pluginId: "parallel" },
|
|
52
|
-
selectionPluginId: "parallel"
|
|
53
|
-
})
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
//#endregion
|
|
57
29
|
//#region extensions/parallel/src/parallel-web-search-provider.ts
|
|
30
|
+
const PARALLEL_CREDENTIAL_PATH = "plugins.entries.parallel.config.webSearch.apiKey";
|
|
58
31
|
const PARALLEL_MAX_SEARCH_COUNT = 40;
|
|
59
32
|
const PARALLEL_MAX_SEARCH_QUERIES = 5;
|
|
60
33
|
const PARALLEL_MAX_SEARCH_QUERY_CHARS = 200;
|
|
61
34
|
const PARALLEL_MAX_OBJECTIVE_CHARS = 5e3;
|
|
62
35
|
const PARALLEL_MAX_SESSION_ID_CHARS = 1e3;
|
|
63
36
|
const PARALLEL_MAX_CLIENT_MODEL_CHARS = 100;
|
|
64
|
-
const loadParallelWebSearchRuntime = createLazyRuntimeModule(() => import("./parallel-web-search-provider.runtime-
|
|
37
|
+
const loadParallelWebSearchRuntime = createLazyRuntimeModule(() => import("./parallel-web-search-provider.runtime-WBGCIoY9.mjs"));
|
|
65
38
|
const ParallelSearchSchema = {
|
|
66
39
|
type: "object",
|
|
67
40
|
properties: {
|
|
@@ -102,7 +75,26 @@ const ParallelSearchSchema = {
|
|
|
102
75
|
};
|
|
103
76
|
function createParallelWebSearchProvider() {
|
|
104
77
|
return {
|
|
105
|
-
|
|
78
|
+
id: "parallel",
|
|
79
|
+
label: "Parallel Search",
|
|
80
|
+
hint: "LLM-optimized dense excerpts from web sources",
|
|
81
|
+
onboardingScopes: ["text-inference"],
|
|
82
|
+
credentialLabel: "Parallel API key",
|
|
83
|
+
envVars: ["PARALLEL_API_KEY"],
|
|
84
|
+
placeholder: "par-...",
|
|
85
|
+
signupUrl: "https://platform.parallel.ai",
|
|
86
|
+
docsUrl: "https://docs.openclaw.ai/tools/parallel-search",
|
|
87
|
+
autoDetectOrder: 75,
|
|
88
|
+
credentialPath: PARALLEL_CREDENTIAL_PATH,
|
|
89
|
+
...createWebSearchProviderContractFields({
|
|
90
|
+
credentialPath: PARALLEL_CREDENTIAL_PATH,
|
|
91
|
+
searchCredential: {
|
|
92
|
+
type: "scoped",
|
|
93
|
+
scopeId: "parallel"
|
|
94
|
+
},
|
|
95
|
+
configuredCredential: { pluginId: "parallel" },
|
|
96
|
+
selectionPluginId: "parallel"
|
|
97
|
+
}),
|
|
106
98
|
createTool: (ctx) => ({
|
|
107
99
|
description: "Search the web using Parallel. Returns ranked, LLM-optimized dense excerpts from web sources. Pass an `objective` describing the underlying question along with 2-3 short keyword `search_queries` (Parallel's recommended pairing). For multi-step research, thread the prior result's `sessionId` back in as `session_id` to keep Parallel's context grouped.",
|
|
108
100
|
parameters: ParallelSearchSchema,
|
|
@@ -126,7 +118,7 @@ const ParallelFreeSearchSchema = {
|
|
|
126
118
|
}
|
|
127
119
|
}
|
|
128
120
|
};
|
|
129
|
-
const loadParallelFreeWebSearchRuntime = createLazyRuntimeModule(() => import("./parallel-free-web-search-provider.runtime-
|
|
121
|
+
const loadParallelFreeWebSearchRuntime = createLazyRuntimeModule(() => import("./parallel-free-web-search-provider.runtime-B86EH2xy.mjs"));
|
|
130
122
|
function createParallelFreeWebSearchProvider() {
|
|
131
123
|
return {
|
|
132
124
|
...createParallelFreeWebSearchProviderBase(),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as executeParallelSearchRequest } from "./parallel-search-normalize-
|
|
1
|
+
import { t as executeParallelSearchRequest } from "./parallel-search-normalize-DCF3dT4s.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { mergeScopedSearchConfig, resolveProviderWebSearchPluginConfig, withTrustedWebSearchEndpoint } from "openclaw/plugin-sdk/provider-web-search";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -14,16 +14,6 @@ const PARALLEL_MCP_ERROR_BODY_LIMIT_BYTES = 8192;
|
|
|
14
14
|
const require = createRequire(import.meta.url);
|
|
15
15
|
const PLUGIN_VERSION = readPluginPackageVersion({ require });
|
|
16
16
|
const USER_AGENT = `openclaw-parallel/${PLUGIN_VERSION} (${process.platform})`;
|
|
17
|
-
function mcpHeaders(params) {
|
|
18
|
-
const headers = {
|
|
19
|
-
"Content-Type": "application/json",
|
|
20
|
-
"User-Agent": USER_AGENT,
|
|
21
|
-
Accept: "application/json, text/event-stream"
|
|
22
|
-
};
|
|
23
|
-
if (params.sessionId) headers["Mcp-Session-Id"] = params.sessionId;
|
|
24
|
-
if (params.protocolVersion) headers["MCP-Protocol-Version"] = params.protocolVersion;
|
|
25
|
-
return headers;
|
|
26
|
-
}
|
|
27
17
|
/**
|
|
28
18
|
* Select the first result/error matching requestId from a fully read JSON or SSE body,
|
|
29
19
|
* falling back to the last result/error when no id matches. JSON batches are flattened
|
|
@@ -91,10 +81,13 @@ async function postMcp(params) {
|
|
|
91
81
|
signal: params.signal,
|
|
92
82
|
init: {
|
|
93
83
|
method: "POST",
|
|
94
|
-
headers:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
84
|
+
headers: {
|
|
85
|
+
"Content-Type": "application/json",
|
|
86
|
+
"User-Agent": USER_AGENT,
|
|
87
|
+
Accept: "application/json, text/event-stream",
|
|
88
|
+
...params.sessionId ? { "Mcp-Session-Id": params.sessionId } : {},
|
|
89
|
+
...params.protocolVersion ? { "MCP-Protocol-Version": params.protocolVersion } : {}
|
|
90
|
+
},
|
|
98
91
|
body: JSON.stringify(params.body)
|
|
99
92
|
}
|
|
100
93
|
}, async (response) => {
|
|
@@ -108,17 +101,19 @@ async function postMcp(params) {
|
|
|
108
101
|
};
|
|
109
102
|
});
|
|
110
103
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
104
|
+
async function runParallelMcpSearch(params) {
|
|
105
|
+
const sessionId = params.sessionId?.trim() || randomUUID();
|
|
106
|
+
const timeoutSeconds = params.timeoutSeconds ?? MCP_TIMEOUT_SECONDS;
|
|
107
|
+
const args = {
|
|
108
|
+
objective: params.objective ?? params.searchQueries.join(" "),
|
|
109
|
+
search_queries: [...params.searchQueries],
|
|
110
|
+
session_id: sessionId
|
|
111
|
+
};
|
|
112
|
+
if (params.modelName) args.model_name = params.modelName;
|
|
118
113
|
const initId = randomUUID();
|
|
119
114
|
const init = await postMcp({
|
|
120
115
|
timeoutSeconds,
|
|
121
|
-
signal,
|
|
116
|
+
signal: params.signal,
|
|
122
117
|
body: {
|
|
123
118
|
jsonrpc: "2.0",
|
|
124
119
|
id: initId,
|
|
@@ -133,7 +128,7 @@ async function mcpCall(toolName, args, timeoutSeconds, signal) {
|
|
|
133
128
|
}
|
|
134
129
|
}
|
|
135
130
|
});
|
|
136
|
-
const
|
|
131
|
+
const mcpSessionId = init.sessionIdHeader ?? void 0;
|
|
137
132
|
const initEnvelope = selectMcpEnvelope(init.text, initId);
|
|
138
133
|
const negotiatedVersion = (isRecord(initEnvelope.result) && typeof initEnvelope.result.protocolVersion === "string" ? initEnvelope.result.protocolVersion : void 0) ?? MCP_PROTOCOL_VERSION;
|
|
139
134
|
await postMcp({
|
|
@@ -141,45 +136,27 @@ async function mcpCall(toolName, args, timeoutSeconds, signal) {
|
|
|
141
136
|
jsonrpc: "2.0",
|
|
142
137
|
method: "notifications/initialized"
|
|
143
138
|
},
|
|
144
|
-
sessionId,
|
|
139
|
+
sessionId: mcpSessionId,
|
|
145
140
|
protocolVersion: negotiatedVersion,
|
|
146
141
|
timeoutSeconds,
|
|
147
|
-
signal
|
|
142
|
+
signal: params.signal
|
|
148
143
|
});
|
|
149
144
|
const callId = randomUUID();
|
|
150
|
-
|
|
145
|
+
const payload = extractMcpToolPayload(selectMcpEnvelope((await postMcp({
|
|
151
146
|
body: {
|
|
152
147
|
jsonrpc: "2.0",
|
|
153
148
|
id: callId,
|
|
154
149
|
method: "tools/call",
|
|
155
150
|
params: {
|
|
156
|
-
name:
|
|
151
|
+
name: "web_search",
|
|
157
152
|
arguments: args
|
|
158
153
|
}
|
|
159
154
|
},
|
|
160
|
-
sessionId,
|
|
155
|
+
sessionId: mcpSessionId,
|
|
161
156
|
protocolVersion: negotiatedVersion,
|
|
162
157
|
timeoutSeconds,
|
|
163
|
-
signal
|
|
158
|
+
signal: params.signal
|
|
164
159
|
})).text, callId));
|
|
165
|
-
}
|
|
166
|
-
function normalizeMcpSessionId(value) {
|
|
167
|
-
return value?.trim() || randomUUID();
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Run a `web_search` tool call against the free hosted Search MCP and return a
|
|
171
|
-
* `ParallelSearchResponse`-compatible object so the runtime's existing result
|
|
172
|
-
* normalization (`normalizeParallelResults`) is reused verbatim.
|
|
173
|
-
*/
|
|
174
|
-
async function runParallelMcpSearch(params) {
|
|
175
|
-
const sessionId = normalizeMcpSessionId(params.sessionId);
|
|
176
|
-
const args = {
|
|
177
|
-
objective: params.objective ?? params.searchQueries.join(" "),
|
|
178
|
-
search_queries: [...params.searchQueries],
|
|
179
|
-
session_id: sessionId
|
|
180
|
-
};
|
|
181
|
-
if (params.modelName) args.model_name = params.modelName;
|
|
182
|
-
const payload = await mcpCall("web_search", args, params.timeoutSeconds ?? MCP_TIMEOUT_SECONDS, params.signal);
|
|
183
160
|
const results = (Array.isArray(payload.results) ? payload.results : []).slice(0, Math.max(params.maxResults, 1));
|
|
184
161
|
return {
|
|
185
162
|
search_id: typeof payload.search_id === "string" ? payload.search_id : void 0,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./parallel-free-web-search-provider-
|
|
1
|
+
import "./parallel-free-web-search-provider-ComsnjrF.mjs";
|
|
2
2
|
import { DEFAULT_SEARCH_COUNT, buildSearchCacheKey, readCachedSearchPayload, readPositiveIntegerParam, readStringArrayParam, readStringParam, resolveSearchCacheTtlMs, resolveSearchTimeoutSeconds, resolveSiteName, wrapWebContent, writeCachedSearchPayload } from "openclaw/plugin-sdk/provider-web-search";
|
|
3
|
-
import { asOptionalObjectRecord, isRecord, normalizeBoundedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
import { asOptionalObjectRecord, filterStringEntries, isRecord, normalizeBoundedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
5
5
|
import { resolveIntegerOption } from "openclaw/plugin-sdk/number-runtime";
|
|
6
6
|
//#region extensions/parallel/src/parallel-search-normalize.ts
|
|
@@ -27,25 +27,37 @@ function normalizeParallelSearchRequest(args, configuredCount, sessionIdMaxLengt
|
|
|
27
27
|
async function executeParallelSearchRequest(params) {
|
|
28
28
|
const request = normalizeParallelSearchRequest(params.args, params.searchConfig?.maxResults, params.provider === "parallel" ? PARALLEL_SESSION_ID_MAX_LENGTH : 100);
|
|
29
29
|
if ("error" in request) return request.error;
|
|
30
|
-
const cacheKey =
|
|
30
|
+
const cacheKey = buildSearchCacheKey(["parallel", JSON.stringify({
|
|
31
31
|
endpoint: params.endpoint,
|
|
32
32
|
...request
|
|
33
|
-
});
|
|
33
|
+
})]);
|
|
34
34
|
const cacheTtlMs = resolveSearchCacheTtlMs(params.searchConfig);
|
|
35
35
|
const cached = readCachedSearchPayload(cacheKey, cacheTtlMs);
|
|
36
36
|
if (cached) return cached;
|
|
37
37
|
const start = Date.now();
|
|
38
38
|
const response = await params.search(request, resolveSearchTimeoutSeconds(params.searchConfig));
|
|
39
39
|
params.signal?.throwIfAborted();
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
objective: request.objective,
|
|
40
|
+
const results = mapParallelResults(response, request.count);
|
|
41
|
+
const payload = {
|
|
42
|
+
...request.objective ? { objective: request.objective } : {},
|
|
43
43
|
searchQueries: request.searchQueries,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
start
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
provider: params.provider,
|
|
45
|
+
count: results.length,
|
|
46
|
+
tookMs: Date.now() - start,
|
|
47
|
+
externalContent: {
|
|
48
|
+
untrusted: true,
|
|
49
|
+
source: "web_search",
|
|
50
|
+
provider: params.provider,
|
|
51
|
+
wrapped: true
|
|
52
|
+
},
|
|
53
|
+
results
|
|
54
|
+
};
|
|
55
|
+
if (typeof response.search_id === "string") payload.searchId = response.search_id;
|
|
56
|
+
if (typeof response.session_id === "string") payload.sessionId = response.session_id;
|
|
57
|
+
if (Array.isArray(response.warnings) && response.warnings.length > 0) payload.warnings = response.warnings;
|
|
58
|
+
if (Array.isArray(response.usage) && response.usage.length > 0) payload.usage = response.usage;
|
|
59
|
+
const cachePayload = !request.sessionId && "sessionId" in payload ? { ...payload } : payload;
|
|
60
|
+
if (!request.sessionId) delete cachePayload.sessionId;
|
|
49
61
|
writeCachedSearchPayload(cacheKey, cachePayload, cacheTtlMs);
|
|
50
62
|
return payload;
|
|
51
63
|
}
|
|
@@ -59,12 +71,10 @@ function resolveParallelSearchCount(args, configuredCount) {
|
|
|
59
71
|
max: PARALLEL_MAX_SEARCH_COUNT
|
|
60
72
|
});
|
|
61
73
|
}
|
|
62
|
-
function normalizeParallelSearchQueries(
|
|
63
|
-
const candidates = Array.isArray(value) ? value : [];
|
|
74
|
+
function normalizeParallelSearchQueries(candidates = []) {
|
|
64
75
|
const seen = /* @__PURE__ */ new Set();
|
|
65
76
|
const out = [];
|
|
66
77
|
for (const entry of candidates) {
|
|
67
|
-
if (typeof entry !== "string") continue;
|
|
68
78
|
const trimmed = entry.trim();
|
|
69
79
|
if (!trimmed) continue;
|
|
70
80
|
const capped = truncateUtf16Safe(trimmed, PARALLEL_MAX_SEARCH_QUERY_CHARS);
|
|
@@ -89,7 +99,7 @@ function mapParallelResults(response, count) {
|
|
|
89
99
|
const title = typeof entry.title === "string" ? entry.title : "";
|
|
90
100
|
const url = typeof entry.url === "string" ? entry.url : "";
|
|
91
101
|
const published = typeof entry.publish_date === "string" && entry.publish_date ? entry.publish_date : void 0;
|
|
92
|
-
const excerpts =
|
|
102
|
+
const excerpts = filterStringEntries(entry.excerpts).map((e) => wrapWebContent(e, "web_search"));
|
|
93
103
|
const description = excerpts.join("\n\n");
|
|
94
104
|
return Object.assign({
|
|
95
105
|
title: title ? wrapWebContent(title, "web_search") : "",
|
|
@@ -99,48 +109,5 @@ function mapParallelResults(response, count) {
|
|
|
99
109
|
}, published ? { published } : {}, excerpts.length > 0 ? { excerpts } : {});
|
|
100
110
|
});
|
|
101
111
|
}
|
|
102
|
-
function buildParallelSearchPayload(params) {
|
|
103
|
-
const results = mapParallelResults(params.response, params.count);
|
|
104
|
-
const payload = {
|
|
105
|
-
...params.objective ? { objective: params.objective } : {},
|
|
106
|
-
searchQueries: params.searchQueries,
|
|
107
|
-
provider: params.provider,
|
|
108
|
-
count: results.length,
|
|
109
|
-
tookMs: Date.now() - params.start,
|
|
110
|
-
externalContent: {
|
|
111
|
-
untrusted: true,
|
|
112
|
-
source: "web_search",
|
|
113
|
-
provider: params.provider,
|
|
114
|
-
wrapped: true
|
|
115
|
-
},
|
|
116
|
-
results
|
|
117
|
-
};
|
|
118
|
-
if (typeof params.response.search_id === "string") payload.searchId = params.response.search_id;
|
|
119
|
-
if (typeof params.response.session_id === "string") payload.sessionId = params.response.session_id;
|
|
120
|
-
if (Array.isArray(params.response.warnings) && params.response.warnings.length > 0) payload.warnings = params.response.warnings;
|
|
121
|
-
if (Array.isArray(params.response.usage) && params.response.usage.length > 0) payload.usage = params.response.usage;
|
|
122
|
-
return payload;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Drops a Parallel-generated `sessionId` before caching. Identical queries from
|
|
126
|
-
* unrelated tasks would otherwise share that id; caller-supplied session ids are
|
|
127
|
-
* part of the cache key, so a cache hit only ever returns the matching id.
|
|
128
|
-
*/
|
|
129
|
-
function stripParallelGeneratedSessionId(payload) {
|
|
130
|
-
if (!("sessionId" in payload)) return payload;
|
|
131
|
-
const { sessionId: _omitted, ...rest } = payload;
|
|
132
|
-
return rest;
|
|
133
|
-
}
|
|
134
|
-
function buildParallelCacheKey(params) {
|
|
135
|
-
return buildSearchCacheKey([
|
|
136
|
-
"parallel",
|
|
137
|
-
params.endpoint,
|
|
138
|
-
params.objective,
|
|
139
|
-
params.searchQueries.join("\0"),
|
|
140
|
-
params.count,
|
|
141
|
-
params.sessionId,
|
|
142
|
-
params.clientModel
|
|
143
|
-
]);
|
|
144
|
-
}
|
|
145
112
|
//#endregion
|
|
146
113
|
export { executeParallelSearchRequest as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as executeParallelSearchRequest } from "./parallel-search-normalize-
|
|
1
|
+
import { t as executeParallelSearchRequest } from "./parallel-search-normalize-DCF3dT4s.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { mergeScopedSearchConfig, readConfiguredSecretString, readProviderEnvValue, resolveProviderWebSearchPluginConfig, withTrustedWebSearchEndpoint } from "openclaw/plugin-sdk/provider-web-search";
|
|
4
4
|
import { readPluginPackageVersion } from "openclaw/plugin-sdk/extension-shared";
|
|
@@ -36,53 +36,19 @@ function resolveParallelSearchEndpoint(parallel) {
|
|
|
36
36
|
}
|
|
37
37
|
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return invalidBaseUrlPayload(configured);
|
|
38
38
|
const pathname = parsed.pathname.replace(/\/+$/, "");
|
|
39
|
-
parsed.pathname = pathname.endsWith(PARALLEL_SEARCH_PATHNAME) ? pathname : `${pathname
|
|
39
|
+
parsed.pathname = pathname.endsWith(PARALLEL_SEARCH_PATHNAME) ? pathname : `${pathname}${PARALLEL_SEARCH_PATHNAME}`;
|
|
40
40
|
parsed.hash = "";
|
|
41
41
|
return { endpoint: parsed.toString() };
|
|
42
42
|
}
|
|
43
|
-
function missingParallelKeyPayload() {
|
|
44
|
-
return {
|
|
45
|
-
error: "missing_parallel_api_key",
|
|
46
|
-
message: "web_search (parallel) needs a Parallel API key. Set PARALLEL_API_KEY in the Gateway environment, or configure plugins.entries.parallel.config.webSearch.apiKey.",
|
|
47
|
-
docs: "https://docs.openclaw.ai/tools/parallel-search"
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
async function runParallelSearch(params) {
|
|
51
|
-
const body = {
|
|
52
|
-
search_queries: [...params.searchQueries],
|
|
53
|
-
advanced_settings: { max_results: params.maxResults }
|
|
54
|
-
};
|
|
55
|
-
if (params.objective) body.objective = params.objective;
|
|
56
|
-
if (params.sessionId) body.session_id = params.sessionId;
|
|
57
|
-
if (params.clientModel) body.client_model = params.clientModel;
|
|
58
|
-
return withTrustedWebSearchEndpoint({
|
|
59
|
-
url: params.endpoint,
|
|
60
|
-
timeoutSeconds: params.timeoutSeconds,
|
|
61
|
-
signal: params.signal,
|
|
62
|
-
init: {
|
|
63
|
-
method: "POST",
|
|
64
|
-
headers: {
|
|
65
|
-
Accept: "application/json",
|
|
66
|
-
"Content-Type": "application/json",
|
|
67
|
-
"x-api-key": params.apiKey,
|
|
68
|
-
"User-Agent": USER_AGENT
|
|
69
|
-
},
|
|
70
|
-
body: JSON.stringify(body)
|
|
71
|
-
}
|
|
72
|
-
}, async (res) => {
|
|
73
|
-
if (!res.ok) {
|
|
74
|
-
const detail = await readResponseTextLimited(res, PARALLEL_ERROR_BODY_LIMIT_BYTES).catch(() => "");
|
|
75
|
-
params.signal?.throwIfAborted();
|
|
76
|
-
throw new ProviderHttpError(`Parallel API error (${res.status}): ${redactToolPayloadText(redactSensitiveText(detail || res.statusText, { mode: "tools" }))}`, { status: res.status });
|
|
77
|
-
}
|
|
78
|
-
return await readProviderJsonResponse(res, "Parallel API", { maxBytes: PARALLEL_SEARCH_RESPONSE_LIMIT_BYTES });
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
43
|
async function executeParallelWebSearchProviderTool(ctx, args, signal) {
|
|
82
44
|
const searchConfig = mergeScopedSearchConfig(ctx.searchConfig, "parallel", resolveProviderWebSearchPluginConfig(ctx.config, "parallel"));
|
|
83
45
|
const parallelConfig = asOptionalRecord(searchConfig?.parallel);
|
|
84
46
|
const apiKey = resolveParallelApiKey(parallelConfig);
|
|
85
|
-
if (!apiKey) return
|
|
47
|
+
if (!apiKey) return {
|
|
48
|
+
error: "missing_parallel_api_key",
|
|
49
|
+
message: "web_search (parallel) needs a Parallel API key. Set PARALLEL_API_KEY in the Gateway environment, or configure plugins.entries.parallel.config.webSearch.apiKey.",
|
|
50
|
+
docs: "https://docs.openclaw.ai/tools/parallel-search"
|
|
51
|
+
};
|
|
86
52
|
const endpointResult = resolveParallelSearchEndpoint(parallelConfig);
|
|
87
53
|
if ("error" in endpointResult) return endpointResult;
|
|
88
54
|
const endpoint = endpointResult.endpoint;
|
|
@@ -92,14 +58,37 @@ async function executeParallelWebSearchProviderTool(ctx, args, signal) {
|
|
|
92
58
|
args,
|
|
93
59
|
searchConfig,
|
|
94
60
|
signal,
|
|
95
|
-
search: (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
61
|
+
search: async (request, timeoutSeconds) => {
|
|
62
|
+
const body = {
|
|
63
|
+
search_queries: [...request.searchQueries],
|
|
64
|
+
advanced_settings: { max_results: request.count }
|
|
65
|
+
};
|
|
66
|
+
if (request.objective) body.objective = request.objective;
|
|
67
|
+
if (request.sessionId) body.session_id = request.sessionId;
|
|
68
|
+
if (request.clientModel) body.client_model = request.clientModel;
|
|
69
|
+
return withTrustedWebSearchEndpoint({
|
|
70
|
+
url: endpoint,
|
|
71
|
+
timeoutSeconds,
|
|
72
|
+
signal,
|
|
73
|
+
init: {
|
|
74
|
+
method: "POST",
|
|
75
|
+
headers: {
|
|
76
|
+
Accept: "application/json",
|
|
77
|
+
"Content-Type": "application/json",
|
|
78
|
+
"x-api-key": apiKey,
|
|
79
|
+
"User-Agent": USER_AGENT
|
|
80
|
+
},
|
|
81
|
+
body: JSON.stringify(body)
|
|
82
|
+
}
|
|
83
|
+
}, async (res) => {
|
|
84
|
+
if (!res.ok) {
|
|
85
|
+
const detail = await readResponseTextLimited(res, PARALLEL_ERROR_BODY_LIMIT_BYTES).catch(() => "");
|
|
86
|
+
signal?.throwIfAborted();
|
|
87
|
+
throw new ProviderHttpError(`Parallel API error (${res.status}): ${redactToolPayloadText(redactSensitiveText(detail || res.statusText, { mode: "tools" }))}`, { status: res.status });
|
|
88
|
+
}
|
|
89
|
+
return await readProviderJsonResponse(res, "Parallel API", { maxBytes: PARALLEL_SEARCH_RESPONSE_LIMIT_BYTES });
|
|
90
|
+
});
|
|
91
|
+
}
|
|
103
92
|
});
|
|
104
93
|
}
|
|
105
94
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./.setup/parallel-free-web-search-provider-
|
|
1
|
+
import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./.setup/parallel-free-web-search-provider-ComsnjrF.mjs";
|
|
2
2
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
3
3
|
//#region extensions/parallel/index.ts
|
|
4
4
|
var parallel_default = definePluginEntry({
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./.setup/parallel-free-web-search-provider-
|
|
1
|
+
import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./.setup/parallel-free-web-search-provider-ComsnjrF.mjs";
|
|
2
2
|
import "./web-search-provider.js";
|
|
3
3
|
export { createParallelFreeWebSearchProvider, createParallelWebSearchProvider };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./.setup/parallel-free-web-search-provider-
|
|
1
|
+
import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./.setup/parallel-free-web-search-provider-ComsnjrF.mjs";
|
|
2
2
|
export { createParallelFreeWebSearchProvider, createParallelWebSearchProvider };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/parallel-plugin",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.10.1-beta.1",
|
|
4
4
|
"description": "OpenClaw Parallel web search plugin.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"minHostVersion": ">=2026.6.8"
|
|
19
19
|
},
|
|
20
20
|
"compat": {
|
|
21
|
-
"pluginApi": ">=2026.
|
|
21
|
+
"pluginApi": ">=2026.10.1-beta.1"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.
|
|
24
|
+
"openclawVersion": "2026.10.1-beta.1",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"assets/activity.svg"
|
|
41
41
|
],
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"openclaw": ">=2026.
|
|
43
|
+
"openclaw": ">=2026.10.1-beta.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"openclaw": {
|