Preface

The plugin system of DeepSeek Harness (dsh) allows agent capabilities to be connected to more entry points. For people who need to use dsh agents in IM clients, a common issue is that DingTalk, QQ, and personal WeChat differ in message protocols, session states, approval requests, question requests, and long-text limits. Adapting to each channel individually would be a distraction.

@lijian-ui/dsh-im-gateway provides a gateway plugin for such scenarios: it connects DingTalk, QQ, and personal WeChat to the same ctx.imGateway, allowing agents to gain capabilities such as streaming replies, tool approval, interactive questioning, long-text chunking, and multi-segment merging in chat windows.

Below, we introduce this plugin’s positioning, core capabilities, installation method, and typical usage.

What This Is

@lijian-ui/dsh-im-gateway is a gateway plugin that provides multi-IM channel access for dsh, supporting DingTalk / QQ / personal WeChat.

Its main capabilities include QR code binding, streaming replies, tool approval, interactive questioning, long-text chunking, multi-segment merging, and a bilingual interface. The maintainer is lijian-ui, the license is MIT, and the GitHub repository is at https://github.com/lijian-ui/dsh-im-gateway.

Core Capabilities

Multi-Channel and Unified Gateway

The plugin supports the following channels:

  • DingTalk
  • QQ
  • Personal WeChat

Multiple channels are aggregated into a unified gateway service ctx.imGateway, providing session management, slash commands, streaming replies, and status broadcasting.

It also supports multiple bot instances: the same channel type can be configured with multiple instances, each using its own independent credentials.

The plugin renders an “IM Channels” settings page in the dsh web UI, where channel binding and configuration can be completed.

Streaming Replies and Long-Text Handling

Streaming replies support:

  • DingTalk AI cards
  • QQ stream_messages

If the channel does not support streaming replies, the plugin falls back to plain text.

When a reply exceeds the channel’s single-message limit, long replies are automatically split with segment prefixes.

Tool Approval and Interactive Questioning

When an agent calls a tool requiring approval, the plugin provides a tool approval bridge. Users can reply directly in the IM with approval or rejection. On timeout, the request is delegated back to the dsh native approval system. The default approval timeout is approvalTimeoutSecs: 120 seconds.

When an agent calls ask_user_question, the plugin provides an interactive questioning bridge. The question is pushed to the IM in real time, and users can answer by replying with the option number or text. On timeout, it falls back to the Web side. The default question timeout is questionTimeoutSecs: 600 seconds.

Multi-Segment Input Merging

When users send multiple consecutive messages, the plugin automatically merges the input.

The control suffixes are as follows:

  • No suffix: enters the merge window
  • ..: continues merging
  • !!: submits immediately

File Sending

The plugin provides the im_send_file tool for sending workspace files to the current IM session.

Language and Permissions

The plugin supports a bilingual interface. Set im-gateway.language to zh or en to switch the language of user-visible replies.

Permission control uses a user whitelist:

  • allowAllUsers
  • allowedUserIds

allowAllUsers globally allows all users and is suitable only for development environments. It is not recommended for production.

Installation and Enablement

First, install the plugin:

dsh plugin --profile web add @lijian-ui/dsh-im-gateway

The npm package includes a pre-built lib/ directory, so no build authorization is needed.

If installing from Git, the source code is pulled, and the package’s prepare build script needs to be approved on first install. In pnpm >= 10, follow the prompt to add the package key to the allowBuilds list in the profile’s pnpm-workspace.yaml. Preferring the npm or tarball installation method can skip this step.

After installation, you can view the configuration with the following command:

dsh --profile web --dump-config

Then start the dsh web UI, open “Settings → IM Channels” to complete channel configuration.

Note that the plugin has version range requirements for dsh-related dependencies. It depends on packages such as @deepseek-ai/cordis, schemastery, and requires specific ranges of @deepseek-ai/dsh-agent, dsh-llm, and dsh-session. Before installation, confirm whether the current dsh environment matches these requirements.

On Windows, if you modify src/, you must rebuild before restarting the dsh process:

npm run build

Typical Usage

Adding Channels

Below are the basic steps for adding channels in the dsh web UI.

  1. Open dsh web UI → Settings → IM Channels.

  2. Click Add Channel and select QQ, personal WeChat, or DingTalk.

  3. Complete binding according to the channel.

QQ:

  • Click QR code login
  • Scan with the QQ mobile app
  • Credentials are filled in automatically, then save

Personal WeChat:

  • Click QR code login
  • Scan with the WeChat mobile app
  • Enter the pairing code if prompted
  • Credentials are filled in automatically, then save

DingTalk:

  • Manually fill in AppKey / AppSecret
  • Or directly edit the configuration file
  • Save the configuration

Configuration is stored in the im-gateway.channels section of ~/.dsh/settings.yaml. Saving the configuration in the UI hot-reloads the channels without requiring a restart.

Sending Messages and Slash Commands

After sending a message to the bot in the IM client, replies are returned in real time with streaming.

The plugin includes the following built-in slash commands:

/help
/model
/status
/new
/reset
/stop
/sessions
/continue
/workspaces
/workspace

Common usage includes:

/model
/status
/new
/sessions
/continue <session id>
/workspaces
/workspace <path>

Approval Replies

When an agent requests approval, you can reply directly in the IM.

Approval-type replies:

批准
同意
yes
y
allow

Rejection-type replies:

拒绝
no
n
reject
deny

Multi-Segment Input

Use the suffixes below when entering consecutive input:

..
!!

.. continues merging, and !! submits immediately.

Switching the Interface Language

Set im-gateway.language to zh or en:

im-gateway:
  language: zh

Applicable Scenarios and Notes

This plugin is suitable for the following scenarios:

  • Connecting dsh agents to DingTalk, QQ, or personal WeChat
  • Handling tool approvals and interactive questioning directly in the IM
  • Needing multiple bot instances with independent credentials
  • Needing automatic chunking of long replies and merging of multi-segment input
  • Needing to send workspace files in the chat window

Usage notes:

  • Personal WeChat supports one-on-one chat only.
  • allowAllUsers is suitable only for development environments; production is recommended to use allowedUserIds as a whitelist.
  • The plugin runs with the current dsh process permissions; inspect the source code and the MIT license before installation.
  • When installing from Git, pay attention to the allowBuilds build authorization.
  • If you modify the source code locally, rebuild before restarting the dsh process.

Conclusion

The value of @lijian-ui/dsh-im-gateway lies in unifying DingTalk, QQ, and personal WeChat into ctx.imGateway, reducing the cost of separately maintaining message, approval, question, and session logic for each IM.

The current documentation does not provide an available table of contents URL, so no specific table of contents link is listed here. You can directly use the GitHub repository address:

https://github.com/lijian-ui/dsh-im-gateway