dsh-whale-inurqq: A QQ Client Integrated with DeepSeek Harness

DeepSeek Harness is a framework based on a plugin architecture, with the philosophy that “everything is a plugin.” To connect QQ to this framework, protocol-level communication must be implemented. dsh-whale-inurqq is a OneBot 11 protocol client plugin. It does not handle QQ login, signing, or encryption itself; these tasks are handled by the protocol endpoint (such as NapCat). Therefore, it remains neutral and can be distributed like any other IM channel plugin.

Below is an introduction to how to install, configure, and understand its operating mechanism.

Core Features

This plugin mainly solves the issues of message routing and session management between QQ and DSH:

  1. Message Normalization and Classification: After receiving QQ messages, it performs normalization processing and determines whether the content is “chitchat” or a “task.” This step only determines the phrasing, not the subsequent routing.
  2. Resident Docking Session: Each QQ conversation (group or private chat) corresponds to a workspace in DSH. Under this workspace, there is a resident docking session where chatting and task execution both take place, rather than creating a new session for every message.
  3. Context Handoff Mechanism: When the context of the resident session reaches a threshold (default handoffAtRatio: 0.25), a handoff is triggered. The old session is archived, a new session takes over, and fragmented memories are retained.
  4. Turn Initiator Determination: The plugin determines whether the current turn was “initiated by the plugin” or “initiated by the user in the GUI” via source.rpcId. Only the former will relay messages back to QQ; the latter remains completely silent.
  5. Non-Active Push: The plugin does not actively push “currently executing” status. The plugin will only query status via qq_alive and qq_tasks to answer when the user actively inquires.

Prerequisites

Before starting, the following environment needs to be prepared:

Component Requirement
Node.js ≥ 20 (Development verified version is 24.19.0)
Protocol Endpoint A OneBot 11 protocol endpoint, recommend NapCatQQ
QQ Account Recommend using a spare account (see risk warning below)

Installation and Migration

Use the official command to install the plugin:

dsh plugin --profile <your_profile> add dsh-whale-inurqq

Restart the DSH process after installation.

Must-read for Existing Users: Renamed from dsh-qq

This plugin was originally named dsh-qq and has now been renamed to dsh-whale-inurqq. This rename is a ruthless string replacement, and the runtime data directory changes accordingly:

Item Old (Original Name) New (Current)
Package Name / Plugin ID dsh-qq dsh-whale-inurqq
Runtime Data Directory $DSH_HOME/dsh-qq/ $DSH_HOME/dsh-whale-inurqq/
Status Endpoint /dsh-qq/status /dsh-whale-inurqq/status

If you have previously installed dsh-qq, it is recommended to perform the following migration steps to retain data:

  1. Uninstall the old plugin (it is still registered under the old package name):
    dsh plugin --profile <your_profile> remove dsh-qq
  1. Install the new plugin:
    dsh plugin --profile <your_profile> add dsh-whale-inurqq
  1. Move runtime data (assuming DSH defaults to ~/.dsh):
    # Linux / macOS
    mv ~/.dsh/dsh-qq ~/.dsh/dsh-whale-inurqq
    # Windows PowerShell
    Rename-Item "$env:USERPROFILE\.dsh\dsh-qq" "$env:USERPROFILE\.dsh\dsh-whale-inurqq"
*Note: If the directory is not moved, the new plugin will treat it as a fresh installation and cannot read old sessions or corpora.*

Configuring the Protocol Endpoint (NapCat)

The plugin listens on 127.0.0.1:6700 by default. You need to configure a reverse WebSocket client in NapCat’s config/onebot11.json:

{
  "network": {
    "websocketClients": [
      {
        "name": "dsh-whale-inurqq-reverse",
        "enable": true,
        "url": "ws://127.0.0.1:6700",
        "messagePostFormat": "array",
        "reportSelfMessage": false,
        "reconnectInterval": 5000,
        "token": "<your access token>",
        "heartInterval": 30000
      }
    ]
  }
}

Key configuration points:
* url: Points to the address the plugin is listening on.
* messagePostFormat: Must be set to array.
* token: Must match the QQ_ONEBOT_TOKEN or connection.token in the plugin configuration.

Configuration Items Description

After the plugin is installed, configuration items will be generated on the DSH settings page. The following are the logic and risk points of key configurations.

Resident Docking Session (Enabled by Default)

conversation.enabled defaults to true. When enabled, the QQ conversation and the DSH workspace share a resident session.

  • Rollback Switch: If conversation.enabled is set to false, the plugin will roll back to v2 behavior: creating a new session for every task, subject to tasks.maxConcurrent rate limiting, and not mounting resident memory.
  • Handoff Threshold: handoffAtRatio (default 0.25) controls the proportion of the context window usage that triggers a handoff. This value must be lower than the host compression thresholdRatio, otherwise compression will summarize the history first.

Permissions and Risks (Scope)

New sessions triggered by QQ will inherit the default permission preset of the DSH profile.

  • Risk Warning: If the default preset is danger-full-access and approval: never, anyone who can send messages to your bot (within the allowed scope) will gain unrestricted file and shell execution capabilities.
  • Public Deployment: It is recommended to tighten scope or use a stricter default preset.

Task Configuration

  • tasks.workspaceRoot: Required field, specifying the parent directory of the QQ project directory.
  • ingest.forwardRecords: When enabled, merged forwards will automatically be expanded into the corpus.

Working Principles and Behavior Details

Determination Logic of the Relay Mechanism

The plugin determines the turn initiator via source.rpcId:
1. If source.rpcId belongs to the set of prompt IDs sent by the plugin, it indicates it was initiated by the plugin, and it will relay to QQ as usual.
2. If it does not match (e.g., the user typed it themselves in the DSH GUI), it indicates it was initiated by the GUI, and nothing will be relayed for this turn.

This mechanism prevents the QQ side from mysteriously receiving relayed messages when the user is operating the GUI in front of the computer.

Progress Display

The plugin does not actively push progress. Intermediate states are kept silent. Only when the user initiates a query on QQ will the plugin query the real status and answer truthfully.

Handoff and New Session Switching

When the context reaches the threshold, the plugin will:
1. Organize the handoff bundle + fragmented memories and write them to disk.
2. Archive the old session.
3. Establish a new session and inject the handoff text.
4. Messages arriving during the handoff will enter a queue (frozenQueue) and be delivered in the original order after the handoff ends.

Status Query

The plugin exposes a read-only status endpoint on the reverse WebSocket port, which can be used for debugging:

curl http://127.0.0.1:6700/dsh-whale-inurqq/status

This interface returns connection status, event statistics, workspace mapping, relay source determination accounts, and task scheduling information.

Summary

dsh-whale-inurqq is a OneBot 11 client connecting QQ and DeepSeek Harness. Through the resident session and context handoff mechanism, it simplifies the task management process. Meanwhile, through strict turn initiator determination and permission control, it ensures the security of interactions.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye