dsh-image-tools: Enable copying and downloading original images in DSH chats

Introduction

Running agents in DSH often involves pasting screenshots into chats, sending images, or having models/tools return images. While these are visible on the interface, saving them isn’t easy: the official display layer lacks readily available “Copy” or “Download” buttons, often requiring you to open a screenshot tool separately, resulting in reduced quality and potential format changes.

dsh-image-tools is a client-side plugin designed to address this pain point. It belongs to the dsh-plugins-cn community plugin suite, categorized as a client plugin. Its purpose is to provide copy and original download capabilities for images in DSH chats without altering the message layout. Below, I introduce its functions, installation methods, and applicable boundaries.

What is this plugin

One-sentence positioning: A client-side plugin that only takes over the image display layer, providing two actions for images in the chat: Copy Image and Download Original Image.

The specific problem it solves is: Pasted screenshots, uploaded images, and images rendered by assistants and tools all lack unified copy/download entry points.

  • Images obtained via copy enter the system clipboard.
  • Files obtained via download preserve original bytes and format (e.g., jpg remains jpg), without transcoding or compression.
  • The plugin only takes over the image display layer and does not change the message layout; according to the README, the official behavior is restored immediately after uninstallation.

Core Features

The plugin covers three types of interaction entry points:

  1. Right-click on a thumbnail to reveal “Copy Image / Download Original”.
  2. When hovering over a thumbnail, two small circular buttons float in the top-right corner.
  3. After opening the preview, the bottom toolbar provides the same two actions.

In implementation, the plugin takes over four image slots:

  • conversation.chat.user.images
  • conversation.chat.message.images
  • tool.call.images
  • conversation.trajectory.images

It overrides the official priority: 100 registration with its own priority: 10, thus allowing it to replace the official image rendering. The preview layer, right-click menu, and toast are all uniformly registered under shell.overlay (list / root).

The source of the original image is the blob URL returned by props.loadImage(attachment), using the same bytes as session.readAttachment; that is, the copy and download operations retrieve the original data, not the result of re-encoding/decoding.

The plugin does not read the official DOM, does not append nodes to document.body, does not require other Client packages, and only uses --dsw-* theme tokens.

Installation and Activation

The installation method provided in the README is via install.ps1 in the repository. First, perform an environment check:

powershell -ExecutionPolicy Bypass -File .\install.ps1 -Profile imagecheck
powershell -ExecutionPolicy Bypass -File .\install.ps1 -Doctor -Profile imagecheck

The -Doctor command above is used to check the installation environment. After confirming everything is correct, install to the daily profile (it will write node_modules and package.json to the profile, requiring DSH to be restarted to take effect):

powershell -ExecutionPolicy Bypass -File .\install.ps1 -Profile desktop

When a rollback is needed:

powershell -ExecutionPolicy Bypass -File .\install.ps1 -Rollback -Profile desktop

The installation commands are taken directly from the README; do not replace them with commands from other package managers. imagecheck / desktop are kept exactly as per the README.

Typical Usage

The plugin has no independent runtime command; once installed and DSH is restarted, it is ready to use.

  1. Paste a screenshot in the chat, or have the assistant/tool generate an image.
  2. Hover the mouse over the thumbnail; two small circular buttons appear in the top-right corner. Click copy or download.
  3. Or right-click the thumbnail and select Copy Image / Download Original.
  4. Open the large image preview; the bottom toolbar also allows copying and downloading.

The downloaded file is the original file; the copied image enters the system clipboard and can be pasted directly into editors, IMs, or documents.

Local Development and Verification:

npm run check
npm test
npm run pack:dry

npm run check performs syntax and manifest validation, npm test runs tests, and npm run pack:dry previews the packaged output. Design specs and acceptance records are located in the docs/ directory of the repository.

Applicable Scenarios and Notes

Suitable for developers who frequently need to handle screenshots or model-generated images in DSH chats and require access to uncompressed, untranscoded original images. It only performs image operations on the display layer and does not involve message sending/receiving logic.

Points to note:

  1. The plugin runs with the permissions of the current dsh process; you should check the source code and license before installing. The license for this plugin is MIT.
  2. It only handles message images. Non-image attachments (PDF/Office/zip) remain official static cards and are not covered by this plugin; workspace images in sidebar previews are also out of scope.
  3. Markdown external link images (http/https) retain the browser’s default behavior and are not affected or taken over.
  4. When copied to the clipboard, GIFs become static PNGs (Chromium clipboard only accepts PNG); downloading retains the original GIF.
  5. Very large images (side length > 16384 or area > 268 million pixels) will skip the copy operation; please use download instead.

Conclusion

dsh-image-tools completes the task of “copying and downloading chat images,” at a very low cost: it only takes over the image display layer, does not touch the message layout, and the official behavior is restored immediately upon uninstallation. For developers who need to process a large number of screenshots in DSH, this is a useful small plugin.

Directory: https://www.skillhub.cn/plugins/dsh-plugins-cn/dsh-image-tools

Source Code & Docs: https://github.com/dsh-plugins-cn/dsh-image-tools

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye