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_image for 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 caption parameter 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 ImageBlock as 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_code sub-dispatch.

Typical Usage

Users can directly make requests in the conversation, for example:

Show me the render.png file 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):

    1. Validators file extension and image types supported by the attachment service.
    2. Resolves the path through the DSH filesystem service and reads the bytes.
    3. Calls attachments.saveImage() to save the image and obtains an ImageAttachmentRef.
    4. Returns a text summary and normalized attachment information for the model.
    5. For top-level calls, writes the client-side payload into presentationMeta.
    6. For run_code sub-dispatch, modifies only the persistent log copy through tools/code-dispatch-log, appending a structured ImageBlock and 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):

    1. Registers a ConversationNodeDefinition.
    2. Matches tool/result entries with the dsh-show-image meta.
    3. Matches tool/code-dispatch entries with image payload markers.
    4. Uses renderMessageImages to reuse the WebUI built-in image gallery and lightbox.
    5. Uses the event sequence number as the node identity to support session history replay.

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