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.
Files changed (111) hide show
  1. package/.github/workflows/release.yml +56 -0
  2. package/README.md +302 -0
  3. package/docs/CHANGELOG_AGENT_MODIFICATIONS.md +132 -0
  4. package/docs/RELEASE-LATEST.md +189 -0
  5. package/docs/RELEASE-MODEL-CONFIG.md +95 -0
  6. package/docs/release-guide.md +259 -0
  7. package/docs/release-operations-manual.md +167 -0
  8. package/docs/specs/tr3-install-system.md +580 -0
  9. package/docs/windows-collaboration-model-paths-troubleshooting.md +0 -0
  10. package/frontend/index.html +12 -0
  11. package/frontend/package-lock.json +1240 -0
  12. package/frontend/package.json +19 -0
  13. package/frontend/src/App.vue +331 -0
  14. package/frontend/src/components/AgentCard.vue +796 -0
  15. package/frontend/src/components/AgentConfigPanel.vue +539 -0
  16. package/frontend/src/components/AgentDetailPanel.vue +738 -0
  17. package/frontend/src/components/ErrorAnalysisView.vue +546 -0
  18. package/frontend/src/components/ErrorCenterPanel.vue +844 -0
  19. package/frontend/src/components/PerformanceMonitor.vue +515 -0
  20. package/frontend/src/components/SettingsPanel.vue +236 -0
  21. package/frontend/src/components/TokenAnalysisPanel.vue +683 -0
  22. package/frontend/src/components/chain/ChainEdge.vue +85 -0
  23. package/frontend/src/components/chain/ChainNode.vue +166 -0
  24. package/frontend/src/components/chain/TaskChainView.vue +425 -0
  25. package/frontend/src/components/chain/index.ts +3 -0
  26. package/frontend/src/components/chain/types.ts +70 -0
  27. package/frontend/src/components/collaboration/CollaborationFlowSection.vue +1032 -0
  28. package/frontend/src/components/collaboration/CollaborationFlowWrapper.vue +113 -0
  29. package/frontend/src/components/performance/PerformancePanel.vue +119 -0
  30. package/frontend/src/components/performance/PerformanceSection.vue +1137 -0
  31. package/frontend/src/components/tasks/TaskStatusSection.vue +973 -0
  32. package/frontend/src/components/timeline/TimelineConnector.vue +31 -0
  33. package/frontend/src/components/timeline/TimelineRound.vue +135 -0
  34. package/frontend/src/components/timeline/TimelineStep.vue +691 -0
  35. package/frontend/src/components/timeline/TimelineToolLink.vue +109 -0
  36. package/frontend/src/components/timeline/TimelineView.vue +540 -0
  37. package/frontend/src/components/timeline/index.ts +5 -0
  38. package/frontend/src/components/timeline/types.ts +120 -0
  39. package/frontend/src/composables/index.ts +7 -0
  40. package/frontend/src/composables/useDebounce.ts +48 -0
  41. package/frontend/src/composables/useRealtime.ts +52 -0
  42. package/frontend/src/composables/useState.ts +52 -0
  43. package/frontend/src/composables/useThrottle.ts +46 -0
  44. package/frontend/src/composables/useVirtualScroll.ts +106 -0
  45. package/frontend/src/main.ts +4 -0
  46. package/frontend/src/managers/EventDispatcher.ts +127 -0
  47. package/frontend/src/managers/RealtimeDataManager.ts +293 -0
  48. package/frontend/src/managers/StateManager.ts +128 -0
  49. package/frontend/src/managers/index.ts +5 -0
  50. package/frontend/src/types/collaboration.ts +135 -0
  51. package/frontend/src/types/index.ts +20 -0
  52. package/frontend/src/types/performance.ts +105 -0
  53. package/frontend/src/types/task.ts +38 -0
  54. package/frontend/vite.config.ts +18 -0
  55. package/package.json +22 -0
  56. package/plugin/README.md +99 -0
  57. package/plugin/config.json.example +1 -0
  58. package/plugin/index.js +250 -0
  59. package/plugin/openclaw.plugin.json +17 -0
  60. package/plugin/package.json +21 -0
  61. package/scripts/build-plugin.js +67 -0
  62. package/scripts/bundle.sh +62 -0
  63. package/scripts/install-plugin.sh +162 -0
  64. package/scripts/install-python-deps.js +346 -0
  65. package/scripts/install-python-deps.sh +226 -0
  66. package/scripts/install.js +512 -0
  67. package/scripts/install.sh +367 -0
  68. package/scripts/lib/common.js +490 -0
  69. package/scripts/lib/common.sh +137 -0
  70. package/scripts/release-pack.sh +110 -0
  71. package/scripts/start.js +50 -0
  72. package/scripts/test_available_models.py +284 -0
  73. package/scripts/test_websocket_ping.py +44 -0
  74. package/src/backend/agents.py +73 -0
  75. package/src/backend/api/__init__.py +1 -0
  76. package/src/backend/api/agent_config_api.py +90 -0
  77. package/src/backend/api/agents.py +73 -0
  78. package/src/backend/api/agents_config.py +75 -0
  79. package/src/backend/api/chains.py +126 -0
  80. package/src/backend/api/collaboration.py +902 -0
  81. package/src/backend/api/debug_paths.py +39 -0
  82. package/src/backend/api/error_analysis.py +146 -0
  83. package/src/backend/api/errors.py +281 -0
  84. package/src/backend/api/performance.py +784 -0
  85. package/src/backend/api/subagents.py +770 -0
  86. package/src/backend/api/timeline.py +144 -0
  87. package/src/backend/api/websocket.py +251 -0
  88. package/src/backend/collaboration.py +405 -0
  89. package/src/backend/data/__init__.py +1 -0
  90. package/src/backend/data/agent_config_manager.py +270 -0
  91. package/src/backend/data/chain_reader.py +299 -0
  92. package/src/backend/data/config_reader.py +153 -0
  93. package/src/backend/data/error_analyzer.py +430 -0
  94. package/src/backend/data/session_reader.py +445 -0
  95. package/src/backend/data/subagent_reader.py +244 -0
  96. package/src/backend/data/task_history.py +118 -0
  97. package/src/backend/data/timeline_reader.py +981 -0
  98. package/src/backend/errors.py +63 -0
  99. package/src/backend/main.py +89 -0
  100. package/src/backend/mechanism_reader.py +131 -0
  101. package/src/backend/mechanisms.py +32 -0
  102. package/src/backend/performance.py +474 -0
  103. package/src/backend/requirements.txt +5 -0
  104. package/src/backend/session_reader.py +238 -0
  105. package/src/backend/status/__init__.py +1 -0
  106. package/src/backend/status/error_detector.py +122 -0
  107. package/src/backend/status/status_calculator.py +301 -0
  108. package/src/backend/status_calculator.py +121 -0
  109. package/src/backend/subagent_reader.py +229 -0
  110. package/src/backend/watchers/__init__.py +4 -0
  111. package/src/backend/watchers/file_watcher.py +159 -0
@@ -0,0 +1,580 @@
1
+ # TR3: 安装系统技术需求分析
2
+
3
+ > 版本: 1.0
4
+ > 日期: 2026-03-06
5
+ > 状态: 待审核
6
+
7
+ ---
8
+
9
+ ## 一、背景与目标
10
+
11
+ ### 1.1 当前问题
12
+
13
+ | 问题 | 影响 |
14
+ |------|------|
15
+ | 用户需要 `git clone` + `npm run deploy` | 门槛高,需要 Node/npm 环境 |
16
+ | 需要本地构建前端 | 构建时间长,依赖 Node 生态 |
17
+ | 安装脚本耦合度高 | `install-plugin.sh` 包含构建、打包、安装全流程 |
18
+ | 无版本管理 | 无法指定安装特定版本 |
19
+
20
+ ### 1.2 目标
21
+
22
+ 1. **用户体验**:一条命令完成安装,无需 Node/npm/构建环境
23
+ 2. **版本控制**:支持安装指定版本或最新版本
24
+ 3. **跨平台**:支持 Linux、macOS、Windows(Git Bash)
25
+ 4. **开发者友好**:保留从源码安装的能力
26
+
27
+ ---
28
+
29
+ ## 二、系统架构
30
+
31
+ ### 2.1 整体流程
32
+
33
+ ```
34
+ ┌─────────────────────────────────────────────────────────────────┐
35
+ │ 安装入口 │
36
+ ├─────────────────────────────────────────────────────────────────┤
37
+ │ │
38
+ │ curl | bash install.sh ./install-plugin.sh │
39
+ │ (普通用户) (开发者) │
40
+ │ │ │ │
41
+ │ ▼ ▼ │
42
+ │ ┌─────────────┐ ┌─────────────┐ │
43
+ │ │ 下载预构建包 │ │ 本地构建打包 │ │
44
+ │ │ (GitHub/CDN)│ │ npm run pack│ │
45
+ │ └──────┬──────┘ └──────┬──────┘ │
46
+ │ │ │ │
47
+ │ ▼ ▼ │
48
+ │ ┌─────────────────────────────────────────────┐ │
49
+ │ │ openclaw plugins install *.tgz │ │
50
+ │ └──────────────────────┬──────────────────────┘ │
51
+ │ │ │
52
+ │ ▼ │
53
+ │ ┌─────────────────────────────────────────────┐ │
54
+ │ │ install-python-deps.sh (可选) │ │
55
+ │ │ 安装 Python 后端依赖 │ │
56
+ │ └─────────────────────────────────────────────┘ │
57
+ │ │
58
+ └─────────────────────────────────────────────────────────────────┘
59
+ ```
60
+
61
+ ### 2.2 文件结构
62
+
63
+ ```
64
+ scripts/
65
+ ├── install.sh # 入口脚本:curl | bash 一键安装
66
+ ├── install-plugin.sh # 开发者脚本:从源码安装(保留)
67
+ ├── install-python-deps.sh # Python 依赖安装(新增,从 install-plugin.sh 抽取)
68
+ ├── build-plugin.js # 构建脚本(不变)
69
+ ├── bundle.sh # 离线打包(不变)
70
+ └── release-pack.sh # 发布打包(新增)
71
+
72
+ .github/workflows/
73
+ └── release.yml # CI 发布流程(新增)
74
+ ```
75
+
76
+ ---
77
+
78
+ ## 三、组件详细设计
79
+
80
+ ### 3.1 预构建包 (Pre-built Package)
81
+
82
+ #### 3.1.1 包格式
83
+
84
+ | 项目 | 规格 |
85
+ |------|------|
86
+ | 格式 | `.tgz` (tarball) |
87
+ | 命名 | `openclaw-agent-dashboard-v{VERSION}.tgz` |
88
+ | 大小 | ~130KB (压缩后) |
89
+ | 平台 | 跨平台通用 (无二进制依赖) |
90
+
91
+ #### 3.1.2 包内容
92
+
93
+ ```
94
+ openclaw-agent-dashboard-v1.0.0.tgz
95
+ └── package/
96
+ ├── openclaw.plugin.json # 插件元数据
97
+ ├── package.json # npm 包信息
98
+ ├── index.js # 插件入口 (Node.js)
99
+ ├── dashboard/ # Python 后端
100
+ │ ├── main.py
101
+ │ ├── requirements.txt
102
+ │ ├── api/
103
+ │ ├── data/
104
+ │ └── ...
105
+ └── frontend-dist/ # 前端构建产物
106
+ ├── index.html
107
+ └── assets/
108
+ ```
109
+
110
+ #### 3.1.3 生成方式
111
+
112
+ ```bash
113
+ # scripts/release-pack.sh
114
+ npm run pack # 构建前端 + 复制文件到 plugin/
115
+ cd plugin && npm pack # 生成 tgz
116
+ mv *.tgz ../openclaw-agent-dashboard-v${VERSION}.tgz
117
+ ```
118
+
119
+ #### 3.1.4 发布渠道
120
+
121
+ | 渠道 | URL 格式 |
122
+ |------|----------|
123
+ | GitHub Releases (主) | `https://github.com/{owner}/{repo}/releases/download/v{VERSION}/openclaw-agent-dashboard-v{VERSION}.tgz` |
124
+ | 自定义 CDN (备) | `https://cdn.example.com/openclaw-agent-dashboard-v{VERSION}.tgz` |
125
+
126
+ ---
127
+
128
+ ### 3.2 install.sh (入口脚本)
129
+
130
+ #### 3.2.1 功能规格
131
+
132
+ | 功能 | 说明 |
133
+ |------|------|
134
+ | 系统检测 | Linux / macOS / Windows (Git Bash) |
135
+ | 前置检查 | openclaw CLI 是否已安装 |
136
+ | 版本解析 | 支持指定版本或获取最新版本 |
137
+ | 下载 | curl / wget 自动选择 |
138
+ | 安装 | 调用 `openclaw plugins install` |
139
+ | Python 依赖 | 调用 `install-python-deps.sh` |
140
+
141
+ #### 3.2.2 命令行接口
142
+
143
+ ```bash
144
+ # 默认安装最新版本
145
+ curl -fsSL https://raw.githubusercontent.com/{owner}/{repo}/main/scripts/install.sh | bash
146
+
147
+ # 指定版本
148
+ DASHBOARD_VERSION=1.0.0 bash install.sh
149
+
150
+ # 使用自定义下载源
151
+ DASHBOARD_RELEASE_URL=https://cdn.example.com/xxx.tgz bash install.sh
152
+
153
+ # 调试模式
154
+ VERBOSE=1 bash install.sh
155
+
156
+ # 预览模式
157
+ DRY_RUN=1 bash install.sh
158
+ ```
159
+
160
+ #### 3.2.3 环境变量
161
+
162
+ | 变量 | 默认值 | 说明 |
163
+ |------|--------|------|
164
+ | `DASHBOARD_VERSION` | `latest` | 安装版本 |
165
+ | `DASHBOARD_RELEASE_URL` | - | 完整下载 URL (覆盖版本) |
166
+ | `DASHBOARD_SKIP_PYTHON` | `0` | 跳过 Python 依赖安装 |
167
+ | `VERBOSE` | `0` | 显示详细输出 |
168
+ | `DRY_RUN` | `0` | 预览模式 |
169
+
170
+ #### 3.2.4 流程伪代码
171
+
172
+ ```bash
173
+ main() {
174
+ # 1. 检测系统
175
+ OS=$(detect_os)
176
+ validate_os "$OS"
177
+
178
+ # 2. 检查 openclaw
179
+ check_command openclaw "npm install -g openclaw"
180
+
181
+ # 3. 解析版本
182
+ VERSION=$(resolve_version "${DASHBOARD_VERSION:-latest}")
183
+
184
+ # 4. 构建下载 URL
185
+ DOWNLOAD_URL=$(build_download_url "$VERSION")
186
+
187
+ # 5. 下载到临时目录
188
+ TMP_DIR=$(mktemp -d)
189
+ TGZ_FILE="$TMP_DIR/openclaw-agent-dashboard.tgz"
190
+ download_file "$DOWNLOAD_URL" "$TGZ_FILE"
191
+
192
+ # 6. 清理旧安装
193
+ cleanup_old_installation
194
+
195
+ # 7. 安装插件
196
+ openclaw plugins install "$TGZ_FILE"
197
+
198
+ # 8. 安装 Python 依赖
199
+ if [ "$DASHBOARD_SKIP_PYTHON" != "1" ]; then
200
+ install_python_deps "$PLUGIN_PATH"
201
+ fi
202
+
203
+ # 9. 清理临时文件
204
+ rm -rf "$TMP_DIR"
205
+
206
+ # 10. 输出成功信息
207
+ print_success_message
208
+ }
209
+ ```
210
+
211
+ #### 3.2.5 版本解析逻辑
212
+
213
+ ```bash
214
+ resolve_version() {
215
+ local requested="$1"
216
+
217
+ if [ "$requested" = "latest" ]; then
218
+ # 方案 A: 使用 GitHub API (有速率限制)
219
+ # curl -s https://api.github.com/repos/{owner}/{repo}/releases/latest | jq -r .tag_name
220
+
221
+ # 方案 B: 使用 GitHub 重定向 (推荐,无速率限制)
222
+ local latest_url="https://github.com/{owner}/{repo}/releases/latest"
223
+ local release_page
224
+ release_page=$(curl -fsSL "$latest_url" 2>/dev/null)
225
+ # 从页面提取版本号或使用重定向 URL
226
+ echo "$latest_version"
227
+ else
228
+ echo "$requested"
229
+ fi
230
+ }
231
+ ```
232
+
233
+ #### 3.2.6 清理逻辑
234
+
235
+ ```bash
236
+ cleanup_old_installation() {
237
+ local plugin_dir="${OPENCLAW_CONFIG_DIR}/extensions/openclaw-agent-dashboard"
238
+
239
+ # 尝试卸载配置记录
240
+ openclaw plugins uninstall openclaw-agent-dashboard --force 2>/dev/null || true
241
+
242
+ # 删除物理目录 (uninstall 不删除目录)
243
+ if [ -d "$plugin_dir" ]; then
244
+ rm -rf "$plugin_dir"
245
+ fi
246
+ }
247
+ ```
248
+
249
+ ---
250
+
251
+ ### 3.3 install-python-deps.sh
252
+
253
+ #### 3.3.1 功能
254
+
255
+ 从 `install-plugin.sh` 抽取 Python 依赖安装逻辑,供多个入口复用。
256
+
257
+ #### 3.3.2 接口
258
+
259
+ ```bash
260
+ # 用法
261
+ ./scripts/install-python-deps.sh <plugin_dir> [options]
262
+
263
+ # 示例
264
+ ./scripts/install-python-deps.sh ~/.openclaw/extensions/openclaw-agent-dashboard
265
+ ./scripts/install-python-deps.sh ~/.openclaw/extensions/openclaw-agent-dashboard --verbose
266
+ ```
267
+
268
+ #### 3.3.3 参数
269
+
270
+ | 参数 | 说明 |
271
+ |------|------|
272
+ | `$1` | 插件安装目录 (必须) |
273
+ | `--verbose` | 显示详细输出 |
274
+ | `--venv-only` | 仅使用 venv,不回退 pip |
275
+ | `--skip-create` | 跳过创建 venv (已存在) |
276
+
277
+ #### 3.3.4 安装策略
278
+
279
+ ```
280
+ 策略 1: venv (推荐)
281
+ ├── python3 -m venv .venv
282
+ ├── .venv/bin/pip install -r requirements.txt
283
+ └── 优点: 隔离环境,不受 PEP 668 影响
284
+
285
+ 策略 2: pip --user (回退)
286
+ ├── python3 -m pip install -r requirements.txt --user
287
+ └── 优点: 无需 venv 支持
288
+
289
+ 策略 3: 系统 pip (最后回退)
290
+ ├── pip install -r requirements.txt
291
+ └── 适用于有权限的环境
292
+ ```
293
+
294
+ ---
295
+
296
+ ### 3.4 release-pack.sh
297
+
298
+ #### 3.4.1 功能
299
+
300
+ 生成预构建包,供 CI 或本地发布使用。
301
+
302
+ #### 3.4.2 流程
303
+
304
+ ```bash
305
+ #!/usr/bin/env bash
306
+ set -euo pipefail
307
+
308
+ cd "$(dirname "$0")/.."
309
+ ROOT=$(pwd)
310
+
311
+ # 1. 读取版本
312
+ VERSION=$(jq -r '.version' "$ROOT/plugin/openclaw.plugin.json")
313
+ OUTPUT_FILE="$ROOT/openclaw-agent-dashboard-v${VERSION}.tgz"
314
+
315
+ # 2. 确保已构建
316
+ if [ ! -d "$ROOT/plugin/frontend-dist" ]; then
317
+ npm run pack
318
+ fi
319
+
320
+ # 3. 生成 tgz
321
+ cd "$ROOT/plugin"
322
+ npm pack
323
+
324
+ # 4. 重命名并移动
325
+ mv openclaw-agent-dashboard-*.tgz "$OUTPUT_FILE"
326
+
327
+ echo "✓ 已生成: $OUTPUT_FILE"
328
+ ```
329
+
330
+ ---
331
+
332
+ ### 3.5 install-plugin.sh (简化)
333
+
334
+ #### 3.5.1 变更
335
+
336
+ | 变更项 | 说明 |
337
+ |------|------|
338
+ | 移除 Python 依赖逻辑 | 调用 `install-python-deps.sh` |
339
+ | 保留构建逻辑 | 开发者从源码安装需要 |
340
+ | 保留 dry-run/verbose | 调试支持 |
341
+
342
+ #### 3.5.2 简化后流程
343
+
344
+ ```bash
345
+ # 1. 检查前置条件 (node, python3, openclaw)
346
+ # 2. 构建前端 (若未构建)
347
+ # 3. 打包插件
348
+ # 4. 清理旧安装
349
+ # 5. 安装插件
350
+ # 6. 调用 install-python-deps.sh
351
+ ```
352
+
353
+ ---
354
+
355
+ ## 四、CI/CD 配置
356
+
357
+ ### 4.1 GitHub Actions 工作流
358
+
359
+ ```yaml
360
+ # .github/workflows/release.yml
361
+ name: Release
362
+
363
+ on:
364
+ push:
365
+ tags:
366
+ - 'v*'
367
+ workflow_dispatch:
368
+
369
+ jobs:
370
+ build:
371
+ runs-on: ubuntu-latest
372
+ steps:
373
+ - uses: actions/checkout@v4
374
+
375
+ - uses: actions/setup-node@v4
376
+ with:
377
+ node-version: '22'
378
+
379
+ - name: Install dependencies
380
+ run: npm ci
381
+
382
+ - name: Build plugin
383
+ run: npm run pack
384
+
385
+ - name: Create release package
386
+ run: bash scripts/release-pack.sh
387
+
388
+ - name: Upload artifact
389
+ uses: actions/upload-artifact@v4
390
+ with:
391
+ name: plugin-tgz
392
+ path: openclaw-agent-dashboard-v*.tgz
393
+
394
+ release:
395
+ needs: build
396
+ runs-on: ubuntu-latest
397
+ permissions:
398
+ contents: write
399
+ steps:
400
+ - uses: actions/checkout@v4
401
+
402
+ - name: Download artifact
403
+ uses: actions/download-artifact@v4
404
+ with:
405
+ name: plugin-tgz
406
+
407
+ - name: Get version
408
+ id: version
409
+ run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
410
+
411
+ - name: Create Release
412
+ uses: softprops/action-gh-release@v1
413
+ with:
414
+ files: openclaw-agent-dashboard-v*.tgz
415
+ generate_release_notes: true
416
+ ```
417
+
418
+ ---
419
+
420
+ ## 五、跨平台兼容性
421
+
422
+ ### 5.1 平台支持矩阵
423
+
424
+ | 平台 | 支持级别 | 说明 |
425
+ |------|----------|------|
426
+ | Linux (x64/ARM) | ✅ 完全支持 | 主要目标平台 |
427
+ | macOS (x64/ARM) | ✅ 完全支持 | 主要目标平台 |
428
+ | Windows + Git Bash | ✅ 支持 | 需要 Git for Windows |
429
+ | Windows + PowerShell | ⚠️ 部分支持 | 需提供 `install.ps1` |
430
+ | Windows + WSL | ✅ 完全支持 | 视同 Linux |
431
+
432
+ ### 5.2 Windows PowerShell 脚本 (可选)
433
+
434
+ ```powershell
435
+ # install.ps1
436
+ param(
437
+ [string]$Version = "latest",
438
+ [switch]$Verbose,
439
+ [switch]$DryRun
440
+ )
441
+
442
+ # 检测 openclaw
443
+ if (-not (Get-Command openclaw -ErrorAction SilentlyContinue)) {
444
+ Write-Error "未找到 openclaw,请先安装: npm install -g openclaw"
445
+ exit 1
446
+ }
447
+
448
+ # 下载并安装
449
+ $DownloadUrl = "https://github.com/{owner}/{repo}/releases/download/v$Version/openclaw-agent-dashboard-v$Version.tgz"
450
+ $TempFile = Join-Path $env:TEMP "openclaw-agent-dashboard.tgz"
451
+
452
+ Invoke-WebRequest -Uri $DownloadUrl -OutFile $TempFile
453
+ openclaw plugins install $TempFile
454
+
455
+ # Python 依赖
456
+ # ...
457
+ ```
458
+
459
+ ---
460
+
461
+ ## 六、错误处理
462
+
463
+ ### 6.1 错误码定义
464
+
465
+ | 错误码 | 说明 | 建议操作 |
466
+ |--------|------|----------|
467
+ | 1 | 前置条件不满足 | 安装缺失的依赖 |
468
+ | 2 | 下载失败 | 检查网络/代理,或手动下载 |
469
+ | 3 | 安装失败 | 查看 `VERBOSE=1` 输出 |
470
+ | 4 | Python 依赖失败 | 手动运行 `install-python-deps.sh` |
471
+ | 5 | 权限不足 | 检查目录权限 |
472
+
473
+ ### 6.2 错误消息模板
474
+
475
+ ```bash
476
+ log_error "下载失败: $DOWNLOAD_URL"
477
+ log_info "可能的原因:"
478
+ log_info " 1. 网络连接问题"
479
+ log_info " 2. 版本不存在: v$VERSION"
480
+ log_info " 3. GitHub 访问受限"
481
+ log_info ""
482
+ log_info "尝试:"
483
+ log_info " 1. 检查网络连接"
484
+ log_info " 2. 设置代理: export https_proxy=http://proxy:port"
485
+ log_info " 3. 手动下载: curl -LO $DOWNLOAD_URL"
486
+ log_info " 4. 指定版本: DASHBOARD_VERSION=1.0.0 bash install.sh"
487
+ ```
488
+
489
+ ---
490
+
491
+ ## 七、测试计划
492
+
493
+ ### 7.1 单元测试
494
+
495
+ | 测试项 | 测试内容 |
496
+ |--------|----------|
497
+ | `detect_os()` | Linux/macOS/Windows 正确识别 |
498
+ | `resolve_version()` | latest → 获取最新版本,指定版本 → 返回指定值 |
499
+ | `build_download_url()` | URL 格式正确 |
500
+ | `cleanup_old_installation()` | 目录被正确删除 |
501
+
502
+ ### 7.2 集成测试
503
+
504
+ | 场景 | 步骤 | 预期结果 |
505
+ |------|------|----------|
506
+ | 全新安装 | 空环境 → 安装 | 插件可用 |
507
+ | 升级安装 | 旧版本 → 新版本 | 升级成功 |
508
+ | 离线安装 | 本地 tgz → 安装 | 插件可用 |
509
+ | 网络失败 | 断网 → 安装 | 明确错误提示 |
510
+ | Python 失败 | 无 pip → 安装 | 插件安装成功,提示 Python 依赖失败 |
511
+
512
+ ### 7.3 平台测试
513
+
514
+ | 平台 | 测试环境 |
515
+ |------|----------|
516
+ | Linux | Ubuntu 22.04, Debian 12 |
517
+ | macOS | Intel + Apple Silicon |
518
+ | Windows | Git Bash, PowerShell |
519
+
520
+ ---
521
+
522
+ ## 八、实施计划
523
+
524
+ ### 8.1 阶段划分
525
+
526
+ | 阶段 | 任务 | 依赖 |
527
+ |------|------|------|
528
+ | P1 | 新增 `release-pack.sh` | 无 |
529
+ | P1 | 新增 `install-python-deps.sh` | 无 |
530
+ | P1 | 简化 `install-plugin.sh` | P1 |
531
+ | P2 | 新增 `install.sh` | P1 |
532
+ | P2 | 新增 GitHub Actions | P1 |
533
+ | P3 | 新增 `install.ps1` (可选) | P2 |
534
+ | P3 | 更新 README | P2 |
535
+
536
+ ### 8.2 验收标准
537
+
538
+ - [ ] `curl | bash install.sh` 可在无 Node 环境的 Linux/macOS 完成
539
+ - [ ] `DASHBOARD_VERSION=x.x.x bash install.sh` 安装指定版本
540
+ - [ ] `VERBOSE=1` 显示详细调试信息
541
+ - [ ] `DRY_RUN=1` 预览安装过程
542
+ - [ ] 升级安装正常工作
543
+ - [ ] GitHub Release 自动附带 tgz
544
+
545
+ ---
546
+
547
+ ## 九、风险与缓解
548
+
549
+ | 风险 | 概率 | 影响 | 缓解措施 |
550
+ |------|------|------|----------|
551
+ | GitHub API 限流 | 中 | 无法获取最新版本 | 使用重定向 URL 替代 API |
552
+ | GitHub Releases 不可用 | 低 | 无法下载 | 支持自定义 CDN URL |
553
+ | Python 环境问题 | 中 | 后端不可用 | 多策略安装 + 明确错误提示 |
554
+ | Windows 兼容性 | 中 | 部分用户无法使用 | 提供 Git Bash 文档 + PowerShell 脚本 |
555
+
556
+ ---
557
+
558
+ ## 十、附录
559
+
560
+ ### A. 相关文件
561
+
562
+ | 文件 | 说明 |
563
+ |------|------|
564
+ | `docs/install-script-plan-v2.md` | 原始方案文档 |
565
+ | `scripts/install-plugin.sh` | 现有安装脚本 |
566
+ | `docs/python-environment-compatibility.md` | Python 环境兼容性说明 |
567
+
568
+ ### B. 参考资料
569
+
570
+ - [openclaw plugins install 支持 .tgz 格式](验证通过)
571
+ - [npm pack 文档](https://docs.npmjs.com/cli/v10/commands/npm-pack)
572
+ - [GitHub Releases API](https://docs.github.com/en/rest/releases)
573
+
574
+ ### C. 术语表
575
+
576
+ | 术语 | 说明 |
577
+ |------|------|
578
+ | tgz | tarball + gzip 压缩格式,npm pack 的输出格式 |
579
+ | PEP 668 | Python Enhancement Proposal 668,限制系统 Python 安装包 |
580
+ | venv | Python 虚拟环境,隔离依赖 |
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>OpenClow Agent Dashboard</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.ts"></script>
11
+ </body>
12
+ </html>