























项目地址: https://github.com/openxlings/xlings
注: 目前 linux 体验比较好, windows/macos 上逐渐适配中
通用包管理基础设施 + 类OS(OS-like)子操作系统(SubOS)隔离
多版本共存 · 无需 Root · 去中心化索引 · 面向代理(Agent)
[官网] | [文档] | [包索引] | [社区论坛]
中文 | 英语(English)
使用者: MCPP · 即将推出的 Luban Linux
| 痛点 | 没有 xlings | 有 xlings |
|---|---|---|
| 系统 gcc@11,还想装 gcc@16 | 手动编译,容易冲突 | xlings install gcc@16 — 两版本共存 |
| 团队需要一致的项目环境 | "在我机器上能跑" | .xlings.json + xlings install — 进入项目目录即无感进入隔离的项目级子操作系统(SubOS) |
| 代理(Agent)需要自己的隔离世界来运行 | Docker守护进程(Docker daemon) + 镜像 + 清理 | 代理(Agent)跑在子操作系统(SubOS) 里面 — 拥有完全权限,无需Root,轻量级,宿主机不受影响 |
| apt/brew | nix | docker | xlings | |
|---|---|---|---|---|
| 多版本共存 | ❌ | ✅ | ✅ | ✅ |
| 无需Root | ❌ | ⚠️ | ⚠️ | ✅(image模式除外) |
| 无daemon | ✅ | ✅ | ❌ | ✅ |
| 跨平台统一命令 | ❌ | ⚠️ | ✅ | ✅ Linux / macOS / Windows |
| 隔离粒度 | ❌ | 文件系统(FS) | 文件系统+(FS+) | 🔒 命令行(shell) / 文件系统(FS) / 镜像(image) 三级 |
| 存储复用 | — | ✅ 存储(store) | ❌ 镜像膨胀 | ✅ 版本视图 + 引用计数 |
| 启动开销 | ⚡ 即时 | ⚡ 即时 | 🐢 秒级 | ⚡ 即时 / ~10ms(沙盒) |
| 去中心化索引 | ❌ | ❌ | ❌ | ✅ 官方 + 第三方 + 自建 |
| 代理 / JSON 接口 | ❌ | ❌ | ⚠️ API | ✅ xlings interface(NDJSON) |
| 可作 OS 级包管理器 | apt 本身是 | NixOS | ❌ | ✅(Luban Linux,即将推出) |
Linux / macOS
curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.sh | bash
Windows (PowerShell)
irm https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.ps1 | iex
把以下内容复制给你的 AI agent(Claude / Codex / OpenCode 等):
帮我安装 xlings 包管理器。
- Linux/macOS: curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.sh | bash
- Windows: irm https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.ps1 | iex
项目地址: https://github.com/openxlings/xlings
xlings install gcc@16 node@24 cmake
xlings use gcc@16 # 切换当前版本
gcc --version # gcc 16.x
xlings interface(NDJSON 协议)面向 AI Agent、CI 和第三方工具xlings install gcc@16 gcc@11 cmake node@24
xlings use gcc@16 # 即时切换
xlings use gcc@11 # 切回 11, 互不干扰
当你进入包含 .xlings.json 的项目目录时,xlings 自动透明地激活项目级子操作系统(SubOS) — 你和团队在隔离环境中工作而无需任何手动操作。所有依赖都在项目自己的子操作系统(SubOS)中。
{
"workspace": {
"xmake": "3.0.7",
"gcc": { "linux": "16.1.0" },
"llvm": { "macosx": "20.1.7" }
}
}
cd my-project/ # 自动进入项目 SubOS
xlings install # 依赖装进项目级隔离环境
xmake build # 一切正常运作, 与宿主机隔离
克隆 → cd → 构建。团队和 CI 环境完全一致,无需手动激活。
xlings 让你把智能体(codex / claude / opencode 等)在 SubOS 内部运行 — agent 在隔离环境中拥有完全权限,宿主机完全安全。
为什么这很重要:
在 SubOS 中运行 Agent:
# 创建 SubOS(从 base 环境 fork,或自己从零配置)
xlings subos new claude-workspace --from subos:dev-env@latest
# 进入 SubOS — Agent 在这里面运行,拥有完全控制权
xlings subos use claude-workspace --sandbox
# → 现在你在 agent 的世界里
# → 在这里启动 claude / codex / opencode
# → 它们可以自由安装、修改、实验 — 宿主机不受影响
# 同一台机器上运行多个隔离的 agent 实例
xlings subos new claude-workspace-1 --from subos:dev-env@latest
xlings subos new claude-workspace-2 --from subos:dev-env@latest
xlings subos new codex-workspace --from subos:dev-env@latest
一次性任务也可以用 --cmd:
xlings subos use claude-workspace --sandbox --cmd "python analyze.py"
无需 root,无守护进程,无镜像膨胀。每个智能体(Agent)拥有自己的世界。
| 级别 | 机制 | 需要根权限(Root)? | 隔离范围 | 适用场景 |
|---|---|---|---|---|
| 🟢 壳(Shell) | 环境变量(env)/路径(PATH)切换 | 否 | 工具版本 | 日常开发, 版本锁定 |
| 🔵 文件系统(FS) | bwrap / proot 沙箱 | 否 | 文件系统(HOME, /tmp 私有) | 代理,实验,不受信代码 |
| 🟠 镜像 | ext4 稀疏镜像挂载 | 是 | 完整块设备隔离 | 重型工作负载,持久化沙箱 |
xlings subos new <name> --from <local|subos:pkg@ver>(共享存储下0秒)xlings subos use <name> --cmd "<command>"退出码透传--sandbox 标志;bwrap 优先 (setuid, xim 自管理), proot 兜底--storage shared|tmpfs|image, fork 时选择.xlings.json 中声明, 进入项目目录即自动透明激活--keep 保持挂载命名空间 (mount namespace) 活跃, 高频执行 (exec) 优化;xlings subos stop 释放graph TD
subgraph 来源
S1["🏛️ 官方 - openxlings/xim-pkgindex"]
S2["🌍 第三方 - 社区仓库"]
S3["🏠 自建 - 团队 Git / 本地路径"]
end
subgraph "资源服务器 (二进制镜像)"
R1[GLOBAL]
R2[CN]
R3[自建 OSS]
end
S1 & S2 & S3 -->|"xpkg 包描述"| X[xlings install]
X -->|"下载二进制"| R1 & R2 & R3
style X fill:#e8f5e9
一行添加自定义索引:
{
"index_repos": [
{ "name": "xim", "url": "https://github.com/openxlings/xim-pkgindex.git" },
{ "name": "my-team", "url": "[email protected]:devtools/pkgs.git" }
]
}
| 项目 | 角色 | 链接 |
|---|---|---|
| MCPP | 现代 C++ 构建工具生态 — 通过 xlings 分发 | github.com/mcpp-community/mcpp |
| 鲁班 Linux(Luban Linux) | 即将推出的 Linux 发行版,采用 xlings 作为系统级包管理器 | (发布时更新链接) |
| xim-pkgindex(包索引) | 官方包索引 — 60+ 个包持续增长 | openxlings/xim-pkgindex |
不同于传统的"agent 调用工具"模式,xlings 让 agent 本身运行在 SubOS 里面。agent 拥有一个完整的隔离环境 — 可以装包、写文件、跑服务 — 全都不会影响宿主机。
| 场景 | 实现方式 |
|---|---|
| 安全地给 agent 完全权限 | agent 在 --sandbox SubOS 内运行 |
| 同一 agent 工具(codex/claude)一台机器多实例 | 每个实例一个 SubOS |
| Agent 需要特定环境(Python + CUDA + 自定义库) | 从 subos:ml-env@latest fork |
| 临时任务执行 | --storage tmpfs + --cmd |
xlings interface 提供 NDJSON 协议(stdio 通信)— 面向 AI Agent、CI 系统和第三方工具的程序化控制:
xlings interface
# → {"protocol":"1.0","capabilities":[...]}
# ← {"action":"install","target":"subos:py-ds@latest"}
# → {"kind":"progress","phase":"downloading","percent":45,...}
# → {"kind":"data","dataKind":"installed","payload":{...}}
除了 Agent,SubOS 同样适合开发和测试:
# 不同场景不同环境
xlings subos new rust-nightly --storage shared
xlings subos new legacy-gcc11 --storage shared
# 或使用项目级模式:进入项目目录即自动进入隔离环境
cd my-project/ # 无感进入项目 SubOS
# 1. 安装 xlings(见上方"快速开始")
# 2. 在仓库根目录安装构建依赖:
xlings install # 读取 .xlings.json → xmake, cmake, ninja, 工具链
# 3. 切换到开发工具链:
xlings use [email protected] # 确保 xrepo 缓存用 glibc 链接
# 4. 构建:
xmake f -y && xmake build xlings
xmake build xlings_tests && xmake run xlings_tests
.xlings.json 同时驱动 CI 和 release 流水线。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。