dsh-sound-alert: A Sound Alert Plugin for DSH Task Completion and Confirmation

When using DeepSeek Harness (DSH) in the terminal, developers can easily overlook moments when tasks finish or require confirmation. This plugin uses browser-based FM synthesis to play two distinct sound effects—a high pitch for task completion and a low pitch for requiring confirmation—without relying on any audio files.

Maintained by Charlestam218, it is a client-side plugin released under the MIT license. Its core value lies in providing non-intrusive status feedback, preventing the loss of critical information when looking away from the terminal.

Core Features

The plugin primarily offers the following capabilities:

  • Dual Sound Distinction: Plays a high-pitched E6→B6 dual tone (clear and resonant) upon task completion, and a low-pitched A3→E3 single tone (short and driving) when confirmation is needed. The two sounds are deliberately placed in different pitch ranges to be distinguished by pitch.
  • Pure Synthesis, Zero Dependencies: Sounds are rendered sample-by-sample using pure JavaScript and FM synthesis formulas on the browser side, without relying on any audio files, network requests, or host routing.
  • Windows Taskbar Badge: Displays a red dot with a number on the DSH taskbar button, indicating the sum of “Requires Confirmation” and “Completed Unread” sessions. This is implemented exclusively on the Windows platform.
  • Compatibility Fallback: Supports the Web Audio API; if the context is suspended by the browser, it automatically falls back to the <audio> + WAV Blob method.

Installation and Activation

To install the plugin, place the package into the profile’s node_modules and write the configuration.

Web Profile Installation:

dsh plugin --profile web add link:<absolute path to this package>

link: indicates a soft link installation, meaning changes to the source code will take effect automatically via HMR (Hot Module Replacement). If file: is used, it is a copy installation. If the installation does not take effect, restart the DSH client (for the Web side, restart and press Ctrl+R).

Typical Usage

Once installed, the plugin exposes the dshSoundAlert object in the browser console.

Testing and Diagnostics

  • Test in sequence:
    dshSoundAlert.test()
  • Test individually:
    dshSoundAlert.test('done')    // Only plays completion sound
    dshSoundAlert.test('confirm') // Only plays confirmation sound
  • View status:
    dshSoundAlert.state()         // { enabled, volume, audio: 'running', watched, sessions, done, confirm, lastPath, lastError }
  • View diagnostic history:
    dshSoundAlert.diag()          // Recent status changes and sound history

State Storage and Troubleshooting

You can view the status without opening DevTools; the data is saved in localStorage:

Key / File Meaning
localStorage dsh-sound-alert:boot Client-side runtime status (version, mount time)
localStorage dsh-sound-alert:diag Heartbeat snapshot: current session, recent playback records, audio status
localStorage dsh-sound-alert:plays Playback count for each sound and the type of the last one
$DSH_HOME/.dsh-sound-alert.log Host-side loading/unloading log

Toggle and Volume Control

dshSoundAlert.off()          // Mute
dshSoundAlert.on()           // Resume
dshSoundAlert.toggle()       // Toggle
dshSoundAlert.setVolume(0.7) // Set volume (0~1)

Applicable Scenarios and Notes

  • Multi-window Limitations: Multiple windows will each play sounds and determine status independently.
  • No Sound When Page is Closed: No sound will play if the page is not open, as this serves as an interface prompt rather than a system notification. If reminders are needed when the window is inactive, it must be paired with system notification tools.
  • Dependencies: The plugin relies on the DSH client service names sessions and uiSession.sessionStatus. If DSH internal services change, the plugin will silently fail.
  • Configuration Activation: Configuration changes require a restart or hot reload.

Development and Maintenance

Sound recipes are located in RECIPES at the top of lib/client.js, defined using FM synthesis parameters (frequency, modulation ratio, decay, etc.). Saving after modification triggers a hot reload.

The plugin follows the MIT License, and the source code is hosted on GitHub.

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

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

Xiaoye