前言¶
在 DSH 的插件化思路下,web 搜索可以通過 ctx.web 能力縫接入外部後端。dsh-searxng 提供一條基於 SearXNG 的路徑:使用免費、自託管、無需 API key 的 metasearch 實例,給 agent 提供 web_search。社區目錄是獨立站點,不等同於官方應用商店。下面介紹它的定位、安裝方式和常用操作。
這是什麼¶
dsh-searxng 是 rogerdigital 維護的 DSH 插件,許可證爲 MIT,版本爲 0.2.1。它註冊一個 SearXNG-backed search provider 到 DSH 的 web capability seam(ctx.web),讓 agent 通過 SearXNG 執行 web 搜索。
它面向需要在 DSH 中啓用 web 搜索,但希望使用自託管 SearXNG 實例的開發者。dsh 本身處於 developer preview,後續可能出現破壞性變更。
核心功能¶
- 向
ctx.web註冊 SearXNG-backed search provider。 setup創建 loopback-only、pinned 的 SearXNG Docker 部署;在 JSON API 和搜索檢查通過後才激活 profile。- 支持通過
--url使用已有 local、remote、authenticated 或 independently managed SearXNG 實例;外部模式不啓動 Docker。 - 支持在 setup 命令中選擇 profile 和 port。
- 提供
status、doctor、remove操作,並支持--service與--purge-data選項。 - 支持提供者配置鍵:
baseURL、language、engines、categories、authHeader。 - 多個搜索提供者可用時,可用
DSH_WEB_SEARCH_PROVIDER=searxng或對應的searchProviderDSH web 配置選擇它。 - 要求 Node.js 20 或更新版本。
- managed Docker path 需要 Docker Engine 或 Docker Desktop,以及 Docker Compose v2;不支持 Podman 和 Podman Compose。
安裝與啓用¶
先確認環境:Node.js 20 或更新版本;如果使用 managed Docker path,還需要 Docker Engine 或 Docker Desktop,以及 Docker Compose v2。
使用 setup 快速接入¶
先執行 setup,讓插件完成部署和檢查;再通過對應 profile 使用 DSH。
npx dsh-searxng setup
dsh --profile web
setup 會創建 loopback-only、pinned 的 SearXNG Docker 部署,等待 JSON API,並在 SearXNG 和最終 DSH 提供者配置下執行搜索檢查;通過後才激活 profile。
經過上面的步驟,可以在 web profile 中使用該搜索提供者。
如果需要使用另一個 profile 或端口:
npx dsh-searxng setup --profile research --port 9080
dsh --profile research
使用現有 SearXNG 實例¶
如果已經有一個本地、遠程、需要認證或獨立管理的 SearXNG 實例,可以直接指定 endpoint:
npx dsh-searxng setup --profile web --url https://search.example.com
外部 endpoint 需要滿足:HTTP(S)、不包含 credentials、不包含 query、不包含 fragment,並且啓用 JSON search。外部模式不會調用 Docker。
只安裝插件包¶
如果你自行管理 DSH profile 配置,不想讓 setup 自動附着配置,可以只安裝插件包:
dsh plugin add dsh-searxng
命名 profile 下使用:
dsh plugin --profile <name> add dsh-searxng
典型用法¶
檢查狀態¶
狀態檢查:
npx dsh-searxng status --profile web
更完整的檢查:
npx dsh-searxng doctor --profile web
移除插件¶
基礎移除:
npx dsh-searxng remove --profile web
如果需要同步處理受管 service,使用:
npx dsh-searxng remove --profile web --service
如果需要永久刪除受管數據,使用:
npx dsh-searxng remove --profile web --service --purge-data
永久刪除在交互式終端會提示確認;自動化需要加 --yes。Destructive Docker operations 只在 container、network、volume labels 匹配當前 DSH home 後執行;同名的外來資源會被拒絕。
提供者配置¶
setup 會管理 DSH profile 中的 web-search-searxng row。可以在該行添加這些可選值:
| Key | 含義 |
|---|---|
baseURL |
SearXNG base URL。 |
language |
SearXNG language。 |
engines |
SearXNG engines。 |
categories |
SearXNG categories。 |
authHeader |
外部實例認證 header。 |
如果存在多個 DSH 搜索提供者,選擇該提供者:
DSH_WEB_SEARCH_PROVIDER=searxng
或使用對應的 searchProvider DSH web 配置。
適用場景與注意¶
它適合以下情況:
- 想給 DSH agent 提供 web 搜索,但希望使用 SearXNG 這類 metasearch。
- 希望自託管、免費、無 key。
- 已有 SearXNG 實例,不想讓插件管理 Docker。
- 需要按 profile 和 port 區分多個搜索環境。
使用前注意:
- Node.js 20 或更新版本是必需的。
- managed Docker path 需要 Docker Engine 或 Docker Desktop,以及 Docker Compose v2;不支持 Podman 和 Podman Compose。
- Docker Desktop on macOS and Windows is supported but has not completed formal release certification.
dsh處於 developer preview,破壞性變更可能出現在上游。- 插件會在當前 DSH 環境中運行,並使用當前 DSH 進程的權限訪問 Docker、文件與網絡。安裝前應檢查源碼、命令行爲和 MIT 許可證。
--purge-data是破壞性操作,只用於確認受管資源屬於當前 DSH home 的場景。
結尾¶
dsh-searxng 的價值在於給 DSH 的 ctx.web 提供一條基於 SearXNG 的搜索路徑:既能由插件創建受管 Docker 實例,也能複用現有 SearXNG endpoint。如果你正在爲 agent 配置 web 搜索,可以從 setup 開始,再用 status 和 doctor 檢查最終狀態。
相關鏈接:
- GitHub:https://github.com/rogerdigital/dsh-searxng
- 插件線索給出的社區目錄頁(供參考):https://www.skillhub.cn/plugins/rogerdigital/dsh-searxng