前言¶
DeepSeek Harness (DSH) 的核心理念是“一切皆插件”。在現有的 DSH 生態中,macOS 端已有成熟的計算機使用插件,但 Windows 端一直缺乏原生實現。dsh-computer-use-win 專爲填補這一空白設計,它允許 DSH 插件通過截圖、UI Automation 元素髮現、OCR 和授權輸入來控制 Windows 桌面環境,使文本模型也能通過輔助功能與 Windows 應用交互。
安裝與啓用¶
該插件需要安裝在 Windows 系統上,並依賴已安裝的 DSH CLI。
- 執行安裝命令:
dsh plugin --profile web add https://github.com/secretxuan/dsh-computer-use-win/releases/download/v0.7.0/dsh-computer-use-win-0.7.0.tgz
- 驗證安裝是否生效:
dsh --profile web --dump-config | Select-String computer-use
- 啓動 DSH:
dsh --profile web
核心能力¶
該插件通過一系列工具暴露 Windows 操作能力,涵蓋截圖、觀察、發現和交互四個維度:
-
視圖與發現
computer_screenshot:捕獲全屏或特定窗口。視覺路由接收圖像;僅文本路由接收保存的 PNG 路徑。computer_list_windows:列出可見頂層窗口(進程、PID、標題、屏幕矩形、激活狀態)。computer_list_elements:使用 UI Automation 搜索控件,返回名稱、類型、物理像素矩形和點擊座標。computer_ocr_image/computer_ocr_window:對圖像或窗口運行 Windows OCR,返回帶絕對座標的文本框。computer_observe_image/computer_observe_window:將現有圖像或窗口轉換爲通用文本模型 UI 映射(OCR、粗略區域、點擊中心、視覺候選)。computer_observe_media_controls:報告播放/暫停狀態等通用媒體控制狀態,無需自定義像素腳本。
-
交互
computer_click/computer_move_mouse:屏幕座標點擊或移動。computer_type_text:通過剪貼板粘貼輸入文本(可靠處理 CJK),並使用 SendInput 作爲後備。computer_press_key/computer_scroll/computer_drag:按鍵、滾動和拖拽操作。computer_open_settings:通過ms-settings:URI 打開 Windows 設置。computer_search_in_window:通用搜索流程(定位字段、輸入、回車)。computer_locate_text/computer_click_text:通過 OCR 定位並點擊可見文本。
配置¶
安裝後,通常需要在 DSH 的配置文件中調整參數。在 cordis.patch.yml 中補全 computer-use-win 配置:
- id: computer-use-win
config:
requireApproval: true
maxScreenshotBytes: 8388608
注意: requireApproval: false 僅適用於無人值守測試或臨時環境。
典型用法¶
根據模型類型(視覺或僅文本)選擇工具組合。
文本模型推薦流程:
1. computer_list_windows
2. computer_list_elements(window: "target app")
3. 如果 UIA 診斷顯示受限,使用 computer_observe_window(window: "target app")
4. 當建議操作匹配任務時直接使用
5. 使用 computer_observe_media_controls 檢查播放/暫停狀態,而非自定義像素腳本
6. 使用 computer_search_in_window(window: "target app", query: "...") 進行搜索
7. 使用 computer_locate_text 或 computer_click_text 進行文本定位
8. 對於純圖標目標,使用高置信度視覺候選的 computer_click
9. 使用 computer_type_text 或 computer_press_key 進行輸入
10. 使用 computer_list_windows、computer_list_elements、computer_observe_window 或 OCR 進行驗證
視覺模型推薦流程:
在 DSH 中選擇 DeepSeek-V4-Flash-Vision-Exp,讓模型檢查真實的截圖,而不是 OCR 摘要:
1. computer_screenshot(window: "target app")
2. 檢查返回的圖像
注意事項¶
- 全局輸入注入:Windows 輸入注入是全局的。點擊發生在座標下的任何位置,而不僅僅是當前焦點窗口。
- 權限問題:提升的管理員窗口可能會忽略來自非提升插件進程的輸入。
- VDI 過濾:Win-key 組合使用 SendInput,某些 VDI 產品會過濾此功能。儘可能使用語義工具,如
computer_open_settings。 - UIA 依賴:UI Automation 覆蓋範圍取決於目標應用程序是否暴露有用的輔助功能元數據。對於 CEF/Chromium/自定義渲染應用,使用
computer_observe_window、computer_search_in_window或computer_click_text。 - 僅文本限制:僅文本的 DeepSeek 路由無法直接檢查截圖像素。
computer_screenshot在這些路由上返回保存的 PNG 路徑。使用觀察/OCR 工具將路徑/窗口轉換爲文本、UI 區域和座標。 - 觀察不是模型:視覺觀察不是視覺模型。圖標/按鈕候選是具有置信度和證據的啓發式方法;點擊後驗證。
結尾¶
dsh-computer-use-win 爲 DSH 提供了與 Windows 界面交互的必要工具集。它通過依賴系統輔助功能和 OCR 處理,解決了文本模型難以直接查看像素的問題。請查看插件倉庫以獲取源代碼和更新。
- GitHub:https://github.com/secretxuan/dsh-computer-use-win
- SkillHub 目錄:https://www.skillhub.cn/plugins/secretxuan/dsh-computer-use-win