Skip to content
dsh.fish
Bundle

@momojie-s/dsh-workspace-files

Workspace file explorer for DeepSeek Harness web UI: right-side resizable file tree with recursive search (skips .git/node_modules), Markdown rendering and multi-language syntax highlighting

Source
Momojie-S
License
MIT
Updated
Updated 12 days ago

Readme

# dsh-workspace-files

DeepSeek Harness Web UI 的工作区文件面板:会话标题栏一键开关,右侧可调宽文件树 + 递归文件搜索(跳过 `.git` / `node_modules`),Markdown 渲染与多语言语法高亮预览;双击浮窗居中放大,远程可一键下载文件。

## 一句话作用

在任何会话旁边快速浏览当前工作区的目录结构与文件内容——不用切出浏览器,不用给 agent 发消息;远程(域名/局域网)使用时直接把文件拉回本地。

## 环境要求

- DeepSeek Harness `>= 0.1.0-rc.6`(web profile;已验证至 `0.1.1-rc.2`)
- Node.js `>= 20`(构建期;运行期无额外依赖)

## 用法

1. 会话标题栏点「🗂 文件」按钮打开面板
2. 左栏文件树:点击目录展开/折叠;**单击文件**在右栏预览,**双击文件**浮窗居中放大(Markdown/高亮同款渲染,`Esc` 或点遮罩关闭)
3. **下载**:预览栏标题行与浮窗标题行都有下载按钮,二进制/超限不可预览的文件在提示语旁也有下载链接——远程使用时把文件拉回本机的正路(本地点击文件名走的是 DSH 原生打开,远程被官方 fence 拒掉)
4. 搜索框输入关键词回车:全工作区递归搜索文件名;`Esc` 返回文件树
5. 面板左缘拖动调宽(240–900px),左缘中部「›」按钮收起面板
6. `.md` 文件自动渲染(标题/列表/表格/代码块高亮/链接/图片);其他文本文件按扩展名语法高亮;二进制与超过 1 MB 的文件提示不预览(但可下载)

## 安装

```sh
dsh plugin --profile web add @momojie-s/dsh-workspace-files
# 或本地路径
dsh plugin --profile web add ./plugins/dsh-workspace-files
dsh web
```

首次按 pnpm 提示在 profile 的 `pnpm-workspace.yaml` 加 `allowBuilds` 授权构建脚本。

## 配置

patch `config` 字段:

| 字段 | 默认值 | 说明 |
| --- | --- | --- |
| `maxReadBytes` | `1000000` | 单文件预览读取上限(字节),超过则不预览 |
| `maxDownloadBytes` | `200000000` | 单文件下载上限(字节),超过回答 413 |
| `maxSearchNodes` | `4000` | 递归搜索访问节点预算(文件+目录) |
| `maxSearchMatches` | `300` | 搜索结果条数上限 |
| `skipDirs` | `['.git', 'node_modules']` | 文件树与搜索都不进入的目录名 |
| `trustedHosts` | `[]` | 非回环 `host[:port]` 授权列表;**远程域名/局域网访问必须配置**,否则所有路由 403 |

远程部署示例(profile patch 层覆盖 bundle 行,认证交给网关层如 nginx basic auth):

```yaml
- id: workspace-files
  config:
    trustedHosts: ['dsh.example.com']
```

## 验证

```sh
curl -s -H "Host: 127.0.0.1:3080" "http://127.0.0.1:3080/plugins/workspace-files/search?q=README"
# 期望:{"matches":[...],"truncated":false}(未打开面板时返回 not-a-directory 之外的 JSON 即通)

curl -sI -H "Host: 127.0.0.1:3080" "http://127.0.0.1:3080/plugins/workspace-files/download?path=README.md" | Select-String 'HTTP|content-disposition'
# 期望:HTTP/1.1 200 且 content-disposition: attachment; filename=...
```

浏览器端:会话标题栏出现「🗂 文件」按钮即客户端半部加载成功。

安全边界与设计取舍见 [docs/design/overview.md](docs/design/overview.md)。

Install

dsh plugin --profile web add github:Momojie-S/dsh-workspace-files#78a0cc7d84043ce88c1583af3482a06a58d40b8a

Profile: web

  • This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
Source