dsh-fs-explorer

by lcj-up

2 会话与消息github收录于 08-23

dsh Web GUI 文件浏览器:非模态侧栏、文件预览、右键删除/加入对话

File explorer plugin for the dsh Web GUI: non-modal side panel, file preview, right-click delete / add-to-chat

安装

dsh plugin --profile web add github:lcj-up/dsh-fs-explorer

GitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试

安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗

安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。

README

目录

DeepSeek Harness (dsh) Web GUI 的文件浏览器插件:在侧边栏打开一个不遮挡对话的右侧文件面板,浏览工作目录、预览文件内容,并支持对文件/文件夹的常用操作。

功能

  • 不遮挡对话的停靠面板:点击左下角「文件」按钮,右侧滑出文件面板;面板只占用自己的区域,聊天区全程可点击、可输入(无需关闭面板即可继续对话)。
  • 目录树 + 文件预览:默认定位到当前会话的工作目录;点击文件夹展开子目录,点击文件在下方预览内容(文本 / 图片 / 二进制自动识别,大文件只预览前 1 MiB)。
  • 路径框:点击任意文件或文件夹,顶部的路径输入框即时显示其绝对路径;也可直接输入任意绝对路径回车跳转,支持返回上级、刷新。
  • 右键菜单(对文件/文件夹/空白区域):
    • 删除:删除文件或目录(目录递归删除,有确认提示;文件系统根目录与工作目录本身被拒绝删除)
    • 添加到对话:把当前路径追加到聊天输入框(有输入框时直接插入;没有时回退为复制到剪贴板)
    • 新建文件夹 / 新建文件:在当前目录创建
  • 重排联动:面板打开时,对话内容自动左移并在剩余空间重新居中。
  • 中英文界面,跟随深浅色主题;面板宽度可拖动调节。

安装

插件无需构建,直接链接到 dsh web 配置即可:

# 1. 克隆到本地
git clone https://github.com/LCJ-up/dsh-fs-explorer.git

# 2. 把插件链接进 profile 的 node_modules
mkdir -p ~/.dsh/profiles/web/node_modules
ln -s "$(pwd)/dsh-fs-explorer" ~/.dsh/profiles/web/node_modules/dsh-fs-explorer

# 3. 在 ~/.dsh/profiles/web/cordis.patch.yml 末尾追加:
#    - insert:
#        - id: fs-explorer
#          name: 'dsh-fs-explorer'

# 4. 重启 dsh web(客户端代码改动保存后 HMR 自动生效,不需要重启)

卸载

  1. 删除 ~/.dsh/profiles/web/cordis.patch.yml 中的 fs-explorer 行;
  2. 删除 ~/.dsh/profiles/web/node_modules/dsh-fs-explorer 链接;
  3. 重启 dsh web。

目录结构

dsh-fs-explorer/
├── package.json        # 插件清单(dsh.client 双端声明、./client 入口)
└── lib/
    ├── index.js        # 宿主端:/__fs 路由(列目录、预览、删除、新建、打开…)
    ├── client.js       # 浏览器端:侧边栏按钮 + 文件面板 + 右键菜单
    └── app.html        # 附带的独立窗口版文件浏览器页面

安全说明

  • /__fs 系列 HTTP 接口仅限本机回环(127.0.0.1 / localhost)访问,并做了 DNS 重绑定与跨站防护,与 dsh 自带特权接口同一防护级别。
  • 请勿把 dsh web 服务暴露到公网(或自行加反向代理/鉴权)。
  • 删除操作有确认提示,且拒绝删除文件系统根目录与工作目录本身。

已知限制

  • 对话重排的选择器:面板打开时让对话左移重排的那条 CSS 使用了 dsh 前端构建产物的哈希类名(当前为 .wSkVaW_root)。dsh 升级后若该类名变化,最坏只会让"对话重排"失效,面板本身完全不受影响。
  • 预览的图片上限 16 MiB、文本预览上限 1 MiB,超出部分截断显示。

开发

  • 客户端代码改动:保存后 dsh 的 client-hmr 热更新会自动生效(页面刷新更保险)。
  • 宿主端代码改动:需要重启 dsh web。
  • 无需任何构建步骤(lib/client.js 是手写的自包含 bundle,直接由 dsh 的模块系统加载)。

License

MIT


English

A file explorer plugin for the DeepSeek Harness (dsh) Web GUI: a non-modal right-side file panel in the sidebar — browse the working directory, preview files, and run common file operations without blocking the chat.

Features

  • Non-modal docked panel (chat stays fully interactive while open)
  • Directory tree + file preview (text / image / binary detection, 1 MiB text cap)
  • Click any file/folder → its absolute path shows in the path box; jump to any absolute path
  • Right-click menu: Delete (recursive, confirmed), Add to chat (inserts the path into the composer draft), New folder, New file
  • Conversation re-centers in the remaining space while the panel is open
  • Chinese/English UI, light/dark theme aware, resizable panel

Install

git clone https://github.com/LCJ-up/dsh-fs-explorer.git
mkdir -p ~/.dsh/profiles/web/node_modules
ln -s "$(pwd)/dsh-fs-explorer" ~/.dsh/profiles/web/node_modules/dsh-fs-explorer
# append to ~/.dsh/profiles/web/cordis.patch.yml:
#   - insert:
#       - id: fs-explorer
#         name: 'dsh-fs-explorer'
# restart dsh web

Security

The /__fs HTTP routes are loopback-only (127.0.0.1 / localhost) with DNS-rebinding and cross-site protection, matching the privileged /api methods. Do not expose the dsh web server to the public internet without extra auth.

License

MIT

原始 README: https://github.com/LCJ-up/dsh-fs-explorer/blob/main/README.md ↗