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

@zhin.js/adapter-satori

v0.0.9

Published

Zhin.js adapter for Satori protocol

Readme

@zhin.js/adapter-satori

Zhin.js Satori 聊天协议适配器,一个适配器支持 WebSocket 正向与 Webhook 两种连接方式,由配置项 connection 区分;支持 HTTP API 与 Bearer Token 鉴权。

勿与本仓库的 @zhin.js/satori 混淆:后者是 Vercel satoriSVG 图片渲染工具包(packages/satori),用于把 HTML/React 画成 SVG,不是聊天协议。参见 @zhin.js/satori README

功能特性

  • 🔌 Satori 协议 兼容
  • 📦 单一适配器context: satori,通过 connection 选择连接方式
  • 🌐 WebSocket 正向connection: ws):应用连 SDK ws(s)://baseUrl/v1/events
  • 📮 Webhookconnection: webhook):应用提供 POST 端点收事件
  • 🔐 Bearer Token 鉴权(API 与 WS IDENTIFY)
  • 📨 频道 / 私聊消息收发,消息 id 格式为 channelId:messageId

安装

pnpm add @zhin.js/adapter-satori ws

Webhook 方式需启用 @zhin.js/http(适配器依赖 router 注册):

pnpm add @zhin.js/http

配置

所有 Bot 使用 同一 context:satori,通过 connection 区分连接方式。

WebSocket 正向

plugins:
  - "@zhin.js/adapter-satori"

bots:
  - context: satori
    connection: ws
    name: satori-bot
    baseUrl: "http://127.0.0.1:5140"
    token: "${SATORI_TOKEN}"
    heartbeat_interval: 10000

Webhook

plugins:
  - "@zhin.js/http"
  - "@zhin.js/adapter-satori"

bots:
  - context: satori
    connection: webhook
    name: satori-webhook-bot
    baseUrl: "http://satori-sdk 地址"
    path: "/satori/webhook"
    token: "${SATORI_TOKEN}"

SDK 会向 path 发送 POST,请求头 Satori-Opcode: 0 表示事件;适配器从首个事件的 login 取得 platform / userId 用于后续 API 调用。

鉴权

  • API:请求头 Authorization: Bearer {token}
  • WebSocket:IDENTIFY 时 body 中传 token

配置 token 并与 Satori SDK 端一致即可。

连接方式对比

| connection | 说明 | |------------|------| | ws | 应用主动连 SDK /v1/events,IDENTIFY + 心跳 | | webhook | 应用提供 POST path,SDK 推送事件 |

消息 id 与撤回

  • 消息 $id 格式为 channelId:messageId,便于发消息 / 撤回时解析。
  • 撤回时需 channel_id + message_id,适配器已按上述格式解析。

协议文档