boundless2619
dsh-paste-path
DSH 插件:复制文件后粘贴到聊天框,自动插入真实绝对路径(类似 codex cli)。
- Stars
- 1
- Language
- JavaScript
- Created
- Aug 15, 2026
- Updated
- Aug 15, 2026
Introduction
dsh-paste-path
A DSH (DeepSeek Harness) plugin: copy a file in Windows Explorer, paste it into the DSH chat input, and its real absolute path is inserted automatically — the Codex-style file reference flow, without leaving the browser.
Why this exists
Browsers never expose the real absolute path of a pasted file — clipboardData.files[].name only gives the basename, by security design. Codex can show full paths because it runs in a terminal, not a browser.
This plugin works around that with a simple trick: at paste time, the host half reads the Windows clipboard's file drop list (Get-Clipboard -Format FileDropList via PowerShell). When you Ctrl+C a file in Explorer, the clipboard keeps the full path list — so the host can recover the real absolute paths and send them back to the browser.
Requirements
| Thing | Requirement |
|---|---|
| OS | Windows (uses PowerShell Get-Clipboard) |
| Browser | Chromium-based (Edge / Chrome) |
| DSH | Web GUI running on the same machine & Windows session as the files |
| Note | DSH backend must be on the same PC as the browser (localhost setup works) |
Install & use
This is a dynamic Cordis plugin — no npm install needed; it lives for the current session (reload after a DSH restart if you need it again).
- In the DSH web GUI, call the
cordis_definetool:- paste
plugin/host-half.jscontent intocode.host - paste
plugin/client-half.jscontent intocode.client - any
idPrefix(e.g.fpst) and a name/purpose
- paste
- Call
cordis_runand approve the Run in the UI (the client half needs browser authorization). - Done. In Explorer,
Ctrl+Ca file (or folder / multiple files), thenCtrl+Vinto the DSH input box:- a single file →
D:\work\report.docx - a folder → its full path
- multiple files → each path, space separated
- a path containing spaces → wrapped in double quotes
- a single file →
Tip: pasting a screenshot (no file list on the clipboard) keeps DSH's original behavior — it's attached as an image, not turned into text.
How it works
Explorer Ctrl+C (file) ──► clipboard holds CF_HDROP file list
Browser Ctrl+V (composer)
│ window 'paste' listener (capture phase) takes over
▼
host.call('paste-paths', { files: [{name,size,type}] })
│
▼ host half runs (unconfined, read-only command):
│ Get-Clipboard -Format FileDropList ──► real absolute paths
▼
paths inserted at the caret (space-separated, quoted when needed)
Edge cases handled:
- Screenshot / image paste — clipboard has no file list → the plugin re-dispatches the paste so DSH's own image-attachment flow runs unchanged.
- Name mismatch (e.g. non-ASCII names through the pipe) — the pasted name filter is a preference, not a gate; the raw clipboard list is used when nothing matches.
- Clipboard read failure — falls back to inserting just the file names.
Sandbox note
The clipboard query runs with danger-full-access. The dynamic host half hangs under the host root context (it has no session object), so it cannot resolve a session-scoped sandbox policy; the ACL sandbox runner cannot start for the agentless fallback workspace root (its temp dir sits inside the fallback workspace). The command is fixed and read-only (pure clipboard read, no filesystem access), so running it unconfined is safe. If you want a session-scoped policy instead, resolve the policy with your session and pass sandboxPolicy explicitly.
Limitations / roadmap
- Windows only — the clipboard trick relies on PowerShell
Get-Clipboard. macOS (osascript/pbpaste) and Linux (xclip) support could be added on the same host half. - Dynamic lifetime — as shipped, the plugin is session-scoped and disappears on a DSH restart. A durable host-composition install (npm package with
dsh.clientmetadata +@RemoteRPC) is a natural follow-up. - Chromium only — the client half uses
DataTransfer/ClipboardEventand a capture-phase listener.