jinsiyu/dsh-code-server-app ↗★ 8
dsh-code-server-app
VS Code (from a code-server release) inside DSH: a right-sidebar tab driven by the plugin's own launcher over the in-process VS Code server (lib/launcher.mjs), plus an editor bridge (assets/extensions/dshcs-editor-bridge) that gives the agent what only the editor knows (unsaved buffers, language-server diagnostics, the active selection) and lets editor gestures drive the session. The bridge is completely read-only: all four of its routes (/health, /sync, /old, /event) are reads. Asking DSH from the editor opens a floating dialog inside the DSH page (draggable, resizable, bottom-right): the plugin's client half sends the question as user input (POST /api/code-server/ask/send) and renders that session's new content with DSH's own Markdown renderer - the same @deepseek-ai/dsh-client-ui-primitives instance the UI uses, required from the page's module table, so typography, highlighting and math match the interface and a renderer version mismatch is impossible. Thinking appears as collapsed rows and approval requests (writing outside the workspace / running commands) can be answered in place: whole-plugin write route POST /api/code-server/ask/approve, constrained to pending in-process requests and the outcomes allowed-once/rejected; dialog-first for 5 minutes, handed back to the official card the moment the dialog closes, never auto-approved. There is no build step anywhere: lib/client.js (client half including the dialog panel) and the extension are committed hand-written source, devDependencies holds a single test-only entry, and the published package carries no frontend bundle. Also: the tab claims DSH file addresses (dsh-resource://file/**) by file type (setting claimExtensions), so produced-file chips, delivered-file previews and inline prose mentions open in the workbench; the IDE is a resident surface moved with Element.moveBefore instead of being remounted, so switching sidebar tabs does not reload it; opening the tab switches the right sidebar to fullscreen by default (setting fullscreenOnOpen); a workspace switch re-navigates the workbench with the new ?folder= without restarting the IDE process. Requires a DSH with the right-sidebar services (sidebarRightTabs/sidebarRight, >= 0.1.5-alpha.1); older DSH versions only get an upgrade notice on the settings page. Two serving modes: loopback port (default) or same-origin mount on DSH's own webServer (/code-server, protected by ctx.connection.requestRejection). The diff the bridge opens always has the real pre-write text on the left, taken from result.value.before in tools/post-execute into a bounded snapshot cache and fetched by opaque key over the read-only GET /old, so files that are not open in the editor work too. No code-server Node layer, no argon2, no C++ toolchain.
설치
npx -p @deepseek-ai/dsh dsh plugin --profile web add dsh-code-server-app@0.2.1打包机环境要求(使用者机器什么都不需要)
工具链只在打包期需要;使用者机器不需要 C++ 工具链,也不需要联网装依赖之外的任何东西。
| 环境 | 版本/要求 | 使用者机器 | 打包机 |
|---|---|---|---|
| Node.js | v24.x(code-server 最新要求;本机 v24.13.1) | 必需 | 必需 |
| npm / pnpm | npm 跟随 Node;pnpm 由 DSH 提供 | 必需(装依赖) | 必需 |
| MSVC 构建工具 | VS Community 2026 + C++ 桌面负载 | ❌ 不需要 | 打包期需要(编译 16 个原生包) |
| VS Spectre 缓解库 | ARM64 与 x86/x64 各一份("MSVC v14x Spectre-mitigated libs") | ❌ 不需要 | 打包期需要(否则 MSB8040) |
| Python | 3.13.x | ❌ 不需要 | 打包期需要(node-gyp) |
| node-gyp | 13.x(旧版不识别 VS 2026) | ❌ 不需要 | 打包期需要 |
缺 Spectre 库也能出包:
vendor-repacks.mjs在某个包编译失败时会自动把该架构*.gyp里的SpectreMitigation降级为false并重试(只是少了 Spectre 加固,功能不受影响),日志会明确提示。
配置(cordis.patch.yml 的 config,均有默认值)
| 键 | 默认 | 说明 |
|---|---|---|
serve | loopback | 服务方式:loopback(独立回环端口,iframe 跨源)→ dsh(挂到 DSH 自身端口的 /code-server/*,转发到命名管道,复用 DSH 的 Host/Origin + cookie 防护)。需 DSH 提供 webServer,缺失时自动回退 loopback |
bin | ''(空 = 用自带 launcher) | 逃生舱:显式指定外部 code-server 可执行文件 / out/node/entry.js 时退回旧模型(不经 lib/launcher.mjs) |
host | 127.0.0.1 | loopback 模式的绑定地址(仅允许回环) |
port | 0 | loopback 模式的端口;0 = 每次启动由系统分配随机端口(实际端口写在 endpoint.json,host 读回)。显式给端口则固定使用;该端口被占用且无有效 pid.json 时报错并给诊断(拒绝误杀) |
auth | none | 固定 none(0.2.0 起 argon2 已移除);回环模式的访问控制由随机端口 + 路径令牌 + Host 白名单承担(见「回环端口的安全模型」),对外访问请用 serve: dsh |
userDataDir | $DSH_HOME/code-server/user-data | 用户数据隔离目录 |
extensionsDir | $DSH_HOME/code-server/extensions | 扩展目录 |
locale | '' | 界面语言(空 = 跟随浏览器),如 zh-cn |
readyTimeoutMs | 60000 | /healthz 就绪探测超时(TCP 或命名管道) |
editorBridge | true | 编辑器桥(0.3.0 起):树内扩展 dshcs-editor-bridge 与 host 之间的只读通道(见「与 DSH 的协同」)。关掉 = 不写 bridge.json、不注册 editor_context/editor_diagnostics、扩展休眠。设置文档里的 code-server.editorBridge 可即时开关 |
用户级覆盖示例(写在 $DSH_HOME/profiles/web/cordis.patch.yml,应使用 - id: code-server 行覆盖):
- id: code-server
config:
serve: dsh # 同源挂载:/code-server/*(无额外端口,复用 DSH 防护)
# port: 8091 # serve: loopback 时才生效