@openclaw/parallel-plugin 2026.9.5 → 2026.9.6

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.
@@ -7,6 +7,7 @@ function createParallelFreeWebSearchProviderBase() {
7
7
  id: "parallel-free",
8
8
  label: "Parallel Search (Free)",
9
9
  hint: "Free web search via Parallel's hosted Search MCP — no API key required",
10
+ configPath: null,
10
11
  onboardingScopes: [...PARALLEL_FREE_ONBOARDING_SCOPES],
11
12
  requiresCredential: false,
12
13
  envVars: [],
@@ -60,7 +61,7 @@ const PARALLEL_MAX_SEARCH_QUERY_CHARS = 200;
60
61
  const PARALLEL_MAX_OBJECTIVE_CHARS = 5e3;
61
62
  const PARALLEL_MAX_SESSION_ID_CHARS = 1e3;
62
63
  const PARALLEL_MAX_CLIENT_MODEL_CHARS = 100;
63
- const loadParallelWebSearchRuntime = createLazyRuntimeModule(() => import("./parallel-web-search-provider.runtime-YULWvnO9.mjs"));
64
+ const loadParallelWebSearchRuntime = createLazyRuntimeModule(() => import("./parallel-web-search-provider.runtime-D3trDaRb.mjs"));
64
65
  const ParallelSearchSchema = {
65
66
  type: "object",
66
67
  properties: {
@@ -125,7 +126,7 @@ const ParallelFreeSearchSchema = {
125
126
  }
126
127
  }
127
128
  };
128
- const loadParallelFreeWebSearchRuntime = createLazyRuntimeModule(() => import("./parallel-free-web-search-provider.runtime-CoicsZIw.mjs"));
129
+ const loadParallelFreeWebSearchRuntime = createLazyRuntimeModule(() => import("./parallel-free-web-search-provider.runtime-OAvvtssG.mjs"));
129
130
  function createParallelFreeWebSearchProvider() {
130
131
  return {
131
132
  ...createParallelFreeWebSearchProviderBase(),
@@ -1,9 +1,9 @@
1
- import { t as executeParallelSearchRequest } from "./parallel-search-normalize-BTXsGUqi.mjs";
1
+ import { t as executeParallelSearchRequest } from "./parallel-search-normalize-Jruxwvw_.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";
5
5
  import { readPluginPackageVersion } from "openclaw/plugin-sdk/extension-shared";
6
- import { readProviderTextResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
6
+ import { ProviderHttpError, readProviderTextResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
7
7
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
8
8
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
9
9
  //#region extensions/parallel/src/parallel-mcp-search.runtime.ts
@@ -25,61 +25,45 @@ function mcpHeaders(params) {
25
25
  return headers;
26
26
  }
27
27
  /**
28
- * Yield JSON-RPC message objects from a plain-JSON or SSE response body.
29
- *
30
- * Handles `application/json` (a single object) and `text/event-stream` (SSE:
31
- * events separated by blank lines; an event's one-or-more `data:` lines
32
- * concatenate into a single JSON payload). Streamable HTTP also allows batching
33
- * responses into a JSON array, so arrays are flattened. Unparseable chunks and
34
- * non-`data` SSE fields (`event:`/`id:`/comments) are skipped.
28
+ * Select the first result/error matching requestId from a fully read JSON or SSE body,
29
+ * falling back to the last result/error when no id matches. JSON batches are flattened
30
+ * one level; multiline SSE data fields are joined and malformed events are skipped.
35
31
  */
36
- function iterMcpMessages(text) {
37
- const out = [];
38
- const emit = (payload) => {
39
- if (Array.isArray(payload)) {
40
- for (const entry of payload) if (isRecord(entry)) out.push(entry);
41
- } else if (isRecord(payload)) out.push(payload);
32
+ function selectMcpEnvelope(text, requestId) {
33
+ let envelope = {};
34
+ const selectMessage = (message) => {
35
+ if (!isRecord(message) || !("result" in message || "error" in message)) return false;
36
+ envelope = message;
37
+ return message.id === requestId;
38
+ };
39
+ const selectPayload = (json) => {
40
+ try {
41
+ const payload = JSON.parse(json);
42
+ return Array.isArray(payload) ? payload.some(selectMessage) : selectMessage(payload);
43
+ } catch {
44
+ return false;
45
+ }
42
46
  };
43
47
  const body = (text ?? "").trim();
44
- if (!body) return out;
48
+ if (!body) return envelope;
45
49
  if (body.startsWith("{") || body.startsWith("[")) {
46
- try {
47
- emit(JSON.parse(body));
48
- } catch {}
49
- return out;
50
+ selectPayload(body);
51
+ return envelope;
50
52
  }
51
53
  let dataLines = [];
52
54
  const flush = () => {
53
- if (dataLines.length === 0) return;
54
- try {
55
- emit(JSON.parse(dataLines.join("\n")));
56
- } catch {}
55
+ if (dataLines.length === 0) return false;
56
+ const matched = selectPayload(dataLines.join("\n"));
57
57
  dataLines = [];
58
+ return matched;
58
59
  };
59
60
  for (const raw of body.split("\n")) {
60
61
  const line = raw.replace(/\r$/, "");
61
62
  if (line.startsWith("data:")) dataLines.push(line.slice(5).replace(/^ /, ""));
62
- else if (line.trim() === "") flush();
63
+ else if (line.trim() === "" && flush()) return envelope;
63
64
  }
64
65
  flush();
65
- return out;
66
- }
67
- /**
68
- * Select the JSON-RPC response for `requestId` from an MCP response body.
69
- *
70
- * Streamable-HTTP servers may emit progress/log notifications before the final
71
- * result, so scan the whole stream and return the result/error message whose
72
- * `id` matches. Falls back to the last result/error-bearing message if no id
73
- * matches; `{}` if none is present.
74
- */
75
- function selectMcpEnvelope(text, requestId) {
76
- let fallback = {};
77
- for (const msg of iterMcpMessages(text)) {
78
- if (!("result" in msg || "error" in msg)) continue;
79
- if (msg.id === requestId) return msg;
80
- fallback = msg;
81
- }
82
- return fallback;
66
+ return envelope;
83
67
  }
84
68
  /**
85
69
  * Extract the tool result payload from a `tools/call` envelope.
@@ -146,7 +130,7 @@ async function mcpCall(toolName, args, timeoutSeconds, signal) {
146
130
  }
147
131
  }
148
132
  });
149
- if (!init.ok) throw new Error(`Parallel MCP initialize failed (${init.status}): ${init.text || init.statusText}`);
133
+ if (!init.ok) throw new ProviderHttpError(`Parallel MCP initialize failed (${init.status}): ${init.text || init.statusText}`, { status: init.status });
150
134
  const sessionId = init.sessionIdHeader ?? void 0;
151
135
  const initEnvelope = selectMcpEnvelope(init.text, initId);
152
136
  const negotiatedVersion = (isRecord(initEnvelope.result) && typeof initEnvelope.result.protocolVersion === "string" ? initEnvelope.result.protocolVersion : void 0) ?? MCP_PROTOCOL_VERSION;
@@ -160,7 +144,7 @@ async function mcpCall(toolName, args, timeoutSeconds, signal) {
160
144
  timeoutSeconds,
161
145
  signal
162
146
  });
163
- if (!initialized.ok) throw new Error(`Parallel MCP notifications/initialized failed (${initialized.status}): ${initialized.text || initialized.statusText}`);
147
+ if (!initialized.ok) throw new ProviderHttpError(`Parallel MCP notifications/initialized failed (${initialized.status}): ${initialized.text || initialized.statusText}`, { status: initialized.status });
164
148
  const callId = randomUUID();
165
149
  const call = await postMcp({
166
150
  body: {
@@ -177,7 +161,7 @@ async function mcpCall(toolName, args, timeoutSeconds, signal) {
177
161
  timeoutSeconds,
178
162
  signal
179
163
  });
180
- if (!call.ok) throw new Error(`Parallel MCP tools/call failed (${call.status}): ${call.text || call.statusText}`);
164
+ if (!call.ok) throw new ProviderHttpError(`Parallel MCP tools/call failed (${call.status}): ${call.text || call.statusText}`, { status: call.status });
181
165
  return extractMcpToolPayload(selectMcpEnvelope(call.text, callId));
182
166
  }
183
167
  function normalizeMcpSessionId(value) {
@@ -1,4 +1,4 @@
1
- import "./parallel-free-web-search-provider-ucr6eh9O.mjs";
1
+ import "./parallel-free-web-search-provider-cXSsdp4Y.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
3
  import { normalizeBoundedOptionalString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
@@ -41,6 +41,7 @@ async function executeParallelSearchRequest(params) {
41
41
  provider: params.provider,
42
42
  objective: request.objective,
43
43
  searchQueries: request.searchQueries,
44
+ count: request.count,
44
45
  response,
45
46
  start
46
47
  });
@@ -98,8 +99,8 @@ function normalizeParallelResults(payload) {
98
99
  return results.filter((entry) => Boolean(entry && typeof entry === "object" && !Array.isArray(entry)));
99
100
  }
100
101
  /** Maps a Parallel v1 response into wrapped `web_search` result entries. */
101
- function mapParallelResults(response) {
102
- return normalizeParallelResults(response).map((entry) => {
102
+ function mapParallelResults(response, count) {
103
+ return normalizeParallelResults(response).slice(0, count).map((entry) => {
103
104
  const title = typeof entry.title === "string" ? entry.title : "";
104
105
  const url = typeof entry.url === "string" ? entry.url : "";
105
106
  const published = typeof entry.publish_date === "string" && entry.publish_date ? entry.publish_date : void 0;
@@ -114,7 +115,7 @@ function mapParallelResults(response) {
114
115
  });
115
116
  }
116
117
  function buildParallelSearchPayload(params) {
117
- const results = mapParallelResults(params.response);
118
+ const results = mapParallelResults(params.response, params.count);
118
119
  const payload = {
119
120
  ...params.objective ? { objective: params.objective } : {},
120
121
  searchQueries: params.searchQueries,
@@ -1,8 +1,8 @@
1
- import { t as executeParallelSearchRequest } from "./parallel-search-normalize-BTXsGUqi.mjs";
1
+ import { t as executeParallelSearchRequest } from "./parallel-search-normalize-Jruxwvw_.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";
5
- import { readProviderJsonResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
5
+ import { ProviderHttpError, readProviderJsonResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
6
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";
@@ -76,7 +76,8 @@ async function runParallelSearch(params) {
76
76
  }, async (res) => {
77
77
  if (!res.ok) {
78
78
  const detail = await readResponseTextLimited(res, PARALLEL_ERROR_BODY_LIMIT_BYTES).catch(() => "");
79
- throw new Error(`Parallel API error (${res.status}): ${redactToolPayloadText(redactSensitiveText(detail || res.statusText, { mode: "tools" }))}`);
79
+ params.signal?.throwIfAborted();
80
+ throw new ProviderHttpError(`Parallel API error (${res.status}): ${redactToolPayloadText(redactSensitiveText(detail || res.statusText, { mode: "tools" }))}`, { status: res.status });
80
81
  }
81
82
  return await readProviderJsonResponse(res, "Parallel API", { maxBytes: PARALLEL_SEARCH_RESPONSE_LIMIT_BYTES });
82
83
  });
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./.setup/parallel-free-web-search-provider-ucr6eh9O.mjs";
1
+ import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./.setup/parallel-free-web-search-provider-cXSsdp4Y.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-ucr6eh9O.mjs";
1
+ import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./.setup/parallel-free-web-search-provider-cXSsdp4Y.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-ucr6eh9O.mjs";
1
+ import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./.setup/parallel-free-web-search-provider-cXSsdp4Y.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.9.5",
3
+ "version": "2026.9.6",
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.9.5"
21
+ "pluginApi": ">=2026.9.6"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.9.5",
24
+ "openclawVersion": "2026.9.6",
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.9.5"
43
+ "openclaw": ">=2026.9.6"
44
44
  },
45
45
  "peerDependenciesMeta": {
46
46
  "openclaw": {