@maricgeer/dsh-websearch 0.1.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GeerMrc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,159 @@
1
+ # dsh-websearch
2
+
3
+ > **Language authority**: This file mirrors `README.md` (Chinese), which is the factual source of truth; when the two disagree, the Chinese file wins.
4
+ > Version line: from **v0.1.0** (ADR-0020). Internal dev numbers 0.2.0–0.9.0 are archived history — see CHANGELOG.
5
+
6
+ `dsh-websearch` is an out-of-tree unified web-search management plugin for [deepseek-harness](https://github.com/) (`dsh`): zero host modification. It consolidates multiple search providers into one standard plugin with a user-configurable priority chain, full high-availability degradation, a multi-API-key pool, unified web_fetch takeover, and a settings-page GUI.
7
+
8
+ **Member admission bar** (ADR-0017): high availability + a free tier + multi-API-key support + upstream-aligned feature implementation.
9
+
10
+ | Member | Search | Fetch | Free tier |
11
+ |---|---|---|---|
12
+ | Tavily | ✔ | ✔ (/extract) | ✔ |
13
+ | Exa | ✔ | ✘ (upstream has no URL-fetch capability; never joins the fetch chain) | ✔ |
14
+ | Firecrawl | ✔ | ✔ (/v2/scrape) | ✔ |
15
+ | AnySearch | ✔ | ✔ (/v1/extract) | ✔ |
16
+ | DeepSeek (paid floor) | ✔ | ✘ | ✘ (paid; opt-in only) |
17
+
18
+ ## Quick start
19
+
20
+ > ⚠️ **Known upstream host issue (not this plugin)**: host `dsh` **0.1.6-alpha.2** has a host-side tool-scheduling defect — every tool call (including shell/web_search) crashes with `TOOL_RUNTIME_SCHEDULER.prepare`, reproducible in a plugin-free environment. Avoid that host version (use 0.1.5-rc.x / 0.1.6-alpha.1 / 0.1.7-alpha.x) or wait for the upstream fix. See the drill matrix in [docs/upgrade.md](docs/upgrade.md).
21
+
22
+ 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`, S32 full span — each rehearsed pre-release pinned explicitly), node >= 22.19.
23
+
24
+ ```sh
25
+ # 1. Pack (repo root)
26
+ pnpm install && pnpm run build && npm pack # produces dsh-websearch-<version>.tgz
27
+
28
+ # 2. Install into the web profile (install-driven takeover, ADR-0013)
29
+ dsh plugin --profile web add /path/to/dsh-websearch-<version>.tgz
30
+
31
+ # 3. Verify composition (no instance / LLM needed)
32
+ dsh --profile web --dump-config
33
+ # web row: searchProvider: dshws-chain / fetchProvider: dshws-fetch-gate
34
+ # dsh-websearch insert row appears
35
+ ```
36
+
37
+ **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.
38
+
39
+ **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).
40
+
41
+
42
+ ## Install, upgrade, and notes
43
+
44
+ **Install** (peer range as above — covers the 0.1.5-rc line, the 0.1.6 and 0.1.7 pre-release lines, and future 0.1.6/0.1.7 stables, capped below 0.1.8):
45
+
46
+ ```sh
47
+ # Option 1: grab the tarball from this repository's releases page
48
+ dsh plugin --profile web add <dsh-websearch-tarball>
49
+ # Option 2: pack from source
50
+ git clone https://github.com/GeerMrc/dsh-websearch.git && cd dsh-websearch
51
+ pnpm install && pnpm run build && npm pack # produces dsh-websearch-<ver>.tgz
52
+ # Option 3: a file: tarball dependency in the profile package.json + pnpm install
53
+ ```
54
+
55
+ 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).
56
+
57
+ **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.
58
+
59
+ **Notes**:
60
+ - Key values never reach the client; the settings badge shows integer counts only (refs whitelisted to the five members, blocking cross-credential probing).
61
+ - After a host upgrade swaps the serving worktree, run `pnpm install && pnpm run build` in that worktree first so the profile links (symlink healing) resolve complete `lib/` outputs.
62
+ - From 0.1.6-alpha.1 the loader is non-transactional: a plugin startup failure surfaces as a FAILED fiber + log line (no whole-tree rollback); check `<dshHome>/logs/`.
63
+
64
+ ## Migrating from the anysearch plugin (ADR-0013)
65
+
66
+ Uninstall first, then install — the bundle pin resolves by install order, last writer wins:
67
+
68
+ ```sh
69
+ dsh plugin --profile web remove @anysearch/anysearch-dsh
70
+ dsh plugin --profile web add /path/to/dsh-websearch-<version>.tgz
71
+ ```
72
+
73
+ - Id prefixes differ (`anysearch` vs `dshws-*`) — zero conflict; the plugin includes a `dshws-anysearch` member reusing `ANYSEARCH_API_KEY`.
74
+ - **Override/customization** (user-layer final say): if your user-layer `cordis.patch.yml` replaces the whole web row config, restate both `searchProvider` and `fetchProvider` keys — otherwise, with a firecrawl key configured, you hit `WEB_PROVIDER_AMBIGUOUS` (loud failure, not silent).
75
+
76
+ ## Key configuration (multi-key single slot, comma values — ADR-0011)
77
+
78
+ Keys go through the host credentials service (credential-ref = env var name); **never plaintext in config files**. Resolution layers: process env > `~/.dsh/.credentials.yaml` > project .env > user .env; resolved per operation, hot.
79
+
80
+ One ref per member (defaults `TAVILY_API_KEY` / `EXA_API_KEY` / `FIRECRAWL_API_KEY` / `ANYSEARCH_API_KEY` / `DEEPSEEK_API_KEY`; renamable via `apiKeyEnv`). **Multiple keys = comma-separated values on the same ref** (e.g. `TAVILY_API_KEY=key1,key2,key3`), or the comma string directly in the GUI key input.
81
+
82
+ `keySelection` (default `round-robin`): `order` | `round-robin` | `random` (random-without-replacement, ADR-0012 — ascending Fisher-Yates deck; no redraw within a round).
83
+
84
+ ## Settings-page GUI tour
85
+
86
+ After install, Web UI "Settings → Web Search":
87
+
88
+ - **Member cards** (collapsed by default; whole header clicks to expand): status dot, name, **key-count badge** (expanded only, a 14px circle matching the ? info icon: 0 = gray hollow circle, N = green count circle = the plugin's activation color, over 10 = warn color; hover shows `N of 10`, the count refreshes on expand), unsaved pill, enable switch; expanded = API key input (plaintext typing / •••• mask after save / clear), key-policy cycle chip, endpoint override (blank = default), per-member upstream-aligned parameters (ⓘ tooltips carry full semantics).
89
+ - **Search chain / Web Fetch chain**: two independently orderable chains (ADR-0019), effective on the next search.
90
+ - **Advanced fold**: fallback selector, timeout budget, DeepSeek maxUses, unified language/region (ADR-0015).
91
+ - **Provenance badge** (ADR-0010): session tool rows show `[served-by: <member-id>]`.
92
+
93
+ ## Chain semantics (ADR-0002 / ADR-0014)
94
+
95
+ - Ordered traversal: unregistered / disabled / credential-not-ready → skip; runtime failure or timeout (`perMemberTimeoutMs`, default 30000) → degrade to next; first success returns.
96
+ - Same-member key retry: pools with >1 key redraw up to 3 times before degrading (ADR-0012).
97
+ - All exhausted → `DSHWS_CHAIN_EXHAUSTED` (per-member failure summary attached; fail-loud).
98
+ - **Fallback** (`fallbackMember`, ADR-0014): `auto` (default — chain tail) | a tool member id (pinned tail) | `dshws-deepseek` (paid floor: joins only when ≤1 tool member is ready and its key is configured — a runtime guard, never a static append).
99
+ - Pinning a single member at the host layer (`searchProvider: dshws-tavily`) = direct connection, no degradation.
100
+
101
+ ## web_fetch takeover (ADR-0019)
102
+
103
+ `fetchProvider` is pinned to `dshws-fetch-gate` (a runtime router):
104
+
105
+ - **Takeover ON** (`fetchTakeover: true`, default): web_fetch is served by the internal fetch chain — Firecrawl → Tavily → AnySearch in order (Exa never joins). Cloud-side extraction bypasses local proxy/SSRF restrictions.
106
+ - **Takeover OFF**: the gate falls back to a built-in http fetch (official-behavior-equivalent stand-in; the pinned patch means the official provider instance is never selected).
107
+ - The two-state toggle is hot in GUI and settings (next agent / next call).
108
+
109
+ ## Configuration reference (`dsh-websearch` section of cordis.yml)
110
+
111
+ > Sole source of truth = the `src/config.ts` schema; this is a common-fields excerpt. All fields are hot (next search). GUI writes share the schema.
112
+
113
+ ```yaml
114
+ dsh-websearch:
115
+ searchChain: [] # search chain; empty = tavily→exa→firecrawl→anysearch
116
+ fetchChain: [] # fetch chain; empty = firecrawl→tavily→anysearch
117
+ perMemberTimeoutMs: 30000 # per-member timeout budget
118
+ fallbackMember: auto # auto | member id | dshws-deepseek (paid floor)
119
+ fetchTakeover: true # web_fetch takeover toggle
120
+ chainLogFile: true # chain log at <dshHome>/logs/dsh-websearch.log
121
+ searchCountry: '' # unified region ISO 3166-1 alpha-2 (fan-out Exa/Firecrawl, ADR-0015)
122
+ searchLanguage: '' # unified language ISO 639-1 (fan-out Tavily, ADR-0015)
123
+ searchIncludeDomains: '' # unified domain allowlist (comma-separated; exclusive with exclude, ADR-0018)
124
+ searchExcludeDomains: ''
125
+ tavily: { enabled: true, apiKeyEnv: TAVILY_API_KEY, baseURL: '', maxResults: 5,
126
+ topic: general, timeRange: '', searchDepth: '', includeAnswer: basic,
127
+ chunksPerSource: 3, filterByLanguage: false, includeDomainsMode: filter,
128
+ startDate: '', endDate: '', exactMatch: false, keySelection: round-robin }
129
+ exa: { enabled: true, apiKeyEnv: EXA_API_KEY, baseURL: '', numResults: 5,
130
+ type: auto, textFallback: true, startPublishedDate: '', endPublishedDate: '',
131
+ category: '', maxAgeHours: 720, textVerbosity: '', includeSections: '',
132
+ excludeSections: '', keySelection: round-robin }
133
+ firecrawl: { enabled: true, apiKeyEnv: FIRECRAWL_API_KEY, baseURL: '', tbs: '',
134
+ safe: false, location: '', sources: '', categories: '', keySelection: round-robin }
135
+ anysearch: { enabled: true, apiKeyEnv: ANYSEARCH_API_KEY, baseURL: '', zone: cn,
136
+ keySelection: round-robin }
137
+ deepseek: { enabled: false, apiKeyEnv: DEEPSEEK_API_KEY, baseURL: '', model: '',
138
+ maxTokens: 0, maxUses: 5, keySelection: round-robin }
139
+ ```
140
+
141
+ Combination constraints (fail-loud: on 0.1.5/0.1.6 hosts the settings validate hook rejects the write up front; on 0.1.7+ hosts this degrades to a loud resolve-time failure — ADR-0021; the cordis.yml load throw holds on both generations):
142
+ - `searchIncludeDomains` and `searchExcludeDomains` are mutually exclusive (ADR-0018).
143
+ - `exa.includeSections/excludeSections` require `exa.maxAgeHours: 0` or `-1` (upstream constraint).
144
+ - `firecrawl.tbs` must follow the official tbs grammar (`qdr:*` / `sbd:1` / `cdr:1,cd_min:…,cd_max:…`, comma-combined).
145
+
146
+ ## FAQ / known behavior
147
+
148
+ - **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.
149
+ - **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.
150
+ - **AnySearch vertical tag/params not implemented**: pending a key probe (registered S22).
151
+ - **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.
152
+ - **Upgrades**: see [docs/upgrade.md](docs/upgrade.md).
153
+
154
+ ## More docs
155
+
156
+ - Architecture: [docs/00-architecture.md](docs/00-architecture.md)
157
+ - Decision records: [docs/decisions/](docs/decisions/) (ADR-0001..0020)
158
+ - Upgrade rehearsal manual: [docs/upgrade.md](docs/upgrade.md)
159
+ - Governance board: [docs/STATUS.md](docs/STATUS.md)
package/README.md ADDED
@@ -0,0 +1,158 @@
1
+ # dsh-websearch
2
+
3
+ > **语言权威声明**:本文件为中文事实正本;`README.en.md` 为英文镜像,两文件不一致时以本文件为准。
4
+ > 版本线:**v0.1.0** 起(ADR-0020)。内部开发编号 0.2.0–0.9.0 归历史档,见 CHANGELOG。
5
+
6
+ `dsh-websearch` 是 [deepseek-harness](https://github.com/)(`dsh`)的**外挂式统一网页搜索管理插件**:零内核侵入,把多家搜索供应商收编进一个标准插件,提供用户可配置的优先级链、完整高可用降级、多 API key 池、统一 web_fetch 接管,以及 Web 设置页管理 GUI。
7
+
8
+ **成员准入标准**(ADR-0017):高可用 + 有免费额度 + 支持多 API key + 功能实现对齐上游官方 API。
9
+
10
+ | 成员 | 搜索 | 抓取 | 免费额度 |
11
+ |---|---|---|---|
12
+ | Tavily | ✔ | ✔(/extract) | ✔ |
13
+ | Exa | ✔ | ✘(上游无 URL-fetch 能力,永不进 fetch 链) | ✔ |
14
+ | Firecrawl | ✔ | ✔(/v2/scrape) | ✔ |
15
+ | AnySearch | ✔ | ✔(/v1/extract) | ✔ |
16
+ | DeepSeek(付费兜底) | ✔ | ✘ | ✘(付费,默认不参与) |
17
+
18
+ ## 快速开始
19
+
20
+ > ⚠️ **已知上游宿主问题(非本插件缺陷)**:`dsh` **0.1.6-alpha.2** 宿主自身工具调度缺陷——任意工具调用(含 shell/web_search)崩溃 `TOOL_RUNTIME_SCHEDULER.prepare`,无插件净环境可复现。请避开该宿主版本(用 0.1.5-rc.x / 0.1.6-alpha.1 / 0.1.7-alpha.x),或等上游修复。详见 [docs/upgrade.md](docs/upgrade.md) 三线矩阵。
21
+
22
+ 前置:宿主 `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`,S32 全跨度——显式钉已演练预发布版)、node ≥ 22.19。
23
+
24
+ ```sh
25
+ # 1. 打包(仓库根)
26
+ pnpm install && pnpm run build && npm pack # 产出 dsh-websearch-<version>.tgz
27
+
28
+ # 2. 安装进 web profile(装即接管,ADR-0013)
29
+ dsh plugin --profile web add /path/to/dsh-websearch-<version>.tgz
30
+
31
+ # 3. 验证组合(无需实例/无 LLM 即可读出选择标量)
32
+ dsh --profile web --dump-config
33
+ # web 行 searchProvider: dshws-chain / fetchProvider: dshws-fetch-gate
34
+ # dsh-websearch insert 行出现
35
+ ```
36
+
37
+ **装即接管**:插件随包 `cordis.patch.yml` 钉 `searchProvider: dshws-chain` + `fetchProvider: dshws-fetch-gate`——`plugin add` 单命令即接管,`plugin remove` 单命令完整复原(dump diff 零输出)。无需手写用户层 patch。
38
+
39
+ **卸载**:`dsh plugin --profile web remove dsh-websearch`。已知残留(诚实披露):settings 默认值与预设目录不随 remove 清理(无害,用户自撰同名目录永不覆写)。
40
+
41
+ ## 安装、升级与注意事项
42
+
43
+ **安装**(宿主 peer 域见上——覆盖 0.1.5-rc 线、0.1.6 与 0.1.7 预发布线及未来 0.1.6/0.1.7 稳定版,上限 0.1.8):
44
+
45
+ ```sh
46
+ # 方式一:从本仓库发布页取 tarball
47
+ dsh plugin --profile web add <dsh-websearch-tarball>
48
+ # 方式二:从源码自行打包
49
+ git clone https://github.com/GeerMrc/dsh-websearch.git && cd dsh-websearch
50
+ pnpm install && pnpm run build && npm pack # 产出 dsh-websearch-<ver>.tgz
51
+ # 方式三:profile package.json 依赖 file: 指向 tarball 后 pnpm install
52
+ ```
53
+
54
+ 安装即接管 web_search / web_fetch(bundle 钉扎安装序,后写者赢);卸载自动复原宿主默认。换包后浏览器整页刷新(client 走 `/plugins/*?rev=` 运行时路由)。
55
+
56
+ **升级**:完整演练手册见 [docs/upgrade.md](docs/upgrade.md)(打包→换包→dump 对照→GUI 冒烟→搜索→降级六步)。同版本号换包会被跳过——预览场景先 bump 版本。
57
+
58
+ **注意事项**:
59
+ - key 值永不下发客户端;设置页徽标只显示整数计数(refs 白名单限定五成员,防跨凭据探测)。
60
+ - 宿主升级换供版 worktree 后需先在该 worktree `pnpm install && pnpm run build`,profile 链接(symlink healing)才能解析到完整 `lib/`。
61
+ - 0.1.6-alpha.1 起 loader 非事务化:插件启动失败表现为 fiber FAILED + 日志(不再整树回滚),排障看 `<dshHome>/logs/`。
62
+
63
+ ## 从 anysearch 插件迁移(ADR-0013)
64
+
65
+ 原 `@anysearch/anysearch-dsh` 用户:**先卸载再安装**即完成切换(bundle 钉扎安装序,后写者赢):
66
+
67
+ ```sh
68
+ dsh plugin --profile web remove @anysearch/anysearch-dsh # 或其安装名
69
+ dsh plugin --profile web add /path/to/dsh-websearch-<version>.tgz
70
+ ```
71
+
72
+ - 两插件 id 前缀不同(`anysearch` vs `dshws-*`),零冲突;本插件含 `dshws-anysearch` 成员,key 沿用 `ANYSEARCH_API_KEY`。
73
+ - **否决/自定义**(用户层终裁):若用户层 `cordis.patch.yml` 整段替换 web 行 config,须重述 `searchProvider` 与 `fetchProvider` 两键,否则在配置了 firecrawl key 的场景触发 `WEB_PROVIDER_AMBIGUOUS` 硬错(响亮失败,非静默)。
74
+
75
+ ## Key 配置(多 key 单槽逗号值,ADR-0011)
76
+
77
+ key 一律走宿主 credentials 服务(credential-ref = 环境变量名),**零明文进配置文件**。解析四层:进程环境 > `~/.dsh/.credentials.yaml` > 项目 .env > 用户 .env;每操作解析,热生效。
78
+
79
+ 每成员一个 ref(默认 `TAVILY_API_KEY` / `EXA_API_KEY` / `FIRECRAWL_API_KEY` / `ANYSEARCH_API_KEY` / `DEEPSEEK_API_KEY`,可经 `apiKeyEnv` 改名)。**多 key = 同一 ref 的值写成逗号分隔**(如 `TAVILY_API_KEY=key1,key2,key3`),或 GUI 设置页 Key 输入框直接输入逗号串。
80
+
81
+ 取 key 策略 `keySelection`(默认 `round-robin`):`order`(按序)/ `round-robin`(轮询)/ `random`(不放回随机,ADR-0012——升序 Fisher-Yates 牌堆,同一轮不重抽)。
82
+
83
+ ## GUI 设置页导览
84
+
85
+ 安装后 Web 端「设置 → 网页搜索」:
86
+
87
+ - **成员卡**(默认折叠,整卡头部点击展开):状态绿点、名称、**Key 计数徽标**(仅展开态,14px 圆同「?」图标尺寸:0=灰空心圆,N=绿色数字圆=插件激活色,超 10=警示色;悬停显示 `已配置 N/10`,展开瞬间自动刷新计数)、未保存 pill、启停开关;展开区 = API Key 输入(明文输入/保存后 •••• 遮罩/清除)、Key 策略循环 chip、接口地址覆盖(留空=默认)、逐成员参数(对齐上游官方枚举,ⓘ 悬停有完整语义说明)。
88
+ - **搜索链 / Web Fetch 链**:双链独立排序(ADR-0019),启停即时生效(下一次搜索)。
89
+ - **详细配置折叠区**:兜底搜索选择器、超时预算、DeepSeek maxUses、统一语言/区域(ADR-0015)。
90
+ - **溯源徽标**(ADR-0010):会话工具行显示 `[served-by: <成员id>]`,模型可据实引用来源。
91
+
92
+ ## 链语义(ADR-0002 / ADR-0014)
93
+
94
+ - 按序遍历:未注册/未启用/凭据未就绪 → 跳过;运行失败或超时(`perMemberTimeoutMs`,默认 30000)→ 降级下一成员;某成员成功即返回。
95
+ - 同工具 key 级重试:池 >1 key 时,失败先同成员重抽 ≤3 次(ADR-0012),再降级。
96
+ - 全部耗尽 → `DSHWS_CHAIN_EXHAUSTED`(附逐成员失败摘要,fail-loud)。
97
+ - **兜底**(`fallbackMember`,ADR-0014):`auto`(默认,链尾即兜底)/ 指定工具成员(钉尾,退出常规轮转)/ `dshws-deepseek`(付费兜底:仅当就绪工具成员 ≤1 且其 key 已配置时参与,运行时守卫,非静态追加)。
98
+ - 用户在宿主层钉死单成员(`searchProvider: dshws-tavily` 等)= 直连不降级。
99
+
100
+ ## web_fetch 接管(ADR-0019)
101
+
102
+ `fetchProvider` 钉 `dshws-fetch-gate`(gate 运行时路由器):
103
+
104
+ - **接管开**(`fetchTakeover: true`,默认):web_fetch 由内部 fetch 链服务——Firecrawl → Tavily → AnySearch 降序降级(Exa 无上游 fetch 能力,永不进链)。云端抓取不受本机代理/SSRF 限制。
105
+ - **接管关**:gate 回落内置 http 直抓(官方行为等价近似;patch 钉死下官方 provider 实例永不被选)。
106
+ - 两态开关在 GUI 与 settings 热生效(下一个 agent / 下一次调用)。
107
+
108
+ ## 配置参考(cordis.yml `dsh-websearch` 节)
109
+
110
+ > 唯一正本 = `src/config.ts` schema;此处摘录常用面。全字段热生效(下一次搜索)。GUI 写入与 cordis.yml 同 schema。
111
+
112
+ ```yaml
113
+ dsh-websearch:
114
+ searchChain: [] # 搜索链;空 = tavily→exa→firecrawl→anysearch
115
+ fetchChain: [] # fetch 链;空 = firecrawl→tavily→anysearch
116
+ perMemberTimeoutMs: 30000 # 每成员超时预算
117
+ fallbackMember: auto # auto | 成员id | dshws-deepseek(付费兜底)
118
+ fetchTakeover: true # web_fetch 接管两态开关
119
+ chainLogFile: true # 链路日志 <dshHome>/logs/dsh-websearch.log
120
+ searchCountry: '' # 统一区域 ISO 3166-1 alpha-2(fan-out Exa/Firecrawl,ADR-0015)
121
+ searchLanguage: '' # 统一语言 ISO 639-1(fan-out Tavily,ADR-0015)
122
+ searchIncludeDomains: '' # 统一域名白名单(逗号分隔;与 exclude 互斥,ADR-0018)
123
+ searchExcludeDomains: ''
124
+ tavily: { enabled: true, apiKeyEnv: TAVILY_API_KEY, baseURL: '', maxResults: 5,
125
+ topic: general, timeRange: '', searchDepth: '', includeAnswer: basic,
126
+ chunksPerSource: 3, filterByLanguage: false, includeDomainsMode: filter,
127
+ startDate: '', endDate: '', exactMatch: false, keySelection: round-robin }
128
+ exa: { enabled: true, apiKeyEnv: EXA_API_KEY, baseURL: '', numResults: 5,
129
+ type: auto, textFallback: true, startPublishedDate: '', endPublishedDate: '',
130
+ category: '', maxAgeHours: 720, textVerbosity: '', includeSections: '',
131
+ excludeSections: '', keySelection: round-robin }
132
+ firecrawl: { enabled: true, apiKeyEnv: FIRECRAWL_API_KEY, baseURL: '', tbs: '',
133
+ safe: false, location: '', sources: '', categories: '', keySelection: round-robin }
134
+ anysearch: { enabled: true, apiKeyEnv: ANYSEARCH_API_KEY, baseURL: '', zone: cn,
135
+ keySelection: round-robin }
136
+ deepseek: { enabled: false, apiKeyEnv: DEEPSEEK_API_KEY, baseURL: '', model: '',
137
+ maxTokens: 0, maxUses: 5, keySelection: round-robin }
138
+ ```
139
+
140
+ 组合限制(fail-loud:0.1.5/0.1.6 宿主 settings validate hook 写前拒写;0.1.7+ 宿主降级为读取时 loud 失败——ADR-0021;cordis.yml 加载报错两代恒在):
141
+ - `searchIncludeDomains` 与 `searchExcludeDomains` 互斥(ADR-0018)。
142
+ - `exa.includeSections/excludeSections` 须配 `exa.maxAgeHours: 0` 或 `-1`(官方约束)。
143
+ - `firecrawl.tbs` 须为官方 tbs 文法(`qdr:*` / `sbd:1` / `cdr:1,cd_min:…,cd_max:…` 逗号组合)。
144
+
145
+ ## FAQ / 已知行为
146
+
147
+ - **官方 web_fetch 在代理环境报错**:宿主 SSRF 硬防护 × TUN fake-ip 所致(非本插件 bug)。开 `fetchTakeover` 走云端 extract 链即绕开。
148
+ - **Perplexity 哪去了**:已移除(ADR-0017——无免费额度可申请,不满足准入标准)。存量 settings.yaml 的 `perplexity:` 残节无害(schema 透传),可手动清理。
149
+ - **AnySearch 垂直面 tag/params 未实现**:待 key 探针(S22 登记)。
150
+ - **宿主设置页闲置的 web-search-deepseek 配置卡**:接管后不生效仍在(其 key 保存为对 `DEEPSEEK_API_KEY` 的单值写入点)——已知行为,勿在那里配置多 key。
151
+ - **升级**:见 [docs/upgrade.md](docs/upgrade.md)。
152
+
153
+ ## 更多文档
154
+
155
+ - 架构正本:[docs/00-architecture.md](docs/00-architecture.md)
156
+ - 决策记录:[docs/decisions/](docs/decisions/)(ADR-0001..0020)
157
+ - 升级演练手册:[docs/upgrade.md](docs/upgrade.md)
158
+ - 治理看板:[docs/STATUS.md](docs/STATUS.md)
@@ -0,0 +1,9 @@
1
+ - insert:
2
+ - id: dsh-websearch
3
+ name: dsh-websearch
4
+ - id: web
5
+ config:
6
+ searchProvider: dshws-chain
7
+ fetchProvider: dshws-fetch-gate
8
+ - id: web-search-deepseek
9
+ disabled: true