docs: add agent auto-register & column validation rules

This commit is contained in:
nav
2026-03-24 00:43:22 +00:00
parent 63d7fb569e
commit ce79a782b9

View File

@@ -161,18 +161,27 @@ col2
- 写操作(`add`, `delete`, `set`)必须使用文件锁,防止多 Agent 并发写入导致数据损坏
- 读操作(`get`, `show`, `list columns`)无需锁
### 2.9 错误退出码
### 2.9 Agent 自动注册
- **读/写操作时**:如果当前 `agent-id` 不存在于 `agent-scope` 中,自动创建空条目:
```json
"agent-scope": {
"new-agent-id": {}
}
```
- **字段验证**:如果 `column-name` 不存在于 `columns` 或 `public-columns` 中,返回错误(退出码 2
### 2.10 错误退出码
| 退出码 | 含义 |
|--------|------|
| 0 | 成功 |
| 1 | 参数错误 / 用法错误 |
| 2 | 字段不存在 |
| 2 | 字段不存在column-name 不在 columns 或 public-columns 中) |
| 3 | 字段已存在 |
| 4 | 权限错误(非 pcexec 环境 / Agent 越权) |
| 5 | 文件锁获取失败 |
| 6 | JSON 解析/写入错误 |
### 2.10 值的大小限制
### 2.11 值的大小限制
- 单字段值长度无限制
---