Introduction¶
Running long tasks in DeepSeek Harness (DSH)—model inference, multi-turn agents, manual /compact—often takes tens of minutes or longer. When a Mac is connected to power or has aggressive battery strategies, it may enter system sleep after a period of idling, suspending processes and interrupting sessions mid-task. Manually changing “System Settings → Battery/Energy Saver” can be a temporary fix, but it needs to be done every time and is easily forgotten.
Below is an introduction to the community plugin dsh-mac-keep-awake (maintainer wjvalue): When any DSH session is running, it holds a power assertion via macOS caffeinate to prevent idle system sleep; it releases immediately when the last session ends. The screen can still turn off normally, making it suitable for scenarios where you want to keep DSH running for long periods without keeping the screen lit all night.
What is this¶
dsh-mac-keep-awake is a Host-side plugin for DeepSeek Harness, typically categorized under scenarios related to long-running tasks like “Model Inference.” It solves the problem: The session is still running, but the machine sleeps due to idleness, interrupting the task.
- Repository: github.com/wjvalue/dsh-mac-keep-awake
- Community Directory Page: skillhub.cn/plugins/wjvalue/dsh-mac-keep-awake
- Current Package Version (Reference): 1.4.2
- License: MIT
- Runtime Environment: Node >= 20; Only macOS will actually hold the assertion. On other platforms, it only logs a warning after loading and does not affect DSH startup.
The DSH ecosystem emphasizes “Everything is a plugin”; directories like SkillHub are community sites and have no official affiliation with DeepSeek or High-Flyer. Please review the source code and license before installation, as the plugin runs with the permissions of the current DSH process.
Core Features¶
When to Hold, When to Release¶
As long as any DSH session is running, the plugin holds a macOS power assertion (PreventUserIdleSystemSleep); it releases immediately after the last session ends.
- When multiple sessions run in parallel, it uses reference counting by session ID, holding only one global assertion. It does not stack multiple
caffeinateprocesses. - The screen can turn off as usual (it uses
caffeinate -iby default, without-d). - If the DSH main process exits abnormally, the child process monitors the host via
-w <pid>, preventing the machine from being permanently “pinned.”
Underlying Mechanism (Brief)¶
The assertion is executed by a child process:
caffeinate -i -w <DSH main process pid>
| Parameter | Function |
|---|---|
-i |
Only prevents idle system sleep, does not prevent display sleep |
-w <pid> |
When the watched process exits, caffeinate exits on its own |
Optional configurations append -d (also prevent display sleep) or -t <seconds> (a fallback timeout for a single assertion; if the session is still running after the time limit, it will re-acquire).
The plugin also listens to agent/status, agent/disposed, compaction/start / compaction/end, and periodically reconciles with ctx.agents.list() to cover edge cases like hot reloads and manual /compact (where the maintenance phase reads as idle on the API). If assertion fails, it retries with exponential backoff (capped at 60 seconds) and will not permanently give up while the session is running.
Installation and Activation¶
The steps provided in the official README are as follows (do not guess dsh plugin add github:... based on the plugin name).
1. Package and stage to the profile’s vendor/ directory
Run this in the plugin repository root directory:
node scripts/install.mjs
2. Install using the DSH Plugin Manager
Note: Desktop profiles can only be managed by the Electron application. Example installation spec:
file:vendor/dsh-mac-keep-awake-1.4.2.tgz
After installation, the bundle’s built-in cordis.patch.yml will insert the Host; patchReload: live means that after modifying src/, you simply reinstall to apply changes without restarting the application.
3. Modify configuration as needed
Override the plugin line’s config in the profile’s cordis.patch.yml, for example:
- id: keep-awake
name: 'dsh-mac-keep-awake'
config:
enabled: true # Master switch
preventDisplaySleep: false # true = Prevent display sleep as well (add -d)
maxHours: 0 # >0 = Fallback timeout per assertion (hours); 0 = disabled
reconcileSeconds: 60 # Reconciliation interval; 0 = disable reconciliation
executable: /usr/bin/caffeinate
Typical Usage and Verification¶
No extra commands are needed daily: once the plugin is enabled, simply start a DSH session and run tasks; after all sessions end, the machine should revert to its original sleep strategy.
Verify on real hardware if the assertion exists
While a session is running:
pmset -g assertions | grep -A2 caffeinate
pgrep -fl "caffeinate -i -w"
Run this again after all sessions have ended; there should be no relevant output.
Developer Self-Test
Inside the plugin repository:
node --test test/*.test.js
Includes unit tests, wiring tests, and integration tests relying on real hardware pmset -g assertions (only meaningful on macOS).
Use Cases and Notes¶
Who is it for
- Users running long-term inference, agents, or multi-session tasks with DSH on Mac, who do not want to change system energy settings for single tasks.
- Scenarios where the screen needs to turn off, but the system must not sleep due to idling (default
preventDisplaySleep: false).
Must Know
- Effective on macOS only; on Linux / Windows, the plugin degrades to a warning and holds no assertions.
- Depends on the system built-in
/usr/bin/caffeinate(path can be overridden viaexecutable). - The plugin runs with the same process permissions as DSH; please read the GitHub Repository source code and MIT license before installation.
- Community Directory Page: https://www.skillhub.cn/plugins/wjvalue/dsh-mac-keep-awake
Conclusion¶
dsh-mac-keep-awake turns “No idle sleep if sessions exist, release if no sessions” into built-in DSH behavior: by default, it does not block display sleep, shares a single assertion for multiple sessions, and provides fallbacks for hot reloads, compaction, and process crashes. If you frequently leave the Harness running long tasks on your Mac, you can follow the README to package and install it, and fine-tune the switches and reconciliation intervals in cordis.patch.yml.
- Directory Page: https://www.skillhub.cn/plugins/wjvalue/dsh-mac-keep-awake
- GitHub: https://github.com/wjvalue/dsh-mac-keep-awake