dsh-balance-pie
DSH 插件:提供可拖拽余额饼图、真实消耗统计和历史月度热力图。
f1yan9
@f1yan9
⬇ 2
★ 1
main
安装
dsh plugin --profile web add github:f1yan9/dsh-balance-pie
需要可复现安装时,可在仓库后追加 #commit 固定提交。
DSH 插件:提供可拖拽余额饼图、真实消耗统计和历史月度热力图。
该插件未提供要点说明,请参考仓库 README。
balancedeepseek-harnessdeepseek-harness-plugindeepseek-harness-pluginsdshdsh-plugin
- 安装并启动 DeepSeek Harness:
npx @deepseek-ai/dsh web - 在终端执行上面的安装命令(CLI 会解析插件并核验来源)
- 用 dsh plugins list 确认已安装,必要时重启 Harness 生效
插件以当前 dsh 进程的权限运行,安装时可能执行代码。请先通读仓库源码与许可证,确认无破坏性命令与越权访问;本站只做索引,不对第三方插件安全性作担保。
| 代码仓库 | github.com/f1yan9/dsh-balance-pie |
| 许可证 | MIT |
| 主要语言 | main |
| 下载量 | 2 |
| GitHub 星标 | 1 |
| 最近推送 | 2026-08-30 |
| 收录日期 | 2026-09-19 |
| 分类 | 工具与能力 |
事实信息来自公开插件目录快照(2026-10-01),介绍文案由本站再加工。
以下为插件仓库 README 全文(原始内容,由公开目录抓取整理)。
# dsh-balance-pie
> [English](./README.md) · [中文](./README.zh-CN.md)
**A DSH plugin · balance monitor / real spending / history heatmap**
[](#)
[](#-license)
A plugin for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH). It shows a draggable floating pie chart in the DSH web UI with the **daily initial balance**, **real per-project spending** and **remaining balance**; collapses to a sidebar bar; and ships a **monthly history heatmap** with a per-day spending table.
## ✨ Features
- 🥧 Draggable floating pie: today's initial / real spending / remaining at a glance
- 📊 Real spending: computed from actual balance decreases (top-ups/refunds handled automatically, survives restarts)
- 💰 Top-up detection + one-click recharge button (jumps to the official top-up page)
- 📅 History: GitHub-style monthly heatmap (days without records shown white) + per-day table (date / spend / remaining)
- 🗂 Local persistence: daily state + per-day JSONL logs (throttled writes, 90-day retention)
- 📐 Adaptive sidebar: horizontal bar when expanded, vertical bar + balance on the collapsed rail
- ⚙️ Settings hub「Balance」: parameters & history sub-pages, live-applied
- 🌐 i18n zh/en (auto-follows DSH language) with optional currency conversion for display
## 🚀 Quick Start
Prerequisites: DSH with a configured DeepSeek API key.
The repository ships a **prebuilt bundle** (`lib/`) and declares the `dsh.bundle` manifest — install it straight from GitHub, one line:
```sh
dsh plugin --profile web add github:f1yan9/dsh-balance-pie
```
Restart DSH web, then open the web UI — the floating pie appears bottom-right.
Uninstall:
```sh
dsh plugin --profile web remove dsh-balance-pie
```
> **Manual install**: clone the repo (or place the package folder into `$DSH_HOME/profiles/node_modules/dsh-balance-pie/`) and append an `insert` block to the profile's `cordis.patch.yml`; restart DSH web. Rebuilding from source: `node build.mjs` (esbuild is auto-detected).
## 📖 Usage
- **Floating pie**: drag to reposition; hover a slice for details; use **—** (minimize), **⚙** (settings), **↻** (refresh) and the **recharge icon** buttons.
- **Sidebar**: minimized state becomes a bar chart (horizontal when expanded, vertical + balance on the narrow rail); click it to expand the pie back.
- **Settings(Balance)**: the parameters sub-page holds all options (polling, currency, prices, history, language…); the history sub-page shows the heatmap and table.
## ⚙️ Configuration
Edit in the settings drawer(Balance section), or via `cordis.patch.yml` in your DSH profile. Common options:
| Option | Description | Default |
|---|---|---|
| `pollIntervalMs` | Balance poll interval | 10000 ms |
| `pricesJson` | Per-model off-peak prices (per 1M tokens) | presets for deepseek-v4-flash |
| `peakMultiplier` | Peak-hour price multiplier | 2 |
| `language` | UI language (`auto` follows DSH) | auto |
| `displayCurrency` | Display currency (converted) | auto (account currency) |
| `fxRatesJson` | CNY→target-currency rates JSON | `{"USD":0.14,"EUR":0.13,"GBP":0.11,"JPY":20,"KRW":190}` |
| `topUpUrl` | Recharge page URL | official top-up page |
## 🛠 Development
```sh
node build.mjs # rebuild lib/ (esbuild is auto-detected: HARNESS_ROOT → local pnpm store → npm i -D esbuild)
node test/run.mjs # typecheck → build → smoke → unit
```
## 📁 Data Storage
Plugin data lives under `$DSH_HOME/dsh-balance-pie/`:
- `daily-state.json` — daily state (anchor, real spending, top-up baselines, today's top-up total)
- `history/YYYY-MM-DD.jsonl` — per-day history logs (90-day retention)
## 💱 Display conversion
Snapshot money fields (`anchor`/`current`/`usedTotal`/`projects[].used`/`remaining`/`topUpToday`) are converted by `fxRatesJson` into `displayCurrency` (`auto` = account currency, no conversion); `language` and `displayCurrency` ride the snapshot. The history route serves `{ records, fx: { displayCurrency, rate } }` — records stay in the account currency, clients convert for display. `topUpToday` (Σ today's merged top-up/grant deltas) accrues, resets at midnight, and is restored on same-day restarts.
## ❓ FAQ
- **Spending doesn't match the bill?** Spending is real (balance decreases); per-project amounts are split by estimated usage — calibrate prices in settings if needed.
- **Initial balance resets after restart?** No — anchor and spending are persisted locally and restored on same-day restarts.
- **Top-up not reflected?** Top-ups are detected on the next poll (default 10 s); already-spent historical top-ups cannot be retro-fixed.
- **Where is history stored?** `$DSH_HOME/dsh-balance-pie/history/` — remove the directory to clear all history.
## 📄 License
MIT
数据来源:公开的 DeepSeek Harness 插件目录与各插件 GitHub 仓库。本站为独立第三方目录,与 DeepSeek、幻方(High-Flyer)及插件作者均无隶属或背书关系。