dsh-wsl
为 Windows 上的 DeepSeek Harness 提供 WSL 执行支持。包含极简 WSL 代理预设、通用 WSL 模型工具,以及带发行版诊断的 Web 插件设置标签页。
AI 分析
核心用于在 Windows 环境下通过 WSL 执行 DSH 任务。适合需要在 Linux 沙箱中运行 bash 命令的用户。需 Win10/11、WSL2 及 node-pty。
安装
此插件尚未提供可验证的 bundle,或兼容性检查未通过。请先阅读仓库说明。 阅读完整 README ↗
说明文档
阅读完整 README ↗使用
- 发行版选择:Web 插件设置 → 插件配置 → WSL 卡片(横条)里用下拉框选择本地发行版(空 = WSL 默认发行版)。选择立即生效并持久化到
settings.yaml(wsl.distro),执行器、持久 PTY 后端与 wsl 工具在每次调用时读取,无需重启。 - 极简模式 (WSL):Web 界面新建会话时选择该预设。bash 工具与 str_replace_editor 双工具表面与原极简模式一致,但命令在 WSL 里执行。
- 通用 wsl 工具:宿主半边注册的
wsl工具(command/description/timeoutMs/workdir/distro 参数)。注意:DSH 的模型工具由预设行注册,宿主级注册对 preset 作用域会话可能不可见——如需在 standard/cordis 会话中使用,把dsh-wsl的工具行加进对应用户预设的组成(后续版本计划提供标准预设变体)。 - 路径规则(已写进预设 persona 与工具描述):文件工具用
D:\dir\file,bash 命令用/mnt/d/dir/file,同一份文件。 - 沙箱:会话切到完全访问后 bash/wsl 工具才放行。受限模式下会返回明确指引(WSL VM 内的进程不受 Windows 受限令牌约束,且经 /mnt/* 可达全部 Windows 文件——受限模式只会造成「看似受限」的假象)。持久 PTY 会话打开期间禁止切换沙箱模式(沿用官方后端的行为)。
配置
宿主半边(cordis.patch.yml 行的 config):
| 字段 | 默认 | 说明 |
|---|---|---|
distro | 空 = 默认发行版 | 兜底发行版;设置页的选择(wsl.distro)优先 |
installPreset | true | 自动安装 minimal-wsl 预设 |
force | false | 预设已存在时是否覆盖刷新 |
registerWslTool | true | 注册通用 wsl 工具 |
warmup | true | 插件加载后预热发行版(跳过首次冷启动) |
settingsApi | true | 提供 /wsl-manager/* 路由(状态/发行版保存/预热) |
terminalBackend | false(显式开启) | 在 preset realm 中注册持久 PTY 后端;minimal-wsl 预设的 backend 行显式设 true |
timeoutMs / maxTimeoutMs / maxOutputBytes / graceMs | 120000 / 600000 / 64000 / 3000 | wsl 工具的执行预算 |
wsl-executor.mjs(preset 内 agent.cordis.yml 的 config):distro(兜底)、timeoutMs、maxTimeoutMs、maxOutputBytes、maxSpillBytes、graceMs。
实现注意:宿主半边声明
inject: ['webServer', 'tools', 'subprocess']。不声明 inject 的行会在这些服务就绪前激活,ctx.get()全部拿空——表现为状态接口 404/兜底页与工具缺失(0.1.0 首版的线上症状)。
Usage
- Distro selection: in Web Plugins settings → plugin configuration → the WSL card (horizontal bar), pick a local distro from the dropdown (empty = WSL default distro). The choice takes effect immediately and is persisted to
settings.yaml(wsl.distro); the executor, persistent PTY backend and wsl tool read it on every call — no restart needed. - 极简模式 (WSL): select this preset when creating a new session. The two-tool surface (bash + str_replace_editor) matches the original minimal preset, but commands execute in WSL.
- General wsl tool: the host half registers a
wsltool (command/description/timeoutMs/workdir/distro). Note: DSH model tools are registered by preset rows, so a host-level registration may not be visible to preset-scoped sessions — to use it in a standard/cordis session, add the tool row to that preset's user composition (a standard-preset variant is planned for a later version). - Path rules (written into the preset persona and tool descriptions): file tools use
D:\dir\file, bash commands use/mnt/d/dir/file, the same files. - Sandbox: bash/wsl tools only run after the session is switched to full access. In confined modes they return clear guidance (processes inside the WSL VM are not bound by the Windows restricted token, and reach all Windows files through /mnt/* — a confined mode would only appear to confine). Sandbox mode cannot be changed while a persistent PTY session is open (same as the official backend).
Configuration
Host half (cordis.patch.yml row config):
| Field | Default | Description |
|---|---|---|
distro | empty = default distro | fallback distro; the settings-page choice (wsl.distro) wins |
installPreset | true | auto-install the minimal-wsl preset |
force | false | overwrite the preset when it already exists |
registerWslTool | true | register the general wsl tool |
warmup | true | warm the distro after plugin load (skip the first cold boot) |
settingsApi | true | serve the /wsl-manager/* routes (status / distro save / warm-up) |
terminalBackend | false (explicit opt-in) | register the persistent PTY backend in the preset realm; the minimal-wsl preset's backend row sets true |
timeoutMs / maxTimeoutMs / maxOutputBytes / graceMs | 120000 / 600000 / 64000 / 3000 | execution budgets for the wsl tool |
wsl-executor.mjs (the preset's agent.cordis.yml config): distro (fallback), timeoutMs, maxTimeoutMs, maxOutputBytes, maxSpillBytes, graceMs.
Implementation note: the host half declares
inject: ['webServer', 'tools', 'subprocess']. A row without inject activates before those services exist and everyctx.get()comes back empty — the symptom is a 404/fallback status API and a missing tool (the 0.1.0 first-release online symptom).