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

@jeik/usage-counter

v1.0.0

Published

统计 agent 的调用次数,存入 SQLite,并提供查询 / 排行 / 导出工具。

Readme

usage-counter

统计 agent 的调用次数,存入 SQLite,并提供查询 / 排行 / 导出工具。

每次"发给模型之前"(before_agent_run 钩子)记一条,写入本地 SQLite;再注册查询工具,让 agent 一键查统计。


安装

方式一:npm(推荐)

插件已发布到 npm。用自带的安装向导,一条命令完成「装插件 + 开启所需 hook 权限」:

npx -y @jeik/usage-counter install

向导会确认开启 allowConversationAccess(统计要读对话上下文:agentId / 会话 / 时间),然后提示重启。

只想装、之后自己配权限:

openclaw plugins install @jeik/usage-counter --force

--force 即为覆盖更新,升级时同样用它,无需先卸载。

方式二:本地构建产物(开发 / 离线)

npm install && npm run build && npm pack   # → jeik-usage-counter-1.0.0.tgz
openclaw plugins install ./jeik-usage-counter-1.0.0.tgz --force

之后

openclaw gateway restart

必须的配置(否则计数不生效)

before_agent_run 是对话敏感钩子,非内置插件必须在 openclaw 主配置里显式放行:

openclaw config set plugins.entries.usage-counter.hooks.allowConversationAccess true --strict-json

用上面的安装向导会自动帮你设置这一项。 排错时若日志出现 ... blocked because non-bundled plugins must set ... allowConversationAccess=true,就是这里没配。


开发

npm install
npm run build      # esbuild → dist/index.js
npm pack           # → jeik-usage-counter-1.0.0.tgz

源码: