web-search-plus-plugin 1.4.0 → 2.0.0
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/README.md +25 -33
- package/index.ts +848 -135
- package/openclaw.plugin.json +1 -2
- package/package.json +1 -2
- package/scripts/search.py +0 -2940
- package/scripts/setup.py +0 -463
package/README.md
CHANGED
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
**Multi-provider web search as a native OpenClaw tool.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
An OpenClaw plugin that registers `web_search_plus` as a first-class tool with intelligent auto-routing. Install, configure an API key, go.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
> **v2.0.0 is a complete rewrite.** The plugin now runs as a single pure TypeScript implementation with native `fetch()` and Node.js builtins only. No Python, no `child_process`, no setup wizard, no extra runtime dependencies.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
9
|
+
## ✨ Highlights
|
|
10
|
+
|
|
11
|
+
- **Pure TypeScript** — single-file implementation, all logic in `index.ts`
|
|
12
|
+
- **Zero dependencies** — Node.js builtins only, no Python, no `child_process`
|
|
13
|
+
- **7 providers** — Serper, Tavily, Querit, Exa, Perplexity, You.com, SearXNG
|
|
14
|
+
- **Intelligent auto-routing** — analyzes query intent, picks the best provider
|
|
15
|
+
- **Automatic fallback** — if a provider fails, the next healthy one takes over
|
|
16
|
+
- **Local result caching** — file-based, survives restarts, saves API credits
|
|
17
|
+
- **Provider health tracking** — exponential cooldown on repeated failures
|
|
18
|
+
- **SSRF protection** — SearXNG URLs validated via `dns/promises` + `net`
|
|
14
19
|
|
|
15
20
|
## 🔎 Supported Providers
|
|
16
21
|
|
|
@@ -94,7 +99,9 @@ Copy `.env.template` to `.env` and add at least one API key:
|
|
|
94
99
|
| `PERPLEXITY_API_KEY` | Perplexity | [perplexity.ai](https://docs.perplexity.ai) |
|
|
95
100
|
| `KILOCODE_API_KEY` | Perplexity via Kilo | [kilocode.ai](https://kilocode.ai) |
|
|
96
101
|
| `YOU_API_KEY` | You.com | [you.com/api](https://you.com/api) |
|
|
97
|
-
| `
|
|
102
|
+
| `SEARXNG_INSTANCE_URL` | SearXNG (self-hosted) | [docs.searxng.org](https://docs.searxng.org) |
|
|
103
|
+
|
|
104
|
+
You can also configure these values through OpenClaw plugin config. Local `.env` values remain convenient for development.
|
|
98
105
|
|
|
99
106
|
## 🤖 Enable for an Agent
|
|
100
107
|
|
|
@@ -123,22 +130,11 @@ The registered `web_search_plus` tool accepts:
|
|
|
123
130
|
|-----------|------|----------|-------------|
|
|
124
131
|
| `query` | string | ✅ | Search query |
|
|
125
132
|
| `provider` | string | ❌ | Force a provider: `serper`, `tavily`, `querit`, `exa`, `perplexity`, `you`, `searxng`, or `auto` (default) |
|
|
126
|
-
| `count` | number | ❌ | Number of results (default: 5) |
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
# Auto-route
|
|
134
|
-
python3 scripts/search.py -q "your query here"
|
|
135
|
-
|
|
136
|
-
# Force a specific provider
|
|
137
|
-
python3 scripts/search.py -q "your query" -p tavily
|
|
138
|
-
|
|
139
|
-
# More results
|
|
140
|
-
python3 scripts/search.py -q "your query" --max-results 10
|
|
141
|
-
```
|
|
133
|
+
| `count` | number | ❌ | Number of results (default: 5, max: 10) |
|
|
134
|
+
| `depth` | string | ❌ | Exa depth: `normal`, `deep`, or `deep-reasoning` |
|
|
135
|
+
| `time_range` | string | ❌ | Recency filter where supported: `day`, `week`, `month`, `year` |
|
|
136
|
+
| `include_domains` | string[] | ❌ | Restrict results to these domains where supported (Tavily, Exa, Querit) |
|
|
137
|
+
| `exclude_domains` | string[] | ❌ | Exclude these domains where supported (Tavily, Exa, Querit) |
|
|
142
138
|
|
|
143
139
|
## ❓ FAQ
|
|
144
140
|
|
|
@@ -146,13 +142,10 @@ python3 scripts/search.py -q "your query" --max-results 10
|
|
|
146
142
|
No. The plugin works with just one API key. Configure whichever providers you have — the auto-router will use what's available and skip what's not.
|
|
147
143
|
|
|
148
144
|
### What's the difference between this plugin and the `web-search-plus` skill?
|
|
149
|
-
The **plugin** registers a native tool that any agent can use directly. The **skill** provides a SKILL.md with instructions for the agent.
|
|
150
|
-
|
|
151
|
-
### Do I need Python?
|
|
152
|
-
Yes, Python 3 is required. The search logic runs as a Python script. Most Linux servers and macOS have Python 3 pre-installed.
|
|
145
|
+
The **plugin** registers a native tool that any agent can use directly. The **skill** provides a SKILL.md with instructions for the agent. The plugin is the recommended approach.
|
|
153
146
|
|
|
154
147
|
### How does auto-routing work?
|
|
155
|
-
The router scores each provider based on query signals
|
|
148
|
+
The router scores each configured provider based on query signals. Shopping keywords boost Serper, explanation queries boost Tavily, multilingual/real-time queries favor Querit, semantic/discovery queries boost Exa, and direct questions boost Perplexity. Highest score wins, with automatic fallback on failure.
|
|
156
149
|
|
|
157
150
|
### Does it cache results?
|
|
158
151
|
Yes. Results are cached locally in a `.cache/` directory inside the plugin folder. Identical queries return cached results instantly and don't consume API credits. Cache is file-based and survives restarts.
|
|
@@ -161,16 +154,15 @@ Yes. Results are cached locally in a `.cache/` directory inside the plugin folde
|
|
|
161
154
|
Yes. Set `KILOCODE_API_KEY` in your `.env` — the plugin routes Perplexity requests through the Kilo Gateway automatically. You can also use a direct `PERPLEXITY_API_KEY`.
|
|
162
155
|
|
|
163
156
|
### What about SearXNG?
|
|
164
|
-
SearXNG is a self-hosted meta search engine that aggregates 70+ sources. It's free but requires your own instance. The plugin validates
|
|
157
|
+
SearXNG is a self-hosted meta search engine that aggregates 70+ sources. It's free but requires your own instance. The plugin validates instance URLs before querying and includes SSRF protection using Node.js DNS/IP checks for security.
|
|
165
158
|
|
|
166
159
|
### Does it work in sandboxed agents?
|
|
167
160
|
Yes, as long as the tool is allowed in the agent's tool config. The plugin runs on the host alongside the gateway.
|
|
168
161
|
|
|
169
162
|
## 📋 Requirements
|
|
170
163
|
|
|
171
|
-
- **OpenClaw
|
|
172
|
-
- **
|
|
173
|
-
- At least **one API key** from a supported provider
|
|
164
|
+
- **OpenClaw gateway** (any recent version)
|
|
165
|
+
- At least **one API key** from a supported provider, or a **SearXNG instance URL**
|
|
174
166
|
|
|
175
167
|
## 📄 License
|
|
176
168
|
|