DSH Hub

k-ying/dsh-vsceditor

dsh-vsceditor

UIWeb UI2 GitHub stars· updated 2026-08-27

dsh-vsceditor is a community DeepSeek Harness plugin. Read the repository README before installing.

Install

npx @deepseek-ai/dsh plugin --profile web add github:k-ying/dsh-vsceditor

Restart `dsh web` after install. Bundle APIs can change during the developer preview.

README badge

dsh-vsceditor DSH Hub badge
[![DSH Hub](https://dshhub.dev/badge/dsh-vsceditor.svg)](https://dshhub.dev/plugins/dsh-vsceditor)

Paste this into your README. The star count updates with every catalog sync.

From the README

Excerpt from k-ying/dsh-vsceditor, cleaned of badges and images.

dsh-vsceditor

中文 | English

DeepSeek Harness 内嵌 VSCode 编辑器插件 —— 在 DSH Web 界面里嵌入一个完整的 code-server(完整版 VSCode),agent 每次写文件/改文件时自动在编辑器里弹出红绿 diff 并定位到改动行,所见即所得地"看着 AI 干活"。

1. 特性

  • 双后端:内嵌 / 本机 —— 默认内嵌 code-server;也可切换为「本机 VS Code」,跟随、diff、锁定全部搬进你自己的桌面编辑器
  • 完整 VSCode,不是玩具编辑器 —— 内嵌的是 code-server 4.x(完整 VSCode 内核),扩展、主题、快捷键、Git 面板全部可用
  • 跟随模式(follow) —— agent 调用 write/edit 工具改文件时,编辑器自动打开该文件的红绿 diff 视图并滚动到首个改动行;DSH 侧还同时内置一个只读 diff 标签页,两边都能看
  • 文件锁定 —— agent 正在写某个文件期间,编辑器里该文件被锁定(防止你和 AI 同时改一个文件互相覆盖),写完自动解锁
  • 工作区自动跟随会话 —— 一个 DSH 进程只跑一个 code-server;当前活跃会话的工作区变化时,编辑器自动切换到对应目录(必要时自动重启 code-server)
  • iframe 常驻不重建 —— 编辑器页面固定在 <body> 上、切换标签页只是隐藏/显示,不会每次点进去都新开一个 VSCode 会话
  • 设置页集成 —— 「设置 → 插件 → 插件配置」里有本插件的折叠卡片:跟随开关、自动启动、端口、code-server 目录,全部即时生效并持久化(~/.dsh/settings.yaml
  • 零依赖 —— host/client 两端都是手写原生 JS,不依赖任何 npm 包;settings schema 用手写的 schemastery 兼容外形,不需要 @deepseek-ai/schemastery

2. 工作原理

┌─ DSH 进程 ─────────────────────────────────────────────┐
│  host.js(host 层 cordis 插件,进程级单例)              │
│   · 监听所有会话的 tools/pre-execute、tools/result 事件   │
│   · 捕获 write/edit 的目标路径,读出改前/改后文本          │
│   · 管理 code-server 子进程(spawn/重启/退出重试)         │
│   · 通过 webServer 暴露:                                 │
│       /__dsh-vsceditor/state|action   (控制面,页面用)   │
│       /__dsh-vsceditor-<rand>/events  (SSE → 扩展)      │
│       /__dsh-vsceditor-<rand>/rpc     (扩展 → host)     │
└───────┬──────────────────────────────▲─────────────────┘
        │ SSE: hello/follow/edit/lock/unlock/reveal
        │                              POST: ready/ack/log
┌───────▼──────────────────────────────┴─────────────────┐
│  code-server(独立进程,--auth none,仅 127.0.0.1)        │
│   └─ dsh-bridge 扩展(vscode-ext/dsh-bridge)            │
│        收到 edit 消息 → 打开红绿 diff 并定位改动行          │
│        收到 lock → 对应文件只读;unlock → 恢复             │
└────────────────────────────────────────────────────────┘
        ▲ iframe(client.js 注册到 conversation.view,
          标签页「编辑器」,常驻 body 不随切换销毁)

消息语义参考 ACP session/updateedit {path, oldText, newText, firstLine} 由 host 计算 diff 统计后推送,扩展负责呈现。host 以 unscoped 方式挂载,因此能看到所有会话的工具事件(scoped 事件会沿 scope 链向上流动)。

3. 前置要求

  • DeepSeek Harness(dsh)web profile(本插件是 profile bundle,挂在 host 层)
  • macOS 或 Linux(Windows 未测试;code-server 官方不支持 Windows 直装)
  • 内嵌模式:需要一个 code-server 安装(见 4.2);本机 VS Code 模式:需要桌面版 VS Code。两者至少满足其一——不装 code-server 也能用插件,只是只能用本机 VS Code 模式

4. 安装

4.1 安装插件

方式 A:从 GitHub 安装(推荐)

dsh plugin --profile web add github:k-ying/dsh-vsceditor

dsh plugin add 会把包加进 ~/.dsh/profiles/web/package.json 的依赖并自动登记到 dsh.profile.bundles(本插件通过 cordis.patch.yml 自挂载,无需手工编辑组合文件)。

方式 B:本地目录安装

git clone https://github.com/k-ying/dsh-vsceditor.git
dsh plugin --profile web add /path/to/dsh-vsceditor

4.2 安装 code-server(内嵌模式必需)

⚠️ 想用默认的内嵌编辑器,这一步不可跳过。 插件本体不带 code-server 运行时(约 100MB)。不装的话内嵌模式不可用——「编辑器」标签页会提示"未找到 code-server"并引导你切换到本机 VS Code 模式(功能等价,见 5.1)。

推荐全局安装,所有工作区共用一份

sh ~/.dsh/profiles/web/node_modules/dsh-vsceditor/scripts/install-code-server.sh ~/.dsh-editor

如果想让某个工作区用独立的 code-server,不传参数即可(默认装到当前目录的 .dsh-editor,优先级高于全局):

cd <你的 DSH 工作区>   # 例如 ~/Documents/AI
sh ~/.dsh/profiles/web/node_modules/dsh-vsceditor/scripts/install-code-server.sh

脚本按平台(macOS arm64/x64、Linux x64/arm64/armhf)从 code-server 官方 release 下载并解压。版本固定为 4.133.0,可用 DSH_VSCEDITOR_VERSION 环境变量覆盖。

Related plugins