dsh-focus-notify: Unified DSH Notifications by Window Focus

Preface

When running multi-session, multi-agent workflows in DeepSeek Harness (DSH), approvals, questions, plan confirmations, and reply completions are often scattered across different events. If a notification policy relies solely on “page visibility” to judge activity, document.hidden might remain false even when the window is obscured by other applications on macOS. This easily leads to misjudgments—assuming “the user is currently watching DSH”—and results in missed alerts requiring user action.

Below is an introduction to the community plugin dsh-focus-notify (maintainer sqzw-x): it unifies the aforementioned event types into a single desktop notification and determines when to pop up based on window keyboard focus and the current session. Classified as a client-side plugin; the repository has approximately 1 star on GitHub. Facts in this article are based on the repository README.

What is this

dsh-focus-notify is a Cordis notification plugin running inside the DSH Web / DSH Desktop interface. It does not replace DSH’s native interaction UI; instead, it listens for “waiting for action” and “reply completed” states on top of the session state exposed by the host, triggering system notifications when rules permit. When you return to the corresponding session or window regains focus, notifications for that session are dismissed.

The license is MIT; the package version in current materials is 0.3.1. The README states: Only tested on DSH Desktop; it is unknown whether it works correctly on the Web version.

Three Notification Rules

The plugin README condenses its behavior into three rules, which serve as the standard for post-installation behavior:

  1. Current Session Rule: For the session held by the current main view on screen, notifications only pop up when the window loses keyboard focus; notifications for other sessions pop up even when DSH is in the foreground.
  2. Event Type Rule: Turn endings (reply completed) and waiting for your action (approval / plan confirmation / question) both trigger alerts. Identical “waiting for action” requests are deduplicated by key to alert only once.
  3. Return to Session Rule: Notifications disappear automatically when a session is focused—whether by clicking the notification, the window regaining focus, or manually switching to the session, the cleanup logic is consistent.

Subagent sessions do not participate by default: ignoreSubagent defaults to true, meaning subagents are neither “current sessions” nor do they trigger notifications.

Why use document.hasFocus() instead of “page visibility”

On macOS, when the window is covered by Edge, QQ, etc., the page often remains “visible”. This plugin uses document.hasFocus(): if the window does not have keyboard focus, it is considered that you are not watching DSH. Therefore, the current session stays quiet only when you are truly looking at it; switching sessions while focus is lost will not inadvertently clear notifications, preventing accidental dismissal while you are still using other applications.

Core Capabilities and Data Sources

The plugin does not guess session states; it subscribes to stores already published by the host:

  • uiSession.sessionStatus: Map<sessionId, { running, pendingInteraction, completionUnread }>
  • sessions.list: Session titles, origin: 'subagent', retainedBy.mainView, etc.

From this, two types of events are derived:

  • Waiting for action: pendingInteraction appears in a session.
  • Reply completed: A session’s running state changes from true to false, and there is no immediate follow-up wait (stopping to wait for your input counts as “waiting for action,” not “completed”).

Rule logic is centralized in allows() in src/engine.ts, which is pure logic and unit-testable. Clicking a notification attempts to summon the window (desktop dsh://open deep link, browser window.focus()) and calls the host’s uiWorkspace.openSession (or sessions.open in older hosts); failures are recorded in counters.failed and a [dsh-focus-notify] warning is printed to the console.

Each time a notification is sent, a dsh-focus-notify:alert event is dispatched on window (event.detail contains kind / sessionId / title / body / tag), facilitating custom taskbar flashing, sound changes, or logging.

Installation and Activation

In the DSH ecosystem, plugins can be installed via the community catalog or GitHub; after installation, the client bundle is read upon page load, so a restart of DSH Desktop is required.

Plugin Manager

Install this package catalog in “Settings → Plugins”, then restart DSH Desktop after enabling.

Command Line

Install from GitHub:

dsh plugin --profile desktop add github:sqzw-x/dsh-focus-notify

Once the npm package is published, you can switch to:

dsh plugin --profile desktop add dsh-focus-notify

If you wish to disable it without uninstalling, you can write the following in the profile’s cordis.patch.yml:

- id: dsh-focus-notify
  disabled: true

The DSH engine range declared in package.json is >=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.3.0-0; actual compatibility should be based on @deepseek-ai/dsh* in peerDependencies.

Configuration and Debugging

The default configuration is sufficient for use. If needed, call the following in the page console:

__dshFocusNotify.configure({ sound: true })   // Enable notification sound
__dshFocusNotify.configure({ enabled: false }) // Temporarily turn off all
__dshFocusNotify.debug()                       // Current session, undelivered waits, counters, permissions, focus, navigation path
__dshFocusNotify.test()                        // Send one immediately bypassing rules, verify channel
__dshFocusNotify.open('session-id')            // Switch session by id, verify click path

In debug(), navigation indicates which service is used to switch sessions when clicking a notification (uiWorkspace.openSession / sessions.open / none); counters.failed is the number of navigation failures.

Field Default Description
enabled true Master switch; when off, still tracks state but sends no notifications
ignoreSubagent true Subagent sessions do not alert
language 'auto' Text language, can be fixed to 'zh' / 'en'
sound false Play a sound alongside the notification (WebAudio, requires prior page interaction)

Configuration is persisted in dshFocusNotify.config in localStorage.

Use Cases and Notes

Who it is for: Developers who frequently open multiple sessions in DSH Desktop, need to approve or confirm plans, and want to avoid missed notifications due to “page visibility” misjudgments. It is also suitable for those who want completions and todos from background sessions to be unified in the system notification bar.

Please be aware before use:

  • The plugin runs within the current DSH process/page; please review the source code and MIT license before installation.
  • Web version is unverified; notification styling is determined by the system (adjustable in macOS Settings → Notifications → DeepSeek Harness).
  • If permission is denied, no notifications are sent, and debug().permission will be denied.
  • If the host lacks retainedBy.mainView, all sessions are treated as “non-current” and will trigger alerts.
  • Completion is determined using running edges, not the SDK’s completionUnread; replies that finish in a very short window (e.g., spanning a page reload) before the client sees running as true might not alert.
  • dsh-app:// pages cannot register a Service Worker, so notifications have no extra buttons (this plugin does not rely on buttons).

The community plugin catalog SkillHub Entry and the GitHub repository are independent of each other and are neither official DeepSeek / High-Flyer app stores.

Conclusion

dsh-focus-notify consolidates approvals, questions, plan confirmations, and reply completions into a single alert type, distinguishing “current session quiet, others alertable at any time” via window focus, with subagents muted by default. If you primarily collaborate in DSH Desktop with multiple sessions, you can install it via the commands above, use test() and debug() to verify the channel and navigation, and then enable sound or listen for dsh-focus-notify:alert as needed.

  • Catalog Page: https://www.skillhub.cn/plugins/sqzw-x/dsh-focus-notify
  • GitHub: https://github.com/sqzw-x/dsh-focus-notify
羽毛球分组比赛记分
小程序二维码

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

Xiaoye