AI Agent Hub
Back to plugins
🖥️

dsh-auto-reconnect

Client Updated 2026.09.14

Run the following command in DeepSeek Harness:

dsh plugin install tqcq/dsh-auto-reconnect

Paste the following prompt into your AI chat to install this plugin:

In your DeepSeek Harness environment, run dsh plugin install tqcq/dsh-auto-reconnect from the dsh-web working directory to install this plugin; the full source is available at https://github.com/tqcq/dsh-auto-reconnect , and a dsh-web restart is required after installation or removal.

About this plugin

The official DSH connection controller includes exponential-backoff reconnect out of the box, yet a source-level audit of dsh-client-connection 0.1.2-rc.1 exposed two gaps that matter in daily use. When backoff hits its ceiling the controller parks in a terminal-disconnected state and only revives on a browser online event or a manual tap. Because phone sleep-and-wake cycles leave navigator.onLine true throughout, the online event never fires and the user is forced to tap the page every time. Separately, the client registers no visibilitychange or focus listener and performs no heartbeat, so a silently dropped TCP connection leaves the WebSocket in the OPEN state while application logic still believes the link is healthy — a zombie that appears connected but delivers nothing.

dsh-auto-reconnect plugs precisely those two holes with a minimal, client-only intervention. It subscribes to visibilitychange(→visible), focus, pointerdown, keydown, pageshow(persisted), and the connection state store, yet invokes connection.reconnect() only when the current state is not already connected, guaranteeing it will never disturb a live link. On a bfcache restore the plugin reconnects unconditionally because the underlying sockets are guaranteed dead. If the controller transitions into terminal disconnected, the plugin fires a delayed retry (3 seconds by default) with a budget of twenty consecutive attempts that resets after a successful connection, covering the edge case where the page is already visible and focused and no further browser events will ever arrive. Each trigger is prefixed in the console with [dsh-auto-reconnect] and throttled to three seconds for clean DevTools forensics. Should the upstream API contract drift, the plugin emits a warning and stays idle, degrading gracefully without breaking the page.

The plugin suits anyone running the DSH web client on mobile devices, tab-switching between apps heavily, sleeping and waking screens on a regular cadence, or working behind NATs that silently prune idle background TCP sessions. It requires zero build tooling, touches no official package, and needs nothing more than a dsh-web restart after install or removal.

Use Cases

  • Connection stalls in terminal disconnected state after phone lock/wake, requiring a manual tap
  • Background tab silently loses TCP via NAT pruning while the UI still reports connected
  • bfcache restore or hard refresh leaves dead sockets that the official controller never re-resolves

Best For

  • Developers using the DSH web client on phones or tablets daily
  • Mobile users who frequently lock/wake screens or switch between apps
  • NAT environments where idle background TCP sessions get silently pruned