dsh-free-search 0.4.12 → 0.4.13

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 CHANGED
@@ -36,7 +36,7 @@ dsh 默认的搜索 provider 依赖 DeepSeek 官方 API key(`DEEPSEEK_API_KEY`
36
36
  - **统一引擎回退** —— 任何引擎失败(付费/免费,缺 key/401/限流/网络)自动轮流尝试下一个引擎:首选引擎 → 其他引擎(exa/tavily/keenable 无 key 也会尝试,因为它们自带 keyless 免费额度)→ 剩余免费引擎,搜索永不直接失败;结果顶部注明实际生效的引擎(如 `Note: perplexity unavailable or failed, using exa.`)
37
37
  - **时间过滤** —— `advanced_search` 工具支持 `timeRange`:固定档、自定义相对值、绝对日期三种形式(详见下方逻辑说明)
38
38
  - **系统提示词注入** —— agent 知道当前用哪个引擎、哪些需要 key
39
- - **版本号 + 检查更新** —— 设置卡片显示当前版本(v0.4.12),"检查更新"按钮直连 npm registry 对比最新版,有新版本时提示并可一键跳转
39
+ - **版本号 + 检查更新** —— 设置卡片显示当前版本(v0.4.13),"检查更新"按钮直连 npm registry 对比最新版,有新版本时提示并可一键跳转
40
40
  - **结果缓存** —— 相同查询(含引擎/时间过滤参数)5 分钟内命中缓存(LRU 50 条),防免费引擎限流、省付费额度;时长可在设置页 0-5 分钟自由配置(0 关闭)
41
41
  - **免费标注** —— 设置页中免费引擎带绿色 `FREE` 徽章,付费引擎带橙色 `API KEY` 徽章
42
42
  - **网页抓取(web_fetch)** —— 让 agent 抓取网页内容(官方 `dsh-web-fetch-http` provider,纯 JS,零额外依赖)
@@ -99,6 +99,7 @@ dsh web
99
99
 
100
100
  - **Search engine**:下拉框切换引擎,保存即生效
101
101
  - **API keys**:为 Exa / Tavily / Keenable / Perplexity / DeepSeek 填写 key(密码框,保存后只显示"已配置")
102
+ - **推荐**:付费引擎 key 建议写入 harness 凭据中心 `~/.dsh/.credentials.yaml`(如 `DEEPSEEK_API_KEY: sk-...`,与官方 LLM provider 一致,一处管理所有 key)。插件读取优先级:凭据中心 > 设置页 > 环境变量,设置页填的 key 仅作为遗留兼容。
102
103
  - **Test engine**:直测当前引擎可用性(不走回退链,付费引擎无 key 会明确报错)
103
104
  - **Use Bing default**:把当前搜索引擎切回稳定的免费 Bing;`Discard` 只撤销尚未保存的编辑
104
105
  - **Platform search**:勾选启用 GitHub / V2EX / Bilibili 平台搜索(`platform_search` 工具按此过滤)
@@ -276,7 +277,7 @@ This plugin provides multiple free search engines with automatic fallback, compl
276
277
  - **Unified Engine Fallback** — Any engine failure (paid or free, missing key, 401, rate limit, network error) automatically tries the next engine: the configured engine first, then other engines (exa/tavily/keenable are tried even without a key because they have built-in keyless quota), then the remaining free engines (Bing/AnySearch etc.) — with a note attached to the results naming the engine that actually served them (e.g. `Note: perplexity unavailable or failed, using exa.`). Search never fails outright.
277
278
  - **Time Filtering** — The `advanced_search` tool supports `timeRange`: fixed tiers, custom relative values, or an absolute date (details below)
278
279
  - **System Prompt Injection** — The agent is aware of the currently active engine and which engines require API keys
279
- - **Version + Update Check** — The settings card shows the current version (v0.4.12), and a "Check update" button queries the npm registry to compare against the latest release, prompting a one-click jump when a newer version exists
280
+ - **Version + Update Check** — The settings card shows the current version (v0.4.13), and a "Check update" button queries the npm registry to compare against the latest release, prompting a one-click jump when a newer version exists
280
281
  - **Result Caching** — Identical queries (same engine / time-filter args) hit an LRU cache (50 entries) for up to 5 minutes, protecting free engines from rate-limiting and saving paid quota; the TTL is configurable from 0-5 minutes in the settings UI (0 disables caching)
281
282
  - **Visual Badges** — Free engines feature a green `FREE` badge, while paid engines show an orange `API KEY` badge in the settings UI
282
283
  - **Webpage Fetching (`web_fetch`)** — Allows the agent to read full webpage contents (official `dsh-web-fetch-http` provider, pure JS, zero extra dependencies)
@@ -339,6 +340,7 @@ After installation, navigate to **Settings → Plugins → Configurable** tab
339
340
 
340
341
  - **Search engine**: Select an engine from the dropdown; changes take effect immediately upon saving.
341
342
  - **API keys**: Enter keys for Exa / Tavily / Keenable / Perplexity / DeepSeek (password fields; displayed as "configured" once saved).
343
+ - **Recommended**: store paid-engine keys in the harness credential center `~/.dsh/.credentials.yaml` (e.g. `DEEPSEEK_API_KEY: sk-...`, same as the official LLM providers — one place for all keys). Resolution order: credentials center > settings page > environment variable; the settings-page fields remain for backward compatibility.
342
344
  - **Test engine**: Tests the selected engine directly (no fallback chain; paid engines without a key report an explicit error).
343
345
  - **Use Bing default**: stage a switch back to the stable free Bing engine; `Discard` only cancels unsaved edits
344
346
  - **Platform search**: check platforms (GitHub / V2EX / Bilibili / Reddit / HN / Stack Overflow / Wikipedia / npm) to enable them for the `platform_search` tool (disabled platforms are skipped).
package/lib/client.js CHANGED
@@ -83,7 +83,7 @@ window.__ModuleLoader__.load({
83
83
  keenablePh: (c) => c ? "Keenable API 密钥(已配置)" : "Keenable API 密钥(可选,不填也可免费使用)",
84
84
  perplexityPh: (c) => c ? "Perplexity API 密钥(已配置)" : "Perplexity API 密钥(pplx-...)",
85
85
  deepseekPh: (c) => c ? "DeepSeek API 密钥(已配置)" : "DeepSeek API 密钥(sk-...)",
86
- keysHint: "密钥保存在 settings.yaml(界面脱敏显示)。为某引擎填写密钥后即可使用。",
86
+ keysHint: "密钥读取优先级:.credentials.yaml 凭据中心 > 这里 > 环境变量。推荐把 key 写进凭据中心(与官方 LLM 一致,一处管理)。",
87
87
  platformSearch: "平台搜索(platform_search 工具)",
88
88
  platformHint: "为 agent 的 platform_search 工具启用平台。禁用的平台会被跳过。",
89
89
  cacheTtl: "结果缓存时长(分钟)",
@@ -124,7 +124,7 @@ window.__ModuleLoader__.load({
124
124
  keenablePh: (c) => c ? "Keenable API key (configured)" : "Keenable API key (optional, free without)",
125
125
  perplexityPh: (c) => c ? "Perplexity API key (configured)" : "Perplexity API key (pplx-...)",
126
126
  deepseekPh: (c) => c ? "DeepSeek API key (configured)" : "DeepSeek API key (sk-...)",
127
- keysHint: "Keys are stored in settings.yaml (redacted in the UI). Enter a key for an engine to use it.",
127
+ keysHint: "Key resolution: .credentials.yaml credential center > here > environment variables. Recommended: store keys in the credential center (same as official LLM providers, one place for all).",
128
128
  platformSearch: "Platform search (platform_search tool)",
129
129
  platformHint: "Enable platforms for the agent's platform_search tool. Disabled platforms are skipped.",
130
130
  cacheTtl: "Result cache TTL (minutes)",
@@ -155,7 +155,7 @@ window.__ModuleLoader__.load({
155
155
  };
156
156
  const tt = (lang) => I18N[lang === "en" ? "en" : "zh"];
157
157
  // 当前插件版本(与 lib/index.js 的 PLUGIN_VERSION 保持一致)
158
- const PLUGIN_VERSION = "0.4.12";
158
+ const PLUGIN_VERSION = "0.4.13";
159
159
  const ENGINES = [
160
160
  { id: "ddg", label: "DuckDuckGo · HTML", badge: "FREE", link: "https://duckduckgo.com" },
161
161
  { id: "ddg-lite", label: "DuckDuckGo · Lite", badge: "FREE", link: "https://duckduckgo.com" },
package/lib/index.js CHANGED
@@ -21,7 +21,7 @@ const FREE_ENGINES = ["ddg", "ddg-lite", "bing", "searxng", "anysearch"];
21
21
  const ALL_ENGINES = ["ddg", "ddg-lite", "bing", "searxng", "anysearch", "exa", "tavily", "keenable", "perplexity", "deepseek-official"];
22
22
 
23
23
  // 当前插件版本(发布时与 package.json 同步)
24
- const PLUGIN_VERSION = "0.4.12";
24
+ const PLUGIN_VERSION = "0.4.13";
25
25
  // 检查更新的 npm registry 元数据地址(dsh-free-search 是 npmjs 上的公开包)
26
26
  const NPM_REGISTRY_URL = "https://registry.npmjs.org/dsh-free-search/latest";
27
27
  const PLUGIN_NPM_URL = "https://www.npmjs.com/package/dsh-free-search";
@@ -1347,16 +1347,16 @@ function apply(ctx, config) {
1347
1347
  // 单 query 结果缓存(provider.search 内闭包持有):LRU 50 条 / TTL 可配置
1348
1348
  const searchCache = new Map(); // key -> { value, expiresAt }
1349
1349
 
1350
- // key 优先级:settings 的 free-search.<x>ApiKey > 环境变量/credentials
1350
+ // key 优先级:credentials(.credentials.yaml 凭据中心,官方推荐)> settings 的 free-search.<x>ApiKey(遗留兼容)> 环境变量
1351
1351
  const resolveApiKey = async (envName, settingsKey) => {
1352
- const cfg = current();
1353
- if (settingsKey && cfg[settingsKey]) return cfg[settingsKey];
1354
1352
  if (credentials) {
1355
1353
  try {
1356
1354
  const resolved = await credentials.resolve(envName);
1357
1355
  if (resolved?.value) return resolved.value;
1358
1356
  } catch {}
1359
1357
  }
1358
+ const cfg = current();
1359
+ if (settingsKey && cfg[settingsKey]) return cfg[settingsKey];
1360
1360
  return process.env[envName] ?? "";
1361
1361
  };
1362
1362
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-free-search",
3
- "version": "0.4.12",
3
+ "version": "0.4.13",
4
4
  "description": "Free web search for DeepSeek Harness: 10 engines (Bing/DuckDuckGo/AnySearch/SearXNG/Exa/Tavily/Keenable keyless) + time filtering + platform search + web_fetch, with web settings UI.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",