@openclaw/perplexity-plugin 2026.9.7 → 2026.10.1-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.
@@ -38,12 +38,6 @@ function resolvePerplexityWebSearchRuntimeMetadata(ctx) {
38
38
  source
39
39
  }).transport };
40
40
  }
41
- function inferPerplexityBaseUrlFromApiKey(apiKey) {
42
- if (!apiKey) return;
43
- const normalized = normalizeLowercaseStringOrEmpty(apiKey);
44
- if (normalized.startsWith("pplx-")) return "direct";
45
- if (normalized.startsWith("sk-or-")) return "openrouter";
46
- }
47
41
  function isDirectPerplexityBaseUrl(baseUrl) {
48
42
  try {
49
43
  return normalizeLowercaseStringOrEmpty(new URL(baseUrl.trim()).hostname) === "api.perplexity.ai";
@@ -58,7 +52,7 @@ function hasPerplexityLegacyOverride(perplexity) {
58
52
  return Boolean(normalizeOptionalString(perplexity?.baseUrl) || normalizeOptionalString(perplexity?.model));
59
53
  }
60
54
  function resolvePerplexityRuntime(perplexity, auth) {
61
- const baseUrl = normalizeOptionalString(perplexity?.baseUrl) || (auth.source === "perplexity_env" || auth.source === "config" && inferPerplexityBaseUrlFromApiKey(auth.apiKey) !== "openrouter" ? PERPLEXITY_DIRECT_BASE_URL : DEFAULT_PERPLEXITY_BASE_URL);
55
+ const baseUrl = normalizeOptionalString(perplexity?.baseUrl) || (auth.source === "perplexity_env" || auth.source === "config" && !normalizeLowercaseStringOrEmpty(auth.apiKey).startsWith("sk-or-") ? PERPLEXITY_DIRECT_BASE_URL : DEFAULT_PERPLEXITY_BASE_URL);
62
56
  return {
63
57
  apiKey: auth.apiKey,
64
58
  source: auth.source,
@@ -69,7 +63,7 @@ function resolvePerplexityRuntime(perplexity, auth) {
69
63
  }
70
64
  //#endregion
71
65
  //#region extensions/perplexity/src/perplexity-web-search-provider.ts
72
- const loadPerplexityWebSearchRuntime = createLazyRuntimeModule(() => import("./perplexity-web-search-provider.runtime-BeEgweF9.mjs"));
66
+ const loadPerplexityWebSearchRuntime = createLazyRuntimeModule(() => import("./perplexity-web-search-provider.runtime-BvKAPBzA.mjs"));
73
67
  function createPerplexityParameters(transport) {
74
68
  const properties = {
75
69
  query: {
@@ -1,6 +1,6 @@
1
- import { i as resolvePerplexityRuntime, n as isDirectPerplexityBaseUrl, r as resolvePerplexityConfig } from "./perplexity-web-search-provider-S1ncBqEC.mjs";
1
+ import { i as resolvePerplexityRuntime, n as isDirectPerplexityBaseUrl, r as resolvePerplexityConfig } from "./perplexity-web-search-provider-CV4FB2B3.mjs";
2
2
  import { normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
3
- import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
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";
5
5
  //#region extensions/perplexity/src/perplexity-web-search-provider.runtime.ts
6
6
  const PERPLEXITY_SEARCH_ENDPOINT = "https://api.perplexity.ai/search";
@@ -29,14 +29,19 @@ function resolvePerplexityRequestModel(baseUrl, model) {
29
29
  if (!isDirectPerplexityBaseUrl(baseUrl)) return model;
30
30
  return model.startsWith("perplexity/") ? model.slice(11) : model;
31
31
  }
32
- function buildPerplexityRequestHeaders(apiKey, acceptJson = false) {
33
- return {
32
+ function buildPerplexityRequestHeaders(params) {
33
+ const defaultHeaders = {
34
34
  "Content-Type": "application/json",
35
- ...acceptJson ? { Accept: "application/json" } : {},
36
- Authorization: `Bearer ${apiKey}`,
37
- "HTTP-Referer": "https://openclaw.ai",
38
- "X-Title": "OpenClaw Web Search"
35
+ ...params.acceptJson ? { Accept: "application/json" } : {},
36
+ Authorization: `Bearer ${params.apiKey}`
39
37
  };
38
+ return resolveProviderRequestHeaders({
39
+ provider: "perplexity",
40
+ baseUrl: params.baseUrl && !isDirectPerplexityBaseUrl(params.baseUrl) ? params.baseUrl : void 0,
41
+ capability: "other",
42
+ transport: "http",
43
+ defaultHeaders
44
+ }) ?? defaultHeaders;
40
45
  }
41
46
  function extractPerplexityCitations(data) {
42
47
  const topLevel = (data.citations ?? []).filter((url) => Boolean(normalizeOptionalString(url)));
@@ -44,7 +49,7 @@ function extractPerplexityCitations(data) {
44
49
  const citations = [];
45
50
  for (const choice of data.choices ?? []) for (const annotation of choice.message?.annotations ?? []) {
46
51
  if (annotation.type !== "url_citation") continue;
47
- const url = typeof annotation.url_citation?.url === "string" ? annotation.url_citation.url : typeof annotation.url === "string" ? annotation.url : void 0;
52
+ const url = typeof annotation.url_citation?.url === "string" ? annotation.url_citation.url : annotation.url;
48
53
  const normalizedUrl = normalizeOptionalString(url);
49
54
  if (normalizedUrl) citations.push(normalizedUrl);
50
55
  }
@@ -63,7 +68,10 @@ async function runPerplexitySearchApi(params) {
63
68
  if (params.searchBeforeDate) body.search_before_date_filter = params.searchBeforeDate;
64
69
  if (params.maxTokens !== void 0) body.max_tokens = params.maxTokens;
65
70
  if (params.maxTokensPerPage !== void 0) body.max_tokens_per_page = params.maxTokensPerPage;
66
- const headers = buildPerplexityRequestHeaders(params.apiKey, true);
71
+ const headers = buildPerplexityRequestHeaders({
72
+ apiKey: params.apiKey,
73
+ acceptJson: true
74
+ });
67
75
  return withTrustedWebSearchEndpoint({
68
76
  url: PERPLEXITY_SEARCH_ENDPOINT,
69
77
  timeoutSeconds: params.timeoutSeconds,
@@ -97,7 +105,10 @@ async function runPerplexitySearch(params) {
97
105
  }]
98
106
  };
99
107
  if (params.freshness) body.search_recency_filter = params.freshness;
100
- const headers = buildPerplexityRequestHeaders(params.apiKey);
108
+ const headers = buildPerplexityRequestHeaders({
109
+ apiKey: params.apiKey,
110
+ baseUrl: params.baseUrl
111
+ });
101
112
  return withTrustedWebSearchEndpoint({
102
113
  url: endpoint,
103
114
  timeoutSeconds: params.timeoutSeconds,
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createPerplexityWebSearchProvider } from "./.setup/perplexity-web-search-provider-S1ncBqEC.mjs";
1
+ import { t as createPerplexityWebSearchProvider } from "./.setup/perplexity-web-search-provider-CV4FB2B3.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-S1ncBqEC.mjs";
1
+ import { t as createPerplexityWebSearchProvider } from "./.setup/perplexity-web-search-provider-CV4FB2B3.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-S1ncBqEC.mjs";
1
+ import { t as createPerplexityWebSearchProvider } from "./.setup/perplexity-web-search-provider-CV4FB2B3.mjs";
2
2
  export { createPerplexityWebSearchProvider };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/perplexity-plugin",
3
- "version": "2026.9.7",
3
+ "version": "2026.10.1-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.9.7"
21
+ "pluginApi": ">=2026.10.1-beta.1"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.9.7",
24
+ "openclawVersion": "2026.10.1-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.9.7"
43
+ "openclaw": ">=2026.10.1-beta.1"
44
44
  },
45
45
  "peerDependenciesMeta": {
46
46
  "openclaw": {