前言¶
在 DeepSeek Harness(DSH)裏做智能體時,模型往往只能讀寫對話內的文本與附件,難以像人一樣「看見」計算器窗口、在表單裏敲字,或在已登錄的瀏覽器裏點按鈕讀表格。手寫無障礙橋接、截圖管道和瀏覽器 CDP 連接,工作量大,且要與 Harness 的授權、日誌和附件管線對齊。
dsh-computer-use-macos 是社區維護者 yw5579358 發佈的工作流類插件,把 Harness 在 macOS 上的原生 Computer Use 能力與可選的瀏覽器 DOM 控制收攏到一套應用/窗口 API 裏,供 PTC 會話跨多次調用持久使用。交互模式參考 Codex Computer Use:選中應用或標籤頁 → 觀察狀態與截圖 → 執行操作 → 再觀察。
這是什麼¶
插件全名 Computer Use for DeepSeek Harness on macOS(npm 包名 dsh-computer-use-macos,當前資料記載版本 0.1.1)。它依賴 DeepSeek Harness 實驗性的 macOS CUA 提供方(@deepseek-ai/dsh-cua、@deepseek-ai/dsh-experimental-cua-macos)做無障礙樹、窗口捕獲與輸入;瀏覽器側通過 Playwright 經 CDP 連接專用 Chrome 配置,按 role、label、文本定位元素。插件本身負責應用/窗口 API、PTC 下的模塊加載、觀察新鮮度校驗、瀏覽器連接管理與截圖投遞,調用走 Harness 既有授權與附件流程。
倉庫:https://github.com/yw5579358/dsh-computer-use-macos。社區目錄頁:https://www.skillhub.cn/plugins/yw5579358/dsh-computer-use-macos。許可證爲 MIT。
核心能力¶
資料中明確列出的能力如下,不擴寫未出現的特性。
macOS 原生應用: 選擇應用與窗口;讀取無障礙樹;捕獲窗口截圖;點擊;輸入 Unicode 文本;發送快捷鍵;滾動;選中文本與粘貼。
網頁(需單獨啓用瀏覽器 DOM 控制): 讀取頁面內容;填寫輸入框;點擊按鈕;提取表格;定位 DOM 元素;捕獲當前視口。任務空閒時瀏覽器連接會釋放供下一會話使用;標記爲交付物或 handoff 的頁面可爲用戶保留打開狀態。
版本 0.1.1 曾在 Harness Desktop 中實測(含中文表單輸入、按鈕點擊、結果回讀、截圖及跨會話瀏覽器複用)。README 記載本地與 GitHub CI 共 44 項自動化測試通過,另有 12 項原生桌面檢查;細節見倉庫內 test report。
環境與依賴¶
安裝前對照 README 覈對:
- macOS 14+
- DeepSeek Harness
0.2.2-rc.1 - Node.js 24.9+;需要具備圖像能力的模型以處理截圖
- 爲
DSH Computer Use.app授予「輔助功能」與「屏幕錄製」權限
每個 profile 宜只使用一個原生 Computer Use 提供方。
安裝與啓用¶
Harness Desktop(推薦路徑)¶
- 打開 Plugins,啓用實驗項 Custom plugin indexes。
- 打開 Discover,添加下面的 JSON 索引地址。
- 選擇 Computer Use for macOS,覈對版本與來源後 Install → Enable now。
- 在 Settings → Agent presets 中選擇 PTC mode,再新建對話。
索引 URL(須與資料原文一致):
https://raw.githubusercontent.com/yw5579358/dsh-computer-use-macos/codex/initial-release/plugin-index.json
Desktop 的 Add plugin 對話框也接受 Releases 中的 tarball;索引版本指向特定 Git 提交,倉庫內包含構建好的 lib/。
更新第三方插件時,建議先備份 profile 配置,卸載舊版再安裝新版;已有對話仍使用當時的 preset。
CLI 獨立 profile¶
若使用單獨 CLI profile,安裝命令來自 README 示例(需先取得對應版本的 .tgz,例如 Releases 產物):
dsh plugin --profile computer-demo add ./dsh-computer-use-macos-0.1.1.tgz
dsh --profile computer-demo --dump-config
Desktop 通過應用內插件頁管理自帶的 desktop profile,與上述 CLI profile 分開。
在對話裏怎麼用¶
以下示例摘自 README,替換應用名、URL 和任務即可復現思路。需要任務結束後保留頁面時,可明確要求 Harness leave the tab open for review。
原生應用:
Use Computer Use to open Calculator, calculate 123 × 456, and report the result shown in the window.
Open TextEdit with Computer Use. Create a document titled “Weekly plan” with three action items. Leave the window open for me to review.
瀏覽器 DOM:
Use browser DOM control to open http://localhost:3000, check the navigation links and main buttons, and capture the result. Leave the tab open for review.
Use browser DOM control to open the dashboard I specify. After I sign in, read the visible table and count records by status.
啓用瀏覽器 DOM 控制¶
瀏覽器不會默認全開;按文檔 opt-in 配置。
先啓動專用 Chrome 實例:
"$HOME/.dsh/profiles/desktop/node_modules/dsh-computer-use-macos/scripts/start-browser.command"
啓動器將用戶數據放在 $HOME/.dsh/browser-dom/profile,調試端點爲 127.0.0.1:9222。需在獨立窗口登錄站點時,在該 Chrome 中完成;關閉瀏覽器後再次運行啓動器。
在 profile 的 cordis.patch.yml 中增加(字段名與資料一致):
- id: macos-computer-use-compat
name: dsh-computer-use-macos
config:
configuredCDPEndpoint: http://127.0.0.1:9222
browserTimeoutMs: 15000
browserMaxElements: 400
保存後新建 PTC 對話。連接保留頁、故障排查見倉庫 browser guide。
PTC 中調用 API(進階)¶
需要在 PTC 腳本里直接編排時,README 給出原生與瀏覽器橋接示例。要點:每次輸入後讀取新鮮狀態;跨空閒邊界恢復時要重新選擇瀏覽器標籤;截圖經 Harness 附件管道交給模型。
原生應用片段:
const entry = await tools.computer_use_bootstrap({})
const { connectComputerUse } = await import(entry.nativeBridgeUrl)
const cua = connectComputerUse(() => tools.cua, {
text: value => console.log(value),
})
const app = await cua.getApp('Calculator')
await app.getAXState()
await app.click(elementIndex)
await app.getAXState()
瀏覽器片段:
const { connectBrowser } = await import(entry.browserBridgeUrl)
const browser = connectBrowser(() => tools.computer_browser)
const tab = await browser.createBrowserTab('chromium', 'http://localhost:3000')
await tab.playwright.getByRole('button', { name: 'Continue', exact: true }).click()
await tab.getAXState()
await tab.markHandoff()
更完整的 API 說明見 docs/capabilities.md。
適用場景與注意¶
適合在 macOS 上用 Harness PTC 做桌面自動化驗證、本地化表單操作、需要「看窗口再點」的重複性任務,以及在專用 Chrome 配置裏做 DOM 級網頁操作(含登錄後讀表)。不適合非 macOS 環境;也不應把插件當成無需審覈即可任意操控整機的黑盒——操作範圍受系統權限與 Harness 授權約束。
安裝與啓用前建議通讀倉庫源碼與 Security 文檔。插件在用戶當前 DSH 進程權限下運行,輔助功能與屏幕錄製授權範圍決定模型能接觸哪些界面。社區目錄(如 SkillHub)與 DeepSeek / 幻方無官方從屬關係,索引與 tarball 均來自第三方倉庫,自行覈對 commit 與版本。
卸載:Desktop 在插件詳情選 Uninstall;CLI profile 可用:
dsh plugin --profile computer-demo remove dsh-computer-use-macos
系統「隱私與安全性」中的 macOS 權限,以及 Harness Computer Use 權限頁中的授權,需單獨管理。
結尾¶
dsh-computer-use-macos 把 macOS 原生 Computer Use 與可選的 CDP 瀏覽器控制接到 Harness 已有 PTC、日誌與附件鏈路上,用統一的應用/窗口抽象降低「對話裏操控本機」的集成成本。若要瀏覽簡介或跳轉安裝說明,可用目錄頁 skillhub.cn/plugins/yw5579358/dsh-computer-use-macos;技術細節與發行包以 GitHub 倉庫爲準:github.com/yw5579358/dsh-computer-use-macos。