@openclaw/duckduckgo-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.
@@ -1,5 +1,5 @@
1
1
  import { decodeHtmlEntities } from "openclaw/plugin-sdk/html-entity-runtime";
2
- import { readProviderTextResponse } from "openclaw/plugin-sdk/provider-http";
2
+ import { ProviderHttpError, readProviderTextResponse } from "openclaw/plugin-sdk/provider-http";
3
3
  import { DEFAULT_CACHE_TTL_MINUTES, DEFAULT_SEARCH_COUNT, normalizeCacheKey, readCache, readResponseText, resolveCacheTtlMs, resolveSearchCount, resolveSiteName, resolveTimeoutSeconds, withTrustedWebSearchEndpoint, wrapWebContent, writeCache } from "openclaw/plugin-sdk/provider-web-search";
4
4
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  //#region extensions/duckduckgo/src/config.ts
@@ -61,7 +61,7 @@ function isBotChallenge(html) {
61
61
  async function readDuckDuckGoHtmlResponse(response) {
62
62
  return await readProviderTextResponse(response, "DuckDuckGo search");
63
63
  }
64
- function parseDuckDuckGoHtml(html) {
64
+ function parseDuckDuckGoHtml(html, count) {
65
65
  const results = [];
66
66
  const resultRegex = /<a\b(?=[^>]*\bclass="[^"]*\bresult__a\b[^"]*")([^>]*)>([\s\S]*?)<\/a>/gi;
67
67
  const nextResultRegex = /<a\b(?=[^>]*\bclass="[^"]*\bresult__a\b[^"]*")[^>]*>/i;
@@ -78,11 +78,14 @@ function parseDuckDuckGoHtml(html) {
78
78
  const title = decodeHtmlEntities$1(stripHtml(rawTitle));
79
79
  const url = decodeDuckDuckGoUrl(decodeHtmlEntities$1(rawUrl));
80
80
  const snippet = decodeHtmlEntities$1(stripHtml(rawSnippet));
81
- if (title && url) results.push({
82
- title,
83
- url,
84
- snippet
85
- });
81
+ if (title && url) {
82
+ results.push({
83
+ title,
84
+ url,
85
+ snippet
86
+ });
87
+ if (results.length >= count) break;
88
+ }
86
89
  }
87
90
  return results;
88
91
  }
@@ -120,11 +123,11 @@ async function runDuckDuckGoSearch(params) {
120
123
  }, async (response) => {
121
124
  if (!response.ok) {
122
125
  const detail = (await readResponseText(response, { maxBytes: 64e3 })).text;
123
- throw new Error(`DuckDuckGo search error (${response.status}): ${detail || response.statusText}`);
126
+ throw new ProviderHttpError(`DuckDuckGo search error (${response.status}): ${detail || response.statusText}`, { status: response.status });
124
127
  }
125
128
  const html = await readDuckDuckGoHtmlResponse(response);
126
129
  if (isBotChallenge(html)) throw new Error("DuckDuckGo returned a bot-detection challenge.");
127
- return parseDuckDuckGoHtml(html).slice(0, count);
130
+ return parseDuckDuckGoHtml(html, count);
128
131
  });
129
132
  params.signal?.throwIfAborted();
130
133
  const payload = {
@@ -28,7 +28,7 @@ function createDuckDuckGoWebSearchProviderBase() {
28
28
  }
29
29
  //#endregion
30
30
  //#region extensions/duckduckgo/src/ddg-search-provider.ts
31
- const loadDuckDuckGoClientModule = createLazyRuntimeModule(() => import("./ddg-client-CbFlWxF7.mjs"));
31
+ const loadDuckDuckGoClientModule = createLazyRuntimeModule(() => import("./ddg-client-D9UL3Bem.mjs"));
32
32
  const DuckDuckGoSearchSchema = {
33
33
  type: "object",
34
34
  properties: {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createDuckDuckGoWebSearchProvider } from "./.setup/ddg-search-provider-CPgV5euE.mjs";
1
+ import { t as createDuckDuckGoWebSearchProvider } from "./.setup/ddg-search-provider-Cv0XhcJ_.mjs";
2
2
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
3
3
  //#region extensions/duckduckgo/index.ts
4
4
  var duckduckgo_default = definePluginEntry({
@@ -1,3 +1,3 @@
1
- import { t as createDuckDuckGoWebSearchProvider } from "./.setup/ddg-search-provider-CPgV5euE.mjs";
1
+ import { t as createDuckDuckGoWebSearchProvider } from "./.setup/ddg-search-provider-Cv0XhcJ_.mjs";
2
2
  import "./web-search-provider.js";
3
3
  export { createDuckDuckGoWebSearchProvider };
@@ -1,2 +1,2 @@
1
- import { t as createDuckDuckGoWebSearchProvider } from "./.setup/ddg-search-provider-CPgV5euE.mjs";
1
+ import { t as createDuckDuckGoWebSearchProvider } from "./.setup/ddg-search-provider-Cv0XhcJ_.mjs";
2
2
  export { createDuckDuckGoWebSearchProvider };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/duckduckgo-plugin",
3
- "version": "2026.9.5",
3
+ "version": "2026.9.6",
4
4
  "description": "OpenClaw DuckDuckGo plugin.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,10 +18,10 @@
18
18
  "minHostVersion": ">=2026.7.2"
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": {