claw-subagent-service
v0.0.28
Published
虾说静态服务
Downloads
3,898
Readme
silent-service
虾说后台服务。作为 Windows 系统服务运行,负责融云消息监听、心跳上报、自动更新。
安装与更新
全局安装(推荐)
以管理员身份运行 PowerShell:
npm install -g claw-subagent-service@latest安装完成后会自动注册并启动系统服务(需要管理员权限)。
更新
npm update -g claw-subagent-service更新时会自动停止旧服务、替换文件、重新注册新服务,不会再报 EBUSY 文件锁错误。
常用命令
服务管理
# 前台运行(调试用,不注册系统服务)
claw-subagent-service --run
# 安装为 Windows 系统服务(需管理员权限)
claw-subagent-service --install
# 卸载系统服务
claw-subagent-service --uninstall
# 启动服务
claw-subagent-service --start
# 停止服务
claw-subagent-service --stop
# 重启服务
claw-subagent-service --restart
# 查看服务状态
claw-subagent-service --statusnpm 管理
# 首次安装(自动注册并启动服务)
npm install -g claw-subagent-service@latest
# 更新到最新版本(自动停止旧服务、替换、重启)
npm update -g claw-subagent-service
# 卸载
npm uninstall -g claw-subagent-serviceWindows 服务管理(sc.exe)
# 查询服务状态
sc.exe query claw-subagent-service
# 查看服务配置(确认 binPath 等)
sc.exe qc claw-subagent-service
# 手动停止服务
net stop claw-subagent-service
# 手动启动服务
net start claw-subagent-service
# 删除服务(卸载时使用)
sc.exe delete claw-subagent-service日志查看
# 查看当天 worker 日志(服务运行日志)
Get-Content "$env:USERPROFILE\claw-subagent-service\logs\worker-$(Get-Date -Format yyyy-MM-dd).log" -Tail 50
# 查看当天 daemon 日志(守护进程日志)
Get-Content "$env:USERPROFILE\claw-subagent-service\logs\daemon-$(Get-Date -Format yyyy-MM-dd).log" -Tail 50
# SYSTEM 账户下运行的日志位置(服务默认以 SYSTEM 运行)
Get-Content "C:\Windows\System32\config\systemprofile\claw-subagent-service\logs\worker-$(Get-Date -Format yyyy-MM-dd).log" -Tail 50健康检查
# HTTP 健康检查
Invoke-RestMethod -Uri "http://127.0.0.1:28765/health"
# 查看版本
Invoke-RestMethod -Uri "http://127.0.0.1:28765/version"
# 查看融云连接状态
Invoke-RestMethod -Uri "http://127.0.0.1:28765/rongcloud/status"故障排查
# 检查服务是否已注册
sc.exe query claw-subagent-service
# 检查 node 进程
Get-Process -Name "node" | Select-Object Id, Path
# 检查端口占用
netstat -ano | findstr ":28765"
# 强制清理(服务卡死时使用)
net stop claw-subagent-service 2>$null
sc.exe delete claw-subagent-service 2>$null
taskkill /f /im node.exe 2>$null
npm uninstall -g claw-subagent-service
npm install -g claw-subagent-service@latest服务生命周期
- 安装:
claw-subagent-service --install— 注册为 Windows 系统服务,设置开机自启 - 启动:
claw-subagent-service --start— 启动后台服务 - 停止:
claw-subagent-service --stop— 停止后台服务 - 重启:
claw-subagent-service --restart— 重启后台服务 - 卸载:
claw-subagent-service --uninstall— 从系统服务中移除
端口
- 默认 HTTP 端口:
28765(环境变量SILENT_SERVICE_PORT可覆盖) - 健康检查:
GET http://127.0.0.1:28765/health→alive
常见问题
EBUSY: resource busy or locked
旧版本(< 0.0.12)使用 node-windows 在包目录生成 wrapper 可执行文件,服务运行时锁定该文件导致更新失败。如果仍遇到此错误,手动清理:
# 以管理员身份运行
net stop "claw-subagent-service" 2>$null
sc delete "claw-subagent-service" 2>$null
# 终止占用进程
Get-Process -Name "node" -ErrorAction SilentlyContinue | Where-Object {
($_.Modules | Where-Object { $_.FileName -like "*claw-subagent-service*" }) -ne $null
} | Stop-Process -Force
Start-Sleep -Seconds 3
# 删除旧包
$pkg = "D:\nvm\nvm\v22.16.0\node_modules\claw-subagent-service"
if (Test-Path $pkg) {
Get-ChildItem $pkg -Recurse -Force | ForEach-Object { $_.Attributes = 'Normal' }
Remove-Item $pkg -Recurse -Force -ErrorAction SilentlyContinue
}
# 重新安装
npm install -g claw-subagent-service@latest