During the development of DeepSeek Harness (DSH), showing users images generated in the local workspace (such as renderings or analytical charts) is a common requirement. Traditional approaches usually require users to manually copy, paste, or upload images through other means, resulting in a fragmented experience. The dsh-show-image plugin registers a model tool and mounts workspace images directly into the DSH WebUI conversation flow, presenting them as a gallery with lightbox support.
Plugin Overview¶
This plugin is maintained by KureKaruna and is licensed under the MIT License. It registers the show_image tool, converts image files in the DSH filesystem into conversation attachments, and ensures that the browser side can render and preview them correctly.
Installation and Activation¶
Install the repository into the specified DSH profile:
dsh plugin --profile test add https://github.com/KureKaruna/dsh-show-image.git
You can also install it using a local path:
dsh plugin --profile test add C:/path/to/dsh-show-image
After installation, restart the DSH WebUI so that both the host-side and browser-side plugins are loaded. The plugin is automatically added to the profile bundle through cordis.patch.yml.
Core Features¶
- Tool registration: Registers the model tool
show_imagefor the model to call during conversation. - Format support: Supports PNG, JPEG, WebP, and GIF images.
- Persistent storage: Reads workspace files from the DSH filesystem service and saves them to the persistent attachment library.
- WebUI rendering: Renders an image gallery in the user’s WebUI session and supports lightbox preview.
- Parameter support: Supports the optional
captionparameter for adding descriptions to images. - Context isolation: Image bytes are not sent to the model context as image content; only references are passed, avoiding unnecessary token consumption.
- Structured references: Uses a structured
ImageBlockas the session attachment reference, ensuring the browser can read the image through the session attachment interface. - Compatibility: Compatible with top-level native tool calls and
run_codesub-dispatch.
Typical Usage¶
Users can directly make requests in the conversation, for example:
Show me the
render.pngfile in the workspace.
The model will invoke the following tool:
{
"file_path": "C:/path/to/render.png",
"caption": "本次渲染结果"
}
The image is then displayed as a standalone chat node in the WebUI. file_path must point to an image file accessible in the current DSH filesystem.
Working Principles¶
The plugin is implemented in two parts: the host side and the browser side:
-
Host side (
index.js):- Validators file extension and image types supported by the attachment service.
- Resolves the path through the DSH filesystem service and reads the bytes.
- Calls
attachments.saveImage()to save the image and obtains anImageAttachmentRef. - Returns a text summary and normalized attachment information for the model.
- For top-level calls, writes the client-side payload into
presentationMeta. - For
run_codesub-dispatch, modifies only the persistent log copy throughtools/code-dispatch-log, appending a structuredImageBlockand client-side markers. The plugin does not create custom top-level session events, keeping session logs compatible with DSH’s known event types and replay logic.
-
Browser side (
client.js):- Registers a
ConversationNodeDefinition. - Matches
tool/resultentries with thedsh-show-imagemeta. - Matches
tool/code-dispatchentries with image payload markers. - Uses
renderMessageImagesto reuse the WebUI built-in image gallery and lightbox. - Uses the event sequence number as the node identity to support session history replay.
- Registers a
Limitations and Notes¶
- Path requirement: Images must have local workspace paths that are readable by the DSH filesystem service.
- Deployment limits: Images are still subject to the attachment size, dimension, and pixel limits of the current deployment.
- Historical data: Old events already written to a session may not have a structured
ImageBlock; their historical images may not be re-readable through the attachment authorization interface. New submissions after the fix carry complete references.
Resources¶
- GitHub repository: https://github.com/KureKaruna/dsh-show-image
- Ecosystem directory: https://www.skillhub.cn/plugins/KureKaruna/dsh-show-image