dsh-web-search-plugin 0.2.1 → 0.3.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,42 @@
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
+ ## [0.3.1] - 2026-08-30
6
+
7
+ ### 修复
8
+
9
+ - **Tavily keyless 模式失效**:通用 REST 后端不再在 keyless 模式下强制解析 API key;无 key 时只发送 `x-tavily-access-mode: keyless`,可正常使用免费额度。
10
+ - **POST 类 provider 的 count 参数类型错误**:Tavily `max_results`、Serper `num`、Exa `num_results`、Firecrawl `limit` 等在 JSON body 中恢复为数字,不再被强转字符串。
11
+ - **Scavio / Firecrawl 设置卡严重卡死**:补齐浏览器端缺失的 `scavioApiKeyEnv` / `scavioBaseURL` / `firecrawlApiKeyEnv` / `firecrawlBaseURL` 表单字段与投影,修复切换后输入框无法输入、引擎无法切换的问题。
12
+ - **Scavio / Firecrawl 默认凭据名错误**:未显式填写 keyEnv 时分别回退到 `SCAVIO_API_KEY` / `FIRECRAWL_API_KEY`,不再错误使用 `EXA_API_KEY`。
13
+ - **Brave 环境代理回退丢失**:恢复 `HTTPS_PROXY` / `HTTP_PROXY` 环境变量回退,未显式配置 `proxy` 时也能按环境代理请求。
14
+ - `User-Agent` 更新为 `0.3.1`。
15
+
16
+ ### 优化
17
+
18
+ - 内置 REST 渠道(Serper / SerpApi / Exa / SearXNG / Scavio / Firecrawl)的 Base URL 默认值预填到设置卡,切换渠道后不再是空 URL。
19
+
20
+ ## [0.3.0] - 2026-08-25
21
+
22
+ ### 新增
23
+
24
+ - **内置 REST provider 元数据化**(`lib/providers.js` 静态表 + `lib/rest.js` 通用后端):内置 REST 供应商由单一元数据表驱动,新增即"表里加一行 + 官方跳转链接",零定制执行代码。
25
+ - 新增内置 provider:**Serper / SerpApi / Exa / SearXNG / Scavio / Firecrawl**(`provider` 值 `serper` / `serpapi` / `exa` / `searxng` / `scavio` / `firecrawl`)。
26
+ - Firecrawl 响应 `data.web[]` 走专用 `firecrawl` 解析分支;Scavio 复用 `organic_results` 解析。
27
+ - DuckDuckGo 无官方 API:下拉以禁用项提示经 SearXNG 使用,不提供独立后端。
28
+ - 元数据字段:`method`(GET/POST)/ `queryIn`(query-string / body)/ `queryParam` / `countParam` / `params[]`(`when: always` / `nonEmpty` / `keyed` / `keyless`,受限谓词清单)/ `auth.type`(bearer / header / none / **query**)/ `response` / `hooks` / `officialUrl`。
29
+ - 通用后端 `RestSearchProvider` 接管 brave / tavily / serper / serpapi / exa / searxng / scavio / firecrawl;`deepseek-official`(模型工具型)仍走专用 `lib/deepseek.js`。
30
+ - Tavily 额度回传、Brave 限流头/代理作为可选 hook 注入,通用体不写死业务逻辑。
31
+ - 设置卡对需要 key 的内置 provider 渲染「获取 API key ↗」跳官方控制台;免 key 的(SearXNG / Tavily keyless)不渲染。
32
+
33
+ ### 变更
34
+
35
+ - **默认引擎从 `tavily` 改为 `deepseek-official`**:schema 默认、服务端/客户端回退、bundle patch 初始值一致改为官方默认(已保存的显式 `provider` 不被覆盖)。
36
+ - `provider` 取值扩展为 `tavily` / `brave` / `deepseek-official` / `serper` / `serpapi` / `exa` / `searxng` / `scavio` / `firecrawl`。
37
+ - **修复 Tavily `include_answer` 类型错误**:`params[]` 布尔值不再强转字符串,请求体发真布尔(`true`/`false`),兼容 Tavily API 对 `include_answer` / `include_images` / `include_usage` 的类型要求。
38
+ - **修复 SearXNG 卡片误显「获取 API key ↗」**:仅需要 key 的 provider 才显示获取 key 跳转,免 key 的(SearXNG / Tavily keyless)不显示。
39
+ - **收紧未配置 key 的提示文案**:placeholder 缩短为「未配置密钥」,补充说明移至输入框下方提示,避免溢出。以下未纳入内置:TinyFish、Google CSE、SERPJET(官网不可访问)、DuckDuckGo(无官方 API,经 SearXNG 使用)。
40
+
5
41
  ## [0.2.1] - 2026-08-18
6
42
 
7
43
  相对 0.2.0 的补丁:设置卡补上额度进度条、两列布局和输入校验,并收紧空态文案。
package/README.md CHANGED
@@ -1,18 +1,28 @@
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/) 三个后端**。本包只向接缝注册 **一个** `WebSearchProvider`,稳定 id 为 `dsh-web-search`。在 **设置 → 网页搜索** 里切换引擎即可,不必再改 `web.searchProvider`。
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`。
4
4
 
5
- - **DeepSeek(官方)** — 走 DeepSeek 的 Anthropic 兼容 Messages API(原生 `web_search_20250305` 工具,凭据名 `DEEPSEEK_API_KEY`),一次搜索消耗一个模型轮次。
6
- - **Tavily(默认)** — `keyless`(免费、限流、无需账号)或 `keyed`(`TAVILY_API_KEY`,Bearer token)。keyed 会在设置卡显示额度进度条。
5
+ - **DeepSeek(官方,默认)** — 走 DeepSeek 的 Anthropic 兼容 Messages API(原生 `web_search_20250305` 工具,凭据名 `DEEPSEEK_API_KEY`),一次搜索消耗一个模型轮次。
6
+ - **Tavily** — `keyless`(免费、限流、无需账号)或 `keyed`(`TAVILY_API_KEY`,Bearer token)。keyed 会在设置卡显示额度进度条。
7
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)不渲染。
8
16
  - **不写自定义 session 事件** — 工具结果已经走接缝自己的事件,无需多余信封。
9
17
 
10
18
  ## 特性
11
19
 
12
20
  - 与官方 `@deepseek-ai/dsh-web-search-deepseek` 相同的提供方约定:`inject: ['web']` + `installSettingsSection` + `ctx.web.registerSearchProvider`。
13
21
  - 顶层 **设置 → 网页搜索** 分区:两列布局、未保存草稿、保存 toast;结果数量为 1–20 下拉。
22
+ - **默认引擎为 DeepSeek(官方)**:新装 / 未显式改动时,搜索直接走 `deepseek-official`,不再依赖 keyless 的 Tavily。
23
+ - 纯 REST 后端由**静态元数据表 + 通用后端**驱动,新增 provider 即"表里加一行 + 官方跳转链接",无定制执行代码。
14
24
  - Tavily keyless 无需密钥即可用;Brave 需要订阅 token(若本机已有 `BRAVE_API_KEY` 凭据,可直接复用)。
15
- - Tavily keyed / Brave 在设置卡展示额度进度条(DeepSeek 官方与 Tavily keyless 不展示)。
25
+ - Tavily keyed / Brave 在设置卡展示额度进度条(DeepSeek 官方与 Tavily keyless / 其余 REST 后端不展示)。
16
26
  - 各引擎结果都规范化为接缝的 `WebSearchResult`(可选 `content` + `sources[]`),按 URL 去重。
17
27
  - 设置段 `dsh-web-search-plugin` 通过 rc.7 的 `settings.describe()` 动态暴露,不需要宿主白名单补丁,也不需要自建回环 settings 桥。
18
28
  - 错误映射为 `WEB_PROVIDER_ERROR` / `WEB_ABORTED` / `WEB_PROVIDER_CREDENTIAL_MISSING`。
@@ -32,56 +42,7 @@
32
42
  dsh plugin --profile web add dsh-web-search-plugin
33
43
  ```
34
44
 
35
- ### 从本地目录安装
36
-
37
- 同盘可以用相对路径:
38
-
39
- ```powershell
40
- dsh plugin --profile web add ".\dsh-web-search-plugin"
41
- ```
42
-
43
- **Windows 跨盘不要 `dsh plugin add` 绝对路径。** Profile 在 `C:`、仓库在 `D:` 时,它会写成 `link:d:/...`;pnpm 把盘符当成相对路径,junction 会指到 `profiles\web\D:\...` 并链坏。也不要写 `file:D:/...`:pnpm 10 同样会把跨盘绝对路径拼进 profile 目录。
44
-
45
- 正确做法是快照到与 profile **同盘**,再用 `file:`:
46
-
47
- ```powershell
48
- $dst = "$env:USERPROFILE\.dsh\profiles\web\.local\dsh-web-search-plugin"
49
- New-Item -ItemType Directory -Force -Path $dst | Out-Null
50
- robocopy "D:\gddi\dsh-web-search-plugin" $dst /E /XD node_modules .git .github /NFL /NDL /NJH /NJS
51
- ```
52
-
53
- 在 profile 的 `package.json` 里:
54
-
55
- ```json
56
- "dsh-web-search-plugin": "file:.local/dsh-web-search-plugin"
57
- ```
58
-
59
- 并保证 `dsh.profile.bundles` 含本包,然后:
60
-
61
- ```powershell
62
- dsh plugin --profile web install
63
- ```
64
-
65
- `file:` 是快照:改完仓库后要再 robocopy + `install` 并重启 DSH。
66
-
67
- 用 `dsh --profile web --dump-config` 确认:组成树里应有 `dsh-web-search-plugin` 行,且 `web.searchProvider` 为 `dsh-web-search`。
68
-
69
- 若 profile 已经覆盖了 `web`(例如旧包 `@dsh-ltctfer/dsh-web-search-brave` 留下的 `brave-official`),后打的 patch 仍会生效。请改指向本插件,并卸掉旧包:
70
-
71
- ```yaml
72
- - id: web
73
- name: '@deepseek-ai/dsh-web'
74
- config:
75
- searchProvider: dsh-web-search
76
- ```
77
-
78
- ```powershell
79
- dsh plugin --profile web remove @dsh-ltctfer/dsh-web-search-brave
80
- ```
81
-
82
- 然后在 **设置 → 网页搜索** 里把引擎切到想要的提供方,即可继续使用对应的 API key。
83
-
84
- > **关于 `file:`(本地)安装** — pnpm 会把 `file:` 依赖做成快照。改完本仓库后,需要再同步快照并 `dsh plugin --profile web install`,然后重启。Windows 上 profile 与仓库不在同一盘时,用同盘 `file:.local/...`,不要 `link:` / `file:` 指向另一块盘。
45
+ > 从源码仓库本地安装(含 Windows 跨盘注意事项)见 [开发 → 本地安装与验证](#本地安装与验证)。
85
46
 
86
47
  ## 配置
87
48
 
@@ -89,12 +50,12 @@ dsh plugin --profile web remove @dsh-ltctfer/dsh-web-search-brave
89
50
 
90
51
  | 键 | 默认值 | 含义 |
91
52
  |---|---|---|
92
- | `provider` | `tavily` | `tavily`、`brave` 或 `deepseek-official` |
53
+ | `provider` | `deepseek-official` | `tavily`、`brave`、`deepseek-official`、`serper`、`serpapi`、`exa`、`searxng`、`scavio` 或 `firecrawl` |
93
54
  | `mode` | `keyless` | 仅 Tavily:`keyless` 或 `keyed` |
94
55
  | `apiKey` | — | Tavily API key 字面量(走凭据域,不会回显) |
95
56
  | `apiKeyEnv` | `TAVILY_API_KEY` | keyed Tavily 使用的凭据/环境变量名 |
96
57
  | `baseURL` | `https://api.tavily.com` | Tavily REST 基址;会再拼 `/search` |
97
- | `maxResults` | `8` | 每次搜索返回的源数量,三个后端共用。设置卡为 1–20 下拉,超出上限会夹到 20 |
58
+ | `maxResults` | `8` | 每次搜索返回的源数量,各后端共用。设置卡为 1–20 下拉,超出上限会夹到 20 |
98
59
  | `searchDepth` | `basic` | 仅 Tavily:`basic` 或 `advanced` |
99
60
  | `includeAnswer` | `true` | 仅 Tavily:请求生成摘要,写入结果 `content` |
100
61
  | `topic` | `general` | 仅 Tavily:`general` 或 `news` |
@@ -112,6 +73,23 @@ dsh plugin --profile web remove @dsh-ltctfer/dsh-web-search-brave
112
73
  | `searchLang` | — | Brave 的 `search_lang`(如 `zh-hans`);留空使用 Brave 默认 |
113
74
  | `freshness` | — | Brave 的 `freshness`:`pd` / `pw` / `pm` / `py` |
114
75
  | `proxy` | — | Brave 使用的 HTTP(S) 代理;留空回退 `HTTPS_PROXY` / `HTTP_PROXY` |
76
+ | `serperApiKey` / `serperApiKeyEnv` / `serperBaseURL` | — / `SERPER_API_KEY` / — | Serper 的 key 字面量 / 凭据引用名 / 端点覆盖 |
77
+ | `serpapiApiKey` / `serpapiApiKeyEnv` / `serpapiBaseURL` | — / `SERPAPI_API_KEY` / — | SerpApi 的 key 字面量 / 凭据引用名 / 端点覆盖 |
78
+ | `exaApiKey` / `exaApiKeyEnv` / `exaBaseURL` | — / `EXA_API_KEY` / — | Exa 的 key 字面量 / 凭据引用名 / 端点覆盖 |
79
+ | `searxngBaseURL` | — | SearXNG 自托管实例基址;留空用 `https://searx.be` |
80
+ | `scavioApiKey` / `scavioApiKeyEnv` / `scavioBaseURL` | — / `SCAVIO_API_KEY` / — | Scavio 的 key 字面量 / 凭据引用名 / 端点覆盖 |
81
+ | `firecrawlApiKey` / `firecrawlApiKeyEnv` / `firecrawlBaseURL` | — / `FIRECRAWL_API_KEY` / — | Firecrawl 的 key 字面量 / 凭据引用名 / 端点覆盖 |
82
+
83
+ ## 未纳入的服务
84
+
85
+ 以下服务**不内置**(在引擎下拉中不会出现,也不提供后端):
86
+
87
+ | 服务 | 不做的原因 |
88
+ |---|---|
89
+ | **TinyFish** | 免费额度极小(每分钟 5 次);其 Search + Fetch 形态超出"纯 REST 搜索"边界,仅搜索部分价值低 |
90
+ | **Google CSE** | 官方已对新用户关闭注册,并将于 2027-01-01 停用 |
91
+ | **SERPJET** | 官网当前不可访问,暂不接入 |
92
+ | **DuckDuckGo** | 无官方搜索 API(HTML/社区库抓取不符合元数据表"纯 REST"边界)。下拉中有禁用提示,指引经 SearXNG 使用 |
115
93
 
116
94
  环境变量:启动时 `DSH_WEB_SEARCH_PROVIDER=dsh-web-search` 会选中本接缝 id。未设置 `baseURL` 时,Tavily 基址回退 `$TAVILY_BASE_URL`。
117
95
 
@@ -129,25 +107,84 @@ DeepSeek 已并入本插件(`provider: deepseek-official`),无需切回。
129
107
  ## 工作方式
130
108
 
131
109
  - **DeepSeek** — `POST {deepseekBaseURL}/messages`,请求头 `x-api-key` / `authorization: Bearer`,工具 `web_search_20250305`。
132
- - **Tavily** — `POST {baseURL}/search`。keyless 发送 `x-tavily-access-mode: keyless`;keyed 发送 `authorization: Bearer <key>`。
133
- - **Brave** — `GET {braveBaseURL}?q=&count=`,请求头 `x-subscription-token`。不向 session 追加自定义事件。
110
+ - **纯 REST 类(Tavily / Brave / Serper / SerpApi / Exa / SearXNG)** — 由静态元数据表(`lib/providers.js`)+ 通用后端(`lib/rest.js`)驱动,无独立定制代码。请求方法 / 路径 / 查询字段名 / 鉴权(bearer / header / none / query)/ 固定参数 / 响应形态全部由表里的行决定。
111
+ - **Tavily** — `POST {baseURL}/search`。keyless 发送 `x-tavily-access-mode: keyless`;keyed 发送 `authorization: Bearer <key>`,并带 `include_usage` 回传 credits。
112
+ - **Brave** — `GET {braveBaseURL}?q=&count=`,请求头 `x-subscription-token`。不向 session 追加自定义事件。
113
+ - **Serper / SerpApi / Exa / SearXNG** — 按各自表的 `method` / `auth` / `params` 约定请求。
134
114
  - 非 2xx 映射为 `WEB_PROVIDER_ERROR`;调用方取消映射为 `WEB_ABORTED`。
135
115
 
136
116
  ## 仓库布局
137
117
 
138
118
  ```
139
- lib/index.js Host 插件:Config、分发提供方、设置段、额度路由
140
- lib/deepseek.js DeepSeek 后端(Anthropic Messages + web_search_20250305)
141
- lib/tavily.js Tavily 后端(keyed 时带 include_usage)
142
- lib/brave.js Brave 后端(解析 X-RateLimit-*,不写自定义 session 事件)
119
+ lib/index.js Host 插件:Config、按元数据分发提供方、设置段、额度路由
120
+ lib/providers.js 静态元数据表:内置 REST provider 的请求/鉴权/响应/官方跳转(纯数据,无定制代码)
121
+ lib/rest.js 通用 REST 后端:按元数据驱动请求构造与响应规范化(可选 hooks)
122
+ lib/deepseek.js DeepSeek 后端(Anthropic Messages + web_search_20250305,模型工具型专用)
123
+ lib/tavily.js Tavily 选项解析 / 响应映射(额度由 Tavily hook 回传)
124
+ lib/brave.js Brave 选项解析 / 响应映射(解析 X-RateLimit-*)
143
125
  lib/usage.js Tavily/Brave 用量本地缓存与 /usage 对账
144
126
  lib/shared.js 中止 / 凭据解析辅助
145
- lib/client.js 浏览器 bundle:顶层「网页搜索」分区 + 引擎切换 + 额度条
127
+ lib/client.js 浏览器 bundle:顶层「网页搜索」分区 + 引擎切换 + 官方 key 跳转 + 额度条
146
128
  cordis.patch.yml Bundle patch:插入 Host 行、设 searchProvider、禁用内置 deepseek
147
129
  ```
148
130
 
149
131
  ## 开发
150
132
 
133
+ ### 本地安装与验证
134
+
135
+ 改源码后本机验证,把仓库装进某个 profile(以 `web` 为例)。**同盘**可以直接用相对路径:
136
+
137
+ ```powershell
138
+ dsh plugin --profile web add ".\dsh-web-search-plugin"
139
+ ```
140
+
141
+ **Windows 跨盘不要 `dsh plugin add` 绝对路径。** Profile 在 `C:`、仓库在 `D:` 时,它会写成 `link:d:/...`;pnpm 把盘符当成相对路径,junction 会指到 `profiles\web\D:\...` 并链坏。也不要写 `file:D:/...`:pnpm 10 同样会把跨盘绝对路径拼进 profile 目录。
142
+
143
+ 正确做法是快照到与 profile **同盘**,再用 `file:`:
144
+
145
+ ```powershell
146
+ $dst = "$env:USERPROFILE\.dsh\profiles\web\.local\dsh-web-search-plugin"
147
+ New-Item -ItemType Directory -Force -Path $dst | Out-Null
148
+ robocopy "D:\sample\dsh-web-search-plugin" $dst /E /XD node_modules .git .github /NFL /NDL /NJH /NJS
149
+ ```
150
+
151
+ 在 profile 的 `package.json` 里:
152
+
153
+ ```json
154
+ "dsh-web-search-plugin": "file:.local/dsh-web-search-plugin"
155
+ ```
156
+
157
+ 并保证 `dsh.profile.bundles` 含本包,然后:
158
+
159
+ ```powershell
160
+ dsh plugin --profile web install
161
+ ```
162
+
163
+ `file:` 是快照:改完仓库后要再 robocopy + `install` 并重启 DSH。
164
+
165
+ 用 `dsh --profile web --dump-config` 确认:组成树里应有 `dsh-web-search-plugin` 行,且 `web.searchProvider` 为 `dsh-web-search`。
166
+
167
+ > **关于 `file:`(本地)安装** — pnpm 会把 `file:` 依赖做成快照。改完本仓库后,需要再同步快照并 `dsh plugin --profile web install`,然后重启。Windows 上 profile 与仓库不在同一盘时,用同盘 `file:.local/...`,不要 `link:` / `file:` 指向另一块盘。
168
+
169
+ ### 迁移旧后端包
170
+
171
+ 若 profile 已经覆盖了 `web`(例如旧包 `@dsh-ltctfer/dsh-web-search-brave` 留下的 `brave-official`),后打的 patch 仍会生效。请改指向本插件,并卸掉旧包:
172
+
173
+ ```yaml
174
+ - id: web
175
+ name: '@deepseek-ai/dsh-web'
176
+ config:
177
+ searchProvider: dsh-web-search
178
+ ```
179
+
180
+ ```powershell
181
+ dsh plugin --profile web remove @dsh-ltctfer/dsh-web-search-brave
182
+ ```
183
+
184
+ 然后在 **设置 → 网页搜索** 里把引擎切到想要的提供方,即可继续使用对应的 API key。
185
+
186
+ ### 语法检查
187
+
151
188
  ```powershell
152
189
  npm run check
153
190
  ```
@@ -156,15 +193,15 @@ npm run check
156
193
 
157
194
  ## 发布
158
195
 
159
- 发布由 GitHub Actions(`.github/workflows/publish.yml`)自动完成:**推送 `v*` 标签**(例如 `v0.2.1`)会带 provenance 发到 npm。向 `main` 的普通推送不会发布。
196
+ 发布由 GitHub Actions(`.github/workflows/publish.yml`)自动完成:**推送 `v*` 标签**(例如 `v0.3.0`)会带 provenance 发到 npm。向 `main` 的普通推送不会发布。
160
197
 
161
- 1. 确认 `package.json` 的 `version` 与即将推送的标签一致(例如 `0.2.1` → `v0.2.1`)。
198
+ 1. 确认 `package.json` 的 `version` 与即将推送的标签一致(例如 `0.3.0` → `v0.3.0`)。
162
199
  2. 在 GitHub **Settings → Secrets and variables → Actions** 里配置有 publish 权限的 npm automation token(仓库密钥 `NPM_TOKEN`),并允许 Actions 运行。
163
200
  3. 打标签并推送:
164
201
 
165
202
  ```powershell
166
- git tag v0.2.1
167
- git push origin v0.2.1
203
+ git tag v0.3.0
204
+ git push origin v0.3.0
168
205
  ```
169
206
 
170
207
  工作流会先核对标签与 `package.json` 的 `version`,再执行 `npm publish --provenance --access public`。
package/cordis.patch.yml CHANGED
@@ -22,5 +22,5 @@
22
22
  - id: dsh-web-search-plugin
23
23
  name: dsh-web-search-plugin
24
24
  config:
25
- provider: tavily
25
+ provider: deepseek-official
26
26
  mode: keyless
package/lib/client.js CHANGED
@@ -25,6 +25,25 @@ window.__ModuleLoader__.load({
25
25
 
26
26
  /** Settings namespace of this plugin. */
27
27
  const NS = "dsh-web-search-plugin";
28
+ /** Built-in REST providers (mirrors `lib/providers.js`; browser bundle is self-contained). */
29
+ const BUILTIN_REST_PROVIDERS = [
30
+ { id: "serper", name: "Serper", officialUrl: "https://serper.dev/", defaultBaseURL: "https://google.serper.dev", keyRequired: true, keyField: "serperApiKey", keyEnvField: "serperApiKeyEnv", baseURLField: "serperBaseURL" },
31
+ { id: "serpapi", name: "SerpApi", officialUrl: "https://serpapi.com/", defaultBaseURL: "https://serpapi.com", keyRequired: true, keyField: "serpapiApiKey", keyEnvField: "serpapiApiKeyEnv", baseURLField: "serpapiBaseURL" },
32
+ { id: "exa", name: "Exa", officialUrl: "https://dashboard.exa.ai/", defaultBaseURL: "https://api.exa.ai", keyRequired: true, keyField: "exaApiKey", keyEnvField: "exaApiKeyEnv", baseURLField: "exaBaseURL" },
33
+ { id: "searxng", name: "SearXNG", officialUrl: "https://docs.searxng.org/", defaultBaseURL: "https://searx.be", keyRequired: false, keyField: "", keyEnvField: "", baseURLField: "searxngBaseURL" },
34
+ { id: "scavio", name: "Scavio", officialUrl: "https://scavio.dev/", defaultBaseURL: "https://api.scavio.dev", keyRequired: true, keyField: "scavioApiKey", keyEnvField: "scavioApiKeyEnv", baseURLField: "scavioBaseURL" },
35
+ { id: "firecrawl", name: "Firecrawl", officialUrl: "https://firecrawl.dev/", defaultBaseURL: "https://api.firecrawl.dev", keyRequired: true, keyField: "firecrawlApiKey", keyEnvField: "firecrawlApiKeyEnv", baseURLField: "firecrawlBaseURL" }
36
+ ];
37
+ /** Find a built-in REST provider by id. */
38
+ function builtinRest(id) {
39
+ for (const entry of BUILTIN_REST_PROVIDERS) if (entry.id === id) return entry;
40
+ return void 0;
41
+ }
42
+ /** Find a built-in REST provider by its literal key field name. */
43
+ function builtinRestByKeyField(field) {
44
+ for (const entry of BUILTIN_REST_PROVIDERS) if (entry.keyField === field) return entry;
45
+ return void 0;
46
+ }
28
47
  /** Credential reference Tavily keyed mode resolves when the section names none. */
29
48
  const DEFAULT_TAVILY_KEY_REF = "TAVILY_API_KEY";
30
49
  /** Credential reference Brave resolves when the section names none. */
@@ -37,7 +56,9 @@ window.__ModuleLoader__.load({
37
56
  const BRAVE_API_KEY_FIELD = "braveApiKey";
38
57
  /** Form field the DeepSeek write-only credential control stages under. */
39
58
  const DEEPSEEK_API_KEY_FIELD = "deepseekApiKey";
40
- const SECRET_FIELDS = new Set([TAVILY_API_KEY_FIELD, BRAVE_API_KEY_FIELD, DEEPSEEK_API_KEY_FIELD]);
59
+ /** Form fields carrying literal API keys (write-only, staged under the credentials domain). */
60
+ const REST_KEY_FIELDS = BUILTIN_REST_PROVIDERS.map((entry) => entry.keyField).filter((field) => field !== "");
61
+ const SECRET_FIELDS = new Set([TAVILY_API_KEY_FIELD, BRAVE_API_KEY_FIELD, DEEPSEEK_API_KEY_FIELD, ...REST_KEY_FIELDS]);
41
62
  const DRAFT_KEY = "dsh-web-search-plugin:settings-draft";
42
63
 
43
64
  function readDraft() {
@@ -81,7 +102,8 @@ window.__ModuleLoader__.load({
81
102
  apiKey: "API key",
82
103
  apiKeyHint: "Stored outside the settings file. Leave blank to keep the current key.",
83
104
  apiKeySet: "A key is configured.",
84
- apiKeyUnset: "No key is configured; keyed / Brave search is unavailable until one is.",
105
+ apiKeyUnset: "No key set",
106
+ apiKeyUnavailableHint: "Search is unavailable until a key is configured.",
85
107
  apiKeyEnv: "Credential reference",
86
108
  apiKeyEnvHint: "Name of the credential/env var resolved for keyed Tavily search.",
87
109
  braveApiKeyEnv: "Credential reference",
@@ -125,6 +147,9 @@ window.__ModuleLoader__.load({
125
147
  maxUsesHint: "Maximum web_search server-tool uses per request.",
126
148
  expand: "Show settings",
127
149
  collapse: "Hide settings",
150
+ getKey: "Get API key",
151
+ ddgDisabled: "DuckDuckGo — use via SearXNG",
152
+ ddgHint: "DuckDuckGo has no official search API. Pick SearXNG and point it at an instance that includes DuckDuckGo (most public ones do), or self-host one.",
128
153
  save: "Save",
129
154
  saving: "Saving…",
130
155
  discard: "Discard",
@@ -173,7 +198,8 @@ window.__ModuleLoader__.load({
173
198
  apiKey: "API Key",
174
199
  apiKeyHint: "不写入设置文件。留空表示保持当前密钥。",
175
200
  apiKeySet: "已配置密钥。",
176
- apiKeyUnset: "未配置密钥;keyed / Brave 模式下搜索不可用。",
201
+ apiKeyUnset: "未配置密钥",
202
+ apiKeyUnavailableHint: "未配置密钥前搜索不可用。",
177
203
  apiKeyEnv: "凭据引用名",
178
204
  apiKeyEnvHint: "keyed 模式解析的凭据/环境变量名。",
179
205
  braveApiKeyEnv: "凭据引用名",
@@ -217,6 +243,9 @@ window.__ModuleLoader__.load({
217
243
  maxUsesHint: "每次请求 web_search 服务端工具的最大调用次数。",
218
244
  expand: "展开设置",
219
245
  collapse: "收起设置",
246
+ getKey: "获取 API key",
247
+ ddgDisabled: "DuckDuckGo — 请经 SearXNG 使用",
248
+ ddgHint: "DuckDuckGo 没有官方搜索 API。请选择 SearXNG,并填入一个聚合了 DuckDuckGo 的实例地址(多数公共实例都有),或自建一个。",
220
249
  save: "保存",
221
250
  saving: "保存中…",
222
251
  discard: "放弃修改",
@@ -328,7 +357,18 @@ window.__ModuleLoader__.load({
328
357
  textField("model"),
329
358
  textField("apiVersion"),
330
359
  numberField("maxTokens", { min: 1 }),
331
- numberField("maxUses", { min: 1 })
360
+ numberField("maxUses", { min: 1 }),
361
+ textField("serperApiKeyEnv"),
362
+ textField("serperBaseURL"),
363
+ textField("serpapiApiKeyEnv"),
364
+ textField("serpapiBaseURL"),
365
+ textField("exaApiKeyEnv"),
366
+ textField("exaBaseURL"),
367
+ textField("searxngBaseURL"),
368
+ textField("scavioApiKeyEnv"),
369
+ textField("scavioBaseURL"),
370
+ textField("firecrawlApiKeyEnv"),
371
+ textField("firecrawlBaseURL")
332
372
  ].map((spec) => [spec.field, spec]));
333
373
  this.staged = new Map();
334
374
  this.saving = false;
@@ -486,7 +526,7 @@ window.__ModuleLoader__.load({
486
526
  this.staged.set(field, edit);
487
527
  this.failed = false;
488
528
  this.publish();
489
- if (field === "provider" || field === "apiKeyEnv" || field === "braveApiKeyEnv" || field === "deepseekApiKeyEnv") this.readCredential();
529
+ if (field === "provider" || field === "apiKeyEnv" || field === "braveApiKeyEnv" || field === "deepseekApiKeyEnv" || BUILTIN_REST_PROVIDERS.some((entry) => entry.keyEnvField === field)) this.readCredential();
490
530
  }
491
531
  snapshotOf() {
492
532
  return this.scope.getSnapshot();
@@ -513,7 +553,8 @@ window.__ModuleLoader__.load({
513
553
  const staged = this.staged.get("provider");
514
554
  if (staged !== void 0 && !staged.clear && staged.text.trim() !== "") return staged.text.trim();
515
555
  const declared = this.sectionValue("provider");
516
- return declared === "brave" || declared === "deepseek-official" ? declared : "tavily";
556
+ if (declared === "tavily" || declared === "brave" || declared === "deepseek-official" || builtinRest(declared) !== void 0) return declared;
557
+ return "deepseek-official";
517
558
  }
518
559
  tavilyRef() {
519
560
  const declared = this.sectionValue("apiKeyEnv");
@@ -530,7 +571,17 @@ window.__ModuleLoader__.load({
530
571
  /** The credential reference the currently visible engine uses. */
531
572
  refOf() {
532
573
  const provider = this.providerOf();
533
- return provider === "brave" ? this.braveRef() : provider === "deepseek-official" ? this.deepseekRef() : this.tavilyRef();
574
+ if (provider === "brave") return this.braveRef();
575
+ if (provider === "deepseek-official") return this.deepseekRef();
576
+ const rest = builtinRest(provider);
577
+ if (rest !== void 0 && rest.keyRequired) return this.restKeyRef(rest);
578
+ return this.tavilyRef();
579
+ }
580
+ /** Credential reference for a built-in REST provider's key env field. */
581
+ restKeyRef(rest) {
582
+ const declared = this.sectionValue(rest.keyEnvField);
583
+ if (declared !== void 0 && declared.length > 0) return declared;
584
+ return rest.id === "serper" ? "SERPER_API_KEY" : rest.id === "serpapi" ? "SERPAPI_API_KEY" : rest.id === "exa" ? "EXA_API_KEY" : rest.id === "scavio" ? "SCAVIO_API_KEY" : "FIRECRAWL_API_KEY";
534
585
  }
535
586
  async readCredential() {
536
587
  const ref = this.refOf();
@@ -560,7 +611,13 @@ window.__ModuleLoader__.load({
560
611
  this.readCredential();
561
612
  }
562
613
  async writeKey(field, value) {
563
- const ref = field === BRAVE_API_KEY_FIELD ? this.braveRef() : field === DEEPSEEK_API_KEY_FIELD ? this.deepseekRef() : this.tavilyRef();
614
+ let ref;
615
+ if (field === BRAVE_API_KEY_FIELD) ref = this.braveRef();
616
+ else if (field === DEEPSEEK_API_KEY_FIELD) ref = this.deepseekRef();
617
+ else {
618
+ const rest = builtinRestByKeyField(field);
619
+ ref = rest !== void 0 ? this.restKeyRef(rest) : this.tavilyRef();
620
+ }
564
621
  try {
565
622
  await this.api.credentials.set({ ref, value });
566
623
  } catch (_credentialWriteFailure) {}
@@ -606,6 +663,22 @@ window.__ModuleLoader__.load({
606
663
  apiVersion: this.form.field("apiVersion"),
607
664
  maxTokens: this.form.field("maxTokens"),
608
665
  maxUses: this.form.field("maxUses"),
666
+ serperApiKey: this.form.field("serperApiKey"),
667
+ serperApiKeyEnv: this.form.field("serperApiKeyEnv"),
668
+ serperBaseURL: this.form.field("serperBaseURL"),
669
+ serpapiApiKey: this.form.field("serpapiApiKey"),
670
+ serpapiApiKeyEnv: this.form.field("serpapiApiKeyEnv"),
671
+ serpapiBaseURL: this.form.field("serpapiBaseURL"),
672
+ exaApiKey: this.form.field("exaApiKey"),
673
+ exaApiKeyEnv: this.form.field("exaApiKeyEnv"),
674
+ exaBaseURL: this.form.field("exaBaseURL"),
675
+ searxngBaseURL: this.form.field("searxngBaseURL"),
676
+ scavioApiKey: this.form.field("scavioApiKey"),
677
+ scavioApiKeyEnv: this.form.field("scavioApiKeyEnv"),
678
+ scavioBaseURL: this.form.field("scavioBaseURL"),
679
+ firecrawlApiKey: this.form.field("firecrawlApiKey"),
680
+ firecrawlApiKeyEnv: this.form.field("firecrawlApiKeyEnv"),
681
+ firecrawlBaseURL: this.form.field("firecrawlBaseURL"),
609
682
  apiKeyConfigured: this.form.credential.configured,
610
683
  apiKeyWritable: this.form.credential.writable,
611
684
  toastKey: this.form.toastKey
@@ -674,11 +747,14 @@ window.__ModuleLoader__.load({
674
747
  ".dshws_quota_alert{font-size:11.5px;margin:0;line-height:1.45}",
675
748
  ".dshws_quota_alert_warning{color:var(--dsw-alias-state-warn-primary,#f59e0b)}",
676
749
  ".dshws_quota_alert_danger{color:var(--dsw-alias-state-error-primary,#ef4444)}",
677
- ".dshws_btn{appearance:none;font:inherit;cursor:pointer;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;display:inline-flex;align-items:center;justify-content:center;transition:filter .15s ease,opacity .15s ease}",
678
- ".dshws_btn:disabled{cursor:not-allowed;opacity:.45}",
679
- ".dshws_btn_primary{border:1px solid transparent;color:var(--dsw-alias-label-on-brand,#fff);background:var(--dsw-alias-bg-brand-solid,var(--dsw-alias-brand-primary,#3b82f6));font-weight:600}",
680
- ".dshws_btn_primary:hover:not(:disabled){filter:brightness(1.08)}",
681
- ".dshws_btn_outline{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:transparent}",
750
+ ".dshws_btn{appearance:none;font:inherit;cursor:pointer;border-radius:6px;padding:8px 16px;font-size:12.5px;font-weight:500;line-height:1.5;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;transition:filter .15s ease,opacity .15s ease}",
751
+ ".dshws_btn:disabled{cursor:not-allowed;opacity:.6}",
752
+ ".dshws_btn_primary{background:var(--dsw-alias-button-primary-fill,var(--dsw-alias-brand-primary,#3b82f6));color:var(--dsw-alias-label-primary-foreground,#fff);font-weight:600}",
753
+ ".dshws_btn_primary:hover:not(:disabled){filter:brightness(1.12)}",
754
+ ".dshws_btn_secondary{background:var(--dsw-alias-button-tool-bar-fill,var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.1)));color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l2,var(--dsw-alias-border-secondary,rgba(128,128,128,.25)))}",
755
+ ".dshws_btn_secondary:hover:not(:disabled){background:var(--dsw-alias-button-tool-bar-hover,var(--dsw-alias-interactive-bg-active,rgba(128,128,128,.16)))}",
756
+ ".dshws_btn_outline{background:transparent;border-color:var(--dsw-alias-border-l2,var(--dsw-alias-border-secondary,rgba(128,128,128,.25)));color:var(--dsw-alias-label-secondary)}",
757
+ ".dshws_btn_outline:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l1,rgba(128,128,128,.45));background:var(--dsw-alias-interactive-bg-hover,rgba(128,128,128,.1))}",
682
758
  ".dshws_toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:var(--dsw-alias-state-success-primary,#10b981);color:#fff;padding:8px 18px;border-radius:999px;box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.3));font-size:12.5px;font-weight:500;z-index:100000;animation:dshws-toast-in .2s ease-out}",
683
759
  ".dshws_toast_error{background:var(--dsw-alias-state-error-primary,#ef4444)}",
684
760
  ".dshws_toast_info{background:var(--dsw-alias-label-secondary,#6b7280)}",
@@ -894,10 +970,13 @@ window.__ModuleLoader__.load({
894
970
  const { t, state, actions } = props;
895
971
  if (!state.available) return null;
896
972
  const disabled = !state.writable;
897
- const provider = state.provider.text === "brave" ? "brave" : state.provider.text === "deepseek-official" ? "deepseek-official" : "tavily";
973
+ const provider = state.provider.text === "tavily" || state.provider.text === "brave" || state.provider.text === "deepseek-official" || builtinRest(state.provider.text) !== void 0 ? state.provider.text : "deepseek-official";
898
974
  const brave = provider === "brave";
899
975
  const deepseek = provider === "deepseek-official";
976
+ const tavily = provider === "tavily";
977
+ const restMeta = builtinRest(provider);
900
978
  const keyed = state.mode.text === "keyed";
979
+ const keyHint = state.apiKeyConfigured ? t("apiKeyHint") : t("apiKeyHint") + " " + t("apiKeyUnavailableHint");
901
980
  const toastText = toastCopy(t, state.toastKey);
902
981
  const toastTone = state.toastKey === "failed" || state.toastKey === "invalid" ? "error" : state.toastKey === "nothing" ? "info" : "success";
903
982
  const row = (field, label, hint, children) => fieldRow(label, hint, children, {
@@ -930,29 +1009,32 @@ window.__ModuleLoader__.load({
930
1009
  row("provider", t("provider"), null, selectInput({ id: "ws-provider", value: provider, disabled, onChange: (e) => actions.edit("provider", e.target.value), children: [
931
1010
  react.createElement("option", { value: "tavily", key: "tavily" }, t("providerTavily")),
932
1011
  react.createElement("option", { value: "brave", key: "brave" }, t("providerBrave")),
933
- react.createElement("option", { value: "deepseek-official", key: "deepseek-official" }, t("providerDeepseek"))
934
- ] })),
935
- deepseek || brave ? null : row("mode", t("mode"), null, selectInput({ id: "ws-mode", value: state.mode.text, disabled, onChange: (e) => actions.edit("mode", e.target.value), children: [
1012
+ react.createElement("option", { value: "deepseek-official", key: "deepseek-official" }, t("providerDeepseek")),
1013
+ ...BUILTIN_REST_PROVIDERS.map((entry) => react.createElement("option", { value: entry.id, key: entry.id }, entry.name)),
1014
+ react.createElement("option", { value: "__ddg__", key: "ddg", disabled: true }, t("ddgDisabled"))
1015
+ ] }),
1016
+ react.createElement("p", { className: "dshws_field_hint", style: { padding: "4px 0 0" } }, t("ddgHint"))),
1017
+ tavily ? row("mode", t("mode"), null, selectInput({ id: "ws-mode", value: state.mode.text, disabled, onChange: (e) => actions.edit("mode", e.target.value), children: [
936
1018
  react.createElement("option", { value: "keyless", key: "keyless" }, t("modeKeyless")),
937
1019
  react.createElement("option", { value: "keyed", key: "keyed" }, t("modeKeyed"))
938
- ] }))
1020
+ ] })) : null
939
1021
  ),
940
1022
  react.createElement(QuotaCard, { t, provider, keyed }),
941
1023
  deepseek ? pair(
942
- fieldRow(t("apiKey"), t("apiKeyHint"), secretInput({ id: "ws-deepseek-key", value: state.deepseekApiKey.text, disabled: !state.apiKeyWritable, placeholder: state.apiKeyConfigured ? t("apiKeySet") : t("apiKeyUnset"), onChange: (e) => actions.edit(DEEPSEEK_API_KEY_FIELD, e.target.value) })),
1024
+ fieldRow(t("apiKey"), keyHint, secretInput({ id: "ws-deepseek-key", value: state.deepseekApiKey.text, disabled: !state.apiKeyWritable, placeholder: state.apiKeyConfigured ? t("apiKeySet") : t("apiKeyUnset"), onChange: (e) => actions.edit(DEEPSEEK_API_KEY_FIELD, e.target.value) })),
943
1025
  row("deepseekApiKeyEnv", t("deepseekApiKeyEnv"), t("deepseekApiKeyEnvHint"), textInput({ id: "ws-deepseek-keyref", value: state.deepseekApiKeyEnv.text, disabled, onChange: (e) => actions.edit("deepseekApiKeyEnv", e.target.value) }))
944
1026
  ) : null,
945
1027
  brave ? pair(
946
- fieldRow(t("apiKey"), t("apiKeyHint"), secretInput({ id: "ws-brave-key", value: state.braveApiKey.text, disabled: !state.apiKeyWritable, placeholder: state.apiKeyConfigured ? t("apiKeySet") : t("apiKeyUnset"), onChange: (e) => actions.edit(BRAVE_API_KEY_FIELD, e.target.value) })),
1028
+ fieldRow(t("apiKey"), keyHint, secretInput({ id: "ws-brave-key", value: state.braveApiKey.text, disabled: !state.apiKeyWritable, placeholder: state.apiKeyConfigured ? t("apiKeySet") : t("apiKeyUnset"), onChange: (e) => actions.edit(BRAVE_API_KEY_FIELD, e.target.value) })),
947
1029
  row("braveApiKeyEnv", t("braveApiKeyEnv"), t("braveApiKeyEnvHint"), textInput({ id: "ws-brave-keyref", value: state.braveApiKeyEnv.text, disabled, onChange: (e) => actions.edit("braveApiKeyEnv", e.target.value) }))
948
1030
  ) : null,
949
- (!brave && !deepseek && keyed) ? pair(
950
- fieldRow(t("apiKey"), t("apiKeyHint"), secretInput({ id: "ws-tavily-key", value: state.apiKey.text, disabled: !state.apiKeyWritable, placeholder: state.apiKeyConfigured ? t("apiKeySet") : t("apiKeyUnset"), onChange: (e) => actions.edit(TAVILY_API_KEY_FIELD, e.target.value) })),
1031
+ (tavily && keyed) ? pair(
1032
+ fieldRow(t("apiKey"), keyHint, secretInput({ id: "ws-tavily-key", value: state.apiKey.text, disabled: !state.apiKeyWritable, placeholder: state.apiKeyConfigured ? t("apiKeySet") : t("apiKeyUnset"), onChange: (e) => actions.edit(TAVILY_API_KEY_FIELD, e.target.value) })),
951
1033
  row("apiKeyEnv", t("apiKeyEnv"), t("apiKeyEnvHint"), textInput({ id: "ws-tavily-keyref", value: state.apiKeyEnv.text, disabled, onChange: (e) => actions.edit("apiKeyEnv", e.target.value) }))
952
1034
  ) : null,
953
1035
  deepseek ? row("deepseekBaseURL", t("deepseekBaseURL"), t("deepseekBaseURLHint"), textInput({ id: "ws-deepseek-base", value: state.deepseekBaseURL.text, disabled, onChange: (e) => actions.edit("deepseekBaseURL", e.target.value) })) : null,
954
1036
  brave ? row("braveBaseURL", t("braveBaseURL"), t("braveBaseURLHint"), textInput({ id: "ws-brave-base", value: state.braveBaseURL.text, disabled, onChange: (e) => actions.edit("braveBaseURL", e.target.value) })) : null,
955
- (!brave && !deepseek) ? row("baseURL", t("baseURL"), t("baseURLHint"), textInput({ id: "ws-tavily-base", value: state.baseURL.text, disabled, onChange: (e) => actions.edit("baseURL", e.target.value) })) : null,
1037
+ tavily ? row("baseURL", t("baseURL"), t("baseURLHint"), textInput({ id: "ws-tavily-base", value: state.baseURL.text, disabled, onChange: (e) => actions.edit("baseURL", e.target.value) })) : null,
956
1038
  deepseek ? pair(
957
1039
  row("model", t("model"), t("modelHint"), textInput({ id: "ws-model", value: state.model.text, disabled, onChange: (e) => actions.edit("model", e.target.value) })),
958
1040
  row("apiVersion", t("apiVersion"), t("apiVersionHint"), textInput({ id: "ws-apiversion", value: state.apiVersion.text, disabled, onChange: (e) => actions.edit("apiVersion", e.target.value) }))
@@ -961,7 +1043,7 @@ window.__ModuleLoader__.load({
961
1043
  row("maxTokens", t("maxTokens"), t("maxTokensHint"), numberInput({ id: "ws-maxtokens", value: state.maxTokens.text, disabled, onChange: (e) => actions.edit("maxTokens", e.target.value), className: state.maxTokens.invalid ? "dshws_input_invalid" : void 0 })),
962
1044
  row("maxUses", t("maxUses"), t("maxUsesHint"), numberInput({ id: "ws-maxuses", value: state.maxUses.text, disabled, onChange: (e) => actions.edit("maxUses", e.target.value), className: state.maxUses.invalid ? "dshws_input_invalid" : void 0 }))
963
1045
  ) : null,
964
- (!brave && !deepseek) ? pair(
1046
+ tavily ? pair(
965
1047
  row("searchDepth", t("searchDepth"), null, selectInput({ id: "ws-depth", value: state.searchDepth.text, disabled, onChange: (e) => actions.edit("searchDepth", e.target.value), children: [
966
1048
  react.createElement("option", { value: "basic", key: "basic" }, t("searchDepthBasic")),
967
1049
  react.createElement("option", { value: "advanced", key: "advanced" }, t("searchDepthAdvanced"))
@@ -971,7 +1053,7 @@ window.__ModuleLoader__.load({
971
1053
  react.createElement("option", { value: "news", key: "news" }, t("topicNews"))
972
1054
  ] }))
973
1055
  ) : null,
974
- (!brave && !deepseek) ? pair(
1056
+ tavily ? pair(
975
1057
  row("includeAnswer", t("includeAnswer"), t("includeAnswerHint"), checkboxInput({ id: "ws-answer", checked: state.includeAnswer.text === "true", disabled, onChange: (e) => actions.edit("includeAnswer", e.target.checked ? "true" : "") })),
976
1058
  maxResultsRow
977
1059
  ) : null,
@@ -991,10 +1073,25 @@ window.__ModuleLoader__.load({
991
1073
  ) : null,
992
1074
  brave ? row("proxy", t("proxy"), null, textInput({ id: "ws-proxy", value: state.proxy.text, disabled, placeholder: t("proxyPlaceholder"), onChange: (e) => actions.edit("proxy", e.target.value) })) : null,
993
1075
  deepseek ? maxResultsRow : null,
1076
+ restMeta ? react.createElement("div", { className: "dshws_form" },
1077
+ restMeta.keyRequired && restMeta.officialUrl ? react.createElement("a", {
1078
+ href: restMeta.officialUrl,
1079
+ target: "_blank",
1080
+ rel: "noopener noreferrer",
1081
+ className: "dshws_field_hint",
1082
+ style: { color: "var(--dsw-alias-brand-primary,#3b82f6)", textDecoration: "none", padding: "8px 0", display: "inline-block" }
1083
+ }, t("getKey") + " ↗") : null,
1084
+ restMeta.keyRequired ? pair(
1085
+ fieldRow(t("apiKey"), keyHint, secretInput({ id: "ws-" + restMeta.id + "-key", value: state[restMeta.keyField]?.text ?? "", disabled: !state.apiKeyWritable, placeholder: state.apiKeyConfigured ? t("apiKeySet") : t("apiKeyUnset"), onChange: (e) => actions.edit(restMeta.keyField, e.target.value) })),
1086
+ row(restMeta.keyEnvField, t("apiKeyEnv"), t("apiKeyEnvHint"), textInput({ id: "ws-" + restMeta.id + "-keyref", value: state[restMeta.keyEnvField]?.text ?? "", disabled, onChange: (e) => actions.edit(restMeta.keyEnvField, e.target.value) }))
1087
+ ) : null,
1088
+ row(restMeta.baseURLField, t("baseURL"), t("baseURLHint"), textInput({ id: "ws-" + restMeta.id + "-base", value: state[restMeta.baseURLField]?.text || restMeta.defaultBaseURL || "", disabled, onChange: (e) => actions.edit(restMeta.baseURLField, e.target.value) })),
1089
+ maxResultsRow
1090
+ ) : null,
994
1091
  react.createElement("div", { style: { borderTop: "1px solid var(--dsw-alias-border-l2)", justifyContent: "flex-end", alignItems: "center", gap: "8px", padding: "12px 0 4px", display: "flex" } },
995
1092
  react.createElement("button", {
996
1093
  type: "button",
997
- className: "dshws_btn dshws_btn_outline",
1094
+ className: "dshws_btn dshws_btn_secondary",
998
1095
  disabled: (!state.dirty && !state.failed) || state.saving,
999
1096
  onClick: (event) => {
1000
1097
  event.preventDefault();