dsh-drag-path
dsh-plugin
- Stars
- 0
- Language
- JavaScript
- Created
- Aug 27, 2026
- Updated
- Aug 27, 2026
Introduction
dsh-drag-path
拖拽工程文件/文件夹进 DeepSeek Harness,自动定位真实绝对路径插入输入框
Drag non-image files & folders into DeepSeek Harness web — real absolute paths land in your composer, no more "only images allowed".
✨ 像 Codex / Claude Code 一样——拖入任意格式的文件或文件夹,路径直接进输入框,不用一个个打字,Agent 立刻知道你在说哪个文件,开发效率拉满。
Like Codex / Claude Code: drag in any file or folder (no format limit), the path lands in your composer instantly — no more typing paths by hand.
这是什么 / What is this
DSH 官方输入框的拖拽只接受图片(PNG/JPG/WebP/GIF),拖入工程文件会弹「仅支持 PNG、JPG、WebP、GIF 格式的图片」,让你完全没法把代码、文档、配置文件拖给 Agent 看。
本插件解决这个问题:拖入任意非图片文件或文件夹,自动定位它的真实绝对路径并插入输入框——Agent 直接就能读写原文件,像 Codex 一样顺畅。
The stock DSH composer only accepts image drags. This plugin intercepts non-image drags, locates the file's real absolute path on disk, and inserts it into the composer — so the agent can read and write the original file, just like Codex.
特性 / Features
- 📁 文件 & 文件夹都支持 — 拖
.swift/.xlsx/.ipa/ 目录… 都行 - 🎯 真实绝对路径 — 不是上传副本,Agent 操作的就是你的原文件
- 🔍 智能定位 — 优先当前工作区,再常见目录(Downloads/Desktop/Documents/Home),
find精确名匹配 +mdfind补充 + 大小校验 - 📍 就近适配 — 批量拖入的同目录文件,用前一个已定位路径作线索,秒级命中
- 🧩 同名多候选弹选择器 —
README.md这种全盘同名文件,弹出候选列表让你点选(工作区内项高亮) - 📋 支持粘贴文件 — 复制文件后 Ctrl+V 也能插入路径
- 🖼️ 图片不受影响 — 图片拖拽照常走官方流程
- 🔄 批量拖入 — 一次拖多个文件,逐个定位插入,换行分隔
- 👁️ 拖拽视觉反馈 — 拖文件到窗口时显示「松开以插入文件路径」提示条
安装 / Install
dsh plugin --profile web add https://github.com/Rudyy898/dsh-drag-path
或从市场安装(若已收录)。重启 dsh web,刷新浏览器(⌘⇧R)即可生效。
Or install from the plugin market once listed. Restart dsh web and hard-refresh the browser (⌘⇧R).
使用 / Usage
直接从 Finder/资源管理器把文件或文件夹拖到 DSH 页面任意位置:
- 唯一命中 → 绝对路径直接插入输入框:
/Users/you/Downloads/project.xlsx - 同名多候选 → 弹出选择器,点选正确的路径
- 找不到 → 插入文件名(控制台有提示)
Drag any file or folder onto the DSH page:
- Unique hit → absolute path inserted:
/Users/you/Downloads/project.xlsx - Name collision → a picker lists the candidates, click the right one
- Not found → filename inserted (console logs the reason)
原理 / How it works
浏览器拖拽 / 粘贴文件(File 对象:只有 name/size,没有路径)
│
▼
client capture 阶段拦截(官方 toast 被阻断,蒙版手动复位)
│ POST /api/drag-path/locate { fileName, sizeBytes, sessionId, hintPath }
▼
host 定位:会话工作区优先 → 常见目录 → Home;find 精确匹配 + mdfind 补充
│ 就近适配:hintPath 同目录优先;目录直接采用 / 文件按大小校验
▼
唯一命中 → 插入绝对路径;多候选 → 弹选择器;无结果 → 文件名
为什么拿不到路径:浏览器安全沙箱只暴露
File对象(name/size/type),不提供绝对路径——任何网页插件都无法直接从拖拽事件读取路径。本插件通过 host 端(Node)按文件名+大小在文件系统里定位,绕开了这个限制。
Why no path from the browser: the web sandbox only exposes
File(name/size/type) — no absolute path is available to any web plugin. This plugin locates the file on the filesystem from the host side (Node) by name + size.
目录结构 / Structure
dsh-drag-path/
├── package.json # dsh.bundle + dsh.client 声明
├── cordis.patch.yml # 插件装载补丁
├── lib/
│ ├── index.js # host:/api/drag-path/locate 路由
│ ├── locate.js # find + mdfind 定位逻辑
│ └── client.js # 浏览器端 capture 拦截 + 候选选择器
└── README.md
平台支持 / Platforms
- 🍎 macOS —
find精确名匹配 +mdfind(Spotlight) 补充 - 🪟 Windows — PowerShell
Get-ChildItem递归 +where全局;支持中文目录名(下载/桌面/文档) - 搜索顺序:当前工作区 → 平台常见目录(下载/桌面/文档)→ 全局兜底
配置 / Configuration
无需配置。所有行为开箱即用。
No configuration needed.
许可证 / License
Made with ❤️ for the DSH community.