npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

claw_messenger

v0.0.88

Published

OpenClaw claw-messenger Bridge - 虾说

Readme

Claw Messenger

虾说 IM 的 OpenClaw 插件与 CLI 管理工具。提供融云消息收发、后台服务管理、节点注册等一站式能力。

功能概述

  • OpenClaw 插件:作为 OpenClaw Channel,打通 IM 消息与 AI 能力
  • 后台服务管理:自动安装/更新 claw-subagent-service,支持系统服务注册
  • 节点注册:自动向虾说后端注册节点,获取融云 token
  • 多平台支持:Windows(系统服务)、Linux(systemd)、macOS(launchd)、Docker

环境要求

| 项目 | 要求 | |------|------| | Node.js | >= 16.0.0 | | OpenClaw | >= 2026.3.24(peer dependency,可选


快速开始

npx 快速安装(推荐)

npx claw_messenger@latest

按提示输入节点昵称,脚本会自动完成:

  1. 将插件安装到 OpenClaw extensions 目录
  2. 安装/更新 claw-subagent-service 后台服务
  3. 注册系统服务(Windows/Linux 有管理员权限时)
  4. 向虾说后端注册节点并获取融云 token
  5. 显示节点二维码,扫码即可添加

常用命令

主安装脚本

# 交互式安装/更新(注册节点 + 安装后台服务 + 配置插件)
npx claw_messenger
# 或
claw_messenger

后台服务管理

# 安装为系统服务(开机自启)
clawmessenger install-service

# 卸载系统服务
clawmessenger uninstall-service

# 查看服务状态
clawmessenger status

# 手动下载/更新后台服务包
clawmessenger download

# 检测并确保后台服务运行
clawmessenger ensure

OpenClaw 桥接

# 启动交互式桥接(直接向 OpenClaw 发送消息并获取回复)
claw-bridge

# 重新配置节点昵称(重新注册节点)
claw-bridge-setup

平台部署指南

Windows

环境准备

  • 安装 Node.js(建议 v20 LTS)
  • 安装 OpenClaw(如需插件模式)

安装

管理员身份运行 PowerShell:

npx claw_messenger@latest

安装完成后会自动注册 Windows 系统服务并开机自启。

常用管理命令

# 查看服务状态
clawmessenger status

# 手动安装/刷新系统服务
clawmessenger install-service

# 卸载系统服务
clawmessenger uninstall-service

# 停止服务
sc.exe stop claw-subagent-service

# 启动服务
sc.exe start claw-subagent-service

# 查看服务详情
sc.exe query claw-subagent-service
sc.exe qc claw-subagent-service

注意事项

  • 必须以管理员身份运行,否则无法注册系统服务
  • 如果 npm update -gEBUSY: resource busy or locked,说明旧服务进程仍在运行:
    net stop "claw-subagent-service" 2>$null
    sc.exe delete "claw-subagent-service" 2>$null
    taskkill /f /im "clawsubagentservice.exe" 2>$null
    npm install -g claw_messenger@latest

Linux(systemd)

环境准备

  • Node.js >= 16
  • systemctl 可用(大多数现代 Linux 发行版)

安装

npx claw_messenger@latest

如果提示权限不足,使用 sudo:

sudo npx claw_messenger@latest

常用管理命令

# 查看服务状态
sudo systemctl status claw-subagent-service

# 启动/停止/重启
sudo systemctl start claw-subagent-service
sudo systemctl stop claw-subagent-service
sudo systemctl restart claw-subagent-service

# 设置/取消开机自启
sudo systemctl enable claw-subagent-service
sudo systemctl disable claw-subagent-service

# 查看日志
sudo journalctl -u claw-subagent-service -f

故障排查

203/EXEC 错误(Node 路径问题)

使用 nvm 时,systemd 服务文件中的 Node 路径可能不正确:

# 1. 确认实际 node 路径
which node

# 2. 修正服务文件
sudo sed -i "s|ExecStart=.*|ExecStart=$(which node) $(npm root -g)/claw-subagent-service/service/daemon.js|" /etc/systemd/system/claw-subagent-service.service

# 3. 重载并启动
sudo systemctl daemon-reload
sudo systemctl start claw-subagent-service

Linux(无 systemd / Docker)

直接运行

npm install -g claw_messenger@latest

# 前台运行(调试用)
clawmessenger ensure
# 或
claw-subagent-service --run

# 后台运行
nohup claw-subagent-service --run > /dev/null 2>&1 &

Docker 部署

FROM node:20-alpine

# 安装必要工具
RUN apk add --no-cache lsof curl

# 安装 claw_messenger(会自动安装后台服务)
RUN npm install -g claw_messenger@latest

# 暴露健康检查端口
EXPOSE 28765

# 环境变量
ENV SILENT_SERVICE_HOST=0.0.0.0
ENV SILENT_SERVICE_PORT=28765

# 前台运行
CMD ["claw-subagent-service", "--run"]

构建并运行:

docker build -t claw-messenger:latest .

docker run -d --name claw-messenger \
  -p 28765:28765 \
  --restart unless-stopped \
  -e SILENT_SERVICE_HOST=0.0.0.0 \
  claw-messenger:latest

# 查看日志
docker logs -f claw-messenger

# 健康检查
curl http://localhost:28765/health

Docker 注意事项

  • 必须设置 SILENT_SERVICE_HOST=0.0.0.0,否则外部无法访问健康检查端口
  • 精简镜像(Alpine)建议安装 lsof,否则端口冲突时无法自动释放
  • Docker 内无需 systemd,直接使用 --run 前台运行

macOS

npx claw_messenger@latest

macOS 会尝试使用 launchd 注册系统服务,或使用用户级守护进程作为兜底。


配置说明

环境变量

| 变量名 | 默认值 | 说明 | |--------|--------|------| | DM_APP_KEY | bmdehs6pbyyks | 融云应用 Key | | DM_SERVER_URL | https://newsradar.dreamdt.cn/im | 虾说后端服务地址 | | SILENT_SERVICE_HOST | 127.0.0.1 | 后台服务 HTTP 监听地址(Docker 需改为 0.0.0.0) | | SILENT_SERVICE_PORT | 28765 | 后台服务 HTTP 监听端口 | | OPENCLAW_PROFILE | - | OpenClaw 配置文件后缀(多环境时使用) |

配置文件位置

  • 节点配置~/.claw-bridge/config.json
  • OpenClaw 插件目录~/.openclaw/extensions/claw_messenger/
  • 后台服务数据~/.clawmessenger/

健康检查

HTTP 接口

# 健康检查
curl http://127.0.0.1:28765/health
# 预期返回: alive

# 查看版本
curl http://127.0.0.1:28765/version

# 查看融云连接状态
curl http://127.0.0.1:28765/rongcloud/status

CLI 状态检查

clawmessenger status

日志查看

日志文件位置

后台服务(claw-subagent-service)将日志写入安装目录下的 logs/ 文件夹中:

| 平台 | 日志目录 | |------|----------| | npm 全局安装(Linux/macOS) | $(npm root -g)/claw-subagent-service/logs/ | | npm 全局安装(Windows) | %APPDATA%\npm\node_modules\claw-subagent-service\logs\ | | 用户级安装(无管理员权限) | ~/claw-subagent-service/logs/ | | 本地源码运行 | ./silent-service/logs/ |

日志文件按日期和组件分类:

  • worker-YYYY-MM-DD.log — Worker 进程日志(融云消息收发、OpenClaw 调用)
  • daemon-YYYY-MM-DD.log — Daemon 进程日志(服务生命周期管理)
  • updater-YYYY-MM-DD.log — 自动更新日志

快速查看命令

Linux / macOS / Docker

# 1. 确定安装路径
INSTALL_DIR=$(npm root -g)/claw-subagent-service
# 如果是本地源码运行
# INSTALL_DIR=/data/node_cli

# 2. 查看当天 worker 日志(实时跟踪)
tail -f $INSTALL_DIR/logs/worker-$(date +%Y-%m-%d).log

# 3. 查看当天 worker 日志(最后 100 行)
tail -n 100 $INSTALL_DIR/logs/worker-$(date +%Y-%m-%d).log

# 4. 查看 daemon 日志
tail -f $INSTALL_DIR/logs/daemon-$(date +%Y-%m-%d).log

# 5. 查看所有日志文件列表
ls -la $INSTALL_DIR/logs/

# 6. 搜索特定关键词(如错误、SSE、融云)
grep -i "error\|sse\|融云\|rongcloud" $INSTALL_DIR/logs/worker-$(date +%Y-%m-%d).log

# 7. 查看最近 1 小时内的日志
grep "$(date -d '1 hour ago' +%H)" $INSTALL_DIR/logs/worker-$(date +%Y-%m-%d).log

# 8. 合并查看 worker + daemon 日志(按时间排序)
cat $INSTALL_DIR/logs/worker-$(date +%Y-%m-%d).log $INSTALL_DIR/logs/daemon-$(date +%Y-%m-%d).log | sort

Docker 专用命令

# 查看容器内日志文件(进入容器后执行)
docker exec -it <容器名> sh -c "tail -f \$(npm root -g)/claw-subagent-service/logs/worker-\$(date +%Y-%m-%d).log"

# 直接在宿主机查看(如果日志挂载到卷)
docker exec <容器名> cat /usr/lib/node_modules/claw-subagent-service/logs/worker-$(date +%Y-%m-%d).log

# 查看容器标准输出
docker logs -f <容器名> --tail 200

Windows

# 查看当天 worker 日志
Get-Content "$((npm root -g)\claw-subagent-service\logs\worker-$(Get-Date -Format yyyy-MM-dd).log)" -Tail 100

# 查看 daemon 日志
Get-Content "$((npm root -g)\claw-subagent-service\logs\daemon-$(Get-Date -Format yyyy-MM-dd).log)" -Tail 100

# 搜索错误
Select-String -Path "$((npm root -g)\claw-subagent-service\logs\*.log)" -Pattern "ERROR|error|失败"

# wrapper 日志(node-windows 生成)
Get-Content "$env:APPDATA\npm\node_modules\claw-subagent-service\service\daemon\clawsubagentservice.wrapper.log" -Tail 50

按运行模式查看日志

systemd 模式

# 查看 systemd 管理的日志
sudo journalctl -u claw-subagent-service -f

# 查看最近 50 条日志
sudo journalctl -u claw-subagent-service -n 50

# 查看今天所有日志
sudo journalctl -u claw-subagent-service --since today

用户级守护进程模式(无 systemd)

# 查找日志目录(可能在多个位置)
find / -name "worker-*.log" -path "*/claw-subagent-service/logs/*" 2>/dev/null

# 常见路径
# /usr/lib/node_modules/claw-subagent-service/logs/
# /root/.clawmessenger/logs/
# ~/claw-subagent-service/logs/

# 实时监控
LOG_DIR=$(find /usr -name "claw-subagent-service" -path "*/node_modules/*" 2>/dev/null | head -1)/logs
tail -f $LOG_DIR/worker-$(date +%Y-%m-%d).log

前台运行模式(调试)

# 直接运行,日志输出到终端
claw-subagent-service --run

# 后台运行并保存到文件
nohup claw-subagent-service --run > /tmp/claw-subagent.log 2>&1 &
tail -f /tmp/claw-subagent.log

Linux

# systemd 日志
sudo journalctl -u claw-subagent-service -f

# 日志文件
tail -f ~/claw-subagent-service/logs/worker-$(date +%Y-%m-%d).log
tail -f ~/claw-subagent-service/logs/daemon-$(date +%Y-%m-%d).log

Docker

docker logs -f claw-messenger --tail 100

故障排查

安装失败 / 服务未注册

Windows

# 检查服务是否已注册
sc.exe query claw-subagent-service

# 手动注册
clawmessenger install-service

# 如果仍失败,检查 wrapper 日志
Get-Content "$env:APPDATA\npm\node_modules\claw-subagent-service\service\daemon\clawsubagentservice.wrapper.log" -Tail 30

Linux

# 检查服务文件是否存在
ls -la /etc/systemd/system/claw-subagent-service.service

# 手动注册
sudo claw-subagent-service --install

# 检查状态
sudo systemctl status claw-subagent-service

端口 28765 被占用

Docker / 精简系统

缺少 lsof 会导致服务无法释放被占用的端口:

# 安装 lsof
apk add lsof          # Alpine
apt-get install lsof  # Debian/Ubuntu

# 检查是否有多个实例
ps aux | grep node

# 杀掉占用进程后重启
kill -9 <PID>
claw-subagent-service --run

融云连接失败

  1. 检查节点是否已注册:cat ~/.claw-bridge/config.json
  2. 检查 token 是否有效
  3. 检查网络是否可以访问融云服务器

插件未加载

  1. 确认插件已安装到 OpenClaw extensions 目录:ls ~/.openclaw/extensions/claw_messenger/
  2. 重启 OpenClaw
  3. 检查 OpenClaw 日志中的插件加载信息

卸载

Windows

# 方式一:npm 卸载(自动清理服务)
npm uninstall -g claw_messenger

# 方式二:手动彻底清理
net stop "claw-subagent-service" 2>$null
sc.exe delete "claw-subagent-service" 2>$null
taskkill /f /im "clawsubagentservice.exe" 2>$null
npm uninstall -g claw_messenger claw-subagent-service
Remove-Item -Recurse -Force "$env:USERPROFILE\claw-subagent-service" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "$env:USERPROFILE\.claw-bridge" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "$env:USERPROFILE\.clawmessenger" -ErrorAction SilentlyContinue

Linux

# 停止并禁用服务
sudo systemctl stop claw-subagent-service
sudo systemctl disable claw-subagent-service

# 卸载
sudo claw-subagent-service --uninstall
npm uninstall -g claw_messenger claw-subagent-service

# 手动清理残留
sudo rm -f /etc/systemd/system/claw-subagent-service.service
sudo systemctl daemon-reload
rm -rf ~/claw-subagent-service
rm -rf ~/.claw-bridge
rm -rf ~/.clawmessenger
rm -f /tmp/.claw-subagent-service.pid

Docker

docker stop claw-messenger
docker rm claw-messenger

开发

git clone <repository-url>
cd clawmessenger
npm install
npm run build
npm test

License

MIT