web-search-plus-plugin 1.3.2 → 1.3.4
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/index.ts +13 -12
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
2
1
|
import { Type } from "@sinclair/typebox";
|
|
3
2
|
import { spawn } from "child_process";
|
|
4
3
|
import fs from "fs";
|
|
@@ -15,6 +14,12 @@ function getPluginDir(): string {
|
|
|
15
14
|
return path.join(process.cwd(), "skills", "web-search-plus-plugin");
|
|
16
15
|
}
|
|
17
16
|
|
|
17
|
+
const SENSITIVE_PATTERN = /(?:key|token|secret|password|api[_-]?key)\s*[=:]\s*\S+/gi;
|
|
18
|
+
|
|
19
|
+
function sanitizeOutput(text: string): string {
|
|
20
|
+
return text.replace(SENSITIVE_PATTERN, "[REDACTED]");
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
function loadEnvFile(envPath: string): Record<string, string> {
|
|
19
24
|
if (!fs.existsSync(envPath)) return {};
|
|
20
25
|
const env: Record<string, string> = {};
|
|
@@ -66,7 +71,9 @@ function runPython(
|
|
|
66
71
|
if (!settled) {
|
|
67
72
|
settled = true;
|
|
68
73
|
clearTimeout(timer);
|
|
69
|
-
|
|
74
|
+
// Only expose the error message, not the full error object (may contain env/args)
|
|
75
|
+
const safeMsg = err.code === "ENOENT" ? "python3 not found" : "Process error";
|
|
76
|
+
resolve({ stdout: "", stderr: safeMsg, code: 1 });
|
|
70
77
|
}
|
|
71
78
|
});
|
|
72
79
|
});
|
|
@@ -75,12 +82,7 @@ function runPython(
|
|
|
75
82
|
const PLUGIN_DIR = getPluginDir();
|
|
76
83
|
const scriptPath = path.join(PLUGIN_DIR, "scripts", "search.py");
|
|
77
84
|
|
|
78
|
-
export default
|
|
79
|
-
id: "web-search-plus-plugin",
|
|
80
|
-
name: "Web Search Plus",
|
|
81
|
-
description:
|
|
82
|
-
"Multi-provider web search (Serper/Google, Tavily, Querit/Multilingual AI Search, Exa/Neural+Deep, Perplexity, You.com, SearXNG) with intelligent auto-routing",
|
|
83
|
-
register(api) {
|
|
85
|
+
export default function (api: any) {
|
|
84
86
|
// Bridge OpenClaw config fields to env vars expected by search.py
|
|
85
87
|
const configEnv: Record<string, string> = {};
|
|
86
88
|
const pluginConfig: Record<string, string> = (api.pluginConfig ?? {}) as Record<string, string>;
|
|
@@ -225,18 +227,17 @@ export default definePluginEntry({
|
|
|
225
227
|
const result = await runPython(args, childEnv, 75000);
|
|
226
228
|
|
|
227
229
|
if (result.code !== 0) {
|
|
228
|
-
const stderr = result.stderr.trim() || "Unknown error";
|
|
230
|
+
const stderr = sanitizeOutput(result.stderr.trim()) || "Unknown error";
|
|
229
231
|
return {
|
|
230
232
|
content: [{ type: "text", text: `Search failed (exit ${result.code}): ${stderr}` }],
|
|
231
233
|
};
|
|
232
234
|
}
|
|
233
235
|
|
|
234
236
|
return {
|
|
235
|
-
content: [{ type: "text", text: result.stdout.trim() || "{}" }],
|
|
237
|
+
content: [{ type: "text", text: sanitizeOutput(result.stdout.trim()) || "{}" }],
|
|
236
238
|
};
|
|
237
239
|
},
|
|
238
240
|
},
|
|
239
241
|
{ optional: true },
|
|
240
242
|
);
|
|
241
|
-
|
|
242
|
-
});
|
|
243
|
+
}
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "web-search-plus-plugin",
|
|
3
3
|
"name": "Web Search Plus",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.4",
|
|
5
5
|
"description": "Multi-provider web search (Serper/Google, Tavily, Querit/Multilingual AI Search, Exa/Neural+Deep, Perplexity, You.com, SearXNG) with intelligent auto-routing",
|
|
6
6
|
"configSchema": {
|
|
7
7
|
"type": "object",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-search-plus-plugin",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "OpenClaw plugin: multi-provider web search (Serper/Google, Tavily, Querit/Multilingual AI Search, Exa/Neural+Deep, Perplexity, You.com, SearXNG) with intelligent auto-routing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|