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

usage-report

v0.1.1

Published

Pi extension: multi-instance token/cost/TTFT usage collector + Tauri dashboard

Readme

usage-report

Pi 扩展:在多个终端同时跑 pi 时,采集每次 LLM 调用的 token / 缓存 / 费用 / TTFT / TPS,写入 ~/.pi/pi-usage-report-store/usage.db,并用 Tauri 2 桌面窗口做实时统计仪表盘。

产物体积

dist/pi-usage-monitor.exe4.4MB(使用系统 WebView2,不内嵌 Bun / Chromium)。dist/ 是自包含产物:编译后的扩展 JS + 桌面 exe,直接可作为 pi 包安装/临时装载。

目录结构

extensions/           # pi 采集端源码(TS,编译进 dist/extensions)
src-tauri/
  src-web/            # Vue3 + Pinia 前端源码
  web/                # 前端构建产物(vite 输出到此,已 gitignore)
  src/                # Rust(rusqlite 只读查询 + usage_config.yaml)
dist/                 # 发布产物(自包含)
  extensions/         # 编译后的扩展 JS
  pi-usage-monitor.exe
  BUILD_INFO.json
docs/                 # 中文文档

package.jsonpi.extensions 指向 ./dist/extensions,所以装载的是编译后的 JS,源码 extensions/*.ts 只是开发输入。

安装与使用

# 先构建(编译扩展 + tauri exe)
npm run build

# 临时装载测试(仅本次运行生效,不写入 settings)
pi -e ./dist

# 或正式安装(写入 settings)
pi install ./path/to/usage_report

# 在 pi 内打开仪表盘
/usage

# 或直接双击
dist/pi-usage-monitor.exe

辅助命令:

/usage-db    # 打印数据库路径

开发

环境要求:Rust stable、Node 22+、Windows WebView2 Runtime(Win11 一般自带)。

npm install && npm --prefix src-tauri/src-web install

npm run seed    # 写入测试数据到 ~/.pi/pi-usage-report-store/usage.db
npm run dev     # Tauri 开发模式(前端热更新)
npm run build   # 发布构建 → dist/extensions(编译)+ dist/pi-usage-monitor.exe

架构

多个 pi 终端
  └─ extensions/ 采集 ──写入──► ~/.pi/pi-usage-report-store/usage.db
                                      ▲ 只读
Tauri 窗口(Rust invoke + 系统 WebView2)
  └─ 前端:src-tauri/src-web 构建进 src-tauri/web
  └─ UI 选项:~/.pi/pi-usage-report-store/usage_config.yaml

| 组件 | 路径 | 运行时 | |---|---|---| | 采集扩展 | extensions/ | pi 进程内 Node(node:sqlite) | | 桌面壳 | src-tauri/ | Tauri 2 + rusqlite | | 前端 | src-tauri/src-web/src-tauri/web | Vue3 + Pinia + ECharts | | 数据库 | ~/.pi/pi-usage-report-store/usage.db | SQLite WAL | | UI 配置 | ~/.pi/pi-usage-report-store/usage_config.yaml | 统计页小选项持久化 |

默认 UI:时间范围 过去 24h → 实时LIVE 模式开启

文档

许可证

MIT