dsh-go-adb-link: Offloading ADB TCP connection maintenance to the DSH plugin

Introduction

To let AI directly control the phone in DSH Go mobile (check battery, screenshot, simulate input, install/uninstall apps), the prerequisite is that the local adbd is reachable. Doing this manually involves some repetitive labor: first confirming that USB debugging is on, guessing the port number, and reconnecting if the connection drops after adb connect. dsh-go-adb-link packs these actions into a plugin: it automatically finds the ADB TCP port on the phone, connects via the local adb and maintains the connection, and auto-reconnects when the engine starts. Below introduces its capabilities and integration steps.

What is this

dsh-go-adb-link is a native plugin for DSH Go, maintained by edgy7493, repository address github.com/edgy7493/dsh-go-adb-link. According to package.json, the current version is 1.2.4, license MIT; repo metadata shows 1 star, written in JavaScript.

It solves the problem: when adbd is opened on the phone via Stellar/Shizuku’s TCP channel or adb tcpip, the plugin automatically discovers the port and maintains the connection, allowing adb shell ... to be executed directly in DSH’s bash.

It is worth noting that it only applies to DSH Go mobile (local engine). The plugin runs in the phone’s own Ubuntu environment and needs to be able to connect to the local adbd from that environment; it does not apply if installed in other environments.

Core Features

The plugin registers a composer strip status bar and an ADB panel. The status bar has three text states: ADB Connected · 3455, ADB Not Connected, ADB Pending Authorization. Clicking the status bar opens the panel, which displays status, port, device, adb client, auto-reconnect toggle, and provides four buttons: Connect, Scan Port, Disconnect, Copy Command.

Connection maintenance is divided into three layers:

  1. Auto-reconnect when the engine starts.
  2. Auto-retry after disconnection, first trying the remembered port and 3455, 5555.
  3. If neither works and authorization was previously granted, it rescans in the background; maximum once every 10 minutes.

Port scanning does not look at specific port numbers; it sends ADB handshakes across all ports (1–65535) to find adbd. It only recognizes CNXN/AUTH responses and filters out false positives caused by TCP self-connection.

1.2.3 introduced AI behavior hints: after a successful connection, a hint is injected into the AI, indicating that system-level capabilities (appops/permissions, install/uninstall, reading protected data, screenshot, simulated input, process/battery queries) are needed. When ADB is more convenient, the AI will actively use ADB instead of taking a detour or asking first. 1.2.4 added an AI-facing adb tool on this basis: executes adb parameters as-is, automatically ensures connection, returns exit codes and output, and displays them in the App as a native card.

Another detail: if the adb client is missing (e.g., runtime upgrade reset /usr), clicking “Connect” will automatically execute apt-get install -y adb to restore it.

Installation and Enablement

The plugin has been submitted for inclusion. During PR review, you can install it using the method below; the effect is the same.

  1. npm install: The domestic mirror is synced; use this first.
   dsh plugin --profile web add dsh-go-adb-link

If the version cannot be found, add the official source:

   dsh plugin --profile web add dsh-go-adb-link --registry=https://registry.npmjs.org/
  1. GitHub direct install:
   dsh plugin --profile web add github:edgy7493/dsh-go-adb-link
  1. Offline tarball: Download dsh-go-adb-link-1.2.4.tgz from Releases to the phone, then install locally:
   dsh plugin --profile web add /sdcard/Download/dsh-go-adb-link-1.2.4.tgz

After installation, restart the engine once in the App’s “Engine” page for the status bar above the input box to appear. The status bar appears immediately after installation; subsequent changes to lib/ code require restarting the engine again.

According to package.json requirements, you need dsh >=0.2.1-rc.2 <0.3.0-0, node >=22, and the minimum App version declared by dshGo is 1.0.11. Installation or enablement will fail if versions are not met.

First-time Authorization

When connecting for the first time, the phone will pop up “Allow USB debugging?”. Tap Allow and check “Always allow from this computer”.

After checking, reconnecting will not pop up the window again, and the plugin can run fully automatically; if not checked, you have to click again every time. This step only needs to be done once.

Port-related Limitations

The README explicitly states three things:

  • The same phone can be used even after changing ports; clicking “Connect” will scan all ports and does not rely on 3455.
  • The plugin looks for the device in the environment of the phone it is running on; it will not connect to LAN ports of other devices.
  • Only supports classic ADB over TCP (adb tcpip, Stellar’s TCP functionality). Android 11+ native “Wireless Debugging” uses a TLS pairing port, which pure ADB handshakes cannot detect, so other methods need to be used.

Data and Security

Runtime memory is written to $DSH_HOME/dsh-go/adb-link/state.json, recording the port, whether authorized, and whether auto-reconnect is on; the file is not inside the plugin package, so uninstalling or upgrading will not remove it, and it will not be sent out by mistake.

The plugin executes the local adb program; if adb is missing, it calls apt-get install -y adb. It declares that it does not read the clipboard, input boxes, or chat content, and only connects to the adbd identified on 127.0.0.1. The local adb server (127.0.0.1:5037) is shared with bash; after the plugin connects, ordinary adb commands are also available.

Typical Usage

After the connection is established, AI can execute adb commands directly in DSH’s bash. For example, checking devices and pulling information via adb (the usage form given in README is “directly adb shell ... in DSH’s bash”, command parameters need to be adjusted according to actual needs):

adb devices
adb shell getprop ro.build.version.release

The AI-facing adb tool allows the model to call it directly without going through bash string concatenation, and the output is displayed in the App as a native card.

Applicable Scenarios and Notes

Suitable for users of DSH Go mobile: those who want AI to perform system-level operations without having to hand-off adb commands. For scenarios that only run on the desktop environment and do not use the phone’s local engine, the plugin is not applicable.

A few points worth checking yourself before integration:

  1. The plugin runs with the current dsh process permissions and will execute local adb; if missing, it will execute apt-get install -y adb. Before installation, you should read the lib/ source code and LICENSE (MIT) once to confirm compatibility with your environment.
  2. Only covers classic ADB over TCP; Android 11+ native wireless debugging is not within the supported scope.
  3. The repository is currently a 1-star personal project; you need to judge the update rhythm and long-term maintenance yourself.
  4. The community directory site has no official affiliation with DeepSeek or Huanfang; do not treat it as an official app store.

Uninstall

dsh plugin --profile web remove dsh-go-adb-link

You can also uninstall directly in the App’s plugin details.

Reference Links

  • Community Directory: https://www.skillhub.cn/plugins/edgy7493/dsh-go-adb-link
  • GitHub: https://github.com/edgy7493/dsh-go-adb-link
  • Releases: https://github.com/edgy7493/dsh-go-adb-link/releases
羽毛球分组比赛记分
小程序二维码

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

Xiaoye