Simplify instance lifecycle commands
This commit is contained in:
@@ -45,7 +45,6 @@ npm run build
|
||||
kimi --version
|
||||
kimi doctor
|
||||
kimi acp --help
|
||||
gori-agent discover-backends
|
||||
```
|
||||
|
||||
模型和 provider 由 ACP agent 自身配置,例如 Kimi Code 使用 `~/.kimi-code/config.toml`。gori-agent 不复制模型凭据。
|
||||
@@ -53,44 +52,36 @@ gori-agent discover-backends
|
||||
## 实例管理
|
||||
|
||||
```bash
|
||||
gori-agent instance init <bot-id>
|
||||
gori-agent instance doctor <bot-id>
|
||||
gori-agent instance start <bot-id>
|
||||
gori-agent instance status <bot-id>
|
||||
gori-agent instance logs <bot-id>
|
||||
gori-agent instance restart <bot-id>
|
||||
gori-agent instance stop <bot-id>
|
||||
gori-agent instance list
|
||||
gori-agent init <bot-id>
|
||||
gori-agent setup <bot-id>
|
||||
gori-agent doctor <bot-id>
|
||||
gori-agent start <bot-id>
|
||||
gori-agent status <bot-id>
|
||||
gori-agent logs <bot-id>
|
||||
gori-agent restart <bot-id>
|
||||
gori-agent stop <bot-id>
|
||||
gori-agent list
|
||||
```
|
||||
|
||||
- `init` 交互生成 Config v3,本身不启动 Bot;它会询问并校验 `gateway.server.host/port`,扫描统一实例目录中其他 Config v3 的声明端口,并在默认端口冲突时建议下一个未占用端口。已有配置通过 `setup` 重跑时可保留或修改 host/port,不会静默改端口。
|
||||
- `init` 交互生成 Config v3,本身不启动 Bot;它会询问并校验 `gateway.server.host/port`,扫描统一实例目录中其他 Config v3 的声明端口,并在默认端口冲突时建议下一个未占用端口。
|
||||
- `setup` 只重配已有实例。它校验目录、配置身份、配置/PID 权限,并拒绝运行中实例或指向其他活进程的 PID;固定 `bot.id`,保留既有 agent(含 args/env)、skills、permissions、gateway policy、runtime、平台 secrets 与 publicBaseUrl,确认写入后自动运行 doctor。
|
||||
- 平台 secret/token 使用不回显输入,空 generic webhook/weixin secret 会随机生成。
|
||||
- `start` 会检查配置存在、目录名匹配 `bot.id`、目录/配置权限、模板占位符、workspace、agent executable、PID identity 和端口,并等待 `/health` 返回匹配的 Bot/platform identity;任一不满足即 fail closed。
|
||||
- `status` 核对 PID 对应的完整 `start --config` 身份以及 `/health` 返回的 Bot/platform identity。
|
||||
- 实例进程由内部 `dist/cli/instance-runner.js` 承载;`status` 和 lifecycle 命令精确核对 Node executable、runner 路径及唯一 config 参数,再核对 `/health` 的 Bot/platform identity。
|
||||
- 每个实例必须使用不同的 `gateway.server.port` 和平台凭据;setup 的声明冲突提示不替代 `start` 的实际端口检查。
|
||||
- `stop` 发送 `SIGTERM` 并等待最多 10 秒,不会自动 `SIGKILL`。
|
||||
- `stop` 发送 `SIGTERM`,runner 会优雅关闭 server,并等待最多 10 秒;不会自动 `SIGKILL`。
|
||||
|
||||
公开 CLI 不兼容旧 `instance` 前缀,也不提供 debug 命令、`--config` 或 `--json`。
|
||||
|
||||
可用 `GORI_AGENT_ROOT` 改变统一根目录:
|
||||
|
||||
```bash
|
||||
GORI_AGENT_ROOT=/srv/gori-agent gori-agent instance list
|
||||
GORI_AGENT_ROOT=/srv/gori-agent gori-agent list
|
||||
```
|
||||
|
||||
## `config.example.json` 的定位
|
||||
|
||||
`config.example.json` 是仓库内唯一可提交、无密钥的配置说明,不是运行配置。它可被 Config v3 schema 解析,但保留 `BOT_ID`、`QQ_APP_ID` 等明显占位符。
|
||||
|
||||
`start`、`status`、`doctor`、`print` 找不到本地配置时会失败,绝不会回退到 example。只有 `setup` 和 `instance init` 会读取 example 作为初始化种子。
|
||||
|
||||
底层调试入口仍可使用:
|
||||
|
||||
```bash
|
||||
gori-agent setup --config /absolute/path/config.json
|
||||
gori-agent start --config /absolute/path/config.json
|
||||
gori-agent status --config /absolute/path/config.json
|
||||
gori-agent doctor --config /absolute/path/config.json
|
||||
gori-agent print feishu --config /absolute/path/config.json
|
||||
```
|
||||
`config.example.json` 是仓库内唯一可提交、无密钥的配置说明,不是运行配置。它可被 Config v3 schema 解析,但保留 `BOT_ID`、`QQ_APP_ID` 等明显占位符。只有 `init` 会读取 example 作为初始化种子;其他命令只按 `<bot-id>` 加载统一实例目录中的 `config.json`,缺失即失败。
|
||||
|
||||
`writeConfigFile()` 使用同目录临时文件、`fsync` 和原子 rename,并强制最终文件为 `0600`。
|
||||
|
||||
@@ -230,7 +221,7 @@ Bot fingerprint 包含 Bot ID、workspace、persona、agent、permissions、skil
|
||||
|
||||
## Doctor 与安全纪律
|
||||
|
||||
`instance doctor` / `doctor --config` 检查:
|
||||
`gori-agent doctor <bot-id>` 检查:
|
||||
|
||||
- Config v3 与 example placeholder。
|
||||
- 配置权限 `0600`。
|
||||
|
||||
Reference in New Issue
Block a user