dsh-composer-balance: A Persistent Balance Input Box Tool for DeepSeek Harness

Introduction

DeepSeek Harness (DSH) users need to keep a close eye on their API balance during development. The upstream plugin kte66/dsh-balance is no longer maintained and has practical defects such as improper key handling and missing origin validation. ushio155/dsh-composer-balance is a replacement implementation for that plugin. It fixes these issues while preserving the most intuitive UX: a persistent balance display on the left side of the input box toolbar.

Core Features

This plugin provides the following capabilities:

  • Persistent balance display at the left end of the input box toolbar: Shows a small balance amount and an ↻ refresh button.
  • Configurable settings page: Supports setting the auto-refresh interval and the low-balance alert threshold.
  • Trigger the tool in conversation: Enter “check the balance” in the conversation to call the deepseek_balance model tool.
  • Security enhancements:
    • The API key is not written to disk; it is passed to curl via stdin and does not enter argv.
    • The Origin and Sec-Fetch-Site headers are validated; cross-origin requests receive a 403 response.
    • Fixed the issue on Windows where key mode 0o600 was not effective.

Installation and Activation

Applies to DSH loading the plugin as a file plugin (takes effect automatically when DSH starts; no approval required).

  1. Place this repository at a stable path (do not place it in the session workspace or temporary directories—if the directory is lost, DSH will fail to start because it cannot resolve the bundle):
    D:\code_practice\AI_coding\dsh-composer-balance
  1. Edit $DSH_HOME/profiles/<profile>/package.json:
    {
      "dependencies": {
        "dsh-composer-balance": "link:D:/code_practice/AI_coding/dsh-composer-balance"
      },
      "dsh": {
        "profile": {
          "bundles": [
            // …原有 bundles…
            "dsh-composer-balance"
          ]
        }
      }
    }
> Use forward slashes for Windows paths in JSON.
  1. Make it discoverable by the bundle resolver—create a directory junction:
    New-Item -ItemType Junction `
      -Path "$env:DSH_HOME\profiles\web\node_modules\dsh-composer-balance" `
      -Target "D:\code_practice\AI_coding\dsh-composer-balance"
Or run `pnpm install` directly in the profile directory.
  1. Verify resolution:
    node -e "console.log(require.resolve('dsh-composer-balance/package.json', { paths: ['$env:DSH_HOME/profiles/web'] }))"
  1. Confirm the credentials (the plugin does not hard-code the API key; if it is missing, it displays red Balance —):
    # $DSH_HOME/.credentials.yaml
    DEEPSEEK_API_KEY: sk-xxxx
  1. Restart DSH (changes on the host side require a restart; after that, only client-side changes require a page refresh).

Typical Usage

After installation, the interface and operations are as follows:

  • UI display: The left side of the input box toolbar shows a small ¥ x.xx amount + ↻; the settings page shows a “DeepSeek Balance” card.
  • Settings items:
    • Auto-refresh interval: default 60 seconds (range 5–86400 seconds).
    • Low-balance alert threshold: default ¥10; below the threshold, the number turns red and shows ⚠.
    • Hide built-in Cordis badge: disabled by default.
  • Conversation trigger: Say “check the balance” in the conversation to trigger the deepseek_balance tool, which returns the total balance by currency, bonus balance, and account availability status.

Applicable Scenarios and Notes

  • Applicable scenario: DSH developers who need continuous balance monitoring, especially users accustomed to displaying the balance in the input box area.
  • Security note: The plugin runs under DSH process permissions. The API key does not enter argv, is passed via stdin, and is not written to disk. Ensure the origin validation policy meets your expectations.
  • License: MIT.

Conclusion

This plugin addresses the upstream maintenance stoppage and security vulnerabilities, providing a more reliable balance monitoring solution.

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

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

Xiaoye