@openclaw/perplexity-plugin 2026.10.1 → 2026.10.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/{perplexity-web-search-provider-CV4FB2B3.mjs → perplexity-web-search-provider-BP_SdCt9.mjs} +2 -6
- package/dist/.setup/{perplexity-web-search-provider.runtime-BvKAPBzA.mjs → perplexity-web-search-provider.runtime-BKoiuxCz.mjs} +45 -65
- package/dist/index.js +1 -1
- package/dist/web-search-contract-api.js +1 -1
- package/dist/web-search-provider.js +1 -1
- package/package.json +4 -4
|
@@ -39,11 +39,7 @@ function resolvePerplexityWebSearchRuntimeMetadata(ctx) {
|
|
|
39
39
|
}).transport };
|
|
40
40
|
}
|
|
41
41
|
function isDirectPerplexityBaseUrl(baseUrl) {
|
|
42
|
-
|
|
43
|
-
return normalizeLowercaseStringOrEmpty(new URL(baseUrl.trim()).hostname) === "api.perplexity.ai";
|
|
44
|
-
} catch {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
42
|
+
return normalizeLowercaseStringOrEmpty(URL.parse(baseUrl.trim())?.hostname) === "api.perplexity.ai";
|
|
47
43
|
}
|
|
48
44
|
function resolvePerplexityConfig(searchConfig) {
|
|
49
45
|
return asNonArrayRecord(searchConfig?.perplexity);
|
|
@@ -63,7 +59,7 @@ function resolvePerplexityRuntime(perplexity, auth) {
|
|
|
63
59
|
}
|
|
64
60
|
//#endregion
|
|
65
61
|
//#region extensions/perplexity/src/perplexity-web-search-provider.ts
|
|
66
|
-
const loadPerplexityWebSearchRuntime = createLazyRuntimeModule(() => import("./perplexity-web-search-provider.runtime-
|
|
62
|
+
const loadPerplexityWebSearchRuntime = createLazyRuntimeModule(() => import("./perplexity-web-search-provider.runtime-BKoiuxCz.mjs"));
|
|
67
63
|
function createPerplexityParameters(transport) {
|
|
68
64
|
const properties = {
|
|
69
65
|
query: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as resolvePerplexityRuntime, n as isDirectPerplexityBaseUrl, r as resolvePerplexityConfig } from "./perplexity-web-search-provider-
|
|
1
|
+
import { i as resolvePerplexityRuntime, n as isDirectPerplexityBaseUrl, r as resolvePerplexityConfig } from "./perplexity-web-search-provider-BP_SdCt9.mjs";
|
|
2
2
|
import { normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { readProviderJsonResponse, resolveProviderRequestHeaders } from "openclaw/plugin-sdk/provider-http";
|
|
4
4
|
import { DEFAULT_SEARCH_COUNT, MAX_SEARCH_COUNT, buildSearchCacheKey, isoToPerplexityDate, normalizeFreshness, parseWebSearchTimeFilters, readCachedSearchPayload, readConfiguredSecretString, readPositiveIntegerParam, readProviderEnvValue, readStringArrayParam, readStringParam, resolveSearchCacheTtlMs, resolveSearchCount, resolveSearchTimeoutSeconds, resolveSiteName, throwWebSearchApiError, withTrustedWebSearchEndpoint, wrapWebContent, writeCachedSearchPayload } from "openclaw/plugin-sdk/provider-web-search";
|
|
@@ -55,25 +55,35 @@ function extractPerplexityCitations(data) {
|
|
|
55
55
|
}
|
|
56
56
|
return uniqueStrings(citations);
|
|
57
57
|
}
|
|
58
|
-
async function
|
|
59
|
-
const
|
|
58
|
+
async function runPerplexitySearch(params) {
|
|
59
|
+
const structured = params.transport === "search_api";
|
|
60
|
+
const label = structured ? "Perplexity Search" : "Perplexity";
|
|
61
|
+
const endpoint = structured ? PERPLEXITY_SEARCH_ENDPOINT : `${params.baseUrl.trim().replace(/\/$/, "")}/chat/completions`;
|
|
62
|
+
const body = structured ? {
|
|
60
63
|
query: params.query,
|
|
61
|
-
max_results: params.count
|
|
64
|
+
max_results: params.count,
|
|
65
|
+
...params.country ? { country: params.country } : {},
|
|
66
|
+
...params.searchDomainFilter?.length ? { search_domain_filter: params.searchDomainFilter } : {},
|
|
67
|
+
...params.searchRecencyFilter ? { search_recency_filter: params.searchRecencyFilter } : {},
|
|
68
|
+
...params.searchLanguageFilter?.length ? { search_language_filter: params.searchLanguageFilter } : {},
|
|
69
|
+
...params.searchAfterDate ? { search_after_date_filter: params.searchAfterDate } : {},
|
|
70
|
+
...params.searchBeforeDate ? { search_before_date_filter: params.searchBeforeDate } : {},
|
|
71
|
+
...params.maxTokens !== void 0 ? { max_tokens: params.maxTokens } : {},
|
|
72
|
+
...params.maxTokensPerPage !== void 0 ? { max_tokens_per_page: params.maxTokensPerPage } : {}
|
|
73
|
+
} : {
|
|
74
|
+
model: resolvePerplexityRequestModel(params.baseUrl, params.model),
|
|
75
|
+
messages: [{
|
|
76
|
+
role: "user",
|
|
77
|
+
content: params.query
|
|
78
|
+
}],
|
|
79
|
+
...params.freshness ? { search_recency_filter: params.freshness } : {}
|
|
62
80
|
};
|
|
63
|
-
if (params.country) body.country = params.country;
|
|
64
|
-
if (params.searchDomainFilter?.length) body.search_domain_filter = params.searchDomainFilter;
|
|
65
|
-
if (params.searchRecencyFilter) body.search_recency_filter = params.searchRecencyFilter;
|
|
66
|
-
if (params.searchLanguageFilter?.length) body.search_language_filter = params.searchLanguageFilter;
|
|
67
|
-
if (params.searchAfterDate) body.search_after_date_filter = params.searchAfterDate;
|
|
68
|
-
if (params.searchBeforeDate) body.search_before_date_filter = params.searchBeforeDate;
|
|
69
|
-
if (params.maxTokens !== void 0) body.max_tokens = params.maxTokens;
|
|
70
|
-
if (params.maxTokensPerPage !== void 0) body.max_tokens_per_page = params.maxTokensPerPage;
|
|
71
81
|
const headers = buildPerplexityRequestHeaders({
|
|
72
82
|
apiKey: params.apiKey,
|
|
73
|
-
acceptJson: true
|
|
83
|
+
...structured ? { acceptJson: true } : { baseUrl: params.baseUrl }
|
|
74
84
|
});
|
|
75
85
|
return withTrustedWebSearchEndpoint({
|
|
76
|
-
url:
|
|
86
|
+
url: endpoint,
|
|
77
87
|
timeoutSeconds: params.timeoutSeconds,
|
|
78
88
|
signal: params.signal,
|
|
79
89
|
init: {
|
|
@@ -82,48 +92,18 @@ async function runPerplexitySearchApi(params) {
|
|
|
82
92
|
body: JSON.stringify(body)
|
|
83
93
|
}
|
|
84
94
|
}, async (res) => {
|
|
85
|
-
if (!res.ok) return await throwWebSearchApiError(res,
|
|
95
|
+
if (!res.ok) return await throwWebSearchApiError(res, label, {
|
|
86
96
|
headers,
|
|
87
97
|
signal: params.signal
|
|
88
98
|
});
|
|
89
|
-
return ((await readProviderJsonResponse(res,
|
|
99
|
+
if (structured) return ((await readProviderJsonResponse(res, label)).results ?? []).slice(0, params.count).map((entry) => ({
|
|
90
100
|
title: entry.title ? wrapWebContent(entry.title, "web_search") : "",
|
|
91
101
|
url: entry.url ?? "",
|
|
92
102
|
description: entry.snippet ? wrapWebContent(entry.snippet, "web_search") : "",
|
|
93
103
|
published: entry.date ?? void 0,
|
|
94
104
|
siteName: resolveSiteName(entry.url) || void 0
|
|
95
105
|
}));
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
async function runPerplexitySearch(params) {
|
|
99
|
-
const endpoint = `${params.baseUrl.trim().replace(/\/$/, "")}/chat/completions`;
|
|
100
|
-
const body = {
|
|
101
|
-
model: resolvePerplexityRequestModel(params.baseUrl, params.model),
|
|
102
|
-
messages: [{
|
|
103
|
-
role: "user",
|
|
104
|
-
content: params.query
|
|
105
|
-
}]
|
|
106
|
-
};
|
|
107
|
-
if (params.freshness) body.search_recency_filter = params.freshness;
|
|
108
|
-
const headers = buildPerplexityRequestHeaders({
|
|
109
|
-
apiKey: params.apiKey,
|
|
110
|
-
baseUrl: params.baseUrl
|
|
111
|
-
});
|
|
112
|
-
return withTrustedWebSearchEndpoint({
|
|
113
|
-
url: endpoint,
|
|
114
|
-
timeoutSeconds: params.timeoutSeconds,
|
|
115
|
-
signal: params.signal,
|
|
116
|
-
init: {
|
|
117
|
-
method: "POST",
|
|
118
|
-
headers,
|
|
119
|
-
body: JSON.stringify(body)
|
|
120
|
-
}
|
|
121
|
-
}, async (res) => {
|
|
122
|
-
if (!res.ok) return await throwWebSearchApiError(res, "Perplexity", {
|
|
123
|
-
headers,
|
|
124
|
-
signal: params.signal
|
|
125
|
-
});
|
|
126
|
-
const data = await readProviderJsonResponse(res, "Perplexity");
|
|
106
|
+
const data = await readProviderJsonResponse(res, label);
|
|
127
107
|
const content = data.choices?.[0]?.message?.content;
|
|
128
108
|
if (typeof content !== "string" || !content.trim()) throw new Error("Perplexity search returned no final answer. Retry the query or choose another search provider.");
|
|
129
109
|
return {
|
|
@@ -254,28 +234,28 @@ async function executePerplexitySearch(args, searchConfig, signal) {
|
|
|
254
234
|
if (cached) return cached;
|
|
255
235
|
const start = Date.now();
|
|
256
236
|
const timeoutSeconds = resolveSearchTimeoutSeconds(searchConfig);
|
|
257
|
-
const result =
|
|
258
|
-
query,
|
|
259
|
-
apiKey: runtime.apiKey,
|
|
260
|
-
baseUrl: runtime.baseUrl,
|
|
261
|
-
model: runtime.model,
|
|
262
|
-
timeoutSeconds,
|
|
263
|
-
signal,
|
|
264
|
-
freshness
|
|
265
|
-
}) : await runPerplexitySearchApi({
|
|
237
|
+
const result = await runPerplexitySearch({
|
|
266
238
|
query,
|
|
267
239
|
apiKey: runtime.apiKey,
|
|
268
|
-
count: resolveSearchCount(count, DEFAULT_SEARCH_COUNT),
|
|
269
240
|
timeoutSeconds,
|
|
270
241
|
signal,
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
242
|
+
...runtime.transport === "chat_completions" ? {
|
|
243
|
+
transport: runtime.transport,
|
|
244
|
+
baseUrl: runtime.baseUrl,
|
|
245
|
+
model: runtime.model,
|
|
246
|
+
freshness
|
|
247
|
+
} : {
|
|
248
|
+
transport: runtime.transport,
|
|
249
|
+
count: resolveSearchCount(count, DEFAULT_SEARCH_COUNT),
|
|
250
|
+
country: country ?? void 0,
|
|
251
|
+
searchDomainFilter: domainFilter,
|
|
252
|
+
searchRecencyFilter: freshness,
|
|
253
|
+
searchLanguageFilter: language ? [language] : void 0,
|
|
254
|
+
searchAfterDate: dateAfter ? isoToPerplexityDate(dateAfter) : void 0,
|
|
255
|
+
searchBeforeDate: dateBefore ? isoToPerplexityDate(dateBefore) : void 0,
|
|
256
|
+
maxTokens: maxTokens ?? void 0,
|
|
257
|
+
maxTokensPerPage: maxTokensPerPage ?? void 0
|
|
258
|
+
}
|
|
279
259
|
});
|
|
280
260
|
const resultFields = Array.isArray(result) ? { results: result } : {
|
|
281
261
|
content: wrapWebContent(result.content, "web_search"),
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createPerplexityWebSearchProvider } from "./.setup/perplexity-web-search-provider-
|
|
1
|
+
import { t as createPerplexityWebSearchProvider } from "./.setup/perplexity-web-search-provider-BP_SdCt9.mjs";
|
|
2
2
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
3
3
|
//#region extensions/perplexity/index.ts
|
|
4
4
|
var perplexity_default = definePluginEntry({
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as createPerplexityWebSearchProvider } from "./.setup/perplexity-web-search-provider-
|
|
1
|
+
import { t as createPerplexityWebSearchProvider } from "./.setup/perplexity-web-search-provider-BP_SdCt9.mjs";
|
|
2
2
|
import "./web-search-provider.js";
|
|
3
3
|
export { createPerplexityWebSearchProvider };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createPerplexityWebSearchProvider } from "./.setup/perplexity-web-search-provider-
|
|
1
|
+
import { t as createPerplexityWebSearchProvider } from "./.setup/perplexity-web-search-provider-BP_SdCt9.mjs";
|
|
2
2
|
export { createPerplexityWebSearchProvider };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/perplexity-plugin",
|
|
3
|
-
"version": "2026.10.1",
|
|
3
|
+
"version": "2026.10.5-beta.1",
|
|
4
4
|
"description": "OpenClaw Perplexity 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.10.1"
|
|
21
|
+
"pluginApi": ">=2026.10.5-beta.1"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.10.1",
|
|
24
|
+
"openclawVersion": "2026.10.5-beta.1",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"assets/activity.svg"
|
|
41
41
|
],
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"openclaw": ">=2026.10.1"
|
|
43
|
+
"openclaw": ">=2026.10.5-beta.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"openclaw": {
|