omp packages

@hex4c59/pi-ext-sandbox-mxc0.1.0

Microsoft MXC backend for the Pi sandbox extension.

hex4c59 Published 8 days ago MIT ~0 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

@hex4c59/pi-ext-sandbox-mxc

@hex4c59/pi-ext-sandbox 的 Microsoft MXC 后端。

用途

把沙箱核心的 bash、powershell 和 ! 命令交给 Microsoft MXC。MXC 会按平台选择底层容器:

  • Windows 11:ProcessContainer(需要 PSEC 支持)
  • Linux:Bubblewrap
  • macOS:Seatbelt

本包只注册后端,不覆盖工具;没有安装 @hex4c59/pi-ext-sandbox 时不会产生效果。核心在平台探测通过后还会实际启动一次 shell 自检;getPlatformSupport() 报支持、但无法加载 Node/Git Bash 的 MXC 会被自检拒绝,并回退 none。

安装

pi install npm:@hex4c59/pi-ext-sandbox
pi install npm:@hex4c59/pi-ext-sandbox-mxc

要求 Node.js 24 或更高版本。Windows 需要支持 ProcessContainer 的 Windows 11 版本;/sandbox probe 会显示不可用原因。

验证

pi -e ./sandbox -e ./sandbox-mxc
/sandbox
!echo mxc-ok

/sandbox 应显示后端 mxc,并列出 processcontainer、bubblewrap 或 seatbelt 等可用方法。如果显示 mxc unavailable,先运行 /sandbox probe 查看原因;shell 自检失败时核心会让 Windows 回退 none,命令继续由 permissions 审查。

限制

  • @microsoft/mxc-sdk 体积较大(安装后约 114 MB),只在需要 MXC 时安装。
  • getPlatformSupport() 只说明平台能力,不保证能启动具体工具。维护者本机 Windows 11 26H2 26300.9974(已装 KB5132061)上,ProcessContainer 能运行 cmd.exe,但 node、Git Bash 和 pwsh 启动即返回 0xC0000142;Git for Windows 2.49.0 与官方 PortableGit 2.56.1 结果相同。核心的 shell 自检会把 MXC 标记为不可用并回退 none。上游 microsoft/mxc#1061 仍未关闭;修复发布后重跑 /sandbox probe 即可确认。
  • 本包不读取或改写 Pi 的凭据;模型请求仍由 Pi 自己发出。
  • MXC 的文件系统、网络和 UI 限制由 MXC 执行;本包只把 SandboxPolicy 映射成 ContainerRequest。
  • src/contract.ts 是 @hex4c59/pi-ext-sandbox 同名文件的副本;修改事件名或接口字段时必须同步。