devctl-dsh: Control DSH Sessions from Another Device via CLI

Preface

DSH (DeepSeek Harness) uses a plugin-based architecture and runs inside a specific process. Usually, controlling a session requires directly operating the device that runs DSH. devctl-dsh provides a DSH access layer: control DSH sessions from another device via a CLI. It manages sessions (list sessions, send messages, view streaming replies, interrupt, and switch models), supports pairing without manually copying the token (via a QR code on the settings page), and provides a native Android client along with a Python controller.

Core Features

  • Session management: list sessions, send messages, view streaming replies, interrupt the current turn, and switch models.
  • Pairing mechanism: the settings page provides a QR code; scanning it yields the dshctl add command and avoids manually transcribing the token.
  • Controller: a single-file Python 3 script, cli/dshctl.py, with zero dependencies.
  • Client: a native Android client, dshconsole, that shares the protocol and token with the CLI.
  • Proxy and UI: provides a web interface proxy integrated into the DSH settings page, supporting device list, workspace CRUD, and permission management.
  • Image support: the --image parameter supports sending local images.

Installation (Controlled Endpoint)

Install the plugin on the controlled endpoint so that it opens a token-authenticated JSON-Lines TCP port inside the DSH process (default: 7788).

plugin_manager install_bundle target=<本仓库的绝对路径>

After installation, the port takes effect immediately, and a devctl section appears on the settings page. Confirm that the port is open:

netstat -ano | findstr :7788

On first startup, a token is generated and written to %USERPROFILE%\.dsh\devctl-dsh.json. To change the port or bind address, edit the config section in cordis.patch.yml or override it in the profile patch layer.

Installation (Controller Endpoint)

The controller endpoint consists of a single file. Temporarily start an HTTP service on the controlled endpoint so a mobile device can download it:

cd cli
python -m http.server 7799

Download it on a phone / iSH / Termux and register the device:

curl -O http://192.168.2.7:7799/dshctl.py
python3 dshctl.py add desk --host 192.168.2.7 --port 7788 --token <TOKEN>

When running on the same machine, --token can be omitted; the script automatically reads %USERPROFILE%\.dsh\devctl-dsh.json.

CLI Usage

The CLI follows the devctl style. Common commands are as follows:

dshctl.py add <name> <host:port> [--token T]        # 注册设备
dshctl.py devices                                  # 列出设备
dshctl.py use <name>                               # 设默认设备
dshctl.py send "message"                           # 发消息
dshctl.py send "图片" --image shot.png             # 发送图片(路径为控制端本地)
dshctl.py permissions                              # 查看权限
dshctl.py permissions danger-full-access           # 提升权限
dshctl.py tail [-n 40]                             # 查看最近消息
dshctl.py watch [--for 60]                         # 实时监听事件
dshctl.py cancel                                   # 打断当前会话
dshctl.py workspaces                               # 列出工作区
dshctl.py ws-new D:\proj\thing                     # 新建工作区
dshctl.py ws-rm d431cc0a                           # 注销工作区(保留文件和会话)

Notes:
* A remote controller can modify permissions and may elevate itself to danger-full-access.
* Each dshctl command uses a short-lived connection (unless watch/tail is in progress).
* ws-rm only deregisters the entry and does not delete the directory on disk or the sessions.

Android Client

The repository includes a native Android client, clients/dshconsole. It uses a single Activity, pure Java + hand-written Views, and has no AndroidX/Compose dependency; the artifact is about 86 KB. It uses the same protocol as the CLI.

Building the APK does not require the Android SDK and can be done in a Linux sandbox:

cd clients/dshconsole
python3 build.py        # → out/dshconsole.apk
adb install -r out/dshconsole.apk

UI features:
* Thinking blocks: ✦ Thinking · N chars ▸ is collapsed by default; during streaming, only the latest line is shown.
* Mode bar: a capsule above the input box directly switches the model/thinking intensity/permissions.
* Send modes: ↑ queues the message until the current turn ends; ⏎ interrupts immediately.
* Tool calls: automatically collapsed into cards.
* Connection self-healing: automatically reconnects and resumes watching after a disconnect.
* Typography: supports Markdown and real tables.

Use Cases and Cautions

This plugin runs with the permissions of the current DSH process. Before installing, review the source code and license. It serves via a LAN port, so ensure the network environment is secure.

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

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

Xiaoye