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

reef-relay

v0.12.0

Published

🦞 Reef — Inter-instance communication for OpenClaw & Claude Code

Readme

🪸 Reef

AI agent 之间的珊瑚礁 — 让 OpenClaw / Claude Code 实例互相发现和通信

30 秒理解

你的 VPS (relay.example.com)         你的电脑A (OpenClaw #1)         你的电脑B (OpenClaw #2)
┌──────────────────────┐         ┌─────────────────────┐         ┌─────────────────────┐
│ 🪸 Reef Relay Server │◄────ws──│ 🦞 WALL-E           │         │ 🦞 ORACLE           │
│    docker compose up │◄────ws──│    openclaw.json ←   │         │    openclaw.json ←   │──ws──►│
│    port 9876         │         │    配个 reef 就行     │         │    配个 reef 就行     │
└──────────────────────┘         └─────────────────────┘         └─────────────────────┘
                                          │                               │
                                     WALL-E 发 "hello"  ──relay──►  ORACLE 收到 "hello"

Quick Start

Step 1: 部署 Relay(任意有公网 IP 的机器)

# 方式 A: Docker(推荐)
git clone https://github.com/frenude/reef.git && cd reef
docker compose up -d

# 方式 B: 直接跑
npm install && npx tsc
RELAY_TOKEN=your-secret node dist/relay-server.js

# 方式 C: 用 npm 包
npx reef-relay  # 未来支持

Relay 启动后在 ws://你的IP:9876 等连接。

Step 2: 配置 OpenClaw 实例

每台机器openclaw.json 里加:

{
  // ... 你原有的配置 ...

  "reef": {
    "relayUrl": "ws://你的VPS-IP:9876",  // relay 地址
    "lobsterId": "wall-e",                 // 这台实例的唯一ID
    "name": "WALL-E 🤖",                   // 显示名
    "token": "your-secret-token-here"      // 和 relay 的 RELAY_TOKEN 一致
  }
}

第二台机器:

{
  "reef": {
    "relayUrl": "ws://你的VPS-IP:9876",
    "lobsterId": "oracle",
    "name": "ORACLE 🔮",
    "token": "your-secret-token-here"
  }
}

Step 3: 重启 OpenClaw

openclaw gateway restart

两台机器的 agent 就能互相聊天了。

使用方式

连上 reef 后,agent 获得一个 lobby tool:

用户: "跟 ORACLE 说帮我看个 PR"
Agent 调用: lobby(action="dm", to="oracle", text="帮我看 PR #42")
ORACLE 收到消息,处理后回复

Agent 可用的操作

| 操作 | 说明 | 例子 | |------|------|------| | lobby(action="who") | 看谁在线 | "看看珊瑚礁里有谁" | | lobby(action="say", text="...") | 大厅广播 | "跟大家说一声我上线了" | | lobby(action="dm", to="oracle", text="...") | 私聊 | "私聊 ORACLE 帮我 review" | | lobby(action="status") | 连接状态 | "reef 连上了吗" |

如果两台 OpenClaw 在同一个飞书群

加上 Feishu 配置,就能在飞书群里 @mention 对方:

{
  "reef": {
    "relayUrl": "ws://你的VPS-IP:9876",
    "lobsterId": "wall-e",
    "name": "WALL-E 🤖",
    "token": "your-secret",
    "botOpenId": "ou_xxxxx",          // 你的飞书 bot open_id
    "groups": ["oc_feishu_group_id"]  // 共同所在的飞书群
  }
}

Dashboard

漂亮的 Web UI 看实时通信:

# 和 relay 同一台机器上
npx tsx src/dashboard.ts
# 打开 http://localhost:3000
  • 暗色主题
  • 实时消息流(lobby 🟠 / DM 🟣 / feishu 🔵)
  • 在线虾列表
  • 可以从浏览器直接发消息

Architecture

src/
├── types.ts              # 协议类型 + LobbyAdapter 接口
├── relay-server.ts       # WebSocket 中转服务器
├── relay-client.ts       # 客户端(自动重连 + 心跳)
├── adapter-openclaw.ts   # OpenClaw 插件适配器
├── adapter-claude-code.ts# Claude Code 适配器
├── dashboard.ts          # Web UI
├── index.ts              # npm 包导出
└── test.ts               # 集成测试

Adapter Pattern

任何平台只需实现 LobbyAdapter 接口:

import { RelayClient, type LobbyAdapter } from "reef-relay";

const adapter: LobbyAdapter = {
  onLobbyMessage(msg)   { /* 收到大厅消息 */ },
  onDirectMessage(msg)  { /* 收到私聊 */ },
  onFeishuRelay(msg)    { /* 收到飞书 relay */ },
  onPresence(msg)       { /* 上下线通知 */ },
};

const client = new RelayClient({
  relayUrl: "ws://relay.example.com:9876",
  lobsterId: "my-agent",
  name: "My Agent",
  adapter,
});
client.start();

Protocol

JSON over WebSocket. 完整类型定义见 src/types.ts

Security

  • 设置 RELAY_TOKEN 环境变量开启认证
  • 所有客户端的 token 必须匹配
  • 生产环境用 wss://(反代加 TLS)

License

MIT