Introduction¶
Running DSH agent sessions typically involves the web GUI provided by dsh web. It is fine when sitting at the computer, but once you leave your desk, it is inconvenient to send messages to the session or check where the task stands. WeChat private chats are a window that is often open on a phone—if WeChat messages could directly drive the agent and the replies were sent back, it would be like having an additional portable entry point.
dsh-plugin-wechat-bridge does exactly this: it bridges WeChat (ilink bot) private chat messages into a DSH agent session, and sends replies back as a stream of plain text chunks. The following sections introduce it in the order of features, installation, configuration, and usage.
What is this¶
dsh-plugin-wechat-bridge is a DSH bundle plugin maintained by NattoCB, licensed under MIT. After installing it into the web profile, you scan a code to bind a WeChat account that has ilink bot permissions (bot_type=3). After that, sending private chat messages in WeChat can drive the agent, and answers are sent back in plain text.
Although the entry point has moved to WeChat, the context is equivalent to the GUI: the daily session injects the full text of ~/.dsh/AGENTS.md, the available skill directories, and mounts the same agent presets as the GUI.
Core Features¶
Message Bridging and Daily Sessions¶
- Supports polling the WeChat ilink bot API (
getupdates) for multiple accounts; private chat messages drive DSH agent sessions. - Replies are sent back as plain text chunks: each chunk is at most 4096 characters and at most 5 segments; anything exceeding this is truncated.
- One daily session per person: rotates at local midnight based on the local timezone; the first inbound message of the day creates the session lazily.
Runtime Hot-swap¶
There are three independent ways to start/stop it; changes take effect in real-time without needing to restart dsh web:
- The “WeChat Bridge” tab in the Settings UI
- The
/wechatslash command - The
wechat-bridge:section insettings.yaml
One-way Session Notifications¶
notifyEnabled is enabled by default: at the end of every turn in any top-level session within DSH, a brief message with a fixed template is pushed to the whitelist WeChat. Three behaviors are worth noting:
- Supports muting by workspace.
- Notifications are automatically buffered (max 20 items, 24 hours) while tokens are invalid, and automatically merged and resent after the next inbound message.
- Only pushes to whitelist contacts who have sent at least one message (the protocol requires
context_token), and does not depend on whether the daily WeChat session exists.
Crash Safety and Persistence¶
- Cross-process polling lock:
~/.dsh/wechat-bridge/poll.lock. - Messages are processed serially per chat; inbound messages are deduplicated by
message_id(processed at most once). - Corrupted session logs are isolated into
.corrupt-<ts>and self-healed/rebuilt. - Account,
context_token, and polling offset are persisted in a single atomic JSON file (~/.dsh/wechat-bridge/state.json), requiring no database.
Whitelist and Media¶
- Inbound whitelist is fail-closed: if
allowedPeersis left empty, everyone is rejected. - Outbound media: the agent calls the
wechat_send_filetool to upload images/videos/files to the WeChat CDN and send them to the current interlocutor. - Inbound media: images/files/videos/voice notes are automatically downloaded from the CDN and decrypted via AES, stored in
WeChatSpace/inbox/<date>/; when the model declares image input, images are attached as native image content. - Interactive option tools like
ask_user_questionare denied in WeChat sessions (to prevent hanging); questions and options are converted to plain text, and users reply via regular WeChat messages.
Installation and Activation¶
Prerequisites¶
- DeepSeek Harness is installed and
dsh webis runnable. - A WeChat account with ilink bot permissions (
bot_type=3).
Installation¶
Install via one command into the web profile:
dsh plugin --profile web add github:NattoCB/dsh-plugin-wechat-bridge
Manual installation is also possible: copy the plugin to ~/.dsh/profiles/web/node_modules/dsh-plugin-wechat-bridge, add file:<SRC> to the dependencies in the profile manifest, and register it in dsh.profile.bundles.
Note: Do not symlink packages outside the profile tree into ~/.dsh/profiles/node_modules (ESM limitation); copy them into the profile directory instead. Adding a dsh.profile.bundles entry for the file: dependency is the formal registration method.
Scan and Bind¶
Web method: Settings → “WeChat Bridge” tab → “Scan to bind account” → The page renders a QR code → Poll scan status every 2 seconds → Automatically saves the account and enables it after WeChat confirmation.
Command line method: First execute in any DSH session:
/wechat qrlogin
After initiating login, sessionId is returned; then poll the status using /wechat qrstatus <sessionId>; save the account and enable it when confirmed.
Verification¶
After the above steps, send a private chat message to the bot (e.g., “What’s the schedule today”), and the agent will answer just like in the GUI, with the reply sent back in plain text.
Configuration¶
Runtime switches are concentrated in the wechat-bridge: section of ~/.dsh/settings.yaml; editing and saving takes effect immediately (hot reload):
wechat-bridge:
enabled: true
mediaEnabled: true
defaultProvider: ''
defaultModel: ''
allowedPeers: ''
notifyEnabled: true
enabled: Master switch for the bridge.mediaEnabled: Whether to accept inbound media.defaultProvider,defaultModel: The provider and model used for the bridged session.allowedPeers: Inbound whitelist; fill in the bot’s internal contact ID; leave empty to reject everyone.notifyEnabled: Switch for one-way session notifications.
The field for allowedPeers is not the WeChat ID or nickname, but the internal contact ID of the WeChat bot protocol (a string of strange characters). How to get it: ask the other person to send a message to the bot; the bot will automatically reply with that ID, and the ID will also appear in the list of chips in the Settings tab.
Common Commands¶
Slash commands are available in any DSH session:
/wechat status # View status
/wechat enable # Enable
/wechat disable # Disable
/wechat accounts # List configured accounts
/wechat qrlogin # Scan to login
Troubleshooting: errcode -14¶
getupdates returning errcode -14 (session timeout) indicates the bot session has expired on the server: polling is paused for 60 minutes, Settings displays a red warning, and the recovery method is to re-scan and bind.
When context_token expires, failed notification sends will go into a buffer queue (max 20 items, 24 hours), and will be automatically merged and resent after the next inbound message.
Applicable Scenarios and Notes¶
Suitable for those who already use DSH as a daily workbench: tasks run in dsh web, and people can send messages, receive replies, and get session summaries via WeChat when away from the desk.
A few notes:
- The plugin runs with the permissions of the current
dshprocess; it is recommended to read the plugin source code and confirm the license before installing (this project is MIT). allowedPeersis a default-reject gate: empty = reject everyone, not allow everyone.- Reply chunks are at most 4096 characters × 5 segments; anything exceeding this will be truncated.
- Interactive option tools like
ask_user_questionare not available in WeChat sessions; interaction is changed to plain text Q&A. - If you previously used the old
weixin-bridge, the data directory and settings section will be automatically renamed towechat-*all at once.
Summary¶
This plugin turns WeChat private chats into the input/output channel for the DSH agent: a whitelist controls who can drive the session, daily sessions remain isolated, the polling structure is crash-safe, and the notification mechanism fills the gap in reaching session progress. Install the plugin, scan and bind, send a message—three steps to get it running.
- GitHub: https://github.com/NattoCB/dsh-plugin-wechat-bridge
- Community Directory Page: https://www.skillhub.cn/plugins/NattoCB/dsh-plugin-wechat-bridge