@openclaw/perplexity-plugin 2026.7.2-beta.7 → 2026.8.1-beta.3
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/{perplexity-web-search-provider-CWMYSpnj.js → perplexity-web-search-provider-CSYSs8kt.js} +4 -3
- package/dist/{perplexity-web-search-provider.runtime-CCtdE3-R.js → perplexity-web-search-provider.runtime-CDJXALXh.js} +14 -14
- package/dist/web-search-provider.js +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createPerplexityWebSearchProvider } from "./perplexity-web-search-provider-
|
|
1
|
+
import { t as createPerplexityWebSearchProvider } from "./perplexity-web-search-provider-CSYSs8kt.js";
|
|
2
2
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
3
3
|
//#region extensions/perplexity/index.ts
|
|
4
4
|
var perplexity_default = definePluginEntry({
|
|
@@ -3,7 +3,7 @@ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
|
3
3
|
import { mergeScopedSearchConfig, resolveProviderWebSearchPluginConfig } from "openclaw/plugin-sdk/provider-web-search-config-contract";
|
|
4
4
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
//#region extensions/perplexity/src/perplexity-web-search-provider.ts
|
|
6
|
-
const loadPerplexityWebSearchRuntime = createLazyRuntimeModule(() => import("./perplexity-web-search-provider.runtime-
|
|
6
|
+
const loadPerplexityWebSearchRuntime = createLazyRuntimeModule(() => import("./perplexity-web-search-provider.runtime-CDJXALXh.js"));
|
|
7
7
|
function createPerplexityParameters(transport) {
|
|
8
8
|
const properties = {
|
|
9
9
|
query: {
|
|
@@ -70,9 +70,10 @@ function createPerplexityToolDefinition(searchConfig, runtimeTransport) {
|
|
|
70
70
|
return {
|
|
71
71
|
description: schemaTransport === "chat_completions" ? "Search the web using Perplexity Sonar via Perplexity/OpenRouter chat completions. Returns AI-synthesized answers with citations from web-grounded search." : "Search the web using Perplexity. Runtime routing decides between native Search API and Sonar chat-completions compatibility. Structured filters are available on the native Search API path.",
|
|
72
72
|
parameters: createPerplexityParameters(schemaTransport),
|
|
73
|
-
execute: async (args) => {
|
|
73
|
+
execute: async (args, context) => {
|
|
74
|
+
context?.signal?.throwIfAborted();
|
|
74
75
|
const { executePerplexitySearch } = await loadPerplexityWebSearchRuntime();
|
|
75
|
-
return await executePerplexitySearch(args, searchConfig);
|
|
76
|
+
return await executePerplexitySearch(args, searchConfig, context?.signal);
|
|
76
77
|
}
|
|
77
78
|
};
|
|
78
79
|
}
|
|
@@ -54,9 +54,6 @@ function buildPerplexityRequestHeaders(apiKey, acceptJson = false) {
|
|
|
54
54
|
"X-Title": "OpenClaw Web Search"
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
async function readPerplexityJsonResponse(response, label) {
|
|
58
|
-
return await readProviderJsonResponse(response, label);
|
|
59
|
-
}
|
|
60
57
|
function resolvePerplexityTransport(perplexity) {
|
|
61
58
|
const auth = resolvePerplexityApiKey(perplexity);
|
|
62
59
|
const baseUrl = resolvePerplexityBaseUrl(perplexity, auth.source, auth.apiKey);
|
|
@@ -96,6 +93,7 @@ async function runPerplexitySearchApi(params) {
|
|
|
96
93
|
return withTrustedWebSearchEndpoint({
|
|
97
94
|
url: PERPLEXITY_SEARCH_ENDPOINT,
|
|
98
95
|
timeoutSeconds: params.timeoutSeconds,
|
|
96
|
+
signal: params.signal,
|
|
99
97
|
init: {
|
|
100
98
|
method: "POST",
|
|
101
99
|
headers: buildPerplexityRequestHeaders(params.apiKey, true),
|
|
@@ -103,7 +101,7 @@ async function runPerplexitySearchApi(params) {
|
|
|
103
101
|
}
|
|
104
102
|
}, async (res) => {
|
|
105
103
|
if (!res.ok) return await throwWebSearchApiError(res, "Perplexity Search");
|
|
106
|
-
return ((await
|
|
104
|
+
return ((await readProviderJsonResponse(res, "Perplexity Search")).results ?? []).map((entry) => ({
|
|
107
105
|
title: entry.title ? wrapWebContent(entry.title, "web_search") : "",
|
|
108
106
|
url: entry.url ?? "",
|
|
109
107
|
description: entry.snippet ? wrapWebContent(entry.snippet, "web_search") : "",
|
|
@@ -125,6 +123,7 @@ async function runPerplexitySearch(params) {
|
|
|
125
123
|
return withTrustedWebSearchEndpoint({
|
|
126
124
|
url: endpoint,
|
|
127
125
|
timeoutSeconds: params.timeoutSeconds,
|
|
126
|
+
signal: params.signal,
|
|
128
127
|
init: {
|
|
129
128
|
method: "POST",
|
|
130
129
|
headers: buildPerplexityRequestHeaders(params.apiKey),
|
|
@@ -132,14 +131,16 @@ async function runPerplexitySearch(params) {
|
|
|
132
131
|
}
|
|
133
132
|
}, async (res) => {
|
|
134
133
|
if (!res.ok) return await throwWebSearchApiError(res, "Perplexity");
|
|
135
|
-
const data = await
|
|
134
|
+
const data = await readProviderJsonResponse(res, "Perplexity");
|
|
135
|
+
const content = data.choices?.[0]?.message?.content;
|
|
136
|
+
if (typeof content !== "string" || !content.trim()) throw new Error("Perplexity search returned no final answer. Retry the query or choose another search provider.");
|
|
136
137
|
return {
|
|
137
|
-
content
|
|
138
|
+
content,
|
|
138
139
|
citations: extractPerplexityCitations(data)
|
|
139
140
|
};
|
|
140
141
|
});
|
|
141
142
|
}
|
|
142
|
-
async function executePerplexitySearch(args, searchConfig) {
|
|
143
|
+
async function executePerplexitySearch(args, searchConfig, signal) {
|
|
143
144
|
const runtime = resolvePerplexityTransport(resolvePerplexityConfig(searchConfig));
|
|
144
145
|
if (!runtime.apiKey) return {
|
|
145
146
|
error: "missing_perplexity_api_key",
|
|
@@ -243,7 +244,7 @@ async function executePerplexitySearch(args, searchConfig) {
|
|
|
243
244
|
runtime.baseUrl,
|
|
244
245
|
runtime.model,
|
|
245
246
|
query,
|
|
246
|
-
resolveSearchCount(count, DEFAULT_SEARCH_COUNT),
|
|
247
|
+
structured ? resolveSearchCount(count, DEFAULT_SEARCH_COUNT) : void 0,
|
|
247
248
|
country,
|
|
248
249
|
language,
|
|
249
250
|
freshness,
|
|
@@ -275,6 +276,7 @@ async function executePerplexitySearch(args, searchConfig) {
|
|
|
275
276
|
baseUrl: runtime.baseUrl,
|
|
276
277
|
model: runtime.model,
|
|
277
278
|
timeoutSeconds,
|
|
279
|
+
signal,
|
|
278
280
|
freshness
|
|
279
281
|
});
|
|
280
282
|
return {
|
|
@@ -298,6 +300,7 @@ async function executePerplexitySearch(args, searchConfig) {
|
|
|
298
300
|
apiKey: runtime.apiKey,
|
|
299
301
|
count: resolveSearchCount(count, DEFAULT_SEARCH_COUNT),
|
|
300
302
|
timeoutSeconds,
|
|
303
|
+
signal,
|
|
301
304
|
country: country ?? void 0,
|
|
302
305
|
searchDomainFilter: domainFilter,
|
|
303
306
|
searchRecencyFilter: freshness,
|
|
@@ -312,6 +315,7 @@ async function executePerplexitySearch(args, searchConfig) {
|
|
|
312
315
|
payload.count = payload.results.length;
|
|
313
316
|
payload.tookMs = Date.now() - start;
|
|
314
317
|
} else payload.tookMs = Date.now() - start;
|
|
318
|
+
signal?.throwIfAborted();
|
|
315
319
|
writeCachedSearchPayload(cacheKey, payload, resolveSearchCacheTtlMs(searchConfig));
|
|
316
320
|
return payload;
|
|
317
321
|
}
|
|
@@ -320,12 +324,8 @@ const testing = {
|
|
|
320
324
|
resolvePerplexityBaseUrl,
|
|
321
325
|
resolvePerplexityModel,
|
|
322
326
|
resolvePerplexityTransport,
|
|
323
|
-
isDirectPerplexityBaseUrl,
|
|
324
327
|
resolvePerplexityRequestModel,
|
|
325
|
-
resolvePerplexityApiKey
|
|
326
|
-
readPerplexityJsonResponse,
|
|
327
|
-
normalizeToIsoDate,
|
|
328
|
-
isoToPerplexityDate
|
|
328
|
+
resolvePerplexityApiKey
|
|
329
329
|
};
|
|
330
330
|
//#endregion
|
|
331
|
-
export {
|
|
331
|
+
export { executePerplexitySearch, testing };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createPerplexityWebSearchProvider } from "./perplexity-web-search-provider-
|
|
1
|
+
import { t as createPerplexityWebSearchProvider } from "./perplexity-web-search-provider-CSYSs8kt.js";
|
|
2
2
|
export { createPerplexityWebSearchProvider };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/perplexity-plugin",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.8.1-beta.3",
|
|
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.
|
|
21
|
+
"pluginApi": ">=2026.8.1-beta.3"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.
|
|
24
|
+
"openclawVersion": "2026.8.1-beta.3",
|
|
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.
|
|
41
|
+
"openclaw": ">=2026.8.1-beta.3"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"openclaw": {
|