Introduction¶
DeepSeek Harness (DSH) does not natively auto-continue. When a turn ends because the output token limit (max-tokens) is reached, the harness stops the session and displays a prompt on the UI: “The response was truncated. Send ‘继续’ (Continue) to let the model resume output.” This is an intentional design choice, awaiting user decision.
For scenarios requiring continuous output, manually typing two characters each time adds operational overhead. dsh-plugin-continue-on-limit solves this problem: it listens for the turn/end event on the host side and automatically sends a follow-up prompt when it detects a truncation reason.
Core Features¶
This plugin is a host-side plugin; it involves no client-side logic and does not rely on UI snapshot fields. It sends messages via agent.followup(), with the message identity set to cordis-host-runner. In the interface, this is rendered as a plugin-triggered status rather than a simulated user input.
The plugin is constrained by the following mechanisms:
* Per-session burst limit
* Minimum interval
* Global switch
Installation and Activation¶
Before installation, ensure the environment meets the requirements: Node.js version must be greater than or equal to 22, and pnpm must be used for installation (pnpm may fail to create junctions in certain sandbox environments, potentially leading to unreachable dependencies).
- Add the dependency to the profile’s
package.json. - Add the plugin to the
bundleslist.
{
"dependencies": {
"dsh-plugin-continue-on-limit": "^0.1.0"
},
"dsh": {
"profile": {
"bundles": [
"@deepseek-ai/dsh-base",
"@deepseek-ai/dsh-web-app",
"dsh-plugin-continue-on-limit"
]
}
}
}
- Run
pnpm installin the profile directory. - Restart DeepSeek Harness.
The plugin is automatically mounted via cordis.patch.yml; there is no need to manually write a patch list. After installation, please go to the Plugins page to confirm that the plugin is enabled.
Configuration¶
All configuration items for the plugin are of the .volatile() type. Changes made on the Plugins page do not require a fiber reload, and setting enabled: false can cut off an ongoing chain mid-execution.
The main configuration items are as follows:
| Field | Type | Default | Description |
|---|---|---|---|
enabled |
boolean | true |
Master switch |
continueText |
string | 继续 |
The continuation text to send. Max length 200 |
maxConsecutive |
integer | 3 |
Max auto-continue attempts for a single truncation chain in a session. Set to 0 for unlimited (dangerous option) |
minIntervalMs |
integer | 1500 |
Minimum interval between two continuations (milliseconds) |
Configuration values are clamped; negative or invalid values fall back to the default values.
How It Works¶
Detection Mechanism¶
The plugin listens for the turn/end event within session/event and checks if event.data.reason.kind is max-tokens. It does not use the client-side SessionSnapshot because the snapshot lacks the fields required for detection.
Timing of Sending¶
The plugin cannot synchronously send messages within the turn/end callback. This is because Session.append opens a reentrancy gate during broadcasting, and Agent.followup() needs to call append internally. A synchronous call would result in a “session append cannot reenter” error.
Therefore, the sending logic is deferred until after agent.whenIdle(). At this point, phase.kind is guaranteed to be idle, allowing wakeDriver to start a new driver loop to process messages in the inbox.
Message Identity¶
To avoid impersonating human input, the source.kind of messages sent by the plugin is set to cordis-host-runner. This is a source type reserved by the harness for host-side behavior, ensuring that flows like approvals are not misjudged.
Safety and Limitations¶
Three Safety Gates¶
- Burst Limit:
maxConsecutivedefaults to 3 to prevent the model from repeatedly overflowing and consuming too much context. Setting it to 0 requires caution. - Infinite Loop Fallback:
minIntervalMsprevents meaningless rapid repeated continuations. - Input Validation: Configuration values undergo strict validation and clamping. Negative numbers do not fall back to 0 (disabling limits) but instead fall back to the default values.
Safety Features¶
- Queue Priority: When there are already user messages queued in the inbox, the plugin skips the current continuation to let the user’s request execute first.
- Deduplication: It does not repeat continuations within the same turn, nor does it schedule duplicates during the sending queue period (
pendingstate). - Exception Isolation: Errors thrown by
followup()are only logged and do not bubble up to the callback.
Testing¶
The plugin includes 61 passing tests. The tests cover pure decision logic (without relying on Cordis), host-side integration tests (driving real apply with a mock ctx), and loading contract tests.
Run tests with:
npm test
Summary¶
dsh-plugin-continue-on-limit provides DeepSeek Harness with the ability to automatically continue truncated answers. Through host-side event monitoring and precise timing control, it automatically handles model output limits without interfering with user intent. It is suitable for developers who require long-text generation and wish to minimize manual interaction.
For more information, please refer to the SkillHub Plugin Directory or the GitHub Repository.