better-dsh-pet 0.1.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.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +93 -0
  3. package/README.md +103 -0
  4. package/assets/alarm.mp3 +0 -0
  5. package/assets/thumb//344/270/234/345/274/240/350/245/277/346/234/233.webm +0 -0
  6. package/assets/thumb//344/270/255/347/247/213/350/265/217/346/234/210/345/220/203/346/234/210/351/245/274.webm +0 -0
  7. package/assets/thumb//344/274/230/351/233/205/345/245/263/344/273/206/350/210/236.webm +0 -0
  8. package/assets/thumb//345/201/267/345/220/203/351/233/266/351/243/237/350/242/253/346/212/223/344/275/217.webm +0 -0
  9. package/assets/thumb//345/206/231/344/273/243/347/240/201.webm +0 -0
  10. package/assets/thumb//345/212/250/347/211/251/347/216/257/347/273/225.webm +0 -0
  11. package/assets/thumb//345/216/237/345/234/260/344/270/223/345/277/203/347/216/251/351/255/224/346/226/271.webm +0 -0
  12. package/assets/thumb//345/216/237/345/234/260/345/260/217/346/206/251/346/262/211/347/234/240.webm +0 -0
  13. package/assets/thumb//345/216/237/345/234/260/345/267/246/350/275/254/345/245/224/350/267/221.webm +0 -0
  14. package/assets/thumb//345/216/237/345/234/260/346/225/262/345/207/273/346/241/214/351/235/242/344/272/222/345/212/250.webm +0 -0
  15. package/assets/thumb//345/216/237/345/234/260/346/274/202/346/265/256/350/270/217/346/255/245.webm +0 -0
  16. package/assets/thumb//345/216/237/345/234/260/350/267/263/350/267/203/346/212/223/347/242/216/345/244/264/351/241/266/347/211/251/345/223/201.webm +0 -0
  17. package/assets/thumb//345/216/237/345/234/260/350/271/262/344/270/213/347/216/251/347/216/251/345/205/267/346/261/275/350/275/246.webm +0 -0
  18. package/assets/thumb//345/216/237/345/234/260/351/207/215/345/212/233/344/270/213/350/271/262/345/216/213/347/274/251.webm +0 -0
  19. package/assets/thumb//345/217/257/347/210/261/345/256/205/350/210/236.webm +0 -0
  20. package/assets/thumb//345/220/203Token.webm +0 -0
  21. package/assets/thumb//345/220/203/345/206/260/346/267/207/346/267/213/350/236/215/345/214/226.webm +0 -0
  22. package/assets/thumb//345/220/203/345/215/210/351/244/220.webm +0 -0
  23. package/assets/thumb//345/220/203/346/227/251/351/244/220.webm +0 -0
  24. package/assets/thumb//345/220/203/346/231/232/351/244/220.webm +0 -0
  25. package/assets/thumb//345/220/203/347/231/275/351/245/255.webm +0 -0
  26. package/assets/thumb//345/220/271/346/260/224/347/220/203.webm +0 -0
  27. package/assets/thumb//345/223/210/346/254/240/350/277/236/345/244/251.webm +0 -0
  28. package/assets/thumb//345/240/206/351/233/252/344/272/272.webm +0 -0
  29. package/assets/thumb//345/244/247/345/217/243/345/220/203/351/233/266/351/243/237.webm +0 -0
  30. package/assets/thumb//345/245/263/344/273/206/345/261/210/350/206/235/347/244/274/344/273/252.webm +0 -0
  31. package/assets/thumb//345/260/217/345/271/205/345/272/246/345/216/237/345/234/260 360 /345/272/246/346/227/213/350/275/254/345/261/225/347/244/272.webm +0 -0
  32. package/assets/thumb//345/260/217/346/217/220/347/220/264/346/274/224/345/245/217.webm +0 -0
  33. package/assets/thumb//345/276/205/346/234/272/345/221/274/345/220/270/344/274/221/351/227/262.webm +0 -0
  34. package/assets/thumb//346/202/240/351/227/262/345/223/274/346/255/214.webm +0 -0
  35. package/assets/thumb//346/211/223/347/236/214/347/235/241/350/242/253/346/203/212/351/206/222.webm +0 -0
  36. package/assets/thumb//346/221/207/346/211/207/347/272/263/345/207/211.webm +0 -0
  37. package/assets/thumb//346/224/276/351/243/216/347/255/235.webm +0 -0
  38. package/assets/thumb//346/225/264/344/275/223/346/215/242/350/243/205/350/257/225/350/211/262.webm +0 -0
  39. package/assets/thumb//346/267/261/345/272/246/346/200/235/350/200/203/347/242/216/347/242/216/345/277/265.webm +0 -0
  40. package/assets/thumb//347/202/271/345/207/273/345/233/236/345/272/224 - /345/202/262/345/250/207/347/224/237/346/260/224/357/274/210/344/276/247/350/272/253/345/261/225/347/244/272/357/274/211.webm +0 -0
  41. package/assets/thumb//347/202/271/345/207/273/345/233/236/345/272/224 - /345/256/263/347/276/236/346/203/212/350/256/266.webm +0 -0
  42. package/assets/thumb//347/202/271/345/207/273/345/233/236/345/272/224 - /345/274/200/345/277/203/350/267/203/345/212/250.webm +0 -0
  43. package/assets/thumb//347/205/247/351/225/234/345/255/220.webm +0 -0
  44. package/assets/thumb//347/216/251/346/260/264/346/236/252.webm +0 -0
  45. package/assets/thumb//347/216/251/346/270/270/346/210/217/346/260/224/346/200/245/350/264/245/345/235/217.webm +0 -0
  46. package/assets/thumb//347/224/250/351/262/270/351/261/274/345/260/276/345/267/264/346/213/215/346/211/223/345/234/260/351/235/242.webm +0 -0
  47. package/assets/thumb//350/223/235/351/262/270/347/216/260/344/270/226.webm +0 -0
  48. package/assets/thumb//350/236/203/350/237/271/350/265/260/350/267/257.webm +0 -0
  49. package/assets/thumb//350/242/253/345/220/223/344/270/200/350/267/263/357/274/210/347/202/270/346/257/233/357/274/211.webm +0 -0
  50. package/assets/thumb//350/242/253/350/220/275/345/217/266/346/267/271/346/262/241.webm +0 -0
  51. package/assets/thumb//350/242/253/351/274/240/346/240/207/346/213/226/346/213/275/346/202/254/347/251/272/345/217/215/351/246/210.webm +0 -0
  52. package/assets/thumb//350/266/205/345/244/247/344/274/270/346/207/222/350/205/260.webm +0 -0
  53. package/assets/thumb//350/275/273/345/277/253/346/221/207/346/221/206/350/210/236.webm +0 -0
  54. package/assets/thumb//350/275/273/345/277/253/350/256/260/345/275/225.webm +0 -0
  55. package/assets/thumb//351/262/270/351/261/274/345/220/220/346/263/241/346/263/241/347/211/271/346/225/210.webm +0 -0
  56. package/cordis.patch.yml +36 -0
  57. package/lib/client.js +238 -0
  58. package/lib/index.js +589 -0
  59. package/lib/index.js.bak-20260819-104008 +483 -0
  60. package/lib/pet-helper-process.js +133 -0
  61. package/lib/pet-protocol.js +64 -0
  62. package/lib/pet-reducer.js +527 -0
  63. package/lib/pet-status-copy.js +118 -0
  64. package/lib/types/client/index.d.ts +43 -0
  65. package/lib/types/index.d.ts +65 -0
  66. package/package.json +85 -0
  67. package/runtime/electron-helper/index.html +134 -0
  68. package/runtime/electron-helper/main.js +191 -0
  69. package/runtime/electron-helper/package.json +7 -0
  70. package/runtime/electron-helper/preload.js +39 -0
  71. package/runtime/electron-helper/renderer.js +903 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ysppwn721
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,93 @@
1
+ # better-dsh-pet 🐾
2
+
3
+ <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=monthly&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=total&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">
12
+ </p>
13
+
14
+ > A floating desktop pet for the [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) Web UI: idle breathing, random actions (including dozing off), occasional turns, screen wandering, click reactions, and draggable.
15
+
16
+ > 📌 **Derivative work notice**: This project is a modified/derived version based on [PC2005-cloud/dsh-pet](https://github.com/PC2005-cloud/dsh-pet). Thanks to the original author for the pet animations and design.
17
+
18
+ ---
19
+
20
+ ## 🚀 Quick Start (Install the Plugin)
21
+
22
+ ```sh
23
+ dsh plugin --profile web add better-dsh-pet
24
+ ```
25
+
26
+ Restart `dsh web` and the pet appears in the bottom-right corner — 51 transparent animations, ready to use out of the box, no generation pipeline required.
27
+
28
+ > 💡 Want to craft your own one-of-a-kind pet? Clone [ysppwn721/better-dsh-pet](https://github.com/ysppwn721/better-dsh-pet) and use the bundled asset pipeline (AI prompts → green-screen video → transparent animation, generated with Doubao) to generate one from scratch — fully reproducible.
29
+
30
+ ## ✨ Features
31
+
32
+ - **A pure pet, nothing else**: no business features — no weather, no monitoring, no agent-state sensing; just a companion. Zero core changes, zero model cost (no LLM/API calls at runtime)
33
+ - **51 hand-drawn style transparent animations**: idle breathing, dozing off, playing with a Rubik's cube, humming, hair-raising, blowing bubbles, playing with a water gun, playing violin, the whale emerging, eating rice, looking in the mirror, three dances, writing code, seasonal actions (kite flying, snowman building, ice cream eating, fireworks…) — all seamlessly chained
34
+ - **Never-ending animation chain**: when each animation finishes, the next one is picked instantly by probability (30% idle / 10% turn / 40% action / 20% move)
35
+ - **Screen wandering**: walks toward its facing direction, checks the space ahead and never walks off screen
36
+ - **Click / drag**: click triggers a random reaction animation (happy / shy / tsundere); drag it anywhere
37
+ - **Left/right facing**: all animations are CSS-mirrored, the pet can face left or right
38
+ - **Ground alignment**: animations share a unified foot line, the pet always stands on the "ground"
39
+ - **Smooth transitions**: double-buffered video cross-fade, zero blank frames between switches
40
+ - **Accessibility-friendly**: supports `prefers-reduced-motion`
41
+
42
+ ## ⚙️ Configuration
43
+
44
+ | Key | Description | Current status |
45
+ |---|---|---|
46
+ | `size` | Stage width (px); pet height ≈ width×9/16×74% | Default 462 (≈260px tall), **not yet delivered to the browser** (DSH client config pipeline limitation; falls back to code default) |
47
+ | `position` | Default corner position | Defaults to bottom-right, same as above (not yet delivered) |
48
+ | `fullRoot` | Original 2160×1215 master asset directory | Defaults to `$DSH_HOME/pet-assets`; takes effect after manually downloading the master assets |
49
+
50
+ > Note: the plugin works out of the box; all config above is optional. Browser-side configuration of `size`/`position` is planned.
51
+
52
+ ## 🗑️ Uninstall
53
+
54
+ ```sh
55
+ dsh plugin --profile web remove better-dsh-pet
56
+ ```
57
+
58
+ ## 🎬 Animation Previews
59
+
60
+ > The animations have transparent backgrounds; in these GIF previews the transparent areas show the page background color, while the actual playback (webm) is transparent.
61
+
62
+ <p>
63
+ <img src="assets/preview/daiji-huxi-xiuxian.gif" width="160" alt="Idle breathing & chill" title="Idle breathing & chill">
64
+ <img src="assets/preview/dongzhangxiwang.gif" width="160" alt="Looking around" title="Looking around">
65
+ <img src="assets/preview/yuandi-piaofu-tabu.gif" width="160" alt="Floating in place" title="Floating in place">
66
+ <img src="assets/preview/yuandi-xiaoqi-chenmian.gif" width="160" alt="Napping" title="Napping">
67
+ <img src="assets/preview/dianji-huiying-kaixin-yuedong.gif" width="160" alt="Click response - happy bounce" title="Click response - happy bounce">
68
+ <img src="assets/preview/beishubiao-tuozhuai-xuankong-fankui.gif" width="160" alt="Dragged by the mouse" title="Dragged by the mouse">
69
+ </p>
70
+
71
+ All 51 animations live in the repo under `assets/thumb/`.
72
+
73
+ ## 📚 A Complete Project (More Than a Plugin)
74
+
75
+ This is a **complete three-piece project** — anyone can clone the repo and generate their own desktop pet from scratch:
76
+
77
+ ```
78
+ ① Prompts (recipe) → ② Asset pipeline (engine) → ③ Plugin (product)
79
+ AI animation prompts source video → transparent the pet running in DSH
80
+ ```
81
+
82
+ - Repository: [ysppwn721/better-dsh-pet](https://github.com/ysppwn721/better-dsh-pet)
83
+ - Design & implementation docs: [DESIGN.md](https://github.com/ysppwn721/better-dsh-pet/blob/master/DESIGN.md)
84
+
85
+ ## 🔎 Discover More DSH Plugins
86
+
87
+ - Community plugin catalog: [awesome-dsh-plugin.com](https://awesome-dsh-plugin.com)
88
+ - DSH official repository: [deepseek-ai/DeepSeek-Harness](https://github.com/deepseek-ai/deepseek-harness)
89
+
90
+ ## 📄 License
91
+
92
+ - Code: MIT
93
+ - Assets (animations/prompts): see the repository notes
package/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # better-dsh-pet 🐾
2
+
3
+ <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">
12
+ </p>
13
+
14
+ > A desktop-native pet bubble driven by [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) session events.
15
+ > 一只住在 Windows 桌面上的透明置顶大肥鱼:由 DSH 真实工作状态驱动,思考/工作/等待/完成/出错时自动切换动画并显示状态气泡。
16
+
17
+ > 📌 **二创声明**:本项目是基于 [PC2005-cloud/dsh-pet](https://github.com/PC2005-cloud/dsh-pet) 的二创修改版,感谢原作者的桌宠动画与设计。
18
+
19
+ ---
20
+
21
+ ## 🚀 快速开始(安装插件)
22
+
23
+ ```sh
24
+ dsh plugin --profile web add better-dsh-pet
25
+ ```
26
+
27
+ 重启 `dsh web`,桌面会出现独立置顶气泡窗口——51 个透明动画开箱即用。网页内不再显示浮动大肥鱼;设置入口在 `设置 → 插件 → 插件配置 → 大肥鱼桌面伴侣`。
28
+
29
+ > 💡 想自己造一只专属宠物?克隆 [ysppwn721/better-dsh-pet](https://github.com/ysppwn721/better-dsh-pet) 仓库,用内置素材链(AI 提示词 → 绿幕视频 → 透明动画,素材由豆包生成)从零生成,全流程可复现。
30
+
31
+ ## ✨ 功能特性
32
+
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
65
+ dsh plugin --profile web remove better-dsh-pet
66
+ ```
67
+
68
+ ## 🎬 效果预览
69
+
70
+ > 动画为透明背景;GIF 预览中透明部分显示为页面底色,实际播放为透明。
71
+
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>
80
+
81
+ 全部 51 个动画见仓库:`assets/thumb/`。
82
+
83
+ ## 📚 完整项目(不止是插件)
84
+
85
+ 这是**完整的三件套项目**,任何人 clone 仓库都可以从零生成自己的桌面宠物:
86
+
87
+ ```
88
+ ① 提示词(配方) → ② 素材生成链(引擎) → ③ 插件(成品)
89
+ AI 生成动画的配方 源视频 → 透明动画的管线 运行在 DSH 里的宠物
90
+ ```
91
+
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)
94
+
95
+ ## 🔎 发现更多 DSH 插件
96
+
97
+ - 社区插件目录:[awesome-dsh-plugin.com](https://awesome-dsh-plugin.com)
98
+ - DSH 官方仓库:[deepseek-ai/DeepSeek-Harness](https://github.com/deepseek-ai/deepseek-harness)
99
+
100
+ ## 📄 许可
101
+
102
+ - 代码:MIT
103
+ - 素材(动画/提示词):见仓库说明
Binary file
@@ -0,0 +1,36 @@
1
+ # ============================================================================
2
+ # better-dsh-pet 的 bundle patch —— 把宠物插件挂进 DSH 配置树
3
+ # ============================================================================
4
+ #
5
+ # 【这是什么】
6
+ # 这是 better-dsh-pet 的"挂载声明"。DSH 启动时按 bundle 层栈把各个插件的
7
+ # patch 叠起来组成配置树。本文件就是 better-dsh-pet 这一层的内容。
8
+ #
9
+ # 【工作原理】
10
+ # - insert:往配置树里添加新的插件行(entry)
11
+ # - 每个 entry 有 id(行标识,patch 覆盖时按它定位)和 name(插件模块)
12
+ # - name: 'better-dsh-pet' 会解析包入口 lib/index.js(宿主半侧)
13
+ # - 因为 package.json 声明了 dsh.client,DSH 的模块系统同时会把
14
+ # 这个包扫描为"浏览器插件",提供 /plugins/better-dsh-pet/client.js 给页面
15
+ #
16
+ # 【config 说明】
17
+ # 这里写的 config 会传给 host 半侧的 apply(ctx, config),作为 DSH 设置页的
18
+ # 初始值;浏览器半侧只提供设置卡片,不再渲染网页宠物。
19
+ #
20
+ # ============================================================================
21
+
22
+ - insert:
23
+ - id: pet # 插件行 id(唯一)
24
+ name: 'better-dsh-pet' # 模块名:解析到 lib/index.js
25
+ config:
26
+ enabled: true # 是否启用桌面气泡
27
+ scale: 1 # 角色大小(70%~140%)
28
+ bubbleScale: 1 # 气泡大小(80%~120%)
29
+ activityLevel: normal # quiet / normal / lively
30
+ reducedMotion: false # 减少动态效果
31
+ bubbleMode: always # always / hidden / custom
32
+ bubbleStates: [SUCCESS, ERROR, WAITING]
33
+ includeSubagents: false # 是否让子 Agent 参与状态选择
34
+ workMinutes: 25 # 番茄钟工作时长(分钟)
35
+ breakMinutes: 5 # 番茄钟休息时长(分钟)
36
+ roastEnabled: false # 根据本次对话自动吐槽(会消耗 Token)
package/lib/client.js ADDED
@@ -0,0 +1,238 @@
1
+ /**
2
+ * ============================================================================
3
+ * better-dsh-pet 浏览器半侧(browser half)—— 设置卡片
4
+ * ============================================================================
5
+ *
6
+ * 桌面宠物本体已迁移到独立的 Electron Helper 窗口,不再在 DSH 网页里浮动。
7
+ * 浏览器半侧现在只负责在 DSH 设置页提供一个“大肥鱼”配置卡片,通过
8
+ * /plugins/better-dsh-pet/config 读写宿主配置。
9
+ *
10
+ * ============================================================================
11
+ */
12
+ window.__ModuleLoader__.load({
13
+ id: 'better-dsh-pet',
14
+ factory: (require) => {
15
+ const module = { exports: {} }
16
+ const exports = module.exports
17
+ const React = require('react')
18
+ const { useEffect, useRef, useState } = React
19
+ const { jsx: h } = require('react/jsx-runtime')
20
+ const CONFIG_ENDPOINT = '/plugins/better-dsh-pet/config'
21
+
22
+ const cardStyle = {
23
+ listStyle: 'none', border: '1px solid var(--border-color, #d8d8d8)', borderRadius: 12,
24
+ padding: 16, background: 'var(--surface-color, transparent)', display: 'grid', gap: 14,
25
+ }
26
+ const rowStyle = { display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 20 }
27
+ const selectStyle = { minWidth: 120, padding: '6px 10px', borderRadius: 8 }
28
+ const BUBBLE_STATE_OPTIONS = [
29
+ ['IDLE', '空闲'],
30
+ ['THINKING', '思考中'],
31
+ ['WORKING', '工作中'],
32
+ ['WAITING', '等待确认'],
33
+ ['SUCCESS', '完成'],
34
+ ['ERROR', '错误'],
35
+ ]
36
+ const bubbleGridStyle = {
37
+ display: 'grid', gridTemplateColumns: 'repeat(3, auto)', gap: '6px 14px',
38
+ padding: '10px 12px', border: '1px solid var(--border-color, #d8d8d8)', borderRadius: 8,
39
+ }
40
+
41
+ function Field({ label, hint, children }) {
42
+ return h('label', { style: rowStyle },
43
+ h('span', null,
44
+ h('span', { style: { display: 'block', fontWeight: 600 } }, label),
45
+ h('small', { style: { display: 'block', opacity: 0.65, marginTop: 3 } }, hint),
46
+ ),
47
+ children,
48
+ )
49
+ }
50
+
51
+ function BubbleStatePicker({ value, disabled, onChange }) {
52
+ const selected = Array.isArray(value) ? value : []
53
+ const toggle = (state, checked) => {
54
+ const next = new Set(selected)
55
+ if (checked) next.add(state)
56
+ else next.delete(state)
57
+ onChange([...next])
58
+ }
59
+ return h('div', { style: bubbleGridStyle },
60
+ ...BUBBLE_STATE_OPTIONS.map(([state, label]) =>
61
+ h('label', { key: state, style: { display: 'flex', alignItems: 'center', gap: 4 } },
62
+ h('input', {
63
+ type: 'checkbox', checked: selected.includes(state), disabled,
64
+ onChange: (event) => toggle(state, event.target.checked),
65
+ }),
66
+ label,
67
+ ),
68
+ ),
69
+ )
70
+ }
71
+
72
+ function PetSettingsCard() {
73
+ const [status, setStatus] = useState('loading')
74
+ const [value, setValue] = useState({})
75
+ const [busy, setBusy] = useState(false)
76
+ const patchSeq = useRef(0)
77
+ const sliderTimers = useRef(new Map())
78
+ const writable = status === 'ready' && !busy
79
+
80
+ useEffect(() => {
81
+ let active = true
82
+ fetch(CONFIG_ENDPOINT, { cache: 'no-store' })
83
+ .then(async (response) => {
84
+ if (!response.ok) throw new Error(`settings request failed: ${response.status}`)
85
+ return response.json()
86
+ })
87
+ .then((next) => { if (active) { setValue(next); setStatus('ready') } })
88
+ .catch(() => { if (active) setStatus('unavailable') })
89
+ return () => {
90
+ active = false
91
+ for (const timer of sliderTimers.current.values()) clearTimeout(timer)
92
+ sliderTimers.current.clear()
93
+ }
94
+ }, [])
95
+
96
+ const write = async (field, next) => {
97
+ const seq = ++patchSeq.current
98
+ setBusy(true)
99
+ try {
100
+ const response = await fetch(CONFIG_ENDPOINT, {
101
+ method: 'PATCH',
102
+ headers: { 'content-type': 'application/json' },
103
+ body: JSON.stringify({ [field]: next }),
104
+ })
105
+ if (!response.ok) throw new Error(`settings write failed: ${response.status}`)
106
+ const updated = await response.json()
107
+ if (seq === patchSeq.current) {
108
+ setValue(updated)
109
+ setStatus('ready')
110
+ }
111
+ } catch {
112
+ if (seq === patchSeq.current) setStatus('unavailable')
113
+ } finally {
114
+ if (seq === patchSeq.current) setBusy(false)
115
+ }
116
+ }
117
+
118
+ const writeSlider = (field, next) => {
119
+ setValue((prev) => ({ ...prev, [field]: next }))
120
+ patchSeq.current += 1
121
+ const pending = sliderTimers.current.get(field)
122
+ if (pending) clearTimeout(pending)
123
+ const timer = setTimeout(() => {
124
+ sliderTimers.current.delete(field)
125
+ void write(field, next)
126
+ }, 250)
127
+ sliderTimers.current.set(field, timer)
128
+ }
129
+
130
+ return h('li', { style: cardStyle, 'data-testid': 'better-dsh-pet-settings' },
131
+ h('div', null,
132
+ h('strong', { style: { fontSize: 16 } }, '大肥鱼桌面伴侣'),
133
+ h('p', { style: { margin: '5px 0 0', opacity: 0.72 } }, '独立桌面气泡,由 DSH 真实工作状态驱动;网页内不再显示浮动大肥鱼。'),
134
+ ),
135
+ status === 'unavailable'
136
+ ? h('span', { role: 'status' }, '大肥鱼设置尚未连接到 DSH Host。')
137
+ : status === 'loading'
138
+ ? h('span', null, '正在读取设置…')
139
+ : h(React.Fragment, null,
140
+ h(Field, { label: '启用大肥鱼', hint: '关闭后立即退出桌面气泡;重新开启无需单独启动程序。' },
141
+ h('input', {
142
+ type: 'checkbox', checked: value.enabled !== false, disabled: !writable,
143
+ onChange: (event) => void write('enabled', event.target.checked),
144
+ }),
145
+ ),
146
+ h(Field, { label: '角色大小', hint: `${Math.round((value.scale ?? 1) * 100)}%` },
147
+ h('input', {
148
+ type: 'range', min: 0.7, max: 1.4, step: 0.05, value: value.scale ?? 1,
149
+ disabled: status !== 'ready',
150
+ onChange: (event) => void writeSlider('scale', Number(event.target.value)),
151
+ }),
152
+ ),
153
+ h(Field, { label: '活跃程度', hint: '控制空闲时微动作的出现频率。' },
154
+ h('select', {
155
+ value: value.activityLevel ?? 'normal', disabled: !writable, style: selectStyle,
156
+ onChange: (event) => void write('activityLevel', event.target.value),
157
+ },
158
+ h('option', { value: 'quiet' }, '安静'),
159
+ h('option', { value: 'normal' }, '标准'),
160
+ h('option', { value: 'lively' }, '活泼')),
161
+ ),
162
+ h(Field, { label: '减少动态效果', hint: '减少走动、循环帧和程序化晃动。' },
163
+ h('input', {
164
+ type: 'checkbox', checked: value.reducedMotion === true, disabled: !writable,
165
+ onChange: (event) => void write('reducedMotion', event.target.checked),
166
+ }),
167
+ ),
168
+ h(Field, { label: '气泡显示', hint: '常驻显示、完全隐藏,或自定义哪些状态显示气泡。' },
169
+ h('select', {
170
+ value: value.bubbleMode ?? 'always', disabled: !writable, style: selectStyle,
171
+ onChange: (event) => void write('bubbleMode', event.target.value),
172
+ },
173
+ h('option', { value: 'always' }, '常驻显示'),
174
+ h('option', { value: 'hidden' }, '完全隐藏'),
175
+ h('option', { value: 'custom' }, '自定义显示状态')),
176
+ ),
177
+ (value.bubbleMode ?? 'always') !== 'hidden'
178
+ ? h(Field, { label: '气泡大小', hint: `${Math.round((value.bubbleScale ?? 1) * 100)}%` },
179
+ h('input', {
180
+ type: 'range', min: 0.8, max: 1.2, step: 0.05, value: value.bubbleScale ?? 1,
181
+ disabled: status !== 'ready',
182
+ onChange: (event) => void writeSlider('bubbleScale', Number(event.target.value)),
183
+ }),
184
+ )
185
+ : null,
186
+ (value.bubbleMode ?? 'always') === 'custom'
187
+ ? h(Field, { label: '自定义显示状态', hint: '勾选后,只有这些状态出现时才会显示气泡。' },
188
+ h(BubbleStatePicker, {
189
+ value: value.bubbleStates ?? ['SUCCESS', 'ERROR', 'WAITING'],
190
+ disabled: !writable,
191
+ onChange: (next) => void write('bubbleStates', next),
192
+ }),
193
+ )
194
+ : null,
195
+ h(Field, { label: '响应子 Agent', hint: '默认只跟随顶层任务,避免状态过度跳动。' },
196
+ h('input', {
197
+ type: 'checkbox', checked: value.includeSubagents === true, disabled: !writable,
198
+ onChange: (event) => void write('includeSubagents', event.target.checked),
199
+ }),
200
+ ),
201
+ h(Field, { label: '自动吐槽', hint: '根据本次对话自动生成吐槽(会消耗 Token)。' },
202
+ h('input', {
203
+ type: 'checkbox', checked: value.roastEnabled === true, disabled: !writable,
204
+ onChange: (event) => void write('roastEnabled', event.target.checked),
205
+ }),
206
+ ),
207
+ h(Field, { label: '番茄钟工作时长(分钟)', hint: '右键菜单“开始番茄钟”使用此时长。' },
208
+ h('input', {
209
+ type: 'number', min: 1, max: 120, step: 1,
210
+ value: value.workMinutes ?? 25, disabled: !writable, style: selectStyle,
211
+ onChange: (event) => void write('workMinutes', Number(event.target.value)),
212
+ }),
213
+ ),
214
+ h(Field, { label: '番茄钟休息时长(分钟)', hint: '右键菜单“开始短休息”使用此时长。' },
215
+ h('input', {
216
+ type: 'number', min: 1, max: 60, step: 1,
217
+ value: value.breakMinutes ?? 5, disabled: !writable, style: selectStyle,
218
+ onChange: (event) => void write('breakMinutes', Number(event.target.value)),
219
+ }),
220
+ ),
221
+ busy ? h('small', { role: 'status' }, '正在保存…') : null,
222
+ ),
223
+ )
224
+ }
225
+
226
+ function apply(ctx) {
227
+ ctx.slots.inject('settings.plugin.item', () => ctx.slots.register({
228
+ name: 'settings.plugin.item', id: 'better-dsh-pet', order: 30,
229
+ inject: () => ({}),
230
+ }, PetSettingsCard))
231
+ }
232
+
233
+ exports.name = 'better-dsh-pet-client'
234
+ exports.inject = ['slots']
235
+ exports.apply = apply
236
+ return module.exports
237
+ },
238
+ })