In the DeepSeek Harness (DSH) Web interface, local image or video paths returned by the assistant are usually plain text only. The dsh-image-preview plugin rewrites these paths and renders them as interactive media elements, while preserving a clickable link to the original address.

Core Features

  • Inline local media: Absolute paths to local images/videos in assistant replies automatically become inline images or playable videos.
  • Video player: Supports dragging the progress bar, implemented using HTTP Range 206 partial responses.
  • Persistence: Media does not disappear after restarts; the persistent token is stored in $DSH_HOME/plugins/dsh-image-preview.token.
  • Open with system: Clicking the URL line (below the media) opens it with the default system application.
  • Click interception: The client intercepts the click and does not open a new tab; it falls back gracefully when no client module is available.
  • Style and bundle size: The URL line below the media uses a small font size and tight spacing; zero build, pure ESM.

Installation and Enabling

This plugin is installed as a regular dependency in DSH’s profile directory.

  1. Navigate to DSH’s profile directory:
   cd ~/.dsh/profiles/web
  1. Install the plugin:
   pnpm add github:ywleeo/dsh-image-preview
  1. Append the configuration to ~/.dsh/profiles/web/cordis.patch.yml:
   - insert:
       - id: dsh-image-preview
         name: dsh-image-preview
  1. Restart dsh web, then refresh the page.

How It Works

The plugin consists of a Host side and a Client side, separated into files to isolate startup risk.

Host side (logic layer)
- Wraps the llm/stream endpoint. When a streamed text chunk ends, it scans for absolute paths to local media files that actually exist (POSIX /…, Windows drive letters, UNC).
- After verifying that the file exists, it rewrites the path to a same-origin loopback URL (127.0.0.1).
- Registers three routes:
- /image: reads the file bytes and returns the image.
- /video: supports HTTP Range 206 partial responses and returns the video.
- /open: invokes a system command (open/start/xdg-open) to open the file and redirects to the media route.

Client side (rendering layer)
- Injects CSS styles: controls player styles, small font size, and spacing.
- Replaces the “▶ Play video” link with a <video controls> tag.
- Intercepts click events on /open links, prevents the default navigation, and triggers the local open action instead.

File structure
- index.js: startup shell, does not depend on core modules, ensuring audit passes.
- host.js: core logic.
- client.js: frontend rendering and interactions.

Notes and Edge Cases

  • Scope: Only processes streamed text in assistant replies (llm/stream); path text in tool result cards is not rewritten.
  • Path validation: Only handles absolute local paths to real, existing files; remote http(s), data:/, file: protocols, and relative paths are ignored.
  • Video support: Only container/codecs natively playable in the browser are supported (mp4/H.264, webm, mov, ogv); mkv, avi, etc. do not support preview, but clicking the URL line can still open them with the system player.
  • Performance limits: Video reading is performed as a full read followed by Range-based slicing; the limit for a single file is 512 MB.
  • Permissions and security: The token is persisted in $DSH_HOME/plugins/dsh-image-preview.token (permission 600); use it on the local machine only and do not expose it to the public Internet.
  • Special characters: When a path contains special characters such as ( ) [ ], the Markdown link syntax may break.
  • Platform differences: The Windows/Linux open command is implemented, but it has only been tested on macOS.

Conclusion

By coordinating the Host and Client sides, the plugin enables seamless preview of local media in the DSH Web interface. For more details and updates, consult the plugin directory or the source repository.