Prompt for Realm password when CST_REALM_PASSWORD is unset; map worker request-gate exhaustion to a clear budget error with partial progress; hard-skip identical tool failures after 3 tries. Add docs/parliament.md. Co-authored-by: Cursor <cursoragent@cursor.com>
74 lines
2.0 KiB
Markdown
74 lines
2.0 KiB
Markdown
# Parliament(议会)快速上手
|
||
|
||
密码串派生 Realm → 登录夺主席 → 常驻服务同步上下文。同一时刻只有一个主席;换项目清空全部议会上下文。
|
||
|
||
## 一次性初始化
|
||
|
||
```bash
|
||
# 交互输入密码,或事先 export CST_REALM_PASSWORD=…
|
||
cst-agent --realm-password-init
|
||
```
|
||
|
||
磁盘只存 salt + 公钥,**不存私钥**。
|
||
|
||
## 日常:登录即夺主席
|
||
|
||
```bash
|
||
export CST_INSTANCE_ID=laptop-a # 可选;默认 chair-local
|
||
cst-agent --login --realm-label "thinkpad"
|
||
# 也可:CST_REALM_PASSWORD=… cst-agent --login
|
||
```
|
||
|
||
效果:
|
||
|
||
1. 用密码解锁 Realm,本机成为**唯一主席**(上一主席被交接)
|
||
2. 写入本地登录票(24h)
|
||
3. 拉起后台议会服务(发现 + 按 revision 同步 `parliament.context`)
|
||
|
||
查看状态:
|
||
|
||
```bash
|
||
cst-agent # 进入 TUI 后 /status
|
||
# 或 CLI
|
||
cst-agent --service-stop # 停服务
|
||
```
|
||
|
||
密码 Realm 开启后,直接打开 agent 会要求登录(TTY 下可当场输入密码)。
|
||
|
||
## 协作模式
|
||
|
||
`settings.json` 里 `"collaboration": "parliament"`(或环境变量 `CST_COLLABORATION=parliament`)时:
|
||
|
||
- 提示词不再鼓动 `task` / `worker_start`
|
||
- 本机用工具直接干活;跨设备靠 Realm peer 席位,而不是进程内子 agent
|
||
|
||
密码 Realm 存在时也会按议会模式注入 Environment(chair / 共享 context / 设备席位)。
|
||
|
||
## 换项目(清场)
|
||
|
||
```bash
|
||
cst-agent --new-project my-app
|
||
```
|
||
|
||
清空共享上下文、撤销主席与登录票,并停止本机服务。Realm 密钥保留。
|
||
|
||
## Docker 冒烟
|
||
|
||
```bash
|
||
bash scripts/docker_parliament_test.sh
|
||
```
|
||
|
||
Alpine 内构建,chair↔member 握手。
|
||
|
||
## 相关标志
|
||
|
||
| 标志 | 作用 |
|
||
|------|------|
|
||
| `--realm-password-init` | 创建密码 Realm |
|
||
| `--login` | 登录 + 夺主席 + 启服务 |
|
||
| `--service` / `--service-fg` | 仅启服务 |
|
||
| `--service-stop` | 停服务 |
|
||
| `--new-project ID` | 清场换项目 |
|
||
| `--peer-port N` | 登录/服务用的 TCP 端口(默认 9100) |
|
||
| `--instance ID` | 实例 id(也可用 `CST_INSTANCE_ID`) |
|