dsh-plugin-android-tools: Driving Android UI via a Local HTTP Bridge

Introduction

When performing mobile-related tasks in DeepSeek Harness (dsh), the model needs to be able to “see the current screen” and perform actions such as clicking, typing, and going back. A common approach involves using ADB scripts or writing a separate RPC suite, and then packaging these capabilities as tools registered to the agent. However, this approach has high maintenance costs and may not align perfectly with the Harness plugin model.

Below is an introduction to the community plugin dsh-plugin-android-tools (maintainer asdukw, SkillHub Category: Workflow). It bridges device-side UI automation into a set of dsh tools: reading the screen, screenshots, tap, long press, input, system keys, app launching, and swiping. It can also execute shell commands via a Termux bridge when necessary. The plugin itself is a cross-platform HTTP client; the actual UI tree reading and gesture injection are implemented by the bridge host. The repository only provides the client and does not include a published Android host. You need to point to an existing host or implement your own based on the contract.

What is this

dsh-plugin-android-tools is a plugin for DeepSeek Harness that registers atomic UI tools. Each call is forwarded to a bridge host configured with ANDROID_BRIDGE_URL. The host can be implemented by referencing Android’s AccessibilityService, and any system capable of responding according to the same HTTP contract can be connected.

If the bridge or token is not configured, tool calls will fail explicitly rather than silently performing a no-op.

Core Functions

The tools exposed by the plugin to the model are as follows (capabilities depend on the host implementation; the plugin only forwards HTTP requests):

Tool Function
read_ui_tree Exports the current screen’s node tree. Line format example: [12] TextView "Send" clickable @(900,2200)
tap_node(ref) Clicks a node ref from the previous read_ui_tree
capture_screenshot() Captures a frame: image and dimensions, screenshot_id, and other frame info
tap_target(screenshot_id,x1,y1,x2,y2) Taps on a screenshot pixel bbox (the host handles coordinate conversion)
long_press_target(...) Long presses a screenshot target (default 700 ms, optional 300–2000 ms)
long_press(ref,...) Long presses a UI tree node
type_text(text) Inputs text into the current focus box (does not send automatically)
press(key) back / home / recents / enter
launch_app(query) Launches an app by fuzzy name or package name
swipe(direction) Swipes about half a screen: up / down / left / right
run_command(cmd,timeout_ms?) Executes shell commands in the phone’s Linux environment (Termux + proot Debian), returns stdout / stderr / exit code

Notes:

  1. UI tools (excluding run_command) are reversible, visible interface operations; run_command modifies the file system, is irreversible, and each call is an independent session (cd, environment variables, and background processes are not retained). It also lacks real kernel capabilities like docker / systemd / iptables.
  2. run_command is only registered when the host injects TAPPET_TERMUX_URL and TAPPET_TERMUX_TOKEN; this tool will not appear on hosts without the Termux bridge configured.
  3. Images from capture_screenshot are passed to the model via the ctx.attachments service. If the attachment service is not mounted, the call still succeeds, but the image degrades to text, and the model does not receive the image. The action payload returned by the bridge takes the form of { mediaType, width, height, base64 }, etc.

Unified Bridge-side contract: POST {ANDROID_BRIDGE_URL}/action, with request header x-android-bridge-token: <ANDROID_BRIDGE_TOKEN> and a body containing action and parameters. Success returns { "ok": true, "payload": "…" }, failure returns { "ok": false, "summary": "…" }. It is recommended that the bridge listens locally and validates the token: screen content may contain personal data, and the bridge can directly drive the device.

Installation and Activation

Please refer to the repository README for installation commands (you need to restart dsh after installation; the dsh.bundle / cordis.patch.yml inside the package will write the plugin line during installation):

# from git, pinned to a release tag:
dsh plugin add github:asdukw/dsh-plugin-android-tools#v0.3.0

# or from the tarball attached to any GitHub Release:
dsh plugin add ./dsh-plugin-android-tools-0.3.0.tgz

# once npm publishing is enabled:
dsh plugin add dsh-plugin-android-tools

Configuration

Set these in the environment where dsh is started (host launchers usually inject them as well):

Variable Description
ANDROID_BRIDGE_URL Bridge base URL, e.g., http://127.0.0.1:37812
ANDROID_BRIDGE_TOKEN Shared token validated for every request
TAPPET_TERMUX_URL Phone Linux bridge URL, e.g., http://127.0.0.1:8899 (Optional)
TAPPET_TERMUX_TOKEN Token for the above bridge (appears paired with the previous item)

If ANDROID_BRIDGE_URL or ANDROID_BRIDGE_TOKEN is missing, tool calls will report a configuration error.

Typical Usage

Recommended loop: Read screen first, then operate, then read screen again to confirm.

User: open the clock app and set a 5 minute timer
Agent: launch_app("Clock") → read_ui_tree → tap_node(12) → type_text("5") → …

If you do not have a physical device, you can first use the mock host included in the repository to verify the plugin and the token chain:

node examples/mock-host.mjs   # mock host on http://127.0.0.1:37812 (token: dev-token)
export ANDROID_BRIDGE_URL=http://127.0.0.1:37812
export ANDROID_BRIDGE_TOKEN=dev-token

The mock confirms various actions and returns a canned read_ui_tree.

If you intend to write your own host, the README provides a checklist: validate the token, map action to platform accessibility/automation APIs, ensure [ref] in read_ui_tree remains stable between reads for tap_node, etc. See examples/mock-host.mjs for a reference implementation (about 60 lines, demonstrating parsing/auth/response format).

Use Cases and Notes

Who is it for

  • Those already orchestrating agents in dsh who need to standardize Android (or other platforms implementing the same contract) UI operations as tools.
  • Those willing to maintain or deploy a bridge host and accept the loopback + token security model.
  • Scenarios requiring running commands in a phone’s Termux/proot environment where the host has the Termux bridge configured (use run_command cautiously).

Notes

  1. The plugin works with the permissions and environment of the process currently running dsh. Please read the source code and the MIT license before installation to ensure the bridge URL, token, and logging policies meet your security requirements.
  2. The repository does not publish finished Android host products; it only includes the HTTP client and a mock. Production environments require self-provided hosts or third-party implementations.
  3. The plugin has no OS-specific code. Switching platforms only requires writing a bridge host; there is no need to modify the plugin.
  4. SkillHub is a community plugin directory and has no official affiliation with DeepSeek / High-Flyer. Stars and versions are subject to GitHub and the directory page (in the installation example, the git tag is v0.3.0, but the repository package.json current version is 0.6.0; please choose the corresponding installation method based on your release).

Conclusion

dsh-plugin-android-tools consolidates “UI reading, tapping, input, system navigation, screenshot localization, and optional shell” into a tool surface callable by the Harness, decoupling the client from the host via a local HTTP bridge. To get started: install the plugin and configure the bridge environment variables. Once the host is ready, let the model combine atomic operations following the “Read—Do—Read again” pattern.

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

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

Xiaoye