dsh-token-gauge 0.1.10 → 1.1.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/LICENSE +1 -1
- package/README.en.md +69 -41
- package/README.md +80 -94
- package/client.js +1143 -0
- package/cordis.patch.yml +2 -8
- package/icon.svg +13 -0
- package/index.js +57 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +66 -84
- package/screenshots/dual-starfield.png +0 -0
- package/screenshots/settings.png +0 -0
- package/screenshots/single-classical.png +0 -0
- package/screenshots/styles.png +0 -0
- package/usage-server.js +344 -0
- package/build.mjs +0 -61
- package/lib/LICENSE +0 -21
- package/lib/client.mjs +0 -1098
- package/lib/index.mjs +0 -265
- package/preview/styles-showcase-v2.html +0 -385
- package/preview/styles-showcase.html +0 -370
- package/src/client.ts +0 -386
- package/src/export.ts +0 -81
- package/src/gauge.ts +0 -163
- package/src/host.ts +0 -375
- package/src/i18n.ts +0 -59
- package/src/settings.ts +0 -270
- package/src/styles.ts +0 -313
- package/src/util.ts +0 -31
- package/tsconfig.json +0 -19
package/LICENSE
CHANGED
package/README.en.md
CHANGED
|
@@ -1,67 +1,95 @@
|
|
|
1
1
|
# dsh-token-gauge · Token Gauge Dashboard
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="screenshots/single-classical.png" alt="Single gauge · Vintage skin" width="48%">
|
|
5
|
+
<img src="screenshots/dual-starfield.png" alt="Dual gauge · Starfield skin" width="48%">
|
|
6
|
+
</p>
|
|
6
7
|
|
|
7
|
-
>
|
|
8
|
+
<p align="center">
|
|
9
|
+
<img src="screenshots/styles.png" alt="Vintage / Macaron / Minimal / Starfield skins" width="78%">
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://github.com/liumiaozhi/dsh-token-gauge/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/liumiaozhi/dsh-token-gauge?style=flat-square"></a>
|
|
14
|
+
<a href="LICENSE"><img alt="License MIT" src="https://img.shields.io/github/license/liumiaozhi/dsh-token-gauge?style=flat-square"></a>
|
|
15
|
+
<img alt="DeepSeek Harness" src="https://img.shields.io/badge/DeepSeek%20Harness-Web%20Plugin-4f46e5?style=flat-square">
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
A sidebar Token gauge for **DeepSeek Harness (DSH)**. Four skins — Vintage, Macaron, Minimal and Starfield — turn token speed, session/today usage and spend, and cache hit rate into a quick car-dashboard read.
|
|
19
|
+
|
|
20
|
+
> Preview images use sample data. Real values are aggregated from local DSH session logs; nothing is fabricated.
|
|
8
21
|
|
|
9
22
|
## Features
|
|
10
23
|
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
18
|
-
- **
|
|
24
|
+
- **Two structures**
|
|
25
|
+
- **Single**: token-speed gauge on the left, current-session / today tokens and spend on the right, cache-hit progress bar at the bottom.
|
|
26
|
+
- **Dual**: token-speed gauge and cache-hit gauge side by side on top; current-session and today tokens / spend below.
|
|
27
|
+
- **Four skins**: Vintage (warm amber), Macaron, Minimal, Starfield. Structure and skin combine freely — eight presentations.
|
|
28
|
+
- **Live speed**: reads streaming output deltas from the current session and moves the needle smoothly across 0–500 tokens/s.
|
|
29
|
+
- **Cache gauge**: 70–100% range with 70 / 75 / 100 ticks; below 70% the needle parks at 70% while the readout keeps the real value.
|
|
30
|
+
- **Token formatting**: always in **k (thousand tokens)**, two decimals and thousands separators, e.g. `15,098.77k`.
|
|
31
|
+
- **Settings**: the slider icon at the card's top-right opens structure/skin choices; selections persist in `localStorage`.
|
|
32
|
+
- **Theme-aware** and dependency-free: no billing plugin, no chart library, no external CDN. The Host half aggregates DSH session logs itself.
|
|
19
33
|
|
|
20
34
|
## Install
|
|
21
35
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
> as a plain dependency (no bundle layer, no sidebar tab). **Pin `0.1.1` to avoid this**:
|
|
36
|
+
The plugin ships its own Host half: it reads DSH's `sessionPersistence` logs and aggregates usage locally. **No billing plugin is required.**
|
|
37
|
+
|
|
25
38
|
```bash
|
|
26
|
-
|
|
27
|
-
dsh plugin --profile web add dsh-token-gauge@0.1.1
|
|
28
|
-
dsh web
|
|
29
|
-
|
|
30
|
-
# From source
|
|
31
|
-
npm install
|
|
32
|
-
node build.mjs
|
|
33
|
-
dsh plugin --profile web add .
|
|
39
|
+
dsh plugin --profile web add dsh-token-gauge
|
|
34
40
|
```
|
|
35
41
|
|
|
36
|
-
|
|
42
|
+
From source (current repository version):
|
|
37
43
|
|
|
38
|
-
If you already installed `0.1.0` (no `token-gauge` layer in `dsh.profile.bundles`, warning `declares no dsh.bundle —
|
|
39
|
-
installed as a plain dependency`), switch with:
|
|
40
44
|
```bash
|
|
41
|
-
|
|
42
|
-
dsh plugin --profile web add
|
|
45
|
+
git clone https://github.com/liumiaozhi/dsh-token-gauge.git
|
|
46
|
+
dsh plugin --profile web add "link:<absolute-path-to-repo>"
|
|
43
47
|
```
|
|
44
|
-
After reconcile, `token-gauge` is added as a bundle layer automatically; restart `dsh web` to see the **Token Gauge** tab.
|
|
45
48
|
|
|
46
|
-
|
|
49
|
+
> If npm still serves an older `dsh-token-gauge`, install from source until 1.1.0 is published.
|
|
50
|
+
|
|
51
|
+
Restart or hard-refresh DSH Web. The card replaces the original billing trigger at the same sidebar-footer slot without needing that plugin.
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
47
54
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
1. Click the slider icon at the **top-right** of the card.
|
|
56
|
+
2. Choose **Single / Dual** under Layout.
|
|
57
|
+
3. Pick one of **Vintage / Macaron / Minimal / Starfield**.
|
|
58
|
+
4. Start a conversation; speed follows streaming output and usage refreshes every 1.5s.
|
|
52
59
|
|
|
53
|
-
|
|
60
|
+
<p align="center">
|
|
61
|
+
<img src="screenshots/settings.png" alt="Settings: layout and four skins" width="62%">
|
|
62
|
+
</p>
|
|
54
63
|
|
|
55
|
-
|
|
56
|
-
Limits (global/daily/weekly/monthly) · Advanced pricing · Export CSV/JSON · Clear / Reset.
|
|
64
|
+
## Data
|
|
57
65
|
|
|
58
|
-
|
|
66
|
+
| Metric | Source |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| Token speed | Streaming text / reasoning / tool-call deltas of the current session, estimated over a 0–500 tokens/s scale |
|
|
69
|
+
| Current-session tokens | `input + output` over all turns of the current session |
|
|
70
|
+
| Today tokens | Today's `input + output` from the plugin's own `byDay` aggregate |
|
|
71
|
+
| Current-session spend | Estimated from successful model calls in the current session |
|
|
72
|
+
| Today spend | Estimated from DeepSeek Flash / Pro list prices with peak/off-peak bands |
|
|
73
|
+
| Cache hit rate | Today's `cacheHit / (cacheHit + cacheMiss)`, gauge range 70–100% |
|
|
74
|
+
|
|
75
|
+
The Host half reads `assistant/message.usage` from DSH `sessionPersistence`, adds 0.02 CNY per web-search call, and prices DeepSeek Flash (2 / 0.04 / 8 CNY per million tokens) and Pro (9 / 0.3 / 27). Peak hours are weekdays 09–12 and 14–18; weekends and off-peak are half price. Unknown models fall back to Flash rates. Amounts are estimates, not an official invoice.
|
|
76
|
+
|
|
77
|
+
## Development
|
|
59
78
|
|
|
60
79
|
```bash
|
|
61
|
-
|
|
62
|
-
|
|
80
|
+
git clone https://github.com/liumiaozhi/dsh-token-gauge.git
|
|
81
|
+
cd dsh-token-gauge
|
|
82
|
+
dsh plugin --profile web add "link:$PWD"
|
|
63
83
|
```
|
|
64
84
|
|
|
85
|
+
`client.js` is a hand-written Client bundle; no build step. DSH Client HMR reloads it after edits; refresh the page if HMR is unavailable.
|
|
86
|
+
|
|
87
|
+
## Compatibility
|
|
88
|
+
|
|
89
|
+
- DSH Web (`platform: web`), requiring `@deepseek-ai/dsh-client-ui-sidebar` and `@deepseek-ai/dsh-client-ui-session`.
|
|
90
|
+
- Host half uses DSH's built-in `sessionPersistence` and `webServer`; no billing plugin.
|
|
91
|
+
- Preview images are generated from the actual component styles with sample data.
|
|
92
|
+
|
|
65
93
|
## License
|
|
66
94
|
|
|
67
|
-
MIT
|
|
95
|
+
[MIT](LICENSE) © 2026 liumiaozhi
|
package/README.md
CHANGED
|
@@ -1,129 +1,115 @@
|
|
|
1
|
-
# dsh-token-gauge ·
|
|
1
|
+
# dsh-token-gauge · 费用仪表盘
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="screenshots/single-classical.png" alt="单表 · 古典风格" width="48%">
|
|
5
|
+
<img src="screenshots/dual-starfield.png" alt="双表 · 星空风格" width="48%">
|
|
6
|
+
</p>
|
|
5
7
|
|
|
6
|
-
>
|
|
8
|
+
<p align="center">
|
|
9
|
+
<img src="screenshots/styles.png" alt="古典 / 马卡龙 / 极简 / 星空四种皮肤" width="78%">
|
|
10
|
+
</p>
|
|
7
11
|
|
|
8
|
-
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://github.com/liumiaozhi/dsh-token-gauge/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/liumiaozhi/dsh-token-gauge?style=flat-square"></a>
|
|
14
|
+
<a href="LICENSE"><img alt="License MIT" src="https://img.shields.io/github/license/liumiaozhi/dsh-token-gauge?style=flat-square"></a>
|
|
15
|
+
<img alt="DeepSeek Harness" src="https://img.shields.io/badge/DeepSeek%20Harness-Web%20Plugin-4f46e5?style=flat-square">
|
|
16
|
+
<img alt="Token Gauge" src="https://img.shields.io/badge/UI-Token%20Gauge-0ea5e9?style=flat-square">
|
|
17
|
+
</p>
|
|
9
18
|
|
|
10
|
-
|
|
11
|
-
- **多风格(6 种)**:现代电车科技(默认)、原始机车、豪华跑车、可爱小车、赛博朋克、复古机械表盘。
|
|
12
|
-
- **多配色(8 种)**:琥珀金、霓虹蓝、赛道红、极光绿、樱粉、暗夜紫、钛银、火山橙。风格与配色可自由组合。
|
|
13
|
-
- **用量与费用**:显示总 Token、费用(¥),并可开启输入/输出、缓存命中、会话数、今日用量、限额进度等副卡片。
|
|
14
|
-
- **限额**:支持全局 / 日 / 周 / 月 四类限额(默认全局为空=自动量程)。指针按所选口径对限额扫动。
|
|
15
|
-
- **中英文界面**:设置内一键切换 zh / en。
|
|
16
|
-
- **导出报表**:一键导出 CSV / JSON 用量明细(全局、分模型、按日/周/月/会话)。
|
|
17
|
-
- **侧边栏 Tab**:通过 `dsh-better-sidebar` 注册(稳定版 0.1.1-rc.x 唯一的外部 Tab 入口,web profile 需已安装);Client 半边将 react 打进 bundle,无需额外运行时。Host 半边监听 DSH 会话用量事件自行累计,可独立发布。
|
|
19
|
+
一个给 **DeepSeek Harness(DSH)** 用的侧边栏 Token 费用仪表盘。用老式车机 / 马卡龙 / 极简 / 星空四种皮肤,把 Token 输出速度、当前会话与今日消耗、缓存命中率做成一眼能读懂的仪表。
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
> 界面预览使用示例数据;实际数据来自 DSH 本地会话日志聚合,不伪造样本。
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
> **前置依赖 `dsh-better-sidebar`**:本插件的 Tab 通过 `ctx.betterSidebar.registerTab` 注册到它的**右侧工作台**,所以它必须是 **profile 的直接依赖、且已挂进 `dsh.profile.bundles`**:
|
|
23
|
-
>
|
|
24
|
-
> `dsh plugin --profile web add dsh-better-sidebar`
|
|
25
|
-
>
|
|
26
|
-
> ⚠️ **陷阱(很常见)**:它若只是本插件的**传递依赖**,只会被装进 `node_modules` 而**不会**被挂成 bundle 层 —— 加载树里没有条目、`betterSidebar` 服务不会被 provide,表现就是本插件「已启用 / 已挂载」却没有任何侧边栏 Tab,**而且全程零报错**(0.1.7 起会在浏览器控制台打出明确指引)。同理请确认 `cordis.patch.yml` 与 `.dsh-market/state.json` 没有把它列为 `disabled`。
|
|
27
|
-
>
|
|
28
|
-
> 另注:Tab 注册后会出现在侧边栏 **「+ 新建 Tab」菜单**里(这是 better-sidebar 的设计:注册的是 tab *类型*,需你点开一次才会出现在标签栏),详见下方「排查」。
|
|
23
|
+
## 特性
|
|
29
24
|
|
|
30
|
-
|
|
25
|
+
- **两种结构**
|
|
26
|
+
- **单表**:左侧 Token 速度仪表盘,右侧当前会话 / 今日 Token 与金额,底部缓存命中率进度条。
|
|
27
|
+
- **双表**:上方左侧 Token 速度、右侧缓存命中率两个仪表盘;下方并列展示当前会话与今日的 Token 量、金额。
|
|
28
|
+
- **四种皮肤**:古典(老式车机琥珀色)、马卡龙、极简、星空。结构 × 皮肤可自由组合,共 8 种呈现。
|
|
29
|
+
- **实时 Token 速度**:读取当前会话的流式输出增量,指针在 0–500 token/秒之间平滑摆动。
|
|
30
|
+
- **缓存命中率表盘**:量程 70–100%,刻度 70 / 85 / 100;低于 70% 时指针停在 70%,中央数字仍显示真实值。
|
|
31
|
+
- **Token 口径**:统一以 **k(千 token)** 显示,保留两位小数并带千分位,例如 `15,098.77k`。
|
|
32
|
+
- **设置入口**:卡片右上角滑杆图标;选择结构与皮肤后立即生效,并写入 `localStorage`,刷新后保留。
|
|
33
|
+
- **主题自适应**:颜色来自 DSH 主题令牌,深浅色模式均可读;不引入图表库、不请求外部 CDN。
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
dsh plugin --profile web add dsh-token-gauge@0.1.7
|
|
35
|
-
dsh web
|
|
36
|
-
```
|
|
37
|
-
> 若想装最新版,可先 `dsh plugin --profile web update dsh-token-gauge` 升级,再确认 `node_modules/dsh-token-gauge/package.json` 的 `dsh.bundle.patch` 字段存在。
|
|
35
|
+
## 安装
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
本插件自带 Host 半边,直接从 DSH 的 `sessionPersistence` 读取本地会话日志并聚合用量,**不依赖任何计费插件**。
|
|
40
38
|
|
|
41
|
-
若此前已误装 `0.1.0`(表现为 `dsh.profile.bundles` 未新增 `token-gauge` 层,并出现 `declares no dsh.bundle — installed as a plain dependency` 警告),按下面两步切换即可,无需手动改 bundles:
|
|
42
39
|
```bash
|
|
43
|
-
dsh plugin --profile web
|
|
44
|
-
dsh plugin --profile web add dsh-token-gauge@0.1.7 # 钉版本,避免又解析回 0.1.0
|
|
40
|
+
dsh plugin --profile web add dsh-token-gauge
|
|
45
41
|
```
|
|
46
|
-
装完后 `dsh.profile.bundles` 在 reconcile 时自动把 `token-gauge` 加为最后一层,重启 `dsh web` 后,在侧边栏 **「+ 新建 Tab」菜单**里选「Token 仪表盘」即可打开。
|
|
47
42
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
git clone <本仓库> dsh-token-gauge
|
|
51
|
-
cd dsh-token-gauge
|
|
52
|
-
npm install
|
|
53
|
-
node build.mjs # 生成 lib/index.mjs 与 lib/client.mjs
|
|
54
|
-
dsh plugin --profile web add . # 读取 package.json 的 dsh 字段
|
|
55
|
-
dsh web
|
|
56
|
-
```
|
|
57
|
-
或在已运行 DSH 的情况下以本地 overlay 调试:
|
|
43
|
+
从源码安装(本仓库当前版本):
|
|
44
|
+
|
|
58
45
|
```bash
|
|
59
|
-
|
|
60
|
-
dsh
|
|
46
|
+
git clone https://github.com/liumiaozhi/dsh-token-gauge.git
|
|
47
|
+
dsh plugin --profile web add "link:<本仓库绝对路径>"
|
|
61
48
|
```
|
|
62
49
|
|
|
63
|
-
|
|
50
|
+
> npm 上的 `dsh-token-gauge` 若仍为旧版,请先用源码安装;发布 1.1.0 后可直接按名称安装。
|
|
64
51
|
|
|
65
|
-
|
|
52
|
+
安装后重启或硬刷新 DSH Web,侧边栏底部会出现「费用仪表盘」。插件以 slot 优先级覆盖原计费卡片,但不需要计费插件本身。
|
|
66
53
|
|
|
67
|
-
|
|
54
|
+
## 使用
|
|
68
55
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
- 改动后务必**完整重启 `dsh web`**(进程内 client 缓存只在重启时清空),仅硬刷新不够。
|
|
56
|
+
1. 点击卡片**右上角**的滑杆图标打开设置。
|
|
57
|
+
2. 在「结构」中选择 **单表 / 双表**。
|
|
58
|
+
3. 在下方四种皮肤中选择 **古典 / 马卡龙 / 极简 / 星空**。
|
|
59
|
+
4. 开始对话,Token 速度表会随流式输出更新;会话与今日数据每 1.5 秒刷新。
|
|
74
60
|
|
|
75
|
-
|
|
61
|
+
<p align="center">
|
|
62
|
+
<img src="screenshots/settings.png" alt="设置面板:结构 + 四种皮肤" width="62%">
|
|
63
|
+
</p>
|
|
76
64
|
|
|
77
|
-
|
|
78
|
-
- **累计视图**:全局 / 当日 / 当周 / 当月 / 会话 / 模型 六套。
|
|
79
|
-
- **费用**:`费用 = (未命中输入×输入未命中单价 + 缓存命中×输入命中单价 + 缓存写入×写入单价 + 输出×输出单价) / 1,000,000`。
|
|
80
|
-
内置 DeepSeek 官方 ¥ 预设(如 deepseek-chat:输入缓存命中 0.5 / 未命中 2、输出 8;deepseek-reasoner:1 / 4 / 16),可在设置「高级·定价」中按模型自定义(¥/百万 token)。
|
|
65
|
+
## 数据与口径
|
|
81
66
|
|
|
82
|
-
|
|
67
|
+
| 指标 | 来源 / 口径 |
|
|
68
|
+
| --- | --- |
|
|
69
|
+
| Token 速度 | 当前会话 `assistant/live-chunk` 文本 / reasoning / tool-call 增量估算,0–500 token/秒 |
|
|
70
|
+
| 当前会话 Token | 当前会话所有轮次的 `input + output` |
|
|
71
|
+
| 今日 Token | 本插件 `byDay` 中今天的 `input + output` |
|
|
72
|
+
| 当前会话金额 | 当前会话所有成功模型调用按单价估算 |
|
|
73
|
+
| 今日金额 | 本插件按 DeepSeek Flash / Pro 列表价与峰谷时段估算的今日费用 |
|
|
74
|
+
| 缓存命中率 | 今日 `cacheHit / (cacheHit + cacheMiss)`,仪表盘量程 70–100% |
|
|
83
75
|
|
|
84
|
-
|
|
85
|
-
|---|---|
|
|
86
|
-
| 语言 | 中文 / English |
|
|
87
|
-
| 风格 | 6 种机车风格 |
|
|
88
|
-
| 配色 | 8 种调色板 |
|
|
89
|
-
| 用量口径 | 全局累计 / 当前会话 / 今日 / 每日 / 每周 / 每月 |
|
|
90
|
-
| 显示内容 | 用量、费用、输入/输出、缓存节省、会话数、今日用量、限额进度(可独立开关) |
|
|
91
|
-
| 限额 | 全局 / 日 / 周 / 月(留空为不限,仪表盘自动量程) |
|
|
92
|
-
| 高级·定价 | 按模型编辑输入命中/未命中、输出、缓存写入 单价(¥/百万 token) |
|
|
93
|
-
| 导出报表 | CSV / JSON |
|
|
94
|
-
| 其他 | 清空用量、恢复默认 |
|
|
76
|
+
Host 半边读取 DSH 的 `sessionPersistence` 会话日志,按 `assistant/message.usage` 聚合;搜索调用按 0.02 元/次估算。DeepSeek Flash(2 / 0.04 / 8 元每百万 token)与 Pro(9 / 0.3 / 27)使用官方列表价,工作日高峰外与周末按半价;其他模型回退到 Flash 价格估算。金额是参考值,不是官方账单。
|
|
95
77
|
|
|
96
78
|
## 目录结构
|
|
97
79
|
|
|
98
|
-
```
|
|
80
|
+
```text
|
|
99
81
|
dsh-token-gauge/
|
|
100
|
-
├── package.json #
|
|
101
|
-
├──
|
|
102
|
-
├──
|
|
103
|
-
├──
|
|
104
|
-
├──
|
|
105
|
-
|
|
106
|
-
│ ├──
|
|
107
|
-
│
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
│ ├── export.ts # 报表导出
|
|
112
|
-
│ └── util.ts # 格式化/量程工具
|
|
113
|
-
├── lib/ # 构建产物(lib/index.mjs / lib/client.mjs),随包发布
|
|
114
|
-
├── README.md / README.en.md / LICENSE
|
|
82
|
+
├── package.json # DSH bundle + Client 声明
|
|
83
|
+
├── cordis.patch.yml # 插入 token-gauge 行
|
|
84
|
+
├── index.js # Host 半边:注册 /api/token-gauge/usage-stats
|
|
85
|
+
├── usage-server.js # 会话日志聚合 + DeepSeek 峰谷计价
|
|
86
|
+
├── client.js # Client 半边:仪表盘 / 设置 / 样式
|
|
87
|
+
├── locale/
|
|
88
|
+
│ ├── zh.json # 插件市场中文标题与描述
|
|
89
|
+
│ └── en.json
|
|
90
|
+
├── icon.svg # 插件图标
|
|
91
|
+
├── screenshots/ # README 预览图
|
|
92
|
+
└── README.md / README.en.md / LICENSE
|
|
115
93
|
```
|
|
116
94
|
|
|
117
|
-
##
|
|
118
|
-
|
|
119
|
-
本包已按 DSH 插件规范命名(`dsh.bundle.patch` 清单 + `lib/index.mjs` / `lib/client.mjs`),并声明 `files` 白名单。
|
|
120
|
-
发布到 npm 后,其他用户即可 `dsh plugin --profile web add dsh-token-gauge` 安装发现:
|
|
95
|
+
## 开发
|
|
121
96
|
|
|
122
97
|
```bash
|
|
123
|
-
|
|
124
|
-
|
|
98
|
+
git clone https://github.com/liumiaozhi/dsh-token-gauge.git
|
|
99
|
+
cd dsh-token-gauge
|
|
100
|
+
# 本插件是手写 Client bundle,无构建步骤
|
|
101
|
+
dsh plugin --profile web add "link:$PWD"
|
|
125
102
|
```
|
|
126
103
|
|
|
104
|
+
修改 `client.js` 后,DSH 的 Client HMR 会在文件变化后重新加载模块;没有热更新时刷新页面即可。
|
|
105
|
+
|
|
106
|
+
## 兼容与限制
|
|
107
|
+
|
|
108
|
+
- 面向 DSH Web(`platform: web`),需要 `@deepseek-ai/dsh-client-ui-sidebar` 与 `@deepseek-ai/dsh-client-ui-session`。
|
|
109
|
+
- Host 半边依赖 DSH 自带的 `sessionPersistence` 与 `webServer` 服务;不需要计费插件。
|
|
110
|
+
- 缓存命中率低于 70% 时指针停在 70% 刻度,中央数字保留真实值,避免表盘外推。
|
|
111
|
+
- README 图片为按实际组件样式生成的示例预览,数据为演示值。
|
|
112
|
+
|
|
127
113
|
## 许可
|
|
128
114
|
|
|
129
|
-
MIT
|
|
115
|
+
[MIT](LICENSE) © 2026 liumiaozhi
|