前言¶
在 DSH 裏跑長任務時,窗口往往被其它應用蓋住。任務結束、失敗、或等着審批時,若只靠盯着界面,很容易錯過時機。系統自帶的 macOS 通知可以打斷這種「守窗口」的習慣,但 DSH 本身並不會默認把各類會話事件推到通知中心。
下面介紹社區插件 dsh-mac-notify(維護者 CarbeneLee):它監聽 DSH 的 Cordis 事件,在任務完成、失敗、需要審批或需要回答時彈出橫幅,並可在點擊後嘗試激活 DeepSeek Harness。插件在 package.json 中聲明 dsh.bundle.platforms: ["darwin"],非 macOS 主機不會安裝該 bundle,避免裝上一個永遠無法觸發的插件。
這是什麼¶
dsh-mac-notify 是面向 DeepSeek Harness (DSH) 的 macOS 通知插件,當前 npm 包版本爲 0.4.1,許可證 MIT,要求 Node >=20。源碼與說明見 GitHub 倉庫,也可在 SkillHub 目錄頁 找到條目。
會監聽哪些時刻¶
插件把 DSH 事件映射爲通知文案,要點如下(子代理回合默認靜音,以免刷屏):
| 時刻 | DSH 事件 | 橫幅內容概要 |
|---|---|---|
| 任務完成 | turn/end → completed |
耗時、你的 prompt、最後一行回答 |
| 任務失敗 | turn/end → error / max-tokens |
錯誤信息 + 任務 |
| 需要審批 | approval/request |
工具名 + 原因 |
| 需要回答 | user-questions/request |
問題文本(多條時帶數量) |
| 計劃待審 | user-questions/request 且含 plan-review |
專用副標題 |
| 任務阻塞 | turn/end → blocked |
默認關閉 |
子代理會持續結束回合;默認只有你在看的會話會播報,可通過配置 includeSubagents 打開(通常較吵)。
安裝與啓用¶
環境限定 macOS。桌面版與 CLI 的配置方式不同。
DeepSeek Harness 桌面應用¶
桌面 profile 由 Electron 應用獨佔管理,不能用 dsh plugin --profile desktop ...。應在側欄 Plugins → Install 填寫:
link:/absolute/path/to/dsh-mac-notify # 本地路徑
github:CarbeneLee/dsh-mac-notify # 直接從 GitHub
桌面版帶 HMR,bundle 多半無需重啓即可掛載;若始終沒有橫幅,再退出並重新打開應用。
Web profile / 自定義 profile(CLI)¶
dsh plugin --profile web add dsh-mac-notify # 從 npm(推薦)
dsh plugin --profile web add github:CarbeneLee/dsh-mac-notify # 或從 GitHub
默認通知後端爲 auto:依次嘗試 Electron、原生 helper、terminal-notifier、osascript。首次掛載時若缺少 DSHNotifier.app,插件會在後臺構建(需 Xcode Command Line Tools,約數秒);構建完成前仍可通過 osascript 收到通知(圖標爲 Script Editor)。設置環境變量 DSH_MAC_NOTIFY_NO_BUILD=1 可跳過構建。
手動寫入 profile¶
在 ~/.dsh/profiles/<profile>/package.json 增加依賴與 bundle,再用應用自帶的 pnpm 安裝:
{
"dependencies": { "dsh-mac-notify": "link:/path/to/dsh-mac-notify" },
"dsh": { "profile": { "bundles": ["...", "dsh-mac-notify"] } }
}
cd ~/.dsh/profiles/desktop
node "/Applications/DeepSeek Harness.app/Contents/Resources/runtime/primary-runtime/dependencies/pnpm/bin/pnpm.mjs" install
驗證是否工作¶
先做系統級演示(不依賴插件):
node scripts/notify-demo.mjs
插件掛載後,可對模型說「send a test notification」,模型會調用 mac_notify_test 並返回當前後端與配置。將配置項 debug: true 後,每次投遞會追加到 ~/.dsh/dsh-mac-notify/debug.log。
配置¶
覆蓋項寫在對應 profile 的 cordis.patch.yml:
- id: dsh-mac-notify
config:
appName: DeepSeek Harness
notifyOnComplete: true
notifyOnError: true
notifyOnApproval: true
notifyOnQuestion: true
suppressWhenFocused: false
backend: osascript
completeSound: Glass
debug: false
常用字段包括:enabled(總開關)、appName / bundleId(標題與點擊激活的應用)、locale(zh / en / auto)、各類 notifyOn*、suppressWhenFocused(DSH 窗口在前臺時是否跳過)、completeSound 等系統音名、*SoundFile(afplay 可播文件,優先於音名)、backend、minIntervalMs(節流)、maxBodyChars / maxLabelChars(正文與標籤長度)、debug。完整默認值見倉庫 README 配置表。
通知後端與圖標¶
| backend | 說明 |
|---|---|
helper(推薦) |
經 bundled DSHNotifier.app 發送,橫幅爲 DSH 圖標,點擊可激活應用 |
osascript |
display notification,無額外依賴;歸因 Script Editor,橫幅不可點 |
electron |
原生 Electron 通知;當前隨附的 DSH 桌面構建不向插件暴露 electron 模塊時會回退 |
terminal-notifier |
需本機 brew install terminal-notifier |
command |
自定義命令,環境變量 DSH_NOTIFY_TITLE/SUBTITLE/BODY/SOUND/GROUP 承載載荷 |
auto(默認) |
Electron → helper → terminal-notifier → osascript |
可一次性構建 helper:
sh scripts/build-helper.sh
輸出安裝到 ~/.dsh/dsh-mac-notify/DSHNotifier.app,再在配置裏設 backend: helper。首次通知會請求系統通知權限,需在 系統設置 → 通知 中允許。
若要把提示音換成其它應用素材(示例爲微信 notify.caf),應複製到自有目錄再配置 *SoundFile,避免應用更新後路徑失效。
backend: command 示例(Webhook):
backend: command
command: 'curl -s -X POST -H "Content-Type: application/json" -d "{\"text\":\"$DSH_NOTIFY_BODY\"}" https://example.com/hook'
適用場景與注意¶
適合在 macOS 上長期用 DSH 跑 agent、工具審批或多輪問答、又希望離開窗口時仍能收到回調的開發者。Windows / Linux 用戶無需安裝此插件。
與其它 DSH 插件一樣,邏輯在 當前 DSH 進程權限 下運行;安裝前建議閱讀倉庫源碼與 MIT 許可證,自行判斷數據是否會出現在通知正文(插件會截斷 maxBodyChars 等,但敏感內容仍可能泄露到通知中心)。
SkillHub 等社區目錄獨立於 DeepSeek / 幻方,並非官方應用商店;插件由 CarbeneLee 維護,問題可提 GitHub Issues。
結尾¶
dsh-mac-notify 把 DSH 的關鍵會話節點接到 macOS 通知中心,減少盯着窗口的時間,並可選 DSH 圖標與點擊回應用。按需選 npm / GitHub / 本地 link 安裝,用 cordis.patch.yml 收緊事件類型與後端即可。
- 目錄頁:https://www.skillhub.cn/plugins/CarbeneLee/dsh-mac-notify
- GitHub:https://github.com/CarbeneLee/dsh-mac-notify