Skip to content
dsh.fish
Bundle

dsh-workbench

VSCode 风格工作台面板:文件树 / 多标签预览 / CodeMirror 编辑 / 终端 / Git / 全库搜索 / 变更审查。VSCode-style workbench sidebar panel for DeepSeek Harness.

Source
LingYuYue1
stars
2 stars
License
MIT
Updated
Updated 9 hours ago

Readme

# dsh-workbench

[English](./README_EN.md) | 简体中文

VSCode 风格工作台侧边栏插件,适用于 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)。自包含,不依赖任何第三方插件。

**随手搓的,功能并不完善,有兴趣的大佬可以优化一下**

## 功能一览

| | |
|---|---|
| 📁 **资源管理器** | 按会话 cwd 定位的文件树,懒加载展开,点击文件即开预览 |
| 📄 **多标签预览** | Markdown 渲染 / 代码高亮(CodeMirror + shiki)/ 图片 / HTML 沙箱 / PDF 内嵌 |
| ✏️ **编辑模式** | CodeMirror 6 编辑器,语法高亮、行号、Ctrl+S 原子保存 |
| 🔄 **刷新按钮** | 每个标签页头部,一键重新读取文件 |
| 🔄 **自动重载** | 轮询已打开文件的 mtime/size,外部变更自动刷新 |
| 🟢 **变更审查** | AI 改完文件后,聊天流末尾出现红绿 diff 审查卡片(Codex 风格) |
| ↩️ **一键撤销** | 审查卡片内直接回滚文件到修改前 |
| ⟂ **Git 面板** | status / stage / unstage / commit,点文件看 diff |
| ⌗ **集成终端** | node-pty + xterm.js,多标签、保活回放、跨视图切换不断连 |
| 🔍 **全库搜索** | 递归搜索工作区所有文本文件内容,按文件分组跳转 |
| 🌐 **内嵌浏览器** | URL 栏 + 沙箱 iframe |
| 📐 **拖拽布局** | 面板宽度 / 侧栏宽度 / 终端高度均可拖拽调整 |

## 安装

### 从 GitHub(推荐,无需本地构建)

```sh
npx -p @deepseek-ai/dsh dsh plugin --profile web-desktop add github:LingYuYue1/dsh-workbench
```

安装后重启 DSH,硬刷新浏览器即可。屏幕右缘会出现 ◀ 按钮。

### 本地开发安装

```sh
git clone https://github.com/LingYuYue1/dsh-workbench.git
cd dsh-workbench && pnpm install && pnpm build
```

然后在 profile 的 `cordis.patch.yml` 中注册:

```yaml
- insert:
    - id: workbench
      name: '/absolute/path/to/dsh-workbench'
```

## 使用

面板通过屏幕右缘的 ◀ 按钮开关。活动图标栏提供六个视图:

- 📁 文件 — 浏览并打开文件
- ⟲ 变更 — 查看 AI 最近一轮修改的文件列表
- ⟂ Git — 暂存/提交/查看差异
- 🔍 搜索 — 全库内容搜索
- 🌐 浏览器 — 内嵌网页浏览
- ⌗ 终端 — 开关底部终端停靠区

聊天流中 AI 改完文件后会自动插入红绿 diff 审查卡片,支持一键撤销。

### 已知限制:内嵌浏览器

内嵌浏览器基于沙箱 `<iframe>` 实现。**多数网站通过 `X-Frame-Options` 和 `Content-Security-Policy: frame-ancestors` 安全头主动拒绝被 iframe 嵌入**——这是浏览器厂商强制执行的安全策略,不是本插件的 bug。

具体表现:
- Google、GitHub、知乎等主流网站会显示空白或拒绝页面
- 部分允许嵌入的站点(如 `example.com`)可以正常显示
- 无法在 iframe 中登录第三方网站(Cookie 隔离)

如果遇到无法嵌入的站点,请点击地址栏旁的 **↗** 按钮在系统浏览器中打开。内嵌浏览器更适合快速查看 AI 产出的 HTML 文件或简单网页。

## 预览

<img src="./assets/001.png" width="480" alt="工作台面板">

<img src="./assets/002.png" width="480" alt="变更审查">

<img src="./assets/003.png" width="680" alt="差异对比">

<img src="./assets/004.png" width="680" alt="终端与 Git">

## 开发

```sh
pnpm install
pnpm typecheck   # tsc --noEmit
pnpm build       # tsc declarations + tsdown (host ESM + client CJS)
pnpm test        # host smoke tests
pnpm watch       # incremental rebuild
pnpm deploy      # sync lib/ to ~/.dsh local-plugins + profile
```

## 架构

- **Host 半** (`src/index.ts`):`/workbench/api/*` REST API + `/workbench/file` 媒体路由 + `/workbench/ws/terminal` WebSocket;信任围栏 + 会话 cwd 边界。
- **Client 半** (`src/client/`):portal 挂载到 `document.body`;复用官方 primitives 的 MarkdownText / CodeBlock / DiffBlock。

## License

[MIT](./LICENSE)

Install

dsh plugin --profile web add github:LingYuYue1/dsh-workbench

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.
  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source