@linxin666/dsh-pet 0.2.0 → 0.2.2

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 (59) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +15 -5
  3. package/README.zh.md +15 -5
  4. package/assets/whale/pet.json +1 -1
  5. package/assets/whale-refined/pet.json +7 -0
  6. package/assets/whale-refined/spritesheet.webp +0 -0
  7. package/lib/client.js +257 -53
  8. package/lib/client.js.map +1 -1
  9. package/lib/index.js +235 -83
  10. package/lib/invariant.js +1 -1
  11. package/lib/{state-Ch3f4luZ.js → state-DrMX22GL.js} +35 -5
  12. package/lib/types/chatter.d.ts.map +1 -1
  13. package/lib/types/chatter.js +167 -77
  14. package/lib/types/client/PetDockEntry.d.ts.map +1 -1
  15. package/lib/types/client/PetDockEntry.js +1 -1
  16. package/lib/types/client/PetSprite.d.ts.map +1 -1
  17. package/lib/types/client/PetSprite.js +54 -11
  18. package/lib/types/client/PluginSettingsCard.d.ts +22 -0
  19. package/lib/types/client/PluginSettingsCard.d.ts.map +1 -1
  20. package/lib/types/client/PluginSettingsCard.js +142 -3
  21. package/lib/types/client/index.d.ts.map +1 -1
  22. package/lib/types/client/index.js +1 -0
  23. package/lib/types/client/locales.d.ts +4 -0
  24. package/lib/types/client/locales.d.ts.map +1 -1
  25. package/lib/types/client/locales.js +4 -0
  26. package/lib/types/client/spritesheet.d.ts +1 -3
  27. package/lib/types/client/spritesheet.d.ts.map +1 -1
  28. package/lib/types/client/spritesheet.js +1 -5
  29. package/lib/types/loopback.d.ts +25 -0
  30. package/lib/types/loopback.d.ts.map +1 -0
  31. package/lib/types/loopback.js +68 -0
  32. package/lib/types/registry.d.ts +0 -2
  33. package/lib/types/registry.d.ts.map +1 -1
  34. package/lib/types/registry.js +11 -7
  35. package/lib/types/remarks.d.ts.map +1 -1
  36. package/lib/types/remarks.js +30 -0
  37. package/lib/types/routes.d.ts.map +1 -1
  38. package/lib/types/routes.js +14 -0
  39. package/lib/types/service.d.ts.map +1 -1
  40. package/package.json +1 -2
  41. package/src/chatter.ts +167 -77
  42. package/src/client/PetDockEntry.test.tsx +93 -0
  43. package/src/client/PetDockEntry.tsx +1 -0
  44. package/src/client/PetSprite.test.tsx +72 -11
  45. package/src/client/PetSprite.tsx +98 -30
  46. package/src/client/PluginSettingsCard.tsx +219 -18
  47. package/src/client/index.test.tsx +95 -0
  48. package/src/client/index.ts +1 -0
  49. package/src/client/locales.ts +4 -0
  50. package/src/client/pet-css.test.ts +15 -3
  51. package/src/client/pet.module.css +101 -71
  52. package/src/client/settings-card.module.css +90 -1
  53. package/src/client/spritesheet.ts +1 -6
  54. package/src/loopback.ts +63 -0
  55. package/src/registry.test.ts +49 -1
  56. package/src/registry.ts +11 -7
  57. package/src/remarks.ts +30 -0
  58. package/src/routes.ts +11 -0
  59. package/src/service.ts +0 -1
package/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # node scripts/verify-docs.mjs --write <dir>
5
- README.md: 2784c32e13b4f35dd94caef439f4b73d99045289
6
- README.zh.md: f062272c21046b364510c016c97877605083689d
5
+ README.md: 7bbc716cb77d488334ef3bfb9638823d549fd530
6
+ README.zh.md: d72e002e27ea84dd9da33efb3b3b0585a70a273a
package/README.md CHANGED
@@ -23,8 +23,8 @@ Re-implemented from the pet feature of the Codex desktop app, as an official DSH
23
23
  | Dragging | Hold and drag the pet to reposition; position persisted |
24
24
  | Hide/Summon | The hover panel sits below the pet (lifted above the status bubbles when there is no room below) and provides 隐藏 (Hide); after hiding, a 召唤{name} (Summon {name}) button appears |
25
25
  | Witty remarks | Built-in remark library (10 lines per event) plus per-pet custom lines; success lines rotate by persisted success counts and cooldown lines by persisted rejection counts |
26
- | Status bubbles | Each concurrently active top-level session gets its own bubble, stacked above the pet (up to 12); subagent sessions report through their spawning conversation and never occupy a bubble of their own; click a bubble to jump to its session; transient interaction feedback temporarily takes priority. Bubble copy comes from generous rotating pools per scene (waiting / thinking / writing / done / failed...), tool calls map onto per-family witty lines carrying the real argument hint (e.g. 跑跑 npm test), and a long-lived scene re-phrases itself every few seconds |
27
- | Inner whispers | 碎碎念: while the model streams, the pet occasionally speaks its inner voice in a distinct violet whisper bubble — keyword moods woken by the model output (errors, test greens, plans, victories...) plus ambient whispers earned by output volume; paced by a cooldown, expired after a few seconds |
26
+ | Status bubbles | Only the most recently active top-level session speaks by default — when several sessions run at once, the rest collapse behind a +N badge on the main bubble instead of stacking a tall column; hover the bubble (or tap the badge, for touch) to fan every session's bubble out above it and click one to jump to its session; subagent sessions report through their spawning conversation and never occupy a bubble of their own; transient interaction feedback temporarily takes priority. Bubble copy comes from generous rotating pools per scene (waiting / thinking / writing / done / failed...), tool calls map onto per-family witty lines carrying the real argument hint (e.g. 跑跑 npm test), and a long-lived scene re-phrases itself every few seconds |
27
+ | Inner whispers | 碎碎念: while the model streams, the pet occasionally speaks its inner voice through its own bubble — a fresh whisper takes over the display session's bubble and marks it with 「」 quotes sharing the same DeepSeek-blue glass as every status bubble, so stacked bubbles never clash — instead of stacking a second bubble — keyword moods woken by the model output (errors, test greens, plans, victories...) plus ambient whispers earned by output volume; paced by a cooldown, the status copy returns after a few seconds |
28
28
  | Multi-session activity | The pet is host-global: the most recent meaningful event drives the sprite animation while every active top-level session reports its own state in a separate bubble; completed turns from every session (subagents included) contribute affinity and treats |
29
29
 
30
30
  ## Pet contract
@@ -67,6 +67,15 @@ Where pets come from (later sources override earlier ones on id collision):
67
67
 
68
68
  The registry is built once at host startup; add or change a pet, then restart `dsh web`.
69
69
 
70
+ ## Built-in pets
71
+
72
+ | Registry id | Selector label | Source |
73
+ |---|---|---|
74
+ | `whale-girl` | 鲸鱼娘(原版) | The repository's original whale-girl atlas |
75
+ | `whale-girl-refined` | 鲸鱼娘(精致版) | An AI-assisted derivative with repaired and refined details, based on the whale-girl design direction |
76
+
77
+ The refined variant references DreamSkin's “DeepSeek-Whale” theme. The historical source record identifies `powerdog996` as the original theme author and marks the theme as MIT: [DreamSkin](https://dreamskin.cc), [repository source record](https://github.com/zhu1090093659/dsh-web-ui/commit/87edd7ff4800dffd40bc93fb76e4ae450390facd). This attribution records the source and derivative relationship; it does not present the refined variant as an official work of the original author or redefine the original artwork's licensing scope.
78
+
70
79
  ## Animation preview
71
80
 
72
81
  The sprites are an 8-column × 9-row atlas (192×208 cells) generated by the [hatch-pet](https://github.com/dsh2026) pipeline; below are previews of each state:
@@ -101,7 +110,8 @@ dsh-pet/
101
110
  | |-- sequences.ts # full-track scene sequence timing
102
111
  | |-- spritesheet.ts # atlas geometry helpers + track trimming
103
112
  | `-- pet.module.css
104
- |-- assets/whale/ # built-in whale-girl (pet.json + spritesheet.webp + previews)
113
+ |-- assets/whale/ # built-in original whale-girl (manifest + atlas + previews)
114
+ |-- assets/whale-refined/ # built-in refined whale-girl registry variant
105
115
  `-- cordis.patch.yml # bundle patch: inserts the pet plugin row
106
116
  ```
107
117
 
@@ -131,7 +141,7 @@ Install the family aggregate package `@linxin666/dsh-web-ui-all` (all plugins an
131
141
 
132
142
  ```sh
133
143
  ### From npm (recommended)
134
- dsh plugin --profile web add @linxin666/dsh-pet
144
+ dsh plugin --profile web add @linxin666/dsh-pet@latest
135
145
 
136
146
  ### From the repository (development)
137
147
  git clone https://github.com/zhu1090093659/dsh-web-ui.git
@@ -156,7 +166,7 @@ The browser bundle rides the `window.__ModuleLoader__.load` contract; React/cord
156
166
 
157
167
  ## Sprites and animation-track calibration
158
168
 
159
- The built-in whale-girl atlas is generated by the hatch-pet pipeline as 9 states × 8 columns: `assets/whale/spritesheet.webp` (1536×1872, 8 columns × 9 rows of 192×208 cells) + `assets/whale/pet.json`. The frame count, rhythm, and scene rotation live in that manifest's `frames`, `tracks`, and `sequences` fields; pets without overrides follow the hatch-pet contract rhythm and canonical single-track scene mapping. Redoing artwork therefore only edits `assets/whale/pet.json` (row-order contract: 0 idle / 1 running-right / 2 running-left / 3 waving / 4 jumping / 5 failed / 6 waiting / 7 running / 8 review).
169
+ The two built-in whale-girl atlases use the same 9-state × 8-column contract: `assets/whale/` is the original and `assets/whale-refined/` is the refined variant. Each atlas is 1536×1872 (8 columns × 9 rows of 192×208 cells). Frame counts, rhythm, and scene rotation live in each directory's `pet.json`; pets without overrides follow the hatch-pet contract rhythm and canonical single-track scene mapping (row order: 0 idle / 1 running-right / 2 running-left / 3 waving / 4 jumping / 5 failed / 6 waiting / 7 running / 8 review).
160
170
 
161
171
  ## License
162
172
 
package/README.zh.md CHANGED
@@ -23,8 +23,8 @@
23
23
  | 拖动 | 按住拖动宠物换位置;位置持久化 |
24
24
  | 隐藏/召唤 | 悬浮面板位于宠物下方(下方空间不足时上移到状态气泡之上)并提供 隐藏;隐藏后出现 召唤{name} 按钮 |
25
25
  | 妙语库 | 内置默认妙语库(每类事件 10 句)+ 宠物自定义台词;成功文案按持久化成功次数轮换,冷却文案按持久化拒绝次数轮换 |
26
- | 状态气泡 | 每个并行活动的顶层会话各自一个气泡,在宠物头顶堆叠(最多 12 个);子代理会话借由其发起会话体现,不占用独立气泡;点击气泡跳转到对应会话;瞬时互动反馈临时优先。气泡文案按场景准备了大量轮换词库(等待 / 思考 / 整理 / 完成 / 失败……),工具调用按工具族映射俏皮文案并带上真实参数(如 跑跑 npm test),同一场景持续数秒会自动换一种说法 |
27
- | 碎碎念 | 模型流式输出期间,宠物会偶尔用专属的紫粉色悄悄话气泡说出内心独白——由模型输出里的关键词触发对应心境(报错、测试全绿、做计划、打胜仗……),输出量累积也会换来日常碎碎念;有冷却节制,数秒后自动消散 |
26
+ | 状态气泡 | 默认只有最近活动的顶层会话说话——多会话并行时,其余会话收进主气泡右上角的 +N 角标,不再叠出一长列;悬停气泡(触屏点按角标)即可向上展开所有会话的气泡,点击任一气泡跳转到对应会话;子代理会话借由其发起会话体现,不占用独立气泡;瞬时互动反馈临时优先。气泡文案按场景准备了大量轮换词库(等待 / 思考 / 整理 / 完成 / 失败……),工具调用按工具族映射俏皮文案并带上真实参数(如 跑跑 npm test),同一场景持续数秒会自动换一种说法 |
27
+ | 碎碎念 | 模型流式输出期间,宠物会偶尔借自己的气泡说出内心独白——新鲜的碎碎念会接管展示会话的气泡并以「」引号标记——与状态气泡共用同一片 DeepSeek 蓝黑玻璃,气泡栈内颜色统一不再色差——不再叠出第二只气泡——由模型输出里的关键词触发对应心境(报错、测试全绿、做计划、打胜仗……),输出量累积也会换来日常碎碎念;有冷却节制,数秒后气泡恢复状态文案 |
28
28
  | 多会话活动 | 宠物是宿主全局的:最近一次有意义事件驱动精灵动画,同时每个活动的顶层会话用自己的气泡报告各自状态;每个会话(含子代理)完成的轮次都计入亲密度与小鱼干 |
29
29
 
30
30
  ## 宠物契约
@@ -67,6 +67,15 @@
67
67
 
68
68
  注册表在宿主启动时构建一次;新增或修改宠物后重启 `dsh web` 生效。
69
69
 
70
+ ## 内置宠物
71
+
72
+ | 注册表 id | 选择器名称 | 来源 |
73
+ |---|---|---|
74
+ | `whale-girl` | 鲸鱼娘(原版) | 仓库原有的鲸鱼娘图集 |
75
+ | `whale-girl-refined` | 鲸鱼娘(精致版) | 以鲸鱼娘设计方向为基础,经 AI 辅助二次创作、修复和细节精修的衍生版本 |
76
+
77
+ 精致版参考了 DreamSkin 的「DeepSeek-鲸鱼娘」主题。历史来源记录标注原主题作者为 `powerdog996`,并标注主题为 MIT:[DreamSkin](https://dreamskin.cc)、[仓库来源记录](https://github.com/zhu1090093659/dsh-web-ui/commit/87edd7ff4800dffd40bc93fb76e4ae450390facd)。此处用于记录素材来源与衍生关系;精致版不表述为原作者的官方作品,也不重新定义原始美术作品的授权范围。
78
+
70
79
  ## 动画预览
71
80
 
72
81
  精灵图是由 [hatch-pet](https://github.com/dsh2026) 流水线生成的 8 列 × 9 行图集(192×208 单元格);各状态预览:
@@ -101,7 +110,8 @@ dsh-pet/
101
110
  | |-- sequences.ts # 完整轨道场景序列计时
102
111
  | |-- spritesheet.ts # 图集几何辅助 + 轨道裁剪
103
112
  | `-- pet.module.css
104
- |-- assets/whale/ # 内置鲸鱼娘(pet.json + spritesheet.webp + 预览)
113
+ |-- assets/whale/ # 内置原版鲸鱼娘(manifest + 图集 + 预览)
114
+ |-- assets/whale-refined/ # 内置精致版鲸鱼娘注册表变体
105
115
  `-- cordis.patch.yml # bundle 补丁:插入宠物插件行
106
116
  ```
107
117
 
@@ -131,7 +141,7 @@ dsh-pet/
131
141
 
132
142
  ```sh
133
143
  ### 从 npm 安装(推荐)
134
- dsh plugin --profile web add @linxin666/dsh-pet
144
+ dsh plugin --profile web add @linxin666/dsh-pet@latest
135
145
 
136
146
  ### 从仓库安装(开发调试)
137
147
  git clone https://github.com/zhu1090093659/dsh-web-ui.git
@@ -156,7 +166,7 @@ pnpm typecheck # 仅类型检查
156
166
 
157
167
  ## 精灵图与动画轨道校准
158
168
 
159
- 内置鲸鱼娘图集由 hatch-pet 流水线生成,9 态 × 8 列:`assets/whale/spritesheet.webp`(1536×18728 列 × 9 行,192×208 单元格)+ `assets/whale/pet.json`。每行的帧数、节奏与场景轮换写在该 manifest 的 `frames`、`tracks` `sequences` 字段里;未覆盖的宠物沿用 hatch-pet 契约节奏和标准单轨场景映射。重做美术因此只需修改 `assets/whale/pet.json`(行序契约:0 idle / 1 running-right / 2 running-left / 3 waving / 4 jumping / 5 failed / 6 waiting / 7 running / 8 review)。
169
+ 两套内置鲸鱼娘图集使用同一份 9 态 × 8 列契约:`assets/whale/` 是原版,`assets/whale-refined/` 是精致版。每张图集均为 1536×18728 列 × 9 行,192×208 单元格)。每行帧数、节奏与场景轮换写在各目录的 `pet.json` 中;未覆盖的宠物沿用 hatch-pet 契约节奏和标准单轨场景映射(行序:0 idle / 1 running-right / 2 running-left / 3 waving / 4 jumping / 5 failed / 6 waiting / 7 running / 8 review)。
160
170
 
161
171
  ## 许可证
162
172
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "whale-girl",
3
- "displayName": "鲸鱼娘",
3
+ "displayName": "鲸鱼娘(原版)",
4
4
  "description": "一只软萌治愈的鲸鱼娘,来自深海的陪伴小伙伴。",
5
5
  "spritesheetPath": "spritesheet.webp",
6
6
  "frames": [6, 8, 8, 4, 5, 8, 6, 6, 6],
@@ -0,0 +1,7 @@
1
+ {
2
+ "id": "whale-girl-refined",
3
+ "displayName": "鲸鱼娘(精致版)",
4
+ "description": "基于鲸鱼娘形象进行 AI 辅助二次创作、修复与细节精修的内置变体。",
5
+ "spritesheetPath": "spritesheet.webp",
6
+ "frames": [6, 8, 8, 4, 5, 8, 6, 6, 6]
7
+ }