@maricgeer/dsh-websearch 0.2.0 → 0.2.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/README.en.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # dsh-websearch
2
2
 
3
+ > **Document split**: the plugin page shows [docs/plugin-page.en.md](docs/plugin-page.en.md) (named by the locale `meta.detail`; a Chinese UI reads [docs/plugin-page.zh.md](docs/plugin-page.zh.md)); this README is for development, installation and acceptance.
4
+ >
3
5
  > **Language authority**: This file mirrors `README.md` (Chinese), which is the factual source of truth; when the two disagree, the Chinese file wins.
4
6
  > Version line: from v0.1.0 (ADR-0020); **v0.2.0 = the DNS resilience layer** (ADR-0022 — a major architecture subsystem, the 0.2.x bump per ADR-0020). Internal dev numbers 0.2.0–0.9.0 are archived history — see CHANGELOG.
5
7
 
@@ -21,7 +23,7 @@
21
23
  > 1. `dsh` **0.1.6-alpha.2**: every tool call crashes with `TOOL_RUNTIME_SCHEDULER.prepare` — avoid that version (use 0.1.5-rc.x / 0.1.6-alpha.1 / 0.1.7+).
22
24
  > 2. `dsh` **0.1.7-alpha.2/rc.1 (half-fixed in rc.2)**: with tsx source launches the host logs `Plugin metadata … TypeError: Cannot assign to read only property 'stack'` at startup — npm-installed / built-output users are unaffected; source-launch users can use the [fork fix branch](https://github.com/GeerMrc/deepseek-harness/tree/fix/readonly-stack-rc2).
23
25
 
24
- Prereqs: host `dsh` >= 0.1.5-rc.1 (peer range `>=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || >=0.2.0 <0.3.0` (S32/S33/S38 full span — each rehearsed pre-release pinned explicitly, semver satisfies verified; the 0.1.8 stable line stays excluded)), node >= 22.19.
26
+ Prereqs: host `dsh` >= 0.1.5-rc.1 (peer range `>=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.2-rc.5 || >=0.2.0 <0.3.0` (S32/S33/S38/S41 full span — each rehearsed pre-release pinned explicitly, except that 0.2.2-rc.5 has so far only been exercised for install and the takeover switch, its search and fetch leg still to do; the range is guarded under both semver semantics by `tests/peer-range.spec.ts`; the 0.1.8 stable line stays excluded. The host compatibility gate admits 0.2.x pre-releases through `includePrerelease`, so an explicit pin records "rehearsed" rather than gating admission — see ADR-0027)), node >= 22.19.
25
27
 
26
28
  ```sh
27
29
  # 1. Pack (repo root)
@@ -36,14 +38,14 @@ dsh --profile web --dump-config
36
38
  # dsh-websearch insert row appears
37
39
  ```
38
40
 
39
- **Install-driven takeover**: the plugin ships a `cordis.patch.yml` pinning `searchProvider: dshws-chain` and `fetchProvider: dshws-fetch-gate` — `plugin add` takes over in one command; `plugin remove` fully restores (zero dump diff). No user-layer patch needed.
41
+ **Install-driven takeover**: the plugin ships a `cordis.patch.yml` pinning `searchProvider: dshws-chain` and `fetchProvider: dshws-fetch-gate`, and hides the built-in "Web search and fetch" settings page while it is enabled (ADR-0024) — `plugin add` takes over in one command; disabling or uninstalling the plugin restores the composition and that page (measured on 0.2.2-rc.5 through the Plugins-page switch; a command-line uninstall was measured separately on rc.5). No user-layer patch needed. A `web` selection saved separately in the user layer is mostly not removed when the plugin is disabled and is not removed on uninstall; see the FAQ.
40
42
 
41
43
  **Uninstall**: `dsh plugin --profile web remove dsh-websearch`. Known residue (honest disclosure): settings defaults and preset directories are not cleaned by remove (harmless; user-authored same-name directories are never overwritten).
42
44
 
43
45
 
44
46
  ## Install, upgrade, and notes
45
47
 
46
- **Install** (peer range as above — covers the 0.1.5-rc line, the 0.1.6/0.1.7 pre-release and stable lines, the 0.2.0-rc line, and 0.2.x stables; 0.1.8 and 0.3.x excluded):
48
+ **Install** (peer range as above — covers the 0.1.5-rc line, the 0.1.6/0.1.7 pre-release and stable lines, the 0.2.0-rc line, 0.2.2-rc.5, and 0.2.x stables; 0.1.8 and 0.3.x excluded):
47
49
 
48
50
  Option 1 (npm registry, recommended):
49
51
 
@@ -62,11 +64,11 @@ pnpm install && pnpm run build && node scripts/pack.mjs # dual tarballs into d
62
64
  # Option 3: a file: tarball dependency in the profile package.json + pnpm install
63
65
  ```
64
66
 
65
- Installing takes over web_search / web_fetch (bundle-pinned install order, last writer wins); uninstalling restores the host defaults. Reload the page after swapping the package (the client bundle is served from `/plugins/*?rev=` runtime routes).
67
+ Installing takes over web_search / web_fetch (bundle-pinned install order, last writer wins) and hides the built-in "Web search and fetch" settings page while the plugin is enabled (ADR-0024); uninstalling restores the host defaults and that page. A `web` selection saved separately in the user layer is not removed by uninstall; see the FAQ. Reload the page after swapping the package (the client bundle is served from `/plugins/*?rev=` runtime routes).
66
68
 
67
69
  **Upgrade**: full rehearsal manual at [docs/upgrade.md](docs/upgrade.md) (pack → swap → dump diff → GUI smoke → search → degradation). Same-version swaps are skipped — bump the version first for preview installs.
68
70
 
69
- **CI / release** (from v0.2.0): pushes/PRs to master run the full gate (typecheck/lint/test/i18n/build on a node 22/24 matrix); pushing a `v*` tag releases automatically — dual-name tarballs attach to the GitHub Release and the scoped package publishes to npmjs.org (the tag push is the release confirmation point).
71
+ **CI / release** (from v0.2.0; OIDC and the consistency gate from ADR-0026): pushes and PRs to master run the full gate plus the release rehearsal (typecheck/lint/test/i18n/build on a node 22/24 matrix; pack both tarballs and check their contents). Pushing a `v*` tag is the release confirmation point: the pipeline runs the full gate and `scripts/check-release.mjs` (tag, package.json, CHANGELOG and `USER_AGENT` agree; the tag points at a commit on master) before publishing — dual-name tarballs attach to the GitHub Release and the scoped package publishes to npmjs.org through OIDC trusted publishing, with no long-lived token. The local release steps are in [docs/release-runbook.md](docs/release-runbook.md).
70
72
 
71
73
  **Notes**:
72
74
  - Key values never reach the client; the settings badge shows integer counts only (refs whitelisted to the five members, blocking cross-credential probing).
@@ -172,13 +174,15 @@ Combination constraints (fail-loud: on 0.1.5/0.1.6 hosts the settings validate h
172
174
  - **Official web_fetch errors under a proxy**: host SSRF hard protection × TUN fake-ip (not a plugin bug). Enable `fetchTakeover` to route through the cloud extract chain.
173
175
  - **Where did Perplexity go**: removed (ADR-0017 — no free API key tier available, fails the admission bar). Residual `perplexity:` sections in stored settings.yaml are harmless (schema passthrough); feel free to clean manually.
174
176
  - **AnySearch vertical tag/params not implemented**: pending a key probe (registered S22).
175
- - **Idle web-search-deepseek card on the host settings page**: inert after takeover (its key field is a single-value write to `DEEPSEEK_API_KEY`) — known behavior; do not configure multi-keys there.
177
+ - **Where the built-in "Web search and fetch" page went**: it is hidden while the plugin is enabled and "Settings → Web Search" takes over (ADR-0024); it comes back when the plugin is disabled or uninstalled. An escape hatch by design: writing `- id: ui-settings-web-search` with `disabled: false` into the profile's `cordis.patch.yml` forces the built-in page to show (the same approach as dsh-subagent-plus; measured working on 0.2.2-rc.5).
178
+ - **The built-in page shows "not loaded" after the plugin is disabled**: in 0.2.0 and earlier the built-in page was visible. A provider of this plugin selected and saved there lives in the user layer, outranks the bundle layer, and dangles once the plugin is off (`web_search` fails with `WEB_PROVIDER_CONFIGURED_MISSING`). While the plugin is enabled and detects the choice, a notice card at the top of the Web Search settings page clears it with one click ("Clear pinned selection"); after the plugin is disabled, picking the providers again on the restored built-in page and saving clears it too (the automatic choice for search plus the local direct fetch is the default); deleting `searchProvider` and `fetchProvider` (both together) from the `web` row of the profile's `cordis.patch.yml` and restarting the host works as well. An automatic handover at disable time is unreliable on rc.5: the host teardown runs inside an HMR transaction and its write is refused, and the client watch is usually unloaded before the event arrives (2 of 13 switches survived, 1 write succeeded); see the [session-41 record](docs/sessions/2026-11-23-session-41.md).
176
179
  - **Upgrades**: see [docs/upgrade.md](docs/upgrade.md).
177
180
 
178
181
  ## More docs
182
+ - [docs/patterns.md](docs/patterns.md) — plugin-page intro-card and swap-verification patterns (PC1–PC3, reusable)
179
183
  - [docs/known-upstream-issues.md](docs/known-upstream-issues.md) — known upstream DSH issues register (zh; symptoms/workarounds/self-checks, incl. the fork fix-branch usage)
180
184
 
181
185
  - Architecture: [docs/00-architecture.md](docs/00-architecture.md)
182
- - Decision records: [docs/decisions/](docs/decisions/) (ADR-0001..0022)
186
+ - Decision records: [docs/decisions/](docs/decisions/) (ADR-0001..0027)
183
187
  - Upgrade rehearsal manual: [docs/upgrade.md](docs/upgrade.md)
184
188
  - Governance board: [docs/STATUS.md](docs/STATUS.md)
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # dsh-websearch
2
2
 
3
+ > **文档分工**:插件页显示的用户文档是 [docs/plugin-page.zh.md](docs/plugin-page.zh.md)(由 locale `meta.detail` 指定,英文环境读 [docs/plugin-page.en.md](docs/plugin-page.en.md));本 README 面向开发、安装与验收。
4
+ >
3
5
  > **语言权威声明**:本文件为中文事实正本;`README.en.md` 为英文镜像,两文件不一致时以本文件为准。
4
6
  > 版本线:v0.1.0 起(ADR-0020);**v0.2.0 = DNS 韧性层 + 上游对齐二轮收口**(ADR-0022;含四工具上游对齐修复与质量批——单一版本发布)。内部开发编号 0.2.0–0.9.0 归历史档,见 CHANGELOG。
5
7
 
@@ -21,7 +23,7 @@
21
23
  > 1. `dsh` **0.1.6-alpha.2**:任意工具调用崩溃 `TOOL_RUNTIME_SCHEDULER.prepare`——避开该版本(用 0.1.5-rc.x / 0.1.6-alpha.1 / 0.1.7+)。
22
24
  > 2. `dsh` **0.1.7-alpha.2/rc.1(rc.2 半修)**:tsx 源码启动下宿主启动期报 `Plugin metadata … TypeError: Cannot assign to read only property 'stack'`——npm 安装/构建产物用户不受影响;源码启动用户可用 [fork 修复分支](https://github.com/GeerMrc/deepseek-harness/tree/fix/readonly-stack-rc2)。
23
25
 
24
- 前置:宿主 `dsh` ≥ 0.1.5-rc.1(peer 域 `>=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || >=0.2.0 <0.3.0`(S32/S33/S38 全跨度——显式钉已演练预发布版,semver satisfies 实测在案;0.1.8 稳定线未演练仍排除))、node ≥ 22.19。
26
+ 前置:宿主 `dsh` ≥ 0.1.5-rc.1(peer 域 `>=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.2-rc.5 || >=0.2.0 <0.3.0`(S32/S33/S38/S41 全跨度——显式钉的是已演练的预发布版,范围由 `tests/peer-range.spec.ts` 按两种 semver 语义守护;0.1.8 稳定线未演练仍排除。其中 0.2.2-rc.5 只做完了装入与接管开关的实测,搜索与抓取的功能腿待做。宿主兼容门按 `includePrerelease` 放行 0.2.x 预发布,显式钉是「已演练」的记录而非过门条件,见 ADR-0027))、node ≥ 22.19。
25
27
 
26
28
  ```sh
27
29
  # 1. 打包(仓库根)
@@ -36,13 +38,13 @@ dsh --profile web --dump-config
36
38
  # dsh-websearch insert 行出现
37
39
  ```
38
40
 
39
- **装即接管**:插件随包 `cordis.patch.yml` 钉 `searchProvider: dshws-chain` + `fetchProvider: dshws-fetch-gate`——`plugin add` 单命令即接管,`plugin remove` 单命令完整复原(dump diff 零输出)。无需手写用户层 patch。
41
+ **装即接管**:插件随包 `cordis.patch.yml` 钉 `searchProvider: dshws-chain` + `fetchProvider: dshws-fetch-gate`,并在启用期间隐藏官方「网页搜索与获取」设置页(ADR-0024)——`plugin add` 单命令即接管;关闭或卸载即复原组合,官方设置页随之恢复(0.2.2-rc.5 上经插件页开关实测;命令行卸载在 rc.5 上另行实测)。无需手写用户层 patch。用户层里另行保存过的 `web` 选择多数不随关闭清除、不随卸载清除,见 FAQ。
40
42
 
41
43
  **卸载**:`dsh plugin --profile web remove dsh-websearch`。已知残留(诚实披露):settings 默认值与预设目录不随 remove 清理(无害,用户自撰同名目录永不覆写)。
42
44
 
43
45
  ## 安装、升级与注意事项
44
46
 
45
- **安装**(宿主 peer 域见上——覆盖 0.1.5-rc 线、0.1.6 与 0.1.7 预发布线及未来 0.1.6/0.1.7 稳定版,上限 0.1.8):
47
+ **安装**(宿主 peer 域见上——覆盖 0.1.5-rc 线、0.1.6 与 0.1.7 预发布线及未来 0.1.6/0.1.7 稳定版、0.2.0-rc 线、0.2.2-rc.5 与 0.2.x 稳定版;0.1.8 与 0.3.x 不在域内):
46
48
 
47
49
  方式一(npm registry,推荐):
48
50
 
@@ -61,11 +63,11 @@ pnpm install && pnpm run build && node scripts/pack.mjs # 双名 tarball 入 d
61
63
  # 方式三:profile package.json 依赖 file: 指向 tarball 后 pnpm install
62
64
  ```
63
65
 
64
- 安装即接管 web_search / web_fetch(bundle 钉扎安装序,后写者赢);卸载自动复原宿主默认。换包后浏览器整页刷新(client 走 `/plugins/*?rev=` 运行时路由)。
66
+ 安装即接管 web_search / web_fetch(bundle 钉扎安装序,后写者赢),并在启用期间隐藏官方「网页搜索与获取」设置页(ADR-0024);卸载自动复原宿主默认与该页面。用户层另行保存的 `web` 选择不随卸载清除,见 FAQ。换包后浏览器整页刷新(client 走 `/plugins/*?rev=` 运行时路由)。
65
67
 
66
68
  **升级**:完整演练手册见 [docs/upgrade.md](docs/upgrade.md)(打包→换包→dump 对照→GUI 冒烟→搜索→降级六步 + 发版前上游对齐确认)。同版本号换包会被跳过——预览场景先 bump 版本。
67
69
 
68
- **CI/发布**(v0.2.0 起):master 推送/PR 跑全量门禁(typecheck/lint/test/i18n/build,node 22/24 矩阵);推送 `v*` 标签自动发布——双名 tarball 附 GitHub Release、scoped 包发布至 npmjs.org(标签推送即发布确认点)。
70
+ **CI/发布**(v0.2.0 起;OIDC 与一致性门自 ADR-0026 起):master 推送与 PR 跑全量门禁加发布预演(typecheck/lint/test/i18n/build,node 22/24 矩阵;打包并校验 tarball 内容)。推送 `v*` 标签即发布确认点:流水线先跑全量门与 `scripts/check-release.mjs`(tag、package.json、CHANGELOG、`USER_AGENT` 四处版本一致,tag 指向 master 上的提交),再发布——双名 tarball 附 GitHub Release,scoped 包经 OIDC trusted publishing 发布到 npmjs.org,不使用长期 token。本地发版步骤见 [docs/release-runbook.md](docs/release-runbook.md)。
69
71
 
70
72
  **注意事项**:
71
73
  - key 值永不下发客户端;设置页徽标只显示整数计数(refs 白名单限定五成员,防跨凭据探测)。
@@ -168,16 +170,21 @@ dsh-websearch:
168
170
 
169
171
  ## FAQ / 已知行为
170
172
 
173
+ - **官方桌面端(Electron app)能用本插件吗**:能。桌面端与 web 端共用 `~/.dsh`(key/会话/工作区直接共享),插件按 profile 隔离需各自安装:桌面端用 app 内置命令装 `'/Applications/DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh' plugin --profile desktop add @maricgeer/dsh-websearch`(装完重启 app)。**app 自动更新后插件可能失效/拒装——这是预期行为**(更新会替换捆绑运行时:宿主兼容门按 `includePrerelease` 放行 0.2.x 预发布,插件不会被拒装,但上游改了接口时插件可能失效):自查 `'<同上 launcher>' plugin --profile desktop add @maricgeer/dsh-websearch` 重装即可;仍失败说明需要等插件适配新版(见 [known-upstream-issues](docs/known-upstream-issues.md) 与 [desktop-adoption](docs/desktop-adoption.md))。
171
174
  - **官方 web_fetch 在代理环境报错**:宿主 SSRF 硬防护 × TUN fake-ip 所致(非本插件 bug)。开 `fetchTakeover` 走云端 extract 链即绕开。
172
175
  - **Perplexity 哪去了**:已移除(ADR-0017——无免费额度可申请,不满足准入标准)。存量 settings.yaml 的 `perplexity:` 残节无害(schema 透传),可手动清理。
173
176
  - **AnySearch 垂直面 tag/params 未实现**:待 key 探针(S22 登记)。
174
- - **宿主设置页闲置的 web-search-deepseek 配置卡**:接管后不生效仍在(其 key 保存为对 `DEEPSEEK_API_KEY` 的单值写入点)——已知行为,勿在那里配置多 key。
177
+ - **官方「网页搜索与获取」设置页去哪了**:插件启用期间它被隐藏,由「设置 → 网页搜索」接管(ADR-0024);关闭或卸载插件后自动恢复。设计上的逃生口:在 profile 的 `cordis.patch.yml` 写 `- id: ui-settings-web-search` 与 `disabled: false` 可强制显示官方页(与 dsh-subagent-plus 的做法一致;0.2.2-rc.5 上实测可用)。
178
+ - **关闭插件后官方页显示「未加载」**:0.2.0 及更早版本里官方页可见,若在其中把提供方选定为本插件成员并保存,该选择写在用户层,优先于组合包层,关闭插件后成为悬空引用(`web_search` 报 `WEB_PROVIDER_CONFIGURED_MISSING`)。插件启用期间检测到该选择时,「网页搜索」设置页顶部会出现提示卡,点「清除钉值」一键清除;关闭插件后在恢复出来的官方页重新选择并保存也可清除(选「自动选择」加「本机直接获取」即回到默认);还可以删除 profile `cordis.patch.yml` 里 `web` 行的 `searchProvider` 与 `fetchProvider`(两个一起删)后重启宿主。关闭时的自动交还在 rc.5 上不可靠:宿主 teardown 运行在 HMR 事务内、写入被拒,客户端守卫多数在事件送达前被卸载(13 次里 2 次存活,1 次写入成功),实测见 [session-41 记录](docs/sessions/2026-11-23-session-41.md)。
175
179
  - **升级**:见 [docs/upgrade.md](docs/upgrade.md)。
176
180
 
177
181
  ## 更多文档
182
+ - [docs/patterns.md](docs/patterns.md) — 插件页介绍卡与换装验证范本(PC1–PC3,跨版本复用)
178
183
  - [docs/known-upstream-issues.md](docs/known-upstream-issues.md) —— 已知上游 DSH 问题登记表(现象/规避/自查命令,含 fork 修复分支用法)
184
+ - [docs/desktop-adoption.md](docs/desktop-adoption.md) —— 官方桌面端全貌与采用实测(ADR-0023)
185
+ - [docs/upstream-sync-sop.md](docs/upstream-sync-sop.md) —— 随官方上游(npm 线 + 桌面端)迭代的同步 SOP(监测/决策/守卫重放/双端验证/发版联动)
179
186
 
180
187
  - 架构正本:[docs/00-architecture.md](docs/00-architecture.md)
181
- - 决策记录:[docs/decisions/](docs/decisions/)(ADR-0001..0022)
188
+ - 决策记录:[docs/decisions/](docs/decisions/)(ADR-0001..0027)
182
189
  - 升级演练手册:[docs/upgrade.md](docs/upgrade.md)
183
190
  - 治理看板:[docs/STATUS.md](docs/STATUS.md)
package/cordis.patch.yml CHANGED
@@ -1,3 +1,14 @@
1
+ # Bundle layer for dsh-websearch (ADR-0013, ADR-0024). Disabling or uninstalling
2
+ # the bundle in the Plugins page removes this whole layer, so every override
3
+ # below is derived state: the official rows return with their config intact.
4
+ #
5
+ # Takeover: pin the seam's selection to this plugin's chain and gate, and hide
6
+ # the official "web search and fetch" settings page, a pure edit surface that
7
+ # would otherwise let users select another provider while this plugin is on.
8
+ # Runtime rows are intentionally NOT disabled: web, web-fetch-http,
9
+ # web-deepseek-api, tool-web and the preset rows must stay up so the official
10
+ # providers take over as soon as this bundle is off. Entries carry no `name`
11
+ # guard on purpose: a mismatched guard makes the host skip the entry silently.
1
12
  - insert:
2
13
  - id: dsh-websearch
3
14
  name: dsh-websearch
@@ -7,3 +18,5 @@
7
18
  fetchProvider: dshws-fetch-gate
8
19
  - id: web-search-deepseek
9
20
  disabled: true
21
+ - id: ui-settings-web-search
22
+ disabled: true
@@ -0,0 +1,20 @@
1
+ # dsh-websearch (multi-provider web search)
2
+
3
+ > A multi-provider search chain taking over DSH's web search and fetch: Tavily, Exa, Firecrawl and AnySearch degrade in your order, DeepSeek backs up for pay, and each provider rotates several keys.
4
+
5
+ ## What it does
6
+
7
+ - **High-availability failover**: a failed member is skipped for the next; key pools rotate within a provider first; the search fails only when all have
8
+ - **Unified settings**: one language, region and domain allow/block list for every member; the tool row names the member that served it
9
+ - **DNS resilience**: encrypted resolution on restricted networks; healthy networks untouched
10
+ - **Install and take over**: enabled, it replaces the built-in "Web search and fetch"; disabled, the built-ins take back over and your settings are kept
11
+
12
+ ## Settings
13
+
14
+ Settings → Web Search: API keys on the member cards (stored locally only), drag to reorder the chain, toggles for web_fetch takeover and DNS; changes apply from the next search.
15
+
16
+ ## Off and compatibility
17
+
18
+ **The list switch hands back to the built-ins and restores on re-enable**; the detail page's "enable component" switch only deactivates the plugin itself (a state with no settings entry — switch it back on there). Compatible with DSH 0.1.5-rc.1 through 0.2.x (0.2.2-rc.5 included).
19
+
20
+ Issues and releases: https://github.com/GeerMrc/dsh-websearch
@@ -0,0 +1,20 @@
1
+ # dsh-websearch(多源网页搜索)
2
+
3
+ > 多源搜索链接管 DSH 的网页搜索与获取:Tavily、Exa、Firecrawl、AnySearch 按你排的顺序自动降级,DeepSeek 付费兜底,每家可配多把 key 轮换。
4
+
5
+ ## 它做什么
6
+
7
+ - **高可用降级**:成员失败自动换下一个;多 key 池先同家换 key 再降级,全部失败才报错
8
+ - **统一配置**:语言、区域、域名黑白名单一处设置、全成员生效;工具行标注实际服务的成员
9
+ - **DNS 韧性**:受限网络自动加密解析,正常网络零改动
10
+ - **装即接管**:启用即接管官方「网页搜索与获取」,关闭即交回官方、设置保留
11
+
12
+ ## 设置与使用
13
+
14
+ 设置 → 网页搜索:成员卡填 API key(只存本机)、拖动排序搜索链、web_fetch 接管与 DNS 开关;改动从下一次搜索起生效。
15
+
16
+ ## 关闭与兼容
17
+
18
+ **列表开关 = 官方接管、重新启用即恢复**;详情页「启用组件」开关只停用本体(留下无设置入口的状态,回详情页打开即恢复)。兼容 DSH 0.1.5-rc.1 至 0.2.x(含 0.2.2-rc.5)。
19
+
20
+ 问题反馈与版本发布:https://github.com/GeerMrc/dsh-websearch
package/lib/client.js CHANGED
@@ -7,6 +7,48 @@ window.__ModuleLoader__.load({
7
7
  let react = require("react");
8
8
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
10
+ //#region src/handover.ts
11
+ /** The seam's two selection fields. A patch replaces the row's whole `config`, so they are cleared together. */
12
+ const SELECTION_KEYS = ["searchProvider", "fetchProvider"];
13
+ /** Prefix of every provider id this plugin registers (ADR-0003). */
14
+ const PLUGIN_PROVIDER_PREFIX = "dshws-";
15
+ /**
16
+ * Whether a value is the id of a provider this plugin registered.
17
+ * @param value - A candidate provider id read from configuration.
18
+ * @returns True when `value` is a string carrying the plugin prefix.
19
+ */
20
+ function isPluginProviderId(value) {
21
+ return typeof value === "string" && value.startsWith(PLUGIN_PROVIDER_PREFIX);
22
+ }
23
+ /**
24
+ * List the user-layer selections that name a provider this plugin registered. Only the user layer
25
+ * is consulted: a selection that comes from the bundle layer leaves with the bundle and needs no
26
+ * handover. The enable-time notice renders one row per entry.
27
+ * @param user - The user section of the seam's settings descriptor.
28
+ * @returns The pinned selections, in field order.
29
+ */
30
+ function pinnedSelections(user) {
31
+ if (typeof user !== "object" || user === null) return [];
32
+ const section = user;
33
+ return SELECTION_KEYS.filter((key) => isPluginProviderId(section[key])).map((key) => ({
34
+ field: key,
35
+ value: section[key]
36
+ }));
37
+ }
38
+ /**
39
+ * Plan the edits that stop a user-layer selection from naming this plugin's providers.
40
+ * Only the user layer is consulted: a selection that comes from the bundle layer
41
+ * leaves with the bundle and needs no handover.
42
+ * @param user - The user section of the seam's settings descriptor.
43
+ * @returns One `unset` per selection key whose user value names a plugin provider, in field order.
44
+ */
45
+ function planHandoverOps(user) {
46
+ return pinnedSelections(user).map((pin) => ({
47
+ op: "unset",
48
+ path: [pin.field]
49
+ }));
50
+ }
51
+ //#endregion
10
52
  //#region src/client/locales.ts
11
53
  /** Locale namespace id for every string this client half registers. */
12
54
  const NS = "dsh-websearch";
@@ -26,6 +68,11 @@ window.__ModuleLoader__.load({
26
68
  saved: "Saved",
27
69
  cleared: "Cleared",
28
70
  failed: "Action failed",
71
+ seamPinTitle: "A provider selection is pinned in the host layer",
72
+ seamPinBody: "A choice saved on the official settings page still lives in the host layer and outranks this plugin: search and fetch go straight to the pinned member with no chain and no failover, and it would dangle if this plugin were disabled. Clearing it puts the chain back in charge and lets the official providers take over cleanly when this plugin is disabled.",
73
+ seamPinClear: "Clear pinned selection",
74
+ seamPinFieldSearch: "Web search provider",
75
+ seamPinFieldFetch: "Web fetch provider",
29
76
  moveUp: "Move up",
30
77
  moveDown: "Move down",
31
78
  chainFloorDeepseekNote: "No usable search tool — the next web_search will be served by the selected DeepSeek paid fallback.",
@@ -209,6 +256,11 @@ window.__ModuleLoader__.load({
209
256
  saved: "已保存",
210
257
  cleared: "已清除",
211
258
  failed: "操作失败",
259
+ seamPinTitle: "宿主层钉死了提供方",
260
+ seamPinBody: "官方设置页保存过的选择仍写在宿主层,优先级高于本插件:搜索与抓取直连被钉死的成员,不走链、不降级;关闭本插件后它会变成悬空引用。清除后由本插件的链接管,关闭插件时官方提供方也能干净接管。",
261
+ seamPinClear: "清除钉值",
262
+ seamPinFieldSearch: "网页搜索提供方",
263
+ seamPinFieldFetch: "网页获取提供方",
212
264
  moveUp: "上移",
213
265
  moveDown: "下移",
214
266
  chainFloorDeepseekNote: "没有可用搜索工具——下一次 web_search 将由所选 DeepSeek 付费兜底服务。",
@@ -449,7 +501,7 @@ window.__ModuleLoader__.load({
449
501
  * event) funnels here so the snapshot is always derived, never patched in
450
502
  * place.
451
503
  */
452
- function deriveSnapshot(value, facts, counts, writable, revision, dnsStatus, dnsTrace) {
504
+ function deriveSnapshot(value, facts, counts, writable, revision, dnsStatus, dnsTrace, seamPins = []) {
453
505
  const members = MEMBERS.map((member) => {
454
506
  const section = value[member.key];
455
507
  const refName = section?.apiKeyEnv ?? member.defaultRef;
@@ -525,7 +577,8 @@ window.__ModuleLoader__.load({
525
577
  trace: dnsTrace
526
578
  },
527
579
  revision,
528
- writable
580
+ writable,
581
+ seamPins
529
582
  };
530
583
  }
531
584
  /** Web-search settings section controller (see {@link WebSearchSettingsPorts}). */
@@ -540,6 +593,7 @@ window.__ModuleLoader__.load({
540
593
  #writable = false;
541
594
  #revision = void 0;
542
595
  #snapshot = deriveSnapshot(EMPTY_SECTION, EMPTY_FACTS, EMPTY_COUNTS, false, void 0, void 0, []);
596
+ #seamPins = [];
543
597
  #unsubscribe;
544
598
  constructor(ports) {
545
599
  this.#ports = ports;
@@ -570,9 +624,29 @@ window.__ModuleLoader__.load({
570
624
  this.#value = view?.value ?? {};
571
625
  this.#revision = view?.revision;
572
626
  this.#writable = described.value.writable;
627
+ const seam = described.value.namespaces.find((candidate) => candidate.ns === "web");
628
+ this.#seamPins = pinnedSelections(seam?.user);
573
629
  this.#recompute();
574
630
  }
575
631
  }
632
+ /**
633
+ * S41 enable-time handover (ADR-0024, user ruling 2026-11-24): clear the seam's user-layer
634
+ * selections that name this plugin's providers, so the chain takes over again and disabling
635
+ * the plugin hands over cleanly. Re-describes first: the mutate carries the revision it read.
636
+ */
637
+ async clearSeamPins() {
638
+ const described = await this.#ports.describeSettings();
639
+ if (!described.ok) return { ok: false };
640
+ const seam = described.value.namespaces.find((candidate) => candidate.ns === "web");
641
+ const ops = planHandoverOps(seam?.user);
642
+ if (ops.length === 0) {
643
+ await this.#refreshSection();
644
+ return { ok: true };
645
+ }
646
+ if (!(await this.#ports.mutateSettings("web", ops, seam?.revision)).ok) return { ok: false };
647
+ await this.#refreshSection();
648
+ return { ok: true };
649
+ }
576
650
  /** Detach the reference-updated subscription (the entry's disposer calls this). */
577
651
  dispose() {
578
652
  this.#unsubscribe?.();
@@ -845,11 +919,82 @@ window.__ModuleLoader__.load({
845
919
  return nodes;
846
920
  }
847
921
  #recompute() {
848
- this.#snapshot = deriveSnapshot(this.#value, this.#facts, this.#counts, this.#writable, this.#revision, this.#dnsStatus, this.#dnsTrace);
922
+ this.#snapshot = deriveSnapshot(this.#value, this.#facts, this.#counts, this.#writable, this.#revision, this.#dnsStatus, this.#dnsTrace, this.#seamPins);
849
923
  for (const listener of this.#listeners) listener();
850
924
  }
851
925
  };
852
926
  //#endregion
927
+ //#region src/client/handover-watch.ts
928
+ /** The names this bundle can carry: the bare registration id and the scoped npm name. */
929
+ const BUNDLE_NAMES = ["dsh-websearch", "@maricgeer/dsh-websearch"];
930
+ /** Event the Host forwards after every plugin-manager operation. */
931
+ const PLUGIN_MANAGER_CHANGED = "plugin-manager/changed";
932
+ /** Optional host faces the watch needs; both are injected together. */
933
+ const WATCH_FACES = ["remote.pluginManager", "configForms"];
934
+ /** A refused write is retried once against a fresh snapshot. */
935
+ const WRITE_ATTEMPTS = 2;
936
+ function isRecord(value) {
937
+ return typeof value === "object" && value !== null;
938
+ }
939
+ function isPluginManagerFace(value) {
940
+ return isRecord(value) && typeof value.listBundles === "function";
941
+ }
942
+ function isConfigFormsFace(value) {
943
+ return isRecord(value) && typeof value.get === "function";
944
+ }
945
+ function warnToConsole(message) {
946
+ console.warn(`[dshws] ${message}`);
947
+ }
948
+ /** Whether this bundle is enabled, disabled or uninstalled, or could not be determined. */
949
+ async function bundleState(pluginManager) {
950
+ const result = await pluginManager.listBundles();
951
+ const list = Array.isArray(result) ? result : isRecord(result) && Array.isArray(result.value) ? result.value : void 0;
952
+ if (list === void 0) return "unknown";
953
+ const own = list.find((entry) => isRecord(entry) && BUNDLE_NAMES.includes(entry.name));
954
+ return own !== void 0 && isRecord(own) && own.enabled === true ? "enabled" : "disabled";
955
+ }
956
+ async function handoverWhenDisabled(pluginManager, forms, warn) {
957
+ if (await bundleState(pluginManager) !== "disabled") return;
958
+ const form = forms.get("web");
959
+ for (let attempt = 0; attempt < WRITE_ATTEMPTS; attempt++) {
960
+ const snapshot = form.getSnapshot();
961
+ const ops = planHandoverOps(snapshot.user);
962
+ const revision = snapshot.revision;
963
+ if (ops.length === 0 || revision === void 0) return;
964
+ if (await form.mutate(ops, revision)) return;
965
+ }
966
+ warn(`handover refused ${WRITE_ATTEMPTS} times: the web selection still names a plugin provider`);
967
+ }
968
+ /**
969
+ * Start watching plugin-manager operations and hand the seam's selection back
970
+ * once this bundle is no longer enabled. The subscription begins when both
971
+ * optional host faces have been served, which may be after this call returns.
972
+ * @param ctx - The client context of this plugin's browser half.
973
+ * @param warn - Receives the reason when the bundle list, the form or the write fails.
974
+ * @returns The function that stops the watch; calling it before the faces are
975
+ * served prevents the subscription from ever starting.
976
+ */
977
+ function installHandoverWatch(ctx, warn = warnToConsole) {
978
+ let unsubscribe;
979
+ let stopped = false;
980
+ ctx.inject(WATCH_FACES, (scoped) => {
981
+ if (stopped) return;
982
+ const pluginManager = scoped.remote.pluginManager;
983
+ const configForms = scoped.configForms;
984
+ if (!isPluginManagerFace(pluginManager) || !isConfigFormsFace(configForms)) return;
985
+ unsubscribe = scoped.remote.$on(PLUGIN_MANAGER_CHANGED, () => {
986
+ handoverWhenDisabled(pluginManager, configForms, warn).catch((error) => {
987
+ warn(`handover watch failed: ${error instanceof Error ? error.message : String(error)}`);
988
+ });
989
+ });
990
+ });
991
+ return () => {
992
+ stopped = true;
993
+ unsubscribe?.();
994
+ unsubscribe = void 0;
995
+ };
996
+ }
997
+ //#endregion
853
998
  //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.js
854
999
  function getEnumValues(entries) {
855
1000
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
@@ -6528,6 +6673,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6528
6673
  background: "var(--dsw-alias-bg-layer-1)",
6529
6674
  color: "var(--dsw-alias-label-primary)"
6530
6675
  };
6676
+ /**
6677
+ * T20: one compact-row label face — the staged fields in the advanced fold and the
6678
+ * maxUses stepper row share it, so every "label left, control right" row reads alike
6679
+ * (the member-card field labels keep {@link fieldLabelStyle} with its ⓘ spacing).
6680
+ */
6681
+ const rowLabelStyle = {
6682
+ display: "inline-flex",
6683
+ alignItems: "center",
6684
+ gap: 4,
6685
+ fontSize: 12,
6686
+ lineHeight: "18px",
6687
+ fontWeight: 500,
6688
+ color: "var(--dsw-alias-label-secondary)"
6689
+ };
6531
6690
  /** Page-header info anchor (12b): the single key-format note seat. */
6532
6691
  const infoButtonStyle = {
6533
6692
  display: "inline-flex",
@@ -6630,7 +6789,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6630
6789
  border: "none",
6631
6790
  borderRadius: 6,
6632
6791
  background: "transparent",
6633
- color: "var(--dsw-alias-label-secondary)"
6792
+ color: "var(--dsw-alias-label-secondary)",
6793
+ font: "inherit",
6794
+ fontSize: 14
6634
6795
  };
6635
6796
  /**
6636
6797
  * S23 D9 (plan §0.5 B2 path a): a staged field can run on LIFTED draft state
@@ -8180,7 +8341,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8180
8341
  * GeoField previously duplicated at ~95% identity.
8181
8342
  */
8182
8343
  function StagedTextField(props) {
8183
- const { t, testid, labelKey, noteKey, placeholder, width, centered, value, onSet, lifted } = props;
8344
+ const { t, testid, labelKey, noteKey, placeholder, width, fill, centered, value, onSet, lifted } = props;
8184
8345
  const [draft, setDraft] = useLiftedDraft(lifted);
8185
8346
  const [feedback, setFeedback] = useAutoClearFeedback();
8186
8347
  const current = value ?? "";
@@ -8193,13 +8354,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8193
8354
  },
8194
8355
  children: [
8195
8356
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
8196
- style: {
8197
- display: "inline-flex",
8198
- alignItems: "center",
8199
- gap: 4,
8200
- fontSize: 12,
8201
- color: "var(--dsw-alias-label-secondary)"
8202
- },
8357
+ style: rowLabelStyle,
8203
8358
  children: [t(labelKey), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
8204
8359
  label: t(noteKey),
8205
8360
  side: "bottom",
@@ -8213,7 +8368,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8213
8368
  })
8214
8369
  })]
8215
8370
  }),
8216
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
8371
+ fill === true ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
8217
8372
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
8218
8373
  "aria-label": t(labelKey),
8219
8374
  "data-testid": testid,
@@ -8225,15 +8380,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8225
8380
  setFeedback(void 0);
8226
8381
  },
8227
8382
  style: {
8383
+ ...fieldInputStyle,
8228
8384
  width,
8229
- height: 28,
8230
- padding: "0 8px",
8231
- ...centered === true ? { textAlign: "center" } : {},
8232
- borderRadius: 8,
8233
- border: "1px solid var(--dsw-alias-border-l2)",
8234
- background: "var(--dsw-alias-bg-layer-2)",
8235
- color: "inherit",
8236
- font: "inherit"
8385
+ ...fill === true ? {
8386
+ flex: 1,
8387
+ minWidth: width,
8388
+ maxWidth: 480
8389
+ } : {},
8390
+ ...centered === true ? { textAlign: "center" } : {}
8237
8391
  }
8238
8392
  }),
8239
8393
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
@@ -8270,7 +8424,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8270
8424
  labelKey: kind === "include" ? "searchIncludeDomainsLabel" : "searchExcludeDomainsLabel",
8271
8425
  noteKey: kind === "include" ? "searchIncludeDomainsNote" : "searchExcludeDomainsNote",
8272
8426
  placeholder: "example.com,foo.org",
8273
- width: 200,
8427
+ width: 220,
8428
+ fill: true,
8274
8429
  value,
8275
8430
  onSet: (text) => onSet(kind, text),
8276
8431
  lifted
@@ -8285,7 +8440,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8285
8440
  labelKey,
8286
8441
  noteKey,
8287
8442
  placeholder,
8288
- width: 88,
8443
+ width: 120,
8289
8444
  centered: true,
8290
8445
  value,
8291
8446
  onSet,
@@ -8576,7 +8731,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8576
8731
  onSetDnsPreset: (preset) => controller.setDnsPreset(preset),
8577
8732
  onSetDnsNodes: (text) => controller.setDnsNodesText(text),
8578
8733
  onRecheckDns: () => controller.recheckDns(),
8579
- onRefreshDnsFace: () => controller.refreshDnsFace()
8734
+ onRefreshDnsFace: () => controller.refreshDnsFace(),
8735
+ onClearSeamPins: () => controller.clearSeamPins()
8580
8736
  });
8581
8737
  };
8582
8738
  }
@@ -8593,6 +8749,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8593
8749
  [data-dshws-card-body] { border-top: 1px solid var(--dsw-alias-border-l2); margin: 0 2px; padding-top: 8px; }
8594
8750
  [data-dshws-input]:focus { border-color: var(--dsw-alias-brand-primary); outline: none; }
8595
8751
  [data-dshws-focusable]:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }
8752
+ /* T20c: placeholders carry the section's type scale and color token — the browser's
8753
+ default gray (rgb(117,117,117)) read as a second, smaller-looking font next to
8754
+ full-color values; opacity 1 keeps the token's own contrast in both themes. */
8755
+ [data-dshws-input]::placeholder { color: var(--dsw-alias-label-tertiary); font-size: 14px; font-family: inherit; opacity: 1; }
8596
8756
  @media (prefers-reduced-motion: reduce) {
8597
8757
  [data-dshws-card] { transition: none; }
8598
8758
  [data-dshws-chevron] { transition: none !important; }
@@ -8600,8 +8760,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8600
8760
  `;
8601
8761
  /** The section body (`t` arrives as the locale runtime's standard seat). */
8602
8762
  function WebSearchSettingsSection(props) {
8603
- const { t, snapshot, onSaveKey, onClearKey, onToggleEnabled, onMoveSearch, onSetKeySelection, onSetMaxUses, onSetFallbackMember, onSetFetchTakeover, onSetBaseURL, onSetMemberOption, onSetSearchCountry, onSetSearchLanguage, onSetSearchDomains, onMoveFetch, onRefreshKeyCounts, onSetDnsMode, onSetDnsPreset, onSetDnsNodes, onRecheckDns, onRefreshDnsFace, onSetDnsProbeMethod } = props;
8763
+ const { t, snapshot, onSaveKey, onClearKey, onToggleEnabled, onMoveSearch, onSetKeySelection, onSetMaxUses, onSetFallbackMember, onSetFetchTakeover, onSetBaseURL, onSetMemberOption, onSetSearchCountry, onSetSearchLanguage, onSetSearchDomains, onMoveFetch, onRefreshKeyCounts, onSetDnsMode, onSetDnsPreset, onSetDnsNodes, onRecheckDns, onRefreshDnsFace, onSetDnsProbeMethod, onClearSeamPins } = props;
8604
8764
  const [chainFeedback, setChainFeedback] = (0, react.useState)(void 0);
8765
+ const [seamPinFeedback, setSeamPinFeedback] = useAutoClearFeedback();
8766
+ const clearSeamPins = async () => {
8767
+ const result = await onClearSeamPins();
8768
+ setSeamPinFeedback(result.ok ? "saved" : "failed");
8769
+ };
8605
8770
  const move = async (id, delta) => {
8606
8771
  const result = await onMoveSearch(id, delta);
8607
8772
  setChainFeedback(result.ok ? void 0 : "failed");
@@ -8667,6 +8832,81 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8667
8832
  },
8668
8833
  children: t("description")
8669
8834
  })] }),
8835
+ snapshot.seamPins.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
8836
+ "data-testid": "dshws-seam-pin-notice",
8837
+ "data-dshws-card": "",
8838
+ style: {
8839
+ ...cardStyle,
8840
+ padding: "10px 14px",
8841
+ gap: 8,
8842
+ borderColor: "var(--dsw-alias-state-error-primary)"
8843
+ },
8844
+ children: [
8845
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
8846
+ style: {
8847
+ margin: 0,
8848
+ fontSize: 12,
8849
+ fontWeight: 500,
8850
+ color: "var(--dsw-alias-state-error-primary)"
8851
+ },
8852
+ children: t("seamPinTitle")
8853
+ }),
8854
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8855
+ style: {
8856
+ ...hintStyle,
8857
+ margin: 0
8858
+ },
8859
+ children: t("seamPinBody")
8860
+ }),
8861
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
8862
+ "data-testid": "dshws-seam-pin-list",
8863
+ style: {
8864
+ margin: 0,
8865
+ paddingLeft: 0,
8866
+ listStyle: "none",
8867
+ display: "flex",
8868
+ flexDirection: "column",
8869
+ gap: 2
8870
+ },
8871
+ children: snapshot.seamPins.map((pin) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
8872
+ "data-testid": `dshws-seam-pin-${pin.field}`,
8873
+ style: {
8874
+ fontSize: 12,
8875
+ color: "var(--dsw-alias-label-secondary)"
8876
+ },
8877
+ children: [
8878
+ t(pin.field === "searchProvider" ? "seamPinFieldSearch" : "seamPinFieldFetch"),
8879
+ ": ",
8880
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: pin.value })
8881
+ ]
8882
+ }, pin.field))
8883
+ }),
8884
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8885
+ style: {
8886
+ display: "flex",
8887
+ alignItems: "center",
8888
+ gap: 8
8889
+ },
8890
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
8891
+ variant: "outline",
8892
+ size: "sm",
8893
+ "data-testid": "dshws-seam-pin-clear",
8894
+ "aria-label": t("seamPinClear"),
8895
+ disabled: !snapshot.writable,
8896
+ onClick: () => void clearSeamPins(),
8897
+ children: t("seamPinClear")
8898
+ }), seamPinFeedback ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8899
+ role: "status",
8900
+ "data-testid": "dshws-seam-pin-feedback",
8901
+ style: {
8902
+ ...feedbackStyle,
8903
+ color: feedbackColor(seamPinFeedback === "saved" ? "saved" : "failed")
8904
+ },
8905
+ children: t(seamPinFeedback)
8906
+ }) : null]
8907
+ })
8908
+ ]
8909
+ }) : null,
8670
8910
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
8671
8911
  "data-testid": "dshws-chains",
8672
8912
  "data-dshws-card": "",
@@ -8982,13 +9222,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8982
9222
  },
8983
9223
  children: [
8984
9224
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
8985
- style: {
8986
- display: "inline-flex",
8987
- alignItems: "center",
8988
- gap: 4,
8989
- fontSize: 12,
8990
- color: "var(--dsw-alias-label-secondary)"
8991
- },
9225
+ style: rowLabelStyle,
8992
9226
  children: [t("maxUsesLabel"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
8993
9227
  label: hint,
8994
9228
  side: "bottom",
@@ -9016,11 +9250,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9016
9250
  "data-testid": "dshws-max-uses-down",
9017
9251
  onClick: stepDown,
9018
9252
  disabled: !valid,
9019
- style: {
9020
- ...moveButtonStyle,
9021
- width: 22,
9022
- height: 22
9023
- },
9253
+ style: moveButtonStyle,
9024
9254
  children: "−"
9025
9255
  }),
9026
9256
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
@@ -9032,15 +9262,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9032
9262
  "data-testid": "dshws-max-uses-input",
9033
9263
  "data-dshws-input": "",
9034
9264
  style: {
9035
- width: 52,
9036
- height: 28,
9265
+ ...fieldInputStyle,
9266
+ width: 64,
9037
9267
  padding: "0 6px",
9038
- textAlign: "center",
9039
- borderRadius: 8,
9040
- border: "1px solid var(--dsw-alias-border-l2)",
9041
- background: "var(--dsw-alias-bg-layer-2)",
9042
- color: "inherit",
9043
- font: "inherit"
9268
+ textAlign: "center"
9044
9269
  },
9045
9270
  value: draft === "" ? String(current) : draft,
9046
9271
  onChange: (event) => {
@@ -9054,11 +9279,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9054
9279
  "data-testid": "dshws-max-uses-up",
9055
9280
  onClick: stepUp,
9056
9281
  disabled: !valid,
9057
- style: {
9058
- ...moveButtonStyle,
9059
- width: 22,
9060
- height: 22
9061
- },
9282
+ style: moveButtonStyle,
9062
9283
  children: "+"
9063
9284
  })
9064
9285
  ]
@@ -9688,6 +9909,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9688
9909
  zh,
9689
9910
  en
9690
9911
  }));
9912
+ ctx.effect(() => installHandoverWatch(ctx));
9691
9913
  registerDnsTraceFetcher(async () => {
9692
9914
  const trace = await (await mountKeyCountsRemote(ctx)).readDnsTrace();
9693
9915
  if (!trace.ok) throw new Error("dshws dns remote unavailable");
@@ -9730,6 +9952,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9730
9952
  return {
9731
9953
  describeSettings: () => remote.settings.describe(),
9732
9954
  updateSettings: (ns, patch, expectedRevision) => remote.settings.update(ns, patch, expectedRevision),
9955
+ mutateSettings: (ns, ops, expectedRevision) => remote.settings.mutate(ns, ops, expectedRevision),
9733
9956
  describeCredentials: (refs) => remote.credentials.describe([...refs]),
9734
9957
  describeKeyCounts: async (refs) => {
9735
9958
  try {
package/lib/index.js CHANGED
@@ -1279,7 +1279,7 @@ async function readMemberEnvelope(response, deps) {
1279
1279
  * drift-guarded by tests/user-agent.test.ts against package.json's version —
1280
1280
  * a version bump that forgets this constant fails the guard loudly.
1281
1281
  */
1282
- const USER_AGENT = "dsh-websearch/0.2.0";
1282
+ const USER_AGENT = "dsh-websearch/0.2.1";
1283
1283
  /**
1284
1284
  * First non-empty detail string among the wire error shapes seen across
1285
1285
  * providers: `error` (string or `{ message }` or `{ error }`), `detail`
package/locale/en.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "dsh-websearch",
4
+ "description": "Unified multi-provider web search and fetch with a configurable priority chain, full HA degradation and multi-key pools; takes over the built-in \"Web search and fetch\" settings page while enabled and restores it when disabled.",
5
+ "detail": "docs/plugin-page.en.md"
6
+ }
7
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "dsh-websearch",
4
+ "description": "多源统一网页搜索与抓取:可配置优先级链、全链路高可用降级、多 API key 池;启用即接管官方「网页搜索与获取」,关闭后官方设置页自动恢复。",
5
+ "detail": "docs/plugin-page.zh.md"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maricgeer/dsh-websearch",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Unified multi-provider WebSearch management plugin for the DeepSeek Harness (dsh) — priority chains with full HA degradation for search and fetch, plus a settings-page GUI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -15,11 +15,15 @@
15
15
  "./client": {
16
16
  "default": "./lib/client.js"
17
17
  },
18
- "./package.json": "./package.json"
18
+ "./package.json": "./package.json",
19
+ "./locale/*.json": "./locale/*.json"
19
20
  },
20
21
  "files": [
21
22
  "lib",
22
23
  "cordis.patch.yml",
24
+ "locale",
25
+ "docs/plugin-page.zh.md",
26
+ "docs/plugin-page.en.md",
23
27
  "README.en.md"
24
28
  ],
25
29
  "engines": {
@@ -33,41 +37,42 @@
33
37
  "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.client.json",
34
38
  "typecheck:client": "tsc --noEmit -p tsconfig.client.json",
35
39
  "lint": "oxlint src tests",
36
- "check:i18n": "node scripts/check-locales.mjs && node scripts/check-cjk.mjs"
40
+ "check:i18n": "node scripts/check-locales.mjs && node scripts/check-cjk.mjs",
41
+ "check:release": "node scripts/check-release.mjs"
37
42
  },
38
43
  "peerDependencies": {
39
44
  "@deepseek-ai/cordis": ">=4.0.1-rc.1 <5",
40
- "@deepseek-ai/dsh-agent": ">=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || >=0.2.0 <0.3.0",
41
- "@deepseek-ai/dsh-credentials": ">=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || >=0.2.0 <0.3.0",
42
- "@deepseek-ai/dsh-settings": ">=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || >=0.2.0 <0.3.0",
43
- "@deepseek-ai/dsh-system-prompt": ">=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || >=0.2.0 <0.3.0",
44
- "@deepseek-ai/dsh-tools": ">=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || >=0.2.0 <0.3.0",
45
- "@deepseek-ai/dsh-web": ">=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || >=0.2.0 <0.3.0"
45
+ "@deepseek-ai/dsh-agent": ">=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.2-rc.5 || >=0.2.0 <0.3.0",
46
+ "@deepseek-ai/dsh-credentials": ">=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.2-rc.5 || >=0.2.0 <0.3.0",
47
+ "@deepseek-ai/dsh-settings": ">=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.2-rc.5 || >=0.2.0 <0.3.0",
48
+ "@deepseek-ai/dsh-system-prompt": ">=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.2-rc.5 || >=0.2.0 <0.3.0",
49
+ "@deepseek-ai/dsh-tools": ">=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.2-rc.5 || >=0.2.0 <0.3.0",
50
+ "@deepseek-ai/dsh-web": ">=0.1.5-rc.1 <0.1.8 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.2-rc.5 || >=0.2.0 <0.3.0"
46
51
  },
47
52
  "dependencies": {
48
53
  "@deepseek-ai/dsh-typert-protocol": "0.1.7-rc.2",
49
54
  "@deepseek-ai/schemastery": ">=3.18.4 <4"
50
55
  },
51
56
  "devDependencies": {
52
- "@deepseek-ai/cordis": "4.0.4",
53
- "@deepseek-ai/dsh-agent": "0.1.7-rc.2",
54
- "@deepseek-ai/dsh-api-remotes": "0.1.7-rc.2",
55
- "@deepseek-ai/dsh-client-locale": "0.1.7-rc.2",
56
- "@deepseek-ai/dsh-client-store": "0.1.7-rc.2",
57
- "@deepseek-ai/dsh-client-ui-primitives": "0.1.7-rc.2",
58
- "@deepseek-ai/dsh-client-ui-renderer": "0.1.7-rc.2",
59
- "@deepseek-ai/dsh-client-ui-settings": "0.1.7-rc.2",
60
- "@deepseek-ai/dsh-client-ui-slots": "0.1.7-rc.2",
61
- "@deepseek-ai/dsh-credentials": "0.1.7-rc.2",
62
- "@deepseek-ai/dsh-llm": "0.1.7-rc.2",
63
- "@deepseek-ai/dsh-settings": "0.1.7-rc.2",
64
- "@deepseek-ai/dsh-system-prompt": "0.1.7-rc.2",
65
- "@deepseek-ai/dsh-tools": "0.1.7-rc.2",
57
+ "@deepseek-ai/cordis": "4.1.0",
58
+ "@deepseek-ai/dsh-agent": "0.2.2-rc.5",
59
+ "@deepseek-ai/dsh-api-remotes": "0.2.2-rc.5",
60
+ "@deepseek-ai/dsh-client-locale": "0.2.2-rc.5",
61
+ "@deepseek-ai/dsh-client-store": "0.2.2-rc.5",
62
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.2-rc.5",
63
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.2-rc.5",
64
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.2-rc.5",
65
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.2-rc.5",
66
+ "@deepseek-ai/dsh-credentials": "0.2.2-rc.5",
67
+ "@deepseek-ai/dsh-llm": "0.2.2-rc.5",
68
+ "@deepseek-ai/dsh-settings": "0.2.2-rc.5",
69
+ "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.5",
70
+ "@deepseek-ai/dsh-tools": "0.2.2-rc.5",
66
71
  "@deepseek-ai/dsh-typert-protocol": "0.1.7-rc.2",
67
- "@deepseek-ai/dsh-util-code-language": "0.1.7-rc.2",
68
- "@deepseek-ai/dsh-util-workspace-path": "0.1.7-rc.2",
69
- "@deepseek-ai/dsh-web": "0.1.7-rc.2",
70
- "@deepseek-ai/schemastery": "3.18.4",
72
+ "@deepseek-ai/dsh-util-code-language": "0.2.2-rc.5",
73
+ "@deepseek-ai/dsh-util-workspace-path": "0.2.2-rc.5",
74
+ "@deepseek-ai/dsh-web": "0.2.2-rc.5",
75
+ "@deepseek-ai/schemastery": "3.19.0",
71
76
  "@shikijs/langs": "^4.4.3",
72
77
  "@shikijs/themes": "^4.4.3",
73
78
  "@testing-library/dom": "^10.4.1",
@@ -75,6 +80,7 @@
75
80
  "@types/node": "^22.20.0",
76
81
  "@types/react": "^18.3.31",
77
82
  "@types/react-dom": "^18.3.0",
83
+ "@types/semver": "^7.7.0",
78
84
  "anser": "^2.3.5",
79
85
  "clsx": "^2.1.1",
80
86
  "diff": "~9.0.0",
@@ -95,11 +101,13 @@
95
101
  "oxlint": "1.76.0",
96
102
  "react": "^18.3.1",
97
103
  "react-dom": "^18.2.0",
104
+ "semver": "7.8.5",
98
105
  "shiki": "^4.4.3",
99
106
  "simple-icons": "~16.31.0",
100
107
  "tsdown": "^0.22.2",
101
108
  "typescript": "^6.0.3",
102
109
  "vitest": "^4.1.8",
110
+ "yaml": "^2.9.1",
103
111
  "zod": "^4.5.4",
104
112
  "zustand": "~4.4.7"
105
113
  },