Files
hermes-mac13 93758f3720 feat: 从 tutti-selfhost 拆出 local_rig 独立仓
- local_rig/ 完整包(7 源文件 + ui.html + CHANGELOG)
- tests/test_local_rig.py + test_rig_real_agent.py(纯 local_rig 测试)
- scripts/15-criterion4-live.sh(判据④活环境门)
- README.md(定位/快速开始/与 tutti-selfhost 的关系)
- requirements.txt(唯一外部依赖 pyyaml)
- .gitignore

来源: figmar/tutti-selfhost @ 3b23853 (2026-10-06)
原 PR #43 已合入 tutti-selfhost main
2026-10-06 13:36:14 +08:00

97 lines
2.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# local-rig
单机轻量 Agent 团队 —— OpenRig 哲学 + ACP(Agent Coordination Protocol)。
从 `tutti-selfhost` 拆出(2026-10-06),独立仓库维护。
## 是什么
`local_rig` 是一个**单机多 Agent 调度器**:
- 一个 `rig.yaml` 定义成员(member)+ 运行环境(runtime)+ 协作边(edge)
- daemon 起 HTTP server(默认 `:27900`)
- 支持两种 runtime:**hermes-cli**(调 Hermes Agent)和 **terminal**(跑 shell 命令)
- 任务队列持久化(SQLite),支持幂等复验
- 自带 Web UI(`/ui`)
**不是** tutti-selfhost 的 bridge —— 它是更底层的「单机 Agent 团队」原语,bridge 可以调用它,但它不依赖 bridge。
## 快速开始
```bash
# 1. 装依赖
pip install pyyaml
# 2. 准备 rig 配置
cat > my-rig.yaml << 'EOF'
members:
- id: coder
runtime: hermes-cli
profile: default
- id: tester
runtime: terminal
command: "echo 'test passed'"
edges:
- from: coder
to: tester
EOF
# 3. 起 daemon
python3 -m local_rig.cli -f my-rig.yaml
# 4. 开 UI
open http://127.0.0.1:27900/ui
```
## CLI
```bash
python3 -m local_rig.cli -f <rig.yaml> # 起 daemon
python3 -m local_rig.cli -f <rig.yaml> --once # 跑一轮就退
```
## 测试
```bash
python3 -m unittest discover -s tests -v
```
## 文件结构
```
local_rig/
__init__.py # 包入口
cli.py # CLI 入口(python3 -m local_rig.cli)
daemon.py # HTTP daemon + 任务调度
queue.py # SQLite 持久化任务队列
rig_schema.py # rig.yaml 解析 + 校验
runtime_hermes.py # hermes-cli runtime(调 Hermes Agent)
runtime_terminal.py # terminal runtime(跑 shell 命令)
ui.html # Web UI(单文件,无构建)
CHANGELOG.md # 变更记录
tests/
test_local_rig.py # 单元测试(纯 local_rig,无外部依赖)
test_rig_real_agent.py # 真 agent 端到端测试
scripts/
15-criterion4-live.sh # 判据④活环境门(两档判定/幂等复验)
```
## 依赖
- Python 3.9+
- `pyyaml`(唯一外部依赖)
## 与 tutti-selfhost 的关系
| | local-rig | tutti-selfhost bridge |
|---|---|---|
| 定位 | 单机 Agent 团队原语 | 多 Agent 协作工作台的事件桥 |
| 依赖 | 纯 stdlib + pyyaml | 依赖 local_rig + Matrix + tuttid |
| 部署 | 任何有 Python 的机器 | 需要 tuttid + Matrix + hermes |
bridge 通过 `RigDispatcher` 调用 local_rig,但 local_rig 不反向依赖 bridge。
## 来源
从 `gitea.apescale.com/figmar/tutti-selfhost` 拆出(commit `3b23853`,2026-10-06)。
原 PR #43(feat(local_rig): 单机轻量 Agent 团队)已合入 tutti-selfhost main。