Repository navigation
Conversation
… Settings DSH Desktop only showed a finished turn while the user was looking at the window. The new dsh-desktop-notifications plugin observes the Harness sessions it is composed with and asks the shell for one system notification when a turn finishes, or when a turn starts waiting for an answer or a permission decision; the shell presents it only while the conversation window is in the background. Settings -> General gains three rows above the version row: - Turn completion notifications: Only when unfocused (default), Always, Never - Notify when a turn needs an answer - Notification sound Preferences live in desktop storage (renderer localStorage -> the profile's desktop-storage.json), so they survive restarts and profile switches without a Harness settings document the desktop cannot write. The renderer only reports Harness session news: src/main/turn-notification.ts owns focus observation, payload validation, the native notice, and the click that returns to the app, and speaks to the page through the existing dshDesktop preload bridge. Verified with: npm run typecheck; npx vitest run test/turn-notifications.test.ts test/turn-notification-main.test.ts test/desktop-plugin-closure.test.ts (24 tests); npx patch-package --error-on-fail.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
作用 / What this does
DSH Desktop only showed a finished turn while the window was visible. This adds one operating-system notification for the news a background window would otherwise miss, configurable from 设置 → 通用 / Settings → General:
Clicking a notice returns to the application (restores a minimized window and focuses it, or reopens the workspace when the Harness is not on screen).
How it is put together
packages/dsh-desktop-notifications(new desktop plugin, mounted bybuild/dsh-desktop.patch.yml) — the browser half observes Harness state:sessions.listfor running-to-idle transitions anduiSession.sessionStatusfor a newly publishedpendingInteraction. Only direct conversations notify; addressed children and subagent rows stay silent, and a reconnect republishing an idle row never replays history. The three rows register on the existingsettings.general.itemslot, with zh/en copy inctx.locale.register.src/main/turn-notification.ts(new module) — the shell owns focus observation, payload validation (bounded, untrusted renderer copy), the nativeNotification, and the click that activates the window. A background-only notice is suppressed while the window is focused, decided here rather than from a renderer boolean.src/preload/index.ts— two calls on the existingdshDesktopbridge:notifyTurnComplete(payload)andclearTurnNotification(). Both main-process handlers require the trusted main window and main frame (assertTrustedMainWindowEvent).localStorage, which the desktop already persists into the profile'sdesktop-storage.json, so they survive restarts and profile switches without depending on a Harness settings document the desktop cannot write.Verification
npm run typecheck— clean.npx vitest run test/turn-notifications.test.ts test/turn-notification-main.test.ts test/desktop-plugin-closure.test.ts— 24 tests pass:@deepseek-ai/dshdependency patch, andpackage.json.npx patch-package --error-on-fail— every patch applies, including the edited@deepseek-ai+dsh+0.2.0-rc.2.patch.Not verified on this machine:
test/host-plugin-sources.test.tsfails withENOTDIRin a temp directory on Windows both with and without this change (a plain Node probe of the samemkdirsucceeds), so it is environmental rather than caused by this branch.Relationship to #674
#674 routes the web
NotificationAPI through the main process (bundle icon, click activation). This change adds the capability that decides when a notice is wanted and where it is configured; its shell bridge is intentionally separate so it works with today'smain. If #674 lands, the renderer side here can either keep usingdshDesktop.notifyTurnCompleteor be re-pointed at the bridgedwindow.Notificationwithout touching the rows or the policy.Notes for review
window.dshDesktopthe rows keep working and nothing is presented.@deepseek-ai/dshdependency closure, which the plugin-closure test requires.