前言¶
在 DSH(DeepSeek Harness)裏跑長任務時,智能體常會調用 ask_user_question 等你確認或補充信息。若此時窗口被最小化、被別的程序蓋住,或你正在看別的 Session,問題卡片只留在 Web 客戶端裏,很容易漏看。
系統自帶的通知在 Electron 外殼裏往往只進通知中心、不出橫幅。本插件在 Windows 上改爲在桌面右下角彈出一張可點擊的毛玻璃卡片;點擊後恢復並置頂 DSH 窗口,並導航回發起詢問的 Session。維護者爲 LJY4-bilibili,分類爲客戶端插件,源碼託管於 GitHub,許可證 MIT。
這是什麼¶
dsh-message-reminder 是 DSH 的客戶端插件:當 DSH 通過 ask_user_question 向你提問,且你當前並不在「盯着該 Session 的前臺窗口」時,在 Windows 桌面右下角彈出通知卡片;點擊卡片會恢復 DSH 窗口並回到對應 Session。非 Windows 或無法使用 PowerShell 輔助進程時,Host 會回退到頁面內的 Notification。
插件不修改詢問流程本身:Host 以 { prepend: true } 觀察 user-questions/request waterfall,記錄詢問後仍把應答權交回原監聽者;卡片不搶焦點。
核心功能¶
詢問觸發與抑制¶
| 時機 | 行爲 |
|---|---|
調用 ask_user_question,且頁面不在該 Session 或窗口未在前臺 |
右下角彈出毛玻璃卡片(內縮約 18px),播放可配置的提示音;正文爲問題摘要,多題時附帶「共 N 個問題」 |
| 頁面正顯示該 Session 且窗口爲當前活動窗口 | 默認不彈卡片、不響(問題已在輸入區) |
| 問題被回答或取消 | 卡片隨輔助進程結束而消失 |
是否「正在看該 Session」由 client.js 上報 mainView、頁面可見性與聚焦狀態;Host 用 visibilityState === 'visible' 與 document.hasFocus() 的與關係判斷。配置項 skipWhenViewingSession 默認爲 true;設爲 false 則不再抑制。
Windows acrylic 卡片¶
在 Windows 10 1803 及以上,卡片通過 SetWindowCompositionAttribute 與 DWMWA_WINDOW_CORNER_PREFERENCE 繪製無邊框、置頂的毛玻璃窗口,文字用 TextRenderer.DrawText 繪製。README 說明:渲染進程 Notification、NotifyIcon 氣泡與 WinRT toast 在該 Electron 環境下均無法顯示橫幅,故採用自繪窗口。
點擊卡片:按階梯策略嘗試恢復、置頂 DSH 窗口(進程名默認 DeepSeek Harness),再導航回 Session。點擊右上角 ✕ 僅關閉卡片,不跳轉。正文超過 160 字符會截斷;標題過長會省略號顯示。
通道與診斷¶
Host 使用 Node 內置模塊(node:child_process、node:fs、node:path),註冊 webServer 路由,無運行時 npm 依賴。頁面通過 SSE(/message-reminder/events)接收 ask / click / resolved 等事件。診斷接口:GET /message-reminder/status。
環境要求¶
- DSH,且使用 Web 客戶端。
- Node.js >= 22。
- Windows 10 1803+ 方可使用 acrylic 卡片;macOS / Linux 或 PowerShell 不可用時使用頁面內
Notification。
安裝與啓用¶
插件上架 DSH 插件市場(dshmarket)後可從市場安裝;也可手動加入 profile。本地 checkout 始終可用:
dsh plugin --profile <your-profile> add link:/path/to/dsh-message-reminder
包發佈到 npm 後也可:
dsh plugin --profile <your-profile> add dsh-message-reminder
dsh plugin add 會在 profile 內執行 pnpm add。包自帶 dsh.bundle.patch,加載 profile 時會插入對應行;請確認 profile 的 bundle 列表中包含該包名,例如:
// $DSH_HOME/profiles/<your-profile>/package.json
{
"dsh": { "profile": { "bundles": ["...", "dsh-message-reminder"] } }
}
配置¶
在 profile 的 cordis.patch.yml 中按行 id 覆蓋(config 塊會替換整個默認塊,需保留仍要使用的字段):
- id: message-reminder
config:
title: DSH 消息提醒 # 卡片標題
skipWhenViewingSession: true # 詢問 Session 已在主視圖時不彈卡片(默認)
skipWhenFocused: false # 爲 true 時頁面聚焦也跳過渲染進程通知
windowProcessName: DeepSeek Harness # 點擊卡片時要置頂的進程窗口名
sound: true # true | false | asterisk / exclamation / question / hand / beep
notifyMode: auto # auto | balloon | renderer
notifyMode: balloon 指 Host 側 PowerShell 輔助進程卡片;renderer 強制使用頁面通知,便於不拉起子進程時測試。提示音僅在卡片實際展示時播放。
典型用法¶
1、在 profile 中按上文命令安裝並確認 bundle 列表包含 dsh-message-reminder。
2、按需修改 cordis.patch.yml 中的 title、windowProcessName 與 sound 等項。
3、啓動 DSH,讓智能體在後臺 Session 中觸發 ask_user_question,同時將 DSH 最小化或切換到其他程序;應看到右下角卡片。點擊卡片應回到該 Session 並展開待答問題。
4、需要排查時訪問 Host 提供的 GET /message-reminder/status。
適用場景與注意¶
適合長時間跑 DSH、常離開窗口又需要及時回答 ask_user_question 的 Windows 用戶。插件以當前 DSH 進程權限運行,安裝前請自行閱讀源碼與 MIT 許可證。
已知限制(來自 README):
- 卡片僅 Windows 可用;其他平臺爲渲染進程通知。
- acrylic 調用失敗時卡片退化爲純色背景,其餘功能仍可用。
- 部分環境下 AMSI 可能導致 PowerShell 編譯腳本失敗,Host 最多重試 5 次後回退到渲染進程通知。
- 首張卡片因輔助進程編譯 Win32 helper 可能略慢(約 1 秒)。
DeepSeek Harness 生態強調「一切皆插件」;社區插件目錄爲獨立站點,與 DeepSeek / 幻方無官方從屬關係。