claw-subagent-service 0.0.142 → 0.0.143

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.
@@ -271,15 +271,36 @@ restart_docker() {
271
271
 
272
272
  log_info "正在启动 OpenClaw 服务..."
273
273
 
274
+ # 查找 openclaw 的完整路径
275
+ local openclaw_path=""
276
+ if command -v openclaw &>/dev/null; then
277
+ openclaw_path=$(which openclaw)
278
+ log_info "找到 openclaw: $openclaw_path"
279
+ else
280
+ # 尝试常见路径
281
+ for path in /usr/local/bin/openclaw /usr/bin/openclaw /opt/openclaw/bin/openclaw; do
282
+ if [ -x "$path" ]; then
283
+ openclaw_path="$path"
284
+ log_info "找到 openclaw: $openclaw_path"
285
+ break
286
+ fi
287
+ done
288
+ fi
289
+
290
+ if [ -z "$openclaw_path" ]; then
291
+ log_error "无法找到 openclaw 命令,请确保已安装 OpenClaw"
292
+ exit 1
293
+ fi
294
+
274
295
  # 使用 setsid 创建新会话,完全脱离父进程
275
296
  # 这样即使父进程(Node.js)退出,openclaw 也不会被终止
276
297
  log_info "使用 setsid 启动,确保进程脱离父进程..."
277
298
  if command -v setsid &>/dev/null; then
278
- setsid bash -c "openclaw gateway run --port $PORT" > "$log_file" 2>&1 &
299
+ setsid bash -c "export PATH='$PATH'; $openclaw_path gateway run --port $PORT" > "$log_file" 2>&1 &
279
300
  else
280
301
  # 如果没有 setsid,使用 nohup 作为后备
281
302
  log_warn "setsid 不可用,使用 nohup 作为后备..."
282
- nohup openclaw gateway run --port "$PORT" > "$log_file" 2>&1 &
303
+ nohup bash -c "export PATH='$PATH'; $openclaw_path gateway run --port $PORT" > "$log_file" 2>&1 &
283
304
  fi
284
305
 
285
306
  log_info "OpenClaw 服务启动命令已发送(PID: $!)"
@@ -297,19 +297,40 @@ start_docker() {
297
297
  fuser -k "${PORT}/tcp" 2>/dev/null || true
298
298
  fi
299
299
 
300
+ # 查找 openclaw 的完整路径
301
+ local openclaw_path=""
302
+ if command -v openclaw &>/dev/null; then
303
+ openclaw_path=$(which openclaw)
304
+ log_info "找到 openclaw: $openclaw_path"
305
+ else
306
+ # 尝试常见路径
307
+ for path in /usr/local/bin/openclaw /usr/bin/openclaw /opt/openclaw/bin/openclaw; do
308
+ if [ -x "$path" ]; then
309
+ openclaw_path="$path"
310
+ log_info "找到 openclaw: $openclaw_path"
311
+ break
312
+ fi
313
+ done
314
+ fi
315
+
316
+ if [ -z "$openclaw_path" ]; then
317
+ log_error "无法找到 openclaw 命令,请确保已安装 OpenClaw"
318
+ exit 1
319
+ fi
320
+
300
321
  # 尝试使用正确的参数启动
301
322
  # 注意:openclaw gateway 可能使用不同的参数名
302
- log_info "尝试启动: openclaw gateway run --port $PORT"
323
+ log_info "尝试启动: $openclaw_path gateway run --port $PORT"
303
324
 
304
325
  # 使用 setsid 创建新会话,完全脱离父进程
305
326
  # 这样即使父进程(Node.js)退出,openclaw 也不会被终止
306
327
  log_info "使用 setsid 启动,确保进程脱离父进程..."
307
328
  if command -v setsid &>/dev/null; then
308
- setsid bash -c "openclaw gateway run --port $PORT" > "$log_file" 2>&1 &
329
+ setsid bash -c "export PATH='$PATH'; $openclaw_path gateway run --port $PORT" > "$log_file" 2>&1 &
309
330
  else
310
331
  # 如果没有 setsid,使用 nohup 作为后备
311
332
  log_warn "setsid 不可用,使用 nohup 作为后备..."
312
- nohup openclaw gateway run --port "$PORT" > "$log_file" 2>&1 &
333
+ nohup bash -c "export PATH='$PATH'; $openclaw_path gateway run --port $PORT" > "$log_file" 2>&1 &
313
334
  fi
314
335
  local started_pid=$!
315
336
  log_info "启动的进程 PID: $started_pid"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claw-subagent-service",
3
- "version": "0.0.142",
3
+ "version": "0.0.143",
4
4
  "description": "虾说智能助手",
5
5
  "main": "cli.js",
6
6
  "bin": {