dsh-token-pulse 0.2.2-beta

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hou-DL
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,69 @@
1
+ # dsh-token-pulse
2
+
3
+ > 中文版:见 [README.md](./README.md)
4
+
5
+ A local Token usage heatmap plugin for DSH Web — GitHub-style calendar views, built into the Settings pane.
6
+
7
+ ## Requirements
8
+
9
+ - **Node.js ≥ 23.8** (built-in `node:zlib` zstd decoding, no extra install); on older Node it falls back to an external `zstd` CLI (`sudo apt install zstd` / `brew install zstd`).
10
+ - A running **DSH Web profile** (`dsh web`).
11
+
12
+ ## Install
13
+
14
+
15
+ ```bash
16
+ # From GitHub
17
+ dsh plugin --profile web add github:Hou-DL/dsh-token-pulse
18
+
19
+ # Or from Gitee (faster in China)
20
+ dsh plugin --profile web add "git+https://gitee.com/HouDL/dsh-token-pulse.git"
21
+ ```
22
+
23
+ Restart, then open **Settings → Token Pulse**.
24
+
25
+ - **Zero network, zero billing** — reads local session logs only, never touches billing/balance APIs
26
+ - **Persistent** — history is stored on disk; deleting sessions never loses data
27
+ - **Multiple views** — Week (per-hour) / Month (calendar) / Quarter (last ~90 days) / Year (full year, two rows)
28
+ - **Stats** — Today / This week / This month / All time + Top 5 by model and by provider
29
+
30
+ ## Screenshots
31
+
32
+ <p align="center">
33
+ <img src="assets/screenshot-week.png" alt="Week view" width="60%">
34
+ <br><br>
35
+ <img src="assets/screenshot-month.png" alt="Month view" width="60%">
36
+ <br><br>
37
+ <img src="assets/screenshot-quarter-year.png" alt="Quarter / Year view" width="60%">
38
+ </p>
39
+
40
+ ## Features
41
+
42
+ | Module | Description |
43
+ | --- | --- |
44
+ | View switcher | Week / Month / Quarter / Year, colored with a view-adaptive 25 / 50 / 75 / 100% palette |
45
+ | Week view | 24 hourly bars per day to spot peak hours; click a row to see that day's Top 5 |
46
+ | Month view | Calendar cells showing date and daily usage |
47
+ | Quarter / Year | GitHub-style grids; quarter is enlarged for readability, year laid out in two rows |
48
+ | Top stats | Today / Week / Month / All-time, M / k abbreviated |
49
+ | Top 5 models | By model or provider, switching with the view window / clicked date |
50
+ | Refresh | Manual refresh + auto refresh (5 / 10 / 30 / 60 min, or off) |
51
+ | Language | 中 / English switch |
52
+
53
+ ## FAQ
54
+
55
+ - **Everything shows 0?** Make sure `~/.dsh/sessions` contains session logs with a `usage` field.
56
+ - **Does it go online?** No. Fully local.
57
+ - **Timezone?** Fixed to Asia/Shanghai, weeks start on Monday.
58
+ - **How to reset?** Settings page → ⋯ menu (top-right) → Reset history.
59
+
60
+ ## Development
61
+
62
+ ```bash
63
+ pnpm install && npx tsdown # build
64
+ node --test src/ # run tests
65
+ ```
66
+
67
+ ## License
68
+
69
+ MIT
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # dsh-token-pulse
2
+
3
+ > English: [README.en.md](./README.en.md)
4
+
5
+ 本地 Token 用量热图插件,GitHub 风格日历视图,内置于 DSH Web 设置页。
6
+
7
+ ## 环境要求
8
+
9
+ - **Node.js ≥ 23.8**(内置 `node:zlib` 的 zstd 解码,无需额外安装);更早版本会回退到外部 `zstd` CLI(`sudo apt install zstd` / `brew install zstd`)。
10
+ - **DSH Web profile**(`dsh web` 已运行)。
11
+
12
+ ## 安装
13
+
14
+
15
+ ```bash
16
+ # 从 GitHub
17
+ dsh plugin --profile web add github:Hou-DL/dsh-token-pulse
18
+
19
+ # 或从 Gitee(国内访问更快)
20
+ dsh plugin --profile web add "git+https://gitee.com/HouDL/dsh-token-pulse.git"
21
+ ```
22
+
23
+ 重启后打开 **设置 → Token Pulse** 即可。
24
+
25
+ - **零网络、零计费**:只读本地会话日志,不触碰任何计费 / 余额接口
26
+ - **持久化**:历史落盘,删除会话不丢数据
27
+ - **多视图**:周(按小时展开)/ 月(日历)/ 季度(近 90 天)/ 年(整年双行)
28
+ - **统计**:今日 / 本周 / 本月 / 累计 + 按模型与供应商的 Top 5
29
+
30
+ ## 截图
31
+
32
+ <p align="center">
33
+ <img src="assets/screenshot-week.png" alt="周视图" width="60%">
34
+ <br><br>
35
+ <img src="assets/screenshot-month.png" alt="月视图" width="60%">
36
+ <br><br>
37
+ <img src="assets/screenshot-quarter-year.png" alt="季度 / 年度视图" width="60%">
38
+ </p>
39
+
40
+ ## 功能
41
+
42
+ | 模块 | 说明 |
43
+ | --- | --- |
44
+ | 视图切换 | 周 / 月 / 季度 / 年,颜色按视图内 25% / 50% / 75% / 100% 四档分档 |
45
+ | 周视图 | 每天 24 个小时柱,看高峰时段;可点击行查看当日 Top 5 |
46
+ | 月视图 | 日历格显示日期与当日用量 |
47
+ | 季度 / 年度 | GitHub 风格栅格,季度放大便于观察,年度双行排布 |
48
+ | 顶部统计 | 今日 / 本周 / 本月 / 累计,M / k 缩写 |
49
+ | 模型 Top 5 | 按模型或供应商查看,随视图窗口 / 点击日期动态切换 |
50
+ | 刷新 | 手动刷新 + 自动刷新(5 / 10 / 30 / 60 分钟,可关闭) |
51
+ | 语言 | 中 / 英文切换 |
52
+
53
+ ## 常见问题
54
+
55
+ - **显示 0?** 确认 `~/.dsh/sessions` 下有含 `usage` 字段的会话日志。
56
+ - **会联网吗?** 不会,纯本地统计。
57
+ - **时区?** 固定北京时区,周一为周起始。
58
+ - **如何重置?** 设置页右上角 ⋯ → 「重置历史」。
59
+
60
+ ## 开发
61
+
62
+ ```bash
63
+ pnpm install && npx tsdown # 构建
64
+ node --test src/ # 运行测试
65
+ ```
66
+
67
+ ## License
68
+
69
+ MIT
package/README.zh.md ADDED
@@ -0,0 +1,33 @@
1
+ # dsh-token-pulse
2
+
3
+ 本地 Token 用量热图插件,GitHub 风格日历视图,内置于 DSH Web 设置页。
4
+
5
+ ## 环境要求
6
+
7
+ - **Node.js ≥ 23.8**(内置 zstd 解码,无需额外安装);更早版本需外部 `zstd` CLI。
8
+
9
+ ## 安装
10
+
11
+
12
+ ```bash
13
+ # 从 GitHub
14
+ dsh plugin --profile web add github:Hou-DL/dsh-token-pulse
15
+ # 或从 Gitee
16
+ dsh plugin --profile web add "git+https://gitee.com/HouDL/dsh-token-pulse.git"
17
+ ```
18
+
19
+ 重启后打开 **设置 → Token Pulse**。
20
+
21
+
22
+ - **零网络、零计费**:只读本地会话日志
23
+ - **持久化**:历史落盘,删除会话不丢数据
24
+ - **多视图**:周(按小时)/ 月(日历)/ 季度(近 90 天)/ 年(整年双行)
25
+ - **Top 5**:按模型与供应商统计
26
+
27
+ ## 常见问题
28
+
29
+ - **会联网吗?** 不会,纯本地统计。
30
+ - **时区?** 固定北京时区,周一为周起始。
31
+ - **如何重置?** 设置页右上角 ⋯ → 「重置历史」。
32
+
33
+ 完整文档:[README.md](./README.md) · [README.en.md](./README.en.md)
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: dsh-token-pulse
3
+ name: dsh-token-pulse