@linxin666/dsh-pet 0.2.1 → 0.2.3
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 +78 -5
- package/README.zh.md +78 -5
- package/assets/whale/pet.json +170 -21
- package/assets/whale-refined/pet.json +22 -0
- package/assets/whale-refined/spritesheet.webp +0 -0
- package/lib/client.js +442 -25
- package/lib/client.js.map +1 -1
- package/lib/index.js +752 -36
- package/lib/live2d-vendor.js +995 -0
- package/lib/live2d-vendor.js.map +1 -0
- package/lib/types/client/PetDockEntry.d.ts.map +1 -1
- package/lib/types/client/PetDockEntry.js +2 -1
- package/lib/types/client/PetSettingsCard.d.ts +10 -0
- package/lib/types/client/PetSettingsCard.d.ts.map +1 -1
- package/lib/types/client/PetSettingsCard.js +22 -1
- package/lib/types/client/PetSprite.d.ts +7 -1
- package/lib/types/client/PetSprite.d.ts.map +1 -1
- package/lib/types/client/PetSprite.js +20 -11
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +5 -0
- package/lib/types/client/locales.d.ts +10 -0
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/locales.js +10 -0
- package/lib/types/client/phase-stream.d.ts +22 -0
- package/lib/types/client/phase-stream.d.ts.map +1 -0
- package/lib/types/client/phase-stream.js +28 -0
- package/lib/types/client/renderers/PetRendererSwitch.d.ts +25 -0
- package/lib/types/client/renderers/PetRendererSwitch.d.ts.map +1 -0
- package/lib/types/client/renderers/PetRendererSwitch.js +24 -0
- package/lib/types/client/renderers/live2d/Live2dVisualMount.d.ts +22 -0
- package/lib/types/client/renderers/live2d/Live2dVisualMount.d.ts.map +1 -0
- package/lib/types/client/renderers/live2d/Live2dVisualMount.js +75 -0
- package/lib/types/client/renderers/live2d/runtime.d.ts +89 -0
- package/lib/types/client/renderers/live2d/runtime.d.ts.map +1 -0
- package/lib/types/client/renderers/live2d/runtime.js +63 -0
- package/lib/types/client/renderers/live2d/vendor-entry.d.ts +15 -0
- package/lib/types/client/renderers/live2d/vendor-entry.d.ts.map +1 -0
- package/lib/types/client/renderers/live2d/vendor-entry.js +14 -0
- package/lib/types/client/renderers/live2d.d.ts +52 -0
- package/lib/types/client/renderers/live2d.d.ts.map +1 -0
- package/lib/types/client/renderers/live2d.js +180 -0
- package/lib/types/client/renderers/registry.d.ts +32 -0
- package/lib/types/client/renderers/registry.d.ts.map +1 -0
- package/lib/types/client/renderers/registry.js +49 -0
- package/lib/types/client/spritesheet.d.ts +1 -3
- package/lib/types/client/spritesheet.d.ts.map +1 -1
- package/lib/types/client/spritesheet.js +1 -5
- package/lib/types/contracts/renderer.d.ts +50 -0
- package/lib/types/contracts/renderer.d.ts.map +1 -0
- package/lib/types/contracts/renderer.js +15 -0
- package/lib/types/manifest-v2.d.ts +129 -0
- package/lib/types/manifest-v2.d.ts.map +1 -0
- package/lib/types/manifest-v2.js +387 -0
- package/lib/types/model3.d.ts +26 -0
- package/lib/types/model3.d.ts.map +1 -0
- package/lib/types/model3.js +96 -0
- package/lib/types/registry.d.ts +57 -5
- package/lib/types/registry.d.ts.map +1 -1
- package/lib/types/registry.js +208 -37
- package/lib/types/routes.d.ts +39 -2
- package/lib/types/routes.d.ts.map +1 -1
- package/lib/types/routes.js +183 -12
- package/lib/types/service.d.ts +5 -1
- package/lib/types/service.d.ts.map +1 -1
- package/lib/types/service.js +4 -0
- package/package.json +3 -2
- package/src/client/PetDockEntry.tsx +19 -11
- package/src/client/PetSettingsCard.tsx +39 -0
- package/src/client/PetSprite.test.tsx +11 -0
- package/src/client/PetSprite.tsx +27 -12
- package/src/client/index.ts +6 -0
- package/src/client/locales.ts +10 -0
- package/src/client/phase-stream.test.ts +76 -0
- package/src/client/phase-stream.ts +39 -0
- package/src/client/renderers/PetRendererSwitch.test.tsx +66 -0
- package/src/client/renderers/PetRendererSwitch.tsx +48 -0
- package/src/client/renderers/live2d/Live2dVisualMount.tsx +98 -0
- package/src/client/renderers/live2d/runtime.test.ts +61 -0
- package/src/client/renderers/live2d/runtime.ts +119 -0
- package/src/client/renderers/live2d/vendor-entry.ts +14 -0
- package/src/client/renderers/live2d.test.ts +242 -0
- package/src/client/renderers/live2d.ts +218 -0
- package/src/client/renderers/registry.ts +58 -0
- package/src/client/settings-section.module.css +23 -0
- package/src/client/spritesheet.ts +1 -6
- package/src/contracts/renderer.ts +54 -0
- package/src/manifest-v2.test.ts +251 -0
- package/src/manifest-v2.ts +414 -0
- package/src/model3.test.ts +79 -0
- package/src/model3.ts +91 -0
- package/src/registry.test.ts +236 -3
- package/src/registry.ts +246 -38
- package/src/routes.ts +202 -13
- package/src/service.ts +6 -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:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 9470df0da7fc9b8cdf0c3816d792a842f17a769c
|
|
6
|
+
README.zh.md: 76fa58171d7c49d04da4e6663d7010e6662408e4
|
package/README.md
CHANGED
|
@@ -59,13 +59,77 @@ A pet is a directory holding one `pet.json` manifest and one atlas image. Nothin
|
|
|
59
59
|
- `frames` counts the used columns per row (defaults to the hatch-pet contract table `[6, 8, 8, 4, 5, 8, 6, 6, 6]`); `tracks` overrides per-frame durations (cycled to the row's frame count), `loop`, and `fallback` per animation (defaults: everything loops; `jumping` and `failed` hold their last frame, then fall back to `idle`).
|
|
60
60
|
- `sequences` optionally maps activity scenes (`idle` / `waiting` / `thinking` / `tool` / `review` / `done` / `failed`) to at least 5 animation tracks. Each item plays every frame for the durations in `tracks`, then the next item starts; the complete sequence loops. An omitted scene keeps its canonical single-track playback.
|
|
61
61
|
|
|
62
|
+
### Manifest v2 (pet center, #623)
|
|
63
|
+
|
|
64
|
+
A pet directory's `pet.json` declares its renderer explicitly in v2:
|
|
65
|
+
|
|
66
|
+
- `petManifestVersion: 2` (absent = v1, compat-read as `sprite2d` with a migration hint);
|
|
67
|
+
- `renderer`: `"sprite2d"` (the atlas contract above) or `"live2d"`;
|
|
68
|
+
- `license` (required in v2): asset license identifier — community pets carry provenance;
|
|
69
|
+
- a renderer block: `sprite2d` (spritesheetPath/cell/columns/atlasRows/frames/tracks) or `live2d` (model/motions/expressions/hitAreas/scale/translate).
|
|
70
|
+
|
|
71
|
+
Validation is fail-closed on structure (unknown fields or renderer kinds reject the entry with a diagnostic) and warn-and-drop on sequence/remark content. The machine-readable schema lives at `contracts/pet-manifest-v2.schema.json`; the authoritative validator is `src/manifest-v2.ts`. Migrate v1 manifests with `node scripts/dsh-pet-migrate-v2.mjs <dir> --write` (dry-run by default; keeps `pet.json.v1.bak`).
|
|
72
|
+
|
|
62
73
|
Where pets come from (later sources override earlier ones on id collision):
|
|
63
74
|
|
|
64
75
|
1. **Built-in**: `assets/<dir>/pet.json` in this package.
|
|
65
|
-
2. **
|
|
66
|
-
3. **
|
|
76
|
+
2. **Legacy custom pets**: `${CODEX_HOME:-~/.codex}/pets/<pet>/pet.json` — the hatch-pet pipeline stages its output there, so a hatched pet appears in the selector with no further wiring.
|
|
77
|
+
3. **Pet-center user directory**: `$DSH_HOME/pets/<id>/` — the recommended home for your pets (see the CLI below).
|
|
78
|
+
4. **Composed**: `PetConfig.pets` manifest entries passed to the plugin by the embedding application.
|
|
79
|
+
|
|
80
|
+
Validate and install a pet directory with the CLI (no build step, no npm publish):
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
node scripts/dsh-pet validate <dir> # manifest + assets + Live2D reference closure
|
|
84
|
+
node scripts/dsh-pet install <dir> # validate, then copy into $DSH_HOME/pets/<id>/
|
|
85
|
+
node scripts/dsh-pet install <dir> --force # overwrite an existing same-id install
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Invalid entries never override a working pet: they are skipped with a diagnostic listed in the settings (Pet section). The registry is built once at host startup; add or change a pet, then restart `dsh web`.
|
|
89
|
+
|
|
90
|
+
## Live2D pets (renderer: live2d)
|
|
91
|
+
|
|
92
|
+
Live2D pets render through PixiJS/WebGL: the MIT pixi.js + untitled-pixi-live2d-engine stack ships inside this plugin as a lazily loaded vendor bundle, so sprite-only installations never download or parse it. **The Cubism Core runtime is never bundled or downloaded by this plugin** — Live2D's proprietary license forbids redistributing it. To enable a Live2D pet:
|
|
93
|
+
|
|
94
|
+
1. Obtain the official Live2D Cubism SDK for Web yourself (you accept Live2D's license) and take `live2dcubismcore.min.js` from it.
|
|
95
|
+
2. Place it at `$DSH_HOME/pets/.runtime/live2dcubismcore.min.js` — the plugin serves it to the page from there, alongside its own vendor bundle.
|
|
96
|
+
3. Install a Live2D pet (a directory with `pet.json` v2, `renderer: "live2d"`, and the model files).
|
|
97
|
+
|
|
98
|
+
If the core is absent, a Live2D pet shows an install-guidance card where the model would render; sprite2d pets are unaffected. Legal note: this plugin is an "extensible application" in Live2D's terms — works you publish with user-loadable models may require a Live2D release license regardless of scale; evaluate your obligations before publishing derivative works.
|
|
67
99
|
|
|
68
|
-
|
|
100
|
+
A Live2D manifest maps the seven activity phases onto the model's motion groups:
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"petManifestVersion": 2,
|
|
105
|
+
"id": "my-live2d-pet",
|
|
106
|
+
"displayName": "My Live2D Pet",
|
|
107
|
+
"license": "CC0-1.0",
|
|
108
|
+
"renderer": "live2d",
|
|
109
|
+
"live2d": {
|
|
110
|
+
"model": "model/my-pet.model3.json",
|
|
111
|
+
"motions": { "idle": "Idle", "thinking": "Think", "failed": "TapBody" },
|
|
112
|
+
"hitAreas": ["Body"]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
- `model`: the `.model3.json` path relative to the pet directory. Every file the model references (moc, textures, motions, physics, pose, expressions) must live inside the directory — the host serves exactly that reference closure.
|
|
118
|
+
- `motions` (required, `idle` mandatory): phase → motion group. Unmapped phases and groups the model lacks fall back to `idle`; a group holding several motions plays a random one. The official Cubism sample models ship only `Idle` and `TapBody` groups.
|
|
119
|
+
- `expressions` (optional): phase → expression name, layered over the motion.
|
|
120
|
+
- `hitAreas` (optional): a tap landing on a listed hit area plays the model's `TapBody` group, then returns to the phase's group. Every tap still counts as petting — the chrome owns interactions exactly like sprite2d.
|
|
121
|
+
- `scale` / `translate` (optional): the model auto-fits the display box; `scale` multiplies the fit (default 1, range (0, 10]) and `translate` offsets it in px from the center.
|
|
122
|
+
|
|
123
|
+
Model licensing: the official Live2D sample models (Hiyori, Haru, and friends) are evaluation-only and must not be redistributed — ship only models you have rights to (original creations or permissively licensed ones).
|
|
124
|
+
|
|
125
|
+
## Built-in pets
|
|
126
|
+
|
|
127
|
+
| Registry id | Selector label | Source |
|
|
128
|
+
|---|---|---|
|
|
129
|
+
| `whale-girl` | 鲸鱼娘(原版) | The repository's original whale-girl atlas |
|
|
130
|
+
| `whale-girl-refined` | 鲸鱼娘(精致版) | An AI-assisted derivative with repaired and refined details, based on the whale-girl design direction |
|
|
131
|
+
|
|
132
|
+
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.
|
|
69
133
|
|
|
70
134
|
## Animation preview
|
|
71
135
|
|
|
@@ -101,7 +165,8 @@ dsh-pet/
|
|
|
101
165
|
| |-- sequences.ts # full-track scene sequence timing
|
|
102
166
|
| |-- spritesheet.ts # atlas geometry helpers + track trimming
|
|
103
167
|
| `-- pet.module.css
|
|
104
|
-
|-- assets/whale/ # built-in whale-girl (
|
|
168
|
+
|-- assets/whale/ # built-in original whale-girl (manifest + atlas + previews)
|
|
169
|
+
|-- assets/whale-refined/ # built-in refined whale-girl registry variant
|
|
105
170
|
`-- cordis.patch.yml # bundle patch: inserts the pet plugin row
|
|
106
171
|
```
|
|
107
172
|
|
|
@@ -156,7 +221,15 @@ The browser bundle rides the `window.__ModuleLoader__.load` contract; React/cord
|
|
|
156
221
|
|
|
157
222
|
## Sprites and animation-track calibration
|
|
158
223
|
|
|
159
|
-
The built-in whale-girl
|
|
224
|
+
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).
|
|
225
|
+
|
|
226
|
+
## Security model
|
|
227
|
+
|
|
228
|
+
- All pet API and asset routes are fenced to loopback clients.
|
|
229
|
+
- Asset serving resolves both the pet directory and the candidate file through `realpath`; symlink escapes are refused (403). Files are size-capped before being read into memory (manifest 64 KB, imagery 20 MB; over-cap answers 413).
|
|
230
|
+
- Live2D models are served by closure: only the manifest, the declared primary assets, and the files the `.model3.json` references (each screened against traversal, absolute and URL forms).
|
|
231
|
+
- The plugin never downloads executables and never bundles the Live2D Cubism Core.
|
|
232
|
+
- Manifests are fail-closed on structure: unknown fields or renderers reject the entry with a diagnostic shown in settings.
|
|
160
233
|
|
|
161
234
|
## License
|
|
162
235
|
|
package/README.zh.md
CHANGED
|
@@ -59,13 +59,77 @@
|
|
|
59
59
|
- `frames` 记录每行用到的列数(缺省按 hatch-pet 契约表 `[6, 8, 8, 4, 5, 8, 6, 6, 6]`);`tracks` 按动画覆盖每帧时长(按该行帧数循环补足)、`loop` 与 `fallback`(默认:全部循环;`jumping` 与 `failed` 停在最后一帧后回到 `idle`)。
|
|
60
60
|
- `sequences` 可选地把活动场景(`idle` / `waiting` / `thinking` / `tool` / `review` / `done` / `failed`)映射到至少 5 条动画轨道。每项按 `tracks` 中的时长播完所有帧后进入下一项,整条序列循环;未声明的场景保持标准单轨播放。
|
|
61
61
|
|
|
62
|
+
### 清单 v2(宠物中心,#623)
|
|
63
|
+
|
|
64
|
+
宠物目录的 `pet.json` 在 v2 中显式声明渲染器:
|
|
65
|
+
|
|
66
|
+
- `petManifestVersion: 2`(缺省 = v1,按 `sprite2d` 兼容读并给出迁移提示);
|
|
67
|
+
- `renderer`:`"sprite2d"`(上文图集契约)或 `"live2d"`;
|
|
68
|
+
- `license`(v2 必填):资产授权标识——社区宠物必须携带来源声明;
|
|
69
|
+
- 渲染器专属块:`sprite2d`(spritesheetPath/cell/columns/atlasRows/frames/tracks)或 `live2d`(model/motions/expressions/hitAreas/scale/translate)。
|
|
70
|
+
|
|
71
|
+
校验纪律:结构 fail-closed(未知字段或未知渲染器直接拒载并给出诊断),sequences/remarks 内容维持 warn-and-drop。机器可读 schema 见 `contracts/pet-manifest-v2.schema.json`,权威校验器为 `src/manifest-v2.ts`。迁移 v1 清单:`node scripts/dsh-pet-migrate-v2.mjs <dir> --write`(默认 dry-run;保留 `pet.json.v1.bak`)。
|
|
72
|
+
|
|
62
73
|
宠物的来源(后注册的来源在同 id 冲突时覆盖前者):
|
|
63
74
|
|
|
64
75
|
1. **内置**:本包 `assets/<dir>/pet.json`。
|
|
65
|
-
2.
|
|
66
|
-
3.
|
|
76
|
+
2. **legacy 自定义宠物**:`${CODEX_HOME:-~/.codex}/pets/<pet>/pet.json` —— hatch-pet 流水线把产物放在这里,孵化的宠物无需任何接线即可出现在选择器里。
|
|
77
|
+
3. **宠物中心用户目录**:`$DSH_HOME/pets/<id>/`——推荐安放位(见下方 CLI)。
|
|
78
|
+
4. **组合注入**:嵌入应用通过 `PetConfig.pets` 传入的 manifest 条目。
|
|
79
|
+
|
|
80
|
+
用 CLI 校验并安装宠物目录(零构建、零发布):
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
node scripts/dsh-pet validate <dir> # 清单 + 资产 + Live2D 引用闭包
|
|
84
|
+
node scripts/dsh-pet install <dir> # 校验通过后拷入 $DSH_HOME/pets/<id>/
|
|
85
|
+
node scripts/dsh-pet install <dir> --force # 覆盖同名已安装宠物
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
非法条目永不覆盖可用宠物:它们被跳过并在设置(宠物栏目)给出诊断。注册表在宿主启动时构建一次;新增或修改宠物后重启 `dsh web` 生效。
|
|
89
|
+
|
|
90
|
+
## Live2D 宠物(renderer: live2d)
|
|
91
|
+
|
|
92
|
+
Live2D 宠物经 PixiJS/WebGL 渲染:MIT 许可的 pixi.js + untitled-pixi-live2d-engine 栈以按需加载的 vendor 分包随插件内置,纯 sprite 用户永不下载、永不解析它。**本插件永不内置、永不代下 Cubism Core 运行时**——Live2D 专有许可不允许再分发。启用 Live2D 宠物:
|
|
93
|
+
|
|
94
|
+
1. 自行从 Live2D 官方渠道获取 Cubism SDK for Web(你自行同意其许可),取得 `live2dcubismcore.min.js`;
|
|
95
|
+
2. 放到 `$DSH_HOME/pets/.runtime/live2dcubismcore.min.js`——插件把它连同自带的 vendor 分包一起提供给页面;
|
|
96
|
+
3. 安装 Live2D 宠物(含 `pet.json` v2、`renderer: "live2d"` 与模型文件的目录)。
|
|
97
|
+
|
|
98
|
+
core 缺失时,Live2D 宠物在渲染位置给出安装指引卡;sprite2d 宠物不受影响。法律提示:本插件属 Live2D 术语下的「可扩展性 APP」——你公开发布基于可加载用户模型的衍生作品时,可能不论规模都须与 Live2D 签订发行许可;发布前请自行评估义务。
|
|
67
99
|
|
|
68
|
-
|
|
100
|
+
Live2D 清单把七个活动相位映射到模型的动作组:
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"petManifestVersion": 2,
|
|
105
|
+
"id": "my-live2d-pet",
|
|
106
|
+
"displayName": "My Live2D Pet",
|
|
107
|
+
"license": "CC0-1.0",
|
|
108
|
+
"renderer": "live2d",
|
|
109
|
+
"live2d": {
|
|
110
|
+
"model": "model/my-pet.model3.json",
|
|
111
|
+
"motions": { "idle": "Idle", "thinking": "Think", "failed": "TapBody" },
|
|
112
|
+
"hitAreas": ["Body"]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
- `model`:相对宠物目录的 `.model3.json` 路径。模型引用的一切文件(moc、贴图、动作、物理、姿态、表情)都必须放在目录内——宿主恰好只服务这个引用闭包。
|
|
118
|
+
- `motions`(必填,且必须含 `idle`):相位 → 动作组。未映射的相位与模型缺失的组一律回退 `idle`;组内有多条动作时随机播放一条。官方 Cubism 示例模型只带 `Idle` 与 `TapBody` 两个组。
|
|
119
|
+
- `expressions`(可选):相位 → 表情名,叠加在动作之上。
|
|
120
|
+
- `hitAreas`(可选):点击落在列出的命中区时播放模型的 `TapBody` 组,播完回到当前相位的动作组。任何点击仍计入摸头——交互经济与 sprite2d 一样由 chrome 掌管。
|
|
121
|
+
- `scale` / `translate`(可选):模型自动适配显示盒;`scale` 在适配结果上乘算(默认 1,范围 (0, 10]),`translate` 以中心为基准做像素偏移。
|
|
122
|
+
|
|
123
|
+
模型授权:Live2D 官方示例模型(Hiyori、Haru 等)仅供评估、禁止再分发——只发布你有权的模型(原创作品或宽松授权的模型)。
|
|
124
|
+
|
|
125
|
+
## 内置宠物
|
|
126
|
+
|
|
127
|
+
| 注册表 id | 选择器名称 | 来源 |
|
|
128
|
+
|---|---|---|
|
|
129
|
+
| `whale-girl` | 鲸鱼娘(原版) | 仓库原有的鲸鱼娘图集 |
|
|
130
|
+
| `whale-girl-refined` | 鲸鱼娘(精致版) | 以鲸鱼娘设计方向为基础,经 AI 辅助二次创作、修复和细节精修的衍生版本 |
|
|
131
|
+
|
|
132
|
+
精致版参考了 DreamSkin 的「DeepSeek-鲸鱼娘」主题。历史来源记录标注原主题作者为 `powerdog996`,并标注主题为 MIT:[DreamSkin](https://dreamskin.cc)、[仓库来源记录](https://github.com/zhu1090093659/dsh-web-ui/commit/87edd7ff4800dffd40bc93fb76e4ae450390facd)。此处用于记录素材来源与衍生关系;精致版不表述为原作者的官方作品,也不重新定义原始美术作品的授权范围。
|
|
69
133
|
|
|
70
134
|
## 动画预览
|
|
71
135
|
|
|
@@ -101,7 +165,8 @@ dsh-pet/
|
|
|
101
165
|
| |-- sequences.ts # 完整轨道场景序列计时
|
|
102
166
|
| |-- spritesheet.ts # 图集几何辅助 + 轨道裁剪
|
|
103
167
|
| `-- pet.module.css
|
|
104
|
-
|-- assets/whale/ #
|
|
168
|
+
|-- assets/whale/ # 内置原版鲸鱼娘(manifest + 图集 + 预览)
|
|
169
|
+
|-- assets/whale-refined/ # 内置精致版鲸鱼娘注册表变体
|
|
105
170
|
`-- cordis.patch.yml # bundle 补丁:插入宠物插件行
|
|
106
171
|
```
|
|
107
172
|
|
|
@@ -156,7 +221,15 @@ pnpm typecheck # 仅类型检查
|
|
|
156
221
|
|
|
157
222
|
## 精灵图与动画轨道校准
|
|
158
223
|
|
|
159
|
-
|
|
224
|
+
两套内置鲸鱼娘图集使用同一份 9 态 × 8 列契约:`assets/whale/` 是原版,`assets/whale-refined/` 是精致版。每张图集均为 1536×1872(8 列 × 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)。
|
|
225
|
+
|
|
226
|
+
## 安全模型
|
|
227
|
+
|
|
228
|
+
- 全部宠物 API 与资产路由仅服务回环客户端。
|
|
229
|
+
- 资产服务对宠物目录与目标文件双双做 `realpath` 解析;symlink 越界一律拒绝(403)。文件读入内存前按类限大小(清单 64 KB、图像 20 MB;超限 413)。
|
|
230
|
+
- Live2D 模型按闭包放行:仅清单、声明的主资产与 `.model3.json` 引用到的文件(引用先经穿越/绝对路径/URL 形态筛查)。
|
|
231
|
+
- 插件从不下载可执行文件,也从不内置 Live2D Cubism Core。
|
|
232
|
+
- 清单结构 fail-closed:未知字段或未知渲染器直接拒载,并在设置中给出诊断。
|
|
160
233
|
|
|
161
234
|
## 许可证
|
|
162
235
|
|
package/assets/whale/pet.json
CHANGED
|
@@ -1,27 +1,176 @@
|
|
|
1
1
|
{
|
|
2
|
+
"petManifestVersion": 2,
|
|
2
3
|
"id": "whale-girl",
|
|
3
|
-
"displayName": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
"displayName": "鲸鱼娘(原版)",
|
|
5
|
+
"renderer": "sprite2d",
|
|
6
|
+
"sprite2d": {
|
|
7
|
+
"spritesheetPath": "spritesheet.webp",
|
|
8
|
+
"frames": [
|
|
9
|
+
6,
|
|
10
|
+
8,
|
|
11
|
+
8,
|
|
12
|
+
4,
|
|
13
|
+
5,
|
|
14
|
+
8,
|
|
15
|
+
6,
|
|
16
|
+
6,
|
|
17
|
+
6
|
|
18
|
+
],
|
|
19
|
+
"tracks": {
|
|
20
|
+
"idle": {
|
|
21
|
+
"durations": [
|
|
22
|
+
400,
|
|
23
|
+
400,
|
|
24
|
+
500,
|
|
25
|
+
400,
|
|
26
|
+
400,
|
|
27
|
+
500
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"running-right": {
|
|
31
|
+
"durations": [
|
|
32
|
+
225,
|
|
33
|
+
225,
|
|
34
|
+
225,
|
|
35
|
+
225,
|
|
36
|
+
225,
|
|
37
|
+
225,
|
|
38
|
+
225,
|
|
39
|
+
225
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"running-left": {
|
|
43
|
+
"durations": [
|
|
44
|
+
225,
|
|
45
|
+
225,
|
|
46
|
+
225,
|
|
47
|
+
225,
|
|
48
|
+
225,
|
|
49
|
+
225,
|
|
50
|
+
225,
|
|
51
|
+
225
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"waving": {
|
|
55
|
+
"durations": [
|
|
56
|
+
350,
|
|
57
|
+
350,
|
|
58
|
+
350,
|
|
59
|
+
350
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"jumping": {
|
|
63
|
+
"durations": [
|
|
64
|
+
300,
|
|
65
|
+
300,
|
|
66
|
+
300,
|
|
67
|
+
350,
|
|
68
|
+
350
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
"failed": {
|
|
72
|
+
"durations": [
|
|
73
|
+
450,
|
|
74
|
+
450,
|
|
75
|
+
450,
|
|
76
|
+
500,
|
|
77
|
+
550,
|
|
78
|
+
600,
|
|
79
|
+
450,
|
|
80
|
+
450
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"waiting": {
|
|
84
|
+
"durations": [
|
|
85
|
+
450,
|
|
86
|
+
450,
|
|
87
|
+
500,
|
|
88
|
+
450,
|
|
89
|
+
450,
|
|
90
|
+
500
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
"running": {
|
|
94
|
+
"durations": [
|
|
95
|
+
250,
|
|
96
|
+
250,
|
|
97
|
+
250,
|
|
98
|
+
250,
|
|
99
|
+
250,
|
|
100
|
+
250
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
"review": {
|
|
104
|
+
"durations": [
|
|
105
|
+
550,
|
|
106
|
+
550,
|
|
107
|
+
550,
|
|
108
|
+
550,
|
|
109
|
+
550,
|
|
110
|
+
550
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
}
|
|
17
114
|
},
|
|
115
|
+
"description": "一只软萌治愈的鲸鱼娘,来自深海的陪伴小伙伴。",
|
|
116
|
+
"license": "BSD-3-Clause",
|
|
18
117
|
"sequences": {
|
|
19
|
-
"idle": [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
118
|
+
"idle": [
|
|
119
|
+
"idle",
|
|
120
|
+
"waving",
|
|
121
|
+
"idle",
|
|
122
|
+
"waiting",
|
|
123
|
+
"idle",
|
|
124
|
+
"idle"
|
|
125
|
+
],
|
|
126
|
+
"waiting": [
|
|
127
|
+
"waiting",
|
|
128
|
+
"idle",
|
|
129
|
+
"waving",
|
|
130
|
+
"waiting",
|
|
131
|
+
"idle",
|
|
132
|
+
"waiting"
|
|
133
|
+
],
|
|
134
|
+
"thinking": [
|
|
135
|
+
"running",
|
|
136
|
+
"running-right",
|
|
137
|
+
"running",
|
|
138
|
+
"running-left",
|
|
139
|
+
"running",
|
|
140
|
+
"waiting",
|
|
141
|
+
"running"
|
|
142
|
+
],
|
|
143
|
+
"tool": [
|
|
144
|
+
"running-right",
|
|
145
|
+
"running",
|
|
146
|
+
"running-left",
|
|
147
|
+
"running",
|
|
148
|
+
"running-right",
|
|
149
|
+
"running"
|
|
150
|
+
],
|
|
151
|
+
"review": [
|
|
152
|
+
"review",
|
|
153
|
+
"waiting",
|
|
154
|
+
"review",
|
|
155
|
+
"running",
|
|
156
|
+
"review",
|
|
157
|
+
"idle"
|
|
158
|
+
],
|
|
159
|
+
"done": [
|
|
160
|
+
"jumping",
|
|
161
|
+
"waving",
|
|
162
|
+
"jumping",
|
|
163
|
+
"waving",
|
|
164
|
+
"jumping",
|
|
165
|
+
"idle"
|
|
166
|
+
],
|
|
167
|
+
"failed": [
|
|
168
|
+
"failed",
|
|
169
|
+
"waiting",
|
|
170
|
+
"failed",
|
|
171
|
+
"idle",
|
|
172
|
+
"waiting",
|
|
173
|
+
"failed"
|
|
174
|
+
]
|
|
26
175
|
}
|
|
27
176
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"petManifestVersion": 2,
|
|
3
|
+
"id": "whale-girl-refined",
|
|
4
|
+
"displayName": "鲸鱼娘(精致版)",
|
|
5
|
+
"renderer": "sprite2d",
|
|
6
|
+
"sprite2d": {
|
|
7
|
+
"spritesheetPath": "spritesheet.webp",
|
|
8
|
+
"frames": [
|
|
9
|
+
6,
|
|
10
|
+
8,
|
|
11
|
+
8,
|
|
12
|
+
4,
|
|
13
|
+
5,
|
|
14
|
+
8,
|
|
15
|
+
6,
|
|
16
|
+
6,
|
|
17
|
+
6
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"description": "基于鲸鱼娘形象进行 AI 辅助二次创作、修复与细节精修的内置变体。",
|
|
21
|
+
"license": "MIT"
|
|
22
|
+
}
|
|
Binary file
|