dsh-peak-hours: DeepSeek Harness Execution Window Toggle Plugin

When developing agents in DeepSeek Harness, model invocation cost is one of the main considerations. The plugin dsh-peak-hours provides the ability to switch execution windows, allowing users to automatically run or pause tasks during off-peak hours to optimize costs.

Plugin Overview

This is a DeepSeek Harness workflow plugin maintained by lion231226, licensed under the MIT License. It allows adding a control to the Composer toolbar to switch between “Always Run” and “Run only during off-peak hours.” In “Run only during off-peak hours” mode, when the peak pricing window starts in Beijing Time, all dsh tasks (including running tasks) are automatically paused; they resume automatically after the window ends.

Core Features

  • UI Control: Adds a run mode switching control to the composer toolbar, supporting the “Always Run” and “Run only during off-peak hours” modes.
  • Automatic Scheduling: Automatically pauses all tasks during peak hours and resumes them during off-peak hours.
  • Time Window Determination: Peak and off-peak time determination based on Beijing Time (UTC+8) (Monday to Friday 09:00-12:00, 14:00-18:00).
  • Holiday Support: Supports determination of statutory holidays and make-up workdays.
  • HTTP API: Provides API endpoints for status queries, mode switching, and clock simulation.
  • Implementation: No build steps; implemented in pure JavaScript.

Installation and Activation

Install using the DeepSeek Harness CLI:

dsh plugin --profile web add github:lion231226/dsh-peak-hours

Typical Usage

UI Interaction

In the composer UI, click the control to the right of the mode button in the toolbar to select the execution strategy.

API Operations

The plugin registers the following endpoints on the host’s loopback Web server:

  • Query health status:
    GET /api/peak-hours/health
  • Query current status:
    GET /api/peak-hours/state?session=<id>
Without the `?session=` parameter, it reports the `default` mode.
  • Switch run mode:
    POST /api/peak-hours/mode
    Content-Type: application/json

    {
      "mode": "always" | "idle-only" | null,
      "session": "<id>",
      "scope": "session" | "default"
    }
Setting `mode: null` and specifying a session clears the override for that session.
  • Clock simulation:
    POST /api/peak-hours/clock
    Content-Type: application/json

    {
      "offsetMs": <int|null>,
      "ttlMs": <int>
    }
The maximum limit for `ttlMs` is 30 minutes.

Technical Details and Notes

  • Installation conflicts: Do not mix the dsh plugin add and install.ps1 installation methods. dsh plugin add registers the package, while install.ps1 manually writes patch files. Mixing them can cause duplicate patch files.
  • Make-up workday logic: Make-up workdays are treated as off-peak periods and do not participate in peak window determination.
  • Clock override: The maximum TTL limit for clockOverride is 30 minutes.
  • Dependencies: Depends on @deepseek-ai/cordis (optional dependency).
  • Interception mechanism: Mainly intercepts through agent/pre-step and tools/pre-execute; the llm/stream endpoint is not blocked because its return type is related to the agent loop invocation path.

Applicable Use Cases

This plugin is suitable for DeepSeek Harness users who need to control task execution during specific time windows to reduce model invocation costs. Before use, check the source code and license; the plugin runs with the permissions of the current dsh process.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye