Passer au contenu principal
H

dsh-file-attach

henryhuuu/dsh-file-attach

Adds a 'file' row to the DSH web GUI composer plus menu: pick images (native composer thumbnails) or arbitrary files (video/audio/Office/PDF, up to 50MB), stored in the DSH home and inserted into the draft as native file reference chips the agent can read

Installer

dsh plugin --profile web add github:henryhuuu/dsh-file-attach

README

dsh-file-attach

给 DSH Web GUI 输入框的加号(+)菜单增加一行 file(上传文件):点开即系统文件选择器,图片走 composer 原生图片通道,其他文件(视频、音频、Office、PDF、压缩包等)上传到 DSH home 并以原生文件芯片插入草稿。发送后 agent 收到文件路径,已发送气泡渲染为文件名芯片。

Adds a file row to the DSH web GUI composer plus menu: the OS file picker opens directly. Images ride the composer's native image channel; every other file (video, audio, Office, PDF, archives, …) is uploaded to the DSH home and inserted into the draft as a native file chip. After sending, the agent receives the file path and the sent bubble shows a filename chip.

特性 / Features

  • 一步选文件 / One-step pick:点击 file 直接打开系统文件选择器;选择多久都有效,取消即静默结束,可再次点开。 Clicking file opens the OS file picker directly; however long the pick takes, it stays valid. Cancelling ends in silence — just open it again.
  • 图片原生通道 / Native image path:图片以缩略图进入 composer 草稿,随消息发送(与粘贴/拖入的图片同机制)。 Images join the draft as thumbnails and ride the message like pasted or dropped images.
  • 其他文件芯片 / Chips for other files:上传后以原生 @文件 引用的同款芯片(强调色图标 + 文件名)插入草稿。 Other files are inserted as chips with the same native look as @file references (accent icon + filename).
  • 发送即路径 / Path on send:发送时芯片展开为文件绝对路径的 @mention,agent 直接读取本地文件;文件字节不进入会话日志。 At send time each chip expands to an @mention of the file's absolute path, which the agent reads locally; file bytes never enter the conversation log.
  • 限制 / Bounds:单文件 ≤ 50MB,一次 ≤ 10 个。 Up to 50 MB per file, 10 files per pick.
  • 零依赖 / Zero dependencies:无第三方运行时依赖,无构建步骤。 No third-party runtime dependencies, no build step.

安装 / Install

dsh plugin --profile <profile> add dsh-file-attach

或在 DSH 桌面端「设置 → 插件市场」搜索 dsh-file-attach 安装。 Or search dsh-file-attach in the DSH desktop settings → plugin market.

手动 / Manual(无需 npm 安装 / without an npm install)

# 1) 链入 profile 的 node_modules
ln -s /path/to/dsh-file-attach ~/.dsh/profiles/<profile>/node_modules/dsh-file-attach

# 2) profile 的 package.json:dependencies 加
#    "dsh-file-attach": "file:/path/to/dsh-file-attach"
#    (dsh.profile.bundles 数组同步追加 "dsh-file-attach")

重启 DSH 后加号菜单出现 file 行。Restart DSH; the plus menu then shows the file row.

消息形态 / Message form

@/Users/you/.dsh/uploads/v1/files/<sha256>/report.pdf

含空格或引号的路径使用引号形态 @"…"。The quoted form @"…" is used when the path contains whitespace or a quote.

存储 / Storage

<dsh-home>/uploads/v1/
├── files/<sha256>/<文件名>    # 文件本体 / the file
└── files/<sha256>.json        # 元数据 / meta sidecar

内容寻址:相同内容得到相同 id(天然去重,同名重传覆盖)。文件名经消毒(去除路径段、控制字符、引号);超过 28 码点的名称中间省略(前 16 + + 后 10,按码点计数以公平对待中文)。存储不过期。

Content-addressed: identical content maps to the same id (deduplication for free; re-uploading under another name replaces the file). Names are sanitized (no path segments, control characters, or quotes); names longer than 28 code points are middle-abbreviated (first 16 + + last 10, counted in code points so CJK names are judged fairly). Stored files do not expire.

路由 / Routes(宿主半边 / host half)

路由 / Route说明 / Description
POST /file-attach/upload{data: <base64>, name?, mimeType?}{ok, value: {id, name, size, mimeType, path, url, createdAt}}
GET /file-attach/raw/<id>回传存储的字节(按 sha256 校验完整性)/ serves the stored bytes (digest-verified)

超过 50MB 返回 413;id 不存在或校验失败返回 404。Over-size uploads answer 413; unknown ids or digest mismatches answer 404.

依赖 / Requirements

  • DSH ≥ 0.1.1-rc.1(web 客户端服务:commandUiconversationlocalesessionsinputTriggers
  • Node ≥ 22.19 或 ≥ 24(宿主半边)

许可 / License

Apache-2.0(见 / see LICENSE)。

Plugins associés