dsh-desktop-statusbar 1.0.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 ADDED
@@ -0,0 +1,77 @@
1
+ Required Notice: Copyright 2026 北浮森屿 (https://github.com/Rapheal-Y7/dsh-desktop-statusbar)
2
+
3
+ PolyForm Noncommercial License 1.0.0
4
+
5
+ https://polyformproject.org/licenses/noncommercial/1.0.0
6
+
7
+ ## Acceptance
8
+
9
+ In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
14
+
15
+ ## Distribution License
16
+
17
+ The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
18
+
19
+ ## Notices
20
+
21
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
22
+
23
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
24
+
25
+ ## Changes and New Works License
26
+
27
+ The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
28
+
29
+ ## Patent License
30
+
31
+ The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
32
+
33
+ ## Noncommercial Purposes
34
+
35
+ Any noncommercial purpose is a permitted purpose.
36
+
37
+ ## Personal Uses
38
+
39
+ Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
40
+
41
+ ## Noncommercial Organizations
42
+
43
+ Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
44
+
45
+ ## Fair Use
46
+
47
+ You may have "fair use" rights for the software under the law. These terms do not limit them.
48
+
49
+ ## No Other Rights
50
+
51
+ These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
52
+
53
+ ## Patent Defense
54
+
55
+ If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
56
+
57
+ ## Violations
58
+
59
+ The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
60
+
61
+ ## No Liability
62
+
63
+ _**As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.**_
64
+
65
+ ## Definitions
66
+
67
+ The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
68
+
69
+ **You** refers to the individual or entity agreeing to these terms.
70
+
71
+ **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
72
+
73
+ **Your licenses** are all the licenses granted to you for the software under these terms.
74
+
75
+ **Use** means anything you do with the software requiring one of your licenses.
76
+
77
+ © PolyForm Project Inc.
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # dsh-desktop-statusbar
2
+
3
+ 把 DSH 桌面端对话区底部的统计行换成一条可配置的状态栏:字段自己挑、顺序自己排、模型单价自己填,费用按官方峰谷口径实时估算。
4
+
5
+ > 非商业许可([PolyForm Noncommercial 1.0.0](LICENSE)):个人使用、学习、教学、非营利组织都可以自由使用和修改,**禁止商业用途**。
6
+
7
+ ![底栏效果](docs/statusbar.png)
8
+
9
+ ## 功能
10
+
11
+ - **10 个可选字段**:会话状态(运行状态 + 峰谷时段)、轮次与步数、缓存命中率、首字延迟、输出速度、运行用时、本次费用、会话费用、余额、Token 计数
12
+ - **自定义顺序**:设置页里拖动把手调整顺序,取消勾选只隐藏、不改变位置;点「恢复默认设置」一键回到出厂顺序并全选
13
+ - **费用估算**:按 DeepSeek 官方的峰谷口径计价,每条调用按**自己发生的那一刻**和**自己使用的模型**分别计算后累加,跨时段、跨模型都不会串价
14
+ - **模型价格库**:可自定义每个模型的单价;支持「峰谷计价」开关(不勾选就是全天同价);补填单价后,之前没算上的历史调用会自动补算
15
+ - **账户余额**:直连 DeepSeek 余额接口,每分钟刷新(key 只在本机内存中使用,不落盘、不转发)
16
+ - **中英双语**:跟随 DSH 的语言设置
17
+
18
+ ## 安装
19
+
20
+ ### 方式一:插件市场
21
+
22
+ 已收录进 [DSH 1024Store](https://deepseek1024.com/plugins/Rapheal-Y7/dsh-desktop-statusbar)(分类:UI 增强),也可以直接命令行安装:
23
+
24
+ ```powershell
25
+ dsh plugin --profile desktop add github:Rapheal-Y7/dsh-desktop-statusbar
26
+ ```
27
+
28
+ 把 `desktop` 换成你自己的 profile 名。npm 包尚未发布,市场目前走 GitHub 源安装。
29
+
30
+ ### 方式二:手动安装
31
+
32
+ 1. 把本项目放进 DSH 的本地插件目录:
33
+
34
+ ```powershell
35
+ git clone https://github.com/Rapheal-Y7/dsh-desktop-statusbar "$env:USERPROFILE\.dsh\local-plugins\dsh-desktop-statusbar"
36
+ ```
37
+
38
+ 2. 安装依赖(只有一个,`zod`):
39
+
40
+ ```powershell
41
+ cd "$env:USERPROFILE\.dsh\local-plugins\dsh-desktop-statusbar"
42
+ npm install --omit=dev
43
+ ```
44
+
45
+ 3. 用 DSH 自己的命令行装进 profile(它会自动补上依赖声明与链接):
46
+
47
+ ```powershell
48
+ dsh plugin --profile desktop add "$env:USERPROFILE\.dsh\local-plugins\dsh-desktop-statusbar"
49
+ ```
50
+
51
+ 4. 重启 DSH,刷新页面。
52
+
53
+ ## 使用
54
+
55
+ 打开 **设置 → 状态栏**:
56
+
57
+ ![设置页](docs/settings.png)
58
+
59
+ - **基础**:启用状态栏、允许换行
60
+ - **数据字段**:勾选要显示的字段,按住右侧六点拖动排序
61
+ - **自定义模型价格**:填写你使用的模型单价(每百万 tokens / 元)。点「修改」展开编辑,改完点「保存」才写入;新增的模型默认全天同价,需要区分峰谷时勾上「峰谷计价」
62
+
63
+ ### 计费口径
64
+
65
+ 高峰时段为**北京时间周一至周五 9:00-12:00、14:00-18:00**,其余为空闲时段,空闲价为高峰价的一半 —— 与 DeepSeek 官方文档一致([模型 & 价格](https://api-docs.deepseek.com/zh-cn/quick_start/pricing),2026-09-15 核对)。
66
+
67
+ 节假日与调休**不单独处理**:官方规则只按星期几判断,所以法定假日落在工作日仍按峰谷算,调休上班的周末仍按空闲价。
68
+
69
+ ![自定义模型价格](docs/pricing.png)
70
+
71
+ ### 需要注意
72
+
73
+ 价格库里**没有单价的模型会被跳过不计费**(不是算错,是不知道单价)。补上单价后,该模型此前所有调用会自动补算进总计。底栏的字段会即时更新,不用重开会话。
74
+
75
+ ## 已知限制
76
+
77
+ - 「当前会话使用」显示的模型名由底栏上报给插件后端再由设置页读取 —— DSH 的设置页是全局槽,拿不到会话投影,所以这一步绕不开
78
+ - 隐藏官方状态栏依赖 DSH 的 slot 契约(`conversation.composer.dock`),不依赖官方组件的类名,因此 DSH 更新构建产物不会失效;但如果 DSH 改动 slot 本身,需要跟着改
79
+ - 会话投影只保留最近 4000 条调用记录,超出后最旧的记录不再参与费用重算
80
+
81
+ ## 开发
82
+
83
+ ```
84
+ tests/ 16 个测试脚本(纯 Node,不需要浏览器)
85
+ tools/ test.cjs 跑全部测试、sync-from-plugin.cjs 把插件目录的源码同步进项目
86
+ ```
87
+
88
+ ```powershell
89
+ node tools/test.cjs
90
+ ```
91
+
92
+ 测试覆盖:字段占位与格式化、峰谷边界与跨周末/工作日、价格自愈与补算、存储键迁移、指标悬停、host 路由、导航图标替换、死代码扫描。
93
+
94
+ ## 许可
95
+
96
+ 本项目采用 [PolyForm Noncommercial 1.0.0](LICENSE):**允许**个人使用、研究、学习、教学、业余项目,以及慈善、教育、公共研究、公共安全/健康、环保、政府机构使用;**允许**修改与再分发(需保留许可与署名);**禁止**任何商业用途。
97
+
98
+ 这不是 OSI 认可的开源许可证 —— 源码公开,但商业使用需要另行获得授权。
99
+
100
+ ## 致谢
101
+
102
+ 思路来自 DSH 社区的 [`@bananiceee/dsh-status-bar`](https://www.npmjs.com/package/@bananiceee/dsh-status-bar)(MIT 许可):隐藏官方统计行、用自建底栏接管。
103
+
104
+ 本项目为**独立实现**。与该项目的 0.1.10 版逐行比对结果:非空行 1415 行中有 247 行文字相同(17.5%),其中 190 行是 `}`、`);` 这类短行;**长于 40 字符的相同行仅 9 行**,全部是 DSH 平台集成的必要写法(`ctx.slots.inject(...)`、`useProjection("tokenUsage")`、模块包装样板等)与通用函数命名(`apply`、`formatTokens`、`segmentView` 等)。除这些之外没有相同代码片段。
@@ -0,0 +1,5 @@
1
+ # dsh-desktop-statusbar bundle 层
2
+ - insert:
3
+ - id: dsh-desktop-statusbar
4
+ name: 'dsh-desktop-statusbar'
5
+ config: {}