schhaohao/dsh-file-explorer

DSH(DeepSeek Harness) 插件:一个 VS Code 风格的工作区文件浏览器,嵌入 DSH Web GUI 的右侧面板列。

catalog 简介 / catalog descriptioncatalog description:dsh-file-explorer

项目介绍Project Overview

DSH 工作区文件浏览器插件,嵌入 Web GUI 右侧面板。支持懒加载目录树、语法高亮、Markdown 预览,按会话隔离文件访问。适合在会话中浏览代码或文档。注意:详情列同一时刻仅支持一个占用者,启用时工具详情会被替代。

A workspace file explorer plugin for DSH Web GUI, embedded in the right-side details column. It provides a lazy-loaded file tree, syntax highlighting for common languages, and Markdown preview with source toggle. File access is scoped per session via realpath fencing. Use it to browse or preview files within the current workspace. Caveat: the details column supports only one occupant at a time, so tool-call details are replaced while this plugin is active.

或使用命令行安装(适合开发者)Or use CLI install (for developers)

命令行安装CLI Install

dsh plugin --profile web add github:schhaohao/dsh-file-explorer

schhaohao/dsh-file-explorer 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-file-explorer

DSH(DeepSeek Harness) 插件:一个 VS Code 风格的工作区文件浏览器,嵌入 DSH Web GUI 的右侧面板列。

type platform

功能

  • 📂 嵌入右侧详情列的文件树,与会话头部「📁 文件」按钮联动,可随时显示/隐藏
  • ▾ 目录懒加载展开/折叠,目录优先排序,自动过滤 . 开头的隐藏文件
  • 📄 文件预览:带行号、文件大小;二进制文件与超大文件(>512KB)安全拦截,超过 3000 行自动截断
  • 🖌 代码语法高亮:JS/TS/Python/Go/Rust/Java/C/C++/Bash/Ruby/PHP/SQL/JSON/CSS/HTML/YAML 等,零依赖正则实现,跨行注释与字符串正确处理
  • 📝 Markdown 渲染预览:.md 默认渲染(标题/列表/代码块/表格/引用/链接),代码块内同样高亮,一键切换「预览 / 源码」
  • 🎯 根目录自动定位为当前会话的工作区;Host API 按会话 realpath 围栏,无法读工作区外的文件
  • 🎨 全部配色使用 GUI 主题变量(--dsw-*),浅色/深色主题下均为原生观感

安装

本仓库是一个标准的 DSH 双面插件包(Host + Browser)。有两种使用方式:

方式一:快速试用(动态插件,重启后失效)

在任何 DSH 会话里直接对 Agent 说:

读取 https://github.com/schhaohao/dsh-file-explorer 里的 dynamic/host.js 和 dynamic/client.js,用 cordis_define 定义成一个新插件(code.host / code.client 分别填两个文件的内容),然后 cordis_run 运行。

Agent 会完成定义和激活,你在 GUI 里批准一次即可使用。适合先试试效果。

方式二:永久安装(组合配置,重启后仍在)

把本包装进你的 DSH profile 组合:

# 1. 把包放到 profile 的 node_modules(~/.dsh 是默认 DSH_HOME)
cd ~/.dsh/profiles/node_modules
git clone https://github.com/schhaohao/dsh-file-explorer.git dsh-file-explorer

如果你装了 pnpm,也可以更规范地安装:把仓库 clone 到任意位置(如 ~/.dsh/profiles/web/plugins/dsh-file-explorer), 在 ~/.dsh/profiles/web/package.jsondependencies 里加 "dsh-file-explorer": "file:plugins/dsh-file-explorer", 然后在 ~/.dsh/profiles/web 下运行 pnpm install

# 2. 在 profile 的 patch 层注册插件行
#    编辑 ~/.dsh/profiles/web/cordis.patch.yml,加入:
- insert:
    - id: dsh-file-explorer
      name: dsh-file-explorer
# 3. 重启 dsh web 进程,打开 GUI 即生效

工作原理

文件 运行位置 职责
lib/index.js DSH Node.js 进程 webServer 上注册 /dsh-file-explorer/api/* JSON 路由(root/list/read);用 ctx.sessions 定位会话工作区,realpath 围栏防越界
lib/client.js 浏览器页面 window.__ModuleLoader__ 格式 bundle;注册 details Slot(右侧面板)与 conversation.session.header.utilities Slot(开关按钮),fetch 调用 Host API
dynamic/ 方式一使用的动态插件源码(cordis_define 的 code.host / code.client)

包通过 package.jsondsh.client 声明被 DSH 的 client-modules 扫描发现,浏览器半由 /plugins/dsh-file-explorer/client.js 提供。

⚠️ 已知取舍:details 列同一时刻只能有一个占用者。插件运行期间,点击工具调用打开的详情列会显示文件浏览器而不是工具详情;移除插件行后恢复。

许可证

MIT

上一个 Prev dsh-deepseek-status 下一个 Next dsh-better-chat-history