Introduction¶
In the conversation stream of DeepSeek Harness (DSH), models typically describe charts or processes through text. While accurate, this approach lacks intuitive visualization within dialogues. The dsh-widget plugin resolves the “viewing” problem by directly rendering model-generated SVG or HTML fragments as visual cards in the conversation through a tool call, eliminating manual intervention or additional visualization libraries.
What is This¶
This is a DSH plugin that renders model-written SVG/HTML fragments as inline visual cards (charts, flowcharts, etc.) in conversations, with sandbox isolation support. Maintained by anneqaq under the MIT license, it registers a ToolDefinition tool allowing models to directly invoke rendering logic.
Core Features¶
- Visual Rendering: Supports rendering model-output SVG or HTML fragments into flowcharts, timelines, comparison tables, layout drafts, and more.
- Sandbox Isolation: Uses
srcdocframes for rendering with no script permissions by default. Content executes in an isolated iframe with a CSP policy ofdefault-src 'none', preventing cross-origin resource loading or data leaks. - No Network Dependencies: Rendering process is independent of external CDNs; all resources must be inlined.
- Tool Integration: Registers the
render_widgettool definition; when models call this tool, DSH automatically handles card display logic.
Installation and Activation¶
The plugin requires no build step and is ready to use after installation.
- Execute the installation command:
dsh plugin --profile web add github:anneqaq/dsh-widget
- Restart
dsh web. The plugin mounts at startup and does not support hot reload. - Verify configuration (optional):
dsh --profile web --dump-config | grep -A2 dsh-widget
Typical Usage¶
Models generate code while DSH handles rendering. Models call the render_widget tool, passing self-contained HTML or SVG fragments.
Parameter Descriptions:
* html: Required. A self-contained SVG or HTML fragment.
* title: Optional. Card title, also used as the frame title.
* height: Optional. Height in CSS pixels. Default 420, range 80-2000.
* allowScripts: Optional. Whether to permit scripts in fragments. Disabled by default.
Usage Example:
Model invocation in conversation:
{
"tool": "render_widget",
"arguments": {
"html": "<svg ...>...</svg>",
"title": "Service Request Lifecycle",
"height": 300
}
}
Use Cases and Considerations¶
This plugin is ideal for scenarios requiring complex structures, charts, or layout drafts within conversation streams.
Important Notes:
* Security: Content originates from model-generated code and is treated as untrusted by default. Rendering uses sandbox iframes with scripts disabled. To enable scripts, set allowScripts: true during invocation, and ensure allow-same-origin is disabled to prevent iframe access to the host document.
* Resource Limits: Soft budget of 8 KB, hard limit of 512 KB. Fragments exceeding the soft budget trigger system warnings to the model; requests exceeding the hard limit are rejected.
* Display Timing: Cards appear when the html parameter closes. Placeholders show during streaming.
* Dependencies: Requires react and relies on the current DSH process’s module resolution capabilities.
* Pre-installation Check: The plugin runs with current DSH process permissions; review source code and license before installation.
Summary¶
dsh-widget embeds model-generated visual content directly into conversations through tool-based integration, enhancing information delivery efficiency. For scenarios requiring high-interaction charts or complex layouts, this provides a direct implementation solution.