dsh-computer-use-native: A Vision-Based Windows Desktop Control Plugin

Preface

When using DeepSeek Harness (DSH) to connect vision models to Windows desktop control, traditional automation schemes based on UI Automation (Accessibility Tree) perform poorly on modern applications. Chromium, WebView2, and Electron windows barely expose accessible controls, rendering tree-based tools unable to read interface content.

The dsh-computer-use-native plugin solves this pain point by capturing real rendered pixels via screenshots and using Win32 FFI to drive windows directly. It does not rely on the accessibility tree and defaults to posting input messages to the target window queue, ensuring desktop focus is not hijacked.

What is it

This is a DSH plugin designed for Windows desktop automation, specifically built for vision models. It captures real desktop or window pixels using the PrintWindow and PW_RENDERFULLCONTENT APIs, feeds the images to the model, and then converts image coordinates to screen coordinates to execute actions.

Core Features

The plugin provides the following tools:

Tool Name Function
computer_screenshot Captures desktop or specified window, returns image and viewport ID
computer_window Lists windows, reads geometry info, or brings window to front
computer_click Clicks, double-clicks, or right-clicks at screenshot position
computer_move Moves mouse pointer (for hover menus)
computer_type Types Unicode text
computer_key Sends key presses or combinations
computer_scroll Scrolls wheel at specified position
computer_drag Drags between two points

Technical Details

Coordinate Mapping

The model processes screenshots, which may be scaled. The plugin records image dimensions, source screen rectangles, scale factors, and window information via viewport. When the model provides image coordinates, the plugin accurately restores image pixels to screen coordinates via the viewport, preventing click deviation caused by the model’s scaling calculation errors.

Input Routing

All input tools support a dispatch parameter, defaulting to background.
* background: Posts messages (e.g., WM_LBUTTONDOWN) directly to the target window queue. The window is not brought to the front, the cursor does not move, and current user operations are unaffected.
* foreground: Operates by simulating real cursor movement and clicks. This is more costly and may interrupt the user.

Performance Optimization

The cost of screenshots lies mainly in encoding. The plugin optimizes the “looking” process:
* Pixel Diff Comparison: Downscales screen pixels to a 32x20 luminance grid. A recapture is only triggered if the difference exceeds 2% (deemed “changed”).
* No-Change Reuse: If the screen is static, the plugin directly reuses the previous viewport, sending no image and writing no attachments. The first screenshot takes about 238ms, while repeated screenshots take about 41ms.

Installation and Enablement

  1. Install the plugin:
    dsh plugin add dsh-computer-use-native
  1. Install a specific version (recommended to prevent behavior changes after updates):
    dsh plugin --profile web add github:dao-awa/dsh-computer-use-native#1354d1d1481619c2cc0a5ecccfa8180f1a34452a
  1. Important: You must restart DSH and start a new session after installation. Bundles need to be mounted before the session is created.

Prerequisites and Notes

  • Runtime Environment: Requires Windows 10 or higher (x64), Node.js 22 or higher.
  • DSH Service: The DSH instance must have computerUse, tools, systemPrompt, and attachments services enabled.
  • Model Support: A model routing that accepts image input needs to be configured.
  • Application Compatibility: Because it does not use the accessibility tree, this solution works for modern applications (Chromium, WebView2, Electron), whereas traditional tree-based tools fail on them.
  • Coexistence Conflicts: Using it simultaneously with the computer-use-win (MCP) server will cause tool overlap and confusion. It is recommended to choose one.
  • Permissions: The plugin runs with the permissions of the current DSH process. Please review the source code and license (MIT) before use.

Summary

dsh-computer-use-native provides pixel-based Windows desktop control capabilities. Through viewport coordinate mapping and background input distribution, it ensures accuracy while reducing interaction costs. For scenarios requiring vision models to operate modern Windows applications, it is a currently viable technical solution.

Project URL: https://github.com/dao-awa/dsh-computer-use-native

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

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

Xiaoye