Skip to content
dsh.fish
Bundle

attach-plus

DSH web-ui plugin: '/' glyph on the composer command-menu button plus a '+' attach button with separated image/document/other uploads.

Source
BaihaWhite
stars
1 stars
License
MIT
Updated
Updated 5 days ago

Readme

<p align="center">
  <img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-0B7285?style=flat-square">
  <img alt="DSH: Web" src="https://img.shields.io/badge/DeepSeek%20Harness-Web-5B4CF0?style=flat-square">
  <img alt="Topics" src="https://img.shields.io/badge/topic-dsh--plugin-5B4CF0?style=flat-square">
  <img alt="Node.js" src="https://img.shields.io/badge/Node.js-%3E%3D20-339933?style=flat-square&logo=nodedotjs&logoColor=white">
</p>

# attach-plus · DSH Web 输入框「/」指令按钮 + 「+」分类上传插件

> DeepSeek Harness 的 web-ui 插件(双面 bundle)。改造对话输入框:
> 原指令菜单的「+」按钮显示为「/」字形,新增「+」按钮分类上传
> **图片 / 文档 / 其他文件**。

## 功能

- **「/」指令按钮**:输入框左侧原「+」指令按钮改为显示「/」字形(点击行为不变,
  仍打开指令菜单,键盘上下选择 / 回车执行)。
- **「+」上传按钮**:新增圆钮,弹出「图片 / 文档 / 其他文件」菜单,调起浏览器原生文件选择器:
  - **图片**(png / jpeg / webp / gif)→ 走 DSH 原生草稿图片管线:缩略图栏、
    限额校验(单张 5MB / 每条 20 张 / 总量 100MB)、随消息以 image block 发送;
  - **文档**(pdf / office / 文本 / csv 等)与其他文件 → 经
    `POST /api/dsh-attach-plus/upload` 落盘到会话工作区 `uploads/` 目录,
    并在草稿末尾追加「附件: 路径」行,模型借助自身文件工具读取。

## 安装

**命令行(推荐):**

```bash
dsh plugin --profile web add github:BaihaWhite/attach-plus
```

**插件商店(设置 → 插件 → 插件商店,搜索 `attach-plus`):**

1. 在商店搜索框输入 `attach-plus`(仓库已打 `dsh-plugin` topic);
2. 卡片点「安装」,等待 pnpm 安装完成;
3. **重启 DSH**,刷新页面生效。

**手动(profile 补丁 + 符号链接):**

```bash
# 包体放任意目录,符号链接进 profile 的 node_modules
ln -s /path/to/attach-plus ~/.dsh/profiles/web/node_modules/attach-plus
# ~/.dsh/profiles/web/cordis.patch.yml 追加:
# - insert:
#     - id: attach-plus
#       name: 'attach-plus'
#       config: {}
```

## 架构

```
Client (conversation.input.left 槽, replaceRisk: none)
  ├─ AttachPlus 组件:+ 按钮 / 菜单 / 三个隐藏 file input / toast
  ├─ 图片 → conversation.createDraftImages(files) → inputActions.addImages(ids)
  ├─ 文档/其他 → file.arrayBuffer() → base64 → fetch POST /api/dsh-attach-plus/upload
  └─ 加载期注入 CSS:字形替换 + 按钮/菜单/toast 样式(主题变量)

Host (webServer 路由 /api/dsh-attach-plus/upload)
  ├─ 校验(size ≤ 20MiB、base64 长度、文件名清洗、loopback)
  ├─ sessions.get(id).header.cwd(兜底 sessionPersistence.list())→ 工作区
  └─ shell.resolve({command:'mkdir -p uploads && base64 -d > …', workdir,
                    stdin:base64, sandboxPolicy}) → shell.run
```

## 限制

- 提示词协议仅支持 text / image 块,无文档块类型——文档以「落盘 + 草稿路径引用」交付;
- 浏览器端文件选择器为浏览器原生对话框,无法由插件替代;
- 上传上限 20MiB/文件(客户端 + Host 双重校验)。

## 插件商店上架

仓库已满足商店一键安装的全部前置(详见 `docs/STORE.md`):

- `package.json` 在**仓库根**,声明 `dsh.bundle.patch` + `dsh.client`(商店预检硬性条件);
- 仓库 topics:`dsh-plugin`(商店目录搜索)、`dsh` / `deepseek-harness`(已收录判定)、`web-ui`;
- 构建产物(`lib/`)直接入库,无构建步骤,`pnpm add github:owner/repo` 即装即用。

## 开发

```bash
node --check lib/index.js   # Host 半语法检查
node --check lib/client.js  # 浏览器半语法检查
```

设计文档见 [`docs/DESIGN.md`](docs/DESIGN.md)(含网络调研案例)。

## 许可证

[MIT](LICENSE)

Install

dsh plugin --profile web add github:BaihaWhite/attach-plus

Profile: web

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