Preface¶
Running agents in DSH typically involves interacting solely through the Web interface or CLI. However, if you wish for the same session to be invoked via @mentions or nicknames in a QQ group while retaining the existing context—rather than creating a new session specifically for QQ and re-priming it—a bridge between OneBot/NapCat and DSH is required. This bridge must also control “who can drive the model” and determine “which messages are recorded without triggering a call.”
This article introduces the community plugin dsh-qq-bridge (maintainer sj244): it connects an existing, fixed DSH session to QQ (via OneBot / NapCat personal account). It features a fail-closed whitelist, ensures wake-ups on @mentions, nicknames, or pokes, and allows other messages to be either probability-sampled or written to a buffer for summary injection upon wake-up. The plugin is categorized as a “Web Tool,” with the current version v0.1.3 (MIT), and the repository is sj244/dsh-qq-bridge.
What is this?¶
dsh-qq-bridge is a Web-side plugin for DeepSeek Harness (DSH). By configuring targetSessionId, inbound QQ messages are injected into the specified session. The plugin explicitly loads the target using agents.get(id); if unavailable, it uses agents.resume({ resumeSessionId }) and does not fall back to other sessions. Outbound messages are constrained by a “Source Gate.” By default, only text within [QQ]...[/QQ] markers in the turn triggered by QQ is sent to the group, preventing technical explanations and thinking processes from the DSH interface from leaking into QQ.
The project describes itself as a vibecoding product. The README states that M1–M8 have been tested end-to-end on a real NapCat + real QQ (Windows physical machine). It does not take over approvals, does not automatically download or execute content upon loading, nor is it an official QQ bot.
Core Functions¶
Fixed Session & Context¶
targetSessionIddictates which session QQ messages enter, preserving the original context.- Messages received during non-wake periods are buffered (max 200 messages). Upon a real wake-up, the most recent
recentChatLimitmessages (default 8) are concatenated into[QQ Chat History During Unwake] ... [End of Record]and prepended to the current message. The buffer is cleared after successful delivery.
Wake-up Strategy (Token Saving)¶
If the whitelist is an empty array, no source can wake the bot (fail-closed). Process overview:
QQ Message ─┬─ Not in whitelist ─────────────────→ Discard (fail-closed)
├─ Within listening window ────────────→ Wake up (reason: listening)
├─ In group + atOnlyInGroup + no @ ───→ Discard
├─ @Mentioned / Nickname hit / Poked ─→ Wake up
├─ random() < wakeProbability ────────→ Wake up (default 5%)
└─ Otherwise ──────────────────────────→ Record only (Zero model calls)
- Private chat whitelist:
whitelist; Group whitelist:groupWhitelist. - If
atOnlyInGroup: truein groups, group messages without @mentions are not processed at all (the listening window check happens before this rule). - The model can open a listening window in the same group/private chat via the tool
qq_bridge_listen({ minutes: 5 })(default 5 min, max 60). Ordinary messages within this window will trigger wake-ups, incurring actual usage costs.
Outbound & Source Gate¶
replyMode controls the outbound method:
| Value | Behavior |
|---|---|
marker (default) |
Only content inside [QQ]...[/QQ] blocks is sent |
tool |
Sent using the qq_bridge_send tool |
always |
The entire reply is sent (legacy behavior) |
This only applies to “the turn woken by QQ.” When chatting with the same session in the DSH interface, marker blocks will not be sent to QQ. If the content is too long (exceeding replyMaxChars), nothing is sent.
Images, Stickers, & NapCat¶
- Images are cached first; upon wake-up, a multimodal model can convert them to text and fill them back in. Once registered as a sticker, they can be reused by emotion or hash to reduce repeated visual calls.
- Non-text segments (emojis, voice, files, etc.) are converted to placeholders to prevent message loss. Poking oneself synthesizes
[Poke] (poked me)and forces a wake-up. - The plugin can connect to NapCat’s forward WebSocket as a client. If
onebotUrlis empty, transport is disabled entirely (default, security-oriented). - Within the session,
qq_bridge_napcatcan be called to: check status, download and verify the distribution package via sha256, writeonebot11.json, and launch NapCat. It will not automatically download or execute without user operation.
Settings Interface¶
Nicknames, whitelists, probabilities, target sessions, outbound methods, OneBot URLs, visual models, etc., can be modified in Settings → Plugins → Plugin Configuration. Changes take effect immediately upon saving. accessTokenEnv takes the environment variable name; the token is resolved by the DSH credential service and is not written into cordis.patch.yml.
Installation & Activation¶
Formal installation (source command):
dsh plugin --profile web add github:sj244/dsh-qq-bridge
After installation and any modification to the plugin code, you must restart dsh web for it to load.
When connecting to OneBot, you can override settings by ID in the profile’s cordis.patch.yml or modify them in the settings interface. For example:
- id: qq-bridge
config:
onebotUrl: 'ws://127.0.0.1:3001'
accessTokenEnv: 'NAPCAT_ACCESS_TOKEN'
On the NapCat side, the WebSocket Server must be enabled (not HTTP). Token resolution priority: Process environment variables → refs: in ~/.dsh/.credentials.yaml → .env in the working directory. Resolution occurs upon connection, allowing for token rotation without restart.
Typical Usage¶
- Install the plugin and restart
dsh web. In the plugin configuration, fill intargetSessionId, whitelists, nicknames, andwakeProbability(default0.05). - Configure
onebotUrlandaccessTokenEnvto ensure NapCat forward WS is reachable.selfIdcan be left blank; upon connection, the plugin will callget_login_infoto obtain the QQ ID and filter out self-messages to prevent infinite loops. - If NapCat is not deployed, call
qq_bridge_napcatin the target session in the order specified in the README:status→download(setdownloadProxyif a proxy is needed) → Manually run the installer once →configure→launch(First-time QQ login requires scanning a QR code). - Test wake-ups by @mentioning the bot or using the nickname in a group. By default, use
[QQ]Reply content[/QQ]to wrap sentences intended for the group. - For consecutive conversations, the model should call
qq_bridge_listenat appropriate times. Note that every message within the window triggers a wake-up.
For development, you can use a local path for link installation: dsh plugin --profile web add "<REPO>". The README details considerations regarding @deepseek-ai dependencies and junctions on Windows.
Use Cases & Cautions¶
Suitable for: Users with an existing fixed DSH session (e.g., a long-term “Da Fei Yu” persona or project agent) who want to interact as a group member in a small QQ group or private chat, with strict controls on who can drive the model and the ratio of random interjections.
Not recommended for: Long-term unattended operation in large public groups. The README explicitly states that NapCat is a third-party client involving account risk control; users decide whether to enable it at their own discretion.
Security & Permissions: The plugin runs with the current dsh process permissions. Before installation, please read the Source Code & LICENSE to understand the boundaries, including whitelists, outbound gates, and the lack of approval bridging. When uninstalling the plugin or exiting DSH, the NapCat process managed by the subprocess will be terminated as well.
The DSH ecosystem emphasizes “Everything is a plugin.” The SkillHub Directory Page is a community site and has no official affiliation with DeepSeek or High-Flyer.
Conclusion¶
dsh-qq-bridge solves the problem of “One Session, Two Entries”: controllable wake-ups and recording-only on the QQ side, while retaining full context and a default non-leaking outbound strategy on the DSH side. For further design details and changes, please refer to DESIGN.md, HANDOVER.md, and CHANGELOG.md in the repository.
- Directory Page: https://www.skillhub.cn/plugins/sj244/dsh-qq-bridge
- GitHub: https://github.com/sj244/dsh-qq-bridge