@openclaw/parallel-plugin 2026.8.1-beta.3 → 2026.8.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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./parallel-free-web-search-provider-1gMblAEi.js";
1
+ import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./parallel-free-web-search-provider-C4pp_if5.js";
2
2
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
3
3
  //#region extensions/parallel/index.ts
4
4
  var parallel_default = definePluginEntry({
@@ -0,0 +1,143 @@
1
+ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
2
+ import { createWebSearchProviderContractFields } from "openclaw/plugin-sdk/provider-web-search-contract";
3
+ //#region extensions/parallel/src/parallel-free-web-search-provider.shared.ts
4
+ const PARALLEL_FREE_ONBOARDING_SCOPES = ["text-inference"];
5
+ function createParallelFreeWebSearchProviderBase() {
6
+ return {
7
+ id: "parallel-free",
8
+ label: "Parallel Search (Free)",
9
+ hint: "Free web search via Parallel's hosted Search MCP — no API key required",
10
+ onboardingScopes: [...PARALLEL_FREE_ONBOARDING_SCOPES],
11
+ requiresCredential: false,
12
+ envVars: [],
13
+ placeholder: "(no key needed)",
14
+ signupUrl: "https://parallel.ai",
15
+ docsUrl: "https://docs.openclaw.ai/tools/parallel-search",
16
+ credentialPath: "",
17
+ ...createWebSearchProviderContractFields({
18
+ credentialPath: "",
19
+ searchCredential: {
20
+ type: "scoped",
21
+ scopeId: "parallel-free"
22
+ },
23
+ selectionPluginId: "parallel"
24
+ })
25
+ };
26
+ }
27
+ //#endregion
28
+ //#region extensions/parallel/src/parallel-web-search-provider.shared.ts
29
+ const PARALLEL_CREDENTIAL_PATH = "plugins.entries.parallel.config.webSearch.apiKey";
30
+ const PARALLEL_ONBOARDING_SCOPES = ["text-inference"];
31
+ function createParallelWebSearchProviderBase() {
32
+ return {
33
+ id: "parallel",
34
+ label: "Parallel Search",
35
+ hint: "LLM-optimized dense excerpts from web sources",
36
+ onboardingScopes: [...PARALLEL_ONBOARDING_SCOPES],
37
+ credentialLabel: "Parallel API key",
38
+ envVars: ["PARALLEL_API_KEY"],
39
+ placeholder: "par-...",
40
+ signupUrl: "https://platform.parallel.ai",
41
+ docsUrl: "https://docs.openclaw.ai/tools/parallel-search",
42
+ autoDetectOrder: 75,
43
+ credentialPath: PARALLEL_CREDENTIAL_PATH,
44
+ ...createWebSearchProviderContractFields({
45
+ credentialPath: PARALLEL_CREDENTIAL_PATH,
46
+ searchCredential: {
47
+ type: "scoped",
48
+ scopeId: "parallel"
49
+ },
50
+ configuredCredential: { pluginId: "parallel" },
51
+ selectionPluginId: "parallel"
52
+ })
53
+ };
54
+ }
55
+ //#endregion
56
+ //#region extensions/parallel/src/parallel-web-search-provider.ts
57
+ const PARALLEL_MAX_SEARCH_COUNT = 40;
58
+ const PARALLEL_MAX_SEARCH_QUERIES = 5;
59
+ const PARALLEL_MAX_SEARCH_QUERY_CHARS = 200;
60
+ const PARALLEL_MAX_OBJECTIVE_CHARS = 5e3;
61
+ const PARALLEL_MAX_SESSION_ID_CHARS = 1e3;
62
+ const PARALLEL_MAX_CLIENT_MODEL_CHARS = 100;
63
+ const loadParallelWebSearchRuntime = createLazyRuntimeModule(() => import("./parallel-web-search-provider.runtime-BD9eIDGn.js"));
64
+ const ParallelSearchSchema = {
65
+ type: "object",
66
+ properties: {
67
+ objective: {
68
+ type: "string",
69
+ description: "Natural-language description of the underlying question or goal driving the search. Should be self-contained with enough context to understand the intent. Used together with search_queries to focus results on the most relevant content.",
70
+ maxLength: PARALLEL_MAX_OBJECTIVE_CHARS
71
+ },
72
+ search_queries: {
73
+ type: "array",
74
+ description: "Concise keyword search queries, 3-6 words each. Provide 2-3 diverse queries for best results (max 5). Vary entity names, synonyms, and angles. Each query is a keyword phrase, not a sentence; do not use site: operators.",
75
+ items: {
76
+ type: "string",
77
+ maxLength: PARALLEL_MAX_SEARCH_QUERY_CHARS
78
+ },
79
+ minItems: 1,
80
+ maxItems: PARALLEL_MAX_SEARCH_QUERIES
81
+ },
82
+ count: {
83
+ type: "integer",
84
+ description: "Number of results to return (1-40).",
85
+ minimum: 1,
86
+ maximum: PARALLEL_MAX_SEARCH_COUNT
87
+ },
88
+ session_id: {
89
+ type: "string",
90
+ description: "Optional session id returned by an earlier Parallel search. Pass it on follow-up searches that are part of the same task to keep Parallel's server-side context grouped (look for `sessionId` in the prior tool result).",
91
+ maxLength: PARALLEL_MAX_SESSION_ID_CHARS
92
+ },
93
+ client_model: {
94
+ type: "string",
95
+ description: "The identifier of the LLM model making this tool call (e.g. 'claude-opus-4-7', 'gpt-5.6-sol', 'gemini-3.1-pro'). Pass the exact active model slug verbatim; never shorten or substitute a family alias like 'gpt-5'. Lets Parallel tailor default settings for your model's capabilities.",
96
+ maxLength: PARALLEL_MAX_CLIENT_MODEL_CHARS
97
+ }
98
+ },
99
+ required: ["objective", "search_queries"],
100
+ additionalProperties: false
101
+ };
102
+ function createParallelWebSearchProvider() {
103
+ return {
104
+ ...createParallelWebSearchProviderBase(),
105
+ createTool: (ctx) => ({
106
+ 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.",
107
+ parameters: ParallelSearchSchema,
108
+ execute: async (args, context) => {
109
+ context?.signal?.throwIfAborted();
110
+ const { executeParallelWebSearchProviderTool } = await loadParallelWebSearchRuntime();
111
+ return await executeParallelWebSearchProviderTool(ctx, args, context?.signal);
112
+ }
113
+ })
114
+ };
115
+ }
116
+ //#endregion
117
+ //#region extensions/parallel/src/parallel-free-web-search-provider.ts
118
+ const ParallelFreeSearchSchema = {
119
+ ...ParallelSearchSchema,
120
+ properties: {
121
+ ...ParallelSearchSchema.properties,
122
+ session_id: {
123
+ ...ParallelSearchSchema.properties.session_id,
124
+ maxLength: 100
125
+ }
126
+ }
127
+ };
128
+ const loadParallelFreeWebSearchRuntime = createLazyRuntimeModule(() => import("./parallel-free-web-search-provider.runtime-CdTfAH22.js"));
129
+ function createParallelFreeWebSearchProvider() {
130
+ return {
131
+ ...createParallelFreeWebSearchProviderBase(),
132
+ createTool: (ctx) => ({
133
+ description: "Search the web using Parallel's free Search MCP (no API key). 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.",
134
+ parameters: ParallelFreeSearchSchema,
135
+ execute: async (args, context) => {
136
+ const { executeParallelFreeWebSearchProviderTool } = await loadParallelFreeWebSearchRuntime();
137
+ return await executeParallelFreeWebSearchProviderTool(ctx, args, context?.signal);
138
+ }
139
+ })
140
+ };
141
+ }
142
+ //#endregion
143
+ export { createParallelWebSearchProvider as n, createParallelFreeWebSearchProvider as t };
@@ -1,17 +1,18 @@
1
- import { a as buildParallelSearchPayload, i as buildParallelCacheKey, p as stripParallelGeneratedSessionId, u as normalizeParallelSearchRequest } from "./parallel-free-web-search-provider-1gMblAEi.js";
1
+ import { n as executeParallelSearchRequest } from "./parallel-search-normalize-77QLJrqw.js";
2
2
  import { createRequire } from "node:module";
3
- import { mergeScopedSearchConfig, readCachedSearchPayload, resolveProviderWebSearchPluginConfig, resolveSearchCacheTtlMs, resolveSearchTimeoutSeconds, withTrustedWebSearchEndpoint, writeCachedSearchPayload } from "openclaw/plugin-sdk/provider-web-search";
4
- import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
5
- import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
3
+ import { mergeScopedSearchConfig, resolveProviderWebSearchPluginConfig, withTrustedWebSearchEndpoint } from "openclaw/plugin-sdk/provider-web-search";
6
4
  import { randomUUID } from "node:crypto";
7
5
  import { readPluginPackageVersion } from "openclaw/plugin-sdk/extension-shared";
8
6
  import { readProviderTextResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
7
+ import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
8
+ import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
9
9
  //#region extensions/parallel/src/parallel-mcp-search.runtime.ts
10
10
  const PARALLEL_MCP_SEARCH_URL = "https://search.parallel.ai/mcp";
11
11
  const MCP_PROTOCOL_VERSION = "2025-06-18";
12
12
  const MCP_TIMEOUT_SECONDS = 30;
13
- const PARALLEL_MCP_ERROR_BODY_LIMIT_BYTES = 8 * 1024;
14
- const PLUGIN_VERSION = readPluginPackageVersion({ require: createRequire(import.meta.url) });
13
+ const PARALLEL_MCP_ERROR_BODY_LIMIT_BYTES = 8192;
14
+ const require = createRequire(import.meta.url);
15
+ const PLUGIN_VERSION = readPluginPackageVersion({ require });
15
16
  const USER_AGENT = `openclaw-parallel/${PLUGIN_VERSION} (${process.platform})`;
16
17
  function mcpHeaders(params) {
17
18
  const headers = {
@@ -210,39 +211,20 @@ async function runParallelMcpSearch(params) {
210
211
  async function executeParallelFreeWebSearchProviderTool(ctx, args, signal) {
211
212
  signal?.throwIfAborted();
212
213
  const searchConfig = mergeScopedSearchConfig(ctx.searchConfig, "parallel-free", resolveProviderWebSearchPluginConfig(ctx.config, "parallel-free"));
213
- const request = normalizeParallelSearchRequest(args, searchConfig?.maxResults, 100);
214
- if ("error" in request) return request.error;
215
- const { objective, searchQueries, count, sessionId, clientModel } = request;
216
- const cacheKey = buildParallelCacheKey({
217
- endpoint: PARALLEL_MCP_SEARCH_URL,
218
- objective,
219
- searchQueries,
220
- count,
221
- sessionId,
222
- clientModel
223
- });
224
- const cached = readCachedSearchPayload(cacheKey);
225
- if (cached) return cached;
226
- const start = Date.now();
227
- const response = await runParallelMcpSearch({
228
- objective,
229
- searchQueries,
230
- maxResults: count,
231
- sessionId,
232
- modelName: clientModel,
233
- timeoutSeconds: resolveSearchTimeoutSeconds(searchConfig),
234
- signal
235
- });
236
- signal?.throwIfAborted();
237
- const payload = buildParallelSearchPayload({
214
+ return executeParallelSearchRequest({
238
215
  provider: "parallel-free",
239
- objective,
240
- searchQueries,
241
- response,
242
- start
216
+ endpoint: PARALLEL_MCP_SEARCH_URL,
217
+ args,
218
+ searchConfig,
219
+ signal,
220
+ search: ({ count, clientModel, ...request }, timeoutSeconds) => runParallelMcpSearch({
221
+ ...request,
222
+ maxResults: count,
223
+ modelName: clientModel,
224
+ timeoutSeconds,
225
+ signal
226
+ })
243
227
  });
244
- writeCachedSearchPayload(cacheKey, sessionId ? payload : stripParallelGeneratedSessionId(payload), resolveSearchCacheTtlMs(searchConfig));
245
- return payload;
246
228
  }
247
229
  //#endregion
248
230
  export { executeParallelFreeWebSearchProviderTool };
@@ -0,0 +1,160 @@
1
+ import "./parallel-free-web-search-provider-C4pp_if5.js";
2
+ import { DEFAULT_SEARCH_COUNT, buildSearchCacheKey, readCachedSearchPayload, readPositiveIntegerParam, readStringArrayParam, readStringParam, resolveSearchCacheTtlMs, resolveSearchTimeoutSeconds, resolveSiteName, wrapWebContent, writeCachedSearchPayload } from "openclaw/plugin-sdk/provider-web-search";
3
+ import { normalizeBoundedOptionalString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
+ import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
5
+ import { resolveIntegerOption } from "openclaw/plugin-sdk/number-runtime";
6
+ //#region extensions/parallel/src/parallel-search-normalize.ts
7
+ const PARALLEL_MAX_SEARCH_COUNT = 40;
8
+ const PARALLEL_MAX_SEARCH_QUERY_CHARS = 200;
9
+ const PARALLEL_MAX_OBJECTIVE_CHARS = 5e3;
10
+ const PARALLEL_MAX_SEARCH_QUERIES = 5;
11
+ const PARALLEL_SESSION_ID_MAX_LENGTH = 1e3;
12
+ const PARALLEL_CLIENT_MODEL_MAX_LENGTH = 100;
13
+ function normalizeParallelSearchRequest(args, configuredCount, sessionIdMaxLength) {
14
+ const objective = normalizeParallelObjective(readStringParam(args, "objective"));
15
+ const cliQuery = normalizeParallelObjective(readStringParam(args, "query"));
16
+ let searchQueries = normalizeParallelSearchQueries(readStringArrayParam(args, "search_queries"));
17
+ if (searchQueries.length === 0 && cliQuery) searchQueries = normalizeParallelSearchQueries([cliQuery]);
18
+ if (searchQueries.length === 0) return { error: invalidSearchQueriesPayload() };
19
+ return {
20
+ objective,
21
+ searchQueries,
22
+ count: resolveParallelSearchCount(args, configuredCount),
23
+ sessionId: normalizeBoundedOptionalString(readStringParam(args, "session_id"), sessionIdMaxLength),
24
+ clientModel: normalizeParallelClientModel(readStringParam(args, "client_model"))
25
+ };
26
+ }
27
+ async function executeParallelSearchRequest(params) {
28
+ const request = normalizeParallelSearchRequest(params.args, params.searchConfig?.maxResults, params.provider === "parallel" ? PARALLEL_SESSION_ID_MAX_LENGTH : 100);
29
+ if ("error" in request) return request.error;
30
+ const cacheKey = buildParallelCacheKey({
31
+ endpoint: params.endpoint,
32
+ ...request
33
+ });
34
+ const cacheTtlMs = resolveSearchCacheTtlMs(params.searchConfig);
35
+ const cached = readCachedSearchPayload(cacheKey, cacheTtlMs);
36
+ if (cached) return cached;
37
+ const start = Date.now();
38
+ const response = await params.search(request, resolveSearchTimeoutSeconds(params.searchConfig));
39
+ params.signal?.throwIfAborted();
40
+ const payload = buildParallelSearchPayload({
41
+ provider: params.provider,
42
+ objective: request.objective,
43
+ searchQueries: request.searchQueries,
44
+ response,
45
+ start
46
+ });
47
+ const cachePayload = request.sessionId ? payload : stripParallelGeneratedSessionId(payload);
48
+ writeCachedSearchPayload(cacheKey, cachePayload, cacheTtlMs);
49
+ return payload;
50
+ }
51
+ function resolveParallelSearchCount(args, configuredCount) {
52
+ const value = readPositiveIntegerParam(args, "count", {
53
+ max: PARALLEL_MAX_SEARCH_COUNT,
54
+ message: `count must be an integer from 1 to ${PARALLEL_MAX_SEARCH_COUNT}.`
55
+ }) ?? (typeof configuredCount === "number" ? configuredCount : DEFAULT_SEARCH_COUNT);
56
+ return resolveIntegerOption(value, DEFAULT_SEARCH_COUNT, {
57
+ min: 1,
58
+ max: PARALLEL_MAX_SEARCH_COUNT
59
+ });
60
+ }
61
+ function normalizeParallelObjective(value) {
62
+ const trimmed = normalizeOptionalString(value);
63
+ if (!trimmed) return;
64
+ return trimmed.length <= PARALLEL_MAX_OBJECTIVE_CHARS ? trimmed : truncateUtf16Safe(trimmed, PARALLEL_MAX_OBJECTIVE_CHARS);
65
+ }
66
+ function normalizeParallelClientModel(value) {
67
+ const trimmed = normalizeOptionalString(value);
68
+ if (!trimmed) return;
69
+ return trimmed.length <= PARALLEL_CLIENT_MODEL_MAX_LENGTH ? trimmed : truncateUtf16Safe(trimmed, PARALLEL_CLIENT_MODEL_MAX_LENGTH);
70
+ }
71
+ function normalizeParallelSearchQueries(value) {
72
+ const candidates = Array.isArray(value) ? value : [];
73
+ const seen = /* @__PURE__ */ new Set();
74
+ const out = [];
75
+ for (const entry of candidates) {
76
+ if (typeof entry !== "string") continue;
77
+ const trimmed = entry.trim();
78
+ if (!trimmed) continue;
79
+ const capped = trimmed.length <= PARALLEL_MAX_SEARCH_QUERY_CHARS ? trimmed : truncateUtf16Safe(trimmed, PARALLEL_MAX_SEARCH_QUERY_CHARS);
80
+ if (seen.has(capped)) continue;
81
+ seen.add(capped);
82
+ out.push(capped);
83
+ if (out.length === PARALLEL_MAX_SEARCH_QUERIES) break;
84
+ }
85
+ return out;
86
+ }
87
+ function invalidSearchQueriesPayload() {
88
+ return {
89
+ error: "invalid_search_queries",
90
+ message: "search_queries must be a non-empty array of keyword strings (max 5, max 200 chars each). See https://docs.parallel.ai/search/best-practices.",
91
+ docs: "https://docs.openclaw.ai/tools/parallel-search"
92
+ };
93
+ }
94
+ function normalizeParallelResults(payload) {
95
+ if (!payload || typeof payload !== "object") return [];
96
+ const results = payload.results;
97
+ if (!Array.isArray(results)) return [];
98
+ return results.filter((entry) => Boolean(entry && typeof entry === "object" && !Array.isArray(entry)));
99
+ }
100
+ /** Maps a Parallel v1 response into wrapped `web_search` result entries. */
101
+ function mapParallelResults(response) {
102
+ return normalizeParallelResults(response).map((entry) => {
103
+ const title = typeof entry.title === "string" ? entry.title : "";
104
+ const url = typeof entry.url === "string" ? entry.url : "";
105
+ const published = typeof entry.publish_date === "string" && entry.publish_date ? entry.publish_date : void 0;
106
+ const excerpts = Array.isArray(entry.excerpts) ? entry.excerpts.filter((e) => typeof e === "string").map((e) => wrapWebContent(e, "web_search")) : [];
107
+ const description = excerpts.join("\n\n");
108
+ return Object.assign({
109
+ title: title ? wrapWebContent(title, "web_search") : "",
110
+ url,
111
+ description,
112
+ siteName: resolveSiteName(url) || void 0
113
+ }, published ? { published } : {}, excerpts.length > 0 ? { excerpts } : {});
114
+ });
115
+ }
116
+ function buildParallelSearchPayload(params) {
117
+ const results = mapParallelResults(params.response);
118
+ const payload = {
119
+ ...params.objective ? { objective: params.objective } : {},
120
+ searchQueries: params.searchQueries,
121
+ provider: params.provider,
122
+ count: results.length,
123
+ tookMs: Date.now() - params.start,
124
+ externalContent: {
125
+ untrusted: true,
126
+ source: "web_search",
127
+ provider: params.provider,
128
+ wrapped: true
129
+ },
130
+ results
131
+ };
132
+ if (typeof params.response.search_id === "string") payload.searchId = params.response.search_id;
133
+ if (typeof params.response.session_id === "string") payload.sessionId = params.response.session_id;
134
+ if (Array.isArray(params.response.warnings) && params.response.warnings.length > 0) payload.warnings = params.response.warnings;
135
+ if (Array.isArray(params.response.usage) && params.response.usage.length > 0) payload.usage = params.response.usage;
136
+ return payload;
137
+ }
138
+ /**
139
+ * Drops a Parallel-generated `sessionId` before caching. Identical queries from
140
+ * unrelated tasks would otherwise share that id; caller-supplied session ids are
141
+ * part of the cache key, so a cache hit only ever returns the matching id.
142
+ */
143
+ function stripParallelGeneratedSessionId(payload) {
144
+ if (!("sessionId" in payload)) return payload;
145
+ const { sessionId: _omitted, ...rest } = payload;
146
+ return rest;
147
+ }
148
+ function buildParallelCacheKey(params) {
149
+ return buildSearchCacheKey([
150
+ "parallel",
151
+ params.endpoint,
152
+ params.objective,
153
+ params.searchQueries.join("\0"),
154
+ params.count,
155
+ params.sessionId,
156
+ params.clientModel
157
+ ]);
158
+ }
159
+ //#endregion
160
+ export { normalizeParallelResults as a, normalizeParallelObjective as i, executeParallelSearchRequest as n, normalizeParallelSearchQueries as o, normalizeParallelClientModel as r, resolveParallelSearchCount as s, buildParallelCacheKey as t };
@@ -1,17 +1,18 @@
1
- import { a as buildParallelSearchPayload, c as normalizeParallelResults, d as normalizeParallelSessionId, f as resolveParallelSearchCount, i as buildParallelCacheKey, l as normalizeParallelSearchQueries, o as normalizeParallelClientModel, p as stripParallelGeneratedSessionId, r as PARALLEL_SESSION_ID_MAX_LENGTH, s as normalizeParallelObjective, u as normalizeParallelSearchRequest } from "./parallel-free-web-search-provider-1gMblAEi.js";
1
+ import { a as normalizeParallelResults, i as normalizeParallelObjective, n as executeParallelSearchRequest, o as normalizeParallelSearchQueries, r as normalizeParallelClientModel, s as resolveParallelSearchCount, t as buildParallelCacheKey } from "./parallel-search-normalize-77QLJrqw.js";
2
2
  import { createRequire } from "node:module";
3
- import { mergeScopedSearchConfig, readCachedSearchPayload, readConfiguredSecretString, readProviderEnvValue, resolveProviderWebSearchPluginConfig, resolveSearchCacheTtlMs, resolveSearchTimeoutSeconds, withTrustedWebSearchEndpoint, writeCachedSearchPayload } from "openclaw/plugin-sdk/provider-web-search";
4
- import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
+ import { mergeScopedSearchConfig, readConfiguredSecretString, readProviderEnvValue, resolveProviderWebSearchPluginConfig, withTrustedWebSearchEndpoint } from "openclaw/plugin-sdk/provider-web-search";
5
4
  import { readPluginPackageVersion } from "openclaw/plugin-sdk/extension-shared";
6
5
  import { readProviderJsonResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
6
+ import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
7
7
  import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
8
8
  import { redactSensitiveText } from "openclaw/plugin-sdk/security-runtime";
9
9
  //#region extensions/parallel/src/parallel-web-search-provider.runtime.ts
10
10
  const PARALLEL_BASE_URL = "https://api.parallel.ai";
11
11
  const PARALLEL_SEARCH_PATHNAME = "/v1/search";
12
- const PARALLEL_ERROR_BODY_LIMIT_BYTES = 8 * 1024;
13
- const PARALLEL_SEARCH_RESPONSE_LIMIT_BYTES = 16 * 1024 * 1024;
14
- const USER_AGENT = `openclaw-parallel/${readPluginPackageVersion({ require: createRequire(import.meta.url) })} (${process.platform})`;
12
+ const PARALLEL_ERROR_BODY_LIMIT_BYTES = 8192;
13
+ const PARALLEL_SEARCH_RESPONSE_LIMIT_BYTES = 16777216;
14
+ const require = createRequire(import.meta.url);
15
+ const USER_AGENT = `openclaw-parallel/${readPluginPackageVersion({ require })} (${process.platform})`;
15
16
  function resolveParallelConfig(searchConfig) {
16
17
  const parallel = searchConfig?.parallel;
17
18
  return parallel && typeof parallel === "object" && !Array.isArray(parallel) ? parallel : {};
@@ -88,41 +89,21 @@ async function executeParallelWebSearchProviderTool(ctx, args, signal) {
88
89
  const endpointResult = resolveParallelSearchEndpoint(parallelConfig);
89
90
  if ("error" in endpointResult) return endpointResult;
90
91
  const endpoint = endpointResult.endpoint;
91
- const request = normalizeParallelSearchRequest(args, searchConfig?.maxResults, PARALLEL_SESSION_ID_MAX_LENGTH);
92
- if ("error" in request) return request.error;
93
- const { objective, searchQueries, count, sessionId, clientModel } = request;
94
- const cacheKey = buildParallelCacheKey({
95
- endpoint,
96
- objective,
97
- searchQueries,
98
- count,
99
- sessionId,
100
- clientModel
101
- });
102
- const cached = readCachedSearchPayload(cacheKey);
103
- if (cached) return cached;
104
- const start = Date.now();
105
- const response = await runParallelSearch({
106
- apiKey,
107
- endpoint,
108
- objective,
109
- searchQueries,
110
- maxResults: count,
111
- sessionId,
112
- clientModel,
113
- timeoutSeconds: resolveSearchTimeoutSeconds(searchConfig),
114
- signal
115
- });
116
- signal?.throwIfAborted();
117
- const payload = buildParallelSearchPayload({
92
+ return executeParallelSearchRequest({
118
93
  provider: "parallel",
119
- objective,
120
- searchQueries,
121
- response,
122
- start
94
+ endpoint,
95
+ args,
96
+ searchConfig,
97
+ signal,
98
+ search: ({ count, ...request }, timeoutSeconds) => runParallelSearch({
99
+ ...request,
100
+ apiKey,
101
+ endpoint,
102
+ maxResults: count,
103
+ timeoutSeconds,
104
+ signal
105
+ })
123
106
  });
124
- writeCachedSearchPayload(cacheKey, sessionId ? payload : stripParallelGeneratedSessionId(payload), resolveSearchCacheTtlMs(searchConfig));
125
- return payload;
126
107
  }
127
108
  const testing = {
128
109
  buildParallelCacheKey,
@@ -131,12 +112,10 @@ const testing = {
131
112
  normalizeParallelObjective,
132
113
  normalizeParallelResults,
133
114
  normalizeParallelSearchQueries,
134
- normalizeParallelSessionId,
135
115
  resolveParallelApiKey,
136
116
  resolveParallelSearchCount,
137
117
  resolveParallelSearchEndpoint,
138
- PARALLEL_SEARCH_RESPONSE_LIMIT_BYTES,
139
- USER_AGENT
118
+ PARALLEL_SEARCH_RESPONSE_LIMIT_BYTES
140
119
  };
141
120
  //#endregion
142
121
  export { executeParallelWebSearchProviderTool, testing };
@@ -1,16 +1,3 @@
1
- import { n as createParallelFreeWebSearchProviderBase, t as createParallelWebSearchProviderBase } from "./parallel-web-search-provider.shared-B8yrY1oc.js";
2
- //#region extensions/parallel/web-search-contract-api.ts
3
- function createParallelWebSearchProvider() {
4
- return {
5
- ...createParallelWebSearchProviderBase(),
6
- createTool: () => null
7
- };
8
- }
9
- function createParallelFreeWebSearchProvider() {
10
- return {
11
- ...createParallelFreeWebSearchProviderBase(),
12
- createTool: () => null
13
- };
14
- }
15
- //#endregion
1
+ import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./parallel-free-web-search-provider-C4pp_if5.js";
2
+ import "./web-search-provider.js";
16
3
  export { createParallelFreeWebSearchProvider, createParallelWebSearchProvider };
@@ -1,2 +1,2 @@
1
- import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./parallel-free-web-search-provider-1gMblAEi.js";
1
+ import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./parallel-free-web-search-provider-C4pp_if5.js";
2
2
  export { createParallelFreeWebSearchProvider, createParallelWebSearchProvider };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/parallel-plugin",
3
- "version": "2026.8.1-beta.3",
3
+ "version": "2026.8.2",
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.8.1-beta.3"
21
+ "pluginApi": ">=2026.8.2"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.8.1-beta.3",
24
+ "openclawVersion": "2026.8.2",
25
25
  "bundledDist": false
26
26
  },
27
27
  "release": {
@@ -38,7 +38,7 @@
38
38
  "README.md"
39
39
  ],
40
40
  "peerDependencies": {
41
- "openclaw": ">=2026.8.1-beta.3"
41
+ "openclaw": ">=2026.8.2"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "openclaw": {
@@ -1,224 +0,0 @@
1
- import { n as createParallelFreeWebSearchProviderBase, t as createParallelWebSearchProviderBase } from "./parallel-web-search-provider.shared-B8yrY1oc.js";
2
- import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
3
- import { resolveIntegerOption } from "openclaw/plugin-sdk/number-runtime";
4
- import { DEFAULT_SEARCH_COUNT, buildSearchCacheKey, readPositiveIntegerParam, readStringArrayParam, readStringParam, resolveSiteName, wrapWebContent } from "openclaw/plugin-sdk/provider-web-search";
5
- import { normalizeBoundedOptionalString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
- import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
7
- //#region extensions/parallel/src/parallel-search-normalize.ts
8
- const PARALLEL_MAX_SEARCH_COUNT$1 = 40;
9
- const PARALLEL_MAX_SEARCH_QUERY_CHARS$1 = 200;
10
- const PARALLEL_MAX_OBJECTIVE_CHARS$1 = 5e3;
11
- const PARALLEL_MAX_SEARCH_QUERIES$1 = 5;
12
- const PARALLEL_SESSION_ID_MAX_LENGTH = 1e3;
13
- const PARALLEL_CLIENT_MODEL_MAX_LENGTH = 100;
14
- const normalizeParallelSessionId = normalizeBoundedOptionalString;
15
- function normalizeParallelSearchRequest(args, configuredCount, sessionIdMaxLength) {
16
- const objective = normalizeParallelObjective(readStringParam(args, "objective"));
17
- const cliQuery = normalizeParallelObjective(readStringParam(args, "query"));
18
- let searchQueries = normalizeParallelSearchQueries(readStringArrayParam(args, "search_queries"));
19
- if (searchQueries.length === 0 && cliQuery) searchQueries = normalizeParallelSearchQueries([cliQuery]);
20
- if (searchQueries.length === 0) return { error: invalidSearchQueriesPayload() };
21
- return {
22
- objective,
23
- searchQueries,
24
- count: resolveParallelSearchCount(args, configuredCount),
25
- sessionId: normalizeParallelSessionId(readStringParam(args, "session_id"), sessionIdMaxLength),
26
- clientModel: normalizeParallelClientModel(readStringParam(args, "client_model"))
27
- };
28
- }
29
- function resolveParallelSearchCount(args, configuredCount) {
30
- return resolveIntegerOption(readPositiveIntegerParam(args, "count", {
31
- max: PARALLEL_MAX_SEARCH_COUNT$1,
32
- message: `count must be an integer from 1 to ${PARALLEL_MAX_SEARCH_COUNT$1}.`
33
- }) ?? (typeof configuredCount === "number" ? configuredCount : DEFAULT_SEARCH_COUNT), DEFAULT_SEARCH_COUNT, {
34
- min: 1,
35
- max: PARALLEL_MAX_SEARCH_COUNT$1
36
- });
37
- }
38
- function normalizeParallelObjective(value) {
39
- const trimmed = normalizeOptionalString(value);
40
- if (!trimmed) return;
41
- return trimmed.length <= PARALLEL_MAX_OBJECTIVE_CHARS$1 ? trimmed : truncateUtf16Safe(trimmed, PARALLEL_MAX_OBJECTIVE_CHARS$1);
42
- }
43
- function normalizeParallelClientModel(value) {
44
- const trimmed = normalizeOptionalString(value);
45
- if (!trimmed) return;
46
- return trimmed.length <= PARALLEL_CLIENT_MODEL_MAX_LENGTH ? trimmed : truncateUtf16Safe(trimmed, PARALLEL_CLIENT_MODEL_MAX_LENGTH);
47
- }
48
- function normalizeParallelSearchQueries(value) {
49
- const candidates = Array.isArray(value) ? value : [];
50
- const seen = /* @__PURE__ */ new Set();
51
- const out = [];
52
- for (const entry of candidates) {
53
- if (typeof entry !== "string") continue;
54
- const trimmed = entry.trim();
55
- if (!trimmed) continue;
56
- const capped = trimmed.length <= PARALLEL_MAX_SEARCH_QUERY_CHARS$1 ? trimmed : truncateUtf16Safe(trimmed, PARALLEL_MAX_SEARCH_QUERY_CHARS$1);
57
- if (seen.has(capped)) continue;
58
- seen.add(capped);
59
- out.push(capped);
60
- if (out.length === PARALLEL_MAX_SEARCH_QUERIES$1) break;
61
- }
62
- return out;
63
- }
64
- function invalidSearchQueriesPayload() {
65
- return {
66
- error: "invalid_search_queries",
67
- message: "search_queries must be a non-empty array of keyword strings (max 5, max 200 chars each). See https://docs.parallel.ai/search/best-practices.",
68
- docs: "https://docs.openclaw.ai/tools/parallel-search"
69
- };
70
- }
71
- function normalizeParallelResults(payload) {
72
- if (!payload || typeof payload !== "object") return [];
73
- const results = payload.results;
74
- if (!Array.isArray(results)) return [];
75
- return results.filter((entry) => Boolean(entry && typeof entry === "object" && !Array.isArray(entry)));
76
- }
77
- /** Maps a Parallel v1 response into wrapped `web_search` result entries. */
78
- function mapParallelResults(response) {
79
- return normalizeParallelResults(response).map((entry) => {
80
- const title = typeof entry.title === "string" ? entry.title : "";
81
- const url = typeof entry.url === "string" ? entry.url : "";
82
- const published = typeof entry.publish_date === "string" && entry.publish_date ? entry.publish_date : void 0;
83
- const excerpts = Array.isArray(entry.excerpts) ? entry.excerpts.filter((e) => typeof e === "string").map((e) => wrapWebContent(e, "web_search")) : [];
84
- const description = excerpts.join("\n\n");
85
- return Object.assign({
86
- title: title ? wrapWebContent(title, "web_search") : "",
87
- url,
88
- description,
89
- siteName: resolveSiteName(url) || void 0
90
- }, published ? { published } : {}, excerpts.length > 0 ? { excerpts } : {});
91
- });
92
- }
93
- function buildParallelSearchPayload(params) {
94
- const results = mapParallelResults(params.response);
95
- const payload = {
96
- ...params.objective ? { objective: params.objective } : {},
97
- searchQueries: params.searchQueries,
98
- provider: params.provider,
99
- count: results.length,
100
- tookMs: Date.now() - params.start,
101
- externalContent: {
102
- untrusted: true,
103
- source: "web_search",
104
- provider: params.provider,
105
- wrapped: true
106
- },
107
- results
108
- };
109
- if (typeof params.response.search_id === "string") payload.searchId = params.response.search_id;
110
- if (typeof params.response.session_id === "string") payload.sessionId = params.response.session_id;
111
- if (Array.isArray(params.response.warnings) && params.response.warnings.length > 0) payload.warnings = params.response.warnings;
112
- if (Array.isArray(params.response.usage) && params.response.usage.length > 0) payload.usage = params.response.usage;
113
- return payload;
114
- }
115
- /**
116
- * Drops a Parallel-generated `sessionId` before caching. Identical queries from
117
- * unrelated tasks would otherwise share that id; caller-supplied session ids are
118
- * part of the cache key, so a cache hit only ever returns the matching id.
119
- */
120
- function stripParallelGeneratedSessionId(payload) {
121
- if (!("sessionId" in payload)) return payload;
122
- const { sessionId: _omitted, ...rest } = payload;
123
- return rest;
124
- }
125
- function buildParallelCacheKey(params) {
126
- return buildSearchCacheKey([
127
- "parallel",
128
- params.endpoint,
129
- params.objective,
130
- params.searchQueries.join("\0"),
131
- params.count,
132
- params.sessionId,
133
- params.clientModel
134
- ]);
135
- }
136
- //#endregion
137
- //#region extensions/parallel/src/parallel-web-search-provider.ts
138
- const PARALLEL_MAX_SEARCH_COUNT = 40;
139
- const PARALLEL_MAX_SEARCH_QUERIES = 5;
140
- const PARALLEL_MAX_SEARCH_QUERY_CHARS = 200;
141
- const PARALLEL_MAX_OBJECTIVE_CHARS = 5e3;
142
- const PARALLEL_MAX_SESSION_ID_CHARS = 1e3;
143
- const PARALLEL_MAX_CLIENT_MODEL_CHARS = 100;
144
- const loadParallelWebSearchRuntime = createLazyRuntimeModule(() => import("./parallel-web-search-provider.runtime-BnnoIEAW.js"));
145
- const ParallelSearchSchema = {
146
- type: "object",
147
- properties: {
148
- objective: {
149
- type: "string",
150
- description: "Natural-language description of the underlying question or goal driving the search. Should be self-contained with enough context to understand the intent. Used together with search_queries to focus results on the most relevant content.",
151
- maxLength: PARALLEL_MAX_OBJECTIVE_CHARS
152
- },
153
- search_queries: {
154
- type: "array",
155
- description: "Concise keyword search queries, 3-6 words each. Provide 2-3 diverse queries for best results (max 5). Vary entity names, synonyms, and angles. Each query is a keyword phrase, not a sentence; do not use site: operators.",
156
- items: {
157
- type: "string",
158
- maxLength: PARALLEL_MAX_SEARCH_QUERY_CHARS
159
- },
160
- minItems: 1,
161
- maxItems: PARALLEL_MAX_SEARCH_QUERIES
162
- },
163
- count: {
164
- type: "integer",
165
- description: "Number of results to return (1-40).",
166
- minimum: 1,
167
- maximum: PARALLEL_MAX_SEARCH_COUNT
168
- },
169
- session_id: {
170
- type: "string",
171
- description: "Optional session id returned by an earlier Parallel search. Pass it on follow-up searches that are part of the same task to keep Parallel's server-side context grouped (look for `sessionId` in the prior tool result).",
172
- maxLength: PARALLEL_MAX_SESSION_ID_CHARS
173
- },
174
- client_model: {
175
- type: "string",
176
- description: "The identifier of the LLM model making this tool call (e.g. 'claude-opus-4-7', 'gpt-5.6-sol', 'gemini-3.1-pro'). Pass the exact active model slug verbatim; never shorten or substitute a family alias like 'gpt-5'. Lets Parallel tailor default settings for your model's capabilities.",
177
- maxLength: PARALLEL_MAX_CLIENT_MODEL_CHARS
178
- }
179
- },
180
- required: ["objective", "search_queries"],
181
- additionalProperties: false
182
- };
183
- function createParallelWebSearchProvider() {
184
- return {
185
- ...createParallelWebSearchProviderBase(),
186
- createTool: (ctx) => ({
187
- 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.",
188
- parameters: ParallelSearchSchema,
189
- execute: async (args, context) => {
190
- context?.signal?.throwIfAborted();
191
- const { executeParallelWebSearchProviderTool } = await loadParallelWebSearchRuntime();
192
- return await executeParallelWebSearchProviderTool(ctx, args, context?.signal);
193
- }
194
- })
195
- };
196
- }
197
- //#endregion
198
- //#region extensions/parallel/src/parallel-free-web-search-provider.ts
199
- const ParallelFreeSearchSchema = {
200
- ...ParallelSearchSchema,
201
- properties: {
202
- ...ParallelSearchSchema.properties,
203
- session_id: {
204
- ...ParallelSearchSchema.properties.session_id,
205
- maxLength: 100
206
- }
207
- }
208
- };
209
- const loadParallelFreeWebSearchRuntime = createLazyRuntimeModule(() => import("./parallel-free-web-search-provider.runtime-D2iDFRDB.js"));
210
- function createParallelFreeWebSearchProvider() {
211
- return {
212
- ...createParallelFreeWebSearchProviderBase(),
213
- createTool: (ctx) => ({
214
- description: "Search the web using Parallel's free Search MCP (no API key). 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.",
215
- parameters: ParallelFreeSearchSchema,
216
- execute: async (args, context) => {
217
- const { executeParallelFreeWebSearchProviderTool } = await loadParallelFreeWebSearchRuntime();
218
- return await executeParallelFreeWebSearchProviderTool(ctx, args, context?.signal);
219
- }
220
- })
221
- };
222
- }
223
- //#endregion
224
- export { buildParallelSearchPayload as a, normalizeParallelResults as c, normalizeParallelSessionId as d, resolveParallelSearchCount as f, buildParallelCacheKey as i, normalizeParallelSearchQueries as l, createParallelWebSearchProvider as n, normalizeParallelClientModel as o, stripParallelGeneratedSessionId as p, PARALLEL_SESSION_ID_MAX_LENGTH as r, normalizeParallelObjective as s, createParallelFreeWebSearchProvider as t, normalizeParallelSearchRequest as u };
@@ -1,55 +0,0 @@
1
- import { createWebSearchProviderContractFields } from "openclaw/plugin-sdk/provider-web-search-contract";
2
- //#region extensions/parallel/src/parallel-free-web-search-provider.shared.ts
3
- const PARALLEL_FREE_ONBOARDING_SCOPES = ["text-inference"];
4
- function createParallelFreeWebSearchProviderBase() {
5
- return {
6
- id: "parallel-free",
7
- label: "Parallel Search (Free)",
8
- hint: "Free web search via Parallel's hosted Search MCP — no API key required",
9
- onboardingScopes: [...PARALLEL_FREE_ONBOARDING_SCOPES],
10
- requiresCredential: false,
11
- envVars: [],
12
- placeholder: "(no key needed)",
13
- signupUrl: "https://parallel.ai",
14
- docsUrl: "https://docs.openclaw.ai/tools/parallel-search",
15
- credentialPath: "",
16
- ...createWebSearchProviderContractFields({
17
- credentialPath: "",
18
- searchCredential: {
19
- type: "scoped",
20
- scopeId: "parallel-free"
21
- },
22
- selectionPluginId: "parallel"
23
- })
24
- };
25
- }
26
- //#endregion
27
- //#region extensions/parallel/src/parallel-web-search-provider.shared.ts
28
- const PARALLEL_CREDENTIAL_PATH = "plugins.entries.parallel.config.webSearch.apiKey";
29
- const PARALLEL_ONBOARDING_SCOPES = ["text-inference"];
30
- function createParallelWebSearchProviderBase() {
31
- return {
32
- id: "parallel",
33
- label: "Parallel Search",
34
- hint: "LLM-optimized dense excerpts from web sources",
35
- onboardingScopes: [...PARALLEL_ONBOARDING_SCOPES],
36
- credentialLabel: "Parallel API key",
37
- envVars: ["PARALLEL_API_KEY"],
38
- placeholder: "par-...",
39
- signupUrl: "https://platform.parallel.ai",
40
- docsUrl: "https://docs.openclaw.ai/tools/parallel-search",
41
- autoDetectOrder: 75,
42
- credentialPath: PARALLEL_CREDENTIAL_PATH,
43
- ...createWebSearchProviderContractFields({
44
- credentialPath: PARALLEL_CREDENTIAL_PATH,
45
- searchCredential: {
46
- type: "scoped",
47
- scopeId: "parallel"
48
- },
49
- configuredCredential: { pluginId: "parallel" },
50
- selectionPluginId: "parallel"
51
- })
52
- };
53
- }
54
- //#endregion
55
- export { createParallelFreeWebSearchProviderBase as n, createParallelWebSearchProviderBase as t };