dsh-account-balance-pill: Display DeepSeek Account Balance in Composer Footer

Preface

When running sessions in DeepSeek Harness (DSH), the stats line below the input box already displays turns, steps, tokens/s, usage, and the context ring. However, to see how much balance remains in your account, you currently have to switch to Settings → Account. If you want to see “how much is left to spend” at a glance while writing Composer messages, without wanting the plugin to store credentials or initiate separate network requests, the community-maintained client plugin dsh-account-balance-pill (maintainer azkbzxf) embeds the official account Remote’s balance reading into the same bottom bar.

What is this

dsh-account-balance-pill is a bundle plugin for DSH: The Host side inserts a line via dsh.bundle.patch (effectively a no-op), while the Web Client side registers an entry (id account-balance) alongside the built-in activity and usage in the conversation.composer.dock slot. Data comes from DSH’s built-in ctx.get('remote.account').getBalance(...), which is the same source as the settings page account panel; the plugin does not store data, read credential files, or initiate network requests on its own.

Bottom bar schematic (ASCII example from README):

[welcome icon] Balance ¥12.34        [stats] 1 turn 160 steps · 254 tok/s     [usage] 10.9M tok · Cache hit 98%   (ring) 9%

The pill displays the total spendable balance (top-up + gift, merged by currency), e.g., Balance ¥17.34; hovering shows the top-up/gift breakdown and last refresh time, with a hint that clicking refreshes it.

  • Package Name: dsh-account-balance-pill
  • Category: Client (DSH Plugin Directory SkillHub Entry)
  • License: MIT (package.json version 1.0.0)
  • Dependencies & Build: No extra dependencies, no build step

Core Features

Display Rules

Account Status Bottom Bar Behavior
Logged in with balance Wallet icon + Balance ¥12.34; tooltip contains top-up/gift breakdown, update time, click-to-refresh hint
Not logged in or Remote returns null Not displayed (no placeholder, no error)
Read failure (offline, Host rejection, etc.) Retains last known value and fades it to mark as stale; if never successfully read, remains hidden
Multi-currency CNY uses ¥, USD uses $; top-up and gift are merged by currency, CNY prioritized

Amounts are truncated to cents, consistent with the official settings page to avoid displaying more than actually available; thousands separators are used. 0 is displayed as ¥0.00, and less than one cent is displayed as <¥0.01.

Refresh Timing

  1. Fetched immediately after the pill mounts;
  2. Polls every 30 s when the page is visible (skipped when hidden, catches up once when visible again);
  3. Approximately 1.5 s after a conversation turn ends (when sessionStats steps changes);
  4. When the window regains focus or the page becomes visible (only if data is older than 15 s);
  5. When the account Remote appears (late loading);
  6. When the user clicks the pill.

At most one request is in flight at any moment; the minimum interval between requests is 3 s; on failure, it automatically recovers after exponential backoff (4 s to 60 s).

Compatibility & Implementation Notes

  • Targets the DSH Web GUI (shared by DSH Desktop and dsh web); README states verification on DSH Desktop 2.0.18 and client 0.2.1-rc.2.
  • Uses only conversation.composer.dock and the official account Remote; does not replace or rewrite existing UI, does not read other plugin DOMs, and does not mount to document.body.
  • Styling uses Harness theme tokens (--dsw-* / --dsh-*); text switches with the interface language via DSH client locale (zh/en).
  • If there is no account Remote, the plugin loads but remains hidden; rendering errors are caught by an error boundary within the entry’s scope, not affecting the rest of the dock.

Known Limitations

  • Balance comes from the DeepSeek account platform and may lag by several seconds; it is not ledger-level real-time.
  • The dock row is only rendered when the session Composer is visible (consistent with built-in slot behavior).
  • If the platform fails continuously, the plugin backs off and logs a console warning on the first failure, without popping up a dialog.

Installation & Activation

Install from GitHub under the profile you are using (command from official README):

dsh plugin --profile <profile> add github:azkbzxf/dsh-account-balance-pill

The newly added bundle activates on the currently running instance (Host side takes effect immediately, Client side hot-loads into already open pages). If replacing an installed copy, restart DSH to load the new client build.

In DSH Desktop, you can also install via the plugin manager using a local directory:

{ "action": "install_bundle", "target": "D:\\path\\to\\dsh-account-balance-pill" }

Uninstall:

dsh plugin --profile <profile> remove dsh-account-balance-pill

Typical Usage & Adjustable Parameters

No configuration is needed by default: After logging into your DeepSeek account, open a session with the Composer, and the balance pill will appear in the bottom bar; click it to manually refresh.

To adjust the polling interval (milliseconds, limited to 5 s~1 h), you can set it in the page global settings:

window.__DSH_ACCOUNT_BALANCE__ = { intervalMs: 60000 };

For development, an offline smoke test is available (does not depend on real DSH):

node test/harness.mjs client.js

Key files: client.js (Client half), index.js (no-op Host), cordis.patch.yml (bundle patch), locale/{en,zh}.json, icon.svg.

Use Cases & Notes

Suitable for developers who converse in DSH Desktop or dsh web for long periods and want to see the account balance in the same row as turns/usage. The plugin runs with the permissions of the current dsh process; before installation, please review the GitHub repository source code and MIT license to ensure it meets your security and compliance requirements. The DSH ecosystem emphasizes “everything is a plugin”; community directories like SkillHub are independent sites and have no official affiliation with DeepSeek / Hithink RoyalFlush.

Conclusion

dsh-account-balance-pill connects the account balance from the same source as the settings page to the Composer bottom bar, reusing the official Remote with no self-built credentials or requests, and defines clear display and refresh behaviors for login, failure, and multi-currency scenarios. To learn more, see the plugin directory page and the repository README:

  • Directory Page: https://www.skillhub.cn/plugins/azkbzxf/dsh-account-balance-pill
  • GitHub: https://github.com/azkbzxf/dsh-account-balance-pill
羽毛球分组比赛记分
小程序二维码

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

Xiaoye