dsh-plugin-balance-badge
其他 活跃维护

dsh-plugin-balance-badge

reg4916/dsh-plugin-balance-badge

轻量级余额显示插件,以常驻胶囊形式悬浮于主界面,自动定时同步账户余额,数据与设置页账户完全同源,可见数字准确一致,无需手动刷新。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
JavaScript
主要语言
MIT
开源协议
120 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:reg4916/dsh-plugin-balance-badge
git clone https://github.com/reg4916/dsh-plugin-balance-badge.git
git clone git@github.com:reg4916/dsh-plugin-balance-badge.git
README.md main

dsh-plugin-balance-badge

DeepSeek Harness
npm
license

Listed in the Awesome DSH Plugin catalog

Always-visible DeepSeek account balance for DeepSeek Harness. A small pill in
the top-left window strip of the sidebar shows the same Topped-up balance as
Settings → Account, and keeps itself up to date.

The balance pill in the sidebar window strip

⬤ ⬤ ⬤        ⌄
   ●  ██ $16.59        ← the balance pill (macOS window strip)
   🐋 deepseek HARNESS
   ⊕ Новая сессия

Features

  • Same number as Settings → Account — reads the DeepSeek account Remote, not a
    separate/provider-specific API.
  • Refreshes itself: on load, every 60 s while the page is visible, immediately when
    the window regains focus, and immediately when the stored account credential changes
    (sign-in, sign-out, grant rotation). Click the pill to refresh on demand.
  • Backs off when the network does: a failed read retries after 15 s, then 30 s, 60 s and
    at most 120 s, so an outage is not polled at the normal cadence. One success resets it.
  • Freshness you can see: the tooltip reads Updated 11:34 PM (5 min ago) and keeps the
    relative part current without spending a request.
  • Honest states: … while loading, -- when signed out / unavailable, and the last
    known amount plus a "stale" hint when a refresh fails — never a fake zero.
  • Bonus balance is shown separately in the tooltip (only when positive), exactly like
    Settings → Account; it is never added to the topped-up amount.
  • Localized (en / ru / zh) and styled with Harness theme tokens, so it follows the
    active theme and language.
  • Accessible by default: the amount is a polite live region, so it is announced when it
    changes; the pill keeps a focus ring and a descriptive aria-label.
  • Pure presentation: no tools, no config, no Host service of its own.

Requirements

  • DeepSeek Harness 0.2.x with the DeepSeek account feature available
    (the same feature that renders Settings → Account).
  • On the macOS desktop build the pill sits in the window strip; on Web/Windows/Linux
    shells it is placed beside the Settings row at the sidebar foot instead.

Install

From npm (prebuilt, recommended)

dsh plugin --profile <profile> add dsh-plugin-balance-badge

An npm install is prebuilt: no repo download, no allowBuilds approval, and a
download figure on the storefront. Use the GitHub spec below only to pin a
commit that is not published yet.

From the GUI (Desktop and Web)

Settings → Plugins → Add plugin, then paste one of:

dsh-plugin-balance-badge
github:reg4916/dsh-plugin-balance-badge
github:reg4916/dsh-plugin-balance-badge#v1.0.2

The Desktop app owns its profile, so this (or an agent using the plugin_manager
tool) is the supported path there.

With an agent (plugin_manager tool)

Ask the agent to run install_bundle with the target
dsh-plugin-balance-badge (or the GitHub spec
github:reg4916/dsh-plugin-balance-badge). It installs the package, selects the
bundle, and applies it through the profile's HMR when available.

From the CLI (non-managed profiles)

dsh plugin --profile <profile> add dsh-plugin-balance-badge

Manual (development)

git clone https://github.com/reg4916/dsh-plugin-balance-badge.git
# in your profile package.json: "dsh-plugin-balance-badge": "link:/abs/path/to/clone"
# and append "dsh-plugin-balance-badge" to "dsh.profile.bundles"
ln -s /abs/path/to/clone <profile>/node_modules/dsh-plugin-balance-badge

Restart the app once if the profile's HMR is not running; afterwards client-plugin
edits are picked up by the running page.

Uninstall

Remove the dependency entry and the bundle name from the profile package.json,
remove node_modules/dsh-plugin-balance-badge (and the lockfile importer entry if
you edited it by hand), then restart the app.

How it works

Piece Detail
Data ctx.remote.account.getState() (local credential read) → ctx.remote.account.getBalance({ version, locale, timezoneOffsetSeconds }) only while signed in
Host chain accountController → deepseekAccount → Platform GET /api/v0/users/get_user_summary (normal_wallets / bonus_wallets)
Placement (macOS) frame slot shell.overlay, entry balance-badge, fixed at the window strip next to the traffic lights
Placement (other) sidebar.footer.action, beside Settings (rail-aware)
Rendering plain React from the page module table; no @deepseek-ai/* import
Refresh one shared poller per plugin (single-flight, 15 s floor, stale results dropped, paused while hidden, 15→120 s backoff while reads fail)

The module is a browser artifact for the Harness module table
(window.__ModuleLoader__.load({ id, factory })) plus an empty Host row
(index.js = export function apply() {}).

Development

node test/contract.test.mjs     # loads client.js with a stubbed page and asserts
                                # registration, live data flow, formatting and states

Publishing

npm login          # once per machine
npm publish        # unscoped name, publishes as public 1.x

publish.yml also publishes from GitHub Actions with npm provenance and needs
the repository secret NPM_TOKEN (an npm automation token); run it from
Actions → publish → Run workflow. Keep the package repository field
pointing at this repo — the registry links npm packages to entries that way.

.
├── package.json         # dsh.bundle.patch + dsh.client manifest
├── cordis.patch.yml     # inserts the balance-badge row into the profile layer stack
├── index.js             # Host half (no Host service)
├── client.js            # browser half: dictionaries, stylesheet, poller, pill
├── locale/{en,ru,zh}.json
├── icon.svg
├── test/contract.test.mjs
├── CONTRIBUTING.md / SECURITY.md
└── .github/       # issue + PR templates, CI (`test.yml`), publish workflow

Tuning: POLL_MS, MIN_GAP_MS, RETRY_BASE_MS, RETRY_MAX_MS, RELATIVE_TICK_MS in client.js.

Changelog

See CHANGELOG.md. The catalog entry and the Plugin Market point at the
newest published version, so dsh plugin --profile <profile> add dsh-plugin-balance-badge
always installs the release described there.

Русский

Плагин показывает баланс аккаунта DeepSeek маленькой «таблеткой» в верхней полосе окна
рядом с кнопками управления (на macOS) — тот же Topped-up balance, что в
Настройки → Аккаунт. Обновляется сам: при запуске, раз в 60 секунд, при возврате
фокуса в окно и при смене учётной записи; по клику — принудительное обновление, при
наведении — бонусный баланс и давность обновления («5 мин назад»). Если чтение
не удалось, следующий запрос откладывается
(15 → 30 → 60 → 120 с), чтобы не долбить платформу во время сбоя. Установка:
Настройки → Плагины → Add plugin → dsh-plugin-balance-badge.

Contributing & security

Bug reports and pull requests are welcome — see
CONTRIBUTING.md for the development loop and the ground rules.
Please report security issues privately per SECURITY.md, not in a
public issue.

License

MIT