Preface¶
When driving a real device with DeepSeek Harness (DSH) on Android—tapping, launching apps, scrolling through interfaces—the app being operated takes over the foreground, while DSH retreats to the background. After each control turn completes, you often have to manually switch back to DSH to see results and continue the conversation. The community plugin dsh-return-front (maintainer: zxyan99, category: Client) targets exactly this workflow gap: only when “this turn actually touched the real device’s foreground” and the toggle is enabled, it brings the DSH host app back to the foreground via the Shizuku privileged channel at the end of the turn; read-only tasks (screenshots, UI dumps, etc.) and virtual display tasks will not trigger it.
Below we introduce its positioning, installation method, settings, and trigger boundaries.
What is this¶
dsh-return-front is a client-side plugin for DSH, version 0.1.0 (MIT license). In one sentence: after a real device control task ends, automatically switch DSH back to the foreground.
The applicable environment is clearly stated in the README: DSH on Android (Termux-based runtime + Shizuku privileged channel). Installing the plugin on other platforms will load it normally, but it will not perform any foreground restoration actions.
| Scenario | Behavior |
|---|---|
| Agent opens an app on the real device and completes a control turn | At the end of the turn, DSH automatically returns to the foreground (when the toggle is on) |
| Pure read-only tasks (screenshot / dump, etc.) | Not triggered |
| Virtual display tasks | Not triggered |
The trigger conditions are deliberately narrowed: only when the current turn actually manipulated the real device’s foreground and you have the switch enabled in settings will it act.
Prerequisites¶
Before use, several prerequisites from the README must all be met:
- DSH runs on Android (Termux-based runtime, for automatic host app package name detection).
- Shizuku privileged channel is ready (the plugin uses it to execute the bring-forward command).
- Screen scope includes real device:
scopeisallorreal-only. When the factory default isvirtual-only, the Agent cannot manipulate the real device’s foreground, and the plugin will silently skip (this is by design, not a bug). - A runtime profile that can execute privileged shell (e.g.,
danger-full-access).
Installation and enabling¶
The official installation command is as follows (after installation, restart DSH and refresh the page):
dsh plugin --profile web add github:zxyan99/dsh-return-front
If assembling manually from local source code, the equivalent steps are: place the repository in any directory; create a symlink pointing to that directory under $DSH_HOME/profiles/<profile>/node_modules/; append a plugin entry at the end of $DSH_HOME/profiles/<profile>/cordis.patch.yml; then restart DSH. The assembly order needs to be later than @dsh-android/dsh-android-bridge; placing it at the end of the patch usually satisfies this.
The plugin runs with the current DSH process privileges; before installation, it is recommended to review the source code and MIT license on GitHub to confirm it meets your environment policy.
Typical usage¶
After installation and restart, open Settings → General, and a line will appear:
Task wrap-up
☑ Return to DSH after real device control tasks end
Checking or unchecking takes effect immediately and persists; the state is saved in $DSH_HOME/dsh-return-front.json, enabled by default.
No additional commands are needed for daily use: after the Agent completes tool calls that change the foreground on the real device, DSH may automatically switch back at the end of the turn; if the current turn only has read-only or virtual display operations, the interface behavior is the same as when the plugin is not installed.
How it works and configuration (optional)¶
The plugin subscribes to session/event: it clears state on turn/start, records whether the real device’s foreground was touched during the turn on tool/call, and decides whether to execute the bring-forward action on turn/end.
Included tools: android_app_launch, android_ui_click, android_act_input, android_ui_scroll, android_ui_input, android_ui_global. Excluded are all android_vdisplay_*, as well as read-only classes (such as device_info, screen_list, ui_dump, ui_detail, ui_tree, screenshot, web_dump, etc.). screenId is counted as real device only when it is missing or real; virtual-N is not counted.
The action is a bring-forward command of the form:
monkey -p <host package name> -c android.intent.category.LAUNCHER 1
The host package name is automatically detected from the directory name of the Termux environment variable TERMUX_APP__DATA_DIR by default, not bound to a specific shell app build. The toggle is read and written via an authenticated loopback route /api/dsh-return-front.
If you need to set the initial state or override the package name in the profile’s patch, you can use (generally no need to manually specify the package name):
- insert:
- id: dsh-return-front
name: dsh-return-front
config:
enabled: true
appPackage: com.example.shell
launchCommand: "monkey -p com.example.shell -c android.intent.category.LAUNCHER 1"
The environment variable DSH_RETURN_FRONT_APP_PACKAGE can also override the host package name.
Use cases and notes¶
Who it’s for: Developers who frequently use DSH for UI automation, tapping, and input on Android real devices, and want one fewer step of manually switching back to DSH after each turn.
Boundaries (honest list from the README):
- On non-Android hosts, the plugin loads but does not act.
- Does not work when
scope=virtual-only, and this is by design; it writes debug logs, no errors. - When Shizuku is not running or the profile is insufficient, failures are swallowed, only debug logs.
- Only does “switch back to foreground”: does not modify foreground content, does not clean up, does not restart the engine, does not touch user data.
- If the current turn touched the real device but the user has already actively switched elsewhere, it may still be pulled back to DSH at the end of the turn; turn off the setting when this behavior is not needed.
The DSH ecosystem emphasizes “everything is a plugin”; the community directory SkillHub plugin page and the GitHub repository are maintained by the community, with no official affiliation with DeepSeek / High-Flyer.
Conclusion¶
dsh-return-front consolidates “real device control turn ends → manually switch back to DSH” into a toggleable automation: the trigger scope is narrowed to real device foreground changes, avoiding false triggers from read-only and virtual display operations. When needed, you can check for updates and Issues from the directory page or the repository.
- Directory page: https://www.skillhub.cn/plugins/zxyan99/dsh-return-front
- GitHub: https://github.com/zxyan99/dsh-return-front