@openclaw/parallel-plugin 2026.9.1-beta.1 → 2026.9.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/index.js +1 -1
- package/dist/parallel-free-web-search-provider-ww-zXurF.js +143 -0
- package/dist/{parallel-free-web-search-provider.runtime-C5mKRTmw.js → parallel-free-web-search-provider.runtime-CFLo2H5U.js} +8 -6
- package/dist/parallel-search-normalize-C4hP4wYF.js +160 -0
- package/dist/{parallel-web-search-provider.runtime-BIJCSTMR.js → parallel-web-search-provider.runtime-CW-ipGm0.js} +7 -20
- package/dist/web-search-contract-api.js +1 -1
- package/dist/web-search-provider.js +1 -1
- package/package.json +4 -4
- package/dist/parallel-free-web-search-provider-CozR2kS8.js +0 -299
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./parallel-free-web-search-provider-
|
|
1
|
+
import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./parallel-free-web-search-provider-ww-zXurF.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-CW-ipGm0.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-CFLo2H5U.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 {
|
|
1
|
+
import { t as executeParallelSearchRequest } from "./parallel-search-normalize-C4hP4wYF.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { mergeScopedSearchConfig, resolveProviderWebSearchPluginConfig, withTrustedWebSearchEndpoint } 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";
|
|
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 =
|
|
14
|
-
const
|
|
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 = {
|
|
@@ -209,11 +210,12 @@ async function runParallelMcpSearch(params) {
|
|
|
209
210
|
//#region extensions/parallel/src/parallel-free-web-search-provider.runtime.ts
|
|
210
211
|
async function executeParallelFreeWebSearchProviderTool(ctx, args, signal) {
|
|
211
212
|
signal?.throwIfAborted();
|
|
213
|
+
const searchConfig = mergeScopedSearchConfig(ctx.searchConfig, "parallel-free", resolveProviderWebSearchPluginConfig(ctx.config, "parallel-free"));
|
|
212
214
|
return executeParallelSearchRequest({
|
|
213
215
|
provider: "parallel-free",
|
|
214
216
|
endpoint: PARALLEL_MCP_SEARCH_URL,
|
|
215
217
|
args,
|
|
216
|
-
searchConfig
|
|
218
|
+
searchConfig,
|
|
217
219
|
signal,
|
|
218
220
|
search: ({ count, clientModel, ...request }, timeoutSeconds) => runParallelMcpSearch({
|
|
219
221
|
...request,
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import "./parallel-free-web-search-provider-ww-zXurF.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 { executeParallelSearchRequest as t };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as executeParallelSearchRequest } from "./parallel-search-normalize-C4hP4wYF.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { mergeScopedSearchConfig, readConfiguredSecretString, readProviderEnvValue, resolveProviderWebSearchPluginConfig, withTrustedWebSearchEndpoint } from "openclaw/plugin-sdk/provider-web-search";
|
|
4
|
-
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
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 =
|
|
13
|
-
const PARALLEL_SEARCH_RESPONSE_LIMIT_BYTES =
|
|
14
|
-
const
|
|
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 : {};
|
|
@@ -104,19 +105,5 @@ async function executeParallelWebSearchProviderTool(ctx, args, signal) {
|
|
|
104
105
|
})
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
|
-
const testing = {
|
|
108
|
-
buildParallelCacheKey,
|
|
109
|
-
missingParallelKeyPayload,
|
|
110
|
-
normalizeParallelClientModel,
|
|
111
|
-
normalizeParallelObjective,
|
|
112
|
-
normalizeParallelResults,
|
|
113
|
-
normalizeParallelSearchQueries,
|
|
114
|
-
normalizeParallelSessionId,
|
|
115
|
-
resolveParallelApiKey,
|
|
116
|
-
resolveParallelSearchCount,
|
|
117
|
-
resolveParallelSearchEndpoint,
|
|
118
|
-
PARALLEL_SEARCH_RESPONSE_LIMIT_BYTES,
|
|
119
|
-
USER_AGENT
|
|
120
|
-
};
|
|
121
108
|
//#endregion
|
|
122
|
-
export { executeParallelWebSearchProviderTool
|
|
109
|
+
export { executeParallelWebSearchProviderTool };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./parallel-free-web-search-provider-
|
|
1
|
+
import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./parallel-free-web-search-provider-ww-zXurF.js";
|
|
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 "./parallel-free-web-search-provider-
|
|
1
|
+
import { n as createParallelWebSearchProvider, t as createParallelFreeWebSearchProvider } from "./parallel-free-web-search-provider-ww-zXurF.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.9.1
|
|
3
|
+
"version": "2026.9.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.9.1
|
|
21
|
+
"pluginApi": ">=2026.9.1"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.9.1
|
|
24
|
+
"openclawVersion": "2026.9.1",
|
|
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.9.1
|
|
41
|
+
"openclaw": ">=2026.9.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"openclaw": {
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
2
|
-
import { createWebSearchProviderContractFields } from "openclaw/plugin-sdk/provider-web-search-contract";
|
|
3
|
-
import { resolveIntegerOption } from "openclaw/plugin-sdk/number-runtime";
|
|
4
|
-
import { DEFAULT_SEARCH_COUNT, buildSearchCacheKey, readCachedSearchPayload, readPositiveIntegerParam, readStringArrayParam, readStringParam, resolveSearchCacheTtlMs, resolveSearchTimeoutSeconds, resolveSiteName, wrapWebContent, writeCachedSearchPayload } 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-free-web-search-provider.shared.ts
|
|
8
|
-
const PARALLEL_FREE_ONBOARDING_SCOPES = ["text-inference"];
|
|
9
|
-
function createParallelFreeWebSearchProviderBase() {
|
|
10
|
-
return {
|
|
11
|
-
id: "parallel-free",
|
|
12
|
-
label: "Parallel Search (Free)",
|
|
13
|
-
hint: "Free web search via Parallel's hosted Search MCP — no API key required",
|
|
14
|
-
onboardingScopes: [...PARALLEL_FREE_ONBOARDING_SCOPES],
|
|
15
|
-
requiresCredential: false,
|
|
16
|
-
envVars: [],
|
|
17
|
-
placeholder: "(no key needed)",
|
|
18
|
-
signupUrl: "https://parallel.ai",
|
|
19
|
-
docsUrl: "https://docs.openclaw.ai/tools/parallel-search",
|
|
20
|
-
credentialPath: "",
|
|
21
|
-
...createWebSearchProviderContractFields({
|
|
22
|
-
credentialPath: "",
|
|
23
|
-
searchCredential: {
|
|
24
|
-
type: "scoped",
|
|
25
|
-
scopeId: "parallel-free"
|
|
26
|
-
},
|
|
27
|
-
selectionPluginId: "parallel"
|
|
28
|
-
})
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region extensions/parallel/src/parallel-search-normalize.ts
|
|
33
|
-
const PARALLEL_MAX_SEARCH_COUNT$1 = 40;
|
|
34
|
-
const PARALLEL_MAX_SEARCH_QUERY_CHARS$1 = 200;
|
|
35
|
-
const PARALLEL_MAX_OBJECTIVE_CHARS$1 = 5e3;
|
|
36
|
-
const PARALLEL_MAX_SEARCH_QUERIES$1 = 5;
|
|
37
|
-
const PARALLEL_SESSION_ID_MAX_LENGTH = 1e3;
|
|
38
|
-
const PARALLEL_CLIENT_MODEL_MAX_LENGTH = 100;
|
|
39
|
-
const normalizeParallelSessionId = normalizeBoundedOptionalString;
|
|
40
|
-
function normalizeParallelSearchRequest(args, configuredCount, sessionIdMaxLength) {
|
|
41
|
-
const objective = normalizeParallelObjective(readStringParam(args, "objective"));
|
|
42
|
-
const cliQuery = normalizeParallelObjective(readStringParam(args, "query"));
|
|
43
|
-
let searchQueries = normalizeParallelSearchQueries(readStringArrayParam(args, "search_queries"));
|
|
44
|
-
if (searchQueries.length === 0 && cliQuery) searchQueries = normalizeParallelSearchQueries([cliQuery]);
|
|
45
|
-
if (searchQueries.length === 0) return { error: invalidSearchQueriesPayload() };
|
|
46
|
-
return {
|
|
47
|
-
objective,
|
|
48
|
-
searchQueries,
|
|
49
|
-
count: resolveParallelSearchCount(args, configuredCount),
|
|
50
|
-
sessionId: normalizeParallelSessionId(readStringParam(args, "session_id"), sessionIdMaxLength),
|
|
51
|
-
clientModel: normalizeParallelClientModel(readStringParam(args, "client_model"))
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
async function executeParallelSearchRequest(params) {
|
|
55
|
-
const request = normalizeParallelSearchRequest(params.args, params.searchConfig?.maxResults, params.provider === "parallel" ? PARALLEL_SESSION_ID_MAX_LENGTH : 100);
|
|
56
|
-
if ("error" in request) return request.error;
|
|
57
|
-
const cacheKey = buildParallelCacheKey({
|
|
58
|
-
endpoint: params.endpoint,
|
|
59
|
-
...request
|
|
60
|
-
});
|
|
61
|
-
const cached = readCachedSearchPayload(cacheKey);
|
|
62
|
-
if (cached) return cached;
|
|
63
|
-
const start = Date.now();
|
|
64
|
-
const response = await params.search(request, resolveSearchTimeoutSeconds(params.searchConfig));
|
|
65
|
-
params.signal?.throwIfAborted();
|
|
66
|
-
const payload = buildParallelSearchPayload({
|
|
67
|
-
provider: params.provider,
|
|
68
|
-
objective: request.objective,
|
|
69
|
-
searchQueries: request.searchQueries,
|
|
70
|
-
response,
|
|
71
|
-
start
|
|
72
|
-
});
|
|
73
|
-
writeCachedSearchPayload(cacheKey, request.sessionId ? payload : stripParallelGeneratedSessionId(payload), resolveSearchCacheTtlMs(params.searchConfig));
|
|
74
|
-
return payload;
|
|
75
|
-
}
|
|
76
|
-
function resolveParallelSearchCount(args, configuredCount) {
|
|
77
|
-
return resolveIntegerOption(readPositiveIntegerParam(args, "count", {
|
|
78
|
-
max: PARALLEL_MAX_SEARCH_COUNT$1,
|
|
79
|
-
message: `count must be an integer from 1 to ${PARALLEL_MAX_SEARCH_COUNT$1}.`
|
|
80
|
-
}) ?? (typeof configuredCount === "number" ? configuredCount : DEFAULT_SEARCH_COUNT), DEFAULT_SEARCH_COUNT, {
|
|
81
|
-
min: 1,
|
|
82
|
-
max: PARALLEL_MAX_SEARCH_COUNT$1
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function normalizeParallelObjective(value) {
|
|
86
|
-
const trimmed = normalizeOptionalString(value);
|
|
87
|
-
if (!trimmed) return;
|
|
88
|
-
return trimmed.length <= PARALLEL_MAX_OBJECTIVE_CHARS$1 ? trimmed : truncateUtf16Safe(trimmed, PARALLEL_MAX_OBJECTIVE_CHARS$1);
|
|
89
|
-
}
|
|
90
|
-
function normalizeParallelClientModel(value) {
|
|
91
|
-
const trimmed = normalizeOptionalString(value);
|
|
92
|
-
if (!trimmed) return;
|
|
93
|
-
return trimmed.length <= PARALLEL_CLIENT_MODEL_MAX_LENGTH ? trimmed : truncateUtf16Safe(trimmed, PARALLEL_CLIENT_MODEL_MAX_LENGTH);
|
|
94
|
-
}
|
|
95
|
-
function normalizeParallelSearchQueries(value) {
|
|
96
|
-
const candidates = Array.isArray(value) ? value : [];
|
|
97
|
-
const seen = /* @__PURE__ */ new Set();
|
|
98
|
-
const out = [];
|
|
99
|
-
for (const entry of candidates) {
|
|
100
|
-
if (typeof entry !== "string") continue;
|
|
101
|
-
const trimmed = entry.trim();
|
|
102
|
-
if (!trimmed) continue;
|
|
103
|
-
const capped = trimmed.length <= PARALLEL_MAX_SEARCH_QUERY_CHARS$1 ? trimmed : truncateUtf16Safe(trimmed, PARALLEL_MAX_SEARCH_QUERY_CHARS$1);
|
|
104
|
-
if (seen.has(capped)) continue;
|
|
105
|
-
seen.add(capped);
|
|
106
|
-
out.push(capped);
|
|
107
|
-
if (out.length === PARALLEL_MAX_SEARCH_QUERIES$1) break;
|
|
108
|
-
}
|
|
109
|
-
return out;
|
|
110
|
-
}
|
|
111
|
-
function invalidSearchQueriesPayload() {
|
|
112
|
-
return {
|
|
113
|
-
error: "invalid_search_queries",
|
|
114
|
-
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.",
|
|
115
|
-
docs: "https://docs.openclaw.ai/tools/parallel-search"
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
function normalizeParallelResults(payload) {
|
|
119
|
-
if (!payload || typeof payload !== "object") return [];
|
|
120
|
-
const results = payload.results;
|
|
121
|
-
if (!Array.isArray(results)) return [];
|
|
122
|
-
return results.filter((entry) => Boolean(entry && typeof entry === "object" && !Array.isArray(entry)));
|
|
123
|
-
}
|
|
124
|
-
/** Maps a Parallel v1 response into wrapped `web_search` result entries. */
|
|
125
|
-
function mapParallelResults(response) {
|
|
126
|
-
return normalizeParallelResults(response).map((entry) => {
|
|
127
|
-
const title = typeof entry.title === "string" ? entry.title : "";
|
|
128
|
-
const url = typeof entry.url === "string" ? entry.url : "";
|
|
129
|
-
const published = typeof entry.publish_date === "string" && entry.publish_date ? entry.publish_date : void 0;
|
|
130
|
-
const excerpts = Array.isArray(entry.excerpts) ? entry.excerpts.filter((e) => typeof e === "string").map((e) => wrapWebContent(e, "web_search")) : [];
|
|
131
|
-
const description = excerpts.join("\n\n");
|
|
132
|
-
return Object.assign({
|
|
133
|
-
title: title ? wrapWebContent(title, "web_search") : "",
|
|
134
|
-
url,
|
|
135
|
-
description,
|
|
136
|
-
siteName: resolveSiteName(url) || void 0
|
|
137
|
-
}, published ? { published } : {}, excerpts.length > 0 ? { excerpts } : {});
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
function buildParallelSearchPayload(params) {
|
|
141
|
-
const results = mapParallelResults(params.response);
|
|
142
|
-
const payload = {
|
|
143
|
-
...params.objective ? { objective: params.objective } : {},
|
|
144
|
-
searchQueries: params.searchQueries,
|
|
145
|
-
provider: params.provider,
|
|
146
|
-
count: results.length,
|
|
147
|
-
tookMs: Date.now() - params.start,
|
|
148
|
-
externalContent: {
|
|
149
|
-
untrusted: true,
|
|
150
|
-
source: "web_search",
|
|
151
|
-
provider: params.provider,
|
|
152
|
-
wrapped: true
|
|
153
|
-
},
|
|
154
|
-
results
|
|
155
|
-
};
|
|
156
|
-
if (typeof params.response.search_id === "string") payload.searchId = params.response.search_id;
|
|
157
|
-
if (typeof params.response.session_id === "string") payload.sessionId = params.response.session_id;
|
|
158
|
-
if (Array.isArray(params.response.warnings) && params.response.warnings.length > 0) payload.warnings = params.response.warnings;
|
|
159
|
-
if (Array.isArray(params.response.usage) && params.response.usage.length > 0) payload.usage = params.response.usage;
|
|
160
|
-
return payload;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Drops a Parallel-generated `sessionId` before caching. Identical queries from
|
|
164
|
-
* unrelated tasks would otherwise share that id; caller-supplied session ids are
|
|
165
|
-
* part of the cache key, so a cache hit only ever returns the matching id.
|
|
166
|
-
*/
|
|
167
|
-
function stripParallelGeneratedSessionId(payload) {
|
|
168
|
-
if (!("sessionId" in payload)) return payload;
|
|
169
|
-
const { sessionId: _omitted, ...rest } = payload;
|
|
170
|
-
return rest;
|
|
171
|
-
}
|
|
172
|
-
function buildParallelCacheKey(params) {
|
|
173
|
-
return buildSearchCacheKey([
|
|
174
|
-
"parallel",
|
|
175
|
-
params.endpoint,
|
|
176
|
-
params.objective,
|
|
177
|
-
params.searchQueries.join("\0"),
|
|
178
|
-
params.count,
|
|
179
|
-
params.sessionId,
|
|
180
|
-
params.clientModel
|
|
181
|
-
]);
|
|
182
|
-
}
|
|
183
|
-
//#endregion
|
|
184
|
-
//#region extensions/parallel/src/parallel-web-search-provider.shared.ts
|
|
185
|
-
const PARALLEL_CREDENTIAL_PATH = "plugins.entries.parallel.config.webSearch.apiKey";
|
|
186
|
-
const PARALLEL_ONBOARDING_SCOPES = ["text-inference"];
|
|
187
|
-
function createParallelWebSearchProviderBase() {
|
|
188
|
-
return {
|
|
189
|
-
id: "parallel",
|
|
190
|
-
label: "Parallel Search",
|
|
191
|
-
hint: "LLM-optimized dense excerpts from web sources",
|
|
192
|
-
onboardingScopes: [...PARALLEL_ONBOARDING_SCOPES],
|
|
193
|
-
credentialLabel: "Parallel API key",
|
|
194
|
-
envVars: ["PARALLEL_API_KEY"],
|
|
195
|
-
placeholder: "par-...",
|
|
196
|
-
signupUrl: "https://platform.parallel.ai",
|
|
197
|
-
docsUrl: "https://docs.openclaw.ai/tools/parallel-search",
|
|
198
|
-
autoDetectOrder: 75,
|
|
199
|
-
credentialPath: PARALLEL_CREDENTIAL_PATH,
|
|
200
|
-
...createWebSearchProviderContractFields({
|
|
201
|
-
credentialPath: PARALLEL_CREDENTIAL_PATH,
|
|
202
|
-
searchCredential: {
|
|
203
|
-
type: "scoped",
|
|
204
|
-
scopeId: "parallel"
|
|
205
|
-
},
|
|
206
|
-
configuredCredential: { pluginId: "parallel" },
|
|
207
|
-
selectionPluginId: "parallel"
|
|
208
|
-
})
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
//#endregion
|
|
212
|
-
//#region extensions/parallel/src/parallel-web-search-provider.ts
|
|
213
|
-
const PARALLEL_MAX_SEARCH_COUNT = 40;
|
|
214
|
-
const PARALLEL_MAX_SEARCH_QUERIES = 5;
|
|
215
|
-
const PARALLEL_MAX_SEARCH_QUERY_CHARS = 200;
|
|
216
|
-
const PARALLEL_MAX_OBJECTIVE_CHARS = 5e3;
|
|
217
|
-
const PARALLEL_MAX_SESSION_ID_CHARS = 1e3;
|
|
218
|
-
const PARALLEL_MAX_CLIENT_MODEL_CHARS = 100;
|
|
219
|
-
const loadParallelWebSearchRuntime = createLazyRuntimeModule(() => import("./parallel-web-search-provider.runtime-BIJCSTMR.js"));
|
|
220
|
-
const ParallelSearchSchema = {
|
|
221
|
-
type: "object",
|
|
222
|
-
properties: {
|
|
223
|
-
objective: {
|
|
224
|
-
type: "string",
|
|
225
|
-
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.",
|
|
226
|
-
maxLength: PARALLEL_MAX_OBJECTIVE_CHARS
|
|
227
|
-
},
|
|
228
|
-
search_queries: {
|
|
229
|
-
type: "array",
|
|
230
|
-
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.",
|
|
231
|
-
items: {
|
|
232
|
-
type: "string",
|
|
233
|
-
maxLength: PARALLEL_MAX_SEARCH_QUERY_CHARS
|
|
234
|
-
},
|
|
235
|
-
minItems: 1,
|
|
236
|
-
maxItems: PARALLEL_MAX_SEARCH_QUERIES
|
|
237
|
-
},
|
|
238
|
-
count: {
|
|
239
|
-
type: "integer",
|
|
240
|
-
description: "Number of results to return (1-40).",
|
|
241
|
-
minimum: 1,
|
|
242
|
-
maximum: PARALLEL_MAX_SEARCH_COUNT
|
|
243
|
-
},
|
|
244
|
-
session_id: {
|
|
245
|
-
type: "string",
|
|
246
|
-
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).",
|
|
247
|
-
maxLength: PARALLEL_MAX_SESSION_ID_CHARS
|
|
248
|
-
},
|
|
249
|
-
client_model: {
|
|
250
|
-
type: "string",
|
|
251
|
-
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.",
|
|
252
|
-
maxLength: PARALLEL_MAX_CLIENT_MODEL_CHARS
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
required: ["objective", "search_queries"],
|
|
256
|
-
additionalProperties: false
|
|
257
|
-
};
|
|
258
|
-
function createParallelWebSearchProvider() {
|
|
259
|
-
return {
|
|
260
|
-
...createParallelWebSearchProviderBase(),
|
|
261
|
-
createTool: (ctx) => ({
|
|
262
|
-
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.",
|
|
263
|
-
parameters: ParallelSearchSchema,
|
|
264
|
-
execute: async (args, context) => {
|
|
265
|
-
context?.signal?.throwIfAborted();
|
|
266
|
-
const { executeParallelWebSearchProviderTool } = await loadParallelWebSearchRuntime();
|
|
267
|
-
return await executeParallelWebSearchProviderTool(ctx, args, context?.signal);
|
|
268
|
-
}
|
|
269
|
-
})
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
//#endregion
|
|
273
|
-
//#region extensions/parallel/src/parallel-free-web-search-provider.ts
|
|
274
|
-
const ParallelFreeSearchSchema = {
|
|
275
|
-
...ParallelSearchSchema,
|
|
276
|
-
properties: {
|
|
277
|
-
...ParallelSearchSchema.properties,
|
|
278
|
-
session_id: {
|
|
279
|
-
...ParallelSearchSchema.properties.session_id,
|
|
280
|
-
maxLength: 100
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
const loadParallelFreeWebSearchRuntime = createLazyRuntimeModule(() => import("./parallel-free-web-search-provider.runtime-C5mKRTmw.js"));
|
|
285
|
-
function createParallelFreeWebSearchProvider() {
|
|
286
|
-
return {
|
|
287
|
-
...createParallelFreeWebSearchProviderBase(),
|
|
288
|
-
createTool: (ctx) => ({
|
|
289
|
-
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.",
|
|
290
|
-
parameters: ParallelFreeSearchSchema,
|
|
291
|
-
execute: async (args, context) => {
|
|
292
|
-
const { executeParallelFreeWebSearchProviderTool } = await loadParallelFreeWebSearchRuntime();
|
|
293
|
-
return await executeParallelFreeWebSearchProviderTool(ctx, args, context?.signal);
|
|
294
|
-
}
|
|
295
|
-
})
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
//#endregion
|
|
299
|
-
export { normalizeParallelClientModel as a, normalizeParallelSearchQueries as c, executeParallelSearchRequest as i, normalizeParallelSessionId as l, createParallelWebSearchProvider as n, normalizeParallelObjective as o, buildParallelCacheKey as r, normalizeParallelResults as s, createParallelFreeWebSearchProvider as t, resolveParallelSearchCount as u };
|