dsh-macos-notify:DSH 窗口失焦時的回合完成通知與未讀點

前言

在 DeepSeek Harness(DSH)裏跑長回合時,你常會切到別的應用等結果。官方界面能顯示會話狀態,但窗口不在前臺時,完成、失敗或 token 用盡往往要等到你手動切回來才發現。社區插件 @apodemakeles/dsh-macos-notify(倉庫 apodemakeles/dsh-macos-notify)針對 macOS 桌面場景:在 harness 窗口未獲得焦點時彈出系統通知,並在側邊欄會話行上留下未讀完成點。下面介紹它的能力、安裝方式與使用注意。

這是什麼

@apodemakeles/dsh-macos-notify 是 DSH 的客戶端類插件,維護者爲 apodemakeles,當前發佈版本爲 v0.1.2(自 GitHub 分發)。npm 上未帶 scope 的包名 dsh-macos-notify 屬於其他項目,安裝時需使用 @apodemakeles scope 或 README 中的 github:apodemakeles/dsh-macos-notify 來源。

插件不發起網絡請求:會話名稱與回合結束原因留在本機處理。

核心功能

系統通知(僅窗口失焦)

僅在 harness 窗口不在前臺(document.hasFocus() === false)時觸發瀏覽器 / Electron 的 Notification API。點擊通知會聚焦窗口並打開對應會話。

turn/end reason 通知行爲
completed、max-tokens、blocked 標題爲會話名,正文爲本地化「已完成」類文案
error 標題爲會話名,正文爲本地化「失敗」類文案
aborted、interrupted、未知原因 靜默
subagent 會話 靜默

未讀完成點

窗口失焦期間完成的回合,會在會話行左側顯示小圓點:成功爲綠色,失敗爲紅色。即使該會話仍停留在主視圖也會出現。點擊該行、開始新的運行,或點擊系統通知後清除。若官方 UI 已顯示後臺完成狀態點,插件不會重複疊加。

啓動或重連後不會對歷史回放:首次 projection 取值只用於建立基線。

設置項

Settings → Notifications 提供總開關(默認開啓)、權限狀態,以及請求權限 / 發送測試通知按鈕。開關保存在瀏覽器 localStorage 中。

安裝與啓用

插件以當前 DSH 進程權限運行;安裝前請自行查看 GitHub 源碼 與 MIT 許可證。

桌面應用(desktop profile)

desktop profile 由 Electron 應用管理,不能使用 dsh plugin --profile desktop。需按應用插件管理器相同方式添加依賴並寫入 bundle:

DSH_HOME=${DSH_HOME:-$HOME/.dsh}
PROFILE="$DSH_HOME/profiles/desktop"

pnpm --dir "$PROFILE" add github:apodemakeles/dsh-macos-notify

在 $PROFILE/package.json 的 dsh.profile.bundles 中加入包名:

{ "dsh": { "profile": { "bundles": [
  "@deepseek-ai/dsh-base",
  "@deepseek-ai/dsh-web-app",
  "@apodemakeles/dsh-macos-notify"
] } } }

重啓應用後,在 Plugins → Installed 應能看到插件,Settings → Notifications 會出現開關。

Web profile

dsh plugin --profile web add github:apodemakeles/dsh-macos-notify

執行後需重啓 dsh web。

Release 壓縮包

每個 GitHub Release 提供 apodemakeles-dsh-macos-notify-<version>.tgz,例如:

dsh plugin --profile web add file:/path/to/apodemakeles-dsh-macos-notify-0.1.2.tgz

典型用法

  1. 按上文完成安裝並重啓 DSH。
  2. 打開 Settings → Notifications,確認總開關爲開;首次使用可點 Request permission 或 Send a test notification,在 系統設置 → 通知 中允許 DeepSeek Harness。
  3. 保持 harness 在後臺,等待某會話回合以 completed 或 error 等可通知原因結束,應收到系統通知;側邊欄對應行出現綠點或紅點。
  4. 點擊通知或會話行,未讀點應清除。

若啓用了 macOS 專注模式且未將 DeepSeek Harness 加入允許列表,通知可能被「延遲送達」靜默;應用內未讀點不依賴專注模式。

實現要點與兼容性

  • Host:註冊 turn-notify session projection,摺疊 turn/start 與 turn/end.reason,向客戶端暴露 { turn, reason }。
  • Client:監聽會話列表與 projection,經總開關、subagent 過濾、原因映射與焦點門控後展示通知;未讀點通過官方 sidebar.session.row.leading 插槽渲染,且僅在官方狀態點爲 idle 時顯示。

兼容範圍(見 package.json engines):

  • DSH >=0.2.0-rc.1 <0.3.0;README 記載在桌面應用 0.2.1-rc.2 與 CLI 0.2.0-rc.1 上做過測試。
  • 系統通知依賴 macOS 與 Notification API;未讀點爲跨平臺 UI 行爲。
  • Node >=22。

結尾

@apodemakeles/dsh-macos-notify 解決的是「人不在 harness 前臺時如何得知回合已結束」:macOS 系統通知加上會話行未讀點,邏輯本地、可關總開關。社區目錄頁:SkillHub - dsh-macos-notify;源碼與詳細說明:GitHub - apodemakeles/dsh-macos-notify。

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

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

小夜