DSH Account Balance Badge
Account balance badge icon
A persistent DeepSeek Harness (DSH) Web UI
plugin that keeps the signed-in DeepSeek account balance visible in the left sidebar, with a
one-click in-app recharge action that opens DeepSeek's official top-up page without leaving the app.
中文说明
Features
- Always visible, on the left: a full-width balance row in the sidebar footer, directly above
Settings (below the shipped Cordis plugins row), so it stays visible across home, settings, and
conversation views instead of hiding inside the Account settings page.
- Recharge and bonus wallets: shows every wallet returned by the account service with the
Platform's currency formatting (CNY
¥, USD $; two decimals with digit grouping; sub-cent
amounts shown as <¥0.01). Positive bonus credit is appended as a small Bonus ¥x.xx note.
- Recharge inside the app: a compact
Top up (充值) button beside the amount opens the official
DeepSeek top-up page as an in-app native Platform view on the Desktop app, with a
"Back to DeepSeek Harness" bar; returning re-reads the balance. A plain Web UI opens the same page
in a new tab instead. The button is disabled while signed out.
- Sensible refresh: reads once on mount, refreshes every 60 seconds while the page is visible,
on window focus, when the row is clicked, and after returning from the top-up page. Reads are
in-flight deduplicated.
- Localized and theme-aware: English and Chinese copy follows the interface language; colors
use the host theme tokens, so light and dark themes and the collapsed 36 px rail both work.
- Credentials never reach the browser: the balance is read through the Host account service via
the Client Remote
account.getBalance method, and the top-up page is a Desktop-owned native view
authenticated by the Desktop's own Platform session — no raw account tokens are exposed to the page.
Requirements
- DSH
>=0.2.1-rc.2 <0.3.0-0 (verified on DSH 0.2.1-rc.2).
- A profile-managed DSH installation (the Desktop app, or
dsh web launched with a profile), with
the shipped Web UI plugins enabled (the sidebar, locale, and account controller are part of the
standard Web app).
- A signed-in DeepSeek account for amounts; a signed-out installation shows the localized
"signed out" state instead of an amount and keeps the recharge action disabled.
- In-app recharge needs the Desktop app: it uses the preload-owned
dshPlatform bridge to host
the official page in a native view. A plain browser build opens the deployment's top-up URL in a
new tab instead.
Install
The plugin is distributed from GitHub —
repository ·
latest release.
It is not on npm yet, so install it from the Git address or from the release tarball.
A step-by-step macOS walkthrough (both languages) lives in
docs/INSTALL-macOS.en.md and docs/INSTALL-macOS.md.
From the DSH Web UI (recommended)
- In DSH, select Plugins in the left sidebar.
- Click Add plugin (or the arrow → Install a third-party plugin).
- Enter one of:
- a Git address:
github:NebulaXIX/dsh-account-balance-badge (tracks main), or
github:NebulaXIX/dsh-account-balance-badge#v0.2.0 to pin the release
- the release tarball: the absolute path to
dsh-account-balance-badge-0.2.0.tgz
- an absolute path to a local checkout
- Click Install.
- When installation finishes, choose Enable now. A profile with HMR recomposes immediately;
otherwise restart DeepSeek Harness. The balance row appears in the left sidebar footer.
The Desktop app manages the desktop profile itself, so the Plugins UI is the only supported
install route there.
With the dsh CLI
Requires the dsh CLI and pnpm on your PATH; start DSH once first so the target profile exists.
--profile is required, and desktop is reserved for the Desktop app:
# Git, tracking main
dsh plugin --profile web add github:NebulaXIX/dsh-account-balance-badge
# Git, pinned to the v0.2.0 release
dsh plugin --profile web add "github:NebulaXIX/dsh-account-balance-badge#v0.2.0"
# the tarball attached to the GitHub release
dsh plugin --profile web add ./dsh-account-balance-badge-0.2.0.tgz
# a local checkout (absolute path in the UI; relative paths resolve from the invoking directory)
dsh plugin --profile web add ./path/to/dsh-account-balance-badge
This package is plain JavaScript with no dependencies and no build script, so a Git install needs no
pnpm build-script approval. dsh plugin ... add also appends the bundle to the profile's bundle
list, so no manual patch editing is needed.
Not on npm yet. dsh plugin ... add dsh-account-balance-badge (the package name) only works
after an npm release; until then use the Git address or the release tarball above.
Update / uninstall
Third-party plugins are upgraded by uninstalling and reinstalling the new version — in the Web UI
from the bundle page (Uninstall, then install again), or with the CLI:
dsh plugin --profile web remove dsh-account-balance-badge
dsh plugin --profile web add "github:NebulaXIX/dsh-account-balance-badge#v<new-version>"
Usage
- The row shows a wallet icon, the localized label, and the current balance(s).
- Click the row to refresh; it also refreshes when the window regains focus and every 60 seconds
while the page is visible.
- Click Top up (充值) beside the amount to recharge: on the Desktop app the official DeepSeek
top-up page opens inside the application window under a "Back to DeepSeek Harness" bar, and
returning re-reads the balance; in a plain Web UI the same page opens in a new tab.
- Loading, signed-out, and failed-but-retryable states are shown in place; the row never fabricates
a zero balance. If the page fails to load, the return bar stays available with a localized error
and a Retry action; Escape also returns.
- The row expands to a full-width 42 px row when the sidebar is wide and becomes a compact 36 px
icon in the collapsed rail (the accessible name and tooltip carry the amount). On Windows Desktop
the shipped shell hides the whole sidebar footer while the sidebar is collapsed, so the row is
hidden there just like the Settings and Cordis rows.
How it works
| Half | File | Role |
|---|
| Host | index.js | Empty bundle half: carries the Loader row only, adds no Host capability, tool, or prompt surface. |
| Client | client.js | Registers the row in sidebar.footer.action and one page host in shell.overlay; reads balances through ctx.remote.account.getBalance; asks the Desktop preload bridge (globalThis.dshPlatform) to host the top-up page and renders the row, the return bar, and the component-local stylesheet. |
| Loader patch | cordis.patch.yml | Inserts the account-balance-badge row named after this package. |
| Display metadata | locale/en.json, locale/zh.json, icon.svg | Plugin Manager title, description, and icon. |
The balance read is a Host-to-Platform query performed by the account service; the browser only
receives wallet amounts (currency and decimal strings). The recharge page is not rendered by this
plugin at all: the Desktop owns the native WebContentsView and its Platform credentials, while the
plugin only contributes the 48 px return bar and reports the measured viewport rectangle
(open / setBounds / close on the preload bridge).
Development
The plugin is plain JavaScript with no build step and no dependencies:
index.js is an ES module exporting apply().
client.js is a lazy browser module in the window.__ModuleLoader__.load({ id, factory }) format;
it is served as-is, so keep it valid plain JavaScript (no JSX/TypeScript/import). Its factory
resolves only react and react-dom from the page's frozen module table (no npm dependencies);
react-dom is used solely to portal the recharge overlay out of the shell.overlay layer, the
same approach the shipped account page uses.
git clone https://github.com/NebulaXIX/dsh-account-balance-badge.git
cd dsh-account-balance-badge
npm test # zero-dependency manifest/structure checks
Install your checkout as a bundle with the local-path option in the Plugins dialog (or
dsh plugin --profile web add /absolute/path/to/checkout). The Web UI picks up client changes through
HMR while the bundle is link-installed; a full page refresh loads the latest bundle if HMR is
unavailable.
Refresh interval
The background refresh cadence is the REFRESH_INTERVAL_MS constant at the top of
client.js (default 60000 ms). Change it in a local checkout if you prefer another cadence; the
row still refreshes on click and on window focus.
Publishing this plugin (maintainers)
The public repository is https://github.com/NebulaXIX/dsh-account-balance-badge. Releases are
tagged vX.Y.Z and carry the npm pack tarball as a release asset, which is what users install.
- Bump
version in package.json and add an entry to CHANGELOG.md.
- Run
npm test (scripts/check.mjs, zero dependencies) and npm pack --dry-run; the tarball must
contain index.js, client.js, cordis.patch.yml, icon.svg, locale/en.json, and
locale/zh.json (plus README/LICENSE/CHANGELOG, which npm always includes; scripts/,
docs/, and .github/ are intentionally not shipped).
- Commit on a
dev/<task> branch, run npm test again, then merge into main.
- Tag and push:
git tag v<version> && git push origin main --tags.
- Pack and publish the release with the tarball attached:
npm pack --pack-destination dist then
gh release create v<version> dist/dsh-account-balance-badge-<version>.tgz --title "v<version>" --notes-file <notes>.
- Optional npm publication (makes the package-name install route work):
npm publish --access public — the package name dsh-account-balance-badge is currently free on
the registry, but publishing needs a logged-in npm account.
- If the package is ever renamed, change it in three places and keep them identical:
package.json name, the cordis.patch.yml row's name, and the id passed to
window.__ModuleLoader__.load(...) in client.js.
License
MIT