Back to home@lzxcs

paste-file-path-pro

Pasting non-image files into the web composer inserts their paths as @file references (host-side clipboard reading).

Stars
0
Language
JavaScript
Created
Aug 26, 2026
Updated
Aug 26, 2026

Introduction

paste-file-path-pro

安装(Install)

需要 DSH(DeepSeek Harness)与 web profile(dsh web):

# 1. 安装插件(pnpm git 依赖)
dsh plugin --profile web add github:lzxcs/paste-file-path-pro
# 2. 在 ~/.dsh/profiles/web/cordis.patch.yml 末尾追加注入块:
- insert:
    - id: paste-file-path-pro
      name: 'paste-file-path-pro'
# 3. 重启 DSH Web(托盘菜单 → DSH Web 重启),浏览器 Ctrl+F5 刷新页面

卸载:dsh plugin --profile web remove paste-file-path-pro,并删掉 cordis.patch.yml 中的注入块。

把粘贴到输入框的非图片文件自动转换为文件路径引用(@path),让模型可以直接读取文件内容。

行为

  • 图片(image/png|jpeg|webp|gif)粘贴行为不变:仍作为图片附件进入图片轨道。
  • 任何非图片文件粘贴到主输入框(capture 阶段判定 clipboardData.items):
    1. 插件阻止本次粘贴默认行为;
    2. 询问宿主路由 /__paste-file-path-pro/clipboard(Node half 读 Windows 系统剪贴板的 FileDropList);
    3. 读到路径 → 以 @path 文本注入输入框(含空格路径用 @"path" 引号语法;多文件一行一个);
    4. 读不到(非 Windows、剪贴板非文件、读取失败)→ 原样重放粘贴,回退到内置管线(与未安装插件时完全一致)。
  • 只作用于主 composer 输入框([data-composer-card] 内),其它输入框不受影响。

结构

paste-file-path-pro/
├── package.json   # dsh.client: platform=web; exports["./client"] 为浏览器半区
├── lib/index.js   # Node half: ctx.inject(['webServer']) 注册回环路由,spawn
│                  #   powershell.exe(STA) + WinForms Clipboard.GetFileDropList()
└── lib/client.js  # Browser half: document capture-phase paste 监听 + 合成粘贴重放

安装方式与 dsh-enter-swap / edit-diff-pro 相同:目录放入 ~/.dsh/profiles/web/, profile package.json dependencies 加 "paste-file-path-pro": "file:./paste-file-path-pro", cordis.patch.yml insert 插件行,profile 目录 pnpm install,重启 dsh web

限制

  • 仅 Windows:路径来自 GetFileDropList()(CF_HDROP);macOS/Linux 宿主返回 supported: false,行为与未安装一致。
  • 浏览器安全模型禁止 Web 页面读取剪贴板文件的绝对路径,所以必须由宿主读剪贴板, 这是本插件存在的全部原因。
  • 路径注入依赖 file-reference 语法 @path / @"path";路径含引号或控制字符时跳过该文件。