@linxin666/dsh-pet 0.4.3 → 0.4.5
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.i18n.yaml +2 -2
- package/README.md +18 -4
- package/README.zh.md +18 -4
- package/lib/client.js +176 -16
- package/lib/client.js.map +1 -1
- package/lib/index.js +91 -12
- package/lib/types/client/index.d.ts +2 -0
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +190 -26
- package/lib/types/index.d.ts +6 -2
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +99 -11
- package/lib/types/service.d.ts +9 -0
- package/lib/types/service.d.ts.map +1 -1
- package/lib/types/service.js +23 -3
- package/package.json +1 -1
- package/src/client/index.test.tsx +81 -3
- package/src/client/index.ts +194 -27
- package/src/index.test.ts +39 -0
- package/src/index.ts +122 -12
- package/src/registry.test.ts +11 -1
- package/src/service.ts +23 -3
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:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 2712e3414b9ef2a47a12fa9f8b27f28eb42383f3
|
|
6
|
+
README.zh.md: 7070355a66d6bc794d0d1ea400cebc3ac3d898a4
|
package/README.md
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
# dsh-pet
|
|
1
|
+
# dsh-pet · Desktop Pet Companion & Interactive Live2D Widget for DeepSeek Harness (DSH)
|
|
2
2
|
|
|
3
3
|
English | [中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://img.shields.io/npm/v/@linxin666/dsh-client-ui-pet?style=flat-square" alt="Version">
|
|
7
|
+
|
|
8
|
+
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.0--rc.2-4c6ef5?style=flat-square&labelColor=454a54" alt="DSH">
|
|
9
|
+
|
|
10
|
+
<img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
|
|
11
|
+
</p>
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
<p align="center">
|
|
14
|
+
<strong>Interactive Desktop Pet Companion & Live2D Widget for DeepSeek Harness (DSH)</strong><br>
|
|
15
|
+
<em>Agent State Tracking · Live2D & Sprite Pets · Interactive Feeding · Status Bubbles · DSH Workshop</em>
|
|
16
|
+
</p>
|
|
8
17
|
|
|
9
|
-
|
|
18
|
+
> A registry-driven desktop companion for DeepSeek Harness — featuring the built-in anime whale girl plus one-click installs for any custom Live2D or sprite pet from the Workshop.
|
|
19
|
+
|
|
20
|
+
While the AI model thinks, you wait — your desktop companion swims and interacts on screen. It dynamically tracks the official DeepSeek Harness session lifecycle, switching fluid animations during waiting, thinking, tool execution (Bash, code editing, web searches), reply generation, celebration on success, and alert on error; you can pat its head, feed it dried fish, and watch affinity grow. Pets are driven by an extensible asset registry rather than hard-coded logic: each pet consists of a `pet.json` manifest and an atlas image (or Live2D model pack), auto-discovered by the host at startup.
|
|
21
|
+
|
|
22
|
+
Re-engineered from desktop companion concepts into an official DSH cordis bundle (host backend + client frontend in a single integrated package).
|
|
10
23
|
|
|
11
24
|
## Features
|
|
12
25
|
|
|
@@ -209,6 +222,7 @@ Host-side sibling plugins can push one structured announcement through the `pet`
|
|
|
209
222
|
| `blue-throated-bee-eater` | 蓝喉蜂虎 | Companion art contributed by the repository contributor under Apache-2.0 (12 AI-illustrated pose references in the palette of the blue-throated-bee-eater skin; composed by docs/archive/blue-throated-bee-eater-pet/gen-pet.py with per-track standalone poses: perched, flight, front hover, waving, landing, droop, tilt, review; ship 小蜜蜂 as the treat name) |
|
|
210
223
|
| `doro` | doro | Frames2d gameplay pet (contributed by stushansusu under MIT): 11 tracks / 802 frames of 42 ms webp sequences — breathing idle, a work trio, sleep, a wash mode (mood +3/s), a four-direction crawl used by random roaming, three idle-director acts (cola / orange / tongue) and a drag-only struggle loop. Doro is an unofficial, fan-made derivative of Dorothy from *Goddess of Victory: Nikke*; the character and all related rights belong to SHIFT UP — personal non-commercial use only, unofficial and not affiliated with SHIFT UP (see THIRD_PARTY_NOTICES.md) |
|
|
211
224
|
| `jyn` | 女仆鲸鱼娘 | Frames2d gameplay pet (contributed by stushansusu under MIT): maid-whale desktop pet with work/sleep/touch gameplay and three selectable skins (暗夜鎏金 / 蓝海霓裳 / 冰晶公主), each with a probability-rolled click action; 暗夜鎏金 also swaps its own rest loop into the sleep gameplay |
|
|
225
|
+
| `jyn-foxtail` | 鲸鱼娘·狗尾巴草 | Frames2d gameplay pet (contributed by stushansusu under MIT): papercut whale-girl with thirteen 3.00 s frame tracks (idle, tease, eat, heart, face, work, work-success, work-fail, sleep, sleeping, snack, sneeze, yawn) carrying click, work, sleep and idle-director gameplay, plus one static webp cover per track under previews/ |
|
|
212
226
|
| `ouo-neko` | OUO Neko | Pink-sakura cat-eared companion contributed by `Pessimist0906` under MIT |
|
|
213
227
|
| `whale-girl` | 鲸鱼娘(原版) | The repository's original whale-girl atlas |
|
|
214
228
|
| `whale-girl-refined` | 鲸鱼娘(精致版) | An AI-assisted derivative with repaired and refined details, based on the whale-girl design direction |
|
package/README.zh.md
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
# dsh-pet
|
|
1
|
+
# dsh-pet · DeepSeek Harness (DSH) 桌面宠物伴侣与 Live2D 互动挂件插件
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://img.shields.io/npm/v/@linxin666/dsh-client-ui-pet?style=flat-square" alt="Version">
|
|
7
|
+
|
|
8
|
+
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.0--rc.2-4c6ef5?style=flat-square&labelColor=454a54" alt="DSH">
|
|
9
|
+
|
|
10
|
+
<img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
|
|
11
|
+
</p>
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
<p align="center">
|
|
14
|
+
<strong>DeepSeek Harness(DSH)官方 Web GUI 与桌面客户端专属桌面宠物伴侣生态</strong><br>
|
|
15
|
+
<em>智能体思考跟随 · Live2D / 精灵图桌宠 · 摸头喂食互动 · 实时状态气泡 · 创意工坊宠物下载</em>
|
|
16
|
+
</p>
|
|
8
17
|
|
|
9
|
-
|
|
18
|
+
> 一个注册表驱动的桌面宠物伴侣:内置萌系鲸鱼娘,同时支持从创意工坊一键下载安装任意 Live2D 与精灵图桌宠。
|
|
19
|
+
|
|
20
|
+
模型思考时你在等待,你的桌面宠物在屏幕上畅游交互。它深度跟随 DeepSeek Harness 官方智能体会话生命周期,在空闲等待、模型思考、调用工具(Bash / 代码编写 / 网页检索)、整理回复、庆祝完成与报告失败时自动无缝切换动画;你还可以随时摸摸头、喂食小鱼干互动,看着专属亲密度与等级不断提升。桌面宠物基于资产注册表驱动而不是硬编码:每只宠物只需一份 `pet.json` manifest 加一张贴图集(或 Live2D 动作模型包),宿主启动时自动发现并支持热切换。
|
|
21
|
+
|
|
22
|
+
从桌面应用的经典宠物系统重构演进,完美适配官方 DSH 插件形态(cordis bundle:host 宿主半区 + client 浏览器半区一站式融合)。
|
|
10
23
|
|
|
11
24
|
## 功能
|
|
12
25
|
|
|
@@ -209,6 +222,7 @@ frames2d 宠物可声明 `gameplay` 块——从 miku 桌宠泛化而来的可
|
|
|
209
222
|
| `blue-throated-bee-eater` | 蓝喉蜂虎 | 贡献者以 Apache-2.0 贡献的伙伴插画(12 张同角色 AI 立绘素材,配色取蓝喉蜂虎皮肤同源;由 docs/archive/blue-throated-bee-eater-pet/gen-pet.py 组装,各轨道独立姿态:栖枝/飞行/正面悬停/挥翅/降落/垂头/歪头/昂首;饲料以「小蜜蜂」命名) |
|
|
210
223
|
| `doro` | doro | 由 stushansusu 以 MIT 许可证贡献的 frames2d 玩法宠物:11 条轨道 / 802 帧 42ms webp 序列——呼吸待机、打工三件套、睡觉、洗澡模式(心情 +3/秒)、随机漫游用的四向爬行、三个待机小动作(cola / orange / tongue)与仅拖拽期间播放的挣扎循环。Doro 是《胜利女神:妮姬》桃乐丝的非官方同人二创/梗衍生形象,角色及相关权利归 SHIFT UP 所有——仅限个人非商业使用,与官方无隶属或背书关系(见 THIRD_PARTY_NOTICES.md)。 |
|
|
211
224
|
| `jyn` | 女仆鲸鱼娘 | frames2d 玩法宠物(stushansusu 以 MIT 贡献):带打工/睡觉/触摸玩法与三款可选皮肤(暗夜鎏金 / 蓝海霓裳 / 冰晶公主)的女仆鲸鱼同桌宠,每款皮肤各带一个概率掷骰点击动作;暗夜鎏金另将专属休息循环换入睡觉玩法 |
|
|
225
|
+
| `jyn-foxtail` | 鲸鱼娘·狗尾巴草 | 由 stushansusu 以 MIT 贡献的 frames2d 玩法宠物:剪纸风格的鲸鱼娘,13 条 3.00s 帧序列轨道(idle / tease / eat / heart / face / work / work-success / work-fail / sleep / sleeping / snack / sneeze / yawn),带点击、打工、睡觉与四个待机小动作玩法;previews/ 下每条轨道一张静态 webp 封面 |
|
|
212
226
|
| `ouo-neko` | OUO Neko | `Pessimist0906` 以 MIT 许可证贡献的粉色樱花猫耳伙伴 |
|
|
213
227
|
| `whale-girl` | 鲸鱼娘(原版) | 仓库原有的鲸鱼娘图集 |
|
|
214
228
|
| `whale-girl-refined` | 鲸鱼娘(精致版) | 以鲸鱼娘设计方向为基础,经 AI 辅助二次创作、修复和细节精修的衍生版本 |
|
package/lib/client.js
CHANGED
|
@@ -4132,7 +4132,7 @@ window.__ModuleLoader__.load({
|
|
|
4132
4132
|
/** The building package's version, when the bundle carries it. */
|
|
4133
4133
|
function bakedVersion() {
|
|
4134
4134
|
try {
|
|
4135
|
-
return "0.4.
|
|
4135
|
+
return "0.4.5";
|
|
4136
4136
|
} catch {
|
|
4137
4137
|
return;
|
|
4138
4138
|
}
|
|
@@ -4240,22 +4240,180 @@ window.__ModuleLoader__.load({
|
|
|
4240
4240
|
"ui-pet",
|
|
4241
4241
|
PET_SETTINGS_NS
|
|
4242
4242
|
];
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4243
|
+
/** How long the deferred form keeps retrying before it settles on the fallback. */
|
|
4244
|
+
const BINDER_RETRY_MS = 250;
|
|
4245
|
+
const BINDER_ATTEMPTS = 24;
|
|
4246
|
+
/** The snapshot an unresolved (or resolvable-but-unbound) form publishes. */
|
|
4247
|
+
function pendingSnapshot(status) {
|
|
4248
|
+
return {
|
|
4249
|
+
status,
|
|
4250
|
+
value: void 0,
|
|
4251
|
+
base: void 0,
|
|
4252
|
+
user: void 0,
|
|
4253
|
+
revision: void 0,
|
|
4254
|
+
writable: false,
|
|
4255
|
+
mode: "host"
|
|
4256
|
+
};
|
|
4257
4257
|
}
|
|
4258
4258
|
/**
|
|
4259
|
+
* A ConfigForm that late-binds to the family settings binder.
|
|
4260
|
+
*
|
|
4261
|
+
* The binder service (dsh-web-settings) is not guaranteed to be published by the
|
|
4262
|
+
* time this plugin's apply() runs: the aggregate bundle mounts its inlined
|
|
4263
|
+
* children — including the binder — inside an async mount that awaits the
|
|
4264
|
+
* active-rows fetch, while standalone loader entries like this one apply
|
|
4265
|
+
* synchronously in that window. A single early probe then permanently falls
|
|
4266
|
+
* back to `configForms.get('pet')`, which is never a served row id under the
|
|
4267
|
+
* aggregate (the row is `web-ui-pet`), so the settings card renders "not
|
|
4268
|
+
* exposed" forever even though the Host serves the namespace.
|
|
4269
|
+
*
|
|
4270
|
+
* This form resolves through the binder as soon as the service appears and
|
|
4271
|
+
* delegates the whole ConfigForm surface to it, re-publishing to its own
|
|
4272
|
+
* subscribers on every swap. Until a form is resolved it publishes a loading
|
|
4273
|
+
* (then unavailable) snapshot so the card shows a transient state, never a
|
|
4274
|
+
* false "not exposed". If the binder never appears it retries for a bounded
|
|
4275
|
+
* window, then permanently binds the non-bridge fallback by SERVED entry id.
|
|
4276
|
+
*/
|
|
4277
|
+
var DeferredSettingsForm = class {
|
|
4278
|
+
ctx;
|
|
4279
|
+
current;
|
|
4280
|
+
listeners = /* @__PURE__ */ new Set();
|
|
4281
|
+
unsubscribeCurrent;
|
|
4282
|
+
retryTimer;
|
|
4283
|
+
attempts = 0;
|
|
4284
|
+
disposed = false;
|
|
4285
|
+
fallback;
|
|
4286
|
+
fallbackUnsubscribe;
|
|
4287
|
+
constructor(ctx) {
|
|
4288
|
+
this.ctx = ctx;
|
|
4289
|
+
this.fallback = ctx.configForms.get(this.resolveFallbackEntryId());
|
|
4290
|
+
if (!this.resolve() && !this.fallbackSettled()) this.scheduleRetry();
|
|
4291
|
+
else if (this.current === void 0) this.adoptFallback();
|
|
4292
|
+
}
|
|
4293
|
+
/**
|
|
4294
|
+
* True while the shared mirror reports the pet namespace unavailable — the
|
|
4295
|
+
* only state in which waiting can still help. A fallback that is ready (or
|
|
4296
|
+
* merely loading, which the mirror fills in on its own) is adopted at once.
|
|
4297
|
+
*/
|
|
4298
|
+
fallbackSettled() {
|
|
4299
|
+
try {
|
|
4300
|
+
return this.fallback.getSnapshot().status !== "unavailable";
|
|
4301
|
+
} catch {
|
|
4302
|
+
return false;
|
|
4303
|
+
}
|
|
4304
|
+
}
|
|
4305
|
+
/**
|
|
4306
|
+
* Bind the fallback to a SERVED row id when the mirror can name one; a mirror
|
|
4307
|
+
* that cannot is left to report its own unavailable state.
|
|
4308
|
+
*/
|
|
4309
|
+
resolveFallbackEntryId() {
|
|
4310
|
+
try {
|
|
4311
|
+
const served = this.ctx.configForms.describe().getSnapshot().view?.namespaces.map((view) => view.ns);
|
|
4312
|
+
if (served && served.length > 0) {
|
|
4313
|
+
const hit = PET_ENTRY_IDS.find((id) => served.includes(id));
|
|
4314
|
+
if (hit !== void 0) return hit;
|
|
4315
|
+
}
|
|
4316
|
+
} catch {}
|
|
4317
|
+
return PET_SETTINGS_NS;
|
|
4318
|
+
}
|
|
4319
|
+
/**
|
|
4320
|
+
* Adopt the family binder the moment it is published.
|
|
4321
|
+
* @returns true when a binder was bound, false when none is available yet.
|
|
4322
|
+
*/
|
|
4323
|
+
resolve() {
|
|
4324
|
+
if (this.disposed) return false;
|
|
4325
|
+
let binder;
|
|
4326
|
+
try {
|
|
4327
|
+
binder = this.ctx.get("webUiSettings");
|
|
4328
|
+
} catch {
|
|
4329
|
+
binder = void 0;
|
|
4330
|
+
}
|
|
4331
|
+
if (binder === void 0 || typeof binder.bind !== "function") return false;
|
|
4332
|
+
let bound;
|
|
4333
|
+
try {
|
|
4334
|
+
bound = binder.bind({ namespace: PET_SETTINGS_NS });
|
|
4335
|
+
} catch {
|
|
4336
|
+
return false;
|
|
4337
|
+
}
|
|
4338
|
+
this.current = bound;
|
|
4339
|
+
this.unsubscribeCurrent?.();
|
|
4340
|
+
this.unsubscribeCurrent = bound.subscribe(() => this.publish());
|
|
4341
|
+
this.publish();
|
|
4342
|
+
return true;
|
|
4343
|
+
}
|
|
4344
|
+
/**
|
|
4345
|
+
* Adopt the shared per-entry form. It is used immediately unless it reports
|
|
4346
|
+
* the namespace unavailable, in which case the binder may still be on its way
|
|
4347
|
+
* and the retry window takes over (see scheduleRetry).
|
|
4348
|
+
*/
|
|
4349
|
+
adoptFallback() {
|
|
4350
|
+
this.current = this.fallback;
|
|
4351
|
+
this.fallbackUnsubscribe ??= this.fallback.subscribe(() => this.publish());
|
|
4352
|
+
this.unsubscribeCurrent = this.fallbackUnsubscribe;
|
|
4353
|
+
this.publish();
|
|
4354
|
+
}
|
|
4355
|
+
/** Retry the binder lookup a few times across the aggregate's async mount. */
|
|
4356
|
+
scheduleRetry() {
|
|
4357
|
+
if (this.disposed) return;
|
|
4358
|
+
if (this.attempts >= BINDER_ATTEMPTS) {
|
|
4359
|
+
this.adoptFallback();
|
|
4360
|
+
return;
|
|
4361
|
+
}
|
|
4362
|
+
this.attempts += 1;
|
|
4363
|
+
this.retryTimer = window.setTimeout(() => {
|
|
4364
|
+
this.retryTimer = void 0;
|
|
4365
|
+
if (this.disposed) return;
|
|
4366
|
+
if (this.resolve()) return;
|
|
4367
|
+
if (this.fallbackSettled()) {
|
|
4368
|
+
this.attempts = BINDER_ATTEMPTS;
|
|
4369
|
+
this.adoptFallback();
|
|
4370
|
+
return;
|
|
4371
|
+
}
|
|
4372
|
+
this.scheduleRetry();
|
|
4373
|
+
}, 250);
|
|
4374
|
+
}
|
|
4375
|
+
publish() {
|
|
4376
|
+
for (const listener of this.listeners) listener();
|
|
4377
|
+
}
|
|
4378
|
+
/** The resolved form, or a placeholder snapshot when still pending. */
|
|
4379
|
+
snapshot() {
|
|
4380
|
+
return this.current?.getSnapshot() ?? pendingSnapshot(this.attempts >= BINDER_ATTEMPTS ? "unavailable" : "loading");
|
|
4381
|
+
}
|
|
4382
|
+
getSnapshot() {
|
|
4383
|
+
return this.snapshot();
|
|
4384
|
+
}
|
|
4385
|
+
subscribe(listener) {
|
|
4386
|
+
this.listeners.add(listener);
|
|
4387
|
+
return () => {
|
|
4388
|
+
this.listeners.delete(listener);
|
|
4389
|
+
};
|
|
4390
|
+
}
|
|
4391
|
+
mutate(ops, expectedRevision) {
|
|
4392
|
+
return this.current?.mutate(ops, expectedRevision) ?? Promise.resolve(false);
|
|
4393
|
+
}
|
|
4394
|
+
set(field, value) {
|
|
4395
|
+
return this.current?.set(field, value) ?? Promise.resolve(false);
|
|
4396
|
+
}
|
|
4397
|
+
unset(field) {
|
|
4398
|
+
return this.current?.unset(field) ?? Promise.resolve(false);
|
|
4399
|
+
}
|
|
4400
|
+
/** Release the retry timer and mirror subscription; not part of ConfigForm. */
|
|
4401
|
+
dispose() {
|
|
4402
|
+
if (this.disposed) return;
|
|
4403
|
+
this.disposed = true;
|
|
4404
|
+
if (this.retryTimer !== void 0) {
|
|
4405
|
+
window.clearTimeout(this.retryTimer);
|
|
4406
|
+
this.retryTimer = void 0;
|
|
4407
|
+
}
|
|
4408
|
+
this.unsubscribeCurrent?.();
|
|
4409
|
+
this.unsubscribeCurrent = void 0;
|
|
4410
|
+
this.current = void 0;
|
|
4411
|
+
this.listeners.clear();
|
|
4412
|
+
this.fallbackUnsubscribe?.();
|
|
4413
|
+
this.fallbackUnsubscribe = void 0;
|
|
4414
|
+
}
|
|
4415
|
+
};
|
|
4416
|
+
/**
|
|
4259
4417
|
* Client plugin body: register dictionaries, mount the global pet entry and
|
|
4260
4418
|
* poll loop while the plugin is enabled, and seat the settings card as a
|
|
4261
4419
|
* first-level settings section.
|
|
@@ -4286,7 +4444,7 @@ window.__ModuleLoader__.load({
|
|
|
4286
4444
|
}, "pet: dictionaries");
|
|
4287
4445
|
defaultPetRendererRegistry.register(live2dRenderer);
|
|
4288
4446
|
defaultPetRendererRegistry.register(frames2dRenderer);
|
|
4289
|
-
const settingsForm =
|
|
4447
|
+
const settingsForm = new DeferredSettingsForm(ctx);
|
|
4290
4448
|
const enabled = () => {
|
|
4291
4449
|
const snapshot = settingsForm.getSnapshot();
|
|
4292
4450
|
return snapshot.status === "ready" ? snapshot.value?.enabled ?? true : snapshot.status === "unavailable";
|
|
@@ -4484,11 +4642,13 @@ window.__ModuleLoader__.load({
|
|
|
4484
4642
|
const unsubscribeSettings = settingsForm.subscribe(syncUi);
|
|
4485
4643
|
ctx.effect(() => () => {
|
|
4486
4644
|
unsubscribeSettings();
|
|
4645
|
+
settingsForm.dispose();
|
|
4487
4646
|
killUi();
|
|
4488
4647
|
}, "pet: client lifecycle");
|
|
4489
4648
|
syncUi();
|
|
4490
4649
|
}
|
|
4491
4650
|
//#endregion
|
|
4651
|
+
exports.BINDER_RETRY_MS = BINDER_RETRY_MS;
|
|
4492
4652
|
exports.apply = apply;
|
|
4493
4653
|
exports.inject = inject;
|
|
4494
4654
|
return module.exports;
|