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

dataagent-claw

v1.0.0

Published

A minimal Weixin bridge for DataAgent, runnable via npx.

Readme

dataagent-claw

基于 @tencent-weixin/openclaw-weixin 源码里的微信协议,做了一个最小桥接器:

  • 轮询微信 ilink/bot/getupdates
  • 每次启动都会清空 WEIXIN_TOKEN,并重新弹出微信扫码二维码
  • 读取用户文本消息
  • 调用 DataAgent POST /api/agent:chat SSE 接口
  • 聚合 SSE 返回内容
  • 用微信 ilink/bot/sendmessage 回消息

配置

复制 .env.example.env,填入:

  • DATAAGENT_BASE_URL
  • DATAAGENT_TOKEN
  • DATAAGENT_SESSION_ID
  • DATAAGENT_SPACE
  • DATAAGENT_AGENT

WEIXIN_TOKEN 只作为运行期写回的凭据缓存。程序每次启动都会先清空它,然后在终端打印二维码,扫码成功后再写回 .env

如果你的 DataAgent 接口依赖后台会话上下文,需要把浏览器里实际使用的 sessionId 填到 DATAAGENT_SESSION_ID。当前实现会按你给的完整 curl 一样发送:

  • sessionId
  • attachments: []
  • x-authenticator
  • x-hostname
  • x-locale
  • x-role
  • x-spaces
  • x-spaces-view
  • x-timezone
  • x-with-acl-meta
  • Origin
  • Referer

日志默认写入 .data/logs/dataagent-claw.log,也可以通过 LOG_FILE 覆盖。

运行

首次使用可以先初始化当前目录配置:

npx dataagent-claw init

初始化后编辑当前目录下的 .env,再启动:

npx dataagent-claw

每次启动流程:

  1. 终端打印二维码
  2. 微信扫码并确认绑定
  3. 程序自动写入 WEIXIN_TOKEN
  4. 进入长轮询,开始收发消息

桥接器会把微信长轮询游标保存到 .data/weixin-sync-buf.jsonagent:chat 的请求和响应日志会持久化到 .data/logs/dataagent-claw.log

发布

发布到 npm 后,其他用户无需源码即可在任意目录直接运行:

npx dataagent-claw init
npx dataagent-claw

发布命令:

npm publish

如果包名已被占用,先把 package.json 里的 name 改成你自己的 npm 包名或作用域包名。

当前范围

  • 支持微信文本消息输入
  • 用户发送 /clear 时清空该微信用户的历史对话上下文,并返回确认消息
  • 固定使用微信网关 https://ilinkai.weixin.qq.com
  • 将 DataAgent SSE 输出聚合为文本后回复微信
  • 自动按微信文本长度限制分片发送
  • 使用 pino 记录运行日志,并持久化 agent:chat 调用详情
  • DataAgent 请求会尽量贴近后台管理端的 curl 头和请求体