DSH (DeepSeek Harness) follows the philosophy of “everything is a plugin.” During model inference, when an Agent needs to generate HTML, Mermaid diagrams, or React components, existing open-source solutions often focus on full rewrites or real-time previews, and lack robust support for single-point edits, version rollback, and persistent storage. dsh-plugin-canvas-pro provides a Web drawer and eight model tools, filling these gaps.
Plugin Overview¶
This is the Canvas-Pro artifact drawer for DeepSeek Harness. It supports HTML/Markdown/Mermaid/SVG/React artifacts and provides creation, patching, version control, and export capabilities. The plugin is maintained by lokih1028, classified under model inference, and licensed under MIT.
Installation¶
Run the following command to install the plugin:
dsh plugin --profile web add github:lokih1028/dsh-plugin-canvas-pro
After installation, refresh the GUI. A Canvas button will appear in the Web session header.
Core Features¶
Web Drawer and Artifact Types¶
The plugin provides a Canvas button in the Web session header. Opening the drawer allows you to preview artifacts. Supported types include HTML, Markdown, Mermaid, SVG, and React artifacts.
Eight Model Tools¶
The plugin provides the following tools for the Agent:
| Tool Name | Function |
|---|---|
create_canvas_artifact |
Create an artifact |
update_canvas_artifact |
Patch content (supports selection, line range, or full overwrite) |
get_canvas_selection |
Read the content selected in the latest preview |
get_canvas_artifact |
Read the current artifact content |
list_canvas_versions |
List version snapshots |
revert_canvas_artifact |
Restore a previous snapshot as a new version |
diff_canvas_artifact |
Compare different versions (supports unified or split diff) |
export_canvas_artifact |
Export as markdown, html, svg, png, or json |
Text Selection and Interaction¶
Selecting text in the preview can trigger Explain / Refactor / Fix operations and submit the operation to the current chat window. The Agent can also read the selected content via get_canvas_selection.
Storage Location¶
Artifacts are persistently stored in $DSH_HOME/storages/canvas-pro/artifacts.json (provided that $DSH_HOME is set).
Typical Usage¶
- Create: The Agent uses the
create_canvas_artifacttool to initialize an artifact. - Patch: The Agent uses the
update_canvas_artifacttool to modify specific parts instead of rewriting the entire document. - Version Management: The Agent can use
list_canvas_versionsto view history,diff_canvas_artifactto compare differences, andrevert_canvas_artifactto restore an older version. - Interaction: Select content in the preview, choose Explain or Refactor, and the selected content will be inserted into the chat input.
- Export: The Agent uses the
export_canvas_artifacttool to export the artifact as markdown, html, svg, png, or json.
Limitations and Notes¶
- React and Mermaid Rendering: React artifacts display source code in the preview sandbox rather than the executed React tree; Mermaid artifacts display source code by default unless converted to HTML.
- Export Fallback: PNG export attempts browser rasterization and falls back to SVG if it fails.
- Line Number Source: Line numbers associated with selections come from the rendered preview rather than the source code lines. When the two are inconsistent, prefer using
replace_selectionoverreplace_range. - Environment Dependency: Persistent storage depends on the
$DSH_HOMEenvironment variable being set.
Summary¶
dsh-plugin-canvas-pro provides core Patch and Versioning capabilities in the DSH artifact workflow. It integrates export functionality as model tools and treats text selection as a first-class input for the Agent, making it suitable for scenarios where UI documents and code snippets need to be manipulated directly by the Agent.