dsh-web-search-plugin 0.4.1 → 0.5.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,64 @@
2
2
 
3
3
  本项目的重要变更都记录在此。格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/)。
4
4
 
5
+ ## [未发布]
6
+
7
+ ## [0.5.1] - 2026-10-10
8
+
9
+ ### 新增
10
+
11
+ - 自定义网页搜索图标:采用与官方图标协调的蓝绿渐变和地球放大镜造型,通过包元数据提供给插件列表、详情及包含的组件。
12
+
13
+ ### 变更
14
+
15
+ - DeepSeek 官方搜索默认模型更新为 `deepseek-flash`,同步 Host 配置、后端回退、设置卡和中英文 README;保留用户显式配置的模型名。
16
+ - 供应商专用配置统一增加前缀:Tavily 使用 `tavily*`,DeepSeek 搜索选项使用 `deepseek*`,Brave 使用 `brave*`;Scavio 的地区与语言选项独立为 `scavioCountry`、`scavioSearchLang`。通用的 `provider`、`maxResults` 保持不变。
17
+ - 保留旧字段兼容读取;新字段优先,包括显式空字符串和 `false`。设置卡保存新名称,恢复默认时处理当前 Profile 的旧别名,并保留另一引擎依赖的旧共享地区或语言值。
18
+ - 设置卡隐藏 API 协议版本输入框,保留 `deepseekApiVersion` 高级配置与旧 `apiVersion` 兼容。
19
+
20
+ ### 文档
21
+
22
+ - README 提供英文主版与独立中文版,补充插件优势、设置卡配置步骤和配置范围;优先建议在卡片中选择 DeepSeek(官方),需要恢复 Harness 内置插件时再关闭整个组合包。
23
+
24
+ ## [0.5.0] - 2026-10-09
25
+
26
+ ### 新增
27
+
28
+ - **适配 DeepSeek Harness `0.2.0-rc.2`**:四个 DSH peerDependencies 提升到 `^0.2.0-rc.2`,`@deepseek-ai/cordis` / `@deepseek-ai/schemastery` 对齐 `~4.0.4` / `~3.18.4`;版本号与 `User-Agent` 更新为 `0.5.0`。
29
+ - DeepSeek 后端支持账号令牌认证:会话 provider 为 `deepseek-account` 时通过 `deepseekAccount.resolveToken()` 获取令牌并以 `x-dsh-auth-token` 发送,未授权时回落到 `DEEPSEEK_API_KEY`。
30
+ - 有会话发起者时,DeepSeek 搜索在派发前记录脱敏请求到会话事件 `web/deepseek-search-llm-request`,与官方 provider 行为一致。
31
+ - 插件列表页与详情页的标题、描述随界面语言切换:`locale/en.json` 与 `locale/zh.json`,经 `"./locale/*.json"` 导出(与官方 bundle 同一机制)。卡片内文案由 `lib/client.js` 的 `zh` / `en` 字典提供。
32
+ - README 整理:修正与实现脱节的仓库布局与安装说明。
33
+
34
+ ### 移除
35
+
36
+ - **`settings.installSection()` 已从 Harness 移除**:Host 侧改为全部配置字段声明 `volatile()`,并在 `apply` 中通过 `config.<field>.get()` 读取实时值。插件不再调用 `ctx.inject(["settings"])`,也不再维护 `setSource` / `current()` 这条配置来源链。
37
+ - **客户端 `settingsScope` 服务已移除**:浏览器端改用 `ctx.configForms`。设置分区通过 `configForms.whileServed([namespace], register)` 条件注册,Host 未下发该命名空间时不留痕迹。`inject` 中的 `settingsScope` 同步替换为 `configForms`。
38
+ - 设置分区不再自行注册 Host 设置卡:0.2.x 的设置由当前 Profile 的插件配置保存,`client.js` 的分区只负责展示与写入。
39
+
40
+ ### 修复
41
+
42
+ - Exa 请求改用 `numResults` 与对象形态的 `contents.highlights`;SearXNG 不再发送其 API 未定义的 `count` 参数。
43
+ - 插件 `maxResults` 与调用方上限取较小值,避免常规 `web_search` 请求覆盖设置卡上限;未选中的引擎不再解析其凭据引用,设置卡校验引用名格式。
44
+ - Tavily 用量只保留当前凭据的内存数据,换 key 后立即重新对账;手动刷新限速改为 10 秒,自动刷新不受手动限速约束。
45
+ - Firecrawl 搜索按 API 要求发送数组形态的 `sources`;REST 元数据的空 `countParam` 不再被强制改为 `max_results`。
46
+ - DeepSeek 与 REST 后端按配置的 `maxResults` 截取超额结果,并标记 `truncated`。
47
+ - 网页搜索设置分区随 Host 配置命名空间出现和撤销;凭据写入失败时保留草稿并显示失败提示。
48
+ - 同时修改凭据引用名与 API key 时,密钥写入新的引用名;DeepSeek 账号令牌预检响应取消并统一映射错误。
49
+ - Tavily 与 DeepSeek 的空端点配置恢复环境变量回退;Tavily 手动刷新额度增加最短请求间隔。
50
+ - 设置卡把配置改动按同一 revision 原子提交;Host 拒绝写入时保留草稿,保存期间锁定编辑。写入新凭据时清空该引擎的字面量 key 覆盖,使新凭据生效。
51
+ - 更新 Serper 冒烟脚本,使用当前导出的 `RestSearchProvider` 与内置元数据。
52
+
53
+ ### 文档
54
+
55
+ - 澄清本插件注册的接缝 id 是 `dsh-web-search`,`deepseek-official` 只是内部引擎选项;同步修正 bundle patch、卸载说明和会话事件说明。
56
+ - 对齐 README 的端点默认值、环境变量优先级和 API key 保存位置。
57
+
58
+ ### 说明
59
+
60
+ - `cordis.patch.yml` 禁用内置 `web-search-deepseek`,使此 bundle 统一管理 DeepSeek 搜索配置;本插件注册的接缝 id 为 `dsh-web-search`。
61
+ - Bundle patch 仍使用单文件声明(0.1.7 起支持的多文件有序声明为可选能力,未启用)。
62
+
5
63
  ## [0.4.1] - 2026-09-10
6
64
 
7
65
  ### 变更
@@ -82,7 +140,7 @@
82
140
  - Brave 月限额 `0` 的套餐按控制台 **Capacity** 展示每秒窗口(例如 50 次/秒),不再把月配额渲染成「已用 0 / 0」。Brave 没有花费/credits 接口。
83
141
  - 数字框只接受不小于 1 的整数;非法输入用红色错误文案替换灰色 hint,保存会被拦住。超出 20 的结果数量会夹到上限。
84
142
 
85
- ## [0.2.0] - 2026-08-19
143
+ ## [0.2.0] - 2026-08-18
86
144
 
87
145
  ### 新增
88
146
 
package/README.md CHANGED
@@ -1,216 +1,335 @@
1
1
  # dsh-web-search-plugin
2
2
 
3
- 面向 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) web 能力接缝(`ctx.web`)的统一网页搜索插件,内置 **DeepSeek(官方,默认)/ Tavily / [Brave Search](https://brave.com/search/api/) / Serper / SerpApi / Exa / SearXNG / Scavio / Firecrawl 九个后端**。本包只向接缝注册 **一个** `WebSearchProvider`,稳定 id 为 `dsh-web-search`。在 **设置 → 网页搜索** 里切换引擎即可,不必再改 `web.searchProvider`。
3
+ English | [中文](./README.zh.md)
4
4
 
5
- - **DeepSeek(官方,默认)** — 走 DeepSeek 的 Anthropic 兼容 Messages API(原生 `web_search_20250305` 工具,凭据名 `DEEPSEEK_API_KEY`),一次搜索消耗一个模型轮次。
6
- - **Tavily** — `keyless`(免费、限流、无需账号)或 `keyed`(`TAVILY_API_KEY`,Bearer token)。keyed 会在设置卡显示额度进度条。
7
- - **Brave Search** — `GET https://api.search.brave.com/res/v1/web/search`,请求头 `X-Subscription-Token`(凭据名 `BRAVE_API_KEY`)。一次搜索就是一次 HTTP 请求,不走模型轮次;设置卡按响应头展示 Capacity / 月配额。
8
- - **Serper** — Google 结果(`POST /search`,头 `X-API-KEY`,凭据名 `SERPER_API_KEY`)。
9
- - **SerpApi** — `GET /search.json`,key 走 query(`api_key=`),凭据名 `SERPAPI_API_KEY`。
10
- - **Exa** — 语义/神经搜索(`POST /search`,Bearer,凭据名 `EXA_API_KEY`)。
11
- - **SearXNG** — 自建/协议免 key 的元搜索(`GET /search?format=json`),可填自托管实例地址。
12
- - **Scavio** — Google SERP(`POST /api/v2/google`,Bearer,凭据名 `SCAVIO_API_KEY`),响应与 SerpApi 同构。
13
- - **Firecrawl** — 搜索+抓取(`POST /v2/search`,Bearer,凭据名 `FIRECRAWL_API_KEY`),`sources: ["web"]`。
14
- - **DuckDuckGo** — 无官方搜索 API,不提供独立后端;下拉中以禁用项提示:选 SearXNG 并指向聚合了 DuckDuckGo 的实例即可。
15
- - **官方 key 跳转** — 需要 key 的内置 provider 在设置卡带「获取 API key ↗」一键跳官方控制台;免 key 的(SearXNG / Tavily keyless)不渲染。
16
- - **不写自定义 session 事件** — 工具结果已经走接缝自己的事件,无需多余信封。
5
+ A web search plugin for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH) that gives your agent more search options through Harness's existing `web_search` tool. Choose from **nine providers** and manage engines, API keys, and search options in **Settings → Web search**.
17
6
 
18
- ## 特性
7
+ ## Why use this plugin?
19
8
 
20
- - 与官方 `@deepseek-ai/dsh-web-search-deepseek` 相同的提供方约定:`inject: ['web']` + `ctx.settings.installSection` + `ctx.web.registerSearchProvider`。
21
- - 顶层 **设置 → 网页搜索** 分区:两列布局、未保存草稿、保存 toast;结果数量为 1–20 下拉。
22
- - **默认引擎为 DeepSeek(官方)**:新装 / 未显式改动时,搜索直接走 `deepseek-official`,不再依赖 keyless 的 Tavily。
23
- - 纯 REST 后端由**静态元数据表 + 通用后端**驱动,新增 provider 即"表里加一行 + 官方跳转链接",无定制执行代码。
24
- - Tavily keyless 无需密钥即可用;Brave 需要订阅 token(若本机已有 `BRAVE_API_KEY` 凭据,可直接复用)。
25
- - Tavily keyed / Brave 在设置卡展示额度进度条(DeepSeek 官方与 Tavily keyless / 其余 REST 后端不展示)。
26
- - 各引擎结果都规范化为接缝的 `WebSearchResult`(可选 `content` + `sources[]`),按 URL 去重。
27
- - 设置段 `dsh-web-search-plugin` 通过 dsh 的 `settings.installSection` 注册、由 `settings.describe()` 动态暴露,不需要宿主白名单补丁,也不需要自建回环 settings 桥。
28
- - 错误映射为 `WEB_PROVIDER_ERROR` / `WEB_ABORTED` / `WEB_PROVIDER_CREDENTIAL_MISSING`。
9
+ - **Avoid an extra DeepSeek model call for search.** The eight third-party backends call search APIs directly instead of DeepSeek's official model-backed search endpoint. This avoids the additional DeepSeek model token usage for that search request. (Your conversation and the model's processing of search results still use tokens, and search providers may charge their own fees or credits.)
10
+ - **Configure everything in a settings card.** Switch engines, enter keys, and adjust result limits in **Settings → Web search**, then save. Changes take effect on the next search without restarting the plugin or editing YAML.
11
+ - **Choose the search service that fits your needs.** Use Google results through Serper, semantic search through Exa, or a self-hosted SearXNG instance. Tavily's keyless mode lets you try search without an account or API key.
12
+ - **Return to built-in search with one switch.** Turn off the entire `dsh-web-search-plugin` bundle in the sidebar's **Plugins** page to remove its search overrides and restore Harness's built-in DeepSeek search under the standard profile configuration. See [Disable or uninstall](#disable-or-uninstall).
29
13
 
30
- ## 运行要求
14
+ **The default engine is still DeepSeek (official).** To avoid the extra official search model call, select a third-party engine in the settings card after installation and save your changes. Selecting DeepSeek (official) uses the official search API and may incur model invocation charges.
31
15
 
32
- - DeepSeek Harness `0.1.5-rc.1` 或兼容版本
33
- - Node.js `^22.19.0` 或 `>=24.0.0`
34
- - pnpm,用于通过 `dsh plugin` 把插件装进 profile
16
+ ## Supported providers
35
17
 
36
- ## 安装
18
+ - **DeepSeek (official, default)** — Uses DeepSeek's Anthropic-compatible Messages API with the native search tool type `web_search_20250305`. Supports account tokens or `DEEPSEEK_API_KEY`. Each search sends a model request and may incur model invocation charges.
19
+ - **Tavily** — Supports `keyless` access (free, rate-limited, no account required) or `keyed` access (`TAVILY_API_KEY`, Bearer token). The settings card shows a quota bar in keyed mode.
20
+ - **Brave Search** — Calls `GET https://api.search.brave.com/res/v1/web/search` with the `X-Subscription-Token` header (credential name: `BRAVE_API_KEY`). Each search is one HTTP request and does not consume a model turn. The settings card displays Capacity and monthly quota from response headers.
21
+ - **Serper** — Google results via `POST /search`, using the `X-API-KEY` header (credential name: `SERPER_API_KEY`).
22
+ - **SerpApi** — Calls `GET /search.json` with the key in the query string (`api_key=`; credential name: `SERPAPI_API_KEY`).
23
+ - **Exa** — Semantic/neural search via `POST /search` with Bearer authentication (credential name: `EXA_API_KEY`). Requests `contents.highlights` for result summaries.
24
+ - **SearXNG** — Metasearch with no API key required by the protocol. Calls `GET /search?format=json` and supports a self-hosted instance URL. The instance must enable JSON output.
25
+ - **Scavio** — Google SERP via `POST /api/v2/google` with Bearer authentication (credential name: `SCAVIO_API_KEY`). Uses the same response structure as SerpApi.
26
+ - **Firecrawl** — Web search via `POST /v2/search` with Bearer authentication (credential name: `FIRECRAWL_API_KEY`) and `sources: ["web"]`. Full-page scraping is not enabled in the current request.
37
27
 
38
- 本包是 **bundle**:`dsh.bundle.patch` + `cordis.patch.yml` 会插入 Host 行、把 `web.searchProvider` 设为 `dsh-web-search`,并**禁用内置 `web-search-deepseek` Host 插件**(本插件已自行托管 DeepSeek 后端,禁用它能移除旧的「插件 → 网页搜索」卡片、避免重复注册 provider)。没有这一声明时,`dsh plugin add` 只写入依赖,插件不会挂载。
28
+ For DuckDuckGo results, choose a SearXNG instance that aggregates DuckDuckGo. DuckDuckGo appears only as a disabled hint in the engine selector.
39
29
 
40
- ### 从 npm 安装
30
+ ## Requirements
31
+
32
+ - DeepSeek Harness `0.2.0-rc.2` or a compatible `0.2.x` release
33
+ - Node.js `^22.19.0` or `>=24.0.0`
34
+ - pnpm, used by `dsh plugin` to install the plugin into a profile
35
+
36
+ ## Installation
37
+
38
+ ### Install from npm
41
39
 
42
40
  ```powershell
43
41
  dsh plugin --profile web add dsh-web-search-plugin
44
42
  ```
45
43
 
46
- > 从源码仓库本地安装(含 Windows 跨盘注意事项)见 [开发 → 本地安装与验证](#本地安装与验证)。
44
+ After installation, configure the plugin in the Harness Web UI:
45
+
46
+ 1. Open **Settings → Web search** and find the plugin's settings card. The sidebar's **Plugins** page controls whether the bundle is enabled; engine settings live in this card.
47
+ 2. Choose a search engine. For direct API search without an extra DeepSeek model call, select Tavily, Brave, Serper, SerpApi, Exa, SearXNG, Scavio, or Firecrawl.
48
+ 3. Enter the engine's API key if required. Engines that require a key show “Get API key ↗”, which opens the official dashboard. For Tavily without a key, choose `keyless`; for SearXNG, set an instance URL with JSON search enabled. These two keyless options do not show a key dashboard link. Existing credentials can be reused, such as `BRAVE_API_KEY` for Brave.
49
+ 4. Adjust the result limit and other options, then click **Save**. The next search uses the saved engine and settings.
47
50
 
48
- ## 配置
51
+ > For installation from a local source checkout, including Windows cross-drive considerations, see [Development → Local installation and verification](#local-installation-and-verification).
49
52
 
50
- 设置卡编辑的是 `dsh-web-search-plugin` 命名空间:
53
+ ## Configuration
51
54
 
52
- | 键 | 默认值 | 含义 |
55
+ For normal use, configure the plugin in **Settings → Web search**. The card shows options for the selected engine and saves ordinary settings to the current profile's `dsh-web-search-plugin` configuration. The tables below describe the underlying configuration, including advanced fields hidden from the card; not every field is shown at once.
56
+
57
+ ### General settings
58
+
59
+ | Key | Default | Meaning and scope |
53
60
  |---|---|---|
54
- | `provider` | `deepseek-official` | `tavily`、`brave`、`deepseek-official`、`serper`、`serpapi`、`exa`、`searxng`、`scavio` 或 `firecrawl` |
55
- | `mode` | `keyless` | 仅 Tavily:`keyless` 或 `keyed` |
56
- | `apiKey` | — | Tavily API key 字面量(走凭据域,不会回显) |
57
- | `apiKeyEnv` | `TAVILY_API_KEY` | keyed Tavily 使用的凭据/环境变量名 |
58
- | `baseURL` | `https://api.tavily.com` | Tavily REST 基址;会再拼 `/search` |
59
- | `maxResults` | `8` | 每次搜索返回的源数量,各后端共用。设置卡为 1–20 下拉,超出上限会夹到 20 |
60
- | `searchDepth` | `basic` | 仅 Tavily:`basic` 或 `advanced` |
61
- | `includeAnswer` | `true` | 仅 Tavily:请求生成摘要,写入结果 `content` |
62
- | `topic` | `general` | 仅 Tavily:`general` 或 `news` |
63
- | `deepseekApiKey` | — | DeepSeek API key 字面量(走凭据域) |
64
- | `deepseekApiKeyEnv` | `DEEPSEEK_API_KEY` | DeepSeek 使用的凭据/环境变量名 |
65
- | `deepseekBaseURL` | `https://api.deepseek.com/anthropic/v1` | DeepSeek Anthropic 兼容 Messages 基址;再拼 `/messages` |
66
- | `model` | `deepseek-v4-flash` | Anthropic 格式模型名 |
67
- | `apiVersion` | `2023-06-01` | `anthropic-version` 请求头 |
68
- | `maxTokens` | `4096` | Messages 请求生成 token 上限 |
69
- | `maxUses` | `5` | 每次请求 `web_search` 工具的最大调用次数 |
70
- | `braveApiKey` | — | Brave 订阅 token 字面量(走凭据域) |
71
- | `braveApiKeyEnv` | `BRAVE_API_KEY` | Brave 使用的凭据/环境变量名 |
72
- | `braveBaseURL` | `https://api.search.brave.com/res/v1/web/search` | Brave 网页搜索接口 |
73
- | `country` | — | Brave 的 `country`(ISO 两位码,如 `cn`);留空使用 Brave 默认 |
74
- | `searchLang` | — | Brave 的 `search_lang`(如 `zh-hans`);留空使用 Brave 默认 |
75
- | `freshness` | — | Brave 的 `freshness`:`pd` / `pw` / `pm` / `py` |
76
- | `proxy` | — | Brave 使用的 HTTP(S) 代理覆盖;留空继承 DSH 的全局 `HTTP_PROXY` / `HTTPS_PROXY` / `ALL_PROXY` / `NO_PROXY` 策略 |
77
- | `serperApiKey` / `serperApiKeyEnv` / `serperBaseURL` | — / `SERPER_API_KEY` / — | Serper 的 key 字面量 / 凭据引用名 / 端点覆盖 |
78
- | `serpapiApiKey` / `serpapiApiKeyEnv` / `serpapiBaseURL` | — / `SERPAPI_API_KEY` / — | SerpApi 的 key 字面量 / 凭据引用名 / 端点覆盖 |
79
- | `exaApiKey` / `exaApiKeyEnv` / `exaBaseURL` | — / `EXA_API_KEY` / — | Exa 的 key 字面量 / 凭据引用名 / 端点覆盖 |
80
- | `searxngBaseURL` | — | SearXNG 自托管实例基址;留空用 `https://searx.be` |
81
- | `scavioApiKey` / `scavioApiKeyEnv` / `scavioBaseURL` | — / `SCAVIO_API_KEY` / — | Scavio 的 key 字面量 / 凭据引用名 / 端点覆盖 |
82
- | `firecrawlApiKey` / `firecrawlApiKeyEnv` / `firecrawlBaseURL` | — / `FIRECRAWL_API_KEY` / — | Firecrawl 的 key 字面量 / 凭据引用名 / 端点覆盖 |
83
-
84
- ## 未纳入的服务
85
-
86
- 以下服务**不内置**(在引擎下拉中不会出现,也不提供后端):
87
-
88
- | 服务 | 不做的原因 |
89
- |---|---|
90
- | **TinyFish** | 免费额度极小(每分钟 5 次);其 Search + Fetch 形态超出"纯 REST 搜索"边界,仅搜索部分价值低 |
91
- | **Google CSE** | 官方已对新用户关闭注册,并将于 2027-01-01 停用 |
92
- | **SERPJET** | 官网当前不可访问,暂不接入 |
93
- | **DuckDuckGo** | 无官方搜索 API(HTML/社区库抓取不符合元数据表"纯 REST"边界)。下拉中有禁用提示,指引经 SearXNG 使用 |
94
-
95
- 环境变量:启动时 `DSH_WEB_SEARCH_PROVIDER=dsh-web-search` 会选中本接缝 id。未设置 `baseURL` 时,Tavily 基址回退 `$TAVILY_BASE_URL`。
96
-
97
- ## 额度
98
-
99
- - **Tavily keyless / DeepSeek 官方**:不展示额度条。前者是免费限流、没有账户配额;后者按次扣费、没有月度限额。
100
- - **Tavily keyed**:搜索时请求 `include_usage`,把本次 credits 累加到 `%DSH_HOME%\storages\dsh-web-search-usage.json`。Host 每 10 分钟(以及设置卡点刷新)调用 `GET /usage`,用 `account.current_plan` / `plan_limit` 做限额,用量取本地累计与远端的较大值。换套餐或远端用量回落会重置本地计数。
101
- - **Brave**:没有 usage / 花费接口。控制台 **Capacity** 就是响应头里的每秒窗口(例如 50 次/秒)。月限额 `0` 表示不限请求次数,不是额度用完。计费 credits 只能看 [Brave API 控制台](https://api-dashboard.search.brave.com/)。
102
- - 浏览器只读 `GET /dsh-web-search/usage`(不直打上游)。进度条:剩余超过 20% 为绿色,不超过 20% 为黄色,不超过 10% 为红色。
103
-
104
- ## 切回内置 DeepSeek
105
-
106
- DeepSeek 已并入本插件(`provider: deepseek-official`),无需切回。若确要恢复 DSH 内置的 DeepSeek host 插件,请在 profile patch 里去掉对 `web-search-deepseek` 的 `disabled` 并把 `searchProvider` 设回 `deepseek-official`;本插件可以继续挂着,只是不会被选中。
107
-
108
- ## 工作方式
109
-
110
- - **DeepSeek** — `POST {deepseekBaseURL}/messages`,请求头 `x-api-key` / `authorization: Bearer`,工具 `web_search_20250305`。
111
- - **纯 REST 类(Tavily / Brave / Serper / SerpApi / Exa / SearXNG)** — 由静态元数据表(`lib/providers.js`)+ 通用后端(`lib/rest.js`)驱动,无独立定制代码。请求方法 / 路径 / 查询字段名 / 鉴权(bearer / header / none / query)/ 固定参数 / 响应形态全部由表里的行决定。
112
- - **Tavily** — `POST {baseURL}/search`。keyless 发送 `x-tavily-access-mode: keyless`;keyed 发送 `authorization: Bearer <key>`,并带 `include_usage` 回传 credits。
113
- - **Brave** — `GET {braveBaseURL}?q=&count=`,请求头 `x-subscription-token`。不向 session 追加自定义事件。
114
- - **Serper / SerpApi / Exa / SearXNG** — 按各自表的 `method` / `auth` / `params` 约定请求。
115
- - 非 2xx 映射为 `WEB_PROVIDER_ERROR`;调用方取消映射为 `WEB_ABORTED`。
116
-
117
- ## 仓库布局
61
+ | `provider` | `deepseek-official` | Active engine: `deepseek-official`, `tavily`, `brave`, `serper`, `serpapi`, `exa`, `searxng`, `scavio`, or `firecrawl`. Each request uses only the selected engine, with no automatic failover to another engine on error. Unknown values fall back to official DeepSeek |
62
+ | `maxResults` | `8` | Maximum returned sources for all engines, from 1–20, also capped by the caller's `request.maxResults`. SearXNG and Scavio send no request-level count parameter; their results are truncated after retrieval and URL deduplication. The upstream response determines how many results are actually available |
63
+
64
+ ### Keys and credential references
65
+
66
+ **The card's “API Key” input differs from the literal configuration fields below.** When you enter and save a new key, the card writes it under the current engine's credential reference rather than storing the plaintext key in plugin configuration. It also sets the corresponding literal field to an empty string so an old configuration key cannot override the new credential. Leaving the input blank preserves the existing key; it does not delete it. Use Harness's credential management capabilities to delete a credential.
67
+
68
+ | Engine | Literal configuration field | Credential reference field | Default reference |
69
+ |---|---|---|---|
70
+ | DeepSeek (API key authentication) | `deepseekApiKey` | `deepseekApiKeyEnv` | `DEEPSEEK_API_KEY` |
71
+ | Tavily (`keyed` only) | `tavilyApiKey` | `tavilyApiKeyEnv` | `TAVILY_API_KEY` |
72
+ | Brave | `braveApiKey` | `braveApiKeyEnv` | `BRAVE_API_KEY` |
73
+ | Serper | `serperApiKey` | `serperApiKeyEnv` | `SERPER_API_KEY` |
74
+ | SerpApi | `serpapiApiKey` | `serpapiApiKeyEnv` | `SERPAPI_API_KEY` |
75
+ | Exa | `exaApiKey` | `exaApiKeyEnv` | `EXA_API_KEY` |
76
+ | Scavio | `scavioApiKey` | `scavioApiKeyEnv` | `SCAVIO_API_KEY` |
77
+ | Firecrawl | `firecrawlApiKey` | `firecrawlApiKeyEnv` | `FIRECRAWL_API_KEY` |
78
+
79
+ All literal fields default to an empty string. A manually configured nonempty literal key takes priority. Otherwise, the plugin resolves the reference through **the credentials service → the Harness launching environment → process environment variables**, in that order. `*ApiKeyEnv` holds a reference name, not the key itself; the card requires names matching `[A-Za-z_][A-Za-z0-9_]*`.
80
+
81
+ Official DeepSeek account sessions (provider: `deepseek-account`) first try an account token authorized for the endpoint by the account service. If no token is obtained, search uses the API key path above. Tavily `keyless` and SearXNG search requests require no API key. Configuring a Tavily key does not automatically select `keyed`; choose that mode explicitly. The current SearXNG backend has no instance-token or custom authentication-header setting.
82
+
83
+ Credential writes and profile configuration saves happen in separate steps. Failed saves retain the draft, but successfully written credentials are not automatically rolled back. Prefer the card for everyday key management to avoid storing plaintext literals in configuration files.
84
+
85
+ ### Endpoints
86
+
87
+ The table lists the addresses used when no custom endpoint or environment override is provided. Normally, you do not need to enter an endpoint. Tavily and DeepSeek also support endpoint overrides through the launching environment.
118
88
 
89
+ | Key | Default address | Address rules |
90
+ |---|---|---|
91
+ | `deepseekBaseURL` | `https://api.deepseek.com/anthropic/v1` | DeepSeek Anthropic-compatible Messages base: nonempty configuration → `DEEPSEEK_SEARCH_BASE_URL` in the launching environment → default address; appends `/messages` |
92
+ | `tavilyBaseURL` | `https://api.tavily.com` | Tavily base: nonempty configuration → `TAVILY_BASE_URL` in the launching environment → default address; appends `/search` |
93
+ | `braveBaseURL` | `https://api.search.brave.com/res/v1/web/search` | Full web search endpoint; no path is appended |
94
+ | `serperBaseURL` | `https://google.serper.dev` | Appends `/search` |
95
+ | `serpapiBaseURL` | `https://serpapi.com` | Appends `/search.json` |
96
+ | `exaBaseURL` | `https://api.exa.ai` | Appends `/search` |
97
+ | `searxngBaseURL` | `https://searx.be` | Appends `/search?format=json` with the search query; the instance must allow JSON search. The default address is not guaranteed to work; a self-hosted instance can be used |
98
+ | `scavioBaseURL` | `https://api.scavio.dev` | Appends `/api/v2/google` |
99
+ | `firecrawlBaseURL` | `https://api.firecrawl.dev` | Appends `/v2/search` |
100
+
101
+ Changing an engine's address does not change its request method, authentication, or response parsing. Custom endpoints must implement the corresponding engine's protocol; replacing a URL alone cannot connect an arbitrary search API. Except for Brave, omit the automatically appended paths listed above when entering a base URL. Engines other than Tavily and DeepSeek fall back to their built-in address when the effective address setting is empty, with no additional dedicated environment variable fallback.
102
+
103
+ Clearing a text input or using “Restore default” in the card normally removes the current profile's override and uses the inherited or default value. This differs from manually writing an empty string into configuration. Endpoint fallbacks are evaluated against the effective configuration value.
104
+
105
+ ### Provider-specific options
106
+
107
+ <table>
108
+ <thead>
109
+ <tr><th>Provider</th><th>Key</th><th>Default</th><th>Meaning and scope</th></tr>
110
+ </thead>
111
+ <tbody>
112
+ <tr>
113
+ <td rowspan="4"><strong>DeepSeek (official)</strong></td>
114
+ <td><code>deepseekModel</code></td>
115
+ <td><code>deepseek-flash</code></td>
116
+ <td>Model used only for the DeepSeek search request; does not change the conversation's chat model. Must be supported by the target endpoint</td>
117
+ </tr>
118
+ <tr>
119
+ <td><code>deepseekApiVersion</code></td>
120
+ <td><code>2023-06-01</code></td>
121
+ <td>Value of the <code>anthropic-version</code> header. Hidden from the settings card and retained as advanced configuration; normally leave at the default</td>
122
+ </tr>
123
+ <tr>
124
+ <td><code>deepseekMaxTokens</code></td>
125
+ <td><code>4096</code></td>
126
+ <td>Maximum generated tokens for one DeepSeek Messages search request, a positive integer; not a conversation-wide token limit</td>
127
+ </tr>
128
+ <tr>
129
+ <td><code>deepseekMaxUses</code></td>
130
+ <td><code>5</code></td>
131
+ <td>Maximum native <code>web_search</code> tool uses within one DeepSeek Messages request, a positive integer; not an engine retry count or result count</td>
132
+ </tr>
133
+ <tr>
134
+ <td rowspan="4"><strong>Tavily</strong></td>
135
+ <td><code>tavilyMode</code></td>
136
+ <td><code>keyless</code></td>
137
+ <td>Tavily only: keyless access (<code>keyless</code>) or API key access (<code>keyed</code>); does not control authentication for other engines</td>
138
+ </tr>
139
+ <tr>
140
+ <td><code>tavilySearchDepth</code></td>
141
+ <td><code>basic</code></td>
142
+ <td>Tavily only: <code>basic</code> or <code>advanced</code>, sent as <code>search_depth</code></td>
143
+ </tr>
144
+ <tr>
145
+ <td><code>tavilyIncludeAnswer</code></td>
146
+ <td><code>true</code></td>
147
+ <td>Tavily only: requests <code>include_answer: true</code> when enabled. The current shared REST backend omits the parameter when disabled; if upstream still returns an answer, it can still become result <code>content</code>. This does not guarantee removal of all answer text</td>
148
+ </tr>
149
+ <tr>
150
+ <td><code>tavilyTopic</code></td>
151
+ <td><code>general</code></td>
152
+ <td>Tavily only: <code>general</code> or <code>news</code></td>
153
+ </tr>
154
+ <tr>
155
+ <td rowspan="4"><strong>Brave</strong></td>
156
+ <td><code>braveCountry</code></td>
157
+ <td>Empty string</td>
158
+ <td>Brave only: sent as <code>country</code> (two-letter country code, such as <code>cn</code>); omitted when the effective value is empty</td>
159
+ </tr>
160
+ <tr>
161
+ <td><code>braveSearchLang</code></td>
162
+ <td>Empty string</td>
163
+ <td>Brave only: sent as <code>search_lang</code> (such as <code>zh-hans</code>); omitted when the effective value is empty</td>
164
+ </tr>
165
+ <tr>
166
+ <td><code>braveFreshness</code></td>
167
+ <td>Empty string</td>
168
+ <td>Brave only: <code>pd</code> / <code>pw</code> / <code>pm</code> / <code>py</code> for the past day / week / month / year. Empty means no time filter</td>
169
+ </tr>
170
+ <tr>
171
+ <td><code>braveProxy</code></td>
172
+ <td>Empty string</td>
173
+ <td>Explicit HTTP(S) proxy override for Brave only. If empty, no separate proxy is set and Harness's global network policy applies. Other engines do not use this field</td>
174
+ </tr>
175
+ <tr>
176
+ <td rowspan="2"><strong>Scavio</strong></td>
177
+ <td><code>scavioCountry</code></td>
178
+ <td>Empty string</td>
179
+ <td>Scavio only: sent as <code>gl</code>, using a country/region code accepted by that service; omitted when the effective value is empty</td>
180
+ </tr>
181
+ <tr>
182
+ <td><code>scavioSearchLang</code></td>
183
+ <td>Empty string</td>
184
+ <td>Scavio only: sent as <code>hl</code>, using a language code accepted by that service; omitted when the effective value is empty. New settings are independent of Brave</td>
185
+ </tr>
186
+ </tbody>
187
+ </table>
188
+
189
+ The startup environment variable `DSH_WEB_SEARCH_PROVIDER=dsh-web-search` selects Harness's registered search provider ID, not this plugin's `provider` engine option. Installing the bundle normally selects the provider already, so this variable is not required.
190
+
191
+ ## Quotas
192
+
193
+ - **DeepSeek (official)**: No quota bar. Search still makes a model request, with usage subject to your account or API billing.
194
+ - **Tavily keyless**: No quota bar; access is free and rate-limited.
195
+ - **Tavily keyed**: Requests `include_usage` during searches and accumulates credits for the current credential in memory. The Host periodically calls `GET /usage`, and the settings card supports manual refresh. Manual refreshes must be at least 10 seconds apart; automatic reconciliation is not subject to this limit. The quota comes from `account.current_plan` / `plan_limit`; usage is the larger of the local total for the current credential and the remote value. Changing keys clears the previous account's usage and triggers immediate reconciliation. Tavily quota data is no longer persisted to disk.
196
+ - **Brave**: No usage/spending endpoint. Dashboard **Capacity** represents the per-second window from response headers (for example, 50 requests/second). A monthly limit of `0` means unlimited requests, not an exhausted quota. Billing credits are available only in the [Brave API dashboard](https://api-dashboard.search.brave.com/).
197
+ - The browser reads only `GET /dsh-web-search/usage` and does not call upstream services directly. Quota bars are green when more than 20% remains, yellow at 20% or less, and red at 10% or less.
198
+
199
+ ## Disable or uninstall
200
+
201
+ ### Switch to DeepSeek (official) first
202
+
203
+ If you only want to use official search again, select **DeepSeek (official)** in **Settings → Web search** and save. There is no need to disable or uninstall this plugin. The next search uses the official search API through this plugin and may still incur model invocation charges.
204
+
205
+ ### Disable and restore built-in search
206
+
207
+ Use the following steps when you want to stop using this plugin and restore Harness's original search plugin. Selecting this plugin's DeepSeek engine and restoring the original plugin are separate operations.
208
+
209
+ Open **Plugins** in the sidebar and turn off the **entire `dsh-web-search-plugin` bundle**. Under the standard Harness profile configuration, this removes the bundle's search-provider override and its override disabling the built-in DeepSeek plugin, restoring built-in search without uninstalling the package. You can turn the bundle back on later.
210
+
211
+ Use the bundle's main switch: disabling only an individual component inside the bundle leaves its other configuration overrides in place. Profiles with configuration hot reload apply the change immediately; otherwise, restart Harness.
212
+
213
+ If you manually set `web.searchProvider: dsh-web-search`, `DSH_WEB_SEARCH_PROVIDER=dsh-web-search`, or a separate override disabling the built-in DeepSeek plugin, also remove or revert those overrides. The bundle switch does not undo settings you added separately.
214
+
215
+ ### Uninstall the package
216
+
217
+ To remove the installed package as well, run:
218
+
219
+ ```powershell
220
+ dsh plugin --profile web remove dsh-web-search-plugin
119
221
  ```
120
- lib/index.js Host 插件:Config、按元数据分发提供方、设置段、额度路由
121
- lib/providers.js 静态元数据表:内置 REST provider 的请求/鉴权/响应/官方跳转(纯数据,无定制代码)
122
- lib/rest.js 通用 REST 后端:按元数据驱动请求构造与响应规范化(可选 hooks)
123
- lib/deepseek.js DeepSeek 后端(Anthropic Messages + web_search_20250305,模型工具型专用)
124
- lib/tavily.js Tavily 选项解析 / 响应映射(额度由 Tavily hook 回传)
125
- lib/brave.js Brave 选项解析 / 响应映射(解析 X-RateLimit-*)
126
- lib/usage.js Tavily/Brave 用量本地缓存与 /usage 对账
127
- lib/shared.js 中止 / 凭据解析辅助
128
- lib/client.js 浏览器 bundle:顶层「网页搜索」分区 + 引擎切换 + 官方 key 跳转 + 额度条
129
- cordis.patch.yml Bundle patch:插入 Host 行、设 searchProvider、禁用内置 deepseek
222
+
223
+ The same checks for manually added overrides apply after uninstallation. If you explicitly selected `dsh-web-search`, remove that override to use the profile default, or set `web.searchProvider` back to `deepseek-official`.
224
+
225
+ ## How it works
226
+
227
+ The plugin registers a single `WebSearchProvider` with the stable ID `dsh-web-search` through `ctx.web`, following the same provider contract as `@deepseek-ai/dsh-web-search-deepseek` (`inject: ['web']` and `ctx.web.registerSearchProvider`). Switching internal engines does not require changing `web.searchProvider`. Results are normalized to `WebSearchResult` (optional `content` and `sources[]`) and deduplicated by URL. All configuration fields use `volatile()`, so saved settings are read without restarting the plugin.
228
+
229
+ This package is a **bundle**. The `dsh.bundle.patch` declaration points to `cordis.patch.yml`, which adds the Host entry, selects `dsh-web-search`, and disables the built-in `web-search-deepseek` Host plugin while the bundle is enabled. The plugin's internal `deepseek-official` engine option is distinct from its registered `dsh-web-search` ID. Disabling the entire bundle removes this patch layer; disabling only its Host entry does not. Without a bundle declaration, `dsh plugin add` only adds the dependency and does not mount the plugin.
230
+
231
+ - **DeepSeek** — Calls `POST {deepseekBaseURL}/messages` with the `web_search_20250305` tool. If the session uses the official DeepSeek account route (provider: `deepseek-account`) and the account service allows the endpoint, the request uses an account token in `x-dsh-auth-token`. Otherwise, it falls back to an API key (`x-api-key` / `authorization: Bearer`, credential name: `DEEPSEEK_API_KEY`). When a session initiator is available, a redacted request is recorded as the session event `web/deepseek-search-llm-request` before dispatch.
232
+ - **REST backends (Tavily / Brave / Serper / SerpApi / Exa / SearXNG / Scavio / Firecrawl)** — Driven by a static metadata table (`lib/providers.js`) and a shared backend (`lib/rest.js`). Table rows define the request method, path, query field names, authentication (`bearer` / `header` / `none` / `query`), fixed parameters, and response shape. REST backends do not append custom session events.
233
+ - **Tavily** — Calls `POST {tavilyBaseURL}/search`. Keyless mode sends `x-tavily-access-mode: keyless`; keyed mode sends `authorization: Bearer <key>` and requests `include_usage` for credits.
234
+ - **Brave** — Calls `GET {braveBaseURL}?q=&count=` with the `x-subscription-token` header. Does not append custom session events.
235
+ - **The other six REST engines** — Follow their metadata entries' `method`, `auth`, and `params` definitions.
236
+ - Non-2xx responses map to `WEB_PROVIDER_ERROR`; caller cancellation maps to `WEB_ABORTED`; missing credentials map to `WEB_PROVIDER_CREDENTIAL_MISSING`.
237
+
238
+ ## Repository layout
239
+
240
+ ```text
241
+ lib/config.js Supplier field naming and legacy configuration resolution
242
+ lib/index.js Host plugin: volatile Config, metadata-based provider dispatch, quota routes
243
+ lib/deepseek.js DeepSeek backend: Anthropic Messages, web_search_20250305, account tokens
244
+ lib/providers.js Static metadata: requests/auth/responses/API key links for 8 REST providers (plus DeepSeek in deepseek.js, for 9 backends total)
245
+ lib/rest.js Shared REST backend: metadata-driven requests and response normalization, including Tavily/Brave quota and rate-limit hooks
246
+ lib/tavily.js Dedicated Tavily backend and option parsing (current dispatch uses the shared REST backend)
247
+ lib/brave.js Dedicated Brave backend and option parsing (current dispatch uses the shared REST backend)
248
+ lib/usage.js Local Tavily/Brave usage cache and /usage reconciliation
249
+ lib/shared.js Cancellation and credential resolution helpers
250
+ lib/client.js Browser bundle: settings section, engine switching, API key links, quota bars
251
+ locale/en.json English titles and descriptions for plugin list/detail pages
252
+ locale/zh.json Chinese titles and descriptions for the same pages
253
+ cordis.patch.yml Bundle patch: adds Host entry, sets searchProvider, disables built-in DeepSeek
130
254
  ```
131
255
 
132
- ## 开发
256
+ ## Development
133
257
 
134
- ### 本地安装与验证
258
+ ### Local installation and verification
135
259
 
136
- 改源码后本机验证,把仓库装进某个 profile(以 `web` 为例)。**同盘**可以直接用相对路径:
260
+ After editing the source, install the checkout into a profile (using `web` as the example) for local verification. If the checkout and profile are on the **same drive**, you can use a relative path:
137
261
 
138
262
  ```powershell
139
263
  dsh plugin --profile web add ".\dsh-web-search-plugin"
140
264
  ```
141
265
 
142
- **Windows 跨盘不要 `dsh plugin add` 绝对路径。** Profile 在 `C:`、仓库在 `D:` 时,它会写成 `link:d:/...`;pnpm 把盘符当成相对路径,junction 会指到 `profiles\web\D:\...` 并链坏。也不要写 `file:D:/...`:pnpm 10 同样会把跨盘绝对路径拼进 profile 目录。
143
-
144
- 正确做法是快照到与 profile **同盘**,再用 `file:`:
266
+ **On Windows, do not pass an absolute path to `dsh plugin add` across drives.** If the profile and checkout are on different drives, the dependency is written as `link:` or `file:` with an absolute drive letter. pnpm treats the drive letter as a relative path, leaving the junction pointing to a nonexistent directory. Copy a snapshot of the checkout onto the **same drive** as the profile, then use a relative `file:` reference:
145
267
 
146
268
  ```powershell
147
269
  $dst = "$env:USERPROFILE\.dsh\profiles\web\.local\dsh-web-search-plugin"
148
- New-Item -ItemType Directory -Force -Path $dst | Out-Null
149
- robocopy "D:\sample\dsh-web-search-plugin" $dst /E /XD node_modules .git .github /NFL /NDL /NJH /NJS
270
+ robocopy "<repository-path>" $dst /E /XD node_modules .git .github .snapshots .workbuddy docs /NFL /NDL /NJH /NJS
150
271
  ```
151
272
 
152
- 在 profile 的 `package.json` 里:
273
+ In the profile's `package.json`:
153
274
 
154
275
  ```json
155
276
  "dsh-web-search-plugin": "file:.local/dsh-web-search-plugin"
156
277
  ```
157
278
 
158
- 并保证 `dsh.profile.bundles` 含本包,然后:
279
+ Ensure that `dsh.profile.bundles` includes this package, then run:
159
280
 
160
281
  ```powershell
161
282
  dsh plugin --profile web install
162
283
  ```
163
284
 
164
- `file:` 是快照:改完仓库后要再 robocopy + `install` 并重启 DSH。
285
+ `file:` is a snapshot: after source changes, copy the files again with robocopy, run `install`, and restart DSH. If you change the package's `files` field, pnpm may consider the snapshot unchanged and skip the update; remove `node_modules/dsh-web-search-plugin` before reinstalling in that case.
165
286
 
166
- 用 `dsh --profile web --dump-config` 确认:组成树里应有 `dsh-web-search-plugin` 行,且 `web.searchProvider` 为 `dsh-web-search`。
287
+ Use `dsh --profile web --dump-config` to verify that the composition tree includes `dsh-web-search-plugin` and that `web.searchProvider` is `dsh-web-search`.
167
288
 
168
- > **关于 `file:`(本地)安装** — pnpm 会把 `file:` 依赖做成快照。改完本仓库后,需要再同步快照并 `dsh plugin --profile web install`,然后重启。Windows 上 profile 与仓库不在同一盘时,用同盘 `file:.local/...`,不要 `link:` / `file:` 指向另一块盘。
289
+ ### Syntax checks
169
290
 
170
- ### 迁移旧后端包
291
+ ```powershell
292
+ npm run check
293
+ npm test
294
+ ```
171
295
 
172
- 若 profile 已经覆盖了 `web`(例如旧包 `@dsh-ltctfer/dsh-web-search-brave` 留下的 `brave-official`),后打的 patch 仍会生效。请改指向本插件,并卸掉旧包:
296
+ The client bundle must retain the `window.__ModuleLoader__.load({ id, factory })` wire format: it is loaded by `dsh-client-modules`, not a bundler. It must export both `apply` and `inject` (`slots`, `locale`, `remote`, `remote.credentials`, `configForms`).
173
297
 
174
- ```yaml
175
- - id: web
176
- name: '@deepseek-ai/dsh-web'
177
- config:
178
- searchProvider: dsh-web-search
179
- ```
298
+ The configuration card is hosted in **Settings → Web search** (`settings.section`, `id: "web-search"`). Its data comes from `ctx.configForms.get("dsh-web-search-plugin")`, and registration is conditional through `configForms.whileServed([namespace], register)`. When the Host does not serve this namespace, the card is not registered.
180
299
 
181
- ```powershell
182
- dsh plugin --profile web remove @dsh-ltctfer/dsh-web-search-brave
183
- ```
300
+ The plugin does not show configuration on the plugin detail page (`plugins.bundle.config`).
184
301
 
185
- 然后在 **设置 → 网页搜索** 里把引擎切到想要的提供方,即可继续使用对应的 API key。
302
+ ## Localization
186
303
 
187
- ### 语法检查
304
+ Plugin list and detail page titles and descriptions use `locale/<lang>.json` and follow the interface language:
188
305
 
189
- ```powershell
190
- npm run check
306
+ ```text
307
+ locale/en.json {"meta": {"title": "Web search", "description": "…"}}
308
+ locale/zh.json {"meta": {"title": "网页搜索", "description": "…"}}
191
309
  ```
192
310
 
193
- 客户端 bundle 必须保持 `window.__ModuleLoader__.load({ id, factory })` 线格式 — 由 `dsh-client-modules` 加载,不是打包器。必须同时导出 `apply` 和 `inject`(`slots`、`locale`、`remote`、`settingsScope`),并把分区注册进 `settings.section`(`id: "web-search"`)。
311
+ Settings card text comes from the `zh` and `en` dictionaries in `lib/client.js`. Keep their keys aligned when editing them.
194
312
 
195
- ## 发布
313
+ ## Publishing
196
314
 
197
- 发布由 GitHub Actions(`.github/workflows/publish.yml`)自动完成:**推送 `v*` 标签**(例如 `v0.3.0`)会带 provenance 发到 npm。向 `main` 的普通推送不会发布。
315
+ GitHub Actions (`.github/workflows/publish.yml`) handles publishing automatically. **Pushing a `v*` tag that matches the version in `package.json`** publishes to npm with provenance. Ordinary pushes to `main` do not publish a package.
198
316
 
199
- 1. 确认 `package.json` 的 `version` 与即将推送的标签一致(例如 `0.3.0` → `v0.3.0`)。
200
- 2. 在 GitHub **Settings → Secrets and variables → Actions** 里配置有 publish 权限的 npm automation token(仓库密钥 `NPM_TOKEN`),并允许 Actions 运行。
201
- 3. 打标签并推送:
317
+ 1. Check that `package.json`'s `version` matches the tag you will push, and add a nonempty `## [version]` section for that version in `CHANGELOG.md`.
318
+ 2. Configure an npm automation token with publishing permissions as the repository secret `NPM_TOKEN` under GitHub **Settings → Secrets and variables → Actions**, and enable Actions.
319
+ 3. Tag and push:
202
320
 
203
321
  ```powershell
204
- git tag v0.3.0
205
- git push origin v0.3.0
322
+ $version = node -p "require('./package.json').version"
323
+ git tag "v$version"
324
+ git push origin "v$version"
206
325
  ```
207
326
 
208
- 工作流会先核对标签与 `package.json` 的 `version`,再执行 `npm publish --provenance --access public`。
327
+ The workflow checks that the tag matches `package.json`'s `version` and that the corresponding release notes in `CHANGELOG.md` are nonempty, then runs `npm publish --provenance --access public`.
209
328
 
210
- ## 参与贡献
329
+ ## Contributing
211
330
 
212
- 欢迎提 issue 和 pull request,见 [issue tracker](https://github.com/X-C1811/dsh-web-search-plugin/issues)。还可以在同一接缝 id 下继续加搜索后端。
331
+ Issues and pull requests are welcome. See the [issue tracker](https://github.com/X-C1811/dsh-web-search-plugin/issues). Additional search backends can be added under the same registered provider ID.
213
332
 
214
- ## 许可证
333
+ ## License
215
334
 
216
335
  [MIT](LICENSE)