Introduction

After DeepSeek Harness (DSH) Web has finished starting, the default behavior is usually to open the system’s default browser. However, in real development or automation scenarios, developers often need finer control: for example, forcing the GUI to open as an app window in a specific browser, or performing some system-level preparation steps before launching the GUI (such as waiting for a service to become ready or starting auxiliary programs).

This requires a mechanism that can automatically trigger a specified command after the DSH Web server is fully ready. The dsh-startup-command plugin is designed for exactly this purpose: it allows users to configure the action to run after startup.

Plugin Overview

This is a DeepSeek Harness Web plugin provided by the maintainer kagurazakayashi. Its core purpose is to execute the command defined in the configuration file after the Web server begins listening on a port and the Loader tree has stabilized. The plugin is configured through the dsh-startup-command namespace in settings.yaml, supports placeholder replacement, and does not block the shutdown of the DSH main process.

Core Features

  • Post-startup triggering: The plugin strictly follows the DSH lifecycle and executes the command only after the Web server starts listening and the Loader tree stabilizes, ensuring that the actual port and Token are available.
  • Fully configurable: Commands can be specified as a single string or an array of commands. Commands in an array are executed sequentially (the next command starts only after the previous one exits).
  • Placeholder support:
    • {url}: Automatically replaced with the actual GUI access address (including the Token, supporting the OS-assigned port).
    • {home}: Replaced with the user directory (os.homedir()).
    • {browser}: Automatically detects a Chromium-based browser (priority: Chromium > Chrome > Edge, or the system default browser).
  • Non-blocking design: The child process is started in detached and unrefed mode, running independently of DSH and not preventing DSH from shutting down.
  • Switch and mode: Provides an enabled switch for temporary disablement, and a shell mode option (for handling paths that contain spaces).
  • Web configuration interface: Provides a visual card in the settings menu, supporting direct configuration editing and example command generation.

Installation and Activation

Installing this plugin requires installation via npm and registration in the configuration file.

1. Obtain the Plugin Package

Run the following command in the terminal to install it:

npm install @kagurazakayashi/dsh-startup-command

2. Mount the Plugin

Edit C:\Users\<you>\.dsh\profiles\web\cordis.patch.yml and add the mount configuration. This step only registers the plugin; the specific command logic is still defined in settings.yaml.

- insert:
    - id: dsh-startup-command
      name: '@kagurazakayashi/dsh-startup-command'
      inject: [webServer]

3. Configure and Restart

Add the dsh-startup-command namespace to C:\Users\<you>\.dsh\settings.yaml, and then restart dsh web. After restarting, the plugin settings card will appear under Settings → Plugins → Plugin configuration.

Configuration and Usage

The configuration items are located under the dsh-startup-command key in settings.yaml:

dsh-startup-command:
  enabled: true
  shell: false
  command: '"C:\Program Files\Google\Chrome\Application\chrome.exe" --app={url}'

Configuration Item Descriptions

  • command (string | string[]): The command to execute. If it is an array, the commands are executed sequentially; if it is a string, be careful about paths that contain spaces.
  • enabled (boolean): Whether the plugin is enabled. Defaults to true.
  • shell (boolean): Whether the command is executed through the system Shell. Defaults to false (pass the argument array directly), which is safer; setting it to true can handle paths that contain spaces.

Placeholder Usage

  • {url}: Replaced with http://127.0.0.1:<actual_port>/?token=.... This is the required authentication address for the new version of DSH Web.
  • {home}: Replaced with the current user’s home directory path.
  • {browser}: Replaced with the path to the detected Chromium-based browser executable.

Usage Examples

Example 1: Automatically detect a browser and launch an app mode window

dsh-startup-command:
  command: '"{browser}" --user-data-dir="{home}/.dsh/dsh-browser-data" --disk-cache-dir="{home}/.dsh/dsh-browser-cache" --app={url} --no-first-run --disable-extensions'

Example 2: Execute multiple commands sequentially

First run a wait command, then start the browser:

dsh-startup-command:
  command:
    - 'cmd /c ping -n 3 127.0.0.1'
    - '"C:\Program Files\Google\Chrome\Application\chrome.exe" --app={url}'

Example 3: Open any program

dsh-startup-command:
  command: 'C:\Windows\System32\notepad.exe'

Notes

  1. Avoid opening the browser twice: DSH includes a built-in open default browser feature. If you use this plugin to open a browser, you usually need to override the config of web-runtime in cordis.patch.yml to disable the built-in browser-opening behavior; otherwise, the browser may be opened twice.
  2. Permission issues: The plugin runs with the permissions of the DSH process, so the configured command should not attempt to access sensitive directories or files that a normal user does not have permission to access.
  3. Dependency versions: This plugin requires DSH version >= 0.1.2-rc.1 and Node.js >= 20.

Conclusion

dsh-startup-command provides a lightweight way to decouple DSH Web startup from the subsequent browser or tool launch process. By using configuration files instead of hard-coding, it preserves flexibility, while its non-blocking mechanism ensures the stability of DSH runtime behavior. For scenarios that require automatically starting a specific browser environment or running post-startup scripts, this is a practical tool.

Related Links:
* Plugin Directory Page
* GitHub Repository