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

liangzimixin-test

v0.3.104-beta.4

Published

Quantum-encrypted IM channel plugin for OpenClaw

Readme

liangzimixin (量子密信)

npm version License: MIT

liangzimixin 是用于 OpenClaw 的密信 IM Channel 插件,支持私聊消息接入、AI 回复分发、量子加密通信、媒体文件传输和 WebSocket 长连接管理。

功能特性

  • 私聊消息接入: 接收密信 IM 私聊消息,并交给 OpenClaw Agent 处理。
  • 量子加密: 支持 quantum_onlyquantum_and_plain 两种消息加密模式。
  • 文本与 Markdown: 自动识别 Markdown 内容,避免格式被纯文本发送。
  • 媒体文件: 支持图片、文件、语音、视频的下载、上传、分片和加密传输。
  • OAuth 认证: 使用 appId/appSecret 获取 access token,支持缓存、提前刷新和 401 重取。
  • WebSocket 重连: 心跳保活,断线后三阶段退避重连并持续重试。
  • OpenClaw 命令: 支持 /reset/new/help 等原生命令。
  • 配置向导: 支持 OpenClaw CLI 交互式配置和非交互参数配置。

运行要求

  • Node.js >=20
  • OpenClaw >=2026.2.0

当前开发依赖使用 openclaw@^2026.4.14

安装

openclaw plugins install liangzimixin

安装后可以通过 OpenClaw CLI 进行配置:

openclaw configure

或使用渠道添加命令配置默认账户:

openclaw channels add --channel liangzimixin \
  --token <appId> \
  --password <appSecret> \
  --user-id <quantumAccount> \
  --device-name quantum_and_plain

参数映射:

| CLI 参数 | 配置字段 | 说明 | |---|---|---| | --token | appId | 应用 ID | | --password | appSecret | 应用密钥 | | --user-id | quantumAccount | 量子账户标识,可选 | | --device-name | encryptionMode | quantum_onlyquantum_and_plainnot_enabled |

配置

当前插件从 OpenClaw 全局配置的 channels.liangzimixin.accounts.default 读取账户配置:

{
  "channels": {
    "liangzimixin": {
      "enabled": true,
      "accounts": {
        "default": {
          "appId": "your-app-id",
          "appSecret": "your-app-secret",
          "quantumAccount": "17100001111",
          "botUserId": "bot-user-id",
          "env": "production",
          "encryptionMode": "quantum_and_plain"
        }
      }
    }
  }
}

配置字段

| 字段 | 必填 | 默认值 | 说明 | |---|---:|---|---| | appId | 是 | 无 | IM 开放平台应用 ID,同时作为 OAuth client_id | | appSecret | 是 | 无 | 应用密钥,同时作为 OAuth client_secret | | quantumAccount | 否 | 无 | 量子账户标识;填写后启用量子加密能力 | | botUserId | 否 | 无 | Bot 自己的用户 ID,用于过滤自己发出的消息 | | env | 否 | production | 部署环境:stagingproduction | | encryptionMode | 否 | quantum_and_plain | 消息加密模式 |

加密模式

| 模式 | 入站行为 | 出站行为 | |---|---|---| | quantum_only | 仅处理量子加密消息;收到明文或无法解密时提示用户 | 强制加密,失败不降级 | | quantum_and_plain | 同时支持加密消息和普通消息 | 根据当前入站消息状态决定回复是否加密,必要时可降级明文 |

如果未启用量子加密能力,可以在 CLI 配置时使用:

openclaw channels add --channel liangzimixin \
  --token <appId> \
  --password <appSecret> \
  --device-name not_enabled

环境变量

常用运维参数可以通过环境变量覆盖:

| 环境变量 | 说明 | |---|---| | LZMX_ENV | 默认部署环境,支持 teststagingdevproduction | | LZMX_WS_URL | 覆盖 WebSocket 服务基址 | | LZMX_AUTH_URL | 覆盖 OAuth 服务基址 | | LZMX_MSG_URL | 覆盖消息服务基址 | | LZMX_FILE_URL | 覆盖文件服务基址 | | LZMX_ALLOW_PRIVATE_NETWORK | 是否允许远程媒体下载访问内网地址 | | LZMX_ALLOW_INSECURE_WS | 是否允许 ws://,默认禁止 | | OPENCLAW_WORKSPACE | 加入本地媒体文件白名单根目录 |

默认服务地址由 env 决定。production 使用线上密信 IM 服务,staging 使用联调环境。

使用

配置完成后重启 OpenClaw Gateway:

openclaw gateway restart

插件启动后会连接密信 IM WebSocket 事件流,接收私聊消息并通过 OpenClaw Agent 回复。

发送目标可以使用原始会话或用户 ID,也可以带渠道前缀:

6917612749001351378
liangzimixin:6917612749001351378

媒体与文件

插件支持发送和接收图片、普通文件、语音和视频。

出站媒体支持三种来源:

  • Buffer 输入
  • 远程 http://https:// URL
  • 本地文件路径

本地文件必须位于白名单目录中。默认白名单包含:

  • OPENCLAW_WORKSPACE
  • ~/.openclaw/workspace
  • /tmp/openclaw

文件上传默认限制:

| 项 | 默认值 | |---|---:| | 单文件大小上限 | 30 MB | | 上传分片大小 | 5 MB | | 文件加密分片大小 | 10 MB | | 上传并发 | 3 |

日志与数据

运行时会在用户目录下保存 token 和日志:

~/.liangzimixin/tokens/<appId>
~/.liangzimixin/logs/app-YYYY-MM-DD.log

日志按天轮换,默认保留 14 天。

开发

npm install
npm run typecheck
npm run lint
npm run build

常用脚本:

| 命令 | 说明 | |---|---| | npm run build | 使用 tsup 构建 CJS 产物并复制量子 SDK | | npm run dev | tsup watch 模式 | | npm run typecheck | TypeScript 类型检查 | | npm run lint | ESLint 检查 | | npm run format:check | Prettier 格式检查 |

回归测试脚本:

node tests/msg-type-detect.test.mjs
node tests/parser-reference.test.mjs
npx -y tsx smoke-test-hardening.mts

发布

scripts/publish-alpha.sh
scripts/publish-beta.sh
scripts/publish.sh

构建产物包含:

  • dist/index.cjs
  • dist/setup-entry.cjs
  • dist/quantum-sdk/
  • openclaw.plugin.json
  • 安装脚本

License

MIT