Introduction

When assistant messages or tool results contain local audio/video/image paths, or online http(s) media links, they are automatically replaced with inline <audio> / <video controls playsInline> / <img> preview components.

Features

This plugin runs in unrestricted mode, meaning any file path readable by the DSH process can be accessed. Permission or I/O errors are returned with explicit HTTP status codes, allowing browser native players to present meaningful error messages.

  • Range request support: Supports bytes=start-end requests, returning 206 Partial Content, so that <video> tags can properly seek the progress bar.
  • Full-file reading: Uses GET requests by default, returning 200 OK.
  • Caching policy: Response headers include Cache-Control: private, max-age=60.
  • Path safety: The client-side regex only matches specific root paths (/Users, /tmp, /private/tmp, /var/folders, /var/tmp) plus 15 extensions, avoiding false matches on external URLs. It also supports UTF-8-safe path encoding.
  • Style cleanup: When the plugin is uninstalled, the client Fiber automatically removes the injected <style>.

Supported Formats

The plugin supports local paths and online links. The supported extensions are as follows:

  • Audio/video (15 types): mp3, wav, m4a, flac, ogg, opus, aac, mp4, mov, mkv, m4v, webm, avi, 3gp, ogv
  • Images (12 types): png, jpg, jpeg, gif, bmp, webp, svg, tiff, ico, avif, heic, heif

Installation and Configuration

  1. Enter the DSH web profile directory (default: ~/.dsh/profiles/web).
  2. Install the plugin using the official command:
dsh plugin --profile web add media-preview
  1. After installation, the plugin automatically modifies package.json and adds the dsh.bundle.patch and dsh.client.platform configuration items.
  2. After source code changes, restart dsh web.

Limitations and Dependencies

  • Buffering limits: Full-file buffered reads are used, with a per-request limit of 500 MB. Large videos may have slower initial frame loading; range requests slice from the same in-memory buffer.
  • Directories and links: Directory listings are not supported, and there is no symbolic link policy (it relies on fs.stat).
  • Dependency: Requires @deepseek-ai/cordis (^4.0.1).

References