dsh-file-link-menu: File and Link Right-click Menu Enhancement

Introduction

In the DSH Web UI, file paths output by tools or links in conversations are typically just plain text. Opening files directly, viewing file details, or managing links often requires copying the path and performing operations in an external application. This plugin introduces native file system operation capabilities into the Web interface by injecting context menus and visual enhancements for path chips.

What is this

dsh-file-link-menu is a plugin that provides context menu support and visual enhancements for path chips in the DSH Web UI.

The core problem it solves is that, in a browser environment, users cannot quickly open files or links as they can on a local desktop. This plugin listens to browser events and identifies specific anchors within the DSH interface to provide context menu actions for files, links, attachments, and user-entered @ references. Simultaneously, it adds file type icons and short names to path chips, improving information recognition efficiency.

Core Features

The plugin primarily handles the interaction and display for three main categories of targets:

  1. File Context Menu
    For delivered file cards, generated file chips, or inline paths, the context menu provides the following actions:

    • Open File (Default App)
    • Open in VS Code
    • Open With…
    • Save As
    • Copy File Path
    • Show in Explorer
  2. Link Context Menu
    For external links (http/https), the context menu provides the following actions:

    • Open in New Tab
    • Open in Default Browser
    • Copy Link
    • Save Link As
  3. Path Chip & Attachment Enhancements

    • Icons & Short Names: Path chips display file type icons and short file names, while the full path is retained in the element’s data-flm-full-path attribute.
    • Attachment Cards: Supports preview (left-click) and right-click actions for attachment cards.
    • @ References: Processes @ references entered by users in messages, rendering them as file chips that support the same context menu actions.
  4. Host Capability Detection
    The plugin retrieves host machine capabilities via the GET /api/dsh-file-link-menu/caps interface, such as desktop session status, available file manager types, and the list of launchable applications. If there is no desktop session, the plugin automatically hides launch rows.

Installation & Activation

The plugin is published via NPM as a pre-built version, requiring no local build steps.

dsh plugin --profile web add dsh-file-link-menu

After installation, you must restart the dsh web process or the host application, and then refresh the page for the features to take effect.

Typical Usage

  • Right-click Actions: In conversations or tool outputs, right-click on a file chip or link to bring up the corresponding action menu.
  • Quick Preview: Click an attachment card to preview the file in the right sidebar.
  • Reference Files: Use @ in the message input box to reference files; after sending, the reference appears as a chip supporting right-click actions.

Scenarios & Notes

  • Environment Dependencies: The plugin depends on the @deepseek-ai/dsh-client-ui-conversation, @deepseek-ai/dsh-client-ui-primitives, and @deepseek-ai/dsh-client-ui-slots plugins.
  • Desktop Sessions: Hosts without a detected desktop session will hide launch rows such as “Open” and “Show in Explorer”.
  • Rendering Mechanism: The plugin uses React’s useId to generate dynamic IDs. If the host updates the anchor structure and the plugin is not updated in sync, the identification logic may fail, in which case the system will fall back to the Shell’s default rendering method.
  • Build Method: The NPM package is a pre-built version; local source checkouts do not require local build steps.

Conclusion

dsh-file-link-menu brings file interaction experiences close to native desktop applications to the DSH Web UI. Through standardized context menus and path chip enhancements, developers can manage files and link resources more intuitively.

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

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

Xiaoye