Introduction¶
The core philosophy of DeepSeek Harness (DSH) is “Everything is a Plugin.” The default dsh-whale-widget balance widget utilizes a static PNG. While its interactive features (dragging, snapping, bubbles) are fully functional, its visual representation is fixed. The goal of the dsh-whale-live2d plugin is to replace this static image with a dynamic Live2D model while retaining all original interaction logic.
This plugin operates via an overlay mode. It does not modify the widget code or disrupt its original structure; it performs a visual layer replacement only.
Installation and Activation¶
To install the plugin, use the DSH plugin management command.
dsh plugin --profile web add github:harmless0819-dev/dsh-whale-live2d
After installation, you must restart the dsh web service. Once restarted, refresh the page in your browser (F5) to see the effect.
How It Works: Overlay Mode¶
The dsh-whale-widget is installed in the %DSH_HOME%\profiles\web\node_modules\ directory. This directory is overwritten by the dsh plugin add command, so its source code cannot be modified directly. Additionally, the widget internally supports only static PNG loading and lacks a Live2D engine.
This plugin employs an overlay mode to resolve these issues:
- Script Injection: The plugin injects a client-side script via the widget’s existing
tapIndexmechanism. - Element Transparency: The script locates the
<img>element within the widget and sets it to transparent (opacity: 0), while retaining the element itself. - Canvas Overlay: A
<canvas>rendered with Live2D is overlaid at the exact geometric position.
Preserving the <img> element is crucial. The widget’s hit testing relies on img.getBoundingClientRect() and Alpha channel sampling of the PNG. If the <img> were removed, the rect would become 0, causing the widget to lose dragging and clicking capabilities. Through this overlay mode, all interactive behaviors of the widget remain unchanged, with only the visuals replaced.
Dependencies and Fallback¶
Due to Live2D’s proprietary license, live2dcubismcore.min.js cannot be distributed, so the plugin does not bundle this core file.
- Obtain Core: Download
live2dcubismcore.min.jsfrom official Live2D channels (Cubism SDK for Web). - Placement Path: Place it in the host environment at
%DSH_HOME%\pets\.runtime\live2dcubismcore.min.js.
If the Cubism Core is not found, the plugin gracefully degrades: the static PNG remains visible on the page, and a notification card appears informing the user of the target path and installation instructions. The pixi.js + Live2D engine used for the rendering stack is MIT licensed and is distributed with the plugin package, requiring no separate installation.
Model Management and Replacement¶
The plugin integrates the DS Whale Girl model (44 expressions / 8 motions) by default. To replace the model, use the provided packaging script package-model.mjs.
- Place the new model’s source files into the
_incoming/<your-model>/directory. - Modify the
SRC(source files),EXPR(expressions), andMOTION(motions) mapping configurations at the top ofpackage-model.mjs. - Run the packaging script:
node package-model.mjs.
The script performs strict path validation: model files must be in pure ASCII paths; otherwise, it will hard-fail and not generate unusable model files.
Verification and Self-Testing¶
The plugin provides a set of offline self-test scripts to verify logic without launching the full host service.
- Host-side Self-Test (Checks routing, path traversal protection, model integrity):
node test-harness.mjs
- Client-side Self-Test (Checks fallback logic when Core is missing):
node test-client.mjs
When the host service is running, you can check the status via the following interface:
curl http://127.0.0.1:3080/dsh-live2d/health.json
The state field returns the following values:
* ready: Model is displayed; PNG is hidden (transparent).
* core-missing: Cubism Core is missing; static widget remains visible + guide card.
* error: Loading failed; reverted to static widget.
* no-widget: Widget element not found (widget disabled or not loaded).
Model Licensing¶
The DS Whale Girl model included in this repository was shared freely by Bilibili user @氵六青 (11272072). The author declares: Commercial streaming and self-printed materials are permitted. Theft and resale are strictly prohibited.
If the author objects to this plugin redistributing the model files, the assets/whale-girl/ directory will be removed. Consequently, only the overlay mode code will remain, and the model component will gracefully degrade to a static PNG. When using other models, please verify their licensing agreements yourself.
Plugin Directory: https://www.skillhub.cn/plugins/harmless0819-dev/dsh-whale-live2d
GitHub Repository: https://github.com/harmless0819-dev/dsh-whale-live2d