zephyrrtos.cnZEPHYR RTOS 本土生态工作组
DSH 插件 · 安装 · 更新 · 排错

dsh-ubuntu-sandbox 安装与更新

把远端 Ubuntu / Debian / Armbian 主机变成 agent 的命令行工作沙盒:默认 tmux 持久会话 + 远程读写工具。 本页给出三种安装方式、更新与回滚步骤,以及安装/更新中最常见的报错与处置。

当前版本 0.1.1(npm latest)· 许可 MIT · npm 页面 · CHANGELOG · 发布记录

安装前先确认三件事

DSH 版本需要 dsh >= 0.1.2-rc.1(插件清单里声明的引擎要求);终端执行 dsh --version 查看
远端主机装 tmux插件默认使用持久会话:sudo apt-get install -y tmux;工作组的沙盒机(deepseek / armbian)已预装
主机写进清单目标主机加到 ~/.dsh/dsh-ssh.json(与 @linxin666/dsh-ssh 共用同一个主机库),或在 dsh-ssh 的 SSH 面板里添加

三种安装方式

任选其一:图形界面走社区市场;脚本化 / 服务器走 dsh plugin;内网离线走手工安装。三者最终都落在同一个 profile 上。

方式适用入口
一 · 社区市场DSH Desktop 图形界面添加目录源 → 列表里一键安装(推荐)
二 · 命令行脚本化、远程机器dsh plugin --profile <profile> add …
三 · 手工安装内网、离线、需指定 pnpm 版本在 profile 目录内用 pnpm 加包,再补挂载清单

方式一 · DSH 社区市场

  1. 添加目录源 DSH Desktop → 设置 → Community Market(社区插件市场)→ 添加源:https://zephyrrtos.cn/dsh-ubuntu-sandbox/catalog-source.json
  2. 安装插件 在列表里找到 Ubuntu Sandbox (remote SSH) 并安装。目录里 latestVersion 已指向 0.1.1
  3. 重启 DSH 重启后工具列表里会出现 sb_cwd / sb_session / sb_exec / sb_ls / sb_read / sb_write

方式二 · 命令行(dsh plugin

dsh plugin --profile desktop add @hakehuang/dsh-ubuntu-sandbox@0.1.1
dsh plugin 做的事只是把参数转发给 profile 目录里的 pnpm:它只装依赖,不写挂载清单。 装完必须确认 ~/.dsh/profiles/<profile>/package.jsondsh.profile.bundles 数组里有 "@hakehuang/dsh-ubuntu-sandbox";缺了不会报错,只是工具永远不出现。
# 检查挂载清单里有没有这一行
node -e "const p=require(process.env.USERPROFILE+'/.dsh/profiles/desktop/package.json');console.log(p.dsh.profile.bundles)"

# 或直接看合成后的插件树(出现 id: ubuntu-sandbox 即已挂载)
dsh --profile desktop --dump-config | Select-String ubuntu-sandbox

方式三 · 手工安装(内网 / 离线)

  1. 先看现有依赖是谁装的 node_modules/.modules.yaml 里的 packageManagerstoreDir,用同一个大版本的 pnpm 来装,避免 store 版本不匹配(见 常见报错)。
  2. 在 profile 目录内加包 pnpm add --save-exact @hakehuang/dsh-ubuntu-sandbox@0.1.1
  3. 手工补挂载清单 编辑同目录 package.jsondependenciesdsh.profile.bundles 各加一条。
  4. 重启 DSH 本插件是 host 侧插件(没有浏览器半),新增 bundle 不会热加载,必须重启。

更新、回滚与卸载

# 更新到指定版本(推荐显式写版本号,便于回滚与复现)
dsh plugin --profile desktop add @hakehuang/dsh-ubuntu-sandbox@0.1.1

# 更新到最新版
dsh plugin --profile desktop add @hakehuang/dsh-ubuntu-sandbox@latest

# 确认当前落地版本
node -p "require(process.env.USERPROFILE+'/.dsh/profiles/desktop/node_modules/@hakehuang/dsh-ubuntu-sandbox/package.json').version"

# 看看 npm 上有哪些版本
npm view @hakehuang/dsh-ubuntu-sandbox versions

# 卸载
dsh plugin --profile desktop remove @hakehuang/dsh-ubuntu-sandbox
# 再从 package.json 的 dsh.profile.bundles 里删掉包名,然后重启 DSH
0.1.1 · 当前修复安装阻断:0.1.0 声明 schemastery ^3.18.2,而公共 npm 源最新只有 3.18.0,导致 npm / pnpm install 与社区市场安装都以 notarget 失败。现已改为 ^3.18.0。功能行为与 0.1.0 一致。
0.1.0 · 已废弃首个发布:sb_cwd / sb_session / sb_exec / sb_ls / sb_read / sb_write 六个工具,默认 tmux 持久会话。存在上述安装阻断,请勿使用(npm 上已标记 deprecated 并指向 ≥0.1.1)。
回滚就是把版本号换成旧版再重启;因为 0.1.0 装不上,可回滚的最低版本是 0.1.1。 更新前建议备份 package.jsonpnpm-lock.yaml

装完怎么验证

  1. 依赖已落地 node_modules/@hakehuang/dsh-ubuntu-sandbox/package.json 版本号应为 0.1.1,目录内有 lib/*.jscordis.patch.yml
  2. 已挂载进插件树 dsh --profile desktop --dump-config 的输出里应出现 - id: ubuntu-sandboxname: '@hakehuang/dsh-ubuntu-sandbox'
  3. 工具真的能用 重启后在对话里执行 sb_cwd alias:<主机别名>,再 sb_exec "uname -a; tmux -V"sb_session action:status 应显示 mode: on (default)

常见报错与处置

下面几条是安装/更新时最常遇到的,按现象对号入座即可。

ERR_PNPM_UNEXPECTED_STORE 原因:profile 的 node_modules 由 pnpm 10 建立(链接自 store\v10),而 DSH 对每一次包管理操作都强制使用它自带的 pnpm 11(要 store\v11),于是拒绝在旧 store 上继续。
处置 A(一次性根治,推荐)完全退出 DSH Desktop 后,在 profile 目录里执行 & "$env:APPDATA\DSH Desktop\runtime-commands\bin\pnpm.cmd" install,把整棵树迁到 v11 store;之后 GUI、市场与 dsh plugin 都恢复正常。必须在关闭状态下做:运行中的进程会锁定原生模块。
处置 B(不动现有树):用与现有 store 匹配的 pnpm(先看 .modules.yamlpackageManager)手工安装,再把包名补进 dsh.profile.bundles
notarget / No matching version装的是 0.1.0:它要求的 schemastery ^3.18.2 在公共源并不存在。改装 0.1.1 或更高
装完了但工具不出现两件事各查一遍:dsh.profile.bundles 是否含该包名;是否已重启 DSH(新 bundle 不热加载)。
插件被忽略、完全不挂载包内 cordis.patch.yml 的行名必须等于包名 @hakehuang/dsh-ubuntu-sandbox——loader 是按包名解析这一行的。自己改包名后务必同步这个文件。
sb_* 报 tmux 相关错误远端缺 tmux:sudo apt-get install -y tmux;也可在 sb_session 里关闭会话模式(不推荐,会失去 cd / export 的跨调用保持)。
长任务被超时打断非会话模式下命令超时会被直接杀掉。开启会话(sb_session action:on)后超时不再杀进程,用 sb_session action:reset 可恢复一个干净 shell。
Windows 上 git 凭据 / HTTPS 检查异常DSH 的文件沙箱会限制子进程与证书栈:需要 git 凭据的操作要放宽沙箱权限;校验 HTTPS 请用 Node 的 fetch,不要用 curl(Windows Schannel 在沙箱内会失败)。
问智能体 Zephyr 问题问答 · 直接问智能体