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

weixin-bridge

v1.0.3

Published

Standalone Weixin long-poll bridge

Readme

微信 AI Bridge

English

这个项目只保留一条真实微信链路:

微信用户
  -> 微信 iLink 后端
  -> weixin-bridge
  -> 你的 AI/业务逻辑
  -> weixin-bridge
  -> 微信 iLink 后端
  -> 微信用户

它不实现自有 IM 后端,也不再提供 webhook 分支。你的业务代码直接通过 startWeixinBridge({ onMessage }) 接入。

安装与构建

npm install
npm run build

扫码登录

node dist/cli.js login

终端会显示二维码,用微信扫码并在手机端确认。登录凭证默认保存在:

~/.weixin-bridge/accounts

查看已登录账号:

node dist/cli.js accounts

回声测试

node dist/cli.js test-chat

用微信给已登录账号发消息,bridge 会回复:

收到:<你的消息>

接入 AI/业务逻辑

根目录的 test.js 演示了真实微信消息接入 Responses 兼容 API:

export BASE_URL='https://ai-demo-dev.kuaiman.com/ai'
export API_KEY='sk-...'
node test.js

核心代码:

import { resolveStandaloneAccount, startWeixinBridge } from "@tencent-weixin/weixin-bridge";

const account = resolveStandaloneAccount();

await startWeixinBridge({
  accountId: account.accountId,
  token: account.token,
  baseUrl: account.baseUrl,
  cdnBaseUrl: account.cdnBaseUrl,
  async onMessage(message) {
    // message.text 是微信文本。
    // message.media?.path 是微信图片/文件下载后的本地路径。
    const reply = await callYourAiOrBusiness(message);
    return reply;
  },
});

onMessage 可以返回文本:

return "回复给微信用户的文本";

也可以返回媒体:

return {
  text: "生成好了",
  mediaPath: "/tmp/generated.png",
};
return {
  text: "生成好了",
  mediaUrl: "https://example.com/generated.png",
};

当前能力

  • 微信扫码登录
  • 长轮询接收微信消息
  • 接收文本消息
  • 下载并解密微信入站图片、语音、文件、视频到本地
  • 回复文本消息
  • 回复图片、视频、文件:onMessage 返回 { text, mediaPath }{ text, mediaUrl }