dsh-peak-bar: Title Bar Peak/Valley & Balance Capsule

Introduction

When using the DeepSeek API for daily development, billing periods are not uniform: weekday daytime is typically peak pricing, while other times are charged at off-peak rates, roughly half the price. Balance and “how much did I actually spend today” are scattered across account pages, consoles, or third-party widgets, requiring window switching just to glance at them. DeepSeek Harness (DSH) splits the UI and capabilities into installable plugins; within the DSH window, what you need most is to confirm whether it’s currently peak or off-peak, how long until the switch, whether the balance is sufficient, and how much has been used today—all without leaving the current conversation. Below is an introduction to the client plugin dsh-peak-bar by maintainer Woo3aN, which collects these pieces of information into a clickable capsule centered in the title bar.

What Is This

dsh-peak-bar is a client plugin for DSH (category: client). The current package version is 0.3.0, and the README indicates it is still pre-release (0.x); CSS variable names and directory structure may change. The plugin renders a capsule in the center of the window title bar, displaying DeepSeek API peak/off-peak periods, countdown to the next switch, account balance, and today’s usage. The color scheme by default follows the current DSH skin (the stylesheet does not hardcode color literals; variables fall back to host --dsw-alias-* tokens). Clicking the capsule opens a detail panel in the main area; closing it in the upper right corner returns to the conversation. The project uses the MIT license; source code and documentation are available at GitHub, and the community directory page is SkillHub entry.

Core Features

Title Bar Capsule and Detail Panel

The capsule displays the peak/off-peak status, countdown, balance, and today’s usage in one line. When the remaining time exceeds one hour, the countdown shows only up to minutes (e.g., 59 hours 24 minutes); within the last hour, it shows down to seconds (e.g., 18 minutes 57 seconds). The title bar slot uses pointer-events: none—only the capsule is clickable, while the rest of the area remains draggable for window movement. Implementation mounts via shell.overlay (rather than shell.leading, which has no corresponding slot on Windows). On Windows, it sits on the same line as the minimize/close buttons, to their left; the README states that the measured horizontal center is approximately 49.9%.

Peak/Off-Peak Rules (Beijing Time)

Period Billing
Monday to Friday 09:00–12:00, 14:00–18:00 Peak pricing
All other periods Off-peak pricing (approximately half of peak pricing)
Statutory holidays All-day off-peak pricing

The statutory holiday table currently only covers 2026; from 2027 onward, if not updated, holidays may be counted as peak periods, and the detail panel will display a notice.

Balance Reading and Privacy

Two paths are attempted in order, with consistent semantics (top-up + credit):

  1. Account login session: ctx.remote.account.getBalance(), the same path as DSH’s built-in “Account & Balance”.
  2. API key: When the account path is unavailable, the Host provides /dsh-peak-bar/balance, which resolves DEEPSEEK_API_KEY from the DSH credential service to directly connect to the official endpoint. Only the total amount and currency are returned; the key does not leave the Host.

Data is not sent to third parties; the panel indicates which path the current balance came from. When no API key is configured, it displays “API key not configured” (a configuration fact, not an error). When both paths fail, the capsule and panel provide separate reasons; on read failure, the capsule writes a short reason rather than silently showing --. If the failure persists for more than 2 minutes, a “Balance not refreshed” marker is attached; the full reason appears in the hover tooltip and detail panel. Polling is normally 60 seconds; on failure, it backs off as 15s → 30s → 60s, retrying immediately when the network recovers or the window becomes visible again.

Today’s Usage

The official account API provides balance rather than bills, so the plugin accumulates consumption based on balance decreases: the difference between two reads is counted as consumption; increases due to top-ups/credits are neither counted nor erase recorded consumption. Daily accounting follows Beijing Time. The ledger is semi-persistently stored by the Host at <DSH_HOME>/.dsh-peak-bar.json (default ~/.dsh/), retaining the last 14 days. When the Host route is unavailable, it falls back to “current session statistics” (losing history, but the feature remains functional).

Language and Color Scheme

There is no independent language switch; it follows DSH Settings → General → Language (Chinese / English). To customize colors, simply override variables such as --dsh-peak-bar-* (e.g., --dsh-peak-bar-bg, --dsh-peak-bar-peak, --dsh-peak-bar-offpeak, etc.). Unoverridden items continue to follow the skin. The README provides examples for skin authors and three ready-made color schemes.

Installation and Activation

The README lists multiple installation methods; after changing configuration or switching packages, you must fully restart the DSH process (refreshing the page alone is insufficient, as the Host snapshots client artifacts into memory upon activation).

  1. Release attachment: Download dsh-peak-bar-<version>.zip, unzip it, and point to that directory when adding the plugin.
  2. Local directory: In DSH, go to Plugins → Add Plugin and enter the absolute path of the directory.
  3. tgz: Run npm pack in the source directory, then install via “Add Plugin → tgz”.
  4. Command line (when profile is web):
dsh plugin --profile web add "<path or package name>"

Replace "<path or package name>" with the local unzipped directory, the .tgz generated by npm pack, or the Release package path.

Before installing, it is recommended to browse the repository source code and the MIT license yourself; the plugin runs with the current DSH process privileges and involves local credentials and API access.

Typical Usage

For daily use, no additional configuration is needed to view peak/off-peak status and balance in the title bar; click the capsule when details are needed to open the panel.

  • Skin switching: After installing a semantic token skin such as Rhine Lab, the capsule color automatically follows it. To change only a few variables, override --dsh-peak-bar-* in the skin CSS as described in the README.
  • Position adjustment (class names are not public contracts; verify after upgrades): For example, use .dshPeakBarSeat to center it on the whole window or place it flush against the left side of the window buttons.
  • Developer self-check: Run npm test in the plugin directory; the three offline test suites (peak / render / host) do not depend on the real ~/.dsh.

Applicable Scenarios and Notes

Suitable for developers who frequently call the DeepSeek API within the DSH desktop client and want to glance at peak/off-peak status and balance. The README states that current testing was primarily conducted on Windows official client + DSH 0.2.0-rc.2; macOS, Linux, and pure browser mode are untested. “Today’s usage” is an estimate derived from balance differences, not a platform bill. The client version field in plugin requests is 'unknown' (inlined in official builds, unavailable to third-party plugins). The community directory SkillHub and GitHub are maintained by the community and have no official affiliation with DeepSeek / High-Flyer.

Conclusion

dsh-peak-bar collects peak/off-peak countdown, balance, and today’s usage into a single capsule in the title bar, with failure explanations, skin-following colors, and Host-persisted state to avoid losing page storage due to port and origin changes. To install or contribute to the holiday table and skin adaptations, visit https://www.skillhub.cn/plugins/Woo3aN/dsh-peak-bar and https://github.com/Woo3aN/dsh-peak-bar.

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

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

Xiaoye