DeepSeek Harness plugin: unified file import - byte-level upload store, file-list context injection, read_attachment/place_attachment tools, historical file bubbles
在 DeepSeek Harness 终端运行:
dsh plugin --profile web add re-itrt/dsh-file-fixDeepSeek Harness(DSH)上传体验优化插件:统一文件导入体系——任何后缀的文件都能
拖入 / 粘贴 / 点击选择,字节上传到附件库(不依赖工作区路径,服务器部署可用),
文件清单随消息注入模型上下文,历史消息下方显示文件气泡(可下载),agent 可读取内容
或导出到工作区。完全不使用 DSH 官方图片导入链路。
| 痛点 | 现状 |
|---|---|
| 非图片文件无法上传 | DSH Web 只收图片;非图片弹「仅支持 PNG、JPG、WebP、GIF」提示 |
| 拖入非图片后 overlay 卡住 | drop 后「拖入图片」界面不消失 |
| 无法点击选择文件 | 没有 file input |
| 粘贴只支持文本 | Ctrl+V 文件无反应 |
| 上传文件 agent 不可见 | 无文件清单注入,agent 只能猜路径(曾猜 75 步) |
filefix/persistFile)→ host 存入内容寻址附件库~/.dsh/attachments/filefix/(sha256 去重,manifest.jsonl 索引)——与工作区完全解耦agent/pre-step)注入文件清单消息(role=user + plugin 来源 + notice 表单:read_attachment:按 attachment_id 读取内容;支持分段(offset/limit/more,默认段.dsh-uploadux/reads/(官方 read 工具在 spill-policy 中豁免,可读全量)place_attachment:把附件字节导出到会话工作区任意路径(边界校验,防 ../ 逃逸)filefix/files 会话事件(ignorable)记录「消息 ↔ 文件」关联,客户端conversationEvents Definition + keyed renderer),/plugins/dsh-file-fix/download/<attachmentId>)src/ host 侧:filefix Typert Remote 服务(persistFile / limits / removeFile /read_attachment / place_attachment 工具 + 下载路由client/ 浏览器侧:document 级 drop/paste 拦截(捕获阶段)+ rail + 📎 选择按钮 +filefix-files Definition + keyed renderer,conversation.chat.node slot 下)+ 设置页(视觉辅助 / 附件清理)scripts/build-client.mjs client bundle 构建(esbuild CJS + __ModuleLoader__ 外壳,zod 内联)scripts/repair-sessions.mjs 会话日志修复工具(帧级 zstd 解压 → 清洗 → 重压;曾用于清除dsh plugin --profile web add dsh-file-fix
装完重启 dsh web 即生效(输入框出现「上传文件」按钮)。
已实测验证的完整生命周期(干净 profile 实测):
| 操作 | 命令 | 结果 |
|---|---|---|
| 全新安装 | dsh plugin --profile web add dsh-file-fix |
依赖 + 自动登记 bundles(插件树加载)✅ |
| 卸载 | dsh plugin --profile web remove dsh-file-fix |
依赖 + bundles 登记自动移除 ✅ |
| 重装 | dsh plugin --profile web add dsh-file-fix |
全部恢复 ✅ |
注意:pnpm 10+ 首次 add 可能报
[ERR_PNPM_IGNORED_BUILDS](dsh 官方依赖的原生模块构建被拦截,任何插件都如此)——此时再跑一次 add 即可(allowBuilds 已登记后 pnpm 干净退出,dsh 完成登记)。
# 1. 构建(需要 deepseek-harness 源码仓库的 node_modules 提供 tsc/esbuild)
npm install # 或 pnpm install(package-lock 已提交)
npm run build # host tsc 编译到 lib/ + esbuild 打包 dist/client.js
# 2. 挂载到 dsh profile(以 web profile 为例)
node scripts/mk-junction.cjs node_modules "<你的 dsh profile>/node_modules"
node scripts/mk-junction.cjs "<你的 dsh profile>/web/node_modules/dsh-file-fix" "$PWD"
# 3. 在 profile 的 cordis.patch.yml 里加载本插件(参照 cordis.dev.yml)
一次性准备:
# 1. 源码 checkout(master),pnpm install + build
# 2. profile 保持干净(不 npm install 任何 @deepseek-ai 包):
# ~/.dsh/profiles/web/ 里只有 package.json(bundles 声明)+ cordis.patch.yml
# —— 运行时会由 dsh 自动 heal 出 ~/.dsh/profiles/node_modules 源码链接
# 3. 本项目依赖解析指向 heal 产物(Linux/macOS 用 ln -s):
ln -s "$DSH_HOME/profiles/node_modules" node_modules # 或 npm install + 手动链接 @deepseek-ai 包
# 4. 让 profile 能以包名解析本项目(client 插件发现机制需要):
ln -s "$PWD" "$DSH_HOME/profiles/<profile>/node_modules/dsh-file-fix"
开发循环(在 deepseek-harness 目录跑):
pnpm dsh web --patch ../dsh-file-fix/cordis.dev.yml --port 3081
# host 改动:npm run build 后重启 dsh(lib/ 是包入口)
# client 改动:npm run build(重建 dist/client.js)+ 刷新页面
npm run typecheck # host + client 类型检查(用仓库的 tsc:
# node <repo>/node_modules/typescript/bin/tsc -p tsconfig.json --noEmit)
npm run build # tsc 编译宿主侧到 lib/ + esbuild 打包 client bundle
[dsh-file-fix] 前缀,全链路可还原:intake(入口/分流统计) → persistFile(校验/拒绝 code/写入路径/耗时) → ref injected(引用注入) → chip removed(删除),失败带 code(TOO_LARGE / EMPTY / SESSION_NOT_FOUND /
NO_WORKSPACE / WRITE_FAILED / INVALID_PATH / REMOVE_FAILED)。
见 docs/design.md(v0.2:完全不保留官方链路 + 照 Hermes 交互)。
登录后即可为该插件评分和评价。
还没有人评价这个插件,来抢个沙发吧!