The core philosophy of DSH (DeepSeek Harness) is “Everything is a plugin.” In agent development, UI code generated by models often suffers from layout inconsistencies, deviations from design specifications, or pixel-level inaccuracies. The dsh-fuse plugin aims to address this issue by quantifying aesthetic standards into design tokens, rendering pages directly via structured specification fences, and providing pixel-level inspection and closed-loop correction capabilities.
What is it¶
dsh-fuse is a page-level UI rendering plugin maintained by KLRSL. It transforms natural language descriptions into structured specification fences and renders them into real page UIs on the browser side. The plugin incorporates a built-in pixel-level inspection closed loop and a ring buffer mechanism, supporting rapid visual style adjustments via theme switching.
Core Features¶
- Page-level UI Rendering:Transforms natural language into structured specification fences and renders them into real page UIs on the browser side.
- Pixel-level Inspection and Closed-loop Correction:Clicking on a preview element triggers an inspection to collect
getComputedStyledata, correcting the fence via anexpected → observed → diff → fixworkflow. - Ring Buffer:Retains the last 10 snapshots, supporting undo and rollback.
- Design Tokens:Built-in
default,apple, anddarkthemes, mapped via CSS variables. - Code Standards:Integrates
code-style.jsonto ensure generated code complies with specifications. - DOM Rendering Channel:Uses
MutationObserverto scan for and render fenced code blocks within the conversation stream. - Dark Mode:Supports dual-channel detection (
body[data-ds-dark-theme]andprefers-color-scheme). - Whitelist Validation:Limits the node budget to 60 nodes (including nesting) and a depth of 8 layers; unknown component types will result in a rejection of the entire render.
Installation and Activation¶
Use the following command to install the plugin (git must be installed):
dsh plugin --profile web add github:KLRSL/dsh-fuse
Restart DSH after installation. The startup log should display [dsh-fuse] Startup complete, and GET http://localhost:<port>/api/fuse/config should return configuration information (including themes and codeStyle).
Typical Usage¶
The model outputs a dsh-fuse fenced JSON code block in its response.
{
"type": "login_form",
"title": "Welcome back",
"theme": "default",
"components": [
{ "type": "input", "label": "Username", "placeholder": "Enter username" },
{ "type": "input", "label": "Password", "placeholder": "Enter password", "inputType": "password" },
{ "type": "button", "text": "Log In", "style": "primary", "action": "login" }
]
}
The renderer fetches corresponding design tokens from /api/fuse/config based on the theme field (e.g., default, apple, dark) for rendering. Clicking a button with an action returns a [fuse-action] event.
Ecosystem and Notes¶
- Version Requirements:DSH ≥ 0.1.1-rc.2 (Adapted for 0.2.0-rc.2), Node.js
^22.19.0 || >=24.0.0. - Security and Performance:The plugin validates component types via a whitelist, with a node budget limit of 60 nodes (including nesting) and 8 layers of depth. For untrusted text (e.g., title, label), the plugin constructs DOM nodes using
textContentinstead ofinnerHTMLto prevent injection risks. - Resources:This plugin is maintained by community developers. Source code can be viewed on GitHub.