dsh-computer-use: Windows Desktop Automation Plugin

Preface

The design philosophy of DeepSeek Harness (DSH) is “Everything is a plugin.” When developing desktop agents, it is a common requirement to directly manipulate Windows windows or applications. dsh-computer-use is a workflow plugin that integrates Codex’s native Windows Computer Use capabilities into DSH, driving the locally installed codex-computer-use.exe via the stdio JSON-RPC protocol.

It does not perform pixel-level recognition: it uses the UI Automation Accessibility Tree to “see” windows and SendInput injection to “act” on windows. It reuses the underlying Codex native assistant rather than reimplementing Win32 interactions.

Prerequisites

  1. Codex Desktop must be installed on the local machine (which provides codex.exe and codex-computer-use.exe).
  2. Node.js must be installed in the environment, with a version requirement of ^22.19.0 || >=24.0.0.

Installation

Add the dependency to the project’s package.json and include the bundle in the DSH configuration.

{
  "dependencies": {
    "dsh-computer-use": "github:gxpppp/dsh-computer-use"
  },
  "dsh": {
    "profile": {
      "bundles": [
        // ... other bundles
        "dsh-computer-use"
      ]
    }
  }
}

After installation, restart DSH to load the plugin. If the configuration is written to cordis.patch.yml, a DSH restart is also required for it to take effect.

Core Features

The plugin provides the following core capabilities:

  • App/Window Enumeration: Read-only operation used to identify applications or windows currently on the desktop.
  • Accessibility Tree + Element Indexing: Obtains the UI structure via the UI Automation tree to assist in locating elements.
  • Input Injection: Supports click, type, key press, scroll, and drag operations.
  • Clipboard Paste: Supports pasting Chinese and long text.
  • Screenshots:
    • Windows 11: Uses native WGC (Windows Graphics Capture).
    • Windows 10: Uses PrintWindow as a fallback.
  • Window Fault Self-Healing: Handles situations such as window minimization, geometry changes, or invalid handles.
  • Wait Primitives: Waits for specific text to appear/disappear or for a window to close.
  • Desktop Lock Detection: Proactively detects desktop lock status to avoid model misjudgment.

Tool Usage

The plugin exposes capabilities through 6 tools:

  1. computer_use_status
    Self-diagnostic tool used to locate the helper process, check screenshot capabilities, view authorized apps, and check the approval-free whitelist. Supports action="reset" to clear authorizations and restart the helper.
  2. computer_use_apps
    Enumerates applications or windows (read-only).
  3. computer_use_state
    Gets a window snapshot, including the accessibility tree (with indices and focus), a screenshot, or both.
  4. computer_use_act
    Executes a single action (including paste_text); by default, it automatically refreshes and returns the new state.
  5. computer_use_wait
    Waits for the interface to be ready, supporting waits for text appearance/disappearance or window closure.
  6. computer_use_launch
    Launches an application and polls until the window appears.

Authorization Model

Each application requires an authorization ticket before it can be operated on. There are only two sources for the ticket, checked in order:

  1. Approval-free Whitelist: Matches the application name in the configured alwaysAllowedAppIds.
  2. Approval Popup: Goes through DSH’s approval.request() and must return allowed-once.

Configuring the Whitelist

The whitelist configuration is written in cordis.patch.yml:

# cordis.patch.yml
- id: computer-use
  disabled: false
  config:
    alwaysAllowedAppIds:
      - mspaint.exe
      - msedge.exe

Note: The configuration must be applied by restarting DSH. Configuring via the GUI settings page is not recommended, as the settings panel in some DSH versions may not sync with the configuration object read by the plugin.

Notes

  • Permissions & Authorization: Every application requires authorization before operation. If this is the first time operating an application, ensure DSH’s approval policy is set to ask, otherwise the popup will not appear.
  • Win10 Performance: On Windows 10, screenshots may be slow (approx. 1–3 seconds per image) and unable to read hardware-accelerated windows. It is recommended to set allowScreenshots: false in the configuration.
  • Browser & Terminal Limitations: Browser window automation and terminal-type applications are currently restricted by policy and cannot be operated directly.

Conclusion

By reusing native Codex capabilities, this plugin provides a standardized desktop control interface for DSH. Developers can perform state retrieval, interface waiting, and action execution via standard DSH tools, thereby building more complex desktop automation workflows.

For more details, please check the catalog page or the GitHub repository.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye