DeepSeek Harness 插件介紹:dsh-computer-use

前言

DeepSeek Harness (DSH) 的核心設計理念是「一切皆插件」。在 Linux 環境下開發計算機操作智能體時,現有方案大多依賴 Node 原生模塊、PowerShell 或無障礙框架,這增加了環境配置的複雜度。dsh-computer-use 作爲一個針對 Linux X11 的插件,通過輕量級的 Python XTest 輔助程序,解決了截圖與真實鼠標鍵盤輸入的需求。

插件定位

這是一個 DeepSeek Harness 插件,允許智能體在 Linux X11 桌面環境進行截圖、鼠標移動、點擊、拖拽、滾動以及鍵盤輸入。它不依賴 Node.js 構建步驟或無障礙框架,直接通過 Python ctypes 調用 libX11 和 libXtst。該插件由 asdasdsdsdasdasdasd 維護,採用 MIT 許可證,並非 DeepSeek 官方維護的包。

核心功能

插件提供了一組工具接口,用於控制桌面環境:

  • computer_screenshot: 捕獲屏幕(全屏或區域),返回圖像及縮放元數據。
  • computer_move_mouse: 移動指針到指定像素座標。
  • computer_click: 移動並點擊鼠標。
  • computer_drag: 在兩點之間拖拽。
  • computer_scroll: 在指定位置滾動滾輪。
  • computer_type: 在聚焦窗口輸入文本。
  • computer_key: 發送按鍵或組合鍵。
  • computer_cursor: 讀取當前指針位置。
  • computer_screen_info: 獲取屏幕幾何信息及 XTest 可用性。

安裝與啓用

在現有的 Harness 配置中添加該插件。請確保你的環境已安裝 python3、libX11、libXtst 和 ImageMagick。

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

安裝後,重啓 DSH 進程,並通過 dsh --profile web --dump-config 確認配置中出現了 # == dsh-computer-use 層。

配置說明

插件默認使用 danger-full-access 沙箱模式。由於需要通過 XTest 進行真實輸入,建議在受控的 Linux 環境下使用。

可在 cordis.patch.yml 中調整配置:

- id: computer-use
  config:
    helper: /absolute/path/to/xc.py   # 默認爲 index.js 旁邊的 xc.py
    shotDir: /tmp/dsh-computer-use    # 截圖臨時目錄
    defaultWidth: 1280                # 圖片寬度上限
    sandboxMode: danger-full-access   # 沙箱模式
    observeAfterAction: true          # 操作後附帶截圖

使用示例

插件提供了一個 Python 輔助腳本 xc.py 用於驗證環境。運行以下命令應返回包含屏幕尺寸和 xtest 狀態的 JSON:

python3 xc.py info

座標計算基於原生 X11 像素,若截圖進行了縮放,需使用以下公式轉換:

screen_xy = region_xy + image_xy * scale_xy

限制與注意事項

  • 平臺限制: 僅支持 Linux X11。不支持 Wayland、macOS 或 Windows。
  • 依賴: 需要 python3, libX11, libXtst, ImageMagick。無 Node 構建步驟,無 PowerShell,無無障礙框架。
  • 權限: 默認 sandboxMode 爲 danger-full-access,插件具備完全的桌面控制權,包括密碼輸入和破壞性操作。
  • 安全性: 請勿在包含敏感信息的共享會話或機器上啓用此插件。請將此視爲完全的桌面控制工具。

總結

如果你的智能體運行在 Linux X11 環境中,且希望避免複雜的 Node 或無障礙依賴,dsh-computer-use 提供了直接的 X11 截圖與輸入方案。安裝後,智能體即可通過 computer_* 系列工具與真實桌面交互。

相關資源:
* 插件目錄:https://www.skillhub.cn/plugins/asdasdsdsdasdasdasd/dsh-computer-use
* GitHub 倉庫:https://github.com/asdasdsdsdasdasdasd/dsh-computer-use

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

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

小夜