Introduction

The DSH ecosystem emphasizes “everything is a plugin,” where plugins can supplement common UI and state display needs within the main workflow. For developers using the DSH web profile, information such as account balance, remaining session context, peak and valley pricing, and auto-compression status is often scattered across different pages or logs. If not displayed centrally, it requires switching views or checking logs.

dsh-game-hud is a DeepSeek Harness plugin that converts these states into a game-style floating HUD. It displays the balance as a health bar, the remaining context as a blue bar, and shows peak and valley pricing, switching countdown, low balance alerts, auto-compression, and entry points for new sessions with memory.

The following introduces its positioning, features, installation methods, configuration options, and precautions.

Plugin Positioning

dsh-game-hud can be understood as a status panel plugin for the DSH Web profile. It is suitable for developers who wish to quickly view their DeepSeek account balance, current session context, peak and valley pricing, and compression status at a fixed position.

Repository address:

https://github.com/guoliyuan97-png/dsh-game-hud

The license is MIT. Verified materials state that the package.json declares a Node.js engine requirement of:

"engines": {
  "node": ">=18"
}

Core Features

Balance Health Bar

The health bar is used to display the DeepSeek account balance in real-time. The plugin calls the official user/balance interface. The full amount is set to ¥20 by default and is configurable.

The balance display does not involve the client directly and frequently requesting the official interface. The verified mechanism is: the client polls the host every 3 seconds, and the host re-checks the official balance interface after caching for 30 seconds.

Context Blue Bar

The blue bar is used to display the remaining current session context. It is based on a projection of contextPressure from the official UI and decreases from full as the conversation grows.

The remaining context is remeasured every 3 seconds.

Low Balance Alert

When the balance falls below the threshold, a red glow flashes around the floating window. The default threshold is 10%, and the alert switch is configurable.

This alert applies only to the balance health bar, not the context blue bar.

Collapsed Mini View

When collapsed, the HUD displays a compact health bar and blue bar, making it convenient to check balance and context without needing the full panel.

Peak and Valley Pricing

The plugin displays the current unit price and switching countdown based on the official Beijing Time peak and valley rules.

The verified peak and valley periods are:

09:00–12:00
14:00–18:00

These two periods are peak times, and the valley time is at half price. The plugin displays the current unit price and shows a countdown to the next switch. The countdown ticks locally every second.

Auto-compression and Carrying Memory

When the remaining context falls below 5%, the plugin automatically triggers:

/compact

After compressing for 2 full rounds, a “Start new conversation (with memory)” button will appear. If you do not click this button, the plugin will continue to compress automatically.

After clicking “Start new conversation (with memory)”, the process is as follows:

  1. Generate a memory summary using the current model.
  2. Create a new session.
  3. Inject the memory into the new session.
  4. The context of the new session is recalculated.

The injection is done silently via POST /hud/seed using the user/message append method, without triggering an agent reply or answering old questions.

Installation and Activation

Using the dsh command

Execute the following in the DSH environment:

dsh plugin --profile web add github:guoliyuan97-png/dsh-game-hud#v1.2.0

Restart DSH after installation.

Verified materials indicate that the installation command references v1.2.0, while the repository package.json displays version 1.3.1. If you are installing via tag or package version, please verify the currently available version of the repository before installing.

Writing to web profile installation

You can also declare dependencies directly in the DSH web profile.

In the package.json of the web profile, set:

{
  "dependencies": {
    "dsh-game-hud": "github:guoliyuan97-png/dsh-game-hud#v1.2.0"
  },
  "dsh": {
    "profile": {
      "bundles": ["dsh-game-hud"]
    }
  }
}

This can also be understood as adding "dsh-game-hud" to dsh.profile.bundles. Then execute:

pnpm install

Restart DSH after installation is complete.

Local Development Installation

If the local repository is at ./packages/dsh-game-hud, you can use a file: reference in package.json:

{
  "dependencies": {
    "dsh-game-hud": "file:./packages/dsh-game-hud"
  },
  "dsh": {
    "profile": {
      "bundles": ["dsh-game-hud"]
    }
  }
}

Configuration and Typical Usage

Configuration Entry

You can edit the configuration via the plugin entry in DSH Settings:

DSH Settings → Plugins → dsh-game-hud

You can also override configuration items in the profile’s cordis.patch.yml.

Verified configurable items include:

maxBalance
lowAlert
lowThreshold
priceTable

Meanings are as follows:

maxBalance    Health bar full amount, default 20
lowAlert      Low balance red light alert switch, default true
lowThreshold  Low balance alert threshold, default 10
priceTable    Override peak and valley prices by model

cordis.patch.yml Example

The example below configures maxBalance, lowAlert, lowThreshold, and the peak and valley prices for deepseek-v4-flash:

- insert:
    - id: game-hud
      name: 'dsh-game-hud'
      config:
        maxBalance: 50
        lowAlert: true
        lowThreshold: 10
        priceTable:
          deepseek-v4-flash:
            peak: { input: 3.0, output: 9.0, cacheHit: 0.1 }
            valley: { input: 1.5, output: 4.5, cacheHit: 0.05 }

API Key Parsing

The plugin parses the API Key via the host’s credentials service.

The default environment name is:

DEEPSEEK_API_KEY

Additionally, it reads apiKeyEnv from the llm-deepseek configuration.

Host Routes

The host has registered three HTTP routes:

GET /hud/state?sessionId=<id>
POST /hud/digest
POST /hud/seed

Their purposes are:

  1. GET /hud/state?sessionId=<id> is used to query real-time status.
  2. POST /hud/digest is used to generate memory summaries.
  3. POST /hud/seed is used to inject memory into a new session.

Specifically, POST /hud/seed injects memory silently using the user/message append method, without triggering an agent reply or answering old questions.

Client Packaging Method

Verified materials indicate that the client is packaged in a hand-written format using window.__ModuleLoader__.load(), requiring no builder.

Applicable Scenarios and Precautions

This plugin is suitable for the following scenarios:

  1. Using the DSH web profile and wishing to view DeepSeek account balance next to the conversation interface.
  2. Needing to monitor the current session context remaining to avoid discovering context insufficiency only after a long conversation.
  3. Needing to view DeepSeek peak and valley pricing and the switching countdown.
  4. Wishing to automatically trigger compression when context is insufficient and open a new session with memory when necessary.

Precautions before use:

  1. The plugin runs with the permissions of the current dsh process. You should check the source code, dependencies, and license before installing.
  2. The license is MIT.
  3. You need to restart DSH after installation.
  4. The balance display relies on the official user/balance interface; the client polls the host every 3 seconds, and the host re-checks after caching for 30 seconds.
  5. The peak and valley pricing display is based on the verified official peak and valley periods and half-price rules; billing is still subject to DeepSeek’s official rules.
  6. Verified materials indicate that the installation command uses v1.2.0, while the repository package.json displays version 1.3.1. It is recommended to verify the actual available version before installing.

Conclusion

dsh-game-hud centralizes DeepSeek account balance, session context, peak and valley pricing, auto-compression, and entry points for new sessions with memory into a single HUD panel. For developers using the DSH web profile, its value lies mainly in reducing the cost of switching states, making changes to balance, context, and prices visible directly next to the conversation.

Repository address:

https://github.com/guoliyuan97-png/dsh-game-hud