Skip to content
dsh.fish
Bundle

dsh-upload

Upload local files into the DeepSeek Harness session workspace: a 📎 button in the web composer, raw bytes saved under .uploads/<sessionId>/, the absolute path appended to the draft so the agent can read it (pair with dsh-word-docs for document workflows)

Source
Ei-Ayw
License
MIT
Updated
Updated 22 hours ago

Readme

# 📎 dsh-upload

给 DeepSeek Harness Web 加一个**真正的"上传文件"按钮**——回答社区 [#867](https://github.com/deepseek-ai/deepseek-harness/discussions/867)("为什么连个上传文件的按钮都没有?")。

- **点 📎 → 选本地文件 → 字节落盘到会话工作区** `.uploads/<sessionId>/` → 绝对路径自动追加进输入框
- 路径**可见、可编辑**:你清楚知道发给 AI 的是什么,发之前随时删改
- AI 用自带的 fs 工具直接读落盘文件;配合 [`dsh-word-docs`](https://github.com/Ei-Ayw/dsh-word-docs) 就是完整文档工作流:**上传 → 处理 → 产出正式 Word**
- 纯浏览器原生 API + 一个 POST 路由,无第三方依赖

## 演示

![dsh-upload 演示:点 📎 选文件,路径自动进入输入框](docs/upload-demo.gif)

点 **📎** → 选择本地文件 → 字节落盘到会话工作区,绝对路径自动追加进输入框(可见、可编辑、可删除)→ 发送后 AI 用 fs 工具直接读取。

## 安装

```sh
dsh plugin --profile web add github:Ei-Ayw/dsh-upload
# 重启 dsh Web → composer 工具行左端出现 📎
```

## 使用

1. 打开一个会话,点输入框左侧的 **📎**
2. 选择本地任意文件(PDF / Word / Excel / 图片 / 压缩包…)
3. 输入框自动追加一行 `📎 /绝对路径/…`,点发送
4. AI 用 fs 工具读取该文件并处理

> 落盘位置:`<工作区>/.uploads/<会话ID>/<原文件名>`。上传的文件属于该会话工作区,随时可以在文件管理器里看到、删除。

## 与同类插件的对比

| 插件 | 方式 | 差异点 |
| --- | --- | --- |
| **dsh-upload(本插件)** | 真上传字节 → 工作区落盘 | 路径透明可见、可编辑;文件真正进入工作区,任何 fs 工具可读;实现最简 |
| dsh-file-beam | 拖拽后**按文件名搜本地路径**(零拷贝) | 只匹配工作区/下载/桌面/文档目录;不传字节,文件不在工作区 |
| dsh-files | 上传 + 会话隔离解析 | 字节存会话隔离目录,解析成文本给模型 |
| dsh-file-upload | 拖放 + MarkItDown 解析 | 侧重"读"成文本进输入框 |
| dsh-user-addons | 拖拽 + 归档管理 | 附加功能多,体积大 |

定位:**最直接的"上传按钮",字节真实落盘工作区,路径完全透明**,适合和文档生成类插件搭配。

## 配置(可选,cordis.patch.yml 或插件设置)

```yaml
- id: dsh-upload
  config:
    maxBytes: 52428800      # 单文件上限,默认 50MB
    subDir: '.uploads'      # 工作区内落盘目录
```

## 安全设计

- 路由仅接受**同源**请求(校验 Origin/Host)
- 文件名净化:只取 basename、剥离路径与控制字符,杜绝路径穿越
- 大小硬限制(默认 50MB,超限 413)
- 原子写入(临时文件 + rename),失败不留残渣
- 会话 ID 净化后才进入路径

## 测试

```sh
node --test
```

覆盖:文件名/会话净化、原子落盘、大小限制、路由级集成(200/413/403)。

## 目录结构

```
dsh-upload/
├── lib/index.js     # Host: 上传路由 + 落盘逻辑
├── lib/client.js    # 浏览器: 📎 按钮 + 草稿注入
├── cordis.patch.yml # bundle 补丁层
├── docs/            # README 素材(演示 GIF)
└── tests/
```

## 已知限制

- 单文件上传(v1);无拖拽、无历史消息文件卡片(可后续加)
- 上传不自动解析内容——"解析/读取"交给 AI 的 fs 工具或配套插件

## License

MIT

Install

dsh plugin --profile web add github:Ei-Ayw/dsh-upload

Profile: web

  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source