When developing agents in DeepSeek Harness (DSH), image display usually relies on external image hosting services or directly transferring file paths, resulting in a fragmented experience within the conversation flow. The dsh-image-preview plugin leverages the built-in HTTP service of the web profile (default 127.0.0.1:3080) to host a preview directory locally, enabling images to be rendered directly inline within chat messages.
This plugin is maintained by ReiRui and licensed under the MIT License. By registering a model tool and a static route, it allows the AI to copy local images into the preview directory and return URLs that can be rendered in chat.
Core Features¶
- Static Hosting: Registers the
/preview/*route on the built-in HTTP service of the web profile and statically hosts images in the preview directory. Same-origin URLs (such ashttp://127.0.0.1:3080/preview/<name>) can be rendered directly in chat without mixed-content/CORS issues. - Model Tool: Registers the model tool
preview_image(file_path), copies local images into the preview directory (or references them directly if already inside), and returns an embeddable URL.
Installation and Activation¶
- Run the installation command:
dsh plugin --profile web add "github:ReiRui/dsh-image-preview#main"
- After installation, restart the web profile for it to take effect.
The default preview directory is ~/.dsh/preview. The root configuration item can be overridden in $DSH_HOME/profiles/web/cordis.patch.yml.
Typical Usage¶
- Have the AI generate or download an image to local storage.
- The AI calls the
preview_imagetool, passing the absolute path of the image. - The tool returns
http://127.0.0.1:3080/preview/<name>. - The AI directly embeds the link in the reply (for example,
), displaying the image.
You can also directly access http://127.0.0.1:3080/preview/<name> to view the image.
Notes and Limitations¶
- Tool Invocation Required: The AI must call the
preview_imagetool. Manually copying files into the preview directory is prohibited. The file sandbox for new sessions defaults toworkspace-write, so the AI’s file tools cannot write to the preview directory (it will report a “directory error”). The tool internals are not subject to this sandbox restriction. - URL Restrictions: URLs always use
127.0.0.1. For LAN access, replace it with your local machine IP yourself (and ensure the web service is bound to 0.0.0.0). - File Cleanup: No cleanup policy is applied to files in the preview directory. For long-term use, it is recommended to clean them up manually periodically.
- Format Support: Only png, jpg, jpeg, webp, gif, avif, and bmp formats are supported.
The plugin source code is located at ReiRui/dsh-image-preview.