Preface¶
In DSH web chat, users often complete their thoughts one sentence after another. Without any handling, each message triggers the agent’s followup(), and the model may be continuously woken up, responding for several rounds in a row—wasting tokens and disrupting the context rhythm. Common approaches include letting users wait a few seconds before sending the next message, or doing debouncing on the frontend—the former relies on user habit, while the latter often fails to affect the server-side wake-up logic.
The following introduces the community plugin dsh-send-debounce (maintainer: praystring, category: workflow): it buffers “short messages sent consecutively by users” on the server side, and after a default 5-second pause, merges them into a single round sent to the model, waking it up only once. Long messages and messages with images/attachments are still sent immediately; plugin-sourced messages and steer() interjections are unaffected.
What Is This¶
dsh-send-debounce is an npm public package plugin for DeepSeek Harness (DSH), currently version 1.0.0 (MIT). It does only one thing: intercept each agent’s followup() (@deepseek-ai/dsh-agent-loop), queue up short messages sent by web users themselves, delay and merge them, and then call the native followup() when the time comes.
- Catalog page: https://www.skillhub.cn/plugins/praystring/dsh-send-debounce
- Source code and documentation: https://github.com/praystring/dsh-send-debounce
The DSH ecosystem emphasizes “everything is a plugin”; community directories such as SkillHub are independent of DeepSeek / 幻方 and are not official app stores. Before installation, it is recommended to review index.mjs and the license yourself. The plugin runs under the permissions of the current dsh process; this plugin declares that it does not connect to the network, does not read the workspace, does not write files, does not read environment keys, and only reads three DSH_SEND_DEBOUNCE* configuration items.
Core Features¶
Buffering and Merging¶
- User messages immediately enter the queue area (visible on the page), but do not wake up the model first.
- Default silence 5000 milliseconds; each new short message arriving during the silence period resets the timer.
- After the timer ends, this batch of messages is merged into one (a blank line is inserted between two messages, preserving the original text and order without rewriting content), and then wakes up once.
Cases for Immediate Release¶
- When the message length reaches the “short message” upper limit (default ≥120 characters), it is sent immediately without delay.
- Messages with images or attachments are sent immediately.
steer()(interjection) is not affected by this plugin.agent.followupfrom other plugins (such asdsh-proactive,dsh-tick) passes through as-is.
Safety and Degradation¶
- Only processes user messages with
message.source.kind === "user". - When reading the queue, merging, or sending fails, after
try/catch, messages are resent one by one or passed through, to avoid the chat box getting stuck. - Any exception falls back to the native
followup()behavior.
Known Limitations (Must Know Before Use)¶
- The silence depends on an in-process timer: if dsh restarts before the merge is triggered, the messages remain in the conversation, but will not be automatically woken up; you need to wait for a new message or trigger it manually; it is recommended to wait a few seconds before restarting so the buffer can land.
- Environment variable changes require restarting dsh; hot updates are not supported.
- Length is judged only by character count, not by semantics; extremely short but urgent content will also be buffered by the default silence duration.
- After merging, the model sees the merged text; the original queued records remain in the inbox events for troubleshooting.
- Only effective on the server side (mobile browsers also benefit); does not change the frontend interface.
Installation and Activation¶
Install from npm (public package):
dsh plugin --profile web add dsh-send-debounce
Local directory development/self-use:
dsh plugin --profile web add file:/path/to/dsh-send-debounce
After installation, you need to write dsh-send-debounce into the dsh.profile.bundles of that profile (cordis.patch.yml is this layer), then restart and confirm the service is running normally:
dsh --profile web --dump-config | grep -n dsh-send-debounce
sudo systemctl restart dsh
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:3080/
package.json requires Node >=22.5, and the DSH peer range is >=0.1.5-rc.2 <0.2.0-0 (as well as several alpha ranges listed in the documentation).
Configuration¶
Configured via environment variables; dsh must be restarted after changes to take effect:
| Variable | Default | Meaning |
|---|---|---|
DSH_SEND_DEBOUNCE |
On | off / 0 / false / no can disable it with one click |
DSH_SEND_DEBOUNCE_MS |
5000 |
Silence duration (milliseconds); 0 equals disabling the delay; invalid values fall back to the default |
DSH_SEND_DEBOUNCE_MAX_CHARS |
120 |
“Short message” character upper limit; 0 means always delay; invalid values fall back to the default |
Typical Usage¶
Without a complete dsh environment, you can run self-tests in the repository root directory (covering consecutive message merging, long message direct sending, plugin-sourced pass-through, image direct sending, each timeout becoming a separate round, switches and invalid configurations, etc.):
npm test
Equivalent to:
node test.mjs
Online behavior can be understood as follows: a user sends multiple short sentences of fewer than 120 characters consecutively in the chat box, without triggering multiple model replies in between; after about 5 seconds of inactivity, the content is merged into one and then enters a round of conversation. If a message exceeds 120 characters or contains an attachment, that message will immediately enter the normal followup process.
Rollback and Uninstallation¶
Backup and restore package.json per profile:
cp ~/.dsh/profiles/web/package.json.bak-<日期> ~/.dsh/profiles/web/package.json
sudo systemctl restart dsh
Or remove dsh-send-debounce from dsh.profile.bundles and restart, which will restore the native followup() (uninstallation will clear the timers).
Conclusion¶
dsh-send-debounce is suitable for scenarios where users are accustomed to entering content in segments in the DSH web page and also want to reduce the multiple wake-ups caused by consecutive messages. It places debouncing at the server-side followup() entry, is unrelated to the frontend, and explicitly does not interfere with plugin messages and interjections from proactive, tick, etc. For more details, see the GitHub README: https://github.com/praystring/dsh-send-debounce; catalog entry: https://www.skillhub.cn/plugins/praystring/dsh-send-debounce.