openclaw-agent-dashboard 1.0.21 → 1.0.23

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 (135) hide show
  1. package/README.md +55 -321
  2. package/frontend-dist/assets/index-B7XqKAxm.css +1 -0
  3. package/frontend-dist/assets/index-CxJaSYyo.js +24 -0
  4. package/{frontend → frontend-dist}/index.html +2 -1
  5. package/{plugin/openclaw.plugin.json → openclaw.plugin.json} +2 -2
  6. package/package.json +21 -13
  7. package/.github/workflows/release.yml +0 -56
  8. package/VERSION_DISPLAY_delivery.md +0 -242
  9. package/VERSION_DISPLAY_implementation_summary.md +0 -315
  10. package/design_manifest.md +0 -100
  11. package/docs/CHANGELOG_AGENT_MODIFICATIONS.md +0 -132
  12. package/docs/MAINTAINER_RELEASE_WORKFLOW.md +0 -211
  13. package/docs/Openclaw-Agent-Dashboard/345/217/221/345/270/203/344/270/216/346/233/264/346/226/260.md +0 -147
  14. package/docs/RELEASE-LATEST.md +0 -189
  15. package/docs/RELEASE-MODEL-CONFIG.md +0 -95
  16. package/docs/WINDOWS_INSTALL_TROUBLESHOOTING.md +0 -171
  17. package/docs/design/.gitkeep +0 -0
  18. package/docs/design/VERSION_DISPLAY_design.md +0 -1236
  19. package/docs/release-guide.md +0 -259
  20. package/docs/release-operations-manual.md +0 -167
  21. package/docs/reviews/.gitkeep +0 -0
  22. package/docs/reviews/approval_history.json +0 -14
  23. package/docs/reviews/cr_VERSION_DISPLAY.md +0 -397
  24. package/docs/reviews/traceability_manifest.json +0 -279
  25. package/docs/specs/VERSION_DISPLAY_spec.md +0 -371
  26. package/docs/specs/tr3-install-system.md +0 -580
  27. package/docs/windows-collaboration-model-paths-troubleshooting.md +0 -0
  28. package/frontend/package-lock.json +0 -1240
  29. package/frontend/package.json +0 -19
  30. package/frontend/src/App.vue +0 -355
  31. package/frontend/src/components/AgentCard.vue +0 -796
  32. package/frontend/src/components/AgentConfigPanel.vue +0 -539
  33. package/frontend/src/components/AgentDetailPanel.vue +0 -738
  34. package/frontend/src/components/ErrorAnalysisView.vue +0 -546
  35. package/frontend/src/components/ErrorCenterPanel.vue +0 -844
  36. package/frontend/src/components/PerformanceMonitor.vue +0 -515
  37. package/frontend/src/components/SettingsPanel.vue +0 -236
  38. package/frontend/src/components/TokenAnalysisPanel.vue +0 -683
  39. package/frontend/src/components/chain/ChainEdge.vue +0 -85
  40. package/frontend/src/components/chain/ChainNode.vue +0 -166
  41. package/frontend/src/components/chain/TaskChainView.vue +0 -425
  42. package/frontend/src/components/chain/index.ts +0 -3
  43. package/frontend/src/components/chain/types.ts +0 -70
  44. package/frontend/src/components/collaboration/CollaborationFlowSection.vue +0 -1032
  45. package/frontend/src/components/collaboration/CollaborationFlowWrapper.vue +0 -113
  46. package/frontend/src/components/common/VersionDisplay.vue +0 -187
  47. package/frontend/src/components/performance/PerformancePanel.vue +0 -119
  48. package/frontend/src/components/performance/PerformanceSection.vue +0 -1137
  49. package/frontend/src/components/tasks/TaskStatusSection.vue +0 -973
  50. package/frontend/src/components/timeline/TimelineConnector.vue +0 -31
  51. package/frontend/src/components/timeline/TimelineRound.vue +0 -135
  52. package/frontend/src/components/timeline/TimelineStep.vue +0 -691
  53. package/frontend/src/components/timeline/TimelineToolLink.vue +0 -109
  54. package/frontend/src/components/timeline/TimelineView.vue +0 -540
  55. package/frontend/src/components/timeline/index.ts +0 -5
  56. package/frontend/src/components/timeline/types.ts +0 -120
  57. package/frontend/src/composables/index.ts +0 -7
  58. package/frontend/src/composables/useDebounce.ts +0 -48
  59. package/frontend/src/composables/useRealtime.ts +0 -52
  60. package/frontend/src/composables/useState.ts +0 -52
  61. package/frontend/src/composables/useThrottle.ts +0 -46
  62. package/frontend/src/composables/useVirtualScroll.ts +0 -106
  63. package/frontend/src/main.ts +0 -4
  64. package/frontend/src/managers/EventDispatcher.ts +0 -127
  65. package/frontend/src/managers/RealtimeDataManager.ts +0 -302
  66. package/frontend/src/managers/StateManager.ts +0 -128
  67. package/frontend/src/managers/index.ts +0 -5
  68. package/frontend/src/types/collaboration.ts +0 -135
  69. package/frontend/src/types/index.ts +0 -20
  70. package/frontend/src/types/performance.ts +0 -105
  71. package/frontend/src/types/task.ts +0 -38
  72. package/frontend/vite.config.ts +0 -18
  73. package/legacy_code_anatomy.md +0 -518
  74. package/plugin/README.md +0 -99
  75. package/plugin/config.json.example +0 -1
  76. package/plugin/package.json +0 -26
  77. package/scripts/build-plugin.js +0 -81
  78. package/scripts/bundle.sh +0 -62
  79. package/scripts/install-plugin.sh +0 -162
  80. package/scripts/install-python-deps.sh +0 -226
  81. package/scripts/install.js +0 -684
  82. package/scripts/install.sh +0 -367
  83. package/scripts/lib/common.sh +0 -137
  84. package/scripts/release-pack.sh +0 -110
  85. package/scripts/start.js +0 -50
  86. package/scripts/test_available_models.py +0 -284
  87. package/scripts/test_version_display.sh +0 -128
  88. package/scripts/test_websocket_ping.py +0 -44
  89. package/session_registry.json +0 -58
  90. package/tests/.gitkeep +0 -0
  91. package/tests/qa_regression_report.md +0 -359
  92. package/tests/qa_version_display_report.md +0 -598
  93. /package/{src/backend → dashboard}/agents.py +0 -0
  94. /package/{src/backend → dashboard}/api/__init__.py +0 -0
  95. /package/{src/backend → dashboard}/api/agent_config_api.py +0 -0
  96. /package/{src/backend → dashboard}/api/agents.py +0 -0
  97. /package/{src/backend → dashboard}/api/agents_config.py +0 -0
  98. /package/{src/backend → dashboard}/api/chains.py +0 -0
  99. /package/{src/backend → dashboard}/api/collaboration.py +0 -0
  100. /package/{src/backend → dashboard}/api/debug_paths.py +0 -0
  101. /package/{src/backend → dashboard}/api/error_analysis.py +0 -0
  102. /package/{src/backend → dashboard}/api/errors.py +0 -0
  103. /package/{src/backend → dashboard}/api/performance.py +0 -0
  104. /package/{src/backend → dashboard}/api/subagents.py +0 -0
  105. /package/{src/backend → dashboard}/api/timeline.py +0 -0
  106. /package/{src/backend → dashboard}/api/version.py +0 -0
  107. /package/{src/backend → dashboard}/api/websocket.py +0 -0
  108. /package/{src/backend → dashboard}/collaboration.py +0 -0
  109. /package/{src/backend → dashboard}/data/__init__.py +0 -0
  110. /package/{src/backend → dashboard}/data/agent_config_manager.py +0 -0
  111. /package/{src/backend → dashboard}/data/chain_reader.py +0 -0
  112. /package/{src/backend → dashboard}/data/config_reader.py +0 -0
  113. /package/{src/backend → dashboard}/data/error_analyzer.py +0 -0
  114. /package/{src/backend → dashboard}/data/session_reader.py +0 -0
  115. /package/{src/backend → dashboard}/data/subagent_reader.py +0 -0
  116. /package/{src/backend → dashboard}/data/task_history.py +0 -0
  117. /package/{src/backend → dashboard}/data/timeline_reader.py +0 -0
  118. /package/{src/backend → dashboard}/data/version_info_reader.py +0 -0
  119. /package/{src/backend → dashboard}/errors.py +0 -0
  120. /package/{src/backend → dashboard}/main.py +0 -0
  121. /package/{src/backend → dashboard}/mechanism_reader.py +0 -0
  122. /package/{src/backend → dashboard}/mechanisms.py +0 -0
  123. /package/{src/backend → dashboard}/performance.py +0 -0
  124. /package/{src/backend → dashboard}/requirements.txt +0 -0
  125. /package/{src/backend → dashboard}/session_reader.py +0 -0
  126. /package/{src/backend → dashboard}/status/__init__.py +0 -0
  127. /package/{src/backend → dashboard}/status/change_tracker.py +0 -0
  128. /package/{src/backend → dashboard}/status/error_detector.py +0 -0
  129. /package/{src/backend → dashboard}/status/status_cache.py +0 -0
  130. /package/{src/backend → dashboard}/status/status_calculator.py +0 -0
  131. /package/{src/backend → dashboard}/status_calculator.py +0 -0
  132. /package/{src/backend → dashboard}/subagent_reader.py +0 -0
  133. /package/{src/backend → dashboard}/watchers/__init__.py +0 -0
  134. /package/{src/backend → dashboard}/watchers/file_watcher.py +0 -0
  135. /package/{plugin/index.js → index.js} +0 -0
@@ -1,367 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # OpenClaw Agent Dashboard - 一键安装脚本
4
- # 用法: curl -fsSL https://raw.githubusercontent.com/Umarchen/openclaw-agent-dashboard/main/scripts/install.sh | bash
5
- # 默认安装仓库中标记为 Latest 的发布(即你最近推送的 release)。
6
- #
7
- # 选项:
8
- # DASHBOARD_VERSION=x.x.x 安装指定版本 (默认: latest,即 Latest release)
9
- # DASHBOARD_RELEASE_URL=URL 使用自定义下载地址
10
- # DASHBOARD_SKIP_PYTHON=1 跳过 Python 依赖安装
11
- # VERBOSE=1 显示详细输出
12
- # DRY_RUN=1 仅预览,不执行实际安装
13
- #
14
- set -euo pipefail
15
-
16
- # ============================================
17
- # [公共函数] 与 scripts/lib/common.sh 同步
18
- # ============================================
19
-
20
- log_info() { echo "$1"; }
21
- log_step() { echo ""; echo ">>> $1"; }
22
- log_ok() { echo "✓ $1"; }
23
- log_warn() { echo "⚠ $1"; }
24
- log_error() { echo "❌ $1" >&2; }
25
-
26
- run_silent() {
27
- if [ "${VERBOSE:-0}" = "1" ]; then
28
- "$@"
29
- else
30
- "$@" 2>/dev/null
31
- fi
32
- }
33
-
34
- resolve_openclaw_config_dir() {
35
- if [ -n "${OPENCLAW_STATE_DIR:-}" ]; then
36
- echo "${OPENCLAW_STATE_DIR}"
37
- return
38
- fi
39
- if [ -n "${CLAWDBOT_STATE_DIR:-}" ]; then
40
- echo "${CLAWDBOT_STATE_DIR}"
41
- return
42
- fi
43
- local home_dir="${OPENCLAW_HOME:-${HOME:-${USERPROFILE:-}}}"
44
- if [ -z "$home_dir" ]; then
45
- home_dir="${HOME:-}"
46
- fi
47
- if [[ "$home_dir" == '~'* ]]; then
48
- home_dir="${HOME:-}${home_dir#\~}"
49
- fi
50
- echo "${home_dir}/.openclaw"
51
- }
52
-
53
- detect_os() {
54
- case "$(uname -s 2>/dev/null)" in
55
- Linux*) echo "linux" ;;
56
- Darwin*) echo "macos" ;;
57
- MINGW*|MSYS*|CYGWIN*) echo "windows" ;;
58
- *) echo "unknown" ;;
59
- esac
60
- }
61
-
62
- validate_os() {
63
- local os="$1"
64
- case "$os" in
65
- linux|macos|windows)
66
- log_info "系统: $os"
67
- ;;
68
- *)
69
- log_error "不支持的系统: $(uname -s 2>/dev/null || echo 'unknown')"
70
- log_info "支持的系统: Linux, macOS, Windows (Git Bash)"
71
- exit 1
72
- ;;
73
- esac
74
- }
75
-
76
- download_file() {
77
- local url="$1"
78
- local output="$2"
79
- log_info " 下载: $url"
80
- if command -v curl &>/dev/null; then
81
- if ! curl -fSL --progress-bar -o "$output" "$url"; then
82
- return 1
83
- fi
84
- elif command -v wget &>/dev/null; then
85
- if ! wget -q --show-progress -O "$output" "$url"; then
86
- return 1
87
- fi
88
- else
89
- log_error "需要 curl 或 wget 来下载文件"
90
- exit 1
91
- fi
92
- return 0
93
- }
94
-
95
- # ============================================
96
- # 配置
97
- # ============================================
98
-
99
- REPO_OWNER="Umarchen"
100
- REPO_NAME="openclaw-agent-dashboard"
101
- PLUGIN_ID="openclaw-agent-dashboard"
102
-
103
- # ============================================
104
- # 环境变量
105
- # ============================================
106
-
107
- VERBOSE="${VERBOSE:-0}"
108
- DRY_RUN="${DRY_RUN:-0}"
109
- DASHBOARD_VERSION="${DASHBOARD_VERSION:-latest}"
110
- DASHBOARD_RELEASE_URL="${DASHBOARD_RELEASE_URL:-}"
111
- DASHBOARD_SKIP_PYTHON="${DASHBOARD_SKIP_PYTHON:-0}"
112
-
113
- # ============================================
114
- # 版本解析
115
- # ============================================
116
-
117
- resolve_version() {
118
- local requested="$1"
119
-
120
- if [ "$requested" = "latest" ]; then
121
- local api_url="https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases/latest"
122
- local latest_tag
123
-
124
- if command -v curl &>/dev/null; then
125
- latest_tag=$(curl -fsSL "$api_url" 2>/dev/null | grep '"tag_name"' | head -1 | sed 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/')
126
- elif command -v wget &>/dev/null; then
127
- latest_tag=$(wget -qO- "$api_url" 2>/dev/null | grep '"tag_name"' | head -1 | sed 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/')
128
- fi
129
-
130
- if [ -n "$latest_tag" ]; then
131
- echo "${latest_tag#v}"
132
- else
133
- echo "1.0.0"
134
- fi
135
- else
136
- echo "$requested"
137
- fi
138
- }
139
-
140
- # ============================================
141
- # [Python 依赖安装] 与 install-python-deps.sh 同步
142
- # ============================================
143
-
144
- install_python_deps_inline() {
145
- local plugin_dir="$1"
146
- local req_file="$plugin_dir/dashboard/requirements.txt"
147
- local venv_dir="$plugin_dir/dashboard/.venv"
148
- local python_deps_ok=""
149
-
150
- if [ ! -f "$req_file" ]; then
151
- log_warn "未找到 requirements.txt"
152
- return 1
153
- fi
154
-
155
- # 策略 1: venv(推荐,不受 PEP 668 影响)
156
- if python3 -c "import venv" 2>/dev/null; then
157
- log_info " 尝试: venv(推荐)"
158
- rm -rf "$venv_dir"
159
- if python3 -m venv "$venv_dir" 2>/dev/null; then
160
- local venv_python="$venv_dir/bin/python"
161
- [ ! -x "$venv_python" ] && [ -x "$venv_dir/Scripts/python.exe" ] && venv_python="$venv_dir/Scripts/python.exe"
162
- if [ -n "$venv_python" ]; then
163
- run_silent "$venv_python" -m pip install --upgrade pip -q 2>/dev/null || true
164
- if run_silent "$venv_python" -m pip install -r "$req_file" -q; then
165
- python_deps_ok="venv"
166
- fi
167
- fi
168
- fi
169
- fi
170
-
171
- # 策略 2: pip --user 兜底
172
- if [ -z "$python_deps_ok" ]; then
173
- log_info " 尝试: pip --user"
174
- if run_silent python3 -m pip install -r "$req_file" -q --user; then
175
- python_deps_ok="pip --user"
176
- elif run_silent python3 -m pip install -r "$req_file" -q; then
177
- python_deps_ok="pip"
178
- elif run_silent pip install -r "$req_file" -q --user; then
179
- python_deps_ok="pip --user"
180
- elif run_silent pip3 install -r "$req_file" -q --user; then
181
- python_deps_ok="pip3 --user"
182
- fi
183
- fi
184
-
185
- if [ -n "$python_deps_ok" ]; then
186
- log_ok "Python 依赖已就绪 ($python_deps_ok)"
187
- return 0
188
- else
189
- log_warn "Python 依赖安装失败"
190
- print_python_deps_help "$req_file"
191
- return 1
192
- fi
193
- }
194
-
195
- print_python_deps_help() {
196
- local req_file="$1"
197
- echo ""
198
- echo "========================================"
199
- echo "请检查以下系统依赖是否已安装:"
200
- echo "========================================"
201
- echo ""
202
-
203
- # 检测系统并给出针对性建议
204
- if [ -f /etc/debian_version ]; then
205
- echo "检测到 Debian/Ubuntu 系统(PEP 668 限制,请用 venv 安装):"
206
- echo ""
207
- echo " 1. 安装 python3-venv:"
208
- echo " sudo apt update"
209
- echo " sudo apt install python3 python3-pip python3-venv"
210
- echo ""
211
- echo " 2. 在插件目录下用 venv 安装依赖(推荐):"
212
- echo " cd ~/.openclaw/extensions/openclaw-agent-dashboard/dashboard"
213
- echo " python3 -m venv .venv"
214
- echo " .venv/bin/pip install -r requirements.txt"
215
- echo ""
216
- elif [ -f /etc/redhat-release ]; then
217
- echo "检测到 RedHat/CentOS/Fedora 系统,请执行:"
218
- echo ""
219
- echo " sudo dnf install python3 python3-pip"
220
- echo ""
221
- elif [[ "$(uname -s)" == "Darwin" ]]; then
222
- echo "检测到 macOS 系统,请执行:"
223
- echo ""
224
- echo " brew install python3"
225
- echo ""
226
- else
227
- echo "请确保已安装:"
228
- echo " - Python 3"
229
- echo " - pip (python3-pip)"
230
- echo " - venv 模块 (python3-venv,Linux 通常需要单独安装)"
231
- echo ""
232
- fi
233
-
234
- echo "========================================"
235
- echo "安装系统依赖后,重新执行安装:"
236
- echo "========================================"
237
- echo ""
238
- echo " curl -fsSL https://raw.githubusercontent.com/Umarchen/openclaw-agent-dashboard/main/scripts/install.sh | bash"
239
- echo ""
240
- echo "或手动用 venv 安装 Python 依赖(Debian/Ubuntu 请用此方式):"
241
- echo ""
242
- echo " cd \$(dirname $req_file)"
243
- echo " python3 -m venv .venv"
244
- echo " .venv/bin/pip install -r requirements.txt"
245
- echo ""
246
- }
247
-
248
- # ============================================
249
- # 主流程
250
- # ============================================
251
-
252
- main() {
253
- # 1. 检测系统
254
- OS=$(detect_os)
255
- validate_os "$OS"
256
-
257
- # 2. 解析配置目录
258
- OPENCLAW_CONFIG_DIR=$(resolve_openclaw_config_dir)
259
- PLUGIN_PATH="${OPENCLAW_CONFIG_DIR}/extensions/${PLUGIN_ID}"
260
-
261
- log_info "配置目录: $OPENCLAW_CONFIG_DIR"
262
- log_info "插件路径: $PLUGIN_PATH"
263
- echo ""
264
-
265
- # 3. 检查 openclaw
266
- if ! command -v openclaw &>/dev/null; then
267
- log_error "未找到 openclaw 命令"
268
- log_info "请先安装: npm install -g openclaw"
269
- exit 1
270
- fi
271
-
272
- # 4. 解析版本
273
- VERSION=$(resolve_version "$DASHBOARD_VERSION")
274
- if [ "$DASHBOARD_VERSION" = "latest" ] && [ "$VERSION" = "1.0.0" ]; then
275
- log_warn "无法获取最新版本,使用默认版本 1.0.0"
276
- fi
277
- log_info "版本: $VERSION"
278
-
279
- # 5. 构建下载 URL
280
- if [ -n "$DASHBOARD_RELEASE_URL" ]; then
281
- DOWNLOAD_URL="$DASHBOARD_RELEASE_URL"
282
- else
283
- DOWNLOAD_URL="https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/download/v${VERSION}/${PLUGIN_ID}-v${VERSION}.tgz"
284
- fi
285
-
286
- log_info "下载地址: $DOWNLOAD_URL"
287
-
288
- # 6. dry-run 模式
289
- if [ "$DRY_RUN" = "1" ]; then
290
- echo ""
291
- log_info "[DRY-RUN] 将执行以下操作:"
292
- log_info " - 下载: $DOWNLOAD_URL"
293
- log_info " - 安装插件到: $PLUGIN_PATH"
294
- if [ "$DASHBOARD_SKIP_PYTHON" != "1" ]; then
295
- log_info " - 安装 Python 依赖到 venv 或 --user"
296
- fi
297
- log_ok "预览完成,未执行实际安装"
298
- exit 0
299
- fi
300
-
301
- # 7. 创建临时目录
302
- TMP_DIR=$(mktemp -d)
303
- TGZ_FILE="$TMP_DIR/${PLUGIN_ID}.tgz"
304
- trap 'rm -rf "$TMP_DIR"' EXIT
305
-
306
- # 8. 下载
307
- log_step "下载预构建包..."
308
- if ! download_file "$DOWNLOAD_URL" "$TGZ_FILE"; then
309
- log_error "下载失败"
310
- log_info ""
311
- log_info "可能的原因:"
312
- log_info " 1. 网络连接问题"
313
- log_info " 2. 版本不存在: v$VERSION"
314
- log_info " 3. GitHub 访问受限"
315
- log_info ""
316
- log_info "尝试:"
317
- log_info " 1. 检查网络连接"
318
- log_info " 2. 设置代理: export https_proxy=http://proxy:port"
319
- log_info " 3. 手动下载: curl -LO $DOWNLOAD_URL"
320
- log_info " 4. 指定版本: DASHBOARD_VERSION=1.0.0 bash install.sh"
321
- exit 1
322
- fi
323
- log_ok "下载完成"
324
-
325
- # 9. 清理旧安装
326
- log_step "清理旧版本..."
327
- if [ -d "$PLUGIN_PATH" ]; then
328
- log_info " 执行: openclaw plugins uninstall $PLUGIN_ID"
329
- if run_silent openclaw plugins uninstall "$PLUGIN_ID" --force; then
330
- log_ok " 已卸载(配置记录)"
331
- else
332
- log_warn " uninstall 失败(可能未注册)"
333
- fi
334
- rm -rf "$PLUGIN_PATH"
335
- log_ok " 已删除旧目录"
336
- else
337
- log_ok " 无旧版本"
338
- fi
339
-
340
- # 10. 安装插件
341
- log_step "安装插件..."
342
- log_info " 执行: openclaw plugins install $TGZ_FILE"
343
- if ! openclaw plugins install "$TGZ_FILE"; then
344
- log_error "插件安装失败"
345
- exit 1
346
- fi
347
- log_ok "插件已安装"
348
-
349
- # 11. 安装 Python 依赖
350
- if [ "$DASHBOARD_SKIP_PYTHON" != "1" ] && [ -f "$PLUGIN_PATH/dashboard/requirements.txt" ]; then
351
- log_step "安装 Python 依赖..."
352
- install_python_deps_inline "$PLUGIN_PATH" || true
353
- fi
354
-
355
- # 12. 完成
356
- echo ""
357
- log_ok "=== 安装完成 (v$VERSION) ==="
358
- echo ""
359
- log_info "执行任意 openclaw 命令(如 openclaw tui)时,Dashboard 会自动启动。"
360
- log_info "访问地址: http://localhost:38271"
361
- echo ""
362
- log_info "若端口被占用,可创建 ~/.openclaw-agent-dashboard/config.json 设置端口:"
363
- log_info ' {"port": 38271}'
364
- echo ""
365
- }
366
-
367
- main "$@"
@@ -1,137 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # 公共函数库 - 安装脚本共用
4
- # 用法: source "$(dirname "$0")/../lib/common.sh" 或 source "$SCRIPT_DIR/lib/common.sh"
5
- #
6
-
7
- # ============================================
8
- # 日志函数
9
- # ============================================
10
-
11
- log_info() { echo "$1"; }
12
- log_step() { echo ""; echo ">>> $1"; }
13
- log_ok() { echo "✓ $1"; }
14
- log_warn() { echo "⚠ $1"; }
15
- log_error() { echo "❌ $1" >&2; }
16
-
17
- # ============================================
18
- # 执行辅助
19
- # ============================================
20
-
21
- # run_silent: 静默执行命令(VERBOSE=1 时显示输出)
22
- # 用法: run_silent command args...
23
- run_silent() {
24
- if [ "${VERBOSE:-0}" = "1" ]; then
25
- "$@"
26
- else
27
- "$@" 2>/dev/null
28
- fi
29
- }
30
-
31
- # ============================================
32
- # 配置目录解析(与 OpenClaw 内部逻辑一致)
33
- # ============================================
34
-
35
- # resolve_openclaw_config_dir: 解析 OpenClaw 配置目录
36
- # 优先级: OPENCLAW_STATE_DIR > CLAWDBOT_STATE_DIR > OPENCLAW_HOME/.openclaw > HOME/.openclaw
37
- # 用法: OPENCLAW_CONFIG_DIR=$(resolve_openclaw_config_dir)
38
- resolve_openclaw_config_dir() {
39
- if [ -n "${OPENCLAW_STATE_DIR:-}" ]; then
40
- echo "${OPENCLAW_STATE_DIR}"
41
- return
42
- fi
43
- if [ -n "${CLAWDBOT_STATE_DIR:-}" ]; then
44
- echo "${CLAWDBOT_STATE_DIR}"
45
- return
46
- fi
47
- local home_dir="${OPENCLAW_HOME:-${HOME:-${USERPROFILE:-}}}"
48
- if [ -z "$home_dir" ]; then
49
- home_dir="${HOME:-}"
50
- fi
51
- # 展开 ~ 前缀(与 openclaw 行为一致)
52
- if [[ "$home_dir" == '~'* ]]; then
53
- home_dir="${HOME:-}${home_dir#\~}"
54
- fi
55
- echo "${home_dir}/.openclaw"
56
- }
57
-
58
- # ============================================
59
- # JSON 版本解析
60
- # ============================================
61
-
62
- # parse_json_version: 从 JSON 文件解析 version 字段
63
- # 优先使用 jq,回退 node,最后 grep+sed
64
- # 用法: VERSION=$(parse_json_version plugin/openclaw.plugin.json)
65
- parse_json_version() {
66
- local json_file="$1"
67
- if [ ! -f "$json_file" ]; then
68
- return 1
69
- fi
70
- if command -v jq &>/dev/null; then
71
- jq -r '.version' "$json_file"
72
- elif command -v node &>/dev/null; then
73
- node -e "const f=require('fs');console.log(JSON.parse(f.readFileSync(process.argv[1],'utf8')).version)" "$json_file"
74
- else
75
- # 最后兜底:使用 grep + sed
76
- grep '"version"' "$json_file" | head -1 | sed 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/'
77
- fi
78
- }
79
-
80
- # ============================================
81
- # 系统检测
82
- # ============================================
83
-
84
- # detect_os: 检测操作系统
85
- # 返回: linux, macos, windows, unknown
86
- detect_os() {
87
- case "$(uname -s 2>/dev/null)" in
88
- Linux*) echo "linux" ;;
89
- Darwin*) echo "macos" ;;
90
- MINGW*|MSYS*|CYGWIN*) echo "windows" ;;
91
- *) echo "unknown" ;;
92
- esac
93
- }
94
-
95
- # validate_os: 验证操作系统是否支持
96
- # 用法: validate_os "$(detect_os)"
97
- validate_os() {
98
- local os="$1"
99
- case "$os" in
100
- linux|macos|windows)
101
- log_info "系统: $os"
102
- ;;
103
- *)
104
- log_error "不支持的系统: $(uname -s 2>/dev/null || echo 'unknown')"
105
- log_info "支持的系统: Linux, macOS, Windows (Git Bash)"
106
- return 1
107
- ;;
108
- esac
109
- }
110
-
111
- # ============================================
112
- # 下载辅助
113
- # ============================================
114
-
115
- # download_file: 下载文件(自动选择 curl 或 wget)
116
- # 用法: download_file "https://example.com/file.tgz" "/tmp/file.tgz"
117
- download_file() {
118
- local url="$1"
119
- local output="$2"
120
-
121
- log_info " 下载: $url"
122
-
123
- if command -v curl &>/dev/null; then
124
- if ! curl -fSL --progress-bar -o "$output" "$url"; then
125
- return 1
126
- fi
127
- elif command -v wget &>/dev/null; then
128
- if ! wget -q --show-progress -O "$output" "$url"; then
129
- return 1
130
- fi
131
- else
132
- log_error "需要 curl 或 wget 来下载文件"
133
- return 1
134
- fi
135
-
136
- return 0
137
- }
@@ -1,110 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # 发布打包脚本
4
- # 用法: ./scripts/release-pack.sh [--version X.X.X]
5
- #
6
- # 生成预构建 tgz 包,供 CI 或本地发布使用。
7
- # 输出: openclaw-agent-dashboard-v{VERSION}.tgz
8
- #
9
- set -euo pipefail
10
-
11
- cd "$(dirname "$0")/.."
12
- ROOT=$(pwd)
13
- SCRIPT_DIR="$ROOT/scripts"
14
-
15
- # 引入公共库
16
- source "$SCRIPT_DIR/lib/common.sh"
17
-
18
- # ============================================
19
- # 参数解析
20
- # ============================================
21
-
22
- VERSION_OVERRIDE=""
23
-
24
- while [ $# -gt 0 ]; do
25
- case "$1" in
26
- --version) VERSION_OVERRIDE="$2"; shift 2 ;;
27
- --help)
28
- echo "用法: $0 [--version X.X.X]"
29
- echo ""
30
- echo "选项:"
31
- echo " --version 指定版本号 (默认从 plugin/openclaw.plugin.json 读取)"
32
- exit 0
33
- ;;
34
- *) echo "未知选项: $1" >&2; exit 1 ;;
35
- esac
36
- done
37
-
38
- # ============================================
39
- # 读取版本
40
- # ============================================
41
-
42
- if [ -n "$VERSION_OVERRIDE" ]; then
43
- VERSION="$VERSION_OVERRIDE"
44
- else
45
- if [ ! -f "$ROOT/plugin/openclaw.plugin.json" ]; then
46
- log_error "未找到 plugin/openclaw.plugin.json"
47
- exit 1
48
- fi
49
- VERSION=$(parse_json_version "$ROOT/plugin/openclaw.plugin.json")
50
- fi
51
-
52
- if [ -z "$VERSION" ]; then
53
- log_error "无法解析版本号"
54
- exit 1
55
- fi
56
-
57
- OUTPUT_FILE="$ROOT/openclaw-agent-dashboard-v${VERSION}.tgz"
58
-
59
- log_info "版本: $VERSION"
60
- log_info "输出: $OUTPUT_FILE"
61
-
62
- # ============================================
63
- # 确保已构建
64
- # ============================================
65
-
66
- if [ ! -d "$ROOT/plugin/frontend-dist" ] || [ ! -f "$ROOT/plugin/dashboard/main.py" ]; then
67
- log_info "构建插件..."
68
- npm run pack
69
- fi
70
-
71
- # ============================================
72
- # 生成 tgz
73
- # ============================================
74
-
75
- log_info "生成 tgz 包..."
76
-
77
- cd "$ROOT/plugin"
78
-
79
- # 清理旧的 tgz
80
- rm -f openclaw-agent-dashboard-*.tgz
81
-
82
- # npm pack
83
- npm pack
84
-
85
- # 查找生成的文件
86
- TGZ_FILE=$(ls openclaw-agent-dashboard-*.tgz 2>/dev/null | head -1)
87
-
88
- if [ -z "$TGZ_FILE" ]; then
89
- log_error "npm pack 未生成 tgz 文件"
90
- exit 1
91
- fi
92
-
93
- # 移动并重命名
94
- mv "$TGZ_FILE" "$OUTPUT_FILE"
95
-
96
- # ============================================
97
- # 完成
98
- # ============================================
99
-
100
- log_ok "已生成: $OUTPUT_FILE"
101
-
102
- # 显示文件信息
103
- ls -lh "$OUTPUT_FILE" 2>/dev/null || true
104
-
105
- # 显示 SHA256
106
- if command -v sha256sum &>/dev/null; then
107
- echo "SHA256: $(sha256sum "$OUTPUT_FILE" | cut -d' ' -f1)"
108
- elif command -v shasum &>/dev/null; then
109
- echo "SHA256: $(shasum -a 256 "$OUTPUT_FILE" | cut -d' ' -f1)"
110
- fi
package/scripts/start.js DELETED
@@ -1,50 +0,0 @@
1
- /**
2
- * 跨平台启动脚本
3
- * 解决 Windows 下 npm run start 无法解析 Linux shell 语法的问题
4
- */
5
- const { spawn } = require('child_process');
6
- const path = require('path');
7
- const os = require('os');
8
-
9
- // 环境变量处理(跨平台)
10
- const OPENCLAW_HOME = process.env.OPENCLAW_HOME || path.join(os.homedir(), '.openclaw');
11
- const DASHBOARD_PORT = process.env.DASHBOARD_PORT || '38271';
12
-
13
- // Windows 使用 python,非 Windows 使用 python3
14
- const pythonCmd = process.platform === 'win32' ? 'python' : 'python3';
15
-
16
- // 工作目录
17
- const backendDir = path.join(__dirname, '..', 'src', 'backend');
18
-
19
- // 设置环境变量并启动 uvicorn
20
- const env = {
21
- ...process.env,
22
- OPENCLAW_HOME,
23
- DASHBOARD_PORT
24
- };
25
-
26
- console.log(`Starting Dashboard...`);
27
- console.log(` OPENCLAW_HOME: ${OPENCLAW_HOME}`);
28
- console.log(` PORT: ${DASHBOARD_PORT}`);
29
- console.log(` Python: ${pythonCmd}`);
30
-
31
- const child = spawn(pythonCmd, [
32
- '-m', 'uvicorn',
33
- 'main:app',
34
- '--host', '0.0.0.0',
35
- '--port', DASHBOARD_PORT
36
- ], {
37
- cwd: backendDir,
38
- env,
39
- stdio: 'inherit',
40
- shell: process.platform === 'win32'
41
- });
42
-
43
- child.on('error', (err) => {
44
- console.error('Failed to start Dashboard:', err);
45
- process.exit(1);
46
- });
47
-
48
- child.on('exit', (code) => {
49
- process.exit(code || 0);
50
- });