dsh-deepseek-balance-widget 2.4.1 → 2.4.2
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 +35 -18
- package/README_EN.md +33 -16
- package/lib/client.js +8 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,29 +8,46 @@
|
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
11
|
+
**侧边栏入口**
|
|
12
|
+
- 实时显示当前平台的余额 / 今日消费 / 今日 Token,每 30 秒自动刷新
|
|
13
|
+
- 数值随弹窗内切换的平台联动
|
|
14
|
+
|
|
15
|
+
**详情弹窗**
|
|
16
|
+
- 顶部显示当前平台,点「**更换**」下拉在已添加平台间切换,点「**×**」移除(带确认)
|
|
17
|
+
- 右上角「**+ 添加**」:加入 MiMo 或 DeepSeek
|
|
18
|
+
- DeepSeek 详情:余额、累计消费、今日消费、今日 Token、本月消耗(本月消费 / Tokens)
|
|
19
|
+
- MiMo 详情:余额、累计消费、今日消费 / 今日 Token、本月消耗、**每日消耗表**(日期 / Token / 请求 / 消费)
|
|
20
|
+
- DeepSeek 显示时段徽章(繁忙 / 空闲,GMT+8:工作日 09-12 / 14-18 为繁忙时段,周末全天空闲)
|
|
21
|
+
|
|
22
|
+
**用量统计**
|
|
23
|
+
- DeepSeek:需可选配置 `DEEPSEEK_PLATFORM_TOKEN`(对 AI 说「帮我配置用量统计」即可);未配置时仅显示余额
|
|
24
|
+
- MiMo:余额与用量均用登录 Cookie 查询,自动推算消费金额(按官方单价)
|
|
25
|
+
|
|
26
|
+
**AI 帮我配置**
|
|
27
|
+
- 弹窗内一键复制提示语,发给智能体后 AI 读取本机教程文件、一步步引导你抓取凭证并写入插件
|
|
28
|
+
- MiMo 支持两种方式:AI 引导向导(打开余额页 → 复制提示语),或手动粘贴 Cookie / cURL(自动提取 Cookie)
|
|
29
|
+
- 数据仅存本机,不上传
|
|
30
|
+
|
|
31
|
+
**版本与更新**
|
|
32
|
+
- 弹窗底部显示当前版本,有新版本时显示 `vX → vY 更新`,一键自动更新
|
|
33
|
+
- 更新失败时显示错误详情面板(可复制错误信息),并引导前往 GitHub 自行安装
|
|
34
|
+
- 界面语言随 dsh 设置自动切换中 / EN
|
|
18
35
|
|
|
19
36
|
## 安装
|
|
20
37
|
|
|
21
38
|
需要:已安装 dsh(可用 `dsh web`)。
|
|
22
39
|
|
|
23
40
|
```bash
|
|
24
|
-
dsh plugin --profile web add dsh-deepseek-balance-widget@2.4.
|
|
41
|
+
dsh plugin --profile web add dsh-deepseek-balance-widget@2.4.2
|
|
25
42
|
```
|
|
26
43
|
|
|
27
44
|
从 npm 拉取安装,dsh 自动注册到 `dsh.profile.bundles`,完成后**重启 `dsh web`** 即可。
|
|
28
45
|
|
|
29
|
-
> **务必写死版本号 `@2.4.
|
|
46
|
+
> **务必写死版本号 `@2.4.2`**(当前最新稳定版)。不要用 `@latest`——它会被本地 pnpm/npm 缓存或镜像源解析成旧版本,导致装到老版。如果未来发布了更高版本,把这里的版本号换成最新的即可。
|
|
30
47
|
|
|
31
48
|
也可以直接对 AI 说:
|
|
32
49
|
|
|
33
|
-
> 帮我用 npm 安装 dsh-deepseek-balance-widget 插件,执行 `dsh plugin --profile web add dsh-deepseek-balance-widget@2.4.
|
|
50
|
+
> 帮我用 npm 安装 dsh-deepseek-balance-widget 插件,执行 `dsh plugin --profile web add dsh-deepseek-balance-widget@2.4.2`。
|
|
34
51
|
|
|
35
52
|
## 配置
|
|
36
53
|
|
|
@@ -40,12 +57,12 @@ dsh plugin --profile web add dsh-deepseek-balance-widget@2.4.1
|
|
|
40
57
|
|
|
41
58
|
> 帮我配置 dsh-deepseek-balance-widget。
|
|
42
59
|
|
|
43
|
-
AI 会接管全部:问 API Key / 引导获取平台 Cookie →
|
|
60
|
+
AI 会接管全部:问 API Key / 引导获取平台 Cookie → 读取本机教程写入配置 → 提醒重启 `dsh web`。
|
|
44
61
|
|
|
45
62
|
| 平台 | 凭据 | 备注 |
|
|
46
63
|
| --- | --- | --- |
|
|
47
64
|
| DeepSeek | `DEEPSEEK_API_KEY` | 必填,余额 |
|
|
48
|
-
| DeepSeek 用量 | `DEEPSEEK_PLATFORM_TOKEN` |
|
|
65
|
+
| DeepSeek 用量 | `DEEPSEEK_PLATFORM_TOKEN` | 可选,统计累计 / 本月 / 今日 |
|
|
49
66
|
| MiMo(小米) | 登录 Cookie | AI 引导获取 |
|
|
50
67
|
|
|
51
68
|
凭据保存在你本机的 `~/.dsh/ai-balances.json`,不随插件分发、不上传。
|
|
@@ -57,29 +74,29 @@ AI 会接管全部:问 API Key / 引导获取平台 Cookie → 写入本机
|
|
|
57
74
|
### 方式一:弹窗一键更新(推荐,已装用户)
|
|
58
75
|
|
|
59
76
|
1. 打开余额弹窗,底部会显示版本号;有新版本时显示 `vX → vY 更新`(`vY` 为 npm 上 semver 最高的版本)。
|
|
60
|
-
2.
|
|
77
|
+
2. 点击「**更新**」,插件会自动从 npm 拉取并安装最高版本。
|
|
61
78
|
3. 安装完成后**必须彻底重启 `dsh web`**(关掉 `dsh web` 进程 / 退出桌面端再重开,**仅刷新浏览器页面无效**)才能加载新版本。
|
|
62
79
|
|
|
63
|
-
>
|
|
80
|
+
> 弹窗的「更新」会跳过 `latest` tag,直接安装 npm 上 semver 最高的版本,所以即使有人把 `latest` 改低了也能升到最新。
|
|
64
81
|
|
|
65
82
|
### 方式二:命令行强制更新(最稳妥,适合卡住或装不上的情况)
|
|
66
83
|
|
|
67
84
|
```bash
|
|
68
|
-
dsh plugin --profile web add dsh-deepseek-balance-widget@2.4.
|
|
85
|
+
dsh plugin --profile web add dsh-deepseek-balance-widget@2.4.2
|
|
69
86
|
```
|
|
70
87
|
|
|
71
|
-
**写死版本号 `@2.4.
|
|
88
|
+
**写死版本号 `@2.4.2`** 可绕过本地缓存 / 镜像源不同步 / `latest` 解析成旧版的问题,一步到位。装完**彻底重启 `dsh web`**。
|
|
72
89
|
|
|
73
90
|
### 方式三:手动更新(命令行更新失败时兜底)
|
|
74
91
|
|
|
75
92
|
```bash
|
|
76
93
|
cd ~/.dsh/profiles/web
|
|
77
|
-
npm install dsh-deepseek-balance-widget@2.4.
|
|
94
|
+
npm install dsh-deepseek-balance-widget@2.4.2 # 若目录内有 pnpm-lock.yaml 则用 pnpm add
|
|
78
95
|
# 验证磁盘上确实变了
|
|
79
96
|
cat node_modules/dsh-deepseek-balance-widget/package.json | grep '"version"'
|
|
80
97
|
```
|
|
81
98
|
|
|
82
|
-
确认输出 `2.4.
|
|
99
|
+
确认输出 `2.4.2` 后,**彻底重启 `dsh web`** 即可。
|
|
83
100
|
|
|
84
101
|
> 如果你的环境里弹窗/命令行的更新一直失败(提示版本没变),通常是 Agent 主机(如 WorkBuddy)通过 `NODE_OPTIONS` 注入了文件删除拦截导致 pnpm/npm 更新中断。此时在**普通终端**(不通过 Agent 运行)里执行上面的命令即可成功;或先执行 `set NODE_OPTIONS=`(PowerShell)再重试。
|
|
85
102
|
|
package/README_EN.md
CHANGED
|
@@ -8,29 +8,46 @@ A multi-provider AI balance widget for the dsh web sidebar. **DeepSeek** is buil
|
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
11
|
+
**Sidebar entry**
|
|
12
|
+
- Live Balance / Today spend / Today tokens for the current provider, auto-refresh every 30 s
|
|
13
|
+
- Values follow the provider selected in the popover
|
|
14
|
+
|
|
15
|
+
**Detail popover**
|
|
16
|
+
- Header shows the current provider: a "**Switch**" menu changes to another added provider, "**×**" removes it (with confirmation)
|
|
17
|
+
- "**+ Add**" button (top right): add MiMo or DeepSeek
|
|
18
|
+
- DeepSeek details: balance, cumulative spend, today spend, today tokens, monthly usage (monthly spend / tokens)
|
|
19
|
+
- MiMo details: balance, cumulative spend, today spend / today tokens, monthly usage, and a **daily usage table** (date / tokens / requests / spend)
|
|
20
|
+
- DeepSeek shows a peak / off-peak badge (GMT+8: weekdays 09-12 / 14-18 are peak, weekends off-peak all day)
|
|
21
|
+
|
|
22
|
+
**Usage stats**
|
|
23
|
+
- DeepSeek: optional `DEEPSEEK_PLATFORM_TOKEN` (just tell your AI "help me configure usage stats"); balance-only otherwise
|
|
24
|
+
- MiMo: balance and usage both come from the login cookie; spend is computed at official unit prices
|
|
25
|
+
|
|
26
|
+
**AI-guided setup**
|
|
27
|
+
- One click in the popover copies a prompt; the AI reads the local guide file and walks you through capturing and writing credentials
|
|
28
|
+
- MiMo supports two paths: an AI wizard (open balance page → copy prompt), or pasting the Cookie / cURL manually (Cookie auto-extracted)
|
|
29
|
+
- Everything stays on your machine; nothing is uploaded
|
|
30
|
+
|
|
31
|
+
**Version & updates**
|
|
32
|
+
- The footer shows the current version; when a newer one exists it reads `vX → vY 更新` with one-click auto-update
|
|
33
|
+
- On update failure an error panel shows the details (copyable) and points you to GitHub for a manual install
|
|
34
|
+
- UI follows dsh's language setting (中文 / EN)
|
|
18
35
|
|
|
19
36
|
## Install
|
|
20
37
|
|
|
21
38
|
Requires: dsh installed (with `dsh web` working).
|
|
22
39
|
|
|
23
40
|
```bash
|
|
24
|
-
dsh plugin --profile web add dsh-deepseek-balance-widget@2.4.
|
|
41
|
+
dsh plugin --profile web add dsh-deepseek-balance-widget@2.4.2
|
|
25
42
|
```
|
|
26
43
|
|
|
27
44
|
Installed from npm and auto-registered by dsh. **Restart `dsh web`** and the balance button appears in the sidebar.
|
|
28
45
|
|
|
29
|
-
> **Always pin the version `@2.4.
|
|
46
|
+
> **Always pin the version `@2.4.2`** (the current latest stable). Do not use `@latest` — local pnpm/npm cache or a mirror registry can resolve it to an outdated release. When a newer version is released, bump the number here.
|
|
30
47
|
|
|
31
48
|
Or just tell your AI:
|
|
32
49
|
|
|
33
|
-
> Install the dsh-deepseek-balance-widget plugin for me via npm: run `dsh plugin --profile web add dsh-deepseek-balance-widget@2.4.
|
|
50
|
+
> Install the dsh-deepseek-balance-widget plugin for me via npm: run `dsh plugin --profile web add dsh-deepseek-balance-widget@2.4.2`.
|
|
34
51
|
|
|
35
52
|
## Configuration
|
|
36
53
|
|
|
@@ -57,29 +74,29 @@ Upgrade to the latest stable release on npm regardless of which older version yo
|
|
|
57
74
|
### Method 1: One-click from the popover (recommended for installed users)
|
|
58
75
|
|
|
59
76
|
1. Open the balance popover; the footer shows the version. When a newer one exists it reads `vX → vY 更新` (where `vY` is the highest semver version on npm).
|
|
60
|
-
2. Click "
|
|
77
|
+
2. Click "**更新**" (Update). The plugin pulls and installs the highest semver version from npm automatically.
|
|
61
78
|
3. After install you **must fully restart `dsh web`** (stop the `dsh web` process / quit the desktop app and reopen — **refreshing the browser tab is not enough**) for the new version to load.
|
|
62
79
|
|
|
63
|
-
> The popover's "
|
|
80
|
+
> The popover's "Update" skips the `latest` tag and installs the highest semver version on npm, so it still reaches latest even if someone lowers the `latest` tag.
|
|
64
81
|
|
|
65
82
|
### Method 2: Force update from the command line (most reliable if stuck)
|
|
66
83
|
|
|
67
84
|
```bash
|
|
68
|
-
dsh plugin --profile web add dsh-deepseek-balance-widget@2.4.
|
|
85
|
+
dsh plugin --profile web add dsh-deepseek-balance-widget@2.4.2
|
|
69
86
|
```
|
|
70
87
|
|
|
71
|
-
**Pinning `@2.4.
|
|
88
|
+
**Pinning `@2.4.2`** bypasses local cache / mirror desync / a stale `latest` resolution in one step. Then **fully restart `dsh web`**.
|
|
72
89
|
|
|
73
90
|
### Method 3: Manual update (fallback when the command-line update fails)
|
|
74
91
|
|
|
75
92
|
```bash
|
|
76
93
|
cd ~/.dsh/profiles/web
|
|
77
|
-
npm install dsh-deepseek-balance-widget@2.4.
|
|
94
|
+
npm install dsh-deepseek-balance-widget@2.4.2 # use `pnpm add` if a pnpm-lock.yaml exists in this dir
|
|
78
95
|
# verify the on-disk version actually changed
|
|
79
96
|
cat node_modules/dsh-deepseek-balance-widget/package.json | grep '"version"'
|
|
80
97
|
```
|
|
81
98
|
|
|
82
|
-
Once it prints `2.4.
|
|
99
|
+
Once it prints `2.4.2`, **fully restart `dsh web`**.
|
|
83
100
|
|
|
84
101
|
> If the popover / command-line update keeps failing (version never changes), an agent host (e.g. WorkBuddy) is likely injecting a file-deletion guard via `NODE_OPTIONS`, which makes pnpm/npm abort during updates. Run the command in a **plain terminal** (not through the agent), or unset `NODE_OPTIONS` first (PowerShell: `set NODE_OPTIONS=`) and retry.
|
|
85
102
|
|
package/lib/client.js
CHANGED
|
@@ -1104,9 +1104,15 @@ window.__ModuleLoader__.load({
|
|
|
1104
1104
|
return html;
|
|
1105
1105
|
}
|
|
1106
1106
|
|
|
1107
|
-
/** DeepSeek peak/off-peak period based on Beijing time (UTC+8).
|
|
1107
|
+
/** DeepSeek peak/off-peak period based on Beijing time (UTC+8).
|
|
1108
|
+
* Weekdays peak: 09:00-12:00, 14:00-18:00.
|
|
1109
|
+
* Since 2026-08-23 00:00 CST, weekends (Sat/Sun) are off-peak all day.
|
|
1110
|
+
*/
|
|
1108
1111
|
function currentDeepseekPeriod() {
|
|
1109
|
-
const
|
|
1112
|
+
const bj = new Date(Date.now() + 8 * 60 * 60 * 1000);
|
|
1113
|
+
const hour = bj.getUTCHours();
|
|
1114
|
+
const day = bj.getUTCDay(); // 0 = Sunday, 6 = Saturday
|
|
1115
|
+
if (day === 0 || day === 6) return "offPeak";
|
|
1110
1116
|
return ((hour >= 9 && hour < 12) || (hour >= 14 && hour < 18)) ? "peak" : "offPeak";
|
|
1111
1117
|
}
|
|
1112
1118
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-deepseek-balance-widget",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Multi-provider AI balance widget for the dsh web sidebar: a live, auto-refreshing balance pill plus a detail popover listing DeepSeek and any added providers (MiMo etc.). Keys are stored per-machine in ~/.dsh/ai-balances.json and resolved from the local credential seam, never hardcoded.",
|
|
6
6
|
"keywords": [
|