opencode-landstripOS-level AI command sandboxing for OpenCode with Landstrip
67
近 30 天 +5
9,090
近 7 天 1.4k
63.6
生态多维模型
5 小时前
2026-08-20
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-landstrip@0.18.34"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-landstrip@0.18.34"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-landstripopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
landstrip
landstrip runs commands in an OS-level sandbox using Landlock on Linux,
Seatbelt on macOS, and AppContainer or restricted users on Windows. Policies use
the supported subset of the Anthropic Sandbox Runtime format.
Installation
npm install --save-dev @landstrip/landstrip
npx landstrip run -p policy.json -- cargo test
The npm package installs a Node.js wrapper and a native binary for the current platform.
Quick start
landstrip run -p policy.json -- cargo test
landstrip policy validate -p policy.json
landstrip policy resolve -p policy.json
landstrip doctor
Windows builds also provide windows install, windows status, and
windows uninstall. Full command reference: landstrip --help and the
manual page.
Agent extensions
pi install npm:pi-landstrip
opencode plugin install opencode-landstrip
See pi-landstrip and opencode-landstrip.
Policy sketch
{
"filesystem": {
"allowWrite": ["."],
"denyWrite": ["**/.env", "**/*.pem"],
"denyRead": ["~/.ssh"],
"allowRead": ["~/.ssh/config"]
},
"network": {
"allowNetwork": false,
"httpProxyPort": 8080,
"allowLocalBinding": false,
"allowUnixSockets": []
}
}
Pass policies with -p, --policy <FILE> (repeatable). Semantics, platform
limits, traps, and exit status are in the manual page.
Development
Package
Artifacts land in npm/*/bin and artifacts/. Staging writes platform tarballs
and matching <file>.sha256 sidecars under artifacts/.
Non-host targets use cargo-zigbuild
(Zig as linker). Requires cargo-zigbuild, zig, and the matching rustup
targets (x86_64-unknown-linux-musl, aarch64-unknown-linux-musl,
x86_64-pc-windows-gnu, aarch64-pc-windows-gnullvm, aarch64-apple-darwin,
x86_64-apple-darwin). Host-native triples use plain cargo. Darwin links
libsandbox; from Linux set SDKROOT to a macOS SDK (Apple SDK; not
redistributed).
make package
make package PLATFORMS='linux-x64 win32-x64'
PACKAGE_STRICT=1 make package
make publish uploads each GitHub release tarball with its <file>.sha256
sidecar. Verify a download with:
sha256sum -c landstrip-<version>-<platform>.tar.gz.sha256
License
landstrip is free software under the GNU Lesser General Public License
version 2.1 or later (LGPL-2.1+). See LICENSE-LGPL-2.1.
The JavaScript npm wrapper is under the Apache License 2.0. See LICENSE-APACHE-2.0. Corresponding source for each native package is available from the matching repository tag.