In the DeepSeek Harness (DSH) framework, the default output of the read_image tool usually contains only path information. For developers, viewing image content directly in the interface or copying images is a frequent need. The dsh-image-preview plugin takes over DSH’s tool rendering slot, provides inline preview capability for read_image, and includes a built-in copying feature.

Core Features

This plugin is implemented based on DSH’s tool.call.toolview slot and covers both direct invocation and nested invocation scenarios:

  1. Inline Preview and Nested Support: Supports direct invocation of read_image, as well as nested invocation via tools.read_image(...) in run_code Code Mode.
  2. Image Copy and Format Conversion: Provides a copy button. PNG files copy the original bytes directly; other formats (JPEG, WebP, GIF) are converted to PNG in the browser before copying, with success or failure feedback.
  3. Security and Resource Management: Reads authenticated attachments only via ctx.sessions.binding(sessionId).session.readAttachment(attachmentId); paths provided by the model are used for display only. Blob URLs are automatically reclaimed during replacement, retry, unmount, or HMR.

Installation and Enabling

Before installation, ensure the environment meets the dependency: DeepSeek Harness 0.1.2-alpha.2 or a compatible version.

pnpm pack --pack-destination "$HOME/.dsh/packages"
dsh plugin --profile web add "$HOME/.dsh/packages/dsh-image-preview-0.3.4.tgz"
dsh --profile web --dump-config

After running the above commands, refresh the Web Profile page to make it take effect. The plugin injects a custom renderer into DSH’s tool list.

Typical Usage

  1. Direct Invocation: Use read_image directly in a tool call; the image will be displayed inline.
  2. Code Mode Invocation: Use tools.read_image(...) inside a run_code code block; the plugin automatically detects and renders the nested image.
  3. Manual Preview Loading: After turning off the “Open previews automatically” option in DSH settings (Plugins), images are collapsed by default. Click “Show preview” in the tool row to load the image content.
  4. Copy Image: Click the image area to copy it to the clipboard. PNG files are preserved as-is, while other formats are converted automatically.

Applicable Scenarios and Notes

This plugin is suitable for developers who need to display or process images intuitively in DSH tool calls. The plugin runs with the permissions of the current DSH process; it is recommended to review the source code and license (MIT) before installation.

For more details and source code, visit the GitHub repository.