Preface¶
When connecting QQ to DeepSeek Harness (DSH), the common practice is to install dsh-onebot-qq as the channel. The channel plugin handles the OneBot protocol and message sending/receiving, but the details of “chatting like a real person”—how to express silence, whether to send narration, whether three consecutive messages count as one turn, whether long replies should be split, how to tell the model the message interval, and whether calling a name in a group chat counts as an @—often require additional conventions.
Some people write this logic into the upstream package inside node_modules; once dsh-onebot-qq is upgraded (e.g., pnpm changes directories), these modifications are wiped out by the whole package. The dsh-onebot-companion by maintainer xfgil takes a different path: without modifying node_modules, it wraps the upstream prototype at runtime (Runtime prototype patching), integrating outbound guards, per-turn behavior rules, conversation rhythm, persona, voice, and other capabilities into a single workflow plugin. It replaces the earlier standalone packages like dsh-onebot-guard, dsh-onebot-prompt, and dsh-onebot-rhythm; old plugins must be uninstalled before installing this one. Do not enable it alongside the old packages, otherwise the same prototype chain will be wrapped twice, leading to duplicate segmentation and double counting.
The following introduces the plugin’s positioning, module capabilities, installation configuration, and usage notes. The DSH community plugin directory is at SkillHub, which has no official affiliation with DeepSeek / Hithink RoyalFlush; the facts in this article are based on the GitHub Repository README (current package version 0.4.1, MIT License, GitHub stars 0).
What is this¶
dsh-onebot-companion is a QQ channel companion plugin for DSH: it restores capabilities to the enabled dsh-onebot-qq that were lost during 0.9.x upgrades or not covered by the upstream. To summarize the README’s positioning in one sentence: Outbound silence guard + per-turn behavior rules + conversation rhythm + persona + voice + session generation protection + timestamps, accompanied by modules for group mentions, card restoration, emojis, sleep gates, social actions, diary/promises, and relationship stages.
Internally, it is split into seventeen modules by responsibility, each switchable; eleven modules hook into the prototype methods of dsh-onebot-qq, while the rest are integrated via host hooks or tool registration.
Core Features¶
Outbound & Rhythm¶
- guard: Intercepts
[[silent]], strips full-line parenthetical narration, discards queued prompts and admin-only receipts, as well as self-reporting/narration-style turn progress; if the cleaned content is empty, it does not send. - rhythm: Inbound merging (composing rapid multi-line inputs into one turn within a quiet window) and outbound segmentation (sending long replies in multiple segments based on a character budget, with typing delays).
- stamp: Injects
time=(sending time) andgap=(the calculated interval since the last message, e.g.,3m47s) into the opening tag of<user_message>, reducing errors caused by the model calculating time differences itself.
Conversation & Persona¶
- adopt: When a bare session id still has historical logs on disk, prioritizes resume adoption to avoid the upstream
retireSessioncausing “a new session for every message, losing all context.” - prompt: Injects 14 behavior rules into the agent every turn, optionally accompanied by emotion lines and style lines (injected only in the first step by default to avoid bloating context).
- persona: Four emotion variables, random proactive speech, style learning; state is stored in the profile’s
mediaDir, separated from the plugin’s general state file so the persona is not lost when switching plugins. - tier: Projects
affinityinto relationship stage steps and integrates it into the prompt.
Group Chat & Inbound Enhancements¶
- mention: If configured names (default includes “云玥”, “玥玥”, “Yara”) appear in the group chat body, it is considered being addressed; optional dive-to-continue and interest-topic interjections (
topicsdefault off). - linkcard: Restores
[卡片](Card) to[卡片:标题 https://…](Card: Title URL) with title and link. - emoji: Corrects upstream emoji representations and supplements mall emoji paths; unrecognized native emojis may result in no reply at all (playing dead).
- sleep: After sleepiness words are spoken, the bot only responds in group chats if @ or name-called, private chats remain as usual.
- isolation: Hard isolation of tools for non-admin turns in group chats via
ctx.tools.guard(), retaining only vocalization and whitelisted tools (e.g.,qq_say,read_image, etc., subject to configuration).
Tools & Extensions¶
- voice: Registers
qq_say, synthesizing text via edge-tts (cloud) or local IndexTTS and sending it as QQ voice messages. - hands:
qq_poke,qq_react,qq_like,qq_requests, etc.;qq_approvedoes not pass directly but generates an approval form for admins to privately message/同意 编号(/approve ID). - diary / promise:
qq_diary,qq_promisetools and notebooks, reminders for promises when due. - lastword: Records the time and snippet of “the last time she really spoke,” observable via HTTP
/physicaletc.
Shared mount points (such as stamp + rhythm on dispatchFollowup) determine the chain order via module markers and priorities in core/patch.js, independent of mount timing.
Environment Requirements¶
- DSH Host 0.2.0-rc.2 and above, below 0.3.0 (README notes development and verification versions include 0.2.1-rc.2 / Electron 44).
- dsh-onebot-qq installed and enabled (mounted according to default 0.9.x internal structure).
- Node.js ≥ 22.
- The plugin itself does not rely on additional third-party npm packages; using the default
voice.backend: edgerequirespip install edge-ttsyourself;backend: localrequires IndexTTS service and sufficient VRAM (README states 8G+ NVIDIA).
Installation & Enablement¶
This plugin is not published to npm; there is no npm i or dsh plugin add channel; it needs to be hooked into the profile using link:, and the bundle self-registers via the bundled cordis.patch.yml.
1. Obtain Source Code¶
Choose one of the methods listed in the README: Release source package, GitHub webpage Download ZIP, or:
git clone https://github.com/xfgil/dsh-onebot-companion.git D:\path\to\plugins\dsh-onebot-companion
The directory after extraction or clone is referred to as <plugin directory>.
2. Register in Profile’s package.json¶
Edit <DSH_HOME>\profiles\<profile>\package.json, adding dependencies and bundles:
{
"dependencies": {
"dsh-onebot-companion": "link:D:/path/to/plugins/dsh-onebot-companion"
},
"dsh": {
"profile": {
"bundles": [
"dsh-onebot-companion"
]
}
}
}
Do not manually write duplicate inserts in the profile’s cordis.patch.yml, otherwise two instances will start.
3. Create Links and Load¶
Order matters: Run pnpm install first to create node_modules links, then modify the profile manifest. If the manifest is modified before links are created, the host hot-reload might short-circuit and skip retries, manifesting as enabled: true in the admin page but no entryId and functions not working; the remedy is to toggle the plugin off and on again in the plugin management page.
cd <DSH_HOME>\profiles\<profile>
pnpm install
Generally, no host restart is needed after changes; if dsh-hot-reloader by the same author is installed, it follows automatically.
4. Confirm Running¶
curl.exe http://127.0.0.1:<port>/onebot-companion
Or check if $DSH_HOME/onebot-companion/state.json is written to disk.
Configuration Points¶
Configuration is written in the profile’s bundle configuration section (passed through by the host to apply(ctx, config)). The plugin does not export a Config schema to avoid loader projection errors on the profile side. Minimal example:
dsh-onebot-companion:
enabled: true
packageName: dsh-onebot-qq
profileDir: ''
pollMs: 3000
stateFile: ''
guard:
enabled: true
adopt:
enabled: true
rhythm:
enabled: true
persona:
enabled: true
voice:
enabled: true
backend: edge
program: python
packageName / profileDir are automatically distributed to each module section, no need to repeat in every module. See the “Configuration” section in the README for full fields (including mention.names, rhythm.inbound/burst, isolation.allowedTools, sleep, diary, promise, etc.).
If dsh-onebot-guard / dsh-onebot-prompt / dsh-onebot-rhythm were previously installed, please uninstall them first and retain only dsh-onebot-companion.
Typical Usage¶
Silence & Outbound Cleaning¶
When the model outputs [[silent]] or full-line parenthetical narration, guard intercepts or strips it at the sendToChat / sendMsg layer, so the user does not see invalid bubbles. You can observe recent hits via HTTP:
curl.exe "http://127.0.0.1:<port>/onebot-companion/hits?limit=20"
Voice Messages¶
Call qq_say in the agent’s available tools (requires voice module enabled and edge-tts or IndexTTS ready). Test synthesis without sending:
curl.exe -X POST http://127.0.0.1:<port>/onebot-companion/say -H "Content-Type: application/json" -d "{\"text\":\"Hello\"}"
Segmentation Preview¶
Debug rhythm outbound segmentation:
curl.exe -X POST http://127.0.0.1:<port>/onebot-companion/burst -H "Content-Type: application/json" -d "{\"text\":\"A relatively long test text\",\"maxChars\":20}"
Module Hot Switch¶
Loopback only (returns 403 if not 127.0.0.1):
curl.exe -X POST http://127.0.0.1:<port>/onebot-companion/module -H "Content-Type: application/json" -d "{\"module\":\"guard\",\"enabled\":true}"
General status and module mounting status: GET /onebot-companion; emotion, style, diary, promise, lastword, etc. have corresponding GET endpoints, see README “HTTP Observation Surface” for details.
Applicable Scenarios & Notes¶
Who it is for: Developers using dsh-onebot-qq on DSH for QQ bots or group assistants who need “workflow layer” capabilities like silence protocols, segmentation rhythm, time intervals, group name @, persona, and voice, and want to keep patches when upgrading the channel plugin.
Must Know:
- The plugin runs with current DSH process permissions, patches the runtime loaded
dsh-onebot-qqprototype, and reads/writes state files under$DSH_HOMEand the profilemediaDir; please read the source code and MIT license before installation to ensure the admin QQ, paths, and tool whitelists in the configuration fit your security boundaries. - DSH /
dsh-onebot-qqversions must fall within the range declared in the README; major upstream version changes may cause patching to fail (the plugin scans viapollMsto self-heal, but gives up mounting rather than guessing if upstream exported functions are unavailable). - voice edge mode depends on external Python and network; isolation
read_imagestrictly depends on themediaDirwhitelist by default. - The group message prefix
[HH:MM Nickname(QQ)]still uses processing time, which may differ by a few seconds from thetime=attribute instamp; the README marks this as a known boundary.
Conclusion¶
dsh-onebot-companion consolidates the guards, rhythm, persona, voice, and session fixes needed for QQ channel chatting into a single bundle: one configuration, one HTTP observation surface, seventeen switchable modules, using prototype external hooks instead of modifying node_modules, facing the dsh-onebot-qq 0.9.x ecosystem. See SkillHub Plugin Page for directory and classification (Workflow); see GitHub: xfgil/dsh-onebot-companion for source code, installation details, and self-test interfaces.