微软跨平台沙盒支持。
安装
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:omdsh-dev/sandbox-mxc
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
English | 中文
这是一个 Stent sidecar:在不修改 DeepSeek Harness 源码的前提下,让 DSH bash、PowerShell 和持久终端载荷通过 MXC 执行。该包是显式 opt-in bundle;ctx.sandbox、subprocess 的 I/O、deadline、signal、终端会话和 teardown 仍由 DSH 持有,Stent 只在加载时把受控 Hook 安装到现有消费路径。
包结构
package.json # 可发布 bundle 与公开依赖
cordis.patch.yml # profile 行与 config.stent.patches 描述
src/stent-entry.ts # 命名导出的 Stent function plugin
src/stent-handlers.ts # descriptor 与生命周期安全的 handler
src/index.ts # MXC 策略编译器与兼容 provider
src/invariant.ts # 包 invariant companion
tests/ # 策略、provider、Hook 与发布路径测试
legacy/ # 历史宿主补丁;bundle 永不应用
包根是 Stent function plugin,刻意不提供 default export。兼容 provider 与策略编译器还可从 @deepseek-ai/dsh-sandbox-mxc/provider 获取;新 profile 应通过 bundle 行加载包根。
MXC runtime 使用公开的 @omdsh-dev/mxc-sdk 0.7.0 GitHub Release asset:
https://github.com/omdsh-dev/sandbox-mxc/releases/download/v0.7.0/omdsh-dev-mxc-sdk-0.7.0.tgz
sha256: ffd9a83b9f6a509ee99a59e60ab6bd68889c106d5d8f14d1fa402efd157e8c72
包在 dependencies 中保留不可变的 v0.7.0 release URL,并在 bundleDependencies 中列出 @omdsh-dev/mxc-sdk。因此 npm pack 会把 SDK、native executor 和 denial-capture asset 放进发布 tarball 的 node_modules/@omdsh-dev/mxc-sdk;消费者不需要再次解析 GitHub URL。@oh-my-dsh/stent 是可安装的 host-facing peer;@deepseek-ai/dsh-sandbox、@deepseek-ai/dsh-subprocess 和 @deepseek-ai/dsh-invariants 是由 DSH 宿主提供的 runtime contract,不会被复制进本包,也不会 patch 宿主源码。
Stent bundle 行为
普通 profile 中该行保持关闭。stent-dsh 从 config.stent.patches 读取 descriptor,在目标模块加载前安装转换,并仅在 Stent composition 中启用该行:
- id: sandbox-mxc
name: '@deepseek-ai/dsh-sandbox-mxc'
disabled: true
config:
enabled: true
useResultEnvelope: true
stent:
patches:
# 完整 descriptor 列表随 cordis.patch.yml 发布。
Handler 覆盖现有公开 seam:
@deepseek-ai/dsh-bash-sandbox的前台和后台调用;@deepseek-ai/dsh-pwsh-sandbox的前台和后台调用;- bash 与 PowerShell local executor 的进程结算 Hook;
terminal-bashbackend 在 local terminal primitive spawn 前的创建路径;dsh-subprocess-local.spawnTerminal的参数替换;@deepseek-ai/dsh-sandbox-local.confine的 terminal-only 绕过,避免原始 terminal 路径再次包装 MXC launch。
每个受约束调用都会以精确 argv、cwd 和 scrubbed+explicit 环境准备一个独立 MXC controller;controller 从 versioned result envelope 结算,并且只释放一次。宿主 subprocess 或 terminal service 继续拥有进程树、超时、signal、stdio 和 quiescence。danger-full-access 直接委托原始宿主调用,不启动 MXC。任何 MXC qualification 或 runner failure 都抛出 SANDBOX_UNAVAILABLE,绝不回退到无约束载荷。
workspace 使用 pnpm 的 nodeLinker: hoisted,因为 isolated linker 无法物化 bundleDependencies。该设置需要保留给开发安装;最终 bundled artifact 应使用 npm pack/npm publish,因为当前 pnpm packer 会把 nested bundled executable 的权限规范化。
开发
pnpm install
pnpm run typecheck
pnpm run build
pnpm test
pnpm run prepare
npm pack --dry-run
pnpm run test:e2e
真实 executor 测试在当前平台没有对应 binary 时会自跳过。Release asset 已包含 native executor 与 denial-capture 文件;不需要 GitHub Packages 凭据或 .npmrc scope 覆盖。
模型体验
此包不增加任何 model-visible prompt、tool 或 result 文本。现有 DSH bash 与 terminal consumer 继续负责渲染和错误语义;sandbox seam 负责 SANDBOX_UNAVAILABLE 诊断。
KV 缓存效果
无直接失效;现有 consumer 拥有请求前缀变化。
已知限制与暂缓事项
- Linux MXC qualification 需要可用的 Bubblewrap/user namespace;macOS 与 Windows 验收仍依赖宿主条件,Windows Tier 3 需要显式宿主 DACL 权限。
- SDK release 仍是 Public Preview。策略 schema 与 native backend 可能在后续 minor 版本变化;升级必须同步审查依赖和 policy version。
- Stent descriptor 因 DSH 按平台选择 bash 或 PowerShell 而设为可选。若 profile 启用 bundle 但没有加载匹配 consumer,不会得到对应 Hook;宿主仍需组合受支持的 sandbox consumer。
legacy/mxc-host-integration.patch仅是历史证据;Stent bundle 不读取、不应用、也不依赖它。
链接
同类插件
toby-bridges/api-relay-audit★ 860
从 DeepSeek Harness 对 AI API 中转站和 LLM 代理运行本地安全审计,生成 Markdown 报告,覆盖提示词注入、模型替换信号、工具调用改写、错误泄漏、流完整性和按 profile 启用的 Web3 风险。
SeaOf0/dsh-redteam-model★ 638
面向授权安全研究的 DSH 合集:九个工作模式(redteam 总控、渗透测试、代码审计、二进制分析、攻防评估、免杀对抗、应急溯源、云安全攻防、CTF 解题)与十五个运行时插件,设置页管理台支持一键部署、安装、更新与卸载。
howmp/dsh-pentest★ 558
面向 DeepSeek Harness 的授权渗透模式:以探索链路记录目标、线索、资产与漏洞,并在 Web 中可视化展示。
PerryLink/dsh-auto-review★ 206
审批链上的第二模型自动审查:只读审查子代理返回带理由的 allow/deny 结构化裁决,默认 fail-closed。
NanmiCoder/dsh-auto-mode★ 163
在 Workspace Write 与 Full access 之间增加 Auto 权限档:日常操作留在官方 workspace-write 沙箱内,由当前会话模型复核升权与破坏性调用,精确的越界访问按次放行一次,意图不明时询问,命中关键路径则拒绝。
PerryLink/dsh-permission-rules★ 114
Claude Code 风格的声明式权限规则:按序 allow/deny/ask 的 YAML 规则,在 tools/pre-execute 瀑布上匹配工具名、参数、工作区路径与 agent 身份,带完整会话日志审计、干跑模式与热重载。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。