Skip to content

About

DeepSeek Harness Web 插件:会话视图"文件"标签页——工作区文件只读浏览(Markdown 渲染 / 移动端单栏适配)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dsh-plugin-file-tab

DeepSeek Harness(DSH)Web 端插件:在会话视图的标签环("对话轨迹"旁)添加一个 "文件" 标签页,只读浏览当前会话工作区下的文本与 Markdown 文件。

功能

  • 📂 跟随当前工作区:自动解析当前会话的 cwd,打开即落在该工作区;切换不同工作区的会话,页签随之跟随
  • 📄 Markdown 渲染:标题 / 表格 / 列表 / 引用 / 围栏代码 / 行内样式,无需外部依赖
  • 📱 响应式双布局:
    • 桌面端(≥768px):左目录树 + 右阅读器双栏
    • 移动端(<768px):单栏 + "‹ 返回"粘性导航条,大触控行高
  • 🔒 只读安全边界:
    • 允许根 = GUI 中注册的全部工作区($DSH_HOME/storages/workspace.json)+ 配置兜底根
    • 拒绝目录穿越(明文与编码均拦截)、拒绝点开头文件、相似前缀目录不误放行
    • 单文件读取上限 2MB,仅文本类扩展名

安装

1. 放置插件包

将本仓库克隆/复制到 web profile 的 node_modules 下(以 $DSH_HOME=/data/dsh-home 为例):

git clone https://github.com/<you>/dsh-plugin-file-tab.git \
  /data/dsh-home/profiles/web/node_modules/dsh-plugin-file-tab

若你的 DSH 以固定安装树为模块解析锚点,建议同时在安装树的 node_modules 里放一个符号链接:

ln -sfn /data/dsh-home/profiles/web/node_modules/dsh-plugin-file-tab \
  /usr/local/lib/node_modules/@deepseek-ai/dsh/node_modules/dsh-plugin-file-tab

2. 注册组合行

编辑 profile 的 patch 层 /data/dsh-home/profiles/web/cordis.patch.yml:

- insert:
    - id: file-viewer
      name: dsh-plugin-file-tab
      config:
        root: /home/ubuntu/books        # 兜底根:相对路径与未注册工作区时的回落
        storages: /data/dsh-home/storages/workspace.json  # 工作区注册表(默认值)

3. 重启

docker restart <容器名>   # 容器部署
# 或重启宿主机上的 dsh web 进程

刷新页面后,任意会话的视图标签环会出现 "文件" 页签。

配置

键 默认 说明
root "" 兜底允许根;相对路径按它解析。动态根来自 workspace 注册表
storages /data/dsh-home/storages/workspace.json 工作区注册表路径,每次请求实时读取

HTTP API(同源只读)

端点 参数 说明
GET /file-viewer/list?path=<绝对路径> 目录绝对路径 返回 {dir, dirs:[{path,name}], files:[{path,name}]}
GET /file-viewer/read?path=<文件绝对路径> 文件绝对路径 返回 text/plain; charset=utf-8 正文

越界访问返回 403 {"error":"path outside allowed workspaces"}。

已知限制

  • 只读;不支持编辑、搜索、排序切换
  • 二进制文件与大文件(>2MB)拒绝展示
  • API 与 Web GUI 同权限级别:能打开界面的人即可读取允许根内的文件(仅回环/受信代理部署假设)

环境要求

  • DeepSeek Harness ≥ 0.1.0-rc.8(dsh --profile web)
  • 无任何 npm 运行时依赖(React 由 Harness 的客户端加载器以共享供应商模块提供)

License

MIT

About

DeepSeek Harness Web 插件:会话视图"文件"标签页——工作区文件只读浏览(Markdown 渲染 / 移动端单栏适配)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages