dsh-free-search 0.9.17 → 0.9.19

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
@@ -32,7 +32,7 @@ dsh 默认的搜索 provider 依赖 DeepSeek 官方 API key(`DEEPSEEK_API_KEY`
32
32
  - **多引擎可选**:DuckDuckGo(html/lite)、Bing、SearXNG(元搜索,支持自定义实例)、AnySearch、Exa、Tavily、Keenable、Firecrawl、Parallel、Perplexity、SerpBase、Serply、DeepSeek 官方、DeepSeek 原生搜索 API、You.com、百度千帆、Kimi、阿里云百炼、火山联网搜索(豆包搜索)、知乎全网/站内(`zhihu_global`/`zhihu_site`,经知乎开放平台 MCP)、OpenAI / Gemini / Claude 模型内置搜索
33
33
  - **网页设置页** —— 引擎切换 + API key 配置(UI 中 key 脱敏显示"已配置")+ 中英文切换;入口在左侧「插件」页的组件行配置(`plugins.row.config`,DSH 0.1.7-rc.1+)。远程访问(VPS / 反向代理 / 自定义域名)下也能用:桥接接口沿用宿主的 Host 围栏,`--trusted-host` 与 `--public-url` 声明的地址会放行(#84)
34
34
  - **右侧浮动目录** —— 卡片右侧的页面留白里浮出「引擎 / 回退 / 语言池 / 搜索行为 / 抓取 / 性能」六个快捷跳转,滚动自动高亮当前项、点击平滑跳转;不占用正文宽度(正文布局与 0.9.6 一致),右侧留白不足时自动隐藏
35
- - **多 key 轮换** —— 任何 key 字段(或对应环境变量)都可以用逗号 / 分号 / 换行分隔多把 key;遇到 401/402/429(鉴权失败、额度耗尽)先轮换同一引擎的下一把,再走引擎回退
35
+ - **多 key 轮换** —— 任何 key 字段(或对应环境变量)都可以用逗号 / 分号 / 换行分隔多把 key;平时按请求轮流使用(round-robin,避免单 key 撞 QPS/RPM 风控),遇到 401/402/429(鉴权失败、额度耗尽、限流)先轮换同一引擎的下一把,再走引擎回退;`multi` 模式同样生效(#96)
36
36
  - **弹出式切换命令** —— 聊天框输入 `/free-search-engine`,弹出引擎选择窗口,点选即切换(等效设置页 + 保存)
37
37
  - **引擎测试** —— `free_search_test` 工具让 agent 一键测试所有引擎;设置页也有"测试引擎"按钮(直测当前引擎,不走回退链,付费引擎无 key 会明确报错)
38
38
  - **全局引擎开关与回退优先级** —— 设置页可勾选/取消引擎(取消后全局生效:普通搜索 / Auto / `advanced_search` / `multi_search` / 引擎测试都不再用它),并可用 ↑↓ 调整全局回退顺序(一键恢复默认)
@@ -46,7 +46,7 @@ dsh 默认的搜索 provider 依赖 DeepSeek 官方 API key(`DEEPSEEK_API_KEY`
46
46
  - **域名黑名单与安全搜索** —— `blockedDomains`:命中的域名不会进入任何结果;`safeSearch`(`off` / `moderate` / `strict`)为 Bing / DuckDuckGo 加一层过滤
47
47
  - **免费标注** —— 设置页中免费引擎带绿色 `FREE` 徽章,付费引擎带橙色 `API KEY` 徽章
48
48
  - **网页抓取(web_fetch)** —— 让 agent 抓取网页内容(官方 `dsh-web-fetch-http` provider,纯 JS,零额外依赖)
49
- - **平台搜索(platform_search)** —— 搜 GitHub / V2EX / B站 / Reddit / Hacker News / Stack Overflow / 维基百科 / npm / YouTube / Vimeo / 掘金 / 豆瓣 / Qiita(公开 API 或免 key 抓取,零依赖)
49
+ - **平台搜索(platform_search)** —— 搜 GitHub / V2EX / B站 / Reddit / Hacker News / Stack Overflow / 维基百科 / npm / YouTube / Vimeo / 掘金 / 豆瓣 / Qiita(公开 API 或免 key 抓取,零依赖);X (Twitter) 经本地 Grok Build CLI(需 SuperGrok / X Premium 登录)
50
50
  - **垂直领域直查(domain_search)** —— 41 个免 key 垂直源直查:包/版本(PyPI、crates、GitHub releases、endoflife…)、学术(arXiv、Crossref、OpenAlex、Semantic Scholar、PubMed、dblp、Zenodo…)、安全(NVD、OSV、CISA KEV)、金融(SEC EDGAR、IMF、World Bank、CFETS、Yahoo Finance、CoinGecko…)、**法律(US Federal Register、US CourtListener、openlegaldata、UK legislation)**、新闻(Google News、GDELT)等
51
51
  - **视频搜索(video_search)** —— 跨站找视频:Bing Videos + DuckDuckGo Videos(免 key,失败互相回退),返回视频链接、标题与来源/时长等元信息
52
52
  - **一次调用完成研究(research)** —— 多引擎并发搜索 → 候选重排 → 分层抓取正文 → 段落选窗 → 带出处的 Markdown 证据包;模型组件(重排/嵌入/决策模型)全部可选,缺失或失败时静默回退规则路径
@@ -211,7 +211,7 @@ DSH 0.2.1 设置 → 网页搜索 → **DeepSeek 搜索 API** 开关会和本插
211
211
  - **推荐**:付费引擎 key 建议写入 harness 凭据中心 `~/.dsh/.credentials.yaml`(如 `DEEPSEEK_API_KEY: sk-...`,与官方 LLM provider 一致,一处管理所有 key)。插件读取优先级:凭据中心 > 设置页 > 环境变量,设置页填的 key 仅作为遗留兼容。
212
212
  - **Test engine**:直测当前引擎可用性(不走回退链,付费引擎无 key 会明确报错)
213
213
  - **Use Bing default**:把当前搜索引擎切回稳定的免费 Bing;`Discard` 只撤销尚未保存的编辑
214
- - **Platform search**:勾选启用 GitHub / V2EX / Bilibili / Reddit / Hacker News / Stack Overflow / 维基百科 / npm / YouTube / Vimeo / 掘金 / 豆瓣 / Qiita 平台搜索(`platform_search` 工具按此过滤)
214
+ - **Platform search**:勾选启用 GitHub / V2EX / Bilibili / Reddit / Hacker News / Stack Overflow / 维基百科 / npm / YouTube / Vimeo / 掘金 / 豆瓣 / Qiita / X (Twitter) 平台搜索(`platform_search` 工具按此过滤)
215
215
  - **EN / 中文**:切换界面语言(默认中文)
216
216
 
217
217
  <table align="center" style="border: none; border-collapse: collapse;">
@@ -313,6 +313,7 @@ lang: zh # 搜索语言池/本地化(zh / en / ru …,不
313
313
  # weather 例外,另有日文(ja 得到日文天气,ru/de… 仍走英文)。
314
314
  # web_fetch(fs-quality-fetch)的 Accept-Language 同样跟随 lang,不再固定中文(#92)。
315
315
  uiLang: zh # 设置页界面语言(zh / en);留空则跟随 lang
316
+ promptLanguage: en # 注入给模型的系统提示词与工具描述语言(en / zh);只翻叙述文字,工具名/参数/枚举保持英文
316
317
  bingMarket: zh-CN # Bing 市场;留空 = 自动(不发送 mkt)
317
318
  fetchProviderTakeover: true # false = 保留你显式 pin 的 fetchProvider: http
318
319
  region: cn-zh # DuckDuckGo 区域(可选)
@@ -496,7 +497,7 @@ Search engine test:
496
497
 
497
498
  #### 离线自检断言(tools/)
498
499
 
499
- 仓库自带 **27 个**零依赖断言脚本(合计 **592 项**),**不需要 API key、不联网、不需要测试框架**,Node ≥ 20 即可跑:
500
+ 仓库自带 **31 个**零依赖断言脚本(合计 **622 项**),**不需要 API key、不联网、不需要测试框架**,Node ≥ 20 即可跑:
500
501
 
501
502
  | 脚本 | 覆盖 | 运行(项数) |
502
503
  |---|---|---|
@@ -519,7 +520,11 @@ Search engine test:
519
520
  | `assert-output-language.mjs` | 语言分支(#92):`searchLanguage` 支持 zh/en/ja/ru/de/es/fr/ko 其余回退 en、`outputLanguage` 只输出 zh/en、天气文案 zh/en/ja(其它回退英文,含 WMO 描述与正文)、置信度说明随语言、失败备注随语言 | `node tools/assert-output-language.mjs`(10) |
520
521
  | `assert-uncertainty.mjs` | 输出契约:0/1 源为 low、2 源与同站为 medium、3 个不同域为 high、时间过滤无日期、失败备注、聚合站提示 | `node tools/assert-uncertainty.mjs`(8) |
521
522
  | `assert-youcom.mjs` | You.com 免 key 档(#90):两档 URL 与请求头、无 key 不发 `X-API-Key`、`YDC_API_KEY` 别名、429/401/402/5xx 分类 | `node tools/assert-youcom.mjs`(23) |
523
+ | `assert-prompt-language.mjs` | 提示词语言(en/zh):语言回退、9 个工具双语文案、标识符不被翻译、占位符插值、切换时只重注册一次 | `node tools/assert-prompt-language.mjs`(7) |
522
524
  | `assert-tool-schema-size.mjs` | 工具 schema 体积(#94):共享引擎 id 常量、`domain_search` 不内嵌逐引擎句子、三处合计 < 1.6k 字符 | `node tools/assert-tool-schema-size.mjs`(5) |
525
+ | `assert-package-files.mjs` | 发布清单闸门(#97):`files` 展开后必须覆盖被引用的本地模块、入口点与 `cordis.patch.yml`,并确认 `prepack` 守卫生效 | `node tools/assert-package-files.mjs`(4) |
526
+ | `assert-key-rotation.mjs` | 多 key 轮换(#96):round-robin 与 peek、单 key 不推进、配额优先于 429 的分类、轮换候选集合、`multi` 模式内重试与预检不消耗 key | `node tools/assert-key-rotation.mjs`(7) |
527
+ | `assert-x-platform.mjs` | X (Twitter) 平台(Grok Build CLI):可用性、提示词约束、structuredOutput/text/原始 JSON 解析、status 链接过滤与截断、双语文案与面板默认值 | `node tools/assert-x-platform.mjs`(8) |
523
528
  | `assert-degoog.mjs` | degoog 自建实例(#85):`/api/search` URL 规范化、查询编码、`time`/`lang` 参数、注册表位置、无需凭据 | `node tools/assert-degoog.mjs`(7) |
524
529
  | `assert-multikey.mjs` | 多 key 字段:单 key 不变、逗号/分号/换行分隔、空白项丢弃、空输入为空数组 | `node tools/assert-multikey.mjs`(3) |
525
530
  | `assert-firecrawl-keyless.mjs` | Firecrawl keyless 出口判定:403 + VPN/proxy 文案才算拒绝、普通 403 与 401/429/500 不算、冷却初始未触发 | `node tools/assert-firecrawl-keyless.mjs`(5) |
@@ -578,7 +583,7 @@ This plugin provides multiple free search engines with automatic fallback, compl
578
583
  - **Multi-Engine Support** — DuckDuckGo (HTML / Lite), Bing, AnySearch AI, SearXNG (meta-search with custom instances), Exa, Tavily, Keenable, Firecrawl, Parallel, Perplexity, SerpBase, Serply, DeepSeek Official, You.com, Baidu Qianfan, Kimi, Aliyun Bailian, Volcano Doubao, Zhihu web-wide/site search (`zhihu_global`/`zhihu_site`, via the Zhihu open-platform MCP), and the model-based OpenAI / Gemini / Claude searches
579
584
  - **Web Settings UI** — Engine switching, API key configuration (keys masked as "configured" in the UI), and a Chinese/English toggle; the entry is the component-row config (`plugins.row.config`) on the sidebar Plugins page (DSH 0.1.7-rc.1+). Remote access (VPS, reverse proxy, custom domain) works too: the bridge reuses the host's own Host fence, so addresses declared with `--trusted-host` or `--public-url` are accepted (#84)
580
585
  - **Right-hand section rail** — A floating list (Engines / Fallback / Language pools / Search behaviour / Fetch / Performance) sits in the page margin to the right of the card: it highlights the section you are in while scrolling and jumps smoothly on click. It is rendered in a portal and never narrows the card, so the body layout is unchanged; it hides itself when the margin is too tight.
581
- - **Multi-key rotation** — Any key field (or its env var) accepts several keys separated by commas, semicolons or newlines; on 401/402/429 (bad key, quota exhausted) the same engine retries with the next key before the engine-level fallback runs
586
+ - **Multi-key rotation** — Any key field (or its env var) accepts several keys separated by commas, semicolons or newlines. Keys are used round-robin per request (so a single key never absorbs every call), and on 401/402/429 (bad key, quota exhausted, rate limited) the same engine retries with the next key before the engine-level fallback runs. This also applies inside `multi` mode (#96).
582
587
  - **Popup Switch Command** — Type `/free-search-engine` in the chat: a picker opens with all engines; click one to switch (equivalent to the settings page + save)
583
588
  - **Engine Testing** — `free_search_test` for the agent to check all engines in one call; the settings UI also has a "Test engine" button that tests the selected engine directly (no fallback chain; paid engines without a key report an explicit error)
584
589
  - **Global engine enable/disable & fallback priority** — uncheck engines you never want (applies everywhere: web_search fallback, Auto routing, advanced_search, multi_search, engine tests) and reorder the global fallback chain with ↑↓ (one-click reset)
@@ -592,7 +597,7 @@ This plugin provides multiple free search engines with automatic fallback, compl
592
597
  - **Domain blocklist & safe search** — `blockedDomains` keeps matching domains out of every result; `safeSearch` (`off` / `moderate` / `strict`) adds a filter layer for Bing / DuckDuckGo
593
598
  - **Visual Badges** — Free engines feature a green `FREE` badge, while paid engines show an orange `API KEY` badge in the settings UI
594
599
  - **Webpage Fetching (`web_fetch`)** — Allows the agent to read full webpage contents (official `dsh-web-fetch-http` provider, pure JS, zero extra dependencies)
595
- - **Platform Search (`platform_search`)** — Search GitHub / V2EX / Bilibili / Reddit / Hacker News / Stack Overflow / Wikipedia / npm / YouTube / Vimeo / Juejin / Douban / Qiita (public APIs or keyless scraping, zero extra dependencies)
600
+ - **Platform Search (`platform_search`)** — Search GitHub / V2EX / Bilibili / Reddit / Hacker News / Stack Overflow / Wikipedia / npm / YouTube / Vimeo / Juejin / Douban / Qiita (public APIs or keyless scraping, zero extra dependencies); X (Twitter) goes through the local Grok Build CLI (SuperGrok / X Premium sign-in)
596
601
  - **Vertical Lookups (`domain_search`)** — Direct lookup in 41 keyless vertical sources: packages/versions (PyPI, crates, GitHub releases, endoflife…), academia (arXiv, Crossref, OpenAlex, Semantic Scholar, PubMed, dblp, Zenodo…), security (NVD, OSV, CISA KEV), finance (SEC EDGAR, IMF, World Bank, CFETS, Yahoo Finance, CoinGecko…), **law (US Federal Register, US CourtListener, openlegaldata, UK legislation)**, news (Google News, GDELT) and more
597
602
  - **Video Search (`video_search`)** — Find videos across the web via Bing Videos + DuckDuckGo Videos (keyless, mutual fallback), returning video links with titles and publisher/duration metadata
598
603
  - **One-Call Research (`research`)** — Concurrent multi-engine search → candidate rerank → tiered body fetch → window selection → an evidence pack with provenance as Markdown; every model component (rerank / embedding / decision model) is optional and silently falls back to the rule path when missing or failing
@@ -758,7 +763,7 @@ The config page provides:
758
763
  - **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.
759
764
  - **Test engine**: Tests the selected engine directly (no fallback chain; paid engines without a key report an explicit error).
760
765
  - **Use Bing default**: stage a switch back to the stable free Bing engine; `Discard` only cancels unsaved edits
761
- - **Platform search**: check platforms (GitHub / V2EX / Bilibili / Reddit / HN / Stack Overflow / Wikipedia / npm / YouTube / Vimeo / Juejin / Douban / Qiita) to enable them for the `platform_search` tool (disabled platforms are skipped).
766
+ - **Platform search**: check platforms (GitHub / V2EX / Bilibili / Reddit / HN / Stack Overflow / Wikipedia / npm / YouTube / Vimeo / Juejin / Douban / Qiita / X (Twitter)) to enable them for the `platform_search` tool (unchecked platforms are skipped, and X needs Grok Build signed in).
762
767
  - **EN / 中文**: toggle the interface language (default Chinese).
763
768
 
764
769
  <table align="center" style="border: none; border-collapse: collapse;">
@@ -860,6 +865,7 @@ lang: zh # search language pools / localization (zh / en / ru
860
865
  # weather also has Japanese (ja gets Japanese weather text, ru/de… still get English).
861
866
  # web_fetch (fs-quality-fetch) sends the same Accept-Language instead of a fixed Chinese one (#92).
862
867
  uiLang: zh # settings UI language (zh / en); empty = follow lang
868
+ promptLanguage: en # language of the system prompt section and tool descriptions (en / zh); prose only - tool names, params and enums stay English
863
869
  bingMarket: zh-CN # Bing market; empty = automatic (no mkt sent)
864
870
  fetchProviderTakeover: true # false = keep the fetchProvider: http you pinned yourself
865
871
  region: cn-zh # DuckDuckGo region (optional)
@@ -1043,7 +1049,7 @@ Restart `dsh web` after switching to apply changes.
1043
1049
 
1044
1050
  #### Offline self-check assertions (`tools/`)
1045
1051
 
1046
- **Twenty-seven** zero-dependency assertion scripts ship with the repo (**592 assertions** total): **no API keys, no network, no test framework**, Node ≥ 20:
1052
+ **Thirty-one** zero-dependency assertion scripts ship with the repo (**622 assertions** total): **no API keys, no network, no test framework**, Node ≥ 20:
1047
1053
 
1048
1054
  | Script | Covers | Run (count) |
1049
1055
  |---|---|---|
@@ -1066,7 +1072,11 @@ Restart `dsh web` after switching to apply changes.
1066
1072
  | `assert-output-language.mjs` | language branches (#92): `searchLanguage` passes zh/en/ja/ru/de/es/fr/ko through and falls back to en, `outputLanguage` only returns zh/en, weather text has zh/en/ja (WMO descriptions and body; others fall back to English), and both confidence and failure notes follow the language | `node tools/assert-output-language.mjs` (10) |
1067
1073
  | `assert-uncertainty.mjs` | output contract: 0/1 source is low, two sources or a single site is medium, three distinct domains is high, time filter without dates, failure notes, aggregator caveat | `node tools/assert-uncertainty.mjs` (8) |
1068
1074
  | `assert-youcom.mjs` | You.com keyless tier (#90): both URLs and headers, no `X-API-Key` without a key, the `YDC_API_KEY` alias, and 429/401/402/5xx classification | `node tools/assert-youcom.mjs` (23) |
1075
+ | `assert-prompt-language.mjs` | Prompt language (en/zh): fallback rules, bilingual copy for all 9 tools, identifiers left untranslated, placeholder interpolation, and one re-registration per language change | `node tools/assert-prompt-language.mjs` (7) |
1069
1076
  | `assert-tool-schema-size.mjs` | Tool schema budget (#94): one shared engine-id constant, no per-engine sentences in `domain_search`, the three schemas under 1.6k chars combined | `node tools/assert-tool-schema-size.mjs` (5) |
1077
+ | `assert-package-files.mjs` | Packaging gate (#97): after expanding `files`, every imported local module, the entry points and `cordis.patch.yml` must be published, and the `prepack` guard must be wired | `node tools/assert-package-files.mjs` (4) |
1078
+ | `assert-key-rotation.mjs` | Multi-key rotation (#96): round-robin and peek, single keys never advancing, quota classification ahead of 429, the rotation-candidate set, and in-engine retries that keep multi-mode preflight from consuming keys | `node tools/assert-key-rotation.mjs` (7) |
1079
+ | `assert-x-platform.mjs` | X (Twitter) platform via the Grok Build CLI: availability, prompt guardrails, structuredOutput/text/raw JSON parsing, status-link filtering and caps, bilingual copy and panel defaults | `node tools/assert-x-platform.mjs` (8) |
1070
1080
  | `assert-degoog.mjs` | degoog self-hosted instance (#85): `/api/search` URL normalisation, query encoding, `time`/`lang` parameters, registry placement, no credentials needed | `node tools/assert-degoog.mjs` (7) |
1071
1081
  | `assert-multikey.mjs` | multi-key fields: a single key is unchanged, comma/semicolon/newline separate keys, blank entries are dropped, empty input yields none | `node tools/assert-multikey.mjs` (3) |
1072
1082
  | `assert-firecrawl-keyless.mjs` | Firecrawl keyless egress refusal: only a 403 with the VPN/proxy wording counts, plain 403 and 401/429/500 do not, and the cooldown starts inactive | `node tools/assert-firecrawl-keyless.mjs` (5) |
package/lib/client.js CHANGED
@@ -10,7 +10,7 @@ window.__ModuleLoader__.load({
10
10
 
11
11
  //#region css
12
12
  const css = [
13
- ".dshfs-card{font-family:-apple-system, \"SF Pro Text\", \"PingFang SC\", \"Segoe UI\", system-ui, sans-serif;border:1px solid rgba(0,0,0,.06);background:rgba(255,255,255,.72);backdrop-filter:blur(20px) saturate(180%);-webkit-backdrop-filter:blur(20px) saturate(180%);border-radius:14px;min-width:0;list-style:none;transition:all 180ms cubic-bezier(.4,0,.2,1);overflow:hidden;margin-bottom:12px;box-shadow:0 1px 2px rgba(0,0,0,.04), 0 10px 30px rgba(0,0,0,.06);color:#1d1d1f}",
13
+ ".dshfs-card{font-family:-apple-system, \"SF Pro Text\", \"PingFang SC\", \"Segoe UI\", system-ui, sans-serif;border:1px solid rgba(0,0,0,.06);background:rgba(255,255,255,.72);backdrop-filter:blur(20px) saturate(180%);-webkit-backdrop-filter:blur(20px) saturate(180%);border-radius:14px;min-width:0;list-style:none;transition:all 180ms cubic-bezier(.4,0,.2,1);overflow:hidden;overflow:clip;margin-bottom:12px;box-shadow:0 1px 2px rgba(0,0,0,.04), 0 10px 30px rgba(0,0,0,.06);color:#1d1d1f}",
14
14
  "@media (prefers-color-scheme: dark){.dshfs-card{background:rgba(30,30,32,.7);border:1px solid rgba(255,255,255,.08);color:#f5f5f7;box-shadow:0 1px 2px rgba(0,0,0,.2), 0 10px 30px rgba(0,0,0,.3)}}",
15
15
  ".dshfs-cardOpen{}",
16
16
  ".dshfs-header{width:100%;color:inherit;cursor:pointer;text-align:left;font:inherit;background:0 0;border:0;align-items:center;gap:12px;padding:16px 20px;display:flex;transition:background 180ms cubic-bezier(.4,0,.2,1)}",
@@ -37,7 +37,8 @@ window.__ModuleLoader__.load({
37
37
  ".dshfs-railDot{flex:none;width:4px;height:4px;border-radius:50%;background:currentColor;opacity:.45}",
38
38
  ".dshfs-railItemActive .dshfs-railDot{opacity:1;background:#0071e3}",
39
39
  "@media (prefers-color-scheme: dark){.dshfs-railItemActive .dshfs-railDot{background:#0a84ff}}",
40
- ".dshfs-footer{justify-content:space-between;align-items:center;gap:12px;display:flex;flex-wrap:wrap;padding-top:4px}",
40
+ ".dshfs-footer{justify-content:space-between;align-items:center;gap:12px;display:flex;flex-wrap:wrap;margin:4px -20px -20px;padding:10px 20px 12px;position:sticky;bottom:0;z-index:8;background:linear-gradient(180deg,rgba(255,255,255,0) 0%,rgba(250,250,252,.88) 26%,rgba(250,250,252,.96) 100%);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}",
41
+ "@media (prefers-color-scheme: dark){.dshfs-footer{background:linear-gradient(180deg,rgba(30,30,32,0) 0%,rgba(30,30,32,.88) 26%,rgba(30,30,32,.96) 100%)}}",
41
42
  ".dshfs-footerLeft{display:flex;align-items:center;gap:12px;flex-wrap:wrap;min-width:0}",
42
43
  ".dshfs-footerRight{display:flex;align-items:center;gap:10px;flex-wrap:wrap}",
43
44
  ".dshfs-star{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:6px;padding:8px 10px;border-radius:8px;border:1px solid rgba(0,0,0,.08);background:rgba(255,196,0,.06);color:inherit;text-decoration:none;font-size:12px;line-height:1.4}",
@@ -92,7 +93,7 @@ window.__ModuleLoader__.load({
92
93
  ".dshfs-priorityHandle{cursor:grab;color:#8e8e93;font-size:16px;line-height:1;padding:0 2px;user-select:none;flex:none}",
93
94
  "@media (prefers-color-scheme: dark){.dshfs-priorityHandle{color:#98989d}}",
94
95
  ".dshfs-priorityHandle:active{cursor:grabbing}",
95
- ".dshfs-priorityKey{flex:1;min-width:110px;max-width:200px;height:26px;padding:0 8px;font-size:12px;border:1px solid rgba(0,0,0,.12);border-radius:8px;background:transparent;color:inherit}",
96
+ ".dshfs-priorityKey{flex:1;min-width:110px;max-width:360px;height:26px;padding:0 8px;font-size:12px;border:1px solid rgba(0,0,0,.12);border-radius:8px;background:transparent;color:inherit}",
96
97
  "@media (prefers-color-scheme: dark){.dshfs-priorityKey{border-color:rgba(255,255,255,.14)}}",
97
98
  ".dshfs-priorityKey::placeholder{color:#8e8e93}",
98
99
  ".dshfs-keyStatus{flex:none;width:8px;height:8px;border-radius:50%;display:inline-block}",
@@ -219,27 +220,27 @@ window.__ModuleLoader__.load({
219
220
  poolAddFirst: "添加引擎…",
220
221
  poolRemove: "移除",
221
222
  poolReset: "恢复默认池",
222
- fallbackOnLabel: "回退触发条件(fallbackOn)",
223
+ fallbackOnLabel: "回退触发条件",
223
224
  fallbackOnHint: "勾选哪些失败类别允许触发回退到下一个引擎。全部勾选=保持现状(搜索永不直接失败);取消某类=遇到该类失败就停下并把该引擎的错误报出,不再换引擎。缺 key、被禁用、不支持时间过滤不算失败,始终会换引擎。",
224
- classQuota: "额度/预算耗尽 (quota)",
225
- classAuth: "鉴权失败 (auth)",
226
- classBotWall: "反爬拦截 (bot-wall)",
227
- classTransient: "超时/网络/限流 (transient)",
228
- classInvalidResponse: "解析失败/0 结果 (invalid-response)",
229
- classUnknown: "其他未知 (unknown)",
225
+ classQuota: "额度/预算耗尽",
226
+ classAuth: "鉴权失败",
227
+ classBotWall: "反爬拦截",
228
+ classTransient: "超时/网络/限流",
229
+ classInvalidResponse: "解析失败/0 结果",
230
+ classUnknown: "其他未知",
230
231
  priorityDisabled: "已禁用",
231
232
  platformSearch: "平台搜索(platform_search 工具)",
232
- platformHint: "为 agent 的 platform_search 工具启用平台。禁用的平台会被跳过。",
233
+ platformHint: "为 agent 的 platform_search 工具启用平台。未勾选的平台会被跳过。",
233
234
  cacheTtl: "结果缓存时长(分钟)",
234
235
  cacheTtlHint: "0 关闭缓存,最长 5 分钟。缩短可加快时效,延长可防限流、省额度。",
235
- multiMaxEngines: "Multi 并发引擎上限(multiMaxEngines)",
236
+ multiMaxEngines: "Multi 并发引擎上限",
236
237
  multiMaxEnginesHint: "Multi 模式最多同时查询几个引擎。0 = 不限制(默认,跑整个语言池,与旧版一致)。这是天花板不是配额:池里不够就少跑,不会凑数。",
237
- multiMinSources: "Multi 目标成功源数(multiMinSources)",
238
+ multiMinSources: "Multi 目标成功源数",
238
239
  multiMinSourcesHint: "希望至少几个引擎成功返回。不够时会自动用池外引擎补跑,达标即停。注意这是「尽量达到」而非硬性要求:补跑也达不到时仍会返回已有结果,只在备注里说明,不会让搜索失败。",
239
240
  multiPreset: "执行档位",
240
241
  multiPresetCustom: "自定义",
241
242
  multiPresetHint: (now) => `一键把上面两个数字设成常用组合(Fast = 1 并发 / 1 目标,Balanced = 3 / 1,Deep = 6 / 2);手改数字会自动回到「自定义」。当前:${now}。`,
242
- blockedDomainsLabel: "域名黑名单(blockedDomains)",
243
+ blockedDomainsLabel: "域名黑名单",
243
244
  blockedDomainsHint: "一行一个域名,命中的站点及其所有子域都会从搜索结果里剔除(csdn.net 覆盖 blog.csdn.net)。留空=不过滤。可以直接粘贴完整网址,scheme、路径和端口会被自动去掉。",
244
245
  blockedDomainsWarn: (corrected, dupes, dropped) => `已忽略 ${dupes} 个重复项、${dropped} 行无法识别;${corrected} 行已自动修正为裸域名。规则对下一次搜索生效,旧结果缓存会同步失效。`,
245
246
  unavailable: "设置不可用 —— free-search 桥接未暴露。",
@@ -271,8 +272,12 @@ window.__ModuleLoader__.load({
271
272
  safeSearchModerate: "中等 —— Bing 默认",
272
273
  safeSearchStrict: "严格",
273
274
  safeSearchHint: "作用于 Bing(adlt)、DuckDuckGo HTML / Lite(adlt 等级)。如遇引擎自带过滤可在此调整。",
275
+ promptLangLabel: "提示词语言(注入给模型)",
276
+ promptLangEn: "English",
277
+ promptLangZh: "中文",
278
+ promptLangHint: "系统提示词与工具描述的语言。只影响叙述文字,工具名/参数名/枚举值保持英文;切换后下一轮对话生效。",
274
279
  bingMarketLabel: "Bing 市场(本地化结果)",
275
- bingMarketHint: "Bing 的 mkt + Accept-Language 跟随此设置。例如 ru-RU 会让西里尔查询返回俄语结果。",
280
+ bingMarketHint: "Bing 的 mkt + Accept-Language 跟随此设置。",
276
281
  marketAuto: "自动 —— 不发送 mkt(推荐用于非上列地区)",
277
282
  fetchTakeoverLabel: "自动接管 web_fetch",
278
283
  fetchTakeoverHint: "开启时:web.fetchProvider 未设置或仍是出厂默认 http 会接管为 fs-quality-fetch。如果你刻意 pin 了 http(例如只想用内置抓取),关掉此项。",
@@ -348,27 +353,27 @@ window.__ModuleLoader__.load({
348
353
  poolAddFirst: "Add engine…",
349
354
  poolRemove: "Remove",
350
355
  poolReset: "Reset default pool",
351
- fallbackOnLabel: "Fallback triggers (fallbackOn)",
356
+ fallbackOnLabel: "Fallback triggers",
352
357
  fallbackOnHint: "Choose which failure classes may trigger a fallback to the next engine. All checked = current behaviour (search never fails outright); unchecking one means such a failure stops the search and surfaces that engine's error instead of trying another engine. Missing keys, disabled engines and unsupported time filters are not failures and always advance.",
353
- classQuota: "Quota/budget exhausted (quota)",
354
- classAuth: "Auth failure (auth)",
355
- classBotWall: "Anti-bot block (bot-wall)",
356
- classTransient: "Timeout/network/rate limit (transient)",
357
- classInvalidResponse: "Parse failure / 0 results (invalid-response)",
358
- classUnknown: "Other unknown (unknown)",
358
+ classQuota: "Quota/budget exhausted",
359
+ classAuth: "Auth failure",
360
+ classBotWall: "Anti-bot block",
361
+ classTransient: "Timeout/network/rate limit",
362
+ classInvalidResponse: "Parse failure / 0 results",
363
+ classUnknown: "Other unknown",
359
364
  priorityDisabled: "disabled",
360
365
  platformSearch: "Platform search (platform_search tool)",
361
- platformHint: "Enable platforms for the agent's platform_search tool. Disabled platforms are skipped.",
366
+ platformHint: "Enable platforms for the agent's platform_search tool. Unchecked platforms are skipped.",
362
367
  cacheTtl: "Result cache TTL (minutes)",
363
368
  cacheTtlHint: "0 disables caching, max 5 minutes. Lower = fresher results, higher = less rate-limiting / fewer credits used.",
364
- multiMaxEngines: "Multi concurrency ceiling (multiMaxEngines)",
369
+ multiMaxEngines: "Multi concurrency ceiling",
365
370
  multiMaxEnginesHint: "How many engines Multi may query at once. 0 = no limit (default, runs the whole language pool, same as before). This is a ceiling, not a quota: fewer candidates simply means fewer engines run.",
366
- multiMinSources: "Multi target successful sources (multiMinSources)",
371
+ multiMinSources: "Multi target successful sources",
367
372
  multiMinSourcesHint: "How many engines should ideally return results. Below target, extra engines from outside the pool are tried until it is met. This is a target, not a hard minimum: if it still cannot be met, existing results are returned and only a note is added — the search never fails for this reason.",
368
373
  multiPreset: "Preset",
369
374
  multiPresetCustom: "Custom",
370
375
  multiPresetHint: (now) => `One click sets the two numbers above to a common combination (Fast = 1 engine / 1 source, Balanced = 3 / 1, Deep = 6 / 2); editing them switches back to Custom. Current: ${now}.`,
371
- blockedDomainsLabel: "Domain blocklist (blockedDomains)",
376
+ blockedDomainsLabel: "Domain blocklist",
372
377
  blockedDomainsHint: "One domain per line. A matched site and all of its subdomains are dropped from search results (csdn.net covers blog.csdn.net). Leave empty to disable. Full URLs are accepted — scheme, path and port are stripped automatically.",
373
378
  blockedDomainsWarn: (corrected, dupes, dropped) => `Ignored ${dupes} duplicate(s) and ${dropped} unrecognized line(s); corrected ${corrected} line(s) to bare domains. Rules apply to the next search, and the result cache is invalidated accordingly.`,
374
379
  unavailable: "Settings unavailable — the free-search bridge is not exposed.",
@@ -400,8 +405,12 @@ window.__ModuleLoader__.load({
400
405
  safeSearchModerate: "Moderate - Bing default",
401
406
  safeSearchStrict: "Strict",
402
407
  safeSearchHint: "Applies to bing (adlt), ddg, ddg-lite (adlt degree). If you see the engine's own filtering, adjust here.",
408
+ promptLangLabel: "Prompt language (sent to the model)",
409
+ promptLangEn: "English",
410
+ promptLangZh: "Chinese",
411
+ promptLangHint: "Language of the system prompt section and tool descriptions. Only prose changes - tool names, parameters and enum values stay English. Applies from the next turn.",
403
412
  bingMarketLabel: "Bing market (localized results)",
404
- bingMarketHint: "Bing's mkt + Accept-Language follow this. e.g. ru-RU returns Russian results for Cyrillic queries.",
413
+ bingMarketHint: "Bing's mkt + Accept-Language follow this.",
405
414
  marketAuto: "Automatic — send no mkt (recommended outside the listed regions)",
406
415
  fetchTakeoverLabel: "Take over web_fetch automatically",
407
416
  fetchTakeoverHint: "On: when web.fetchProvider is unset or still the factory default http, it is taken over as fs-quality-fetch. Turn this off if you deliberately pinned http (e.g. you only want the built-in fetcher).",
@@ -428,7 +437,7 @@ window.__ModuleLoader__.load({
428
437
  };
429
438
  const tt = (lang) => I18N[String(lang ?? "").trim().toLowerCase() === "zh" ? "zh" : "en"];
430
439
  // 当前插件版本(与 lib/index.js 的 PLUGIN_VERSION 保持一致;跟随上游 v0.7.5)
431
- const PLUGIN_VERSION = "0.9.17";
440
+ const PLUGIN_VERSION = "0.9.19";
432
441
  const PLUGIN_REPO_URL = "https://github.com/DDDMUC/dsh-free-search";
433
442
  // 右侧浮动目录(#85):条目顺序即页面顺序,anchor 是页面里对应 field 的 id。
434
443
  const NAV_ITEMS = [
@@ -684,7 +693,7 @@ window.__ModuleLoader__.load({
684
693
  const [jinaKey, setJinaKey] = react.useState("");
685
694
  const [searxngToken, setSearxngToken] = react.useState("");
686
695
  const [degoogKey, setDegoogKey] = react.useState("");
687
- const [platforms, setPlatforms] = react.useState(["github", "v2ex", "bilibili", "reddit", "hn", "stackoverflow", "wikipedia", "npm", "youtube", "vimeo", "juejin", "douban", "qiita"]);
696
+ const [platforms, setPlatforms] = react.useState(["github", "v2ex", "bilibili", "reddit", "hn", "stackoverflow", "wikipedia", "npm", "youtube", "vimeo", "juejin", "douban", "qiita", "x"]);
688
697
  const [cacheTtl, setCacheTtl] = react.useState(5);
689
698
  const [multiMaxEngines, setMultiMaxEngines] = react.useState(0);
690
699
  const [multiMinSources, setMultiMinSources] = react.useState(1);
@@ -719,6 +728,7 @@ window.__ModuleLoader__.load({
719
728
  const [credConfigured, setCredConfigured] = react.useState({});
720
729
  const [lang, setLang] = react.useState("zh");
721
730
  const [uiLang, setUiLang] = react.useState("");
731
+ const [promptLanguage, setPromptLanguage] = react.useState("en");
722
732
  const [dirty, setDirty] = react.useState(false);
723
733
  const [saving, setSaving] = react.useState(false);
724
734
  const [failed, setFailed] = react.useState(false);
@@ -802,6 +812,7 @@ window.__ModuleLoader__.load({
802
812
  setFetchProviderTakeover(v.fetchProviderTakeover !== false);
803
813
  setLang(v.lang ?? "zh");
804
814
  setUiLang(typeof v.uiLang === "string" ? v.uiLang : "");
815
+ setPromptLanguage(v.promptLanguage === "zh" ? "zh" : "en");
805
816
  setAnysearchKey(v.anysearchApiKey ?? "");
806
817
  setExaKey(v.exaApiKey ?? "");
807
818
  setTavilyKey(v.tavilyApiKey ?? "");
@@ -825,7 +836,7 @@ window.__ModuleLoader__.load({
825
836
  setJinaKey(v.jinaApiKey ?? "");
826
837
  setSearxngToken(v.searxngBearerToken ?? "");
827
838
  setDegoogKey(v.degoogApiKey ?? "");
828
- setPlatforms(Array.isArray(v.platforms) && v.platforms.length > 0 ? v.platforms : ["github", "v2ex", "bilibili", "reddit", "hn", "stackoverflow", "wikipedia", "npm", "youtube", "vimeo", "juejin", "douban", "qiita"]);
839
+ setPlatforms(Array.isArray(v.platforms) && v.platforms.length > 0 ? v.platforms : ["github", "v2ex", "bilibili", "reddit", "hn", "stackoverflow", "wikipedia", "npm", "youtube", "vimeo", "juejin", "douban", "qiita", "x"]);
829
840
  setCacheTtl(v.cacheTtl === undefined ? 5 : Math.min(Math.max(Number(v.cacheTtl) ?? 5, 0), 5));
830
841
  // #69:multi 上限 0 = 不限制(旧行为);目标成功源数下限 1
831
842
  setMultiMaxEngines(v.multiMaxEngines === undefined ? 0 : Math.max(Number(v.multiMaxEngines) ?? 0, 0));
@@ -949,6 +960,7 @@ window.__ModuleLoader__.load({
949
960
  ops.push({ op: "set", path: ["fallbackOn"], value: normalizeFallbackOn(fallbackOn) });
950
961
  ops.push({ op: "set", path: ["blockedDomains"], value: parseBlockedDomains(blockedDomains).domains });
951
962
  ops.push({ op: "set", path: ["uiLang"], value: uiLang });
963
+ ops.push({ op: "set", path: ["promptLanguage"], value: promptLanguage });
952
964
  ops.push({ op: "set", path: ["keyStorage"], value: keyStorage });
953
965
  ops.push({ op: "set", path: ["safeSearch"], value: safeSearch });
954
966
  ops.push({ op: "set", path: ["bingMarket"], value: bingMarket });
@@ -1669,6 +1681,35 @@ react_jsx_runtime.jsx("div", {
1669
1681
  })(),
1670
1682
  ],
1671
1683
  }),
1684
+ react_jsx_runtime.jsx("div", {
1685
+ className: "dshfs-field",
1686
+ children: [
1687
+ react_jsx_runtime.jsx("div", {
1688
+ className: "dshfs-label",
1689
+ children: t.promptLangLabel,
1690
+ }),
1691
+ react_jsx_runtime.jsx("select", {
1692
+ className: "dshfs-select",
1693
+ value: promptLanguage,
1694
+ style: { colorScheme: selectColorScheme },
1695
+ disabled: !ready || saving,
1696
+ onChange: (e) => {
1697
+ setPromptLanguage(e.target.value === "zh" ? "zh" : "en");
1698
+ setDirty(true);
1699
+ setFailed(false);
1700
+ setSaveError("");
1701
+ },
1702
+ children: [
1703
+ react_jsx_runtime.jsx("option", { value: "en", children: t.promptLangEn }, "en"),
1704
+ react_jsx_runtime.jsx("option", { value: "zh", children: t.promptLangZh }, "zh"),
1705
+ ],
1706
+ }),
1707
+ react_jsx_runtime.jsx("p", {
1708
+ className: "dshfs-hint",
1709
+ children: t.promptLangHint,
1710
+ }),
1711
+ ],
1712
+ }),
1672
1713
  react_jsx_runtime.jsx("div", {
1673
1714
  className: "dshfs-field",
1674
1715
  children: [
@@ -1804,7 +1845,7 @@ react_jsx_runtime.jsx("div", {
1804
1845
  children: [
1805
1846
  ["github", "GitHub"], ["v2ex", "V2EX"], ["bilibili", "Bilibili"], ["reddit", "Reddit"],
1806
1847
  ["hn", "Hacker News"], ["stackoverflow", "Stack Overflow"], ["wikipedia", "Wikipedia"], ["npm", "npm"],
1807
- ["youtube", "YouTube"], ["vimeo", "Vimeo"], ["juejin", "掘金"], ["douban", "豆瓣"], ["qiita", "Qiita"],
1848
+ ["youtube", "YouTube"], ["vimeo", "Vimeo"], ["juejin", "掘金"], ["douban", "豆瓣"], ["qiita", "Qiita"], ["x", "X (Twitter)"],
1808
1849
  ].map(([id, label]) =>
1809
1850
  react_jsx_runtime.jsx("label", {
1810
1851
  className: "dshfs-platform",