Introduction

DeepSeek Harness (DSH) web_search capability typically relies on HTTP requests or web scraping. This approach is often unstable when facing anti-bot mechanisms or dynamically rendered pages. The dsh-web-search-opencli plugin provides a more direct solution: it uses OpenCLI to control the browser directly, invokes Google AI Mode to perform the search, and returns the results in a standardized way to DSH.

What Is This?

dsh-web-search-opencli is a DeepSeek Harness plugin maintained by the user sincerity711. It registers a DSH ctx.web search provider. When an agent calls web_search, the plugin drives your Chrome or Edge browser via OpenCLI, opens Google Search AI Mode (udm=50), waits for the AI answer, extracts the answer and cited sources, and finally returns a standard DSH WebSearchResult.

Core Features

  • AI Mode integration: Exposes Google AI Mode answers directly to DSH’s web_search interface.
  • Browser automation: Uses OpenCLI for browser control instead of unstable HTTP endpoint scraping.
  • Source extraction: Extracts source URLs from AI Mode citations and links.
  • Markdown conversion: Converts the AI answer body into Markdown format.
  • Session reuse: By default, reuses browser session tabs configured in OpenCLI.
  • Highly configurable: Supports configuring the provider ID, OpenCLI command/session/window mode, timeout duration, and tab cleanup strategy.

Installation and Enablement

Use the officially recommended installation command:

dsh plugin --profile web add dsh-web-search-opencli

Before installing, it is recommended to verify OpenCLI’s connection status:

opencli doctor

After installation, DSH automatically applies the configuration in cordis.patch.yml, setting the searchProvider of the web context to google-ai-mode. You can check whether the configuration took effect with the following command:

dsh --profile web --dump-config

Configuration

The plugin supports the following configuration options (default values are defined in cordis.patch.yml):

Field Default Description
providerId google-ai-mode Provider ID registered to ctx.web.
opencliCommand opencli Name or path of the OpenCLI executable.
opencliSession dsh-google-ai-mode OpenCLI browser session name used for the Google tab.
opencliWindow background Value passed to OPENCLI_WINDOW and the OpenCLI --window parameter.
timeoutMs 45000 Timeout for a single search, in milliseconds.
closeTabAfterSearch false Attempts to close the tab after search. Due to Chrome automation window behavior, this may be unstable, so the default is disabled.

Typical Usage and Behavior

After an agent calls web_search, the plugin performs the following flow:
1. Drives Chrome or Edge through OpenCLI commands.
2. Opens the Google search page with the udm=50 parameter.
3. Waits for the AI Mode answer to load.
4. Extracts content (the AI answer in Markdown format) and sources[] (cited URLs).
5. Returns a standard DSH WebSearchResult.

Behavior details:
- content contains the AI Mode answer converted to Markdown.
- sources[] contains URLs cited or linked in the AI Mode answer.
- Duplicate source URLs are merged at their first occurrence.
- Ordinary search results are not used as a fallback for the AI Mode answer.
- Uses the background window mode by default to avoid stealing focus.

Environment Requirements and Notes

The following conditions must be met before use:
- Node.js: The version must be within ^22.19.0 || >=24.0.0.
- DeepSeek Harness: Installed and includes the @deepseek-ai/dsh-web dependency.
- OpenCLI: Installed and connected to the browser extension.
- Browser environment: Chrome or Edge is signed in to a Google account, and the account has access to AI Mode.

Important notes:
- The plugin does not read or store Google cookies.
- Running multiple searches concurrently with the same opencliSession may cause session conflicts. It is recommended to use different session names or serialize search requests.
- If Google presents a CAPTCHA, resolve it manually and retry.

Error Handling

The plugin throws DSH WebError type errors, including:
- WEB_SEARCH_OPENCLI_CAPTCHA: Google displays a CAPTCHA or an abnormal traffic page.
- WEB_SEARCH_OPENCLI_AI_MODE_UNAVAILABLE: AI Mode is unavailable for the current account/region.
- WEB_SEARCH_OPENCLI_TIMEOUT: The OpenCLI operation exceeded timeoutMs.
- WEB_PROVIDER_ERROR: OpenCLI failed or result extraction was abnormal.
- WEB_ABORTED: The DSH call was aborted.

The plugin is released under the MIT license and can be viewed on GitHub. For more information, see the SkillHub plugin directory.