dsh-web-search-enhanced 0.1.9 → 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.
Files changed (63) hide show
  1. package/README.md +59 -160
  2. package/lib/client.cjs +5620 -0
  3. package/lib/client.cjs.map +1 -0
  4. package/lib/index.js +3797 -2182
  5. package/locale/en.json +1 -1
  6. package/locale/zh.json +1 -1
  7. package/package.json +46 -84
  8. package/CHANGELOG.md +0 -249
  9. package/cordis.patch.yml +0 -29
  10. package/lib/client.js +0 -3614
  11. package/lib/client.js.map +0 -1
  12. package/lib/types/catalog.d.ts +0 -201
  13. package/lib/types/client/ActivationPrompt.d.ts +0 -4
  14. package/lib/types/client/command.d.ts +0 -12
  15. package/lib/types/client/connections.d.ts +0 -41
  16. package/lib/types/client/index.d.ts +0 -9
  17. package/lib/types/client/locales.d.ts +0 -218
  18. package/lib/types/client/selection.d.ts +0 -59
  19. package/lib/types/client/selector/SearchSelector.d.ts +0 -29
  20. package/lib/types/client/settings/ConnectionEditor.d.ts +0 -22
  21. package/lib/types/client/settings/CredentialEditor.d.ts +0 -10
  22. package/lib/types/client/settings/CustomConnections.d.ts +0 -13
  23. package/lib/types/client/settings/DefaultsSection.d.ts +0 -7
  24. package/lib/types/client/settings/OptionsEditor.d.ts +0 -32
  25. package/lib/types/client/settings/ServicesSection.d.ts +0 -13
  26. package/lib/types/client/settings/SettingsPage.d.ts +0 -21
  27. package/lib/types/client/settings/connection-form.d.ts +0 -55
  28. package/lib/types/client/settings/credentials.d.ts +0 -24
  29. package/lib/types/client/settings/model.d.ts +0 -52
  30. package/lib/types/client/settings/parts.d.ts +0 -65
  31. package/lib/types/client/settings/sparse.d.ts +0 -26
  32. package/lib/types/host/connections.d.ts +0 -7
  33. package/lib/types/host/follow-model.d.ts +0 -50
  34. package/lib/types/host/pairings.d.ts +0 -13
  35. package/lib/types/host/remote.d.ts +0 -13
  36. package/lib/types/host/restriction.d.ts +0 -11
  37. package/lib/types/host/runtime.d.ts +0 -6
  38. package/lib/types/host/selections.d.ts +0 -61
  39. package/lib/types/host/snapshots.d.ts +0 -47
  40. package/lib/types/host/storage.d.ts +0 -47
  41. package/lib/types/index.d.ts +0 -33
  42. package/lib/types/remote-contract.d.ts +0 -103
  43. package/lib/types/search/adapters/deepseek.d.ts +0 -2
  44. package/lib/types/search/adapters/exa.d.ts +0 -2
  45. package/lib/types/search/adapters/firecrawl.d.ts +0 -2
  46. package/lib/types/search/adapters/index.d.ts +0 -5
  47. package/lib/types/search/adapters/openalex.d.ts +0 -2
  48. package/lib/types/search/adapters/semanticscholar.d.ts +0 -2
  49. package/lib/types/search/adapters/tavily.d.ts +0 -2
  50. package/lib/types/search/adapters/tinyfish.d.ts +0 -2
  51. package/lib/types/search/adapters/types.d.ts +0 -45
  52. package/lib/types/search/errors.d.ts +0 -9
  53. package/lib/types/search/execute.d.ts +0 -22
  54. package/lib/types/search/http.d.ts +0 -29
  55. package/lib/types/search/mcp.d.ts +0 -18
  56. package/lib/types/search/model.d.ts +0 -14
  57. package/lib/types/search/sources.d.ts +0 -31
  58. package/lib/types/settings/legacy.d.ts +0 -20
  59. package/lib/types/settings/migrator.d.ts +0 -9
  60. package/lib/types/settings/options.d.ts +0 -9
  61. package/lib/types/settings/resolve.d.ts +0 -63
  62. package/lib/types/settings/types.d.ts +0 -72
  63. package/lib/types/settings/version.d.ts +0 -15
package/README.md CHANGED
@@ -1,163 +1,62 @@
1
- <div align="center">
1
+ # dsh-web-search-enhanced
2
2
 
3
- ![Q 版 DeepSeek 鲸鱼娘与 Web Search Enhanced](docs/assets/deepseek-search-banner.png)
3
+ Search half of [dsh-tool-web-enhanced-profile](../profile/README.md).
4
+ **Install the profile, not this package**: the profile mounts this package as
5
+ row `web-search-enhanced` and selects its provider in the shared `web` row.
4
6
 
5
- # Web Search Enhanced
6
-
7
- **为每个会话选择网页搜索方式:免密钥起步,也可以用自己的密钥、DeepSeek 搜索或模型自带的搜索。**
8
-
9
- [![Release](https://img.shields.io/github/v/release/Yurzi/dsh-web-search-enhanced?style=flat-square)](https://github.com/Yurzi/dsh-web-search-enhanced/releases)
10
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue?style=flat-square)](LICENSE)
11
- [![DSH](https://img.shields.io/badge/DSH-0.2.1--rc.2%2B-536DFE?style=flat-square)](package.json)
12
- [![Node.js](https://img.shields.io/badge/Node.js-22.19%2B%20%7C%2024%2B-green?style=flat-square)](package.json)
13
-
14
- </div>
15
-
16
- dsh-web-search-enhanced 是 [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) 的插件。它接管 DSH 原生的 `web_search` 工具,让每个会话独立选择搜索连接和内容实时性;对话模型和工具调用方式都不变,`web_fetch` 也不受影响。
17
-
18
- ## 特性
19
-
20
- - **装好就能搜**:默认使用 Exa 免密钥搜索;Firecrawl、Tavily、Tinyfish、OpenAlex 同样免密钥可用。
21
- - **按会话选择**:在输入框的地球按钮或 `/setup-search` 中切换,每个会话记住自己的连接和实时性,fork 出的会话之后独立变化。
22
- - **记住模型的搭配**:在某个模型下选过的连接,会成为该模型新会话的默认选择。
23
- - **多种来源**:网页搜索服务、学术检索(OpenAlex、Semantic Scholar)、DeepSeek 搜索(账号登录或 API Key)、固定的搜索模型,或跟随当前会话模型。
24
- - **内容实时性**:自动 / 优先新鲜 / 优先实时,Firecrawl 和 Exa(个人密钥)会据此请求较新的页面内容。
25
- - **密钥安全**:密钥只存放在 DSH 凭据中,设置里只保存引用名;免密钥连接从不发送你的密钥。
26
- - **原生界面**:使用 DSH 的组件和主题,支持深色模式和窄屏,中英文界面。
27
-
28
- ## 截图
29
-
30
- 输入框中的搜索菜单:
31
-
32
- <p align="center">
33
- <img src="docs/assets/selector.png" alt="输入框中的搜索菜单" width="720" />
34
- </p>
35
-
36
- <p align="center"><sub><a href="docs/assets/selector-dark.png">深色模式</a> · <a href="docs/assets/selector-narrow.png">窄屏</a> · <a href="docs/assets/selector-not-ready.png">所选连接缺少密钥</a></sub></p>
37
-
38
- 插件设置页:
39
-
40
- <p align="center">
41
- <img src="docs/assets/settings.png" alt="插件设置页" width="720" />
42
- </p>
43
-
44
- <p align="center"><sub><a href="docs/assets/settings-dark.png">深色模式</a> · <a href="docs/assets/settings-narrow.png">窄屏</a> · <a href="docs/assets/settings-editor.png">添加自定义连接</a></sub></p>
45
-
46
- ## 安装
47
-
48
- 要求 DSH `>=0.2.1-rc.2 <0.3.0`,Node.js `^22.19.0 || >=24.0.0`。
49
-
50
- 从 npm 安装:
51
-
52
- ```sh
53
- dsh plugin --profile web add dsh-web-search-enhanced@0.1.9
54
- ```
55
-
56
- 或安装本地构建的包(例如用 `pnpm pack` 生成),路径需为绝对路径:
57
-
58
- ```sh
59
- dsh plugin --profile web add /absolute/path/to/dsh-web-search-enhanced-0.1.9.tgz
60
- ```
61
-
62
- 也可以在 Web 界面的 **插件** 页安装第三方插件时填入包名 `dsh-web-search-enhanced`。安装后刷新 Web 页面。
63
-
64
- **升级**:DSH 默认开启热更新(HMR),这时不能在已安装的版本上直接再装一次,需要先卸载再安装:在插件页卸载本插件后重新安装,或执行 `dsh plugin --profile web remove dsh-web-search-enhanced` 后再 `add`。设置、密钥和各会话的选择都会保留。从 0.1.8 及更早版本升级前请先阅读[升级指南](docs/upgrading.md)。
65
-
66
- ## 快速上手
67
-
68
- 1. 新建一个会话,直接提问,例如「搜索 TypeScript 最新版本的发布说明,总结主要变化并附上来源」。新会话默认使用 **Exa** 免密钥搜索。
69
- 2. 想换连接或实时性:点输入框右侧的地球按钮,或输入 `/setup-search`。选择只作用于当前会话。缺少密钥的连接会注明原因,点击它可直接打开设置页。
70
- 3. 想配置密钥、默认连接或自定义连接:打开 **插件 → 已安装插件 → 增强网页搜索**,或在搜索菜单底部点「管理搜索连接」。
71
-
72
- ## 搜索连接一览
73
-
74
- | 连接 | 访问方式 | 内容实时性 | 说明 |
75
- | --- | --- | --- | --- |
76
- | Exa(默认) | 免密钥 / 个人密钥 | 仅个人密钥 | 语义检索,个人密钥时返回页面正文片段,可选搜索类型 |
77
- | Firecrawl | 免密钥 / 个人密钥 | 两种方式都支持 | 可按国家、位置筛选;非自动模式下返回新抓取的正文 |
78
- | Tavily | 免密钥 / 个人密钥 | — | 可选搜索深度和主题(通用、新闻、财经) |
79
- | Tinyfish | 免密钥 / 个人密钥 | — | 可按地区、语言筛选;学术论文类型需要个人密钥 |
80
- | DeepSeek | DeepSeek 账号登录,或 `DEEPSEEK_API_KEY` | — | 使用 DeepSeek 账号登录的会话直接用账号;其他会话使用 API Key(与 DSH「模型」页共用) |
81
- | OpenAlex | 免密钥 / 个人密钥 | — | 开放学术图谱,附作者、引用数、开放获取链接和摘要 |
82
- | Semantic Scholar | 仅个人密钥 | — | 学术检索,附 TL;DR、引用数和开放获取 PDF |
83
- | 自定义搜索服务 | 个人密钥 | 同所用服务 | 复用以上任一服务的接口格式,可指向团队网关等自定义地址 |
84
- | 固定搜索模型 | 个人密钥 | — | 通过 Anthropic Messages、OpenAI Responses 或 Chat Completions 的服务端搜索工具检索 |
85
- | 跟随会话模型 | 会话模型的密钥 | — | 用当前会话的模型搜索;provider 配置需写明 `api`,不支持 OAuth 和订阅登录 |
86
-
87
- 免密钥连接使用服务的公共接口,额度与其他用户共享,可能因网络或高峰被拒绝或限流。完整的参数、地址和规则见[配置参考](docs/configuration.md)。
88
-
89
- ## 内容实时性
90
-
91
- 搜索菜单中的「内容实时性」按会话保存:
92
-
93
- - **自动**:使用服务的默认行为,最快。
94
- - **优先新鲜**:优先使用 24 小时内的缓存内容。
95
- - **优先实时**:重新抓取页面,适合刚发生的新闻、行情等。
96
-
97
- 只有 Firecrawl 和 Exa(个人密钥)会据此调整请求;选中其他连接时,菜单中的实时性选项不可用。实时性控制的是内容缓存,不是按发布日期筛选;越新的内容通常越慢、消耗越多额度。
98
-
99
- ## 密钥与凭据
100
-
101
- 在设置页对应服务的配置中填入密钥并保存,密钥写入 DSH 凭据(例如 `EXA_API_KEY`),不会出现在设置文件里。保存密钥后还需把该服务的访问方式切换为个人密钥,插件不会自动切换。
102
-
103
- DSH 0.2.1 起,凭据存储中的值优先于环境变量。如果你习惯用环境变量提供密钥,而凭据存储中已有同名的旧值,环境变量不会生效。
104
-
105
- ## 常见问题
106
-
107
- ### 搜索报 WEB_SEARCH_NOT_SELECTED
108
-
109
- 当前会话在搜索菜单中选择了「不使用搜索」。点输入框的地球按钮或输入 `/setup-search`,选择一个连接即可。新会话的默认连接可在设置页修改。
110
-
111
- ### 免密钥搜索失败或被限流
112
-
113
- `WEB_KEYLESS_UNAVAILABLE` 表示服务拒绝了来自你所在网络的匿名访问,`WEB_PROVIDER_RATE_LIMITED` 表示限流。先在菜单里换一个免密钥连接;经常遇到时,为常用服务配置个人密钥并切换访问方式。
114
-
115
- ### 保存了密钥,搜索仍然是免密钥
116
-
117
- 保存密钥不会改变访问方式,这是为了避免意外消耗付费额度。在设置页该服务的配置中把访问方式切换为个人密钥。
118
-
119
- ### 修改会影响其他会话吗?fork 出的会话呢?
120
-
121
- 不会。每个会话单独保存连接和实时性。fork 出的会话第一次使用时继承父会话当时的选择,之后两边各自修改,互不影响。
122
-
123
- ### 窗口很窄时,搜索按钮只剩一个图标
124
-
125
- 输入栏空间不足时,按钮先隐藏实时性,再隐藏连接名,最后只保留地球图标,点开后的菜单不变。也可以随时用 `/setup-search` 切换。按钮只有在设置中关闭「在输入框显示搜索按钮」时才会完全隐藏。
126
-
127
- ### 内置的“网页搜索”设置页不见了,搜索报 WEB_PROVIDER_CONFIGURED_MISSING
128
-
129
- 本插件的安装补丁停用了 DSH 自带的 `web-search-deepseek` 和 `web-deepseek-api`,所以 **插件 → 内置插件配置 → 网页搜索** 页面不再显示。DeepSeek 搜索可以改用本插件的 DeepSeek 连接。
130
-
131
- 如果以前在那个页面打开或关闭过「启用新版 Web 搜索 API」,用户配置的 `web` 条目中会残留 `searchProvider` / `fetchProvider`,指向已停用的 provider,于是搜索或抓取报 `WEB_PROVIDER_CONFIGURED_MISSING`。用 `dsh --profile web --dump-config` 查看 `web` 条目,删除用户层中的这两个字段即可。
132
-
133
- ### 跟随会话模型报 WEB_SEARCH_FOLLOW_UNSUPPORTED
134
-
135
- 插件无法从模型配置推导出搜索路由,错误信息会写明缺少什么。最常见的原因是 provider 配置没有写 `api`。DSH 自带的 DeepSeek 路由不支持跟随,请改用 DeepSeek 连接。规则见[配置参考](docs/configuration.md#跟随会话模型)。
136
-
137
- ## 文档
138
-
139
- | 文档 | 内容 |
7
+ | | |
140
8
  | --- | --- |
141
- | [配置参考](docs/configuration.md) | 所有字段、内置连接、参数白名单、自定义连接、跟随模型规则、错误码 |
142
- | [升级指南](docs/upgrading.md) | 版本对应关系、升级到 0.1.9 的变化、旧配置迁移、回退 |
143
- | [架构](docs/architecture.md) | 模块划分、请求流程、如何新增搜索服务 |
144
- | [开发](docs/development.md) | 本地开发、测试、在真实 DSH 中验证、发布 |
145
- | [更新日志](CHANGELOG.md) | 各版本的变化 |
146
- | [AGENTS.md](AGENTS.md) | 给编码代理的仓库说明(英文) |
147
-
148
- ## 开发
149
-
150
- ```sh
151
- pnpm install
152
- pnpm run check
153
- ```
154
-
155
- 详见[开发指南](docs/development.md)。
156
-
157
- ## 许可与致谢
158
-
159
- - 代码以 [MIT](LICENSE) 许可发布。
160
- - 感谢 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 团队,以及 Exa、Firecrawl、Tavily、Tinyfish、OpenAlex、Semantic Scholar 等服务。
161
- - **关于横幅形象**:Banner 中的 DeepSeek 鲸鱼娘形象来源于 **上善无形原创角色与 ZipZipPipe 二创**;本项目横幅基于用户提供的参考图经 AI 辅助创作。角色与参考作品的著作权利均归原作者所有,不因本项目代码的 MIT 许可而获得再授权,亦不代表官方背书。
162
-
163
- 问题反馈请到 [GitHub Issues](https://github.com/Yurzi/dsh-web-search-enhanced/issues),附上 DSH 与插件版本;不要粘贴密钥或私密对话。
9
+ | Row id | `web-search-enhanced` |
10
+ | Provider id in `ctx.web` | `search-enhanced` |
11
+ | Model surface | DSH's own `web_search` (tool-web), unchanged |
12
+ | Per conversation | one connection or Off, from the composer menu or `/setup-search` |
13
+ | Settings | row settings page on the Plugins page (`plugins.row.config`) |
14
+
15
+ ## What it does
16
+
17
+ Choose a search connection per conversation from the composer menu or
18
+ `/setup-search`; Off hides `web_search` from that conversation's Agent from
19
+ the next model request step. Operators decide which connections exist: DSH's
20
+ own DeepSeek search (the default) and DeepSeek Search API, the conversation's
21
+ own model (`builtin:session-model`), Exa, Firecrawl, Tavily, Tinyfish,
22
+ OpenAlex and Semantic Scholar, plus custom adapter connections and fixed-model
23
+ connections over Anthropic Messages, OpenAI Responses or OpenAI Chat
24
+ Completions. Native connections keep the behaviour of DSH's own providers;
25
+ only their error messages are restated.
26
+
27
+ - **Where the query goes.** Every connection sends the query to the service
28
+ named in its label (a model connection: to the model's provider). Model
29
+ search is billed per search by that provider, on top of the tokens it uses.
30
+ - **Credentials.** Keys live in DSH Credentials; settings store only the
31
+ reference name. Adapter and model API keys are validated before requests;
32
+ native providers retain DSH's credential handling.
33
+ - **Results and errors.** Sources must be http(s) URLs without user
34
+ information. Errors are a short message of this plugin with a `WEB_*` code,
35
+ optionally followed by the service's own explanation marked
36
+ `(untrusted)`; there is no retry and no fallback. This request's API key or
37
+ account token is kept out of what the model sees (withheld from error text,
38
+ replaced by `[redacted]` in successful responses and parsed adapter results,
39
+ including OpenAlex inverted abstracts), with one known gap; see
40
+ [known limitations](../../docs/design.md#已知限制).
41
+
42
+ For the catalog, model-search options, settings grammar and error behavior,
43
+ see [Functional design](../../docs/design.md): [connections](../../docs/design.md#连接与目录),
44
+ [session selection](../../docs/design.md#会话选择), [settings document](../../docs/design.md#配置文档),
45
+ [model backend](../../docs/design.md#model-后端) and [errors](../../docs/design.md#错误与上游说明).
46
+
47
+ ## Upgrading from 0.1.x
48
+
49
+ Versions up to 0.1.x were a standalone bundle that took the native
50
+ `deepseek-official` seat. From 0.2.0 this package is a plain plugin of the
51
+ profile bundle: remove the 0.1.x bundles, then install the profile. Upgrading
52
+ this package alone removes its row.
53
+
54
+ 0.1.x settings are not read or migrated. Calls fail with
55
+ `WEB_PROVIDER_CONFIGURED_UNAVAILABLE` and a fixed message asking the user to
56
+ repair the settings. Field diagnostics are available in the settings page and
57
+ Host log. Press **Restore default settings** (Reset) on the settings page, or
58
+ delete the fields by hand, then set up your connections again. Stored
59
+ conversation choices and model memories are kept. Details:
60
+ [upgrading from 0.1.x](../../docs/design.md#从-01x-升级).
61
+
62
+ Architecture: [docs/architecture.md](../../docs/architecture.md).