dsh-plugin
DayuanJiang/next-ai-draw-iodsh 的 draw.io 绘图插件:通过 next-ai-drawio MCP 服务器作图,点回复里的链接在右侧栏打开实时预览,可以手动修改图,AI 的每次修改都是可以恢复的版本。需 Node.js 18+,首次使用由 npx 下载 MCP 服务器。
新增余额查询工具,在每轮对话中注入 DeepSeek 账户余额快照与低余额省电/严重不足停机策略,并提供阈值和汇率联动换算设置页。需要已登录的 DeepSeek 账号才能读取余额,仅配置 API key 的 profile 会返回无法读取。
Balance-aware turns for DeepSeek Harness: a
check_balancetool, a durable per-step balance snapshot, and an automatic power-saving / stop policy.
AI查余额 is a DeepSeek Harness plugin that lets the model see the signed-in DeepSeek account balance while it works. It gives the model an explicit balance tool, appends a compact balance snapshot to every model step, and turns the configured balance thresholds into a concrete output-budget and stop policy.
The project is independent and is not affiliated with DeepSeek.
Long agent runs can burn through a small balance while every step still looks healthy. The failure is rarely dramatic: the model simply keeps working until the account cannot pay for the next request. AI查余额 makes the remaining balance part of the model's working context, then asks it to behave differently before that happens.
GOAL.md, send one short top-up message, and stop the turn in place.check_balance agent tool — returns recharge wallets, bonus wallets, per-currency totals, the primary-currency spendable total, and the current level (ok / low / critical).GOAL.md requirements and the one-message stop behavior.$DSH_HOME/your-balance/config.json; no credentials or balance values are written into the repository.check_balance calls the Host's optional deepseekAccount service with the same account metadata used by the official account UI. It always performs a live read and returns structured data plus a readable tool card.
AI查余额:查询结果
状态:充足
主币种:CNY
可用合计:CNY 10.7562
钱包明细:
- CNY:充值 3.0838;赠送 7.6723;合计 10.7562
If the profile is signed out, uses only an API key, or the Platform endpoint is unavailable, the tool returns an explicit “unreadable” result instead of a fabricated zero.
The Host registers an agent/pre-step listener. When auto-injection is on, it appends one sourced user message to the step:
【AI查余额 · 自动余额快照】
状态:充足
主币种:CNY;可用合计:CNY 10.7562
钱包:
- CNY:充值 3.0838;赠送 7.6723;合计 10.7562
阈值:较低 2.5 CNY / 0.3472 USD / 0.2976 EUR;严重不足 0.25 CNY / 0.0347 USD / 0.0298 EUR。
本币种判定:低于 2.5 CNY 进入省电模式;低于 0.25 CNY 视为严重不足。
采样时间:2026-10-23T23:58:31.855Z
The injected message is durable session history, not a transient UI decoration. The snapshot is intentionally short: the full policy lives once in the system prompt, while each step carries only the current facts.
The system-prompt section is registered only while auto-injection is on. It gives the model three behaviors:
| Level | Behavior |
|---|---|
ok | Work normally. |
low | Enter power-saving mode: concise answers, minimal tool calls, no filler. |
critical | Stop productive work. First write/update GOAL.md with a detailed resumable state, then reply with one short top-up message and stop the turn. |
unknown | Do not guess the balance; retry with check_balance when it matters. |
A new user turn with a recovered balance is instructed to read GOAL.md and resume from the saved state.
dsh plugin --profile <profile> add github:LzdqesjG/dsh-your-balance
dsh plugin --profile <profile> add /absolute/path/to/dsh-your-balance
Or use the DSH Plugin Manager and install the directory as a bundle.
After installation, refresh the Web page and open Settings → AI查余额.
0.2.1-rc.2 (tested) with the Web app and deepseekAccount service.^22.19.0 || >=24.0.0.Open Settings → AI查余额. The page provides:
Defaults:
| Level | CNY | USD | EUR |
|---|---|---|---|
| Low | 1.50 | 0.25 | 0.20 |
| Critical | 0.25 | 0.05 | 0.045 |
Built-in reference rates: 1 USD = 7.2 CNY, 1 EUR = 8.4 CNY. The plugin evaluates the primary currency — the wallet currency with the highest converted total — against that currency's thresholds.
Settings are stored at:
$DSH_HOME/your-balance/config.json
When DSH_HOME is unset, ~/.dsh is used. Writes are atomic (temporary file + rename).
x-dsh-your-balance: 1.check_balance tool always performs a live read.node --check index.js
node --check client.js
node --check lib/balance.js
node --check lib/config.js
node test/config.test.mjs
The test file uses Node's built-in test runner. Run it directly; on some sandboxed Windows setups, node --test cannot spawn the child process even though the tests themselves pass.
deepseek-flash model, working from LzdqesjG's specification on 2026-10-24.中文说明见 README.zh.md。
MIT. See LICENSE.