|
@@ -198,6 +198,39 @@ DELETE /api/mqtt/:id
|
|
|
./bin/opencode-monitor monitor --ports 4096 --api-addr :8080
|
|
./bin/opencode-monitor monitor --ports 4096 --api-addr :8080
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+## 全局选项
|
|
|
|
|
+
|
|
|
|
|
+以下选项适用于 `monitor`、`serve`、`config` 三个子命令:
|
|
|
|
|
+
|
|
|
|
|
+| 选项 | 默认值 | 说明 |
|
|
|
|
|
+|------|--------|------|
|
|
|
|
|
+| `--log-file` | `./logs` | 日志文件路径。默认 `./logs/monitor.log`,按天自动轮转,同时输出到控制台和文件 |
|
|
|
|
|
+| `--log-level` | `info` | 日志级别:`debug`、`info`、`warn`、`error` |
|
|
|
|
|
+
|
|
|
|
|
+### 日志示例
|
|
|
|
|
+
|
|
|
|
|
+```bash
|
|
|
|
|
+# 默认日志到 ./logs/monitor.log
|
|
|
|
|
+./bin/opencode-monitor monitor --ports 4096
|
|
|
|
|
+
|
|
|
|
|
+# 指定日志路径
|
|
|
|
|
+./bin/opencode-monitor serve --log-file /var/log/monitor.log
|
|
|
|
|
+
|
|
|
|
|
+# 开启 debug 日志
|
|
|
|
|
+./bin/opencode-monitor monitor --scan 4096-4100 --log-level debug
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+### 日志文件轮转
|
|
|
|
|
+
|
|
|
|
|
+日志按天自动轮转,跨天后旧文件自动重命名:
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+logs/
|
|
|
|
|
+├── monitor.log # 当天日志
|
|
|
|
|
+├── monitor.log.2026-06-03 # 历史日志
|
|
|
|
|
+└── monitor.log.2026-06-02 # 历史日志
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
## CORS
|
|
## CORS
|
|
|
|
|
|
|
|
API 已启用 CORS,支持跨域请求。
|
|
API 已启用 CORS,支持跨域请求。
|
|
@@ -209,7 +242,7 @@ API 已启用 CORS,支持跨域请求。
|
|
|
```json
|
|
```json
|
|
|
{
|
|
{
|
|
|
"port": 4096,
|
|
"port": 4096,
|
|
|
- "status": "忙碌",
|
|
|
|
|
|
|
+ "status": "工作中",
|
|
|
"code": "busy",
|
|
"code": "busy",
|
|
|
"timestamp": "2026-06-03T14:30:00Z"
|
|
"timestamp": "2026-06-03T14:30:00Z"
|
|
|
}
|
|
}
|
|
@@ -220,7 +253,7 @@ API 已启用 CORS,支持跨域请求。
|
|
|
| status | code | 说明 |
|
|
| status | code | 说明 |
|
|
|
|--------|------|------|
|
|
|--------|------|------|
|
|
|
| 空闲 | idle | 会话空闲 |
|
|
| 空闲 | idle | 会话空闲 |
|
|
|
-| 忙碌 | busy | 会话忙碌 |
|
|
|
|
|
|
|
+| 工作中 | busy | 会话工作中 |
|
|
|
| 重试中 | retry | 会话重试中 |
|
|
| 重试中 | retry | 会话重试中 |
|
|
|
| 修改中 | pending | 会话修改中 |
|
|
| 修改中 | pending | 会话修改中 |
|
|
|
| 思考中 | reasoning | 模型推理中 |
|
|
| 思考中 | reasoning | 模型推理中 |
|
|
@@ -249,7 +282,7 @@ WebSocket 推送的消息格式为 JSON:
|
|
|
```json
|
|
```json
|
|
|
{
|
|
{
|
|
|
"port": 4096,
|
|
"port": 4096,
|
|
|
- "status": "忙碌",
|
|
|
|
|
|
|
+ "status": "工作中",
|
|
|
"code": "busy",
|
|
"code": "busy",
|
|
|
"timestamp": "2026-06-03T14:30:00Z"
|
|
"timestamp": "2026-06-03T14:30:00Z"
|
|
|
}
|
|
}
|