@dougen/dsh-deepseek-usage 0.1.2 → 0.1.3

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 CHANGED
@@ -1,6 +1,14 @@
1
- # dsh-deepseek-usage
1
+ # @dougen/dsh-deepseek-usage
2
2
 
3
- 一个给 DeepSeek Harness(DSH)**网页界面**用的插件:在**侧边栏底部**常驻显示你的 **DeepSeek 账号用量**卡片 —— 余额、今日花费、今日 Token、今日 API 请求次数与高峰/空闲计费时段指示灯。
3
+ DeepSeek 用量侧边栏插件(DeepSeek Harness Web UI)· 已发布到 npm:[https://www.npmjs.com/package/@dougen/dsh-deepseek-usage](https://www.npmjs.com/package/@dougen/dsh-deepseek-usage)
4
+
5
+ > **⚠️ 使用须知**
6
+ > - 本插件界面文案仅提供**中文**(无多语言版本)。
7
+ > - **仅适用于 DSH 的 Web UI**:卡片渲染在侧边栏底部的 `sidebar.footer.action` 槽位,命令行 / 桌面端等其他界面形态不支持。
8
+
9
+ ## 简介
10
+
11
+ 给 DeepSeek Harness(DSH)**网页界面**用的插件:在**侧边栏底部**常驻显示你的 **DeepSeek 账号用量**卡片 —— 余额、今日花费、今日 Token、今日 API 请求次数与高峰/空闲计费时段指示灯。
4
12
 
5
13
  与动态插件不同,它是**正式的可安装 cordis 插件**:随 profile 组合启动,**刷新页面 / 重启服务后依然存在**。
6
14
 
@@ -9,30 +17,33 @@
9
17
  - 第一行:`余额 ¥110.00`
10
18
  - 第二行:`今日 ¥2.94 · 36.9M · 170`(今日花费 / 今日 Token / 今日 API 请求次数,带图标)
11
19
  - 第三行:`↑1.5 · 💾0.05 · ↓4.5`(输入 / 缓存命中 / 输出 单价,按当前启用模型与峰谷时段自动切换)+ 右下角时间(刷新时显示旋转 ⟳ 图标,仅作刷新中的状态指示)
12
- - 右上角:高峰/空闲状态指示灯(9:00–14:00 为高峰,橙色;其余空闲,绿色;悬停提示时段)
13
- - 每 60 秒自动刷新;点击卡片任意位置也可刷新
20
+ - 右上角:高峰/空闲状态指示灯(高峰 9:00–12:00、14:00–18:00 为橙色;其余空闲为绿色;悬停提示时段)
21
+ - 每 60 秒自动刷新;点击卡片任意位置也可手动刷新
14
22
  - 折叠 rail 态显示紧凑余额 + 状态灯
15
23
  - 跟随应用明暗主题(`--dsw-*` 变量,含兜底值)
16
24
  - 错误状态明确(未配置 Key / 网络失败 / 接口报错)
17
25
 
18
26
  ## 安装
19
27
 
20
- 需要 DSH CLI [pnpm](https://pnpm.io/installation)。
28
+ 需要 DSH CLI。**从 npm 直接安装(推荐)**:
21
29
 
22
30
  ```sh
23
- # 1) 打包(把包真实安装进 profile node_modules,保证 ESM 依赖解析正确)
24
- cd dsh-deepseek-usage
25
- pnpm pack # 生成 dsh-deepseek-usage-<version>.tgz
31
+ dsh plugin --profile web add @dougen/dsh-deepseek-usage
32
+ ```
33
+
34
+ > 包声明了 `dsh.bundle`,`dsh plugin` 会自动把它加入 profile 的 bundle 层。
35
+
36
+ 本地开发时也可以用 tarball 安装:
26
37
 
27
- # 2) 安装
28
- dsh plugin --profile web add D:\path\to\dsh-deepseek-usage-0.1.2.tgz
29
- # 或直接从 npm 安装(发布到 npm 后):
30
- # dsh plugin --profile web add @dougen/dsh-deepseek-usage
38
+ ```sh
39
+ cd dsh-deepseek-usage
40
+ pnpm pack # 生成 dougen-dsh-deepseek-usage-<version>.tgz
41
+ dsh plugin --profile web add <生成的 .tgz>
31
42
  ```
32
43
 
33
- > 注意:不要用目录路径 `dsh plugin add <目录>`——pnpm 会以 link 方式安装,包的真实路径在工作区外,ESM 无法解析到 peer 依赖(`@deepseek-ai/dsh-*`)。务必安装 tarball npm 包(真实拷贝进 profile 的 node_modules)。
44
+ > 注意:不要用目录路径 `dsh plugin add <目录>`——pnpm 会以 link 方式安装,包的真实路径在工作区外,ESM 无法解析到 peer 依赖(`@deepseek-ai/dsh-*`)。务必安装 npm 包或 tarball(真实拷贝进 profile 的 node_modules)。
34
45
 
35
- 包声明了 `dsh.bundle`,`dsh plugin` 会自动把它加入 profile 的 bundle 层。之后:
46
+ 安装之后:
36
47
 
37
48
  1. 重启网页应用:`dsh web`(bundle 层在启动时读取)。
38
49
  2. 打开 http://127.0.0.1:3080 。
@@ -43,7 +54,7 @@ dsh plugin --profile web add D:\path\to\dsh-deepseek-usage-0.1.2.tgz
43
54
  > ```yaml
44
55
  > - insert:
45
56
  > - id: deepseek-usage
46
- > name: dsh-deepseek-usage
57
+ > name: @dougen/dsh-deepseek-usage
47
58
  > ```
48
59
 
49
60
  ## 数据来源
@@ -75,7 +86,7 @@ DEEPSEEK_PLATFORM_TOKEN: <令牌>
75
86
  | 部分 | 文件 | 作用 |
76
87
  |---|---|---|
77
88
  | Host 半 | `lib/index.js` | Cordis 插件(`inject: credentials, webServer`),注册 `GET /api/deepseek-usage`;解析余额、平台今日消费、本地日志用量统计(按 `message.source.model` + 事件时刻峰谷单价计价,20s 缓存) |
78
- | 定价 | `lib/pricing.js` | 官方价格表(2026-08-17 峰谷价),调整价格只改此文件 |
89
+ | 定价 | `lib/pricing.js` | 官方价格表(2026-08-17 峰谷价:高峰半价为空闲),调整价格只改此文件 |
79
90
  | 浏览器半 | `lib/client.js` | `dsh.client` web 包,注册 `sidebar.footer.action` 槽位卡片,60s 轮询 |
80
91
  | 组合层 | `cordis.patch.yml` | `dsh.bundle` 补丁层,插入加载项 |
81
92
 
@@ -88,10 +99,16 @@ dsh plugin --profile web add <生成的 .tgz>
88
99
  # 重启 dsh web,硬刷新页面
89
100
  ```
90
101
 
102
+ 发布新版本(`publishConfig` 已指向官方源并设为 public):
103
+
104
+ ```sh
105
+ npm publish
106
+ ```
107
+
91
108
  ## 卸载
92
109
 
93
110
  ```sh
94
- dsh plugin --profile web remove dsh-deepseek-usage
111
+ dsh plugin --profile web remove @dougen/dsh-deepseek-usage
95
112
  ```
96
113
 
97
114
  ## License
package/cordis.patch.yml CHANGED
@@ -1,5 +1,5 @@
1
- # dsh-deepseek-usage — DeepSeek 用量侧边栏插件。
1
+ # dsh-deepseek-usage — DeepSeek 用量侧边栏插件(npm 包名 @dougen/dsh-deepseek-usage)。
2
2
  # Host 半注册 GET /api/deepseek-usage;包声明 dsh.client 提供浏览器侧边栏卡片。
3
3
  - insert:
4
4
  - id: deepseek-usage
5
- name: dsh-deepseek-usage
5
+ name: @dougen/dsh-deepseek-usage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dougen/dsh-deepseek-usage",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "DeepSeek 用量侧边栏插件:余额(官方 API)、今日花费(官方平台数据或本地日志估算)、今日 Token 与 API 次数(本地日志)、高峰/空闲时段指示灯。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",