better-dsh-pet 0.2.0 → 0.2.1

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,103 +1,398 @@
1
- # better-dsh-pet 🐾
1
+ <div align="center">
2
+
3
+ # 🐋 better-dsh-pet
4
+
5
+ **一只住在 Windows 桌面上的大肥鱼,由 DeepSeek Harness 真实工作状态驱动。**
6
+
7
+ 透明 · 置顶 · 会吐槽 · 会番茄钟 · 会喂食 · 会陪你干活
8
+
9
+ <br/>
10
+
11
+ [![npm version](https://img.shields.io/npm/v/better-dsh-pet?label=npm&color=blue)](https://www.npmjs.com/package/better-dsh-pet)
12
+ [![npm downloads](https://img.shields.io/npm/dm/better-dsh-pet?label=downloads&color=brightgreen)](https://www.npmjs.com/package/better-dsh-pet)
13
+ [![GitHub stars](https://img.shields.io/github/stars/ysppwn721/better-dsh-pet?style=social)](https://github.com/ysppwn721/better-dsh-pet)
14
+ [![License](https://img.shields.io/github/license/ysppwn721/better-dsh-pet?color=orange)](LICENSE)
15
+ ![platform](https://img.shields.io/badge/platform-Windows%20%7C%20DeepSeek%20Harness-8A2BE2)
16
+ ![assets](https://img.shields.io/badge/assets-91%20animations-ff69b4)
17
+
18
+ </div>
19
+
20
+ ---
21
+
22
+ ## 🎬 视频推广
23
+
24
+ > 📹 演示视频占位:拍好视频后把链接放到这里。
25
+ >
26
+ > ```md
27
+ > [▶️ 点击观看 better-dsh-pet 演示视频](https://www.bilibili.com/video/你的视频ID)
28
+ > ```
29
+
30
+ ---
31
+
32
+ ## 📖 项目简介
33
+
34
+ `better-dsh-pet` 是一个 **DSH 桌面宠物插件**,基于 [PC2005-cloud/dsh-pet](https://github.com/PC2005-cloud/dsh-pet) 二创增强。
35
+
36
+ 它和普通网页桌宠最大的区别是:
37
+
38
+ - 🪟 使用 **独立透明置顶窗口** 运行,不占用 DSH 网页界面
39
+ - 🧠 能感知 DSH 的真实工作状态:思考 / 工作 / 等待 / 完成 / 出错
40
+ - 🎞️ 内置 **91 个透明动画**,全部开箱即用
41
+ - 🎛️ 提供大量自定义玩法:动作选择、播放顺序、移动频率、番茄钟、喂食、吐槽、余额显示
42
+
43
+ > 简单说:**DSH 在干活,大肥鱼在陪你。**
44
+
45
+ ---
46
+
47
+ ## ✨ 功能特性
48
+
49
+ ### 🧠 DSH 状态联动
50
+
51
+ - 监听 DSH 会话事件
52
+ - 状态变化自动切换动画和气泡文案
53
+ - 支持状态:空闲、思考、工作、等待确认、完成、出错
54
+ - 支持子 Agent 状态选择(可关闭)
55
+
56
+ ### 🖥️ 独立桌面气泡
57
+
58
+ - 透明、无边框、始终置顶
59
+ - 不占用网页界面
60
+ - 支持点击穿透,不挡鼠标
61
+ - 可拖拽到屏幕任意位置
62
+
63
+ ### 🎞️ 91 个透明动画
64
+
65
+ 包含但不限于:
66
+
67
+ - 待机呼吸、东张西望、打瞌睡、伸懒腰
68
+ - 写代码、照镜子、玩魔方、敲桌面
69
+ - 吃白饭、吃火锅、吃大闸蟹、吃汤圆、吃饺子
70
+ - 放风筝、堆雪人、放烟花、放孔明灯
71
+ - 拆礼物、变鸽子、扑克魔术、撸猫、骑木马
72
+ - 小提琴、女仆舞、宅舞、摇摆舞
73
+ - 点击回应:开心、害羞、傲娇、挠痒、元气挥手
74
+
75
+ ### 🚶 屏幕漫游
76
+
77
+ - 可开启 / 关闭行走
78
+ - 可调节移动频率
79
+ - 支持螃蟹走路、原地漂浮踏步、向左奔跑
80
+ - 移动和动画节奏同步
81
+
82
+ ### 🍚 喂食互动
83
+
84
+ - 右键菜单一键喂食
85
+ - 随机播放吃饭动画
86
+ - 显示“谢谢投喂”气泡
87
+
88
+ ### 💰 余额显示
89
+
90
+ - 自动读取 DeepSeek 账户余额
91
+ - 气泡中显示余额,如 `余额 ¥11.06`
92
+ - 每次对话结束后自动刷新
93
+ - 每 5 分钟定时刷新
94
+ - 点击余额气泡可手动刷新
95
+
96
+ ### 🍅 番茄钟
97
+
98
+ - 自定义工作时长 / 休息时长
99
+ - 气泡显示倒计时
100
+ - 结束时播放 MP3 闹钟 + 抖动
101
+ - 可随时停止
102
+
103
+ ### 💬 对话吐槽
104
+
105
+ - 根据当前对话生成俏皮吐槽
106
+ - 可手动触发
107
+ - 可开启自动吐槽(会消耗 Token)
108
+ - 自动吐槽可一键关闭
109
+
110
+ ### 🎛️ 自定义动作
111
+
112
+ - 右键勾选要播放的动作
113
+ - 支持自定义播放顺序
114
+ - 支持动作切换间隔
115
+ - 支持移动频率
116
+
117
+ ### ⚙️ 行为设置
118
+
119
+ - 宠物大小(px)
120
+ - 角色大小百分比
121
+ - 气泡大小
122
+ - 移动频繁度
123
+ - 动作切换间隔
124
+ - 行走开关
125
+ - 自动吐槽开关
126
+
127
+ ---
128
+
129
+ ## 📸 效果预览
130
+
131
+ > 动画为透明背景;GIF 预览中透明部分显示为页面底色,实际播放为透明。
132
+
133
+ ### 😴 待机 / 日常
134
+
135
+ <p align="center">
136
+ <img src="assets/preview/daiji-huxi-xiuxian.gif" width="150" alt="待机呼吸休闲" title="待机呼吸休闲">
137
+ <img src="assets/preview/dongzhangxiwang.gif" width="150" alt="东张西望" title="东张西望">
138
+ <img src="assets/preview/haqian-liantian.gif" width="150" alt="哈欠连天" title="哈欠连天">
139
+ <img src="assets/preview/yuandi-xiaoqi-chenmian.gif" width="150" alt="原地小憩沉眠" title="原地小憩沉眠">
140
+ <img src="assets/preview/chaoda-shenlanyao.gif" width="150" alt="超大伸懒腰" title="超大伸懒腰">
141
+ <img src="assets/preview/youxian-hengga.gif" width="150" alt="悠闲哼歌" title="悠闲哼歌">
142
+ </p>
143
+
144
+ ### 🏃 移动
145
+
146
+ <p align="center">
147
+ <img src="assets/preview/yuandi-piaofu-tabu.gif" width="150" alt="原地漂浮踏步" title="原地漂浮踏步">
148
+ <img src="assets/preview/pangxie-zoulu.gif" width="150" alt="螃蟹走路" title="螃蟹走路">
149
+ <img src="assets/preview/beishubiao-tuozhuai-xuankong-fankui.gif" width="150" alt="被鼠标拖拽悬空反馈" title="被鼠标拖拽悬空反馈">
150
+ </p>
151
+
152
+ ### 🍜 吃东西
153
+
154
+ <p align="center">
155
+ <img src="assets/preview/chi-baifan.gif" width="150" alt="吃白饭" title="吃白饭">
156
+ <img src="assets/preview/chi-token.gif" width="150" alt="吃Token" title="吃Token">
157
+ <img src="assets/preview/dakou-chi-lingshi.gif" width="150" alt="大口吃零食" title="大口吃零食">
158
+ <img src="assets/preview/chi-zaocan.gif" width="150" alt="吃早餐" title="吃早餐">
159
+ <img src="assets/preview/chi-bingqilin-ronghua.gif" width="150" alt="吃冰淇淋融化" title="吃冰淇淋融化">
160
+ </p>
161
+
162
+ ### 🎮 玩耍 / 才艺
2
163
 
3
164
  <p align="center">
4
- <a href="https://www.npmjs.com/package/better-dsh-pet"><img alt="npm version" src="https://img.shields.io/npm/v/better-dsh-pet?label=npm&color=blue"></a>
5
- <a href="https://www.npmjs.com/package/better-dsh-pet"><img alt="npm monthly downloads" src="https://img.shields.io/npm/dm/better-dsh-pet?label=%E6%9C%88%E4%B8%8B%E8%BD%BD&color=brightgreen"></a>
6
- <a href="https://www.npmjs.com/package/better-dsh-pet"><img alt="total downloads" src="https://img.shields.io/npm/dt/better-dsh-pet?label=%E6%80%BB%E4%B8%8B%E8%BD%BD&color=success"></a>
7
- <a href="https://github.com/ysppwn721/better-dsh-pet"><img alt="stars" src="https://img.shields.io/github/stars/ysppwn721/better-dsh-pet?style=social"></a>
8
- <a href="https://github.com/ysppwn721/better-dsh-pet/blob/master/LICENSE"><img alt="license" src="https://img.shields.io/github/license/ysppwn721/better-dsh-pet?color=orange"></a>
9
- <a href="https://awesome-dsh-plugin.com"><img alt="awesome dsh plugin" src="https://awesome-dsh-plugin.com/badge.svg"></a>
10
- <img alt="platform" src="https://img.shields.io/badge/platform-DeepSeek%20Harness%20Web-8A2BE2">
11
- <img alt="assets" src="https://img.shields.io/badge/assets-51%20animations-ff69b4">
165
+ <img src="assets/preview/yuandi-zhuanxin-wan-mofang.gif" width="150" alt="原地专心玩魔方" title="原地专心玩魔方">
166
+ <img src="assets/preview/wan-shuiqiang.gif" width="150" alt="玩水枪" title="玩水枪">
167
+ <img src="assets/preview/xiaotiqin-yanzou.gif" width="150" alt="小提琴演奏" title="小提琴演奏">
168
+ <img src="assets/preview/youya-nvpuwu.gif" width="150" alt="优雅女仆舞" title="优雅女仆舞">
169
+ <img src="assets/preview/keai-zhaiwu.gif" width="150" alt="可爱宅舞" title="可爱宅舞">
12
170
  </p>
13
171
 
14
- > A desktop-native pet bubble driven by [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) session events.
15
- > 一只住在 Windows 桌面上的透明置顶大肥鱼:由 DSH 真实工作状态驱动,思考/工作/等待/完成/出错时自动切换动画并显示状态气泡。
172
+ ### 🎉 节日 / 季节
173
+
174
+ <p align="center">
175
+ <img src="assets/preview/duixueren.gif" width="150" alt="堆雪人" title="堆雪人">
176
+ <img src="assets/preview/fang-fengzheng.gif" width="150" alt="放风筝" title="放风筝">
177
+ <img src="assets/preview/zhongqiu-shangyue-chi-yuebing.gif" width="150" alt="中秋赏月吃月饼" title="中秋赏月吃月饼">
178
+ <img src="assets/preview/beiluoye-yanmo.gif" width="150" alt="被落叶淹没" title="被落叶淹没">
179
+ </p>
16
180
 
17
- > 📌 **二创声明**:本项目是基于 [PC2005-cloud/dsh-pet](https://github.com/PC2005-cloud/dsh-pet) 的二创修改版,感谢原作者的桌宠动画与设计。
181
+ ### 🖱️ 点击回应
182
+
183
+ <p align="center">
184
+ <img src="assets/preview/dianji-huiying-kaixin-yuedong.gif" width="150" alt="开心跃动" title="开心跃动">
185
+ <img src="assets/preview/dianji-huiying-haixiu-jingya.gif" width="150" alt="害羞惊讶" title="害羞惊讶">
186
+ <img src="assets/preview/dianji-huiying-aojiao-shengqi-ceshen-zhanshi.gif" width="150" alt="傲娇生气" title="傲娇生气">
187
+ </p>
188
+
189
+ 全部 **91 个透明动画** 见仓库:`assets/thumb/`
18
190
 
19
191
  ---
20
192
 
21
- ## 🚀 快速开始(安装插件)
193
+ ## 🚀 快速开始
194
+
195
+ ### 环境要求
196
+
197
+ - Windows 10 / 11
198
+ - 已安装 DeepSeek Harness(DSH)
199
+ - Node.js 环境可用
22
200
 
23
- ```sh
201
+ ### 安装
202
+
203
+ ```bash
24
204
  dsh plugin --profile web add better-dsh-pet
25
205
  ```
26
206
 
27
- 重启 `dsh web`,桌面会出现独立置顶气泡窗口——51 个透明动画开箱即用。网页内不再显示浮动大肥鱼;设置入口在 `设置 → 插件 → 插件配置 → 大肥鱼桌面伴侣`。
207
+ ### 启动
28
208
 
29
- > 💡 想自己造一只专属宠物?克隆 [ysppwn721/better-dsh-pet](https://github.com/ysppwn721/better-dsh-pet) 仓库,用内置素材链(AI 提示词 → 绿幕视频 → 透明动画,素材由豆包生成)从零生成,全流程可复现。
209
+ ```bash
210
+ dsh web
211
+ ```
30
212
 
31
- ## ✨ 功能特性
213
+ 启动后,桌面右下角会出现大肥鱼。
32
214
 
33
- - **DSH 状态联动**:监听 DSH 会话事件,按思考 / 工作 / 等待 / 完成 / 错误切换动画和气泡文案
34
- - **独立桌面气泡**:不再占用网页界面;透明、无边框、始终置顶的 Electron 窗口
35
- - **51 个手绘风透明动画**:待机呼吸、打瞌睡、玩魔方、哼歌、炸毛、吐泡泡、玩水枪、小提琴演奏、蓝鲸现世、吃白饭、照镜子、三支舞、写代码、四季动作(放风筝、堆雪人、吃冰淇淋、放烟花……)全部无缝衔接
36
- - **永不停止的动画链**:空闲时每段动画播完立即按概率选下一个(30% 待机 / 10% 转向 / 40% 动作 / 20% 移动)
37
- - **点击 / 拖拽**:点击有随机回应动画(开心 / 害羞 / 傲娇),可拖到任意位置
38
- - **喂食互动**:右键菜单可喂食,播放吃饭动画并显示感谢气泡
39
- - **余额 / 进度汇报**:气泡中显示当前任务进度和 DeepSeek 账户余额
40
- - **完成反馈**:任务完成时播放提示音并抖动宠物
41
- - **对话吐槽**:根据本次对话生成俏皮吐槽(会消耗 Token,可开关;也可右键手动触发)
42
- - **番茄钟**:右键菜单可开始 25 分钟专注 / 5 分钟短休息,气泡显示倒计时,结束时提示音 + 抖动
43
- - **左右朝向**:所有动画 CSS 镜像,人物可朝左 / 朝右
44
- - **落地对齐**:动画统一脚底线,宠物始终站在"地面"上
45
- - **流畅切换**:双缓冲 video 交叉淡入,切换零空白帧
46
- - **无障碍友好**:支持 `prefers-reduced-motion`
47
-
48
- ## ⚙️ 配置
49
-
50
- | 配置项 | 说明 | 当前状态 |
51
- |---|---|---|
52
- | `enabled` | 是否启用桌面大肥鱼 | 默认 true,可在 DSH 设置页切换 |
53
- | `scale` | 角色大小(70%~140%) | 默认 100%,设置页实时生效 |
54
- | `bubbleScale` | 气泡大小(80%~120%) | 默认 100%,设置页实时生效 |
55
- | `activityLevel` | 空闲微动作频率:quiet / normal / lively | 默认 normal |
56
- | `reducedMotion` | 减少动态效果 | 默认关闭 |
57
- | `bubbleMode` | 气泡显示:always / hidden / custom | 默认 always |
58
- | `bubbleStates` | 自定义模式下显示气泡的状态 | 默认 SUCCESS / ERROR / WAITING |
59
- | `includeSubagents` | 是否让子 Agent 参与状态选择 | 默认关闭 |
60
- | `helper.electronPath` | 自定义 Electron 可执行文件路径 | 缺省自动探测 `DSH_PET_ELECTRON_PATH` / `require('electron')` / 本地 dsh-desktop-electron |
61
-
62
- ## 🗑️ 卸载
63
-
64
- ```sh
215
+ ### 卸载
216
+
217
+ ```bash
65
218
  dsh plugin --profile web remove better-dsh-pet
66
219
  ```
67
220
 
68
- ## 🎬 效果预览
221
+ ---
69
222
 
70
- > 动画为透明背景;GIF 预览中透明部分显示为页面底色,实际播放为透明。
223
+ ## 🖱️ 右键菜单使用指南
71
224
 
72
- <p>
73
- <img src="assets/preview/daiji-huxi-xiuxian.gif" width="160" alt="待机呼吸休闲" title="待机呼吸休闲">
74
- <img src="assets/preview/dongzhangxiwang.gif" width="160" alt="东张西望" title="东张西望">
75
- <img src="assets/preview/yuandi-piaofu-tabu.gif" width="160" alt="原地漂浮踏步" title="原地漂浮踏步">
76
- <img src="assets/preview/yuandi-xiaoqi-chenmian.gif" width="160" alt="原地小憩沉眠" title="原地小憩沉眠">
77
- <img src="assets/preview/dianji-huiying-kaixin-yuedong.gif" width="160" alt="点击回应 - 开心跃动" title="点击回应 - 开心跃动">
78
- <img src="assets/preview/beishubiao-tuozhuai-xuankong-fankui.gif" width="160" alt="被鼠标拖拽悬空反馈" title="被鼠标拖拽悬空反馈">
79
- </p>
225
+ 右键点击大肥鱼,可以看到:
226
+
227
+ | 菜单项 | 作用 |
228
+ |---|---|
229
+ | 喂食 | 播放吃饭动画 + 感谢气泡 |
230
+ | 开始番茄钟 / 开始短休息 | 启动番茄钟 |
231
+ | 停止番茄钟 | 停止当前番茄钟 |
232
+ | 番茄钟设置 | 设置工作时长 / 休息时长 |
233
+ | 行为设置 | 设置大小、移动频率、动作切换间隔 |
234
+ | 选择待机动作 | 勾选要播放的动作(悬停展开) |
235
+ | 开启/关闭行走 | 切换是否走动 |
236
+ | 开启/关闭自动吐槽 | 切换自动吐槽 |
237
+ | 让大肥鱼吐槽一下 | 手动生成一条吐槽 |
238
+ | 打开 DSH 桌面版 | 打开 DSH 桌面客户端 |
239
+ | 本次隐藏 | 隐藏本次大肥鱼 |
240
+ | 本次关闭 | 关闭本次大肥鱼 |
241
+
242
+ ---
243
+
244
+ ## ⚙️ 配置说明
245
+
246
+ ### DSH 设置页
247
+
248
+ ```text
249
+ 设置 → 插件 → 插件配置 → Better DSH Pet(大肥鱼增强版)
250
+ ```
251
+
252
+ | 配置项 | 说明 | 默认 |
253
+ |---|---|---|
254
+ | `enabled` | 是否启用大肥鱼 | `true` |
255
+ | `petSize` | 宠物宽度(px) | `460` |
256
+ | `scale` | 角色大小(70%~140%) | `100%` |
257
+ | `bubbleScale` | 气泡大小(80%~120%) | `100%` |
258
+ | `activityLevel` | 空闲微动作频率 | `normal` |
259
+ | `reducedMotion` | 减少动态效果 | `false` |
260
+ | `bubbleMode` | 气泡显示模式 | `always` |
261
+ | `bubbleStates` | 自定义气泡状态 | `SUCCESS/ERROR/WAITING` |
262
+ | `includeSubagents` | 是否响应子 Agent | `false` |
263
+ | `walkEnabled` | 是否允许走动 | `true` |
264
+ | `moveChance` | 移动频繁度(%) | `20` |
265
+ | `actionDelayMs` | 动作切换间隔(ms) | `0` |
266
+ | `enabledActions` | 自定义待机动作 | `[]`(全部) |
267
+ | `actionOrder` | 自定义播放顺序 | `[]`(随机) |
268
+ | `roastEnabled` | 自动吐槽(耗 Token) | `false` |
269
+ | `workMinutes` | 番茄钟工作时长 | `25` |
270
+ | `breakMinutes` | 番茄钟休息时长 | `5` |
271
+
272
+ ---
273
+
274
+ ## ❓ 常见问题
275
+
276
+ ### Q:为什么大肥鱼没有出现?
277
+
278
+ 1. 确认安装的是 `better-dsh-pet`
279
+ 2. 完全退出并重启 DSH
280
+ 3. 检查设置里“启用大肥鱼”是否开启
281
+ 4. 确认 Electron 路径可用(一般会自动探测)
282
+
283
+ ### Q:为什么没有余额显示?
284
+
285
+ - 需要 DSH 中配置了 `DEEPSEEK_API_KEY`
286
+ - 插件会自动读取 `~/.dsh/.credentials.yaml`
287
+ - 网络不通时不会显示
288
+
289
+ ### Q:余额多久刷新一次?
290
+
291
+ - 每次对话/任务结束后自动刷新
292
+ - 每 5 分钟定时刷新
293
+ - 点击余额气泡可手动刷新
294
+
295
+ ### Q:自动吐槽会消耗 Token 吗?
296
+
297
+ 会。所以默认关闭,可以在设置或右键菜单中开启。
80
298
 
81
- 全部 51 个动画见仓库:`assets/thumb/`。
299
+ ### Q:如何让大肥鱼只播放指定动作?
82
300
 
83
- ## 📚 完整项目(不止是插件)
301
+ 右键 → **选择待机动作** → 勾选要播放的动作 → 保存。
84
302
 
85
- 这是**完整的三件套项目**,任何人 clone 仓库都可以从零生成自己的桌面宠物:
303
+ ### Q:如何自定义播放顺序?
86
304
 
305
+ 在 DSH 设置页的“自定义播放顺序”中填写动作名,用逗号分隔。
306
+
307
+ ### Q:大小设置无效?
308
+
309
+ - 在 DSH 设置页或右键“行为设置”中修改
310
+ - 现在是**实时生效**的,不需要重启
311
+ - 如果没生效,确认保存成功后再看
312
+
313
+ ### Q:没有 DSH 桌面端能运行吗?
314
+
315
+ 可以。
316
+
317
+ - 本插件**不依赖 DSH Desktop.exe**
318
+ - 只需要 DSH 本体(`dsh web`)正常运行
319
+ - 右键“打开 DSH 桌面版”只是可选功能,找不到桌面端也不影响桌宠本体
320
+
321
+ ### Q:其他电脑需要额外安装 Electron 吗?
322
+
323
+ 需要。
324
+
325
+ - 本插件**不打包 Electron**(npm 包体积限制)
326
+ - 桌面 Helper 依赖 Electron 运行
327
+ - 其他电脑上可通过以下方式提供 Electron:
328
+ ```powershell
329
+ # 方式一:设置环境变量
330
+ $env:DSH_PET_ELECTRON_PATH = "C:\path\to\electron.exe"
331
+
332
+ # 方式二:安装 electron 到全局 npm
333
+ npm install -g electron
334
+ ```
335
+ - 插件也会自动探测常见位置:
336
+ - `~/.dsh/electron/electron.exe`
337
+ - `%APPDATA%\npm\node_modules\electron\dist\electron.exe`
338
+ - `C:\Program Files\Electron\electron.exe`
339
+ - 当前开发机上的 dsh-desktop-electron 路径(仅本机)
340
+
341
+ ### Q:插件会在没有 Electron 的电脑上崩溃吗?
342
+
343
+ 不会导致 DSH 崩溃,但桌宠窗口无法显示,日志会提示:
344
+
345
+ ```text
346
+ better-dsh-pet: cannot resolve Electron executable.
87
347
  ```
88
- ① 提示词(配方) → ② 素材生成链(引擎) → ③ 插件(成品)
89
- AI 生成动画的配方 源视频 → 透明动画的管线 运行在 DSH 里的宠物
348
+
349
+ 所以正式分发给别人前,建议在 README 或安装说明里写明需要 Electron。
350
+
351
+ ---
352
+
353
+ ## 🛠️ 开发 / 本地调试
354
+
355
+ ```bash
356
+ # 使用本地源码
357
+ dsh plugin --profile web add "D:\dsh-pet"
358
+
359
+ # 打包
360
+ npm pack
361
+
362
+ # 发布前检查
363
+ node scripts/prepack-check.js
90
364
  ```
91
365
 
92
- - 仓库:[ysppwn721/better-dsh-pet](https://github.com/ysppwn721/better-dsh-pet)
93
- - 设计与实现文档:[DESIGN.md](https://github.com/ysppwn721/better-dsh-pet/blob/master/DESIGN.md)
366
+ ---
367
+
368
+ ## 📌 二创声明
369
+
370
+ 本项目是基于 [PC2005-cloud/dsh-pet](https://github.com/PC2005-cloud/dsh-pet) 的**二创修改版**。
371
+
372
+ - 感谢原作者的桌宠动画与设计
373
+ - 本项目在保留原动画基础上,增加了 DSH 状态联动、桌面独立窗口、余额、番茄钟、吐槽、自定义动作等能力
374
+ - 素材使用请遵守原作者仓库的许可说明
375
+
376
+ ---
94
377
 
95
- ## 🔎 发现更多 DSH 插件
378
+ ## 🔎 相关链接
96
379
 
97
380
  - 社区插件目录:[awesome-dsh-plugin.com](https://awesome-dsh-plugin.com)
98
381
  - DSH 官方仓库:[deepseek-ai/DeepSeek-Harness](https://github.com/deepseek-ai/deepseek-harness)
382
+ - 上游原版:[PC2005-cloud/dsh-pet](https://github.com/PC2005-cloud/dsh-pet)
383
+ - 上游 Windows 移植参考:[MerZlin/dsh-pet-indesktop](https://github.com/MerZlin/dsh-pet-indesktop)
384
+
385
+ ---
99
386
 
100
387
  ## 📄 许可
101
388
 
102
389
  - 代码:MIT
103
- - 素材(动画/提示词):见仓库说明
390
+ - 素材(动画 / 提示词 / 源视频):见仓库说明,**禁止商用**
391
+
392
+ ---
393
+
394
+ <div align="center">
395
+
396
+ **如果这个大肥鱼让你开心,给个 ⭐ 支持一下吧~**
397
+
398
+ </div>
package/lib/client.js CHANGED
@@ -16,7 +16,7 @@ window.__ModuleLoader__.load({
16
16
  const exports = module.exports
17
17
  const React = require('react')
18
18
  const { useEffect, useRef, useState } = React
19
- const { jsx: h } = require('react/jsx-runtime')
19
+ const h = React.createElement
20
20
  const CONFIG_ENDPOINT = '/plugins/better-dsh-pet/config'
21
21
 
22
22
  const cardStyle = {
@@ -72,6 +72,7 @@ window.__ModuleLoader__.load({
72
72
  function PetSettingsCard() {
73
73
  const [status, setStatus] = useState('loading')
74
74
  const [value, setValue] = useState({})
75
+ const [sizeDraft, setSizeDraft] = useState(null)
75
76
  const [busy, setBusy] = useState(false)
76
77
  const patchSeq = useRef(0)
77
78
  const sliderTimers = useRef(new Map())
@@ -129,15 +130,15 @@ window.__ModuleLoader__.load({
129
130
 
130
131
  return h('li', { style: cardStyle, 'data-testid': 'better-dsh-pet-settings' },
131
132
  h('div', null,
132
- h('strong', { style: { fontSize: 16 } }, '大肥鱼桌面伴侣'),
133
- h('p', { style: { margin: '5px 0 0', opacity: 0.72 } }, '独立桌面气泡,由 DSH 真实工作状态驱动;网页内不再显示浮动大肥鱼。'),
133
+ h('strong', { style: { fontSize: 16 } }, 'Better DSH Pet(大肥鱼增强版)'),
134
+ h('p', { style: { margin: '5px 0 0', opacity: 0.72 } }, '由 better-dsh-pet 提供:独立桌面气泡,DSH 状态联动、余额、番茄钟、吐槽、自定义动作。'),
134
135
  ),
135
136
  status === 'unavailable'
136
- ? h('span', { role: 'status' }, '大肥鱼设置尚未连接到 DSH Host。')
137
+ ? h('span', { role: 'status' }, 'Better DSH Pet 设置尚未连接到 DSH Host。')
137
138
  : status === 'loading'
138
139
  ? h('span', null, '正在读取设置…')
139
140
  : h(React.Fragment, null,
140
- h(Field, { label: '启用大肥鱼', hint: '关闭后立即退出桌面气泡;重新开启无需单独启动程序。' },
141
+ h(Field, { label: '启用 Better DSH Pet', hint: '关闭后立即退出桌面气泡;重新开启无需单独启动程序。' },
141
142
  h('input', {
142
143
  type: 'checkbox', checked: value.enabled !== false, disabled: !writable,
143
144
  onChange: (event) => void write('enabled', event.target.checked),
@@ -150,11 +151,17 @@ window.__ModuleLoader__.load({
150
151
  onChange: (event) => void writeSlider('scale', Number(event.target.value)),
151
152
  }),
152
153
  ),
153
- h(Field, { label: '宠物宽度(px)', hint: '基础尺寸,配合“角色大小”百分比使用,重启后生效。' },
154
+ h(Field, { label: '宠物宽度(px)', hint: '基础尺寸,实时生效;会自动按 10 的倍数保存。' },
154
155
  h('input', {
155
156
  type: 'number', min: 100, max: 1000, step: 10,
156
- value: value.petSize ?? 460, disabled: !writable, style: selectStyle,
157
- onChange: (event) => void write('petSize', Number(event.target.value)),
157
+ value: sizeDraft ?? value.petSize ?? 460, disabled: !writable, style: selectStyle,
158
+ onChange: (event) => setSizeDraft(event.target.value),
159
+ onBlur: () => {
160
+ const raw = Number(sizeDraft ?? value.petSize ?? 460)
161
+ const rounded = Math.min(1000, Math.max(100, Math.round(raw / 10) * 10))
162
+ setSizeDraft(null)
163
+ void write('petSize', rounded)
164
+ },
158
165
  }),
159
166
  ),
160
167
  h(Field, { label: '移动频繁度(%)', hint: '数值越高,待机时越容易走动。' },
package/lib/index.js CHANGED
@@ -507,6 +507,10 @@ function mount(ctx, config = {}, eventCtx = ctx) {
507
507
  } else if (event?.type === 'assistant/message') {
508
508
  appendTranscript('assistant', event.data?.message?.content)
509
509
  }
510
+ // 每轮对话结束后自动刷新一次余额。
511
+ if (event?.type === 'turn/end') {
512
+ void refreshBalance()
513
+ }
510
514
  // 自动吐槽:每轮对话结束后,如果开启了吐槽,则延迟生成一条。
511
515
  if (event?.type === 'turn/end' && settings.get().roastEnabled === true) {
512
516
  if (roastTimer) clearTimeout(roastTimer)
@@ -567,6 +571,17 @@ function mount(ctx, config = {}, eventCtx = ctx) {
567
571
  }),
568
572
  'better-dsh-pet: local roast endpoint',
569
573
  )
574
+ httpCtx.effect(
575
+ () => httpCtx.webServer.register({
576
+ kind: 'exact',
577
+ path: '/plugins/better-dsh-pet/refresh-balance',
578
+ handler: async (_req, res) => {
579
+ await refreshBalance()
580
+ jsonResponse(res, 200, { ok: true, balance })
581
+ },
582
+ }),
583
+ 'better-dsh-pet: local refresh-balance endpoint',
584
+ )
570
585
  httpCtx.effect(
571
586
  () => httpCtx.webServer.register({ kind: 'prefix', path: ROUTE_PREFIX, handler: createAssetHandler(config) }),
572
587
  'better-dsh-pet: /pet asset route',
@@ -1,4 +1,4 @@
1
- import { spawn } from 'node:child_process'
1
+ import { spawn, spawnSync } from 'node:child_process'
2
2
  import { existsSync } from 'node:fs'
3
3
  import { createRequire } from 'node:module'
4
4
  import { fileURLToPath } from 'node:url'
@@ -32,16 +32,40 @@ function resolveElectronPath(candidates = []) {
32
32
  } catch {
33
33
  /* electron 未安装时跳过 */
34
34
  }
35
- // 当前机器上的 dsh-desktop-electron 开发依赖,便于本地直接跑通。
35
+ // 常见 Electron 安装位置(便于其他电脑直接跑通)。
36
36
  const localCandidates = [
37
37
  'D:/deepseek harness/tools/desktop-eval/dsh-desktop-electron/node_modules/electron/dist/electron.exe',
38
38
  'D:/deepseek harness/tools/desktop-eval/dsh-desktop-electron/node_modules/electron/dist/electron',
39
39
  join(process.env.USERPROFILE || '', '.dsh', 'electron', 'electron.exe'),
40
+ join(process.env.APPDATA || '', 'npm', 'node_modules', 'electron', 'dist', 'electron.exe'),
41
+ join(process.env.USERPROFILE || '', 'AppData', 'Roaming', 'npm', 'node_modules', 'electron', 'dist', 'electron.exe'),
42
+ join(process.env.LOCALAPPDATA || '', 'Programs', 'Electron', 'electron.exe'),
43
+ 'C:/Program Files/Electron/electron.exe',
44
+ 'C:/Program Files (x86)/Electron/electron.exe',
40
45
  ]
41
46
  for (const candidate of localCandidates) push(candidate)
47
+ if (process.env.ELECTRON_PATH) push(process.env.ELECTRON_PATH)
48
+ if (!list.some((value) => existsSync(value))) {
49
+ const ensured = ensureElectron()
50
+ if (ensured) push(ensured)
51
+ }
42
52
  return list.find((value) => existsSync(value))
43
53
  }
44
54
 
55
+ function ensureElectron() {
56
+ const script = resolve(packageRoot, 'scripts', 'ensure-electron.mjs')
57
+ if (!existsSync(script)) return undefined
58
+ console.log('[better-dsh-pet] Electron not found, running ensure-electron.mjs ...')
59
+ const result = spawnSync(process.execPath, [script], {
60
+ stdio: 'inherit',
61
+ timeout: 10 * 60 * 1000,
62
+ })
63
+ if (result.status !== 0) return undefined
64
+ const home = process.env.DSH_HOME || join(process.env.USERPROFILE || '', '.dsh')
65
+ const exe = join(home, 'electron', 'electron.exe')
66
+ return existsSync(exe) ? exe : undefined
67
+ }
68
+
45
69
  function defaultLaunch(options = {}) {
46
70
  const electronPath = resolveElectronPath([options.electronPath])
47
71
  if (!electronPath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-dsh-pet",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "A desktop-native pet bubble driven by DeepSeek Harness session events: transparent always-on-top Electron window, status-aware animations, balance, pomodoro, roast, and DSH settings card.",
5
5
  "keywords": [
6
6
  "dsh",
@@ -178,6 +178,16 @@ app.whenReady().then(() => {
178
178
  console.error('[better-dsh-pet-helper] request roast error:', error)
179
179
  }
180
180
  })
181
+ ipcMain.on('pet:refresh-balance', async () => {
182
+ const statusUrl = process.env.DSH_PET_STATUS_URL
183
+ if (!statusUrl) return
184
+ try {
185
+ const refreshUrl = statusUrl.replace(/\/plugins\/better-dsh-pet\/status$/, '/plugins/better-dsh-pet/refresh-balance')
186
+ await fetch(refreshUrl, { method: 'POST', cache: 'no-store' })
187
+ } catch (error) {
188
+ console.error('[better-dsh-pet-helper] refresh balance error:', error)
189
+ }
190
+ })
181
191
  ipcMain.on('pet:move-by', () => {
182
192
  // 已改为全屏画布内移动宠物 DOM,不再移动窗口。
183
193
  })
@@ -36,4 +36,7 @@ contextBridge.exposeInMainWorld('petBridge', {
36
36
  requestRoast() {
37
37
  ipcRenderer.send('pet:request-roast')
38
38
  },
39
+ refreshBalance() {
40
+ ipcRenderer.send('pet:refresh-balance')
41
+ },
39
42
  })
@@ -8,6 +8,7 @@
8
8
  // ---------- 配置 ----------
9
9
  const params = new URLSearchParams(location.search)
10
10
  const CONFIG = {
11
+ enabled: params.get('enabled') !== '0',
11
12
  scale: Number(params.get('scale') || '1'),
12
13
  bubbleScale: Number(params.get('bubbleScale') || '1'),
13
14
  activityLevel: params.get('activityLevel') || 'normal',
@@ -297,19 +298,17 @@ function playIdle() {
297
298
  actionOrderIndex++
298
299
  if (MOVES.includes(next) && CONFIG.walkEnabled && tryMove(next)) isMove = true
299
300
  } else {
300
- const roll = Math.random()
301
- if (roll < 0.3) {
302
- next = IDLE
303
- } else if (roll < 0.4) {
304
- next = TURN
305
- } else if (roll < 0.8) {
306
- next = pick(usableActions, anim)
301
+ // 移动频繁度 = 每次待机决策时尝试走动的概率(可关闭)。
302
+ const moveCandidate = pick(MOVES, anim)
303
+ if (CONFIG.walkEnabled && Math.random() * 100 < CONFIG.moveChance && tryMove(moveCandidate)) {
304
+ next = moveCandidate
305
+ isMove = true
307
306
  } else {
308
- // 按“移动频繁度”概率尝试走动(可关闭);空间不够或关闭时退回随机动作。
309
- const moveCandidate = pick(MOVES, anim)
310
- if (CONFIG.walkEnabled && Math.random() * 100 < CONFIG.moveChance && tryMove(moveCandidate)) {
311
- next = moveCandidate
312
- isMove = true
307
+ const roll = Math.random()
308
+ if (roll < 0.3) {
309
+ next = IDLE
310
+ } else if (roll < 0.4) {
311
+ next = TURN
313
312
  } else {
314
313
  next = pick(usableActions, anim)
315
314
  }
@@ -703,6 +702,7 @@ function updateBubble() {
703
702
  || (CONFIG.bubbleMode === 'custom' && tasks.length >= 2 && tasks.some((t) => CONFIG.bubbleStates.includes(t.state)))
704
703
  if (CONFIG.bubbleMode === 'hidden' || !shouldShow) {
705
704
  bubbleEl.classList.remove('visible')
705
+ bubbleEl.style.pointerEvents = 'none'
706
706
  return
707
707
  }
708
708
  let title = ''
@@ -737,6 +737,7 @@ function updateBubble() {
737
737
  bubbleTitle.textContent = title
738
738
  bubbleDetail.textContent = detail
739
739
  bubbleEl.style.transform = `translateX(-50%) scale(${CONFIG.bubbleScale})`
740
+ bubbleEl.style.pointerEvents = 'auto'
740
741
  bubbleEl.classList.add('visible')
741
742
  }
742
743
 
@@ -746,8 +747,14 @@ const DRAG_THRESHOLD = 5
746
747
  // 让透明窗口只在宠物/菜单区域接收鼠标,其余区域点击穿透到下层应用。
747
748
  function updateClickThrough() {
748
749
  const rect = hitEl.getBoundingClientRect()
749
- const inside = lastMouse.x >= rect.left && lastMouse.x <= rect.right
750
+ let inside = lastMouse.x >= rect.left && lastMouse.x <= rect.right
750
751
  && lastMouse.y >= rect.top && lastMouse.y <= rect.bottom
752
+ // 气泡可见时也允许点击(用于点击刷新余额)。
753
+ if (bubbleEl.classList.contains('visible')) {
754
+ const b = bubbleEl.getBoundingClientRect()
755
+ inside = inside || (lastMouse.x >= b.left && lastMouse.x <= b.right
756
+ && lastMouse.y >= b.top && lastMouse.y <= b.bottom)
757
+ }
751
758
  const menuVisible = menuEl.classList.contains('visible')
752
759
  const ignore = !inside && !dragging && !dragState.active && !menuVisible
753
760
  window.petBridge.setIgnoreMouse(ignore)
@@ -840,6 +847,13 @@ hitEl.addEventListener('contextmenu', (e) => {
840
847
  showMenu(e.clientX, e.clientY)
841
848
  })
842
849
 
850
+ // 点击余额气泡可手动刷新余额。
851
+ bubbleEl.addEventListener('click', (e) => {
852
+ e.stopPropagation()
853
+ window.petBridge.refreshBalance()
854
+ showManualBubble('余额刷新中~', '', 1500)
855
+ })
856
+
843
857
  function addMenuButton(label, onClick) {
844
858
  const button = document.createElement('button')
845
859
  button.textContent = label
@@ -881,6 +895,14 @@ function renderMainMenu() {
881
895
  updateClickThrough()
882
896
  feedPet()
883
897
  })
898
+ if (CONFIG.enabled) {
899
+ addMenuButton('禁用 Better DSH Pet', () => {
900
+ CONFIG.enabled = false
901
+ window.petBridge.saveConfig({ enabled: false })
902
+ menuEl.classList.remove('visible')
903
+ updateClickThrough()
904
+ })
905
+ }
884
906
  addMenuButton(`开始番茄钟 ${CONFIG.workMinutes}分`, () => {
885
907
  menuEl.classList.remove('visible')
886
908
  updateClickThrough()
@@ -1199,6 +1221,7 @@ function applyStatus(incoming) {
1199
1221
  if (!incoming || typeof incoming !== 'object') return
1200
1222
 
1201
1223
  if (incoming.config) {
1224
+ CONFIG.enabled = incoming.config.enabled !== false
1202
1225
  CONFIG.bubbleMode = incoming.config.bubbleMode || CONFIG.bubbleMode
1203
1226
  CONFIG.bubbleStates = Array.isArray(incoming.config.bubbleStates) ? incoming.config.bubbleStates : CONFIG.bubbleStates
1204
1227
  CONFIG.reducedMotion = incoming.config.reducedMotion === true