Back to home@zurrll

dsh-file-explorer

DSH Web GUI 文件资源管理器:右侧文件树抽屉,拖拽粘贴路径,双击打开,右侧取消区

Stars
0
Language
TypeScript
Created
Aug 18, 2026
Updated
Aug 18, 2026
GitHub repo

Introduction

@zurrll/dsh-file-explorer

DSH Web GUI 的文件资源管理器:右侧浮动文件树抽屉,显示当前会话工作目录结构。

English · README.en.md

screenshot

  • 拖拽任意文件/目录到对话框输入框 → 路径在光标处插入(全程插件接管,不依赖浏览器原生行为)
  • 后悔:拖到页面最右侧红色「取消」区松手 = 取消放置(按 Esc 亦可)
  • 双击:文件 → 系统默认应用打开;目录 → 展开/折叠
  • 会话切换自动跟随新工作目录;明暗主题自适应;超大目录自动截断防卡死

功能一览

能力说明
文件树懒加载展开(目录在前、按名排序),行数 600 / 深度 20 上限
拖放粘贴document 级接管:整页合法放置目标(防浏览器搜索劫持);execCommand('insertText') 光标处插入,连续拖放稳定
取消机制右侧 48px 取消区(红色高亮)+ Esc 原生取消
双击打开workspaces.openPath 系统默认应用
根目录会话 cwd 自动跟随;顶部根目录条点击回到会话目录;↻ 刷新
主题全部 --dsw-alias-* token,浅色/深色模式自动适配
侧栏开关sidebar.footer.action,宽模式自动换行独占一行(:has() 检测容器),窄条模式 36px 圆形

架构

host  (src/index.ts)      webServer JSON API(cordis 服务注入)
  POST /dsh-file-explorer/api/list-dir   { path }      → { ok, entries: [{name,path,type}] }
  POST /dsh-file-explorer/api/get-root   { sessionId } → { ok, cwd }
  ├─ fs.resolve + fs.listDir + fs.processPath(宿主文件系统,跨平台路径)
  └─ agents.get(sessionId).session.header.cwd → sandboxPolicy.workspaceRoot 兜底

client (src/client/index.ts)  React(tsdown → lib/client.js,ModuleLoader 注册)
  ├─ shell.overlay          fexpl-drawer     文件树抽屉
  ├─ shell.overlay          fexpl-cancelzone 拖放取消区
  ├─ sidebar.footer.action  fexpl-toggle     开关按钮
  ├─ fetch POST API(host 通信)
  └─ document 级 dragover/drop 接管(自定义 MIME: application/x-dsh-fexpl-path)

安装

要求:DSH Web GUI(webServer / fs / agents / sandboxPolicy 核心服务)。

# 方式 A:dsh-super-injector 运行时注入(免重启)
# 对 AI 说:dev_inject_plugin <解压目录>

# 方式 B:官方装配(重启后由 bundles 接管)
dsh plugin --profile web add github:zurrll/dsh-file-explorer
# 或 npm 包
npm pack @zurrll/dsh-file-explorer
dsh plugin --profile web add <解压目录>

开发

# 构建(host tsc + client tsdown)
bash scripts/build.sh && npm run build:client

# 注入运行(dsh-super-injector 环境)
# 对 AI 说:dev_inject_plugin <本目录>

# 改代码 → 构建 → 自动 watch 约 1.5s 重载(或 dev_reload_package)

peerDependencies 全范围声明,DSH 升级不报废。

发布

License

MIT © zurrll