dsh-computer-use:在 DeepSeek Harness 上實現 Codex 風格的 Windows 桌面操控

前言

在 DeepSeek Harness(DSH)裏做智能體,常見路徑是接 MCP、寫自定義工具,或讓模型只處理文本與 API。若要讓模型像人一樣點窗口、讀界面、敲鍵盤,往往需要單獨搭一套桌面自動化運行時,還要自己定義「觀察—動作—再觀察」的協議。

dsh-computer-use 把這件事做成純 DSH 插件:面向 Windows 10/11 交互式會話,用窗口級 UI Automation、可容忍遮擋的截圖和 SendInput 注入輸入,對外暴露五個模型工具,並由內置的長駐 PowerShell helper 執行。界面參考 OpenAI Codex Windows Computer Use 的工具面(列應用、取窗口狀態、點擊/按鍵/輸入等),但不依賴第三方運行時或 MCP。維護者爲 GitHub 用戶 esch30636,在 SkillHub 目錄中歸類爲「工作流」;源碼託管於 esch30636/dsh-computer-use,許可證爲 MIT(資料中 package 版本爲 1.1.0)。

這是什麼

一句話:dsh-computer-use 是僅支持 Windows(os: win32)的 DSH 插件,在 Harness 會話裏提供 computer_* 工具鏈,讓模型按「先觀察窗口狀態,再執行單一動作(或有限步序列)」操控本機 GUI。

運行要求包括:Windows 10/11、可交互用戶會話(非服務會話)、PowerShell 5.1(powershell.exe,不要求 pwsh 7);DSH 0.2.x,且所用 profile 需掛載 tools、systemPrompt、attachments(官方 base 默認三者皆有)。插件無原生模塊、無 npm 業務依賴、無 MCP server。

核心功能

五個模型工具

工具 作用
computer_list_windows 列出可瞄準的頂層窗口(含 window_id、進程、標題、矩形、前臺/最小化、是否被策略攔截);可選列出可從開始菜單啓動的應用。
computer_observe 抓取某一窗口狀態:默認含截圖,可選 UI Automation 樹與元素索引、焦點、選區、文檔文本;返回 state_id 與截圖座標映射。
computer_action 針對某一 state_id 執行恰好一個動作:點擊/雙擊/右鍵/中鍵/移動/輸入/按鍵/滾動/拖拽/set_value/等待/activate_window 等。
computer_launch_app 按 exe 路徑、exe 名、開始菜單顯示名、.lnk 或 shell:AppsFolder\<AUMID> 啓動應用,並報告打開的窗口。
computer_sequence 在同一窗口上按順序執行最多 100 步輸入(屏幕絕對像素座標),中間不必重新觀察,適合重複性 GUI 操作;可選返回一張校驗截圖。

設計遵循「一次動作後再觀察」的工作流;按鍵名採用 X11-keysym 風格,與 Codex 文檔中的習慣對齊。

屏幕 overlay 與 ESC 終止

Computer use 激活期間,會顯示可穿透點擊的全屏狀態層:中心透明、四邊藍寶石色漸暗的「liquid glass」邊緣,顯示器邊框一圈青色細邊,頂部中央有動態島式狀態條,默認文案爲「DeepSeek Harness 正在操控你的電腦 | 按 ESC 終止」。用戶按 ESC 會立即停止 computer use、關閉 overlay,並向智能體發出停止信號(USER_ESCAPE)。

插件還附帶 system prompt 片段(工作流、硬拒絕、確認策略)以及 computer-use skill,內含完整 playbook。

安裝與啓用

包名注意: npm 上另有無關包名 dsh-computer-use,不要用 dsh plugin add dsh-computer-use 安裝本插件;應使用 GitHub 規格或 release 壓縮包 URL。

Web / CLI 可管理的 profile

對 dsh CLI 可管理的 profile(如 web、tui、headless 等),在終端執行:

dsh plugin --profile web add github:esch30636/dsh-computer-use

若不便直連 GitHub,可使用 release 壓縮包(無需 git fetch):

dsh plugin --profile web add "https://github.com/esch30636/dsh-computer-use/releases/latest/download/dsh-computer-use.tgz"

安裝後插件會進入該 profile 並啓用 bundle;重啓宿主或等待 HMR 重新組合後,新會話中會出現 computer_* 工具。

Desktop profile

Desktop 應用保留 desktop profile,dsh plugin --profile desktop 會拒絕執行。可選路徑包括:待插件列入 awesome-dsh-plugin 後從「設置 → 插件市場」一鍵安裝;或從 releases 下載解壓後運行:

powershell -NoProfile -ExecutionPolicy Bypass -File scripts\install-release.ps1

可用 -Version v1.1.0 固定版本、-Profile web 指定 profile、-Verify 做離線組合校驗。

離線 / 手動安裝

下載 release 解壓後:

powershell -NoProfile -ExecutionPolicy Bypass -File scripts\install.ps1 -Profile desktop

安裝器會把包複製到 ~/.dsh/profiles/<profile>/node_modules/dsh-computer-use,把 dsh-computer-use 寫入 dsh.profile.bundles,並把 skill 安裝到 %USERPROFILE%\.agents\skills\computer-use。卸載示例:

powershell -NoProfile -ExecutionPolicy Bypass -File scripts\install.ps1 -Profile desktop -Uninstall

配置要點

在 profile 的 cordis.patch.yml 中,對應行 id 爲 computer-use。示例片段如下(僅列出資料中出現的字段):

- id: computer-use
  config:
    blockedProcesses: [msedge.exe]
    screenshotMaxWidth: 1600
    screenshotMaxHeight: 1200
    maxElements: 600
    maxTreeDepth: 12
    idleTimeoutMs: 600000
    startupTimeoutMs: 90000
    requestTimeoutMs: 30000
    confirmRiskyActions: true
    warnWhenApprovalUnavailable: true
    allowWindowsKey: false
    allowTerminalAutomation: false
    keepScreenshots: false
    overlayEnabled: true
    overlayMessage: "DeepSeek Harness 正在操控你的電腦 | 按 ESC 終止"
    overlayIdleTimeoutMs: 90000
    overlayEdgeOpacity: 55

常用含義簡述:blockedProcesses / allowedProcesses(非空時爲白名單模式)控制可自動化的進程;截圖與 UIA 樹有 screenshotMaxWidth/Height、maxElements、maxTreeDepth 等上限;confirmRiskyActions 會在破壞性或對外的操作前走 ctx.approval;overlayEnabled 與 overlayMessage 控制全屏提示與 ESC 終止行爲。更多選項見倉庫 README 配置表。

典型用法思路

資料中的設計是顯式工作流,而非單條魔法命令:

  1. 用 computer_list_windows(必要時配合 computer_launch_app)確定目標 window_id。
  2. 用 computer_observe 獲取當前 state_id、截圖與可點擊元素索引。
  3. 用 computer_action 執行一步操作(例如 click 帶 element_index 或座標、type、key、scroll 等)。
  4. 再次 computer_observe,根據新狀態決定下一步。

對重複、座標固定的操作(如畫圖填表),可在同一窗口上用 computer_sequence 批量發送最多 100 步,最後再觀察或依賴可選的校驗截圖。

適用場景與注意

適合: 已在 DSH 0.2.x 上開發 Windows 端智能體、需要模型驅動本機 GUI(辦公客戶端、畫圖、設置嚮導等)且能接受「觀察—單步動作—再觀察」節奏的團隊。

務必注意:

  • 插件以當前 DSH 進程權限運行,能點的窗口和能發的輸入與登錄用戶一致;安裝前請自行審閱 源碼 與 MIT 許可證。
  • 僅 Windows;Linux/macOS profile 不適用。
  • 內置策略會拒絕部分高風險進程與操作;可通過 blockedProcesses、allowedProcesses 等收緊範圍。默認 confirmRiskyActions: true,無審批通道時可能僅警告繼續(見 warnWhenApprovalUnavailable)。
  • 操控進行中請留意全屏 overlay;需要立刻收回控制權時按 ESC。

結尾

dsh-computer-use 把 Windows 桌面自動化收斂進 DSH 插件形態:五個 computer_* 工具、PowerShell helper、可配置的進程策略,以及帶 ESC 終止的全屏提示,便於在 Harness 裏複用 Codex 式 computer use 協議而不另起運行時。

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

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

小夜