Introduction¶
In the DeepSeek Harness (DSH) web client, dragging a file from the right-side file tree into the chat input to insert a reference is a common workflow that hasn’t been natively wired up. Existing options either only support dragging or lack a chip-based UI. This plugin fills that gap by supporting both drag-and-drop and right-click entry points, turning file/folder rows directly into @path reference chips.
Plugin Overview¶
- Name: dsh-plugin-drag-reference
- Maintainer: GandalfGao
- Category: Client
- Function: Drag a row from the right-side “Files” panel into the chat input (or right-click the row) to insert an
@pathreference chip. - Version: 0.1.1 (from package.json)
Core Features¶
Drag-and-drop and right-click share the same resolution and insertion logic, so both entry points behave identically.
Drag Behavior¶
- Hold a file row or folder row in the right-side file tree and drag rightward beyond 6px to initiate a drag.
- The cursor changes to a grab hand, and a small label appears showing the file name.
- When dropped over the composer area, the label turns blue, and releasing inserts a reference chip (file/folder icon + file name, consistent with the behavior of selecting from
@autocomplete). - Upon submission, it serializes to
@relative/path:
- Folders get a trailing slash:@src/
- Paths containing spaces are automatically quoted:@"file with spaces.doc" - After insertion, focus returns to the input field so you can keep typing.
- If the drop target is outside the composer or belongs to a different session’s composer, nothing happens.
- Press
Escduring a drag to cancel. - A short press (displacement < 6px) still triggers the original “click to open preview” behavior and won’t accidentally initiate a drag.
Right-Click Menu¶
Right-click any file row or folder row to open a context menu:
@src/app.ts ← Shows which file this row is (selectable, copyable)
@ Reference in Chat ← Identical insertion to drag-and-drop; click or press Enter
- The file tree originally had no context menu; this plugin replaces the browser’s native menu (only on file rows).
- Pressing
Esc, clicking outside the menu, scrolling the file tree, or switching sessions will close the menu. - Focus lands on a menu item when opened, so you can press Enter directly.
Differences from dsh-drag¶
| This Plugin | dsh-drag | |
|---|---|---|
| No drag preference | Right-click file row → “@ Reference in Chat” | Drag only |
| Drag visuals | Follows-cursor label, turns blue on drop target | Only the browser’s native drag ghost |
| Chip rejected | Degrades to plain text @path; the action is not lost |
Shows a failure message; nothing is inserted |
| Left-side session rows | Not supported | Supported |
Compatible Versions¶
engines.dsh: ">=0.2.1-rc.5 <0.3.0-0", verified on a real device with DSH 0.2.2-rc.5.
The plugin relies on several undocumented host seams. If DSH upgrades change the chip channel, insertion will degrade to plain text @path, and a warning will appear in the console.
Installation & Activation¶
Method 1: Bundle Install (Recommended)¶
Published on npm:
dsh plugin --profile web add dsh-plugin-drag-reference
Or install directly from GitHub:
dsh plugin --profile web add github:GandalfGao/dsh-plugin-drag-reference
You can also manually add the package name to the dsh.profile.bundles array in the profile’s package.json, then restart the app:
"dsh": { "profile": { "bundles": ["dsh-plugin-drag-reference"] } }
Method 2: Local Development Install¶
Link the plugin directory into the profile so you don’t need to reinstall after code changes:
// <your_user_dir>\.dsh\profiles\desktop\package.json
"dependencies": {
"dsh-plugin-drag-reference": "link:<absolute_path_to_plugin_dir, use_forward_slashes>"
}
# <your_user_dir>\.dsh\profiles\desktop\cordis.patch.yml
- insert:
- id: drag-reference
name: dsh-plugin-drag-reference
Then install dependencies in the profile directory (using the desktop app’s bundled node + pnpm):
& "$env:USERPROFILE\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies\node\bin\node.exe" `
"$env:USERPROFILE\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies\pnpm\bin\pnpm.cjs" install
Note: Do not use both methods simultaneously—both will insert a
drag-referenceentry, causing the Loader to report a duplicate id. Remove the other method before switching, then restart.
Uninstallation¶
Simply delete the - insert: block from cordis.patch.yml. To fully remove, also delete the dependencies entry and re-run pnpm install.
Implementation Notes¶
- Uses a single invisible
conversation.input.dockentry to hook into the session-level standard propertyinputActions; no visible UI is added. - Chips use the same internal channel as selecting from
@autocomplete, employing the autocomplete pick shape so rendering, serialization, and click-to-preview behavior are consistent with built-in. - Fallback uses the public
InputActions.captureInsertion()+insertText(text, span): if the input is in a submitting/arbitrating state, the chip degrades to plain text@pathand a warning is logged in the console. - Drag and right-click share the same resolution and insertion logic, so the two entry points won’t drift apart.
- The menu is self-drawn (
role="menu"/role="menuitem") with no dependency on the product’s menu component. - Relies on
data-files-entry/data-files-pathon file tree rows,data-files-rooton the container, and thedata-conversation-region="composer"/data-conversation-sessionDOM contract on the composer.
Known Limitations¶
shell.addFiles()andconversation.input.for()are not documented public APIs. After a DSH upgrade, if this layer changes, chips will fall back to plain text without crashing, but realignment will be needed.- Verified only in the desktop window (
dsh-app://); it also works in browser tabs since it doesn’t depend on real file paths. - Dragging a folder in only creates an
@dir/reference and does not recursively expand its contents; clicking a folder chip won’t open a preview (the built-in behavior is alsofalse). - The right-click menu only works on the file tree and replaces the browser’s native menu; tree rows don’t have a “current row” focus model, so only right-click is available for now—a pure keyboard path awaits the product to provide row focus.
- The host writes
~/.dsh/cache/dsh-plugin-drag-reference/mounted.jsonas a load probe; if unneeded, you can delete thattryblock inlib/index.js. - After modifying
lib/client.js, the browser needs to pick up the new version by reloading the plugin entry (setdisabled: truethen remove it, or restart the app); a simple page refresh may not suffice because the host computes version numbers based on mtime/size.
Use Cases & Notes¶
Suitable for users who frequently reference files/folders from the file tree in the DSH web client. The plugin runs with the current dsh process’s permissions; review the source code and license before installing.
Conclusion¶
This plugin offers an alternative trade-off for the “from list to draft” drag path: it supports both right-click and drag-and-drop entry points, provides cursor-following visual feedback during drag, and degrades to plain text when a chip is rejected rather than failing silently. For the directory page or source code, visit:
- Directory page: https://www.skillhub.cn/plugins/GandalfGao/dsh-plugin-drag-reference
- GitHub: https://github.com/GandalfGao/dsh-plugin-drag-reference