dsh-balance-sentinel Balance Sentinel

Introduction

When developing or running agents with DeepSeek Harness (DSH), an insufficient balance can cause calls to be interrupted, requiring manual checks and top-ups. This is especially easy to overlook in multi-instance or long-running scenarios. dsh-balance-sentinel addresses this by monitoring your DeepSeek account balance during DSH execution and pushing alerts to IM platforms like Feishu/Lark, DingTalk, etc., when the balance drops below a threshold.

Plugin Overview

This is a DSH plugin that provides DeepSeek balance monitoring and two-tier low-balance alerting. Maintained by liancheng2020, it is categorized as a networking tool. Its core value: automatically pushes alerts when the balance falls below a threshold, and sends a “recovered/cleared” message after you top up or adjust the threshold. It runs only within the local DSH process and stops when the process is closed. It supports host-account authentication so no API Key is required.

Core Features

  • Two-tier threshold alerts: By default, a “Warning” is pushed when the balance drops below ¥20, and a “Critical” alert is pushed below ¥5 (account currency, adjustable in the panel). A single “Recovered/Cleared” message is sent when the balance rises back above the threshold after a top-up or threshold adjustment.
  • No spam: Same-level alerts are not re-sent; recovery messages have a 10-minute cooldown; undelivered alerts are silently cancelled; quiet-hour alerts are deferred and merged into a single message upon window exit.
  • Failure tracking: Pending alerts are persisted; business failures trigger a 10-minute backoff and suspend after 3 attempts (manual retry available); undetermined delivery status suspends immediately; the “deduplication cannot be guaranteed” notice only appears when even the deduplication receipt cannot be written.
  • No deadlocks, no duplicate pushes across instances: A 15s timeout on queries, scheduling continues after exceptions; when sharing DSH_HOME, a full-cycle lock + disk-level merge ensures each state transition triggers only one push.
  • Multi-channel support: WeCom / DingTalk / Feishu Card / Bark / ServerChan / Telegram / Generic Webhook. The panel follows the host’s light/dark theme.

Installation & Enablement

Requirements: DSH ≥ 0.2.1-rc.2, Node ≥ 18.

# Install directly from GitHub repo (recommended)
dsh plugin --profile web add github:liancheng2020/dsh-balance-sentinel
# Or via npm
dsh plugin --profile web add dsh-balance-sentinel
# Or a pinned release tarball
dsh plugin --profile web add https://github.com/liancheng2020/dsh-balance-sentinel/releases/download/v0.1.6/dsh-balance-sentinel-0.1.6.tgz

Restart DSH once after installation. Desktop app: Settings → Plugins → Add Plugin, then enter dsh-balance-sentinel or github:liancheng2020/dsh-balance-sentinel.

First-Time Setup

  1. Open the “Balance Sentinel” panel to view the official balance or the explicit reason for unavailability (not logged in / no account service / network issue).
  2. Click “Configure Now” → select a channel → paste the webhook URL (auto-detected) → save and send a test. Feishu/DingTalk fields include “How to obtain the Bot Webhook” and the applicable security settings for that channel.

If no channel is configured, monitoring runs but no pushes are sent. A successful save only means “configured” — the panel shows “Last test succeeded” only when a test is actually delivered; failures include the reason. Switching channels immediately clears previous test results. If the balance is already below the threshold at the time of first connection, a one-time current-status message is sent.

Configuration (Optional)

Thresholds and channels can also be modified in the panel; changes take effect immediately upon saving. If the panel covers your needs, there’s no need to edit this config file.

- id: balance-sentinel
  name: dsh-balance-sentinel
  config:
    balance:
      enabled: true                # Disabling stops monitoring; panel becomes display-only
      pollSeconds: 60              # Minimum 60
      warn: 20                     # Warning threshold (account currency)
      critical: 5                  # Critical threshold; must be less than warn
      timezone: Asia/Shanghai
      quiet: { start: "", end: "" }  # Quiet hours, e.g. "23:00"–"08:00"
      apiKey: ""                   # Legacy host fallback only
    notify:
      signatureText: ""            # Optional: custom footer; only appended if non-empty
    localApi:
      enabled: true                # Panel bridge on 127.0.0.1:17430; can be disabled

Privacy & Compliance

  • State and webhook credentials are stored only on the local machine at $DSH_HOME/balance-sentinel/ (directory permissions 0700); nothing is uploaded, and telemetry is off by default.
  • The local bridge binds to 127.0.0.1 only, rejects cross-origin requests, and does not expose the webhook URL or secret. Balance queries go through the host account service or the official /user/balance endpoint, with 60s+ intervals and backoff on failure. Code is MIT-licensed.

Use Cases

Ideal for users who run DSH long-term, especially in multi-instance or unattended scenarios. The plugin runs with the current DSH process permissions — review the source code and license before installing.

Summary

dsh-balance-sentinel provides DeepSeek balance monitoring with two-tier low-balance alerts, supports IM push notifications via Feishu/Lark, DingTalk, and more, stores data locally only, and has no telemetry by default. It is well-suited for users who need to monitor their balance and avoid service interruptions.

  • Plugin directory: https://www.skillhub.cn/plugins/liancheng2020/dsh-balance-sentinel
  • GitHub: https://github.com/liancheng2020/dsh-balance-sentinel
羽毛球分组比赛记分
小程序二维码

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

Xiaoye