@maricgeer/dsh-websearch 0.1.2 → 0.2.0
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 +33 -8
- package/README.md +33 -8
- package/lib/client.js +2503 -1021
- package/lib/index.d.ts +103 -10
- package/lib/index.js +1706 -164
- package/package.json +25 -24
package/README.en.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# dsh-websearch
|
|
2
2
|
|
|
3
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
|
|
4
|
+
> 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
5
|
|
|
6
|
-
`dsh-websearch` is an out-of-tree unified web-search management plugin for
|
|
6
|
+
`dsh-websearch` is an out-of-tree unified web-search management plugin for deepseek-harness (`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
7
|
|
|
8
8
|
**Member admission bar** (ADR-0017): high availability + a free tier + multi-API-key support + upstream-aligned feature implementation.
|
|
9
9
|
|
|
@@ -17,13 +17,15 @@
|
|
|
17
17
|
|
|
18
18
|
## Quick start
|
|
19
19
|
|
|
20
|
-
> ⚠️ **Known upstream host
|
|
20
|
+
> ⚠️ **Known upstream host issues (not this plugin)** — see **[docs/known-upstream-issues.md](docs/known-upstream-issues.md)** (in Chinese; symptoms/affected versions/workarounds/self-check commands):
|
|
21
|
+
> 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
|
+
> 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).
|
|
21
23
|
|
|
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
|
|
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.
|
|
23
25
|
|
|
24
26
|
```sh
|
|
25
27
|
# 1. Pack (repo root)
|
|
26
|
-
pnpm install && pnpm run build &&
|
|
28
|
+
pnpm install && pnpm run build && node scripts/pack.mjs # dual tarballs: bare dsh-websearch-<ver>.tgz (profile installs) + scoped (npm)
|
|
27
29
|
|
|
28
30
|
# 2. Install into the web profile (install-driven takeover, ADR-0013)
|
|
29
31
|
dsh plugin --profile web add /path/to/dsh-websearch-<version>.tgz
|
|
@@ -41,14 +43,22 @@ dsh --profile web --dump-config
|
|
|
41
43
|
|
|
42
44
|
## Install, upgrade, and notes
|
|
43
45
|
|
|
44
|
-
**Install** (peer range as above — covers the 0.1.5-rc line, the 0.1.6
|
|
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):
|
|
47
|
+
|
|
48
|
+
Option 1 (npm registry, recommended):
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
dsh plugin --profile web add @maricgeer/dsh-websearch
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
(npm page: https://www.npmjs.com/package/@maricgeer/dsh-websearch — the bare name `dsh-websearch` was rejected by npm's typo-squatting policy as too similar to the existing `dsh-web-search`, hence the scoped distribution name; the plugin registers as `dsh-websearch` either way, identical behavior to a local tarball install)
|
|
45
55
|
|
|
46
56
|
```sh
|
|
47
57
|
# Option 1: grab the tarball from this repository's releases page
|
|
48
58
|
dsh plugin --profile web add <dsh-websearch-tarball>
|
|
49
59
|
# Option 2: pack from source
|
|
50
60
|
git clone https://github.com/GeerMrc/dsh-websearch.git && cd dsh-websearch
|
|
51
|
-
pnpm install && pnpm run build &&
|
|
61
|
+
pnpm install && pnpm run build && node scripts/pack.mjs # dual tarballs into dist-artifacts/
|
|
52
62
|
# Option 3: a file: tarball dependency in the profile package.json + pnpm install
|
|
53
63
|
```
|
|
54
64
|
|
|
@@ -56,6 +66,8 @@ Installing takes over web_search / web_fetch (bundle-pinned install order, last
|
|
|
56
66
|
|
|
57
67
|
**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
68
|
|
|
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).
|
|
70
|
+
|
|
59
71
|
**Notes**:
|
|
60
72
|
- Key values never reach the client; the settings badge shows integer counts only (refs whitelisted to the five members, blocking cross-credential probing).
|
|
61
73
|
- 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.
|
|
@@ -89,6 +101,7 @@ After install, Web UI "Settings → Web Search":
|
|
|
89
101
|
- **Search chain / Web Fetch chain**: two independently orderable chains (ADR-0019), effective on the next search.
|
|
90
102
|
- **Advanced fold**: fallback selector, timeout budget, DeepSeek maxUses, unified language/region (ADR-0015).
|
|
91
103
|
- **Provenance badge** (ADR-0010): session tool rows show `[served-by: <member-id>]`.
|
|
104
|
+
- **DNS resilience card** (v0.2.0, ADR-0022): member-card-style header with an on/off Switch; mode (auto/on/off), DoH preset (auto/CN/global/custom nodes), probe method (TCP/TLS), live detection status with evidence, and the Inspect resolution trace — see the section below.
|
|
92
105
|
|
|
93
106
|
## Chain semantics (ADR-0002 / ADR-0014)
|
|
94
107
|
|
|
@@ -106,6 +119,17 @@ After install, Web UI "Settings → Web Search":
|
|
|
106
119
|
- **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
120
|
- The two-state toggle is hot in GUI and settings (next agent / next call).
|
|
108
121
|
|
|
122
|
+
## DNS resilience layer (v0.2.0, ADR-0022)
|
|
123
|
+
|
|
124
|
+
Process-level resolution high availability under side-router/controlled networks (applies to all upstream requests of this plugin; other processes untouched):
|
|
125
|
+
|
|
126
|
+
- **Automatic detection** (default `mode: auto`): a startup canary cross-checks member domains and enables DoH on poisoning evidence (e.g. 198.18.0.0/15 fake-ips); clean networks see zero behavior change (zero hits uninstall the patch).
|
|
127
|
+
- **DoH encrypted resolution**: bypasses transparent port-53 interception; regional preset pools (AliDNS/DNSPod for CN, Cloudflare/Google/Quad9 globally) with bootstrap auto-selection (RTT ranked).
|
|
128
|
+
- **Egress probing** (`dns.probe.method`): TCP-443 or TLS-Hello (SNI-carrying; default tcp) probes IP reachability, filtering CDN-rotation-stale unreachable IPs — the empirically effective measure on (SNI, IP) tuple-filtered networks.
|
|
129
|
+
- **Multi-level degradation**: DoH total failure falls back to system resolution exactly once; connect-level failures retry once after a fresh resolve, then degrade to the next member (no key-budget burn).
|
|
130
|
+
- **Privacy red lines**: hostnames in logs/traces are sanitized (non-member hosts hashed + last two labels); an active proxy environment suspends the layer (system path).
|
|
131
|
+
- Chain-log `[dshws-dns]` / `[dshws-chain] connect-flap` lines carry a 4-hex run key for concurrent-run attribution.
|
|
132
|
+
|
|
109
133
|
## Configuration reference (`dsh-websearch` section of cordis.yml)
|
|
110
134
|
|
|
111
135
|
> 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.
|
|
@@ -152,8 +176,9 @@ Combination constraints (fail-loud: on 0.1.5/0.1.6 hosts the settings validate h
|
|
|
152
176
|
- **Upgrades**: see [docs/upgrade.md](docs/upgrade.md).
|
|
153
177
|
|
|
154
178
|
## More docs
|
|
179
|
+
- [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)
|
|
155
180
|
|
|
156
181
|
- Architecture: [docs/00-architecture.md](docs/00-architecture.md)
|
|
157
|
-
- Decision records: [docs/decisions/](docs/decisions/) (ADR-0001..
|
|
182
|
+
- Decision records: [docs/decisions/](docs/decisions/) (ADR-0001..0022)
|
|
158
183
|
- Upgrade rehearsal manual: [docs/upgrade.md](docs/upgrade.md)
|
|
159
184
|
- Governance board: [docs/STATUS.md](docs/STATUS.md)
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# dsh-websearch
|
|
2
2
|
|
|
3
3
|
> **语言权威声明**:本文件为中文事实正本;`README.en.md` 为英文镜像,两文件不一致时以本文件为准。
|
|
4
|
-
>
|
|
4
|
+
> 版本线:v0.1.0 起(ADR-0020);**v0.2.0 = DNS 韧性层 + 上游对齐二轮收口**(ADR-0022;含四工具上游对齐修复与质量批——单一版本发布)。内部开发编号 0.2.0–0.9.0 归历史档,见 CHANGELOG。
|
|
5
5
|
|
|
6
|
-
`dsh-websearch` 是
|
|
6
|
+
`dsh-websearch` 是 deepseek-harness(`dsh`)的**外挂式统一网页搜索管理插件**:零内核侵入,把多家搜索供应商收编进一个标准插件,提供用户可配置的优先级链、完整高可用降级、多 API key 池、统一 web_fetch 接管,以及 Web 设置页管理 GUI。
|
|
7
7
|
|
|
8
8
|
**成员准入标准**(ADR-0017):高可用 + 有免费额度 + 支持多 API key + 功能实现对齐上游官方 API。
|
|
9
9
|
|
|
@@ -17,13 +17,15 @@
|
|
|
17
17
|
|
|
18
18
|
## 快速开始
|
|
19
19
|
|
|
20
|
-
> ⚠️
|
|
20
|
+
> ⚠️ **已知上游宿主问题(非本插件缺陷)**,详见 **[docs/known-upstream-issues.md](docs/known-upstream-issues.md)**(现象/影响版本/规避/自查命令,照做即可):
|
|
21
|
+
> 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
|
+
> 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)。
|
|
21
23
|
|
|
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
|
|
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。
|
|
23
25
|
|
|
24
26
|
```sh
|
|
25
27
|
# 1. 打包(仓库根)
|
|
26
|
-
pnpm install && pnpm run build &&
|
|
28
|
+
pnpm install && pnpm run build && node scripts/pack.mjs # 双名 tarball:裸名 dsh-websearch-<ver>.tgz(profile 安装)+ scoped(npm)
|
|
27
29
|
|
|
28
30
|
# 2. 安装进 web profile(装即接管,ADR-0013)
|
|
29
31
|
dsh plugin --profile web add /path/to/dsh-websearch-<version>.tgz
|
|
@@ -42,18 +44,28 @@ dsh --profile web --dump-config
|
|
|
42
44
|
|
|
43
45
|
**安装**(宿主 peer 域见上——覆盖 0.1.5-rc 线、0.1.6 与 0.1.7 预发布线及未来 0.1.6/0.1.7 稳定版,上限 0.1.8):
|
|
44
46
|
|
|
47
|
+
方式一(npm registry,推荐):
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
dsh plugin --profile web add @maricgeer/dsh-websearch
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
(npm 包页 https://www.npmjs.com/package/@maricgeer/dsh-websearch ;裸名 `dsh-websearch` 因 npm 防仿冒政策与既有包 `dsh-web-search` 过近被拒,故用 scope 分发——插件注册 id 仍为 `dsh-websearch`,功能与本地 tarball 安装完全一致)
|
|
54
|
+
|
|
45
55
|
```sh
|
|
46
56
|
# 方式一:从本仓库发布页取 tarball
|
|
47
57
|
dsh plugin --profile web add <dsh-websearch-tarball>
|
|
48
58
|
# 方式二:从源码自行打包
|
|
49
59
|
git clone https://github.com/GeerMrc/dsh-websearch.git && cd dsh-websearch
|
|
50
|
-
pnpm install && pnpm run build &&
|
|
60
|
+
pnpm install && pnpm run build && node scripts/pack.mjs # 双名 tarball 入 dist-artifacts/
|
|
51
61
|
# 方式三:profile package.json 依赖 file: 指向 tarball 后 pnpm install
|
|
52
62
|
```
|
|
53
63
|
|
|
54
64
|
安装即接管 web_search / web_fetch(bundle 钉扎安装序,后写者赢);卸载自动复原宿主默认。换包后浏览器整页刷新(client 走 `/plugins/*?rev=` 运行时路由)。
|
|
55
65
|
|
|
56
|
-
**升级**:完整演练手册见 [docs/upgrade.md](docs/upgrade.md)(打包→换包→dump 对照→GUI
|
|
66
|
+
**升级**:完整演练手册见 [docs/upgrade.md](docs/upgrade.md)(打包→换包→dump 对照→GUI 冒烟→搜索→降级六步 + 发版前上游对齐确认)。同版本号换包会被跳过——预览场景先 bump 版本。
|
|
67
|
+
|
|
68
|
+
**CI/发布**(v0.2.0 起):master 推送/PR 跑全量门禁(typecheck/lint/test/i18n/build,node 22/24 矩阵);推送 `v*` 标签自动发布——双名 tarball 附 GitHub Release、scoped 包发布至 npmjs.org(标签推送即发布确认点)。
|
|
57
69
|
|
|
58
70
|
**注意事项**:
|
|
59
71
|
- key 值永不下发客户端;设置页徽标只显示整数计数(refs 白名单限定五成员,防跨凭据探测)。
|
|
@@ -88,6 +100,7 @@ key 一律走宿主 credentials 服务(credential-ref = 环境变量名),*
|
|
|
88
100
|
- **搜索链 / Web Fetch 链**:双链独立排序(ADR-0019),启停即时生效(下一次搜索)。
|
|
89
101
|
- **详细配置折叠区**:兜底搜索选择器、超时预算、DeepSeek maxUses、统一语言/区域(ADR-0015)。
|
|
90
102
|
- **溯源徽标**(ADR-0010):会话工具行显示 `[served-by: <成员id>]`,模型可据实引用来源。
|
|
103
|
+
- **DNS 韧性卡**(v0.2.0,ADR-0022):成员卡同构头部(启停 Switch),模式(自动/开启/关闭)、DoH 预设(自动/国内/海外/自定义节点)、探测方式(TCP/TLS)、检测状态与证据、Inspect 最近解析 trace;详见下节。
|
|
91
104
|
|
|
92
105
|
## 链语义(ADR-0002 / ADR-0014)
|
|
93
106
|
|
|
@@ -105,6 +118,17 @@ key 一律走宿主 credentials 服务(credential-ref = 环境变量名),*
|
|
|
105
118
|
- **接管关**:gate 回落内置 http 直抓(官方行为等价近似;patch 钉死下官方 provider 实例永不被选)。
|
|
106
119
|
- 两态开关在 GUI 与 settings 热生效(下一个 agent / 下一次调用)。
|
|
107
120
|
|
|
121
|
+
## DNS 韧性层(v0.2.0,ADR-0022)
|
|
122
|
+
|
|
123
|
+
旁路由/受控网络下的进程级解析高可用(对本插件的全部上游请求生效;不影响插件外进程):
|
|
124
|
+
|
|
125
|
+
- **自动检测**(默认 `mode: auto`):启动金丝雀对成员域名做双路对照,命中投毒证据(如 198.18.0.0/15 fake-ip)自动启用 DoH;干净网络零行为变化(零命中即卸载补丁)。
|
|
126
|
+
- **DoH 加密解析**:绕开 53 端口透明拦截;区域预设池(国内 AliDNS/DNSPod,海外 Cloudflare/Google/Quad9)+ bootstrap 自动选点(RTT 排序)。
|
|
127
|
+
- **出口预检**(`dns.probe.method`):TCP-443 或 TLS-Hello(带 SNI,默认 tcp)探测 IP 可达性,过滤 CDN 轮换滞后的不可达 IP——(SNI, IP) 元组过滤网络的实测有效项。
|
|
128
|
+
- **多级降级**:DoH 全灭回退系统解析恰一次;连接级失败 fresh 解析后重试一次即降级下一成员(不烧 key 额度)。
|
|
129
|
+
- **隐私红线**:日志/trace 的主机名脱敏(非成员域名哈希+末两标);代理环境变量在位时自动暂停(走系统路径)。
|
|
130
|
+
- 链路日志 `[dshws-dns]`/`[dshws-chain] connect-flap` 行含 4-hex 运行键,可并行归属。
|
|
131
|
+
|
|
108
132
|
## 配置参考(cordis.yml `dsh-websearch` 节)
|
|
109
133
|
|
|
110
134
|
> 唯一正本 = `src/config.ts` schema;此处摘录常用面。全字段热生效(下一次搜索)。GUI 写入与 cordis.yml 同 schema。
|
|
@@ -151,8 +175,9 @@ dsh-websearch:
|
|
|
151
175
|
- **升级**:见 [docs/upgrade.md](docs/upgrade.md)。
|
|
152
176
|
|
|
153
177
|
## 更多文档
|
|
178
|
+
- [docs/known-upstream-issues.md](docs/known-upstream-issues.md) —— 已知上游 DSH 问题登记表(现象/规避/自查命令,含 fork 修复分支用法)
|
|
154
179
|
|
|
155
180
|
- 架构正本:[docs/00-architecture.md](docs/00-architecture.md)
|
|
156
|
-
- 决策记录:[docs/decisions/](docs/decisions/)(ADR-0001..
|
|
181
|
+
- 决策记录:[docs/decisions/](docs/decisions/)(ADR-0001..0022)
|
|
157
182
|
- 升级演练手册:[docs/upgrade.md](docs/upgrade.md)
|
|
158
183
|
- 治理看板:[docs/STATUS.md](docs/STATUS.md)
|