RailgunHamster/dsh-web-search

dsh-web-search

A DeepSeek Harness plugin for selecting and routing web search providers.

待分类deepseek-harnessdeepseek-harness-plugindeepseek-harness-plugins

Host plugin for selecting and routing DeepSeek Harness web_search backends.

Requires DSH 0.2.0-rc.2 or later (declared as a @deepseek-ai/dsh peer). On DSH 0.1.5 use dsh-web-search 0.3.0; see docs/compatibility-0.2.0.md.


English

What it does

The plugin registers one ctx.web provider named dsh-web-search-selected. The provider field of the web-search entry chooses the live backend. Since 0.4.1 the plugin restores a dedicated Plugins → Web search card using the current configForms API. Choose OpenAI Responses or DeepSeek, then click Save. The volatile field is saved to the profile's cordis.patch.yml and remains available in the generic entry form.

Request path:

web_search
  -> ctx.web
  -> dsh-web-search-selected
  -> selected backend

Built-in backends:

IDBehavior
openai-responsesOpenAI Responses API with the native web_search tool
deepseek-officialDeepSeek native web search protocol

The plugin identity is the router, not any one model or vendor.

Install

dsh plugin --profile web add github:RailgunHamster/dsh-web-search
dsh plugin --profile web install

Restart the Web profile:

dsh web

Or add it to the Web profile package.json by hand:

{
  "dependencies": {
    "dsh-web-search": "git+https://github.com/RailgunHamster/dsh-web-search.git"
  },
  "dsh": {
    "profile": {
      "bundles": [
        "dsh-web-search"
      ]
    }
  }
}
cd "$env:USERPROFILE\.dsh\profiles\web"
pnpm install
dsh web

The bundled cordis.patch.yml then:

  1. Disables the shipped web-search-deepseek provider.
  2. Points @deepseek-ai/dsh-web searchProvider at dsh-web-search-selected.
  3. Restates fetchProvider: http. Since DSH 0.2.1-rc.2 the shipped web-deepseek-api package registers a second usable fetch provider; overriding the web entry without an explicit fetch pin leaves web_fetch ambiguous (WEB_PROVIDER_AMBIGUOUS).
  4. Inserts dsh-web-search into the current composition.

Configuration

The web-search entry's config accepts:

KeyDefaultMeaning
provideropenai-responsesSelected backend
responsesApiKeyEnvOPENAI_API_KEYCredential / env name for Responses search
responsesBaseURLhttps://api.openai.com/v1Responses API base URL
responsesModelgpt-4oModel that exposes tools: [{ type: "web_search" }]
responsesMaxTokens1024max_output_tokens for Responses search
deepseekApiKeyEnvDEEPSEEK_API_KEYCredential / env name for DeepSeek search
deepseekBaseURLhttps://api.deepseek.com/anthropic/v1DeepSeek Anthropic-compatible base URL
deepseekModeldeepseek-v4-flashDeepSeek search model
deepseekApiVersion2023-06-01anthropic-version header
deepseekMaxTokens4096DeepSeek max_tokens
deepseekMaxUses5DeepSeek web_search max_uses

Provide keys through DSH credentials or the launching environment. Do not put real keys in Git, cordis.patch.yml, or this README.

Example entry in the profile's cordis.patch.yml:

- id: web-search
  config:
    provider: openai-responses
    responsesApiKeyEnv: OPENAI_API_KEY
    responsesBaseURL: https://api.openai.com/v1
    responsesModel: gpt-4o

Saving provider in the settings form applies to later web_search calls immediately. A DSH restart is not required for that switch. The other fields are ordinary config: change them in cordis.patch.yml, and DSH re-applies the plugin.

On its first boot DSH 0.1.7+ imports a legacy settings.yaml web-search: section into this entry, provided 0.4.0 is already installed then. If that boot ran with 0.3.x, the selection stays in settings.yaml.imported; set provider on the entry above.

Verify

dsh --profile web --dump-config | Select-String -Pattern 'searchProvider|fetchProvider|web-search-deepseek|web-search'

Expected:

searchProvider: dsh-web-search-selected
fetchProvider: http
web-search-deepseek: disabled: true
web-search: dsh-web-search

Then run a normal web_search. The default Responses backend posts:

POST {responsesBaseURL}/responses
tools: [{ "type": "web_search" }]

The plugin maps returned text and url_citation annotations to Harness content and sources.

Development

Host or bundle cordis.patch.yml changes need a full DSH Web restart, then a browser refresh.

Do not commit:

  • node_modules/
  • .dsh/
  • settings.yaml or a profile cordis.patch.yml
  • credential files
  • .env files
  • API keys, private keys, or session data

License

MIT


中文

功能

需要 DSH 0.2.0-rc.2 及以上(以 @deepseek-ai/dsh peer 声明)。DSH 0.1.5 请用 dsh-web-search 0.3.0,见 docs/compatibility-0.2.0.md。

插件注册一个名为 dsh-web-search-selected 的 ctx.web provider。web-search 条目的 provider 字段决定当前搜索后端。0.4.1 起插件使用当前 configForms 接口恢复独立的 插件 → 网页搜索 卡片。选择 OpenAI Responses 或 DeepSeek,点击 保存,选择就会写入 profile 的 cordis.patch.yml。该 volatile 字段也仍可在通用配置表单里编辑。

请求路径:

web_search
  -> ctx.web
  -> dsh-web-search-selected
  -> 当前选中的 backend

内置 backend:

ID行为
openai-responses调用 OpenAI Responses API 的原生 web_search 工具
deepseek-official使用 DeepSeek 原生 web search 协议

插件本身是路由器,不绑定某个模型或厂商。

安装

dsh plugin --profile web add github:RailgunHamster/dsh-web-search
dsh plugin --profile web install

然后重启 Web profile:

dsh web

也可以手动改 Web profile 的 package.json:

{
  "dependencies": {
    "dsh-web-search": "git+https://github.com/RailgunHamster/dsh-web-search.git"
  },
  "dsh": {
    "profile": {
      "bundles": [
        "dsh-web-search"
      ]
    }
  }
}
cd "$env:USERPROFILE\.dsh\profiles\web"
pnpm install
dsh web

插件自带的 cordis.patch.yml 会:

  1. 禁用 shipped 的 web-search-deepseek provider。
  2. 将 @deepseek-ai/dsh-web 的 searchProvider 指向 dsh-web-search-selected。
  3. 重申 fetchProvider: http。DSH 0.2.1-rc.2 起 shipped 的 web-deepseek-api 包会注册第二个可用的 fetch provider,覆盖 web 条目而不显式钉住 fetch 会让 web_fetch 报二义性(WEB_PROVIDER_AMBIGUOUS)。
  4. 把 dsh-web-search 插入当前 composition。

配置

web-search 条目的配置支持:

字段默认值含义
provideropenai-responses当前 backend
responsesApiKeyEnvOPENAI_API_KEYResponses 搜索使用的凭据 / 环境变量名
responsesBaseURLhttps://api.openai.com/v1Responses API 根地址
responsesModelgpt-4o支持 tools: [{ type: "web_search" }] 的模型
responsesMaxTokens1024Responses 搜索的 max_output_tokens
deepseekApiKeyEnvDEEPSEEK_API_KEYDeepSeek 搜索使用的凭据 / 环境变量名
deepseekBaseURLhttps://api.deepseek.com/anthropic/v1DeepSeek Anthropic 兼容根地址
deepseekModeldeepseek-v4-flashDeepSeek 搜索模型
deepseekApiVersion2023-06-01anthropic-version 请求头
deepseekMaxTokens4096DeepSeek max_tokens
deepseekMaxUses5DeepSeek web_search 的 max_uses

密钥只能放在 DSH credentials 或启动环境里,不要写入 Git、cordis.patch.yml 或本文。

profile cordis.patch.yml 条目示例:

- id: web-search
  config:
    provider: openai-responses
    responsesApiKeyEnv: OPENAI_API_KEY
    responsesBaseURL: https://api.openai.com/v1
    responsesModel: gpt-4o

在设置表单里切换 provider 并点击保存后,会立即作用于之后的 web_search,不必为了切换而重启 DSH。其余字段是普通配置:改 cordis.patch.yml,DSH 会重新应用插件。

DSH 0.1.7+ 首次启动时会把旧 settings.yaml 的 web-search: 段导入这个条目,前提是那时已装好 0.4.0。如果首次启动时装的还是 0.3.x,选择只留在 settings.yaml.imported 里,需要在上面的条目里手动设置 provider。

验证

dsh --profile web --dump-config | Select-String -Pattern 'searchProvider|fetchProvider|web-search-deepseek|web-search'

预期看到:

searchProvider: dsh-web-search-selected
fetchProvider: http
web-search-deepseek: disabled: true
web-search: dsh-web-search

然后发一次普通 web_search。默认 Responses backend 会请求:

POST {responsesBaseURL}/responses
tools: [{ "type": "web_search" }]

插件把返回文本和 url_citation 映射为 Harness 的 content 与 sources。

开发

Host 代码或 bundle cordis.patch.yml 改动后需要完整重启 DSH Web,再刷新浏览器。

不要提交:

  • node_modules/
  • .dsh/
  • settings.yaml 或 profile 的 cordis.patch.yml
  • credentials 文件
  • .env 文件
  • API key、私钥或 session 数据

许可证

MIT