dsh-at-file
FSMargoo/dsh-at-fileCodex 风格的 `@file` 文件引用,输入框里直接搜索并引用工作区文件。
允许将任意文件上传给 DSH,按工作区与会话隔离。输入框内置文件库,服务端生成缩略图,右键菜单可打开、复制、重新下载或删除。
🇨🇳 中文: README.md
Upload any file to DSH — uploaded files are isolated per workspace and per session.
Best for: users running DSH on a standalone server — upload files straight from chat to the server, then @-reference them right away.
| Library window (upload / list / row actions) | Right-click action menu (6 actions) |
|---|---|
<workspace>/.uploaded_files/<sessionId>/ (hidden directory)_1/_2 suffix, and the @UPLOAD: reference always equals the actual file name on diskreaddir + stat (sorted by mtime descending — newest upload on top).thumbs/<original-name>.jpg inside the session directory; the listing endpoint skips dot-prefixed entries by design, so the library is never pollutedimmutable long-lived cacheffmpeg (images/video) and pdftoppm (PDF, poppler); if either is missing or fails, that file falls back to the original image (images) or a type badge (video/PDF) — uploads and the listing are unaffectednormalize(join()) must stay inside the session directory)sessionId strictly validated (UUID format); the workspace is resolved from the session's own header.cwd — client-supplied paths are never trustedPOST /uploads/prepare {sessionId, name, size} → {uploadId, putUrl, commitUrl, deleteUrl}PUT /uploads/<id> streaming upload (application/octet-stream, inline sha256)POST /uploads/<id>/commit {expectedSha256} → {name, displayName, absolutePath, size, createdAt}DELETE /uploads/<id> cancel (an already-committed id returns 404; the client swallows it)GET /sessions/<sessionId>/attachments directory listingGET /attachments/content?sessionId&name download / open (traversal-safe)GET /attachments/thumbnail?sessionId&name server-side thumbnail (lazy generation, image/jpeg + immutable cache; unsupported types 404 and the client falls back)DELETE /sessions/<sessionId>/attachments?name= delete a committed file (and its thumbnail)pnpm install
pnpm run build
dsh plugin --profile web add github:seeingrain/dsh-upload-file
# the host half needs a web restart; the client half loads on next page refresh
Local dev link: add "dsh-upload-file": "link:<path to this repo>" to
profiles/web/package.json dependencies, append dsh-upload-file to the
bundles list, then pnpm install.
MIT — see LICENSE.