Preface¶
When running long tasks with DSH, network jitter is an unavoidable problem: the model stream cuts off halfway, the reply chain breaks, and resuming the session means starting from scratch; if retries are unconstrained, waiting and resending will continue to consume tokens. DSH’s philosophy is “everything is a plugin,” and network layer problems can also be handled uniformly by plugins. Rather than manually remedying after a stream cut, it is better to let the plugin manage retries, caching, and reconnections at the network layer—the dsh-plugin-weaknet-adaptor introduced below does exactly that.
What is it¶
dsh-plugin-weaknet-adaptor is a DeepSeek Harness weak network adapter plugin by jiay98528-dev, MIT licensed, requiring Node >= 18. It solves the core problems: broken model reply chains and retrying burning tokens in weak network environments.
It is distributed as an npm package, statically loaded in cordis.yml. Unlike dynamic plugins created via cordis_define inside a session (which only exist in process memory and are lost on crash/restart), static packages remain effective after restart. As of September 2026, the version in package.json is 1.0.5, with the repository CHANGELOG documenting up to 1.0.3.
Core Features¶
Transparent Model Stream Retry¶
The plugin is mounted in a prepend manner to the llm/stream waterfall layer, transparently intercepting the model stream. After entering degradation mode, the plugin buffers the entire response, retrying with exponential backoff on failure, with a default maximum wait time of 10 minutes. During retry wait times, there are zero model calls, i.e., zero tokens.
Local Response Cache¶
Successfully completed responses are cached locally. The key is the request fingerprint, using LRU eviction, with a configurable TTL. The fingerprint consists of the following fields; only requests that are byte-for-byte identical will match. After a match, local replay consumes zero tokens:
provider + model + reasoningEffort + temperature + maxTokens
+ stop + system + tools + messages + purpose
Automatic Heartbeat Reconnection¶
After a network disconnection, the local heartbeat task automatically probes for reconnection with exponential backoff, with a default interval limit of 10 minutes; any successful model stream immediately triggers a passive recovery of online status. The composer status bar at the bottom displays network status: green for normal, yellow for weak network, and red for interruption.
Degradation to Save Tokens¶
After reconnection, there are two optional token-saving methods: output limit degradation (reduceMaxTokens) and deterministic pruning of session tool-results (pruneToolResults). Note that the latter is irreversible, so confirmation is needed before enabling.
Structured Settings Page¶
All 24 parameters are structured (grouped, typed, ranged, with default values), concentrated in the “Weak Network Adapter” settings page, adjustable in real-time. The description and expected effect for each parameter are bilingual (Chinese/English), and the UI follows the system language. Parameters are persisted to <workspaceRoot>/.dsh/weaknet-params.json.
The settings page calls the weaknet/* namespace (getParamDefs / getParams / setParams / getStatus / resetStats) via @Remote (dsh-typert-protocol) SRC markers mechanism at the bottom layer, without the need to hand-write typert artifacts.
Design Decisions¶
Retry mounted on llm/stream, not agent/request-error¶
The host’s llm-retry already defaults to taking over agent/request-error, so later-registered listeners will be short-circuited. llm/stream, however, is a waterfall that every model request must go through, allowing for deterministic takeover. Therefore, retries are placed in llm/stream, and agent/request-error serves only as a fallback observer.
Explicitly Not Doing Things¶
- No toolset pruning: Pruning the toolset changes the model’s capability surface, so the plugin exercises restraint.
- No “prefix continuation” for stream interruptions: LLM APIs do not support continuation; retrying means regenerating from scratch.
Installation & Enablement¶
First, install via npm:
npm install dsh-plugin-weaknet-adaptor
The package depends on @deepseek-ai/dsh-typert-protocol; @deepseek-ai/* and other peer dependencies like cordis are installed automatically by npm.
Then statically load it in the cordis.yml configured for the DSH you are running:
plugins:
- name: dsh-plugin-weaknet-adaptor
The host half is automatically activated; the browser half (settings page and status bar) is provided by client-modules declared by dsh.client inside the package, requiring no extra wiring. The plugin remains effective after restarting dsh.
Quick Verification¶
After the steps above, the plugin is running. You can confirm its status in three steps:
- Open Settings → Weak Network Adapter. You can see the status card and grouped parameters, each with bilingual descriptions and expected effects.
- Change “Heartbeat Probe Address” to
http://127.0.0.1:1/xand save. The composer status bar at the bottom will turn yellow (weak network), then red (3 consecutive probe failures, interrupted) in sequence; changing it back to the default address turns it green, automatically recovering online status. - Switch the interface language (CN/EN), and the settings page text follows immediately.
Use Cases & Notes¶
Suitable for two types of users: DSH users running long tasks in unstable network environments, and users who care about token consumption and want to directly replay the same request locally. The heartbeat probe address can be customized; in a LAN or proxy environment, it can point to your own lightweight endpoint.
There are a few points to note before use:
pruneToolResultsis irreversible for session tool-result pruning. Confirm before enabling.- Caching only matches when requests are byte-for-byte identical. Any difference in messages or parameters will trigger a model call again.
- The plugin runs with the permissions of the current dsh process. It is recommended to read the source code and license before installing third-party plugins; the license for this project is MIT, and the source code and dependency list are visible in the GitHub repository.
Conclusion¶
dsh-plugin-weaknet-adaptor brings retries, caching, reconnection, and token saving into a real-time adjustable settings page under weak network conditions. All parameters are structured, and behavior boundaries (retry mounting layer, explicitly avoided actions) are clearly defined. In unstable network environments, it allows the reply chain to remain as unbroken as possible.
- GitHub repository: https://github.com/jiay98528-dev/dsh-plugin-weaknet-adaptor
- Community Plugin Directory (independent site, no official affiliation with DeepSeek / HF): https://www.skillhub.cn/plugins/jiay98528-dev/dsh-plugin-weaknet-adaptor