dsh-notify-tray 0.1.3 → 0.1.5
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 +23 -15
- package/README.zh-CN.md +23 -15
- package/lib/client.js +426 -315
- package/lib/format.js +109 -61
- package/lib/icon.js +62 -1
- package/lib/index.js +86 -23
- package/lib/ledger.js +12 -0
- package/lib/pricing.js +48 -3
- package/lib/system.js +9 -3
- package/lib/tray/linux.js +41 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -27,18 +27,19 @@ A notification + status-bar plugin for DeepSeek Harness (DSH). Works on macOS, W
|
|
|
27
27
|
|
|
28
28
|
The plugin is published on npm as [`dsh-notify-tray`](https://www.npmjs.com/package/dsh-notify-tray). Installing from npm needs nothing beyond DSH itself — no Git required.
|
|
29
29
|
|
|
30
|
+
> **⚠️ To get the latest release, include the version number**, e.g. `dsh-notify-tray@0.1.5` (the latest version is listed on [npm](https://www.npmjs.com/package/dsh-notify-tray)).
|
|
31
|
+
> DSH installs plugins with pnpm, whose supply-chain policy (`minimumReleaseAge`) won't auto-install a release that is still inside its waiting period. With a bare `dsh-notify-tray` you may get an older version (e.g. 0.1.0). If an older version is already installed, remove it first, then install with the version number.
|
|
32
|
+
|
|
30
33
|
**Option 1 — from inside DSH (recommended)**
|
|
31
|
-
Open DSH **Plugins → Add plugin**, type `dsh-notify-tray` into the input box and click **Install**.
|
|
34
|
+
Open DSH **Plugins → Add plugin**, type `dsh-notify-tray@0.1.5` (with the version number) into the input box and click **Install**.
|
|
32
35
|
|
|
33
36
|
**Option 2 — command line**
|
|
34
37
|
|
|
35
38
|
```sh
|
|
36
|
-
# Desktop app (the dsh command bundled with the app)
|
|
37
|
-
dsh plugin --profile desktop add dsh-notify-tray
|
|
39
|
+
# Desktop app (the dsh command bundled with the app); include the version to get the latest
|
|
40
|
+
dsh plugin --profile desktop add dsh-notify-tray@0.1.5
|
|
38
41
|
# Or the web / CLI profile
|
|
39
|
-
dsh plugin --profile web add dsh-notify-tray
|
|
40
|
-
# Pin a specific version
|
|
41
|
-
dsh plugin --profile desktop add dsh-notify-tray@0.1.3
|
|
42
|
+
dsh plugin --profile web add dsh-notify-tray@0.1.5
|
|
42
43
|
```
|
|
43
44
|
|
|
44
45
|
**Option 3 — from the Git repository** (latest unreleased code)
|
|
@@ -49,13 +50,20 @@ This route **requires Git**; without it you'll see `ERR_PNPM_GIT_RESOLVE_FAILED
|
|
|
49
50
|
|
|
50
51
|
Restart DSH after installing. The version on the plugin page is the one installed; the latest is listed on [npm](https://www.npmjs.com/package/dsh-notify-tray).
|
|
51
52
|
|
|
52
|
-
> **Got an older version?**
|
|
53
|
+
> **Got an older version?** Most often this is pnpm's `minimumReleaseAge` described above: a new release is only auto-installed after a waiting period, and the install message says releases younger than the required age are not installed automatically. Remove the plugin, then install with the version number:
|
|
54
|
+
>
|
|
55
|
+
> ```sh
|
|
56
|
+
> dsh plugin --profile desktop remove dsh-notify-tray
|
|
57
|
+
> dsh plugin --profile desktop add dsh-notify-tray@0.1.5
|
|
58
|
+
> ```
|
|
59
|
+
>
|
|
60
|
+
> Also, when the official npm registry is unreachable, DSH falls back to the npmmirror registry, which syncs a little later, so a just-published release may take a few minutes to appear there.
|
|
53
61
|
|
|
54
|
-
To update: `dsh plugin --profile desktop
|
|
62
|
+
To update: include the version here too — `dsh plugin --profile desktop remove dsh-notify-tray`, then `dsh plugin --profile desktop add dsh-notify-tray@<new version>`. To uninstall: `dsh plugin --profile desktop remove dsh-notify-tray`.
|
|
55
63
|
|
|
56
64
|
## Configuration
|
|
57
65
|
|
|
58
|
-
Every option can be changed
|
|
66
|
+
Every option can be changed on DSH's **Plugins → Whale Notify Station** page, or written into the profile's `cordis.patch.yml`. The page's first screen holds only the everyday options (which events notify, sound, the status-bar whale, a today's-spend card, your plan and its quota lookup); notification channel, spend method, custom prices, exchange rate and refresh intervals sit under a folded **Advanced** section at the bottom, tagged with how many of them you have changed.
|
|
59
67
|
|
|
60
68
|
```yaml
|
|
61
69
|
- id: notify-tray
|
|
@@ -78,7 +86,7 @@ Every option can be changed under DSH **Plugins → Whale Notify Station → Con
|
|
|
78
86
|
| `channel` | `auto` | `auto`: the DSH window shows the notification when one is open, otherwise the OS does |
|
|
79
87
|
| `suppressWhenFocused` | `true` | Don't notify while you're looking at that session (switch to another app and you will be) |
|
|
80
88
|
| `sound` | `true` | Play a sound with system notifications (macOS chime, Windows toast sound, Linux where the desktop supports it) |
|
|
81
|
-
| `tray` | `true` | Show the status-bar icon (macOS / Linux, takes effect
|
|
89
|
+
| `tray` | `true` | Show the status-bar icon (macOS / Linux, takes effect as soon as you save; ignored on Windows). After **Hide status-bar icon** in the tray menu, **Show the status-bar icon again** on the settings page brings it back without restarting DSH |
|
|
82
90
|
| `titleStyle` | `text` | What to show next to the whale in the macOS menu bar: `text` (Pending 1 / Running 2), `count` (numbers only), `icon` (whale only) |
|
|
83
91
|
| `showSpendInTitle` | `false` | Append today's spend to the macOS menu-bar label |
|
|
84
92
|
| `errorHoldMinutes` | `10` | How many minutes the icon stays red / shows the `×` after a task fails (macOS / Linux) |
|
|
@@ -87,7 +95,7 @@ Every option can be changed under DSH **Plugins → Whale Notify Station → Con
|
|
|
87
95
|
|
|
88
96
|
| Option | Default | Description |
|
|
89
97
|
|---|---|---|
|
|
90
|
-
| `spendSource` | `auto` | Use the DeepSeek account balance when available, otherwise estimate from prices |
|
|
98
|
+
| `spendSource` | `auto` | Use the DeepSeek account balance when available, otherwise estimate from prices. In `auto`, while balance drops lag behind the DeepSeek models' estimate (the platform bills with a delay) the estimate is shown until the balance catches up; other providers' models are always added as an estimate |
|
|
91
99
|
| `currency` | `CNY` | Display currency |
|
|
92
100
|
| `balancePollMinutes` | `5` | How often (minutes) to refresh the DeepSeek account balance |
|
|
93
101
|
| `priceSource` | `auto` | Which price to estimate with: `auto` (price table → custom price → DSH's built-in model catalog → plugin's built-in prices), `catalog`, `custom` |
|
|
@@ -96,7 +104,7 @@ Every option can be changed under DSH **Plugins → Whale Notify Station → Con
|
|
|
96
104
|
| `exchangeRate` | `7.2` | 1 USD = ? CNY; catalog prices are in USD and converted when displaying CNY |
|
|
97
105
|
| `prices` | `{}` | Per-model price table, highest priority |
|
|
98
106
|
|
|
99
|
-
The **Current API price** section shows the model you're using (provider / model) and its catalog price. DSH's pi-ai adapter ships a model catalog (Claude, GPT, Gemini, Grok, Groq, Kimi, GLM, MiMo, MiniMax, OpenCode Go, DeepSeek, …); the plugin reads it directly and falls back to its built-in prices or your custom price when a model is missing. A one-click **Copy catalog price into custom price** lets you tweak from the catalog value.
|
|
107
|
+
The **Current API price** section shows the model you're using (provider / model) and its catalog price. DSH's pi-ai adapter ships a model catalog (Claude, GPT, Gemini, Grok, Groq, Kimi, GLM, MiMo, MiniMax, OpenCode Go, DeepSeek, …); the plugin reads it directly and falls back to its built-in prices or your custom price when a model is missing. It is found automatically for the desktop app and for `dsh web` (including global npm installs such as `~/.npm-global`); if the settings page says it wasn't found, set the `DSH_NOTIFY_TRAY_PI_AI` environment variable to the DSH install directory (e.g. `~/.npm-global/lib/node_modules/@deepseek-ai/dsh`) and restart. A one-click **Copy catalog price into custom price** lets you tweak from the catalog value.
|
|
100
108
|
|
|
101
109
|
### Plans
|
|
102
110
|
|
|
@@ -128,12 +136,12 @@ Built-in plan presets (prices are the list prices at the time of writing and may
|
|
|
128
136
|
| GPT | ChatGPT Go / Plus / Pro 5x / Pro 20x / Business, API pay-as-you-go | No endpoint for regular keys |
|
|
129
137
|
| MiniMax | M Plan Go / Explore / Build (CN ¥49 / 119 / 469, intl. $22 / 55 / 132), legacy Coding Plan | 5-hour window remaining `GET /v1/coding_plan/remains` |
|
|
130
138
|
|
|
131
|
-
Anything that can't be fetched can be typed in by hand; empty fields are simply hidden. On macOS / Linux the status-bar menu
|
|
139
|
+
Anything that can't be fetched can be typed in by hand; empty fields are simply hidden. On macOS / Linux the status-bar menu shows balance and plan on one row (**余额 ¥… · provider 剩 …**); its submenu lists the DeepSeek balance, plan name and price, remaining quota and reset time, a **Refresh quota** action and the usage page. The full details returned by the endpoint are on the settings page. The menu has one level of submenus, at most 6 rows each and 24 characters per row, so Windows / Linux trays no longer cut it off at the screen edge.
|
|
132
140
|
|
|
133
141
|
## Notes
|
|
134
142
|
|
|
135
143
|
- **When notifications fire** — a task that runs to completion counts as *completed*; an error, hitting the token limit or being blocked counts as *failed*; stopping a task yourself doesn't notify. For `ask_user_question`, questions with options and plan approvals count as *needs a choice*, questions without options as *needs input*; tool approvals count as *needs approval*. Only top-level sessions are tracked — sub-agents don't get their own notifications.
|
|
136
|
-
- **How spend is computed** — when signed in with a DeepSeek account, today's spend is accumulated from drops in the account balance (top-ups don't count as negative spend;
|
|
144
|
+
- **How spend is computed** — when signed in with a DeepSeek account, today's spend is accumulated from drops in the account balance (top-ups don't count as negative spend; the platform bills with a delay, so in `auto` the estimate stands in until the balance catches up). In parallel, it's estimated from each `provider/model` route's tokens × unit price (price sources described under `priceSource` above); the **Today** submenu breaks it down per model (top 3). The ledger lives in `~/.dsh/storages/dsh-notify-tray/ledger.json` and keeps 31 days.
|
|
137
145
|
- **Clicking a notification / the status-bar icon / "Open DeepSeek Harness" in the menu** — brings up the desktop app when there is one, otherwise (`dsh web`) opens the web UI in the browser. Browser notifications require granting notification permission first.
|
|
138
146
|
|
|
139
147
|
## Development
|
|
@@ -162,7 +170,7 @@ Requires Node ≥ 20. Linux uses [`dbus-next`](https://www.npmjs.com/package/dbu
|
|
|
162
170
|
|
|
163
171
|
## Known limitations
|
|
164
172
|
|
|
165
|
-
- Verified on macOS
|
|
173
|
+
- Verified on macOS, Windows and Linux (Linux verified under the web profile: notifications and the system tray).
|
|
166
174
|
|
|
167
175
|
## License
|
|
168
176
|
|
package/README.zh-CN.md
CHANGED
|
@@ -27,18 +27,19 @@ DeepSeek Harness(DSH)的通知 + 状态栏插件,支持 macOS、Windows、
|
|
|
27
27
|
|
|
28
28
|
插件已发布到 npm:[`dsh-notify-tray`](https://www.npmjs.com/package/dsh-notify-tray)。从 npm 安装只需要 DSH 本身,**不需要装 Git**。
|
|
29
29
|
|
|
30
|
+
> **⚠️ 想装最新版,请带上版本号**,例如 `dsh-notify-tray@0.1.5`(最新版本号见 [npm](https://www.npmjs.com/package/dsh-notify-tray))。
|
|
31
|
+
> DSH 用 pnpm 安装插件,pnpm 的供应链安全策略(`minimumReleaseAge`)不会自动安装刚发布、还没过观察期的版本,只写 `dsh-notify-tray` 时会退回装一个旧版本(例如 0.1.0)。已经装了旧版的,先卸载,再带版本号安装。
|
|
32
|
+
|
|
30
33
|
**方式一:在 DSH 里装(推荐)**
|
|
31
|
-
打开 DSH「插件 → 添加插件」,输入框里填 `dsh-notify-tray
|
|
34
|
+
打开 DSH「插件 → 添加插件」,输入框里填 `dsh-notify-tray@0.1.5`(带上版本号),点「安装」。
|
|
32
35
|
|
|
33
36
|
**方式二:命令行**
|
|
34
37
|
|
|
35
38
|
```sh
|
|
36
|
-
# 桌面版(App 内置的 dsh
|
|
37
|
-
dsh plugin --profile desktop add dsh-notify-tray
|
|
39
|
+
# 桌面版(App 内置的 dsh 命令),带上版本号才能装到最新版
|
|
40
|
+
dsh plugin --profile desktop add dsh-notify-tray@0.1.5
|
|
38
41
|
# 或者 Web / 命令行 profile
|
|
39
|
-
dsh plugin --profile web add dsh-notify-tray
|
|
40
|
-
# 指定版本
|
|
41
|
-
dsh plugin --profile desktop add dsh-notify-tray@0.1.3
|
|
42
|
+
dsh plugin --profile web add dsh-notify-tray@0.1.5
|
|
42
43
|
```
|
|
43
44
|
|
|
44
45
|
**方式三:从 Git 仓库装**(想用还没发版的最新代码时)
|
|
@@ -49,13 +50,20 @@ dsh plugin --profile desktop add dsh-notify-tray@0.1.3
|
|
|
49
50
|
|
|
50
51
|
装好后重启 DSH。插件页上显示的版本号就是装上的版本,最新版见 [npm](https://www.npmjs.com/package/dsh-notify-tray)。
|
|
51
52
|
|
|
52
|
-
> **装到的不是最新版?**
|
|
53
|
+
> **装到的不是最新版?** 最常见的原因是上面说的 pnpm `minimumReleaseAge`:新版本发布后要过一段观察期才会被自动安装,安装提示里会写「发布时间未满规定时长的版本不会被自动安装」。解决办法是先卸载,再带版本号安装:
|
|
54
|
+
>
|
|
55
|
+
> ```sh
|
|
56
|
+
> dsh plugin --profile desktop remove dsh-notify-tray
|
|
57
|
+
> dsh plugin --profile desktop add dsh-notify-tray@0.1.5
|
|
58
|
+
> ```
|
|
59
|
+
>
|
|
60
|
+
> 另外,官方 npm 源连不上时 DSH 会退到 npmmirror(淘宝镜像),镜像比官方源晚一点同步,刚发的新版可能要等几分钟才到。
|
|
53
61
|
|
|
54
|
-
|
|
62
|
+
更新:同样建议带版本号,先 `dsh plugin --profile desktop remove dsh-notify-tray`,再 `dsh plugin --profile desktop add dsh-notify-tray@<新版本号>`。卸载:`dsh plugin --profile desktop remove dsh-notify-tray`。
|
|
55
63
|
|
|
56
64
|
## 设置
|
|
57
65
|
|
|
58
|
-
所有选项都可以在 DSH「插件 →
|
|
66
|
+
所有选项都可以在 DSH「插件 → 小鲸鱼通知站」页里修改,也可以写在 profile 的 `cordis.patch.yml` 里。设置页首屏只有常用的几项(通知勾选、提示音、状态栏小鲸鱼、今日花费卡片、我的套餐和额度查询);通知通道、花费算法、自定义单价、汇率、各种刷新间隔都在页面底部的「高级设置」里,默认折叠,改过的项会标「已改 n 项」。
|
|
59
67
|
|
|
60
68
|
```yaml
|
|
61
69
|
- id: notify-tray
|
|
@@ -78,7 +86,7 @@ dsh plugin --profile desktop add dsh-notify-tray@0.1.3
|
|
|
78
86
|
| `channel` | `auto` | `auto`:有 DSH 窗口时由窗口弹,没有窗口时由系统弹 |
|
|
79
87
|
| `suppressWhenFocused` | `true` | 你正在看这个会话时不弹通知(切到别的应用去就有了) |
|
|
80
88
|
| `sound` | `true` | 系统通知带提示音(macOS「叮」一声、Windows 通知音、Linux 视桌面环境而定) |
|
|
81
|
-
| `tray` | `true` | 是否显示状态栏图标(macOS / Linux
|
|
89
|
+
| `tray` | `true` | 是否显示状态栏图标(macOS / Linux,保存后立即生效;Windows 忽略)。在状态栏菜单里点「隐藏状态栏图标」后,可在插件设置页点「重新显示状态栏图标」把它找回来,不用重启 DSH |
|
|
82
90
|
| `titleStyle` | `text` | macOS 菜单栏鲸鱼旁边显示什么:`text`(待处理 1 / 运行中 2)、`count`(只有数字)、`icon`(只有鲸鱼) |
|
|
83
91
|
| `showSpendInTitle` | `false` | macOS 菜单栏文字里附带今日花费 |
|
|
84
92
|
| `errorHoldMinutes` | `10` | 任务失败后图标保持红色 / 挂「×」的分钟数(macOS / Linux) |
|
|
@@ -87,7 +95,7 @@ dsh plugin --profile desktop add dsh-notify-tray@0.1.3
|
|
|
87
95
|
|
|
88
96
|
| 选项 | 默认值 | 说明 |
|
|
89
97
|
|---|---|---|
|
|
90
|
-
| `spendSource` | `auto` | 有 DeepSeek
|
|
98
|
+
| `spendSource` | `auto` | 有 DeepSeek 账户余额时用余额扣费,否则按价格估算。`auto` 下余额扣费落后于 DeepSeek 模型的估算时(平台扣费有延迟),先按估算显示,余额追上后再改回余额;其它平台模型的花费始终按估算加上 |
|
|
91
99
|
| `currency` | `CNY` | 显示币种 |
|
|
92
100
|
| `balancePollMinutes` | `5` | DeepSeek 账户余额刷新间隔(分钟) |
|
|
93
101
|
| `priceSource` | `auto` | 估算用哪个价:`auto`(价格表 → 自定义价 → DSH 自带的模型目录价 → 插件内置价)、`catalog`、`custom` |
|
|
@@ -96,7 +104,7 @@ dsh plugin --profile desktop add dsh-notify-tray@0.1.3
|
|
|
96
104
|
| `exchangeRate` | `7.2` | 1 美元 = ? 人民币;目录价是美元,显示人民币时按它换算 |
|
|
97
105
|
| `prices` | `{}` | 按模型的价格表,优先级最高 |
|
|
98
106
|
|
|
99
|
-
「当前 API 价格」区域会显示你正在用的模型(provider / model)和它的目录价:DSH 的 pi-ai 适配器自带一份模型目录(Claude、GPT、Gemini、Grok、Groq、Kimi、GLM、MiMo、MiniMax、OpenCode Go、DeepSeek
|
|
107
|
+
「当前 API 价格」区域会显示你正在用的模型(provider / model)和它的目录价:DSH 的 pi-ai 适配器自带一份模型目录(Claude、GPT、Gemini、Grok、Groq、Kimi、GLM、MiMo、MiniMax、OpenCode Go、DeepSeek 等),插件直接读它,拿不到的再用内置价或你填的自定义价。桌面版和 `dsh web`(含 `~/.npm-global` 等全局 npm 安装)都会自动找到这份目录;如果设置页提示没找到,可以设置环境变量 `DSH_NOTIFY_TRAY_PI_AI` 指向 DSH 的安装目录(例如 `~/.npm-global/lib/node_modules/@deepseek-ai/dsh`)后重启。一键「把目录价填进自定义价」可以在目录价的基础上改。
|
|
100
108
|
|
|
101
109
|
### 套餐
|
|
102
110
|
|
|
@@ -128,14 +136,14 @@ dsh plugin --profile desktop add dsh-notify-tray@0.1.3
|
|
|
128
136
|
| GPT | ChatGPT Go / Plus / Pro 5x / Pro 20x / Business、API 按量 | 普通 Key 无接口 |
|
|
129
137
|
| MiniMax | M Plan Go / Explore / Build(国内 ¥49 / 119 / 469,国际 $22 / 55 / 132)、旧版 Coding Plan | 5 小时窗口剩余 `GET /v1/coding_plan/remains` |
|
|
130
138
|
|
|
131
|
-
拿不到的信息就手填;留空也可以,留空的项不显示。macOS / Linux
|
|
139
|
+
拿不到的信息就手填;留空也可以,留空的项不显示。macOS / Linux 的状态栏菜单里,余额和套餐合在一行「余额 ¥… · 平台 剩 …」,子菜单里有 DeepSeek 余额、套餐名和价格、剩余额度和重置时间、「刷新额度」和用量页链接;接口返回的完整明细在设置页里看。状态栏菜单只有一层子菜单,每个最多 6 行、每行不超过 24 个字,在 Windows / Linux 托盘里也不会被屏幕边缘截断。
|
|
132
140
|
|
|
133
141
|
## 说明
|
|
134
142
|
|
|
135
143
|
- **通知的触发时机**:任务跑完算「完成」;出错、超出 Token 上限、被拦截算「失败」;你自己点停止不弹通知。调用 `ask_user_question` 时,带选项的问题和计划审批算「需要选择」,不带选项的算「需要输入」;工具审批算「需要批准」。只跟踪顶层会话,子 agent 不单独弹通知。
|
|
136
|
-
- **花费怎么算**:用 DeepSeek
|
|
144
|
+
- **花费怎么算**:用 DeepSeek 账户登录时,按账户余额的下降累计当天花费(充值不算负花费;平台扣费有延迟,`auto` 下余额没跟上时先按估算显示);同时按当天各「provider/model」的 Token 乘以单价估算(单价来源见上面的 `priceSource`),「今日」子菜单里按模型分行显示(最多 3 个模型)。账本存在 `~/.dsh/storages/dsh-notify-tray/ledger.json`,保留 31 天。
|
|
137
145
|
- **点击通知 / 状态栏图标 / 菜单里的「打开 DeepSeek Harness」**:有桌面版时唤起桌面版,没有时(`dsh web`)在浏览器里打开 Web 界面。浏览器里的通知需要先允许通知权限。
|
|
138
146
|
|
|
139
147
|
## 已知限制
|
|
140
148
|
|
|
141
|
-
-
|
|
149
|
+
- macOS、Windows、Linux 均已完成验证(Linux 在 web profile 下验证了通知与系统托盘)。
|