@openclaw/duckduckgo-plugin 2026.9.6 → 2026.9.7
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/assets/icon.png +0 -0
- package/dist/.setup/{ddg-client-D9UL3Bem.mjs → ddg-client-BGCnzqUb.mjs} +5 -11
- package/dist/.setup/{ddg-search-provider-Cv0XhcJ_.mjs → ddg-search-provider-CuJUFuao.mjs} +1 -1
- 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
package/assets/icon.png
CHANGED
|
Binary file
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { decodeHtmlEntities } from "openclaw/plugin-sdk/html-entity-runtime";
|
|
2
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
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
+
import { asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
//#region extensions/duckduckgo/src/config.ts
|
|
6
6
|
const DEFAULT_DDG_SAFE_SEARCH = "moderate";
|
|
7
7
|
function resolveDdgWebSearchConfig(config) {
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const pluginConfig = config?.plugins?.entries?.duckduckgo?.config;
|
|
9
|
+
return asOptionalRecord(pluginConfig?.webSearch);
|
|
10
10
|
}
|
|
11
11
|
function resolveDdgRegion(config) {
|
|
12
12
|
return normalizeOptionalString(resolveDdgWebSearchConfig(config)?.region);
|
|
@@ -51,16 +51,10 @@ function decodeDuckDuckGoUrl(rawUrl) {
|
|
|
51
51
|
} catch {}
|
|
52
52
|
return rawUrl;
|
|
53
53
|
}
|
|
54
|
-
function readHrefAttribute(tagAttributes) {
|
|
55
|
-
return /\bhref="([^"]*)"/i.exec(tagAttributes)?.[1] ?? "";
|
|
56
|
-
}
|
|
57
54
|
function isBotChallenge(html) {
|
|
58
55
|
if (/class="[^"]*\bresult__a\b[^"]*"/i.test(html)) return false;
|
|
59
56
|
return /g-recaptcha|are you a human|id="challenge-form"|name="challenge"/i.test(html);
|
|
60
57
|
}
|
|
61
|
-
async function readDuckDuckGoHtmlResponse(response) {
|
|
62
|
-
return await readProviderTextResponse(response, "DuckDuckGo search");
|
|
63
|
-
}
|
|
64
58
|
function parseDuckDuckGoHtml(html, count) {
|
|
65
59
|
const results = [];
|
|
66
60
|
const resultRegex = /<a\b(?=[^>]*\bclass="[^"]*\bresult__a\b[^"]*")([^>]*)>([\s\S]*?)<\/a>/gi;
|
|
@@ -69,7 +63,7 @@ function parseDuckDuckGoHtml(html, count) {
|
|
|
69
63
|
for (const match of html.matchAll(resultRegex)) {
|
|
70
64
|
const rawAttributes = match[1] ?? "";
|
|
71
65
|
const rawTitle = match[2] ?? "";
|
|
72
|
-
const rawUrl =
|
|
66
|
+
const rawUrl = /\bhref="([^"]*)"/i.exec(rawAttributes)?.[1] ?? "";
|
|
73
67
|
const matchEnd = (match.index ?? 0) + match[0].length;
|
|
74
68
|
const trailingHtml = html.slice(matchEnd);
|
|
75
69
|
const nextResultIndex = trailingHtml.search(nextResultRegex);
|
|
@@ -125,7 +119,7 @@ async function runDuckDuckGoSearch(params) {
|
|
|
125
119
|
const detail = (await readResponseText(response, { maxBytes: 64e3 })).text;
|
|
126
120
|
throw new ProviderHttpError(`DuckDuckGo search error (${response.status}): ${detail || response.statusText}`, { status: response.status });
|
|
127
121
|
}
|
|
128
|
-
const html = await
|
|
122
|
+
const html = await readProviderTextResponse(response, "DuckDuckGo search");
|
|
129
123
|
if (isBotChallenge(html)) throw new Error("DuckDuckGo returned a bot-detection challenge.");
|
|
130
124
|
return parseDuckDuckGoHtml(html, count);
|
|
131
125
|
});
|
|
@@ -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-
|
|
31
|
+
const loadDuckDuckGoClientModule = createLazyRuntimeModule(() => import("./ddg-client-BGCnzqUb.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-
|
|
1
|
+
import { t as createDuckDuckGoWebSearchProvider } from "./.setup/ddg-search-provider-CuJUFuao.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-
|
|
1
|
+
import { t as createDuckDuckGoWebSearchProvider } from "./.setup/ddg-search-provider-CuJUFuao.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-
|
|
1
|
+
import { t as createDuckDuckGoWebSearchProvider } from "./.setup/ddg-search-provider-CuJUFuao.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.
|
|
3
|
+
"version": "2026.9.7",
|
|
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.
|
|
21
|
+
"pluginApi": ">=2026.9.7"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.9.
|
|
24
|
+
"openclawVersion": "2026.9.7",
|
|
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.
|
|
43
|
+
"openclaw": ">=2026.9.7"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"openclaw": {
|