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

clawdbox-edge-gateway

v0.2.5

Published

ClawdBox Edge Gateway - OpenClaw 管理代理 + 后端对接网关

Readme

ClawdBox Edge Gateway

ClawdBox Edge Gateway 是运行在边缘设备(Debian ARM64)上的核心网关服务。它负责连接 ClawdBox 云端后端、管理本地 OpenClaw AI 引擎,并提供安全的自更新机制。

核心特性

  • 双重代码保护:结合 NCC 打包、JavaScript Obfuscator 混淆与 Bytenode 字节码编译,实现工业级源码防逆向。
  • 配置代码化:默认配置直接硬编码在字节码中,无外部 .env 文件依赖,极致隐藏后端地址与敏感信息。
  • AI 代理转发:实时接收云端 Socket.IO 消息,注入设备系统上下文,并代理转发至本地 OpenClaw API。
  • 生命周期管理:自动检测、启动、停止及监控本地 OpenClaw 进程。
  • 全方位自更新:支持通过 Socket.IO 远程命令或命令行强制触发二进制级别的平滑更新。
  • 资源限制:针对边缘设备优化,内置内存与 CPU 保护配置。

🛠 开发指南

环境要求

  • Node.js >= 18 (推荐 v22)
  • npm

快速开始

  1. 安装依赖:npm install
  2. 启动开发模式:npm run dev (默认连接测试环境 http://192.168.10.51:3000)

配置修改

配置位于 src/config/ 目录下:

  • base.js: 通用基础配置。
  • envs.js: 环境差异配置(测试/正式环境地址)。
  • 注意: 修改配置后需重新执行 npm run build 才能生效于生产环境。

📦 构建与部署

为了保护知识产权,分发到设备的代码必须经过构建处理。

1. 执行构建

npm run build

构建产物将输出至 dist/ 目录:

  • dist/clawdbox-edge-gateway/: 部署文件夹(仅含混淆后的二进制字节码)。
  • dist/clawdbox-edge-gateway.tar.gz: 供自更新使用的标准压缩包。
  • dist/VERSION: 当前构建的版本号。

2. 生产环境部署 (Debian ARM64 - 零依赖离线)

  1. dist/clawdbox-edge-gateway/ 拷贝至设备(或直接上传 tar.gz 并解压)。
  2. 直接启动(无需运行 npm install,依赖已打入包内):
    cd clawdbox-edge-gateway
    pm2 start ecosystem.config.js
    pm2 save

🔄 自更新与远程控制

项目内置了 src/services/updater.js 模块,支持以下两种更新逻辑:

A. 手动远程命令 (Socket.IO)

后端可发送 gateway_update 消息实时触发更新:

  • 消息类型: gateway_update
  • Payload 示例:
    {
      "type": "gateway_update",
      "content": {
        "version": "1.0.1",
        "url": "http://api.clawdbox.cn/download/v1.0.1.tar.gz"
      }
    }

B. 命令行强制更新 (CLI)

运维人员可直接在设备上通过 update 命令强制更新:

# 方式 1: 使用远程 URL 更新 (-u 参数)
node index.js update -u http://your-server.com/clawdbox-edge-gateway.tar.gz

# 方式 2: 使用本地下载好的文件更新 (-u 参数)
node index.js update -u /tmp/clawdbox-edge-gateway.tar.gz

# 查看帮助
node index.js --help

该命令支持子命令 update,会自动识别来源类型并完成安装与 PM2 重启。


🛡 安全说明

  • index.jsc: 核心业务代码已编译为 V8 二进制字节码,反编译成本极高。
  • index.js & ecosystem.config.js: 启动引导与运行配置已执行深度混淆,肉眼不可读。
  • 无明文依赖/配置: 生产环境不携带任何 .env 文件或 config/ 源码目录,所有敏感信息均锁死在字节码中。

日志查看

pm2 logs clawdbox-edge-gateway