dsh-ds-balance 1.0.0 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +121 -49
- package/README_en.md +120 -48
- package/lib/client.js +96 -213
- package/lib/config.d.ts +10 -1
- package/lib/config.js +13 -1
- package/lib/http/handlers.js +2 -2
- package/lib/services/balance-service.js +2 -1
- package/lib/types/client/index.d.ts +3 -3
- package/lib/types/client/locales.d.ts +6 -11
- package/lib/types/client/model.d.ts +12 -0
- package/lib/types/client/settings/BalanceSettingsCard.d.ts +1 -1
- package/lib/types/client/settings/fields.d.ts +6 -23
- package/lib/types/client/settings/use-config-form.d.ts +2 -1
- package/lib/types/client/sidebar/BalancePopover.d.ts +2 -4
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,81 +1,153 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<h1 align="center">dsh-ds-balance</h1>
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<div align="center">
|
|
6
|
+
<p><strong>把 DeepSeek 账户余额放进 DSH 的左边栏</strong></p>
|
|
7
|
+
<p><em>DeepSeek account balance in the DSH sidebar</em></p>
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
<p>
|
|
10
|
+
<a href="https://api-docs.deepseek.com/"><img src="https://img.shields.io/badge/DeepSeek%20API-Official-4D6BFE?style=flat" alt="DeepSeek 官方接口"></a>
|
|
11
|
+
<a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/DeepSeek%20Harness-Plugin-4176E6?style=flat" alt="DeepSeek Harness Plugin"></a>
|
|
12
|
+
</p>
|
|
9
13
|
|
|
10
|
-
>
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
<p>
|
|
15
|
+
<a href="https://github.com/zlZayn/dsh-ds-balance/actions/workflows/ci.yml"><img src="https://github.com/zlZayn/dsh-ds-balance/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/dsh-ds-balance"><img src="https://img.shields.io/npm/v/dsh-ds-balance.svg" alt="npm"></a>
|
|
17
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="MIT 许可证"></a>
|
|
18
|
+
</p>
|
|
13
19
|
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
<p>
|
|
21
|
+
<strong><a href="README.md">简体中文</a></strong> · <a href="README_en.md">English</a>
|
|
22
|
+
</p>
|
|
23
|
+
</div>
|
|
16
24
|
|
|
17
|
-
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
> [!NOTE]
|
|
28
|
+
> **余额读自 DeepSeek 官方 `GET /user/balance`**,不是估算。凭据只经 DSH 的凭据通道解析:API Key 不会出现在设置文件里,也不会返回给界面。
|
|
29
|
+
|
|
30
|
+
余额要有地方看,但不该占地方。左边栏底部一个常驻的状态环,点开是三段金额与数据新鲜度;要改配置,进侧边栏**插件(Plugins)**页里本插件的详情页。
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<img src="assets/sidebar-popover.png" alt="左边栏底部的「DeepSeek 余额」条目与展开的余额浮层" width="360">
|
|
34
|
+
<br>
|
|
35
|
+
<em>常驻<strong>左边栏底部</strong>,与「使用统计」「设置」并排;点开是余额、赠送 / 充值拆分与数据新鲜度。</em>
|
|
36
|
+
</p>
|
|
37
|
+
|
|
38
|
+
## 界面一览
|
|
39
|
+
|
|
40
|
+
| 界面 | 一句话 | 你会用它来 |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| 侧栏圆环 | 常驻左边栏底部的状态环 + 名称,**环里填了多少 = 余额离该币种预警线还有多远** | 扫一眼就知道还剩多少、离预警线多远 |
|
|
43
|
+
| 余额浮层 | 点条目展开:总额、赠送 / 充值拆分、数据新鲜度、手动刷新(带冷却) | 核对具体数字,以及数据是几分钟前的 |
|
|
44
|
+
| 设置卡片 | 连接 / 展示 / 阈值 / 刷新四组,默认四组全展开,各自可折叠 | 换端点、换币种、调预警线、调节奏 |
|
|
45
|
+
|
|
46
|
+
三种界面的分工是死的:**圆环回答「大概还剩多少」,浮层回答「具体是多少」,卡片回答「怎么算」。**
|
|
47
|
+
|
|
48
|
+
<p align="center">
|
|
49
|
+
<img src="assets/settings-card.png" alt="插件页里的「DeepSeek 余额」卡片" width="360">
|
|
50
|
+
<br>
|
|
51
|
+
<em>卡片就是这四组:默认全展开,各自可折叠;组里有填错的项时那一组会自己展开。</em>
|
|
52
|
+
</p>
|
|
18
53
|
|
|
19
54
|
## 能力
|
|
20
55
|
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
-
|
|
56
|
+
- 左边栏底部常驻一个状态环加名称,点开看明细;收起与展开是同一个环,位置不变。
|
|
57
|
+
- 余额按设定的周期自动刷新,界面读的是缓存 —— 开着界面不会反复去打上游接口。
|
|
58
|
+
- 浮层给出总额、赠送 / 充值拆分、数据是多久之前的,以及一个带冷却的手动刷新。
|
|
59
|
+
- 多币种:显示哪个币种由账户决定;设置里选的币种账户里没有时,浮层会说明并给一键改用。
|
|
60
|
+
- 设置卡片分四组、默认全展开、各自可折叠;组里有填错的项时,那一组会自己展开。
|
|
61
|
+
- 凭据默认继承官方模型页配好的那一份,不必重填;徽标只报「已配置密钥。/ 未配置密钥。」(官方卡片同款),
|
|
62
|
+
只读时不给编辑,并说明原因。
|
|
63
|
+
- 颜色只表达状态(正常 / 偏低 / 告急),与金额大小无关;读法与理由见「[圆环怎么读](#圆环怎么读)」。
|
|
29
64
|
|
|
30
65
|
## 安装
|
|
31
66
|
|
|
32
|
-
|
|
67
|
+
### 前置
|
|
33
68
|
|
|
34
|
-
|
|
69
|
+
- **DSH**:版本范围以 [package.json](package.json) 的 `engines.dsh` 与 `peerDependencies` 为准,本插件跟的是宿主当前那条 alpha 线。
|
|
70
|
+
- Node `>= 20`(同上,真源是 `engines.node`)。
|
|
71
|
+
|
|
72
|
+
装宿主时**要显式点名版本线**:`@deepseek-ai/dsh` 的 `latest` 标签比本插件要求的那条线还旧 —— 按默认方式装会落在声明范围之外。
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm install -g @deepseek-ai/dsh@alpha # 本插件承诺支持的线
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
兼容性不是推断出来的:每周由 [compat.yml](.github/workflows/compat.yml) 在 `alpha` 与 `next` 两条线上换包实跑一遍现有测试。当前结论与红了怎么办见 [兼容性](docs/PUBLISHING.md#兼容性)。配置界面注册在宿主的 `plugins.bundle.config` 槽,**该槽由 DSH 0.1.6 引入**(下限的真源是 [package.json](package.json) 的 `engines.dsh`,现查 `node scripts/compat-swap.mjs check`):更早的宿主上圆环与浮层照常工作,但**插件页里不会出现配置区**(静默,不报错)—— 这就是分水岭。
|
|
79
|
+
|
|
80
|
+
### 从 npm 安装
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
dsh plugin --profile web add dsh-ds-balance
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
装完**重启 `dsh --profile web`** 生效。
|
|
87
|
+
|
|
88
|
+
### 从源码安装
|
|
35
89
|
|
|
36
90
|
```bash
|
|
37
91
|
git clone https://github.com/zlZayn/dsh-ds-balance.git
|
|
38
92
|
cd dsh-ds-balance
|
|
39
|
-
npm install
|
|
40
|
-
|
|
41
|
-
dsh plugin --profile
|
|
93
|
+
npm install && npm run build
|
|
94
|
+
|
|
95
|
+
dsh plugin --profile web add "$PWD"
|
|
42
96
|
```
|
|
43
97
|
|
|
44
|
-
|
|
45
|
-
|
|
98
|
+
与 npm 那条路一样,重启后生效。
|
|
99
|
+
|
|
100
|
+
### 发现与安装
|
|
46
101
|
|
|
47
|
-
|
|
102
|
+
- **npm**:[`dsh-ds-balance`](https://www.npmjs.com/package/dsh-ds-balance)
|
|
103
|
+
- **GitHub**:[`zlZayn/dsh-ds-balance`](https://github.com/zlZayn/dsh-ds-balance)
|
|
48
104
|
|
|
49
|
-
|
|
105
|
+
仓库带有 GitHub topic [`dsh-plugin`](https://github.com/topics/dsh-plugin),插件市场据此自动发现插件。
|
|
50
106
|
|
|
51
107
|
## 配置
|
|
52
108
|
|
|
53
|
-
|
|
109
|
+
打开侧边栏 **插件(Plugins)** →「已安装(Installed)」组,点进 **dsh-ds-balance** 的详情页;配置表单直接铺在那一页上,四组默认全展开、各自可折叠:
|
|
54
110
|
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
-
|
|
111
|
+
<p align="center">
|
|
112
|
+
<img src="assets/settings-cards-position.png" alt="Plugins 页列表里「DeepSeek 余额」的位置" width="480">
|
|
113
|
+
<br>
|
|
114
|
+
<em>Plugins 页列表里的位置:<code>dsh-ds-balance</code> 与其他已安装插件并排;点进它的详情页才是上面那张配置表单。</em>
|
|
115
|
+
</p>
|
|
59
116
|
|
|
60
|
-
|
|
117
|
+
- **连接**:API 地址与凭据,两项都默认留空 —— 地址留空即用 DeepSeek 官方端点,凭据继承官方模型页那一份、只读不可改;
|
|
118
|
+
二级「自定义设置」里只放凭据引用名。
|
|
119
|
+
- **展示**:金额用哪种币种,或让它自动跟随账户。
|
|
120
|
+
- **阈值**:每个币种两档提醒线(预警 / 告急)。同一币种内**告急必须严格低于预警**,相等也会被拒绝。
|
|
121
|
+
- **刷新**:服务端刷新周期与界面轮询周期。
|
|
61
122
|
|
|
62
|
-
|
|
63
|
-
- **API Key 永不返回前端**:配置接口只回一个固定长度的掩码串,连末几位也不给。
|
|
64
|
-
- 密钥只经 DSH 的凭据通道解析,不落日志、不落本插件的文件。
|
|
65
|
-
- 余额快照落在 DSH 自己的存储目录(`ctx.storageDomain`),按凭据派生出的账本标识分组;
|
|
66
|
-
换 key 自动开新账本,旧快照不会被混用。
|
|
67
|
-
- 一个非记录型文件 `.salt` 落在 `$DSH_HOME` 下,用来派生账本标识;**它丢了旧快照会读不回来**。
|
|
123
|
+
保存即生效,不必重启 DSH。
|
|
68
124
|
|
|
69
|
-
|
|
125
|
+
### 圆环怎么读
|
|
70
126
|
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
127
|
+
- 环里填多少 = 当前余额占该币种**预警线**的比例,100% 封顶;告急线不参与画环 —— 它已经决定了颜色。
|
|
128
|
+
- 颜色只表达状态,与金额大小无关:正常、偏低、告急各一色;账户读不到时另画一个带叉号的环。
|
|
129
|
+
- 没配阈值的币种退回按状态定性:正常与不可用画满环,偏低 3/4,告急 1/4,未知空环。
|
|
130
|
+
- 为什么颜色不由金额算、阈值为什么只当刻度 → [数据流](docs/ARCHITECTURE.md#数据流)。
|
|
74
131
|
|
|
75
|
-
|
|
132
|
+
### 凭据
|
|
76
133
|
|
|
77
|
-
|
|
134
|
+
密钥只经 DSH 的凭据通道解析,卡片里的 `API Key` 一栏默认继承官方模型页配好的那一份,且只读不可改。
|
|
135
|
+
由启动环境(环境变量)提供时,字段只读,徽标写明来源。
|
|
136
|
+
|
|
137
|
+
## 安全与边界
|
|
138
|
+
|
|
139
|
+
- **API Key 永不返回界面**:配置接口只回一个固定长度的掩码串,连末几位也不给。
|
|
140
|
+
- 密钥不落日志、不落本插件的文件;设置文件里只有引用名,卡片可以安全截图或分享。
|
|
141
|
+
- 余额快照存在 DSH 自己的数据目录里,按凭据派生出的账本标识分组 —— 换 key 自动开新账本,旧快照不会被混用。
|
|
142
|
+
- 账本标识还要一个 `.salt` 文件(在 DSH 的 home 目录下)参与派生;**它丢了,旧快照就读不回来**。
|
|
143
|
+
- 只访问 `api.deepseek.com`,不代理、不转发其他流量。
|
|
144
|
+
|
|
145
|
+
## 许可
|
|
146
|
+
|
|
147
|
+
[MIT](LICENSE)。
|
|
148
|
+
|
|
149
|
+
## 贡献
|
|
78
150
|
|
|
79
|
-
|
|
151
|
+
外部贡献入口(报 bug 带什么、提功能前先翻什么、提 PR 前做什么)→ [CONTRIBUTING.md](CONTRIBUTING.md)。
|
|
80
152
|
|
|
81
|
-
|
|
153
|
+
设计取向与实现约束 → [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md);发布流程与版本号判定 → [docs/PUBLISHING.md](docs/PUBLISHING.md);维护者文档地图 → [AGENTS.md](AGENTS.md)。
|
package/README_en.md
CHANGED
|
@@ -1,81 +1,153 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<h1 align="center">dsh-ds-balance</h1>
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<div align="center">
|
|
6
|
+
<p><strong>DeepSeek account balance in the DSH sidebar</strong></p>
|
|
7
|
+
<p><em>把 DeepSeek 账户余额放进 DSH 的左边栏</em></p>
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
<p>
|
|
10
|
+
<a href="https://api-docs.deepseek.com/"><img src="https://img.shields.io/badge/DeepSeek%20API-Official-4D6BFE?style=flat" alt="DeepSeek official API"></a>
|
|
11
|
+
<a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/DeepSeek%20Harness-Plugin-4176E6?style=flat" alt="DeepSeek Harness Plugin"></a>
|
|
12
|
+
</p>
|
|
9
13
|
|
|
10
|
-
>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
<p>
|
|
15
|
+
<a href="https://github.com/zlZayn/dsh-ds-balance/actions/workflows/ci.yml"><img src="https://github.com/zlZayn/dsh-ds-balance/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/dsh-ds-balance"><img src="https://img.shields.io/npm/v/dsh-ds-balance.svg" alt="npm"></a>
|
|
17
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="MIT License"></a>
|
|
18
|
+
</p>
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
<p>
|
|
21
|
+
<a href="README.md">简体中文</a> · <strong><a href="README_en.md">English</a></strong>
|
|
22
|
+
</p>
|
|
23
|
+
</div>
|
|
17
24
|
|
|
18
|
-
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
> [!NOTE]
|
|
28
|
+
> **The balance is read from the official `GET /user/balance`** — not estimated. The credential is resolved only through DSH's credential channel: the API key never lands in a settings file and is never returned to the UI.
|
|
29
|
+
|
|
30
|
+
The balance needs somewhere to live that does not take up room. A permanent status ring at the bottom of the sidebar; click it for the three amounts and the freshness of the data. Anything you want to configure lives on the plugin's details page under **Plugins → Installed**.
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<img src="assets/sidebar-popover_en.png" alt="The DeepSeek balance entry at the bottom of the sidebar, with its popover open" width="360">
|
|
34
|
+
<br>
|
|
35
|
+
<em>A permanent fixture at the <strong>bottom of the sidebar</strong>, alongside Usage statistics and Settings; click it for the balance, the granted / topped-up split, and how fresh the data is.</em>
|
|
36
|
+
</p>
|
|
37
|
+
|
|
38
|
+
## Surface at a glance
|
|
39
|
+
|
|
40
|
+
| Surface | One line | Use it for |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| Sidebar ring | A status ring plus label at the bottom of the sidebar; **how full it is = how far the balance is from that currency's warning line** | Seeing at a glance how much is left and how close it is to the warning line |
|
|
43
|
+
| Balance popover | Click the entry: total, granted / topped-up split, data freshness, manual refresh (with cooldown) | Checking the exact figures, and how many minutes old they are |
|
|
44
|
+
| Settings card | Connection / Display / Thresholds / Refresh, all expanded by default, each collapsible | Changing the endpoint, the currency, the warning lines, the cadence |
|
|
45
|
+
|
|
46
|
+
The division of labour is fixed: **the ring answers "roughly how much is left", the popover answers "exactly how much", and the card answers "how is that computed".**
|
|
47
|
+
|
|
48
|
+
<p align="center">
|
|
49
|
+
<img src="assets/settings-card_en.png" alt="The DeepSeek balance card on the Plugins page" width="360">
|
|
50
|
+
<br>
|
|
51
|
+
<em>The card is those four groups: all expanded by default, each collapsible; a group holding a bad value opens itself.</em>
|
|
52
|
+
</p>
|
|
19
53
|
|
|
20
54
|
## Capabilities
|
|
21
55
|
|
|
22
|
-
- A permanent status ring plus label at the bottom of the sidebar; click it
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
- Multiple currencies: the
|
|
26
|
-
- The settings card has four
|
|
27
|
-
-
|
|
28
|
-
|
|
56
|
+
- A permanent status ring plus label at the bottom of the sidebar; click it for the breakdown. The collapsed and expanded states share the same ring, in the same place.
|
|
57
|
+
- The balance refreshes on its own schedule and the UI reads a cache — leaving the interface open does not hammer the upstream.
|
|
58
|
+
- The popover shows the total, the granted / topped-up split, how old the data is, and a manual refresh with a cooldown.
|
|
59
|
+
- Multiple currencies: the account decides which currency is shown; when the one chosen in settings is absent, the popover explains and offers a one-click switch.
|
|
60
|
+
- The settings card has four groups, all expanded by default and each collapsible; a group holding a bad value opens itself.
|
|
61
|
+
- The credential is inherited from the official model settings by default, so there is nothing to re-enter; where it comes from is on a badge
|
|
62
|
+
(a key is configured / no key is configured, exactly the official card's wording), and a read-only field explains itself instead of offering an edit.
|
|
63
|
+
- Colour carries state only (normal / low / critical), never an amount; see "[Reading the ring](#reading-the-ring)".
|
|
29
64
|
|
|
30
65
|
## Installation
|
|
31
66
|
|
|
32
|
-
|
|
67
|
+
### Requirements
|
|
33
68
|
|
|
34
|
-
|
|
69
|
+
- **DSH**: the range is whatever [package.json](package.json) declares under `engines.dsh` and `peerDependencies`; this plugin follows the alpha line the host is on.
|
|
70
|
+
- Node `>= 20` (same source of truth: `engines.node`).
|
|
71
|
+
|
|
72
|
+
Install the host by **naming the version line explicitly**: the `latest` tag of `@deepseek-ai/dsh` is older than the line this plugin requires — a default install lands outside the declared range.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm install -g @deepseek-ai/dsh@alpha # the line this plugin promises to support
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Compatibility is measured, not inferred: every week [compat.yml](.github/workflows/compat.yml) swaps packages onto the `alpha` and `next` lines and reruns the existing tests. The current verdict, and what to do when it goes red, are in [Compatibility](docs/PUBLISHING.md#兼容性). The configuration UI registers into the Host's `plugins.bundle.config` slot, which **arrives with DSH 0.1.6** (the floor's single source is `engines.dsh` in [package.json](package.json); check it live with `node scripts/compat-swap.mjs check`): on an earlier Host the ring and the popover keep working, but the configuration area never appears on the Plugins page (silently, with no error) — that is the watershed.
|
|
79
|
+
|
|
80
|
+
### From npm
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
dsh plugin --profile web add dsh-ds-balance
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Restarting `dsh --profile web`** is what makes it take effect.
|
|
87
|
+
|
|
88
|
+
### From source
|
|
35
89
|
|
|
36
90
|
```bash
|
|
37
91
|
git clone https://github.com/zlZayn/dsh-ds-balance.git
|
|
38
92
|
cd dsh-ds-balance
|
|
39
|
-
npm install
|
|
40
|
-
|
|
41
|
-
dsh plugin --profile
|
|
93
|
+
npm install && npm run build
|
|
94
|
+
|
|
95
|
+
dsh plugin --profile web add "$PWD"
|
|
42
96
|
```
|
|
43
97
|
|
|
44
|
-
|
|
45
|
-
|
|
98
|
+
Same as the npm route: it takes effect after a restart.
|
|
99
|
+
|
|
100
|
+
### Discovery
|
|
46
101
|
|
|
47
|
-
**
|
|
102
|
+
- **npm**: [`dsh-ds-balance`](https://www.npmjs.com/package/dsh-ds-balance)
|
|
103
|
+
- **GitHub**: [`zlZayn/dsh-ds-balance`](https://github.com/zlZayn/dsh-ds-balance)
|
|
48
104
|
|
|
49
|
-
|
|
50
|
-
and a status ring at the bottom of the sidebar.
|
|
105
|
+
The repository carries the GitHub topic [`dsh-plugin`](https://github.com/topics/dsh-plugin), which is how the plugin marketplace discovers plugins.
|
|
51
106
|
|
|
52
107
|
## Configuration
|
|
53
108
|
|
|
54
|
-
The
|
|
109
|
+
Open **Plugins → Installed** and step into the **dsh-ds-balance** details page. The form runs straight down that page, four groups all expanded by default and each collapsible:
|
|
55
110
|
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
|
|
111
|
+
<p align="center">
|
|
112
|
+
<img src="assets/settings-cards-position_en.png" alt="Where the DeepSeek balance entry sits in the Plugins list" width="480">
|
|
113
|
+
<br>
|
|
114
|
+
<em>Where it sits: the Plugins page's list view, with <code>dsh-ds-balance</code> alongside the other installed plugins; the details page behind it carries the form shown above.</em>
|
|
115
|
+
</p>
|
|
60
116
|
|
|
61
|
-
|
|
117
|
+
- **Connection**: the API base URL and the credential, both blank by default — a blank URL means the official DeepSeek endpoint, and the credential is inherited from the official model page and is read-only.
|
|
118
|
+
The nested "Customised settings" holds only the credential reference name.
|
|
119
|
+
- **Display**: which currency to use for amounts, or let it follow the account.
|
|
120
|
+
- **Thresholds**: two alert lines per currency (warning / critical). **Within one currency the critical line must be strictly lower than the warning line** — equality is rejected too.
|
|
121
|
+
- **Refresh**: the server refresh interval and the UI poll interval.
|
|
62
122
|
|
|
63
|
-
|
|
64
|
-
- **The API key is never returned to the frontend**: the config endpoint returns only a fixed-length mask, not even the last few characters.
|
|
65
|
-
- The key is resolved only through the DSH credential channel; it is never logged and never written to a file owned by this plugin.
|
|
66
|
-
- Balance snapshots land in DSH's own storage (`ctx.storageDomain`), grouped by a ledger identifier derived from the credential. Changing the key opens a new ledger; old snapshots are never mixed in.
|
|
67
|
-
- One non-record file, `.salt`, lives under `$DSH_HOME` and derives the ledger identifier. **Losing it makes old snapshots unreadable.**
|
|
123
|
+
Saving applies immediately; there is no need to restart DSH.
|
|
68
124
|
|
|
69
|
-
|
|
125
|
+
### Reading the ring
|
|
70
126
|
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
127
|
+
- How full the ring is = the current balance as a fraction of that currency's **warning line**, capped at 100%; the critical line takes no part in drawing it — it already decided the colour.
|
|
128
|
+
- Colour carries state only, never an amount: normal, low and critical each get one hue; an account that cannot be read gets a ring with a cross instead.
|
|
129
|
+
- A currency with no threshold configured falls back to state: full ring for normal and unavailable, 3/4 for low, 1/4 for critical, empty for unknown.
|
|
130
|
+
- Why colour is never computed from an amount, and why thresholds are only a scale → [Data flow](docs/ARCHITECTURE.md#数据流).
|
|
74
131
|
|
|
75
|
-
|
|
132
|
+
### Credentials
|
|
76
133
|
|
|
77
|
-
|
|
134
|
+
The key is resolved only through DSH's credential channel; the card's "API key" inherits the one already configured on the official model settings page.
|
|
135
|
+
When it comes from the launch environment (an environment variable) the field is read-only and the badge says where it came from.
|
|
136
|
+
|
|
137
|
+
## Security and boundaries
|
|
138
|
+
|
|
139
|
+
- **The API key is never returned to the UI**: the config endpoint returns only a fixed-length mask, not even the last few characters.
|
|
140
|
+
- The key is never logged and never written to a file owned by this plugin; the settings file holds only a reference name, so the card is safe to screenshot or share.
|
|
141
|
+
- Balance snapshots live in DSH's own data directory, grouped by a ledger identifier derived from the credential — changing the key opens a new ledger and old snapshots are never mixed in.
|
|
142
|
+
- That identifier also involves a `.salt` file in DSH's home directory; **lose it and old snapshots become unreadable**.
|
|
143
|
+
- Only `api.deepseek.com` is contacted; nothing is proxied or forwarded.
|
|
78
144
|
|
|
79
145
|
## License
|
|
80
146
|
|
|
81
|
-
MIT
|
|
147
|
+
[MIT](LICENSE).
|
|
148
|
+
|
|
149
|
+
## Contributing
|
|
150
|
+
|
|
151
|
+
Where to report bugs, what to check before proposing a feature, and what to do before sending a PR → [CONTRIBUTING_en.md](CONTRIBUTING_en.md).
|
|
152
|
+
|
|
153
|
+
Design stance and implementation constraints → [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md); the release flow and the version-bump decision chain → [docs/PUBLISHING.md](docs/PUBLISHING.md); the maintainer's document map → [AGENTS.md](AGENTS.md).
|