openclaw-agent-dashboard 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.yml +56 -0
- package/README.md +302 -0
- package/docs/CHANGELOG_AGENT_MODIFICATIONS.md +132 -0
- package/docs/RELEASE-LATEST.md +189 -0
- package/docs/RELEASE-MODEL-CONFIG.md +95 -0
- package/docs/release-guide.md +259 -0
- package/docs/release-operations-manual.md +167 -0
- package/docs/specs/tr3-install-system.md +580 -0
- package/docs/windows-collaboration-model-paths-troubleshooting.md +0 -0
- package/frontend/index.html +12 -0
- package/frontend/package-lock.json +1240 -0
- package/frontend/package.json +19 -0
- package/frontend/src/App.vue +331 -0
- package/frontend/src/components/AgentCard.vue +796 -0
- package/frontend/src/components/AgentConfigPanel.vue +539 -0
- package/frontend/src/components/AgentDetailPanel.vue +738 -0
- package/frontend/src/components/ErrorAnalysisView.vue +546 -0
- package/frontend/src/components/ErrorCenterPanel.vue +844 -0
- package/frontend/src/components/PerformanceMonitor.vue +515 -0
- package/frontend/src/components/SettingsPanel.vue +236 -0
- package/frontend/src/components/TokenAnalysisPanel.vue +683 -0
- package/frontend/src/components/chain/ChainEdge.vue +85 -0
- package/frontend/src/components/chain/ChainNode.vue +166 -0
- package/frontend/src/components/chain/TaskChainView.vue +425 -0
- package/frontend/src/components/chain/index.ts +3 -0
- package/frontend/src/components/chain/types.ts +70 -0
- package/frontend/src/components/collaboration/CollaborationFlowSection.vue +1032 -0
- package/frontend/src/components/collaboration/CollaborationFlowWrapper.vue +113 -0
- package/frontend/src/components/performance/PerformancePanel.vue +119 -0
- package/frontend/src/components/performance/PerformanceSection.vue +1137 -0
- package/frontend/src/components/tasks/TaskStatusSection.vue +973 -0
- package/frontend/src/components/timeline/TimelineConnector.vue +31 -0
- package/frontend/src/components/timeline/TimelineRound.vue +135 -0
- package/frontend/src/components/timeline/TimelineStep.vue +691 -0
- package/frontend/src/components/timeline/TimelineToolLink.vue +109 -0
- package/frontend/src/components/timeline/TimelineView.vue +540 -0
- package/frontend/src/components/timeline/index.ts +5 -0
- package/frontend/src/components/timeline/types.ts +120 -0
- package/frontend/src/composables/index.ts +7 -0
- package/frontend/src/composables/useDebounce.ts +48 -0
- package/frontend/src/composables/useRealtime.ts +52 -0
- package/frontend/src/composables/useState.ts +52 -0
- package/frontend/src/composables/useThrottle.ts +46 -0
- package/frontend/src/composables/useVirtualScroll.ts +106 -0
- package/frontend/src/main.ts +4 -0
- package/frontend/src/managers/EventDispatcher.ts +127 -0
- package/frontend/src/managers/RealtimeDataManager.ts +293 -0
- package/frontend/src/managers/StateManager.ts +128 -0
- package/frontend/src/managers/index.ts +5 -0
- package/frontend/src/types/collaboration.ts +135 -0
- package/frontend/src/types/index.ts +20 -0
- package/frontend/src/types/performance.ts +105 -0
- package/frontend/src/types/task.ts +38 -0
- package/frontend/vite.config.ts +18 -0
- package/package.json +22 -0
- package/plugin/README.md +99 -0
- package/plugin/config.json.example +1 -0
- package/plugin/index.js +250 -0
- package/plugin/openclaw.plugin.json +17 -0
- package/plugin/package.json +21 -0
- package/scripts/build-plugin.js +67 -0
- package/scripts/bundle.sh +62 -0
- package/scripts/install-plugin.sh +162 -0
- package/scripts/install-python-deps.js +346 -0
- package/scripts/install-python-deps.sh +226 -0
- package/scripts/install.js +512 -0
- package/scripts/install.sh +367 -0
- package/scripts/lib/common.js +490 -0
- package/scripts/lib/common.sh +137 -0
- package/scripts/release-pack.sh +110 -0
- package/scripts/start.js +50 -0
- package/scripts/test_available_models.py +284 -0
- package/scripts/test_websocket_ping.py +44 -0
- package/src/backend/agents.py +73 -0
- package/src/backend/api/__init__.py +1 -0
- package/src/backend/api/agent_config_api.py +90 -0
- package/src/backend/api/agents.py +73 -0
- package/src/backend/api/agents_config.py +75 -0
- package/src/backend/api/chains.py +126 -0
- package/src/backend/api/collaboration.py +902 -0
- package/src/backend/api/debug_paths.py +39 -0
- package/src/backend/api/error_analysis.py +146 -0
- package/src/backend/api/errors.py +281 -0
- package/src/backend/api/performance.py +784 -0
- package/src/backend/api/subagents.py +770 -0
- package/src/backend/api/timeline.py +144 -0
- package/src/backend/api/websocket.py +251 -0
- package/src/backend/collaboration.py +405 -0
- package/src/backend/data/__init__.py +1 -0
- package/src/backend/data/agent_config_manager.py +270 -0
- package/src/backend/data/chain_reader.py +299 -0
- package/src/backend/data/config_reader.py +153 -0
- package/src/backend/data/error_analyzer.py +430 -0
- package/src/backend/data/session_reader.py +445 -0
- package/src/backend/data/subagent_reader.py +244 -0
- package/src/backend/data/task_history.py +118 -0
- package/src/backend/data/timeline_reader.py +981 -0
- package/src/backend/errors.py +63 -0
- package/src/backend/main.py +89 -0
- package/src/backend/mechanism_reader.py +131 -0
- package/src/backend/mechanisms.py +32 -0
- package/src/backend/performance.py +474 -0
- package/src/backend/requirements.txt +5 -0
- package/src/backend/session_reader.py +238 -0
- package/src/backend/status/__init__.py +1 -0
- package/src/backend/status/error_detector.py +122 -0
- package/src/backend/status/status_calculator.py +301 -0
- package/src/backend/status_calculator.py +121 -0
- package/src/backend/subagent_reader.py +229 -0
- package/src/backend/watchers/__init__.py +4 -0
- package/src/backend/watchers/file_watcher.py +159 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build-and-release:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Setup Node.js
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: '20'
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: cd frontend && npm ci
|
|
26
|
+
|
|
27
|
+
- name: Build and pack plugin
|
|
28
|
+
run: npm run pack
|
|
29
|
+
|
|
30
|
+
- name: Generate release tgz
|
|
31
|
+
run: bash scripts/release-pack.sh
|
|
32
|
+
|
|
33
|
+
- name: Get version
|
|
34
|
+
id: version
|
|
35
|
+
run: |
|
|
36
|
+
VERSION=$(jq -r '.version' plugin/openclaw.plugin.json)
|
|
37
|
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
38
|
+
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
|
|
39
|
+
|
|
40
|
+
- name: Upload artifact
|
|
41
|
+
uses: actions/upload-artifact@v4
|
|
42
|
+
with:
|
|
43
|
+
name: plugin-tgz
|
|
44
|
+
path: openclaw-agent-dashboard-v*.tgz
|
|
45
|
+
retention-days: 30
|
|
46
|
+
|
|
47
|
+
- name: Create Release
|
|
48
|
+
if: github.event_name == 'push'
|
|
49
|
+
uses: softprops/action-gh-release@v2
|
|
50
|
+
with:
|
|
51
|
+
tag_name: ${{ steps.version.outputs.tag }}
|
|
52
|
+
name: Release ${{ steps.version.outputs.tag }}
|
|
53
|
+
generate_release_notes: true
|
|
54
|
+
make_latest: true
|
|
55
|
+
files: |
|
|
56
|
+
openclaw-agent-dashboard-v*.tgz
|
package/README.md
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# OpenClaw Agent Dashboard
|
|
2
|
+
|
|
3
|
+
多 Agent 可视化看板 - 实时展示 OpenClaw Agent 状态、任务进度和错误分析。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- **工位视图** - 以卡片形式展示主 Agent 和子 Agent 状态
|
|
8
|
+
- **时序视图** - 展示 Agent 执行步骤的时间线
|
|
9
|
+
- **链路视图** - 展示主 Agent 与子 Agent 的任务派发链路
|
|
10
|
+
- **Agent 配置** - 查看和修改 Agent 的模型配置
|
|
11
|
+
- **错误分析** - 错误根因分析、分类和修复建议
|
|
12
|
+
- **API 状态** - 展示 API 服务异常和限流情况
|
|
13
|
+
- **性能监控** - Token 使用、响应时间等
|
|
14
|
+
|
|
15
|
+
## 系统要求
|
|
16
|
+
|
|
17
|
+
| 组件 | 要求 |
|
|
18
|
+
|------|------|
|
|
19
|
+
| **openclaw** | 已安装 (`npm install -g openclaw`) |
|
|
20
|
+
| **Node.js** | 16+ |
|
|
21
|
+
| **Python** | 3.8+ |
|
|
22
|
+
| **pip** | python3-pip |
|
|
23
|
+
| **venv** | python3-venv(Linux 推荐) |
|
|
24
|
+
|
|
25
|
+
### 各系统依赖安装
|
|
26
|
+
|
|
27
|
+
**Debian / Ubuntu:**
|
|
28
|
+
```bash
|
|
29
|
+
sudo apt update
|
|
30
|
+
sudo apt install python3 python3-pip python3-venv
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Fedora / CentOS / RHEL:**
|
|
34
|
+
```bash
|
|
35
|
+
sudo dnf install python3 python3-pip
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**macOS:**
|
|
39
|
+
```bash
|
|
40
|
+
brew install python3
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Windows:**
|
|
44
|
+
1. 安装 [Node.js](https://nodejs.org/)(LTS 版本)
|
|
45
|
+
2. 安装 [Python 3](https://www.python.org/downloads/)
|
|
46
|
+
- ⚠️ 安装时务必勾选 **"Add Python to PATH"**
|
|
47
|
+
3. 安装 [Git for Windows](https://git-scm.com/download/win)(可选,用于 `curl | bash` 安装方式)
|
|
48
|
+
|
|
49
|
+
## 快速安装
|
|
50
|
+
|
|
51
|
+
### 方式一:一键安装(推荐)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# 一键安装(需已安装 openclaw:npm install -g openclaw)
|
|
55
|
+
curl -fsSL https://raw.githubusercontent.com/Umarchen/openclaw-agent-dashboard/main/scripts/install.sh | bash
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
安装完成后,执行任意 `openclaw` 命令时 Dashboard 会自动启动。
|
|
59
|
+
|
|
60
|
+
访问地址: http://localhost:38271
|
|
61
|
+
|
|
62
|
+
**可选参数**:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# 安装指定版本
|
|
66
|
+
DASHBOARD_VERSION=1.0.0 curl -fsSL https://raw.githubusercontent.com/Umarchen/openclaw-agent-dashboard/main/scripts/install.sh | bash
|
|
67
|
+
|
|
68
|
+
# 使用自定义下载地址
|
|
69
|
+
DASHBOARD_RELEASE_URL=https://example.com/openclaw-agent-dashboard-v1.0.0.tgz curl -fsSL ... | bash
|
|
70
|
+
|
|
71
|
+
# 跳过 Python 依赖安装
|
|
72
|
+
DASHBOARD_SKIP_PYTHON=1 curl -fsSL ... | bash
|
|
73
|
+
|
|
74
|
+
# 显示详细输出(调试用)
|
|
75
|
+
VERBOSE=1 curl -fsSL ... | bash
|
|
76
|
+
|
|
77
|
+
# 预览安装过程(不执行实际安装)
|
|
78
|
+
DRY_RUN=1 curl -fsSL ... | bash
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 方式二:从源码安装
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# 克隆仓库
|
|
85
|
+
git clone https://github.com/Umarchen/openclaw-agent-dashboard.git
|
|
86
|
+
cd openclaw-agent-dashboard
|
|
87
|
+
|
|
88
|
+
# 部署到 OpenClaw(构建前端 + 打包插件 + 安装)
|
|
89
|
+
npm run deploy
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Windows 用户**:源码安装使用 Node.js 脚本,无需 Git Bash,在 PowerShell 或 CMD 中直接运行:
|
|
93
|
+
|
|
94
|
+
```powershell
|
|
95
|
+
# 克隆仓库
|
|
96
|
+
git clone https://github.com/Umarchen/openclaw-agent-dashboard.git
|
|
97
|
+
cd openclaw-agent-dashboard
|
|
98
|
+
|
|
99
|
+
# 部署(跨平台)
|
|
100
|
+
npm run deploy
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 方式三:手动下载安装
|
|
104
|
+
|
|
105
|
+
从 [GitHub Releases](https://github.com/Umarchen/openclaw-agent-dashboard/releases) 下载 tgz 包:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# 下载
|
|
109
|
+
curl -LO https://github.com/Umarchen/openclaw-agent-dashboard/releases/download/v1.0.0/openclaw-agent-dashboard-v1.0.0.tgz
|
|
110
|
+
|
|
111
|
+
# 安装
|
|
112
|
+
openclaw plugins install openclaw-agent-dashboard-v1.0.0.tgz
|
|
113
|
+
|
|
114
|
+
# 安装 Python 依赖(Debian/Ubuntu 请用 venv,避免 PEP 668 报错)
|
|
115
|
+
cd ~/.openclaw/extensions/openclaw-agent-dashboard/dashboard
|
|
116
|
+
python3 -m venv .venv
|
|
117
|
+
.venv/bin/pip install -r requirements.txt
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## 命令说明
|
|
121
|
+
|
|
122
|
+
| 命令 | 说明 |
|
|
123
|
+
|------|------|
|
|
124
|
+
| `npm run deploy` | 打包 + 安装到 OpenClaw(首次安装或升级) |
|
|
125
|
+
| `npm run upgrade` | 拉取最新代码 + 部署(推荐用于升级) |
|
|
126
|
+
| `npm run pack` | 仅打包插件,不安装(开发调试用) |
|
|
127
|
+
| `npm run bundle` | 生成可分发的压缩包(给同事用) |
|
|
128
|
+
| `npm run start` | 独立启动 Dashboard(插件未自动启动时使用) |
|
|
129
|
+
|
|
130
|
+
## 离线分发(给同事)
|
|
131
|
+
|
|
132
|
+
如果 git clone 失败,可以打包分发:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# 生成压缩包
|
|
136
|
+
npm run bundle
|
|
137
|
+
# 输出: openclaw-agent-dashboard-v1.0.0.tar.gz
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
同事收到后:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# 解压
|
|
144
|
+
tar -xzf openclaw-agent-dashboard-v1.0.0.tar.gz
|
|
145
|
+
|
|
146
|
+
# 进入目录
|
|
147
|
+
cd openclaw-agent-dashboard
|
|
148
|
+
|
|
149
|
+
# 安装
|
|
150
|
+
npm run deploy
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Python 依赖安装策略
|
|
154
|
+
|
|
155
|
+
安装脚本采用以下策略安装 Python 依赖:
|
|
156
|
+
|
|
157
|
+
1. **venv(推荐)** - 在插件目录下创建 `.venv`,隔离依赖,不受 PEP 668 影响;Debian/Ubuntu 下**必须**用此方式(系统禁止 pip 装到系统/用户目录)。
|
|
158
|
+
2. **pip --user(回退)** - 仅在不支持 venv 或非 Debian/Ubuntu 环境下尝试,安装到 `~/.local/`。
|
|
159
|
+
|
|
160
|
+
若安装失败,请确保已安装系统依赖(见 [系统要求](#系统要求))。
|
|
161
|
+
|
|
162
|
+
详见 [Python 环境兼容性](docs/python-environment-compatibility.md)。
|
|
163
|
+
|
|
164
|
+
## 独立运行(不作为插件)
|
|
165
|
+
|
|
166
|
+
如果需要独立运行(不作为插件):
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# 1. 安装后端依赖(Debian/Ubuntu 建议用 venv:python3 -m venv .venv && .venv/bin/pip install -r requirements.txt)
|
|
170
|
+
cd src/backend
|
|
171
|
+
pip install -r requirements.txt
|
|
172
|
+
|
|
173
|
+
# 2. 构建前端
|
|
174
|
+
cd ../../frontend
|
|
175
|
+
npm install
|
|
176
|
+
npm run build
|
|
177
|
+
|
|
178
|
+
# 3. 启动后端
|
|
179
|
+
cd ../src/backend
|
|
180
|
+
uvicorn main:app --host 0.0.0.0 --port 38271
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## 项目结构
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
openclaw-agent-dashboard/
|
|
187
|
+
├── frontend/ # Vue 3 前端
|
|
188
|
+
│ └── src/ # 组件源码
|
|
189
|
+
├── src/backend/ # FastAPI 后端
|
|
190
|
+
│ ├── api/ # API 路由
|
|
191
|
+
│ ├── data/ # 数据读取层
|
|
192
|
+
│ └── main.py # 入口
|
|
193
|
+
├── plugin/ # 插件打包配置
|
|
194
|
+
├── scripts/ # 安装与构建脚本
|
|
195
|
+
│ ├── lib/ # 公共函数库
|
|
196
|
+
│ ├── install.sh # 一键安装
|
|
197
|
+
│ └── install-plugin.sh # 源码安装
|
|
198
|
+
├── .github/workflows/ # CI/CD
|
|
199
|
+
└── docs/ # 设计文档
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## 主要 API
|
|
203
|
+
|
|
204
|
+
| 方法 | 路径 | 说明 |
|
|
205
|
+
|------|------|------|
|
|
206
|
+
| GET | `/api/agents` | Agent 列表及状态 |
|
|
207
|
+
| GET | `/api/agent-config/:id` | Agent 配置 |
|
|
208
|
+
| PUT | `/api/agent-config/:id/model` | 更新模型配置 |
|
|
209
|
+
| GET | `/api/error-analysis/:id` | 错误分析 |
|
|
210
|
+
| GET | `/api/timeline/:id` | 时序数据 |
|
|
211
|
+
| GET | `/api/chains` | 任务链路 |
|
|
212
|
+
|
|
213
|
+
完整 API 文档: http://localhost:38271/docs
|
|
214
|
+
|
|
215
|
+
## 数据源
|
|
216
|
+
|
|
217
|
+
- `~/.openclaw/openclaw.json` - Agent 配置
|
|
218
|
+
- `~/.openclaw/subagents/runs.json` - 子代理运行记录
|
|
219
|
+
- `~/.openclaw/agents/*/sessions/*.jsonl` - 会话消息
|
|
220
|
+
|
|
221
|
+
## 环境变量
|
|
222
|
+
|
|
223
|
+
| 变量 | 说明 | 默认值 |
|
|
224
|
+
|------|------|--------|
|
|
225
|
+
| `OPENCLAW_STATE_DIR` | OpenClaw 配置根目录(优先级最高) | - |
|
|
226
|
+
| `OPENCLAW_HOME` | 替代 HOME,用于解析 `~/.openclaw` | `$HOME` |
|
|
227
|
+
|
|
228
|
+
插件安装路径与 `openclaw` 命令一致:`$OPENCLAW_STATE_DIR/extensions/` 或 `$OPENCLAW_HOME/.openclaw/extensions/` 或 `~/.openclaw/extensions/`,确保 Gateway 能正确发现插件。
|
|
229
|
+
|
|
230
|
+
## 开发调试
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
# 修改代码后重新部署
|
|
234
|
+
npm run deploy
|
|
235
|
+
openclaw gateway restart
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## 故障排查
|
|
239
|
+
|
|
240
|
+
### Python 依赖安装失败
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
❌ Python 依赖安装失败
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**解决方案:**
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
# Debian/Ubuntu(需安装 python3-venv,否则请用下方 venv 手动安装)
|
|
250
|
+
sudo apt update && sudo apt install python3 python3-pip python3-venv
|
|
251
|
+
|
|
252
|
+
# 重新安装(安装脚本会优先使用 venv)
|
|
253
|
+
npm run deploy
|
|
254
|
+
|
|
255
|
+
# 或手动用 venv 安装依赖(推荐,避免 externally-managed-environment)
|
|
256
|
+
cd ~/.openclaw/extensions/openclaw-agent-dashboard/dashboard
|
|
257
|
+
python3 -m venv .venv
|
|
258
|
+
.venv/bin/pip install -r requirements.txt
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### 无法访问 Dashboard
|
|
262
|
+
|
|
263
|
+
若 http://localhost:38271 无法访问,可能是插件未随 Gateway 自动启动,可手动启动:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# 方式一:在项目目录下(需先 npm run deploy)
|
|
267
|
+
npm run start
|
|
268
|
+
|
|
269
|
+
# 方式二:使用已安装的插件目录(若有 .venv 可用 .venv/bin/python 替代 python3)
|
|
270
|
+
cd ~/.openclaw/extensions/openclaw-agent-dashboard/dashboard
|
|
271
|
+
OPENCLAW_HOME=~/.openclaw python3 -m uvicorn main:app --host 0.0.0.0 --port 38271
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
说明:`openclaw gateway restart` 重启的是 Gateway 网关(端口 18789),不是 Agent Dashboard(38271)。Dashboard 作为插件随 Gateway 加载,若 systemd 方式运行的 Gateway 未正确加载插件,需手动启动 Dashboard。
|
|
275
|
+
|
|
276
|
+
### 安装报错:plugin not found / Invalid config
|
|
277
|
+
|
|
278
|
+
若出现 `plugins.allow: plugin not found: openclaw-agent-dashboard` 或 `Invalid config`,说明配置中有脏数据(插件曾被加入 allow 但当前未被发现)。按以下步骤处理:
|
|
279
|
+
|
|
280
|
+
**方式一:先清理再安装(推荐)**
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# 1. 卸载旧配置
|
|
284
|
+
openclaw plugins uninstall openclaw-agent-dashboard
|
|
285
|
+
|
|
286
|
+
# 2. 重新安装
|
|
287
|
+
npm run deploy
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
**方式二:手动编辑配置**
|
|
291
|
+
|
|
292
|
+
编辑 `~/.openclaw/openclaw.json`,在 `plugins` 下:
|
|
293
|
+
|
|
294
|
+
- 若存在 `allow` 数组且包含 `"openclaw-agent-dashboard"`,将其移除
|
|
295
|
+
- 若存在 `entries.openclaw-agent-dashboard`,可删除
|
|
296
|
+
- 若存在 `installs.openclaw-agent-dashboard`,可删除
|
|
297
|
+
|
|
298
|
+
保存后执行 `npm run deploy`。
|
|
299
|
+
|
|
300
|
+
## 许可证
|
|
301
|
+
|
|
302
|
+
MIT
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# OpenClaw Agent Dashboard — 修改点汇总
|
|
2
|
+
|
|
3
|
+
本文档汇总近期对 **openclaw-agent-dashboard** 工程的修改,便于他人评审与追溯。
|
|
4
|
+
修改范围:TPM/RPM 统计、连接状态、Windows 启动、调试能力及文档。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 一、TPM 趋势无值 / 多接口 usage 兼容
|
|
9
|
+
|
|
10
|
+
### 问题
|
|
11
|
+
- 性能监控中 **TPM 趋势** 一直为 0,RPM 趋势有值。
|
|
12
|
+
- 原因:TPM 仅依赖 `usage.totalTokens`,而不同大模型/网关返回的 usage 格式不一(如 `input`/`output`、`input_tokens`/`output_tokens` 等),或上游未写入 totalTokens 导致为 0。
|
|
13
|
+
|
|
14
|
+
### 修改策略
|
|
15
|
+
- **不再枚举字段名**:采用两段逻辑——
|
|
16
|
+
1. 若有明确总量字段(`totalTokens` / `total_tokens` / `total`)且 > 0,直接使用;
|
|
17
|
+
2. 否则对 `usage` 内**所有数值**求和作为总 token 数,兼容任意命名。
|
|
18
|
+
- 避免对同一用量重复计算:有总量时只返回总量,不再参与求和。
|
|
19
|
+
|
|
20
|
+
### 涉及文件
|
|
21
|
+
| 文件 | 修改内容 |
|
|
22
|
+
|------|----------|
|
|
23
|
+
| `plugin/dashboard/api/performance.py` | `_tokens_from_usage()` 重写;新增 `GET /api/performance/debug-usage` 调试接口 |
|
|
24
|
+
| `src/backend/api/performance.py` | 同上(与 plugin 保持一致的逻辑与调试接口) |
|
|
25
|
+
| `plugin/dashboard/performance.py` | `_tokens_from_usage()` 与 plugin api 一致 |
|
|
26
|
+
| `src/backend/performance.py` | 同上 |
|
|
27
|
+
|
|
28
|
+
### 调试接口
|
|
29
|
+
- **GET** `/api/performance/debug-usage?limit=5`
|
|
30
|
+
- 返回:`openclaw_path`、`agents_path_exists`、`samples[]`(含 `usage_raw`、`tokens_computed`)。
|
|
31
|
+
- 用于确认 session 中实际 usage 结构及 TPM 为 0 是否因上游未写入 token 数。
|
|
32
|
+
|
|
33
|
+
### 说明
|
|
34
|
+
- 若 session 中 `usage` 各字段均为 0(如部分 vLLM/本地模型未回传 token),TPM 仍会为 0,需在**写 session 的上游**(OpenClaw/网关/模型适配层)补齐 usage 写入。
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 二、右上角「连接错误」与 WebSocket 回退
|
|
39
|
+
|
|
40
|
+
### 问题
|
|
41
|
+
- Dashboard 右上角连接状态显示「连接错误」。
|
|
42
|
+
- 原因:WebSocket `ws://localhost:38271/ws` 连接失败或建立后因发送初始状态异常而断开;前端未及时进入 HTTP 轮询。
|
|
43
|
+
|
|
44
|
+
### 后端修改
|
|
45
|
+
- **发送初始状态失败时**:捕获异常后仍发送最小 `full_state` payload(空列表/空对象),保持连接不因异常关闭。
|
|
46
|
+
- **心跳协议**:同时支持纯文本 `ping` 与 JSON `{"type":"ping",...}`,并统一以 JSON 回复 `{"type":"pong",...}`,与前端一致。
|
|
47
|
+
|
|
48
|
+
### 前端修改
|
|
49
|
+
- **WebSocket onerror**:除设置状态为 error 外,调用 `handleDisconnect()`,进入重连或 HTTP 轮询,避免一直停在「连接错误」。
|
|
50
|
+
- **重连次数**:默认由 5 次改为 3 次,更快 fallback 到 HTTP 轮询。
|
|
51
|
+
|
|
52
|
+
### 涉及文件
|
|
53
|
+
| 文件 | 修改内容 |
|
|
54
|
+
|------|----------|
|
|
55
|
+
| `plugin/dashboard/api/websocket.py` | 初始状态异常时发最小 payload;心跳支持 JSON ping/pong |
|
|
56
|
+
| `src/backend/api/websocket.py` | 同上 |
|
|
57
|
+
| `frontend/src/managers/RealtimeDataManager.ts` | onerror 时调用 handleDisconnect();reconnectMaxAttempts 默认 3 |
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 三、Windows 下 `npm run start` 报错
|
|
62
|
+
|
|
63
|
+
### 问题
|
|
64
|
+
- 在 Windows PowerShell 执行 `npm run start` 报错:`'OPENCLAW_HOME' 不是内部或外部命令`。
|
|
65
|
+
- 原因:`package.json` 的 start 脚本使用 Linux/Mac 环境变量语法(`OPENCLAW_HOME=${OPENCLAW_HOME:-$HOME/.openclaw} ...`),在 Windows CMD 下无法解析。
|
|
66
|
+
|
|
67
|
+
### 修改
|
|
68
|
+
- 新增 **Node 跨平台启动脚本** `scripts/start.js`:
|
|
69
|
+
- 根据 `OPENCLAW_HOME`、`DASHBOARD_PORT` 环境变量或默认值设置;
|
|
70
|
+
- Windows 使用 `python`,非 Windows 使用 `python3`;
|
|
71
|
+
- 在 `src/backend` 目录下执行 `uvicorn main:app --host 0.0.0.0 --port <port>`。
|
|
72
|
+
- **package.json**:`start` 脚本改为 `node scripts/start.js`。
|
|
73
|
+
|
|
74
|
+
### 涉及文件
|
|
75
|
+
| 文件 | 修改内容 |
|
|
76
|
+
|------|----------|
|
|
77
|
+
| `scripts/start.js` | 新增,跨平台启动 Dashboard 后端 |
|
|
78
|
+
| `package.json` | `"start": "node scripts/start.js"` |
|
|
79
|
+
|
|
80
|
+
### 说明
|
|
81
|
+
- 不影响 Ubuntu/Debian 等 Linux 行为;若已设置 `OPENCLAW_HOME`、`DASHBOARD_PORT`,仍会生效。
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 四、文档与运维
|
|
86
|
+
|
|
87
|
+
### 新增/更新文档
|
|
88
|
+
| 文件 | 用途 |
|
|
89
|
+
|------|------|
|
|
90
|
+
| `RESTART_AND_BUILD.md` | 重启服务、是否需重新打包、一条龙命令(含 Windows PowerShell);插件部署与独立运行两种方式 |
|
|
91
|
+
| `docs/CHANGELOG_AGENT_MODIFICATIONS.md` | 本修改汇总文档,供他人评审 |
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 五、修改文件清单(便于 diff / code review)
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
openclaw-agent-dashboard-main/
|
|
99
|
+
├── package.json # start 改为 node scripts/start.js
|
|
100
|
+
├── RESTART_AND_BUILD.md # 新增:重启与打包说明
|
|
101
|
+
├── scripts/
|
|
102
|
+
│ └── start.js # 新增:跨平台启动脚本
|
|
103
|
+
├── docs/
|
|
104
|
+
│ └── CHANGELOG_AGENT_MODIFICATIONS.md # 本文件
|
|
105
|
+
├── frontend/src/managers/
|
|
106
|
+
│ └── RealtimeDataManager.ts # WebSocket 失败回退与重连次数
|
|
107
|
+
├── plugin/dashboard/api/
|
|
108
|
+
│ ├── performance.py # _tokens_from_usage + debug-usage
|
|
109
|
+
│ └── websocket.py # 初始状态容错 + JSON 心跳
|
|
110
|
+
├── plugin/dashboard/
|
|
111
|
+
│ └── performance.py # _tokens_from_usage 与 api 一致
|
|
112
|
+
├── src/backend/api/
|
|
113
|
+
│ ├── performance.py # 同 plugin/dashboard/api/performance
|
|
114
|
+
│ └── websocket.py # 同 plugin/dashboard/api/websocket
|
|
115
|
+
└── src/backend/
|
|
116
|
+
└── performance.py # _tokens_from_usage 与 api 一致
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 六、建议评审关注点
|
|
122
|
+
|
|
123
|
+
1. **TPM 逻辑**:`_tokens_from_usage` 先取总量、再对 usage 全数值求和的策略是否满足业务(有无误把非 token 数字加进去的风险)。
|
|
124
|
+
2. **WebSocket**:初始状态失败时发最小 payload 是否与前端约定一致;JSON ping/pong 与现有客户端兼容性。
|
|
125
|
+
3. **前端**:onerror 时立即 handleDisconnect 与 onclose 的重复调用是否会导致双重重连定时器(当前实现中 scheduleReconnect 会先 stopReconnect,一般只保留一个定时器)。
|
|
126
|
+
4. **Windows 启动**:`scripts/start.js` 中 `OPENCLAW_HOME` 默认路径、`python`/`python3` 选择在目标环境是否均可用。
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
**文档版本**:v1.0
|
|
131
|
+
**整理日期**:2026-03-13
|
|
132
|
+
**工程**:openclaw-agent-dashboard(含 plugin 与 src/backend 两套路径)
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# 发布新 Latest 版本指南
|
|
2
|
+
|
|
3
|
+
> 修改工程后,按本文步骤推送新 release,该版本会自动成为 GitHub 上的 **Latest**,用户一键安装即会装到该版本。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 一、发布前必读
|
|
8
|
+
|
|
9
|
+
### 1.1 版本号从哪里来?
|
|
10
|
+
|
|
11
|
+
Release 的 **tag 和安装包版本** 由仓库里**两个文件**的 `version` 字段决定(不是由你打的 git tag 名决定):
|
|
12
|
+
|
|
13
|
+
| 文件 | 作用 |
|
|
14
|
+
|------|------|
|
|
15
|
+
| `plugin/openclaw.plugin.json` | 插件元数据,**Release 流程会读这里的 version** 来创建 tag 和 tgz 包名。 |
|
|
16
|
+
| `plugin/package.json` | Node 包配置,需与上面保持一致,否则包版本和展示会错乱。 |
|
|
17
|
+
|
|
18
|
+
**重要**:先改这两个文件里的版本号并提交,再打同版本的 git tag。否则会出现「tag 是 v1.0.2、Release 却是 v1.0.0」的情况。
|
|
19
|
+
|
|
20
|
+
### 1.2 流程概览
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
改代码 → 改两处 version → 提交并 push main → 打 tag 并 push tag → 自动构建并设为 Latest
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 二、操作步骤(以发布 v1.0.2 为例)
|
|
29
|
+
|
|
30
|
+
### 步骤 1:在 main 上并拉取最新
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
git checkout main
|
|
34
|
+
git pull origin main
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 步骤 2:修改两处版本号
|
|
38
|
+
|
|
39
|
+
将 **`plugin/openclaw.plugin.json`** 和 **`plugin/package.json`** 中的 `"version"` 改为新版本,例如 `"1.0.2"`。
|
|
40
|
+
|
|
41
|
+
- 编辑 `plugin/openclaw.plugin.json`,找到 `"version": "x.x.x"` 改为 `"1.0.2"`。
|
|
42
|
+
- 编辑 `plugin/package.json`,同样把 `"version"` 改为 `"1.0.2"`。
|
|
43
|
+
|
|
44
|
+
或用一条命令同时改(把下面的 `1.0.1` 换成你当前版本,`1.0.2` 换成目标版本):
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
sed -i 's/"version": "1.0.1"/"version": "1.0.2"/' plugin/openclaw.plugin.json plugin/package.json
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 步骤 3:提交并推送到 main
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
git add plugin/openclaw.plugin.json plugin/package.json
|
|
54
|
+
git commit -m "chore: bump version to 1.0.2"
|
|
55
|
+
git push origin main
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
> 注意:提交信息用 `-m "..."`,不要写成 `git commit "..."`(会报错 pathspec)。
|
|
59
|
+
|
|
60
|
+
### 步骤 4:打 tag 并推送(触发 Release)
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
git tag v1.0.2
|
|
64
|
+
git push origin v1.0.2
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
推送 tag 后,GitHub Actions 会自动:
|
|
68
|
+
|
|
69
|
+
1. 用该 tag 对应的 commit 构建
|
|
70
|
+
2. 读取 `plugin/openclaw.plugin.json` 的 version,创建 Release 和 tgz
|
|
71
|
+
3. 将本次 Release 设为 **Latest**
|
|
72
|
+
|
|
73
|
+
### 步骤 5:验证
|
|
74
|
+
|
|
75
|
+
- **Actions**:打开 [Actions](https://github.com/Umarchen/openclaw-agent-dashboard/actions),确认 Release workflow 成功。
|
|
76
|
+
- **Releases**:打开 [Releases](https://github.com/Umarchen/openclaw-agent-dashboard/releases),确认出现 **v1.0.2**,且为 **Latest release**。
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 三、用户如何安装
|
|
81
|
+
|
|
82
|
+
默认一键安装即安装 **Latest**(即你刚发布的版本):
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
curl -fsSL https://raw.githubusercontent.com/Umarchen/openclaw-agent-dashboard/main/scripts/install.sh | bash
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
安装指定版本:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
DASHBOARD_VERSION=1.0.2 curl -fsSL https://raw.githubusercontent.com/Umarchen/openclaw-agent-dashboard/main/scripts/install.sh | bash
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 四、快速命令清单(复制用)
|
|
97
|
+
|
|
98
|
+
发布新版本时,把 `1.0.2` 换成你的目标版本号即可:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# 1. 同步 main
|
|
102
|
+
git checkout main && git pull origin main
|
|
103
|
+
|
|
104
|
+
# 2. 改版本号(两处文件,或手动编辑)
|
|
105
|
+
# 编辑 plugin/openclaw.plugin.json 和 plugin/package.json 的 "version"
|
|
106
|
+
|
|
107
|
+
# 3. 提交并推送
|
|
108
|
+
git add plugin/openclaw.plugin.json plugin/package.json
|
|
109
|
+
git commit -m "chore: bump version to 1.0.2"
|
|
110
|
+
git push origin main
|
|
111
|
+
|
|
112
|
+
# 4. 打 tag 并推送,触发 Release
|
|
113
|
+
git tag v1.0.2
|
|
114
|
+
git push origin v1.0.2
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 五、常见问题
|
|
120
|
+
|
|
121
|
+
### 为什么 GitHub 上有的 release 没有「Set as latest」按钮?
|
|
122
|
+
|
|
123
|
+
若该 release 被标成了 **Pre-release**,GitHub 不允许把它设为 Latest,所以只会显示 Pre-release 相关选项。当前流程发布的是正式版并自动设为 Latest,不会出现这种情况。
|
|
124
|
+
|
|
125
|
+
### 推送 main 或 tag 报错:Could not read from remote repository / Connection closed
|
|
126
|
+
|
|
127
|
+
多为网络或权限问题:检查本机能否访问 GitHub、SSH 密钥或 token 是否有效、仓库是否存在且有写权限。
|
|
128
|
+
|
|
129
|
+
### 想重新用同一版本号再发一次(例如 workflow 之前失败了)
|
|
130
|
+
|
|
131
|
+
需要**先删本地 tag、再删远程 tag**,在要发布的 commit(例如当前 main)上重新打 tag 并推送。否则你 push 的仍是旧 tag 指向的旧 commit,Release 会错。完整步骤见下方 [六、Git tag 说明](#六git-tag-说明)。也可参见 `docs/release-operations-manual.md` 的「重新触发构建」一节。
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 六、Git tag 说明
|
|
136
|
+
|
|
137
|
+
发布流程依赖 **git tag**。了解其行为可以避免「改了版本号、删了远程 tag 再 push,结果 Release 还是错的」。
|
|
138
|
+
|
|
139
|
+
### 6.1 tag 是什么?
|
|
140
|
+
|
|
141
|
+
- 每个 **commit** 有一个唯一的 SHA-1(如 `f7db4d1...`)。
|
|
142
|
+
- **tag** 是给某个 commit 起的**固定名字**(如 `v1.0.1`),在 Git 里就是一个「名字 → 该 commit」的引用。
|
|
143
|
+
- 可以理解为:**tag = 钉在某个 commit 上的书签**,不会跟着你后续的新提交自动移动。
|
|
144
|
+
|
|
145
|
+
### 6.2 两种 tag
|
|
146
|
+
|
|
147
|
+
| 类型 | 命令 | 说明 |
|
|
148
|
+
|------|------|------|
|
|
149
|
+
| **轻量 tag** | `git tag v1.0.1` | 只记录「名字 → 当前 commit」,常用。 |
|
|
150
|
+
| **附注 tag** | `git tag -a v1.0.1 -m "Release 1.0.1"` | 会生成带作者、时间、说明的 tag 对象,再让名字指向它。 |
|
|
151
|
+
|
|
152
|
+
本项目的发布用轻量 tag 即可。
|
|
153
|
+
|
|
154
|
+
### 6.3 常用操作实际做了什么?
|
|
155
|
+
|
|
156
|
+
| 操作 | 实际效果 |
|
|
157
|
+
|------|----------|
|
|
158
|
+
| `git tag v1.0.1` | 在当前 HEAD 指向的 commit 上,创建引用 `refs/tags/v1.0.1`,不提交、不改文件。 |
|
|
159
|
+
| `git tag -d v1.0.1` | 删除**本地**的 `v1.0.1` 引用,commit 仍在。 |
|
|
160
|
+
| `git push origin v1.0.1` | 把本地 `v1.0.1` 指向的 commit 的「名字」同步到远程。 |
|
|
161
|
+
| `git push origin --delete v1.0.1` | 删除**远程**的 `v1.0.1` 引用,不删 commit。 |
|
|
162
|
+
|
|
163
|
+
### 6.4 为什么 tag「不会自己更新」?
|
|
164
|
+
|
|
165
|
+
Tag 的设计就是**给历史某一点打标签**(如「这是 1.0.1 正式版」),所以不会随 `git commit` 自动挪到新 commit。要换指向,只能:删掉旧 tag(本地 + 远程),在**新的** commit 上重新打 tag 再 push。
|
|
166
|
+
|
|
167
|
+
### 6.5 把已有版本号重新发布到当前 main(完整步骤)
|
|
168
|
+
|
|
169
|
+
例如 v1.0.1 已存在但指向了旧 commit,想让它指向当前 main 并重新跑 Release:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# 1. 确保在最新 main(已改好 version 的提交)
|
|
173
|
+
git checkout main
|
|
174
|
+
git pull origin main
|
|
175
|
+
|
|
176
|
+
# 2. 删本地 tag(否则会一直指向旧 commit)
|
|
177
|
+
git tag -d v1.0.1
|
|
178
|
+
|
|
179
|
+
# 3. 在当前 commit 上重新打 tag
|
|
180
|
+
git tag v1.0.1
|
|
181
|
+
|
|
182
|
+
# 4. 删远程 tag(若存在)
|
|
183
|
+
git push origin --delete v1.0.1
|
|
184
|
+
|
|
185
|
+
# 5. 推送新 tag,触发 Release workflow
|
|
186
|
+
git push origin v1.0.1
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
之后到 Actions / Releases 确认 v1.0.1 的 Release 和 tgz 是否正常。
|