rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:jeremytenjo/dsh-plugin-balance-indicator
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Shows how much DeepSeek Platform balance you have left, in the left sidebar footer just above the account row.
The badge reads ¥12.34 / $12.34 from your signed-in DeepSeek account, refreshes every 60 seconds and when the window regains focus, and opens platform.deepseek.com/usage when clicked. The refresh button beside the amount forces an immediate read. Bonus credit, per-currency breakdown, and the last refresh time appear on hover.
usageUrl.Sign in when no DeepSeek account is connected, Unavailable when the query fails (click to retry), and no fake zero balance.0.2.1-rc.2 (the version this plugin was built against).platform.deepseek.com.git clone https://github.com/jeremytenjo/dsh-plugin-balance-indicator.git
dsh plugin --profile desktop add ./dsh-plugin-balance-indicator
Restart the Host or reload the page, then start or open a session. The badge appears at the bottom of the left sidebar, above the account row. Replace desktop with the profile name shown by dsh --profile <name> --dump-config.
Manual installation is also possible: add the package directory to the profile's dependencies as a link:, add it to dsh.profile.bundles, and run the profile's package install. Prefer the plugin command; it owns those files.
| State | Footer badge | Badge click |
|---|---|---|
| Signed in, balance loaded | ¥12.34 |
Opens the Platform usage page |
| Balance with bonus credit | ¥12.34 (hover for bonus lines) |
Opens the Platform usage page |
| Not signed in | Sign in |
— |
| Query failed | Unavailable |
Retries |
| First load | Balance… |
— |
The refresh button sits directly beside the amount and works in every state. It asks the Host for a forced read (refresh=1, bypassing the 20-second cache), spins while that read runs, and changes its label from “Refresh balance” to “Refreshing balance…” for screen readers. If a poll is already in flight, a refresh click cancels it and restarts with the forced read, so the button never returns a stale cached amount.
Hovering the badge shows every wallet currency, bonus wallets with a positive balance, the last successful refresh time, and the click hint.
The badge uses the sidebar footer's own 42px action row, radius, and theme tokens, so it inherits light and dark themes without configuration. The sidebar footer is a single row shared with the shipped Plugins launcher: the balance and its refresh button take only their content width and sit first, and they stay hidden while the sidebar is collapsed to the 56px rail (the cached balance reappears immediately on expand).
client.js ── GET /__dsh/deepseek-balance ──▶ index.js
│
├─ ctx.deepseekAccount.getState()
└─ ctx.deepseekAccount.getBalance(client)
│
▼
platform.deepseek.com
index.js is the Host half. It registers one exact loopback route and calls the Harness account service, which already owns the Platform credential and the /api/v0/users/get_user_summary query. The plugin never reads the credential store, never logs a token, and returns only:
{
"ok": true,
"status": "ready",
"wallets": [{ "currency": "CNY", "balance": "12.34" }],
"bonusWallets": [{ "currency": "CNY", "balance": "2.00" }],
"links": {
"usageUrl": "https://platform.deepseek.com/usage",
"topUpUrl": "https://platform.deepseek.com/top_up"
},
"fetchedAt": 1790000000000
}
The route accepts loopback requests only, rejects a foreign Origin and cross-site fetches, sends cache-control: no-store, and caps the wallet list and string lengths. Account query failures are not cached, so a retry or the next poll recovers; successful reads are cached for 20 seconds to coalesce multiple windows.
client.js is the browser half. It registers a lazy factory with the package name, adds a sidebar.footer.action entry with order -1 (before the shipped Plugins launcher), and registers its English and Chinese strings through the client locale service. The slot passes the sidebar's wide flag: the badge renders only while the sidebar is expanded, because the collapsed 56px rail already holds the Plugins launcher.
The badge's state lives in one TanStack Query entry keyed by language and timezone, with the route response as its data:
staleTime: 20s matches the Host cache, so a focus refetch only asks again once that cache could have moved.refetchInterval: 60s polls while the window is visible; refetchOnWindowFocus and refetchOnReconnect cover the gaps.refetch() with the route's refresh=1 flag; the query's own retry loop is disabled so a failure is reported immediately instead of after backoff.refetch(). It is not disabled while fetching, so keyboard focus is never dropped; instead the icon spins, the accessible label changes, and the 60-second interval restarts after the read.status: "failed") is cached as data, not as an error, so the failed state appears immediately and the 60-second poll recovers on its own. A network error after a successful load keeps the last known amount visible instead of replacing it.QueryClient is created per enabled plugin instance, provided to the badge's subtree, and cleared in the effect cleanup when the plugin is disabled. The cached entry survives collapsing the sidebar, so expanding again shows the last amount while any stale fetch runs.src/client.js is the editable source. scripts/build-client.mjs bundles it with esbuild into client.js, keeping React external so the page's shared module table supplies it and TanStack Query bundled in, since the table does not provide it. Do not edit client.js directly.
None. The Platform origin belongs to the Harness account provider; this plugin follows it rather than hard-coding an API host. The usage fallback is https://platform.deepseek.com/usage and is used only if the account supplies no link.
pnpm install
pnpm run build
node --check index.js
node --check client.js
pnpm install brings the build toolchain. esbuild is build-only; TanStack Query is compiled into client.js rather than loaded as a separate page module. pnpm run build bundles src/client.js into the module-loader artifact client.js. Editing the Host half or src/client.js and reloading the plugin (Settings → Plugins → disable/enable) or restarting the Host is enough after a build. The locale metadata in locale/*.json supplies the Plugin Manager title, description, and icon.
Files:
index.js — Host route, cache, account calls, origin checks.src/client.js — sidebar footer badge source: query definition, formatting, refresh control, tooltip, locale dictionaries.scripts/build-client.mjs — esbuild bundle wrapped in the __ModuleLoader__ factory.client.js — generated browser bundle; do not edit.cordis.patch.yml — inserts the deepseek-balance-indicator row.locale/en.json, locale/zh.json — Plugin Manager metadata.icon.svg — original wallet icon.The balance is read through the existing Harness account session. This plugin adds no credential storage, no cookies, no analytics, and no third-party requests; the browser talks only to its own loopback Harness origin. Amounts and currency codes leave the Host, but account identity, profile, token, and masked contact details do not.
Sign in.CNY for Chinese, USD otherwise) and lists the rest in the tooltip.MIT © 2026 Jeremy Tenjo
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek、deepseek-harness。