Introduction¶
The DSH Desktop Terminal displays a system-level Toast notification when a task ends. This notification has two drawbacks: first, if the window is in the foreground, it is disruptive noise; second, if you step away and return later, the Toast is already gone. Since the host only retains the latest turn/end record, the session conclusion becomes untraceable.
The dsh-tauri-notify-webhook plugin moves notifications off-screen, persisting them via channels such as Email (SMTP) or Pushplus. It only triggers when a task stops abnormally or completes, and the window is not in the foreground.
Installation & Enablement¶
This plugin requires the DSH Desktop Shell and Node.js >= 22.15.0.
Install using the following command:
dsh plugin --profile <name> add github:iuuuuuuuu/dsh-tauri-notify-webhook
After installation, DSH must be restarted to take effect. This is due to the Harness loader’s caching mechanism and the fact that hmr.root defaults to an empty array; newly installed modules are not automatically loaded into the running host process.
Usage¶
- Open Settings and navigate to the “Task Push” (任务推送) page.
- Select the push channel (Email or Pushplus) and fill in the corresponding fields.
- Click “Send Test” (发送测试) to verify the configuration.
- Click “Save” (保存) and restart DSH.
Configuration Fields¶
- Email (SMTP): Requires SMTP Host, Port, Security Settings (e.g., TLS/SSL), Sender, and Recipient. Username and Password may be optional depending on the relay server.
- Pushplus: Enter the Token obtained from pushplus.plus. The plugin sends requests directly to the official
/sendendpoint.
Features & Trigger Mechanism¶
Two Trigger Conditions¶
The plugin enables two trigger switches by default:
- Task Completed (任务完成): Triggers when the task end reason is
completed. - Task Abnormal Stop (任务异常停止): Triggers when the task end reason is
aborted,error,blocked,max-tokens,interrupted, orforked.
Push Only When Window Loses Focus¶
The plugin determines this by listening for document.visibilityState === 'hidden'. The DSH Tauri shell patches document.hidden to reflect the real window focus state, so the logic effectively checks for “window not in foreground” rather than “tab in background.”
Push Decision Logic¶
The client cannot directly read the task’s end reason, necessitating a two-step interaction:
- Listen for the
running: truetorunning: falsestate flip in the session list. - Wait for a 250ms stability window (to prevent state flickering), then request
GET /turn-end?sessionId=...to retrieve the reason recorded by the host. - If the session state is confirmed as stopped and has not stopped again, the client initiates
POST /delivery. The host re-reads the settings and sends the notification at this point.
The entire flow re-checks whether the plugin is still loaded to prevent data inconsistency caused by reloads.
Configuration Storage & Security¶
Configuration Storage¶
Settings files are stored locally at $DSH_HOME/notify-webhook/settings (default path is ~/.dsh).
Security¶
- Settings files are saved via the Shell’s atomic write helper to prevent file corruption caused by crashes during the writing process.
- Host routes are loopback and same-origin. Browser profiles cannot read these settings or force the plugin to send emails.
Applicable Scenarios & Notes¶
- Desktop Profile Only: This plugin relies on DSH’s
dsh-taurianddsh-tauri-uiruntime plugins and is not applicable to browser profiles. - No Push When Window is in Foreground: If you are watching the session stream, the plugin remains silent.
- Skip Sub-sessions: Sub-agent sessions are driven by parent tasks; the plugin does not trigger pushes for sub-sessions individually.