Introduction to the DeepSeek Harness Plugin: dsh-browser

Introduction

The DeepSeek Harness (DSH) plugin ecosystem aims to standardize the integration of various capabilities through tools. In the realm of browser automation, common solutions like Puppeteer and Playwright rely on the Chrome DevTools Protocol (CDP). While powerful, these tools emit commands such as Runtime.enable at startup, which easily exposes the navigator.webdriver flag. Furthermore, they default to using a fresh, blank profile, making them highly susceptible to triggering CAPTCHA mechanisms of mainstream anti-crawling vendors.

The dsh-browser plugin is designed to address this issue. It does not rely on the Chrome Debugging Protocol; instead, it uses native messaging to enable communication between an extension and DSH. It converts web pages into a numbered text list for the model and utilizes a persistent Chrome profile to retain login status and history, thereby reducing the risk of being identified as automation.

Core Features

The plugin implements browser control through the following methods:
* No CDP: It does not launch via --remote-debugging-port but instead uses an extension to communicate with the native messaging host.
* Persistent Profile: Chrome uses a persistent, independent profile to retain login status across sessions.
* Text-based Interaction: Pages are presented as numbered text, eliminating the need for visual models to perform screenshot recognition.
* Toolset: Provides tools such as browser_status, browser_open, browser_tabs, browser_select_tab, browser_close_tab, browser_snapshot, browser_text, browser_click, browser_fill, browser_press_key, browser_scroll, browser_navigate, browser_wait, browser_query, browser_hover, browser_upload, browser_screenshot, browser_evaluate, browser_console, etc.

Installation and Activation

The installation and activation process involves three main steps: installing the plugin, configuring connection components, and loading the extension for pairing.

1. Install Plugin

Run the following command in the terminal to install the plugin:

dsh plugin --profile desktop add azazo1/dsh-browser

Restart DSH after installation is complete.

2. Install Connection Components

Open Settings -> Plugins -> dsh-browser and click Install Connection Components. This step will:
1. Copy extension artifacts to the DSH data directory.
2. Generate a native messaging manifest and write the extension ID into it.
3. Generate a launch wrapper script with the absolute path of node hardcoded (Chrome will execute it directly, bypassing the shell).

Manifest file locations:
* macOS: ~/Library/Application Support/Google/Chrome/NativeMessagingHosts/
* Linux: ~/.config/google-chrome/NativeMessagingHosts/
* Windows: Registry HKCU\Software\Google\Chrome\NativeMessagingHosts\

3. Manually Load Extension

Due to Chrome version restrictions, manual operation is required:
1. Open chrome://extensions and enable Developer Mode.
2. Click “Load unpacked”.
3. Select the extension directory displayed on the configuration page.
4. Return to the configuration page; the status should turn green.

Note: Chrome disabled the command-line --load-extension argument after version 154, and starting from version 33, it only accepts extensions from the store or enterprise policies. Therefore, this step cannot be completed via command line. Extensions loaded in an unpacked manner will not auto-update.

4. Pairing Token

Authorization between dsh and the extension is performed via a pairing token. Operations will be rejected if no token is present, rather than allowing a degraded mode.

  1. Click the dsh Browser icon in the browser toolbar.
  2. Copy the pairing token from the panel.
  3. Paste the token into Settings -> Plugins -> dsh-browser in DSH and save.
  4. The status should change to “dsh has accepted pairing”.

5. (Optional) Enable Allow User Scripts

The browser_evaluate tool requires executing JS code, which is subject to CSP restrictions. You need to manually toggle the Allow User Scripts switch in the extension details page (Developer Mode must be enabled in the top right corner before Chrome 138). If not enabled, the tool will report an error and suggest using browser_query.

Usage Instructions

Once installed, the Agent can call the tools mentioned above. Please note the following rules during use:

Tool Division

  • browser_snapshot: Lists visible and interactive elements with numbers, used for operations.
  • browser_query: Returns text and attributes of all matching items based on CSS selectors, used for reading data.
  • browser_text: Extracts only the main text content of the page.
  • browser_evaluate: Executes JS expressions (Requires “Allow User Scripts” to be enabled).
  • browser_screenshot: Captures only the current viewport, saves it as a file, and returns the path; it is not passed directly to the model.

Operation Rules

  • Binding Tabs: All operations only affect the bound tab. You must call browser_select_tab first.
  • Snapshot Number Invalidation: After the page DOM structure changes, the numbers generated by the previous browser_snapshot become invalid. If you operate on an expired number, the tool will report an error, requiring a new snapshot.

Configuration

Configure dsh-browser in the DSH profile patch layer:

- id: dsh-browser
  config:
    # Chrome executable path (optional, defaults to detecting the stable version)
    chromePath: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    # Persistent profile directory (optional, defaults to <DSH_HOME>/data/dsh-browser/profile)
    profileDir: ~/chrome-for-dsh
    # Extra launch arguments (arguments like --remote-debugging-port, --headless will be rejected)
    extraArgs: []
    # Whether to ask for user consent when the browser is first used
    askOnAcquire: true
    # Whether to launch Chrome with an independent profile
    launchStandaloneChromeProfile: false

Notes

  • Multi-session Conflicts: The browser plane is exclusive. If two sessions attempt to drive simultaneously, an approval process will be triggered.
  • Permission Rejection: Conflicting parameters (such as --remote-debugging-port) included in extraArgs will be rejected and cause an error at startup.
  • Token Management: The pairing token is written directly to the pairing-token file in the data directory (permission 0600) and is not involved in configuration file synchronization.

Conclusion

By bypassing the CDP protocol and retaining a real Profile, dsh-browser provides a browser control method for DSH that closely mimics human operation. It is suitable for scenarios requiring web interaction in environments with strict login requirements and robust anti-crawling detection.

  • Plugin Directory: https://www.skillhub.cn/plugins/azazo1/dsh-browser
  • GitHub: https://github.com/azazo1/dsh-browser
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye