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

pi-rusty-voice

v0.7.11

Published

pi 扩展:本地语音输入(Rust 原生内核 + SenseVoice,隐私零上传,DirectML GPU 加速)— Local voice input for pi: on-device, private, Rust-powered

Readme

pi-rusty-voice

English | 简体中文

给 pi coding agent 的本地语音输入扩展:按 /voice 或 Ctrl+S 说话,静音约 1 秒后自动转写,文字直接粘贴进输入框。

  • 🔒 隐私优先:语音数据永不离开你的电脑——只在内存中处理、不落盘、不上传,模型下载后完全离线可用(拔网线照常工作)
  • ⚡ Rust 原生内核:napi + sherpa-onnx + DirectML GPU 加速,5 秒语音约 0.1 秒出字(无 GPU 自动回退 CPU/WASM)
  • 中英文(SenseVoice-small,顺带支持日/韩/粤语),自动加标点、数字规范化
  • 纯 npm:没有 Python、没有系统依赖——连 ffmpeg 都来自 npm 包
  • lite:int8 量化模型约 239MB,一次下载永久使用(走 HF-Mirror,国内直连)

安装

pi install npm:pi-rusty-voice

首次使用 /voice 时自动完成:

  1. 下载 SenseVoice int8 模型(~239MB,HF-Mirror 直连)+ silero-vad(~1MB)
  2. 自动枚举麦克风并选择第一个输入设备(可用 /voice device 更换)

模型存放在 ~/.pi/agent/voice-models/。

命令

| 命令 | 作用 | |---|---| | /voice | 开始说话 → 静音 ~1s 自动转写 → 结果粘贴进输入框 | | /voice device | 选择麦克风(记住选择) | | /voice file <wav> | 转写一个 wav 文件(调试用) | | /voice setup | 强制重新下载/校验模型 | | /voice status | 查看模型/设备/依赖状态 |

录音规则:10 秒内没说话自动放弃;语音满 60 秒自动截断(停顿不占预算);结束只靠再按一次快捷键——说话中的停顿不再打断录音,VAD 仅用于裁掉静音。

快捷键

默认 Ctrl+S:按一次开始录音,再按一次手动停止(或停顿 1 秒自动断句)✓。pi 未占用该键,终端 raw mode 下无 XOFF 风险。

提示语跟随系统语言自动切换(中文/English)。可用环境变量 PI_VOICE_LANG=zh|en 强制指定。 引擎在 pi 会话启动时后台预热(模型上显存),首次按键即秒开无延迟。

/voice key alt+v      # 修改快捷键(如 alt+v / ctrl+shift+9)
/reload               # 立即生效
/voice key            # 查看当前快捷键

配置存于 ~/.pi/agent/voice-input.json 的 shortcut 字段。 (注:pi 的 keybindings.json 仅覆盖内置 action,扩展快捷键由本扩展自行配置。)

工作原理

麦克风 (ffmpeg dshow, 16kHz mono)
  → silero-vad 静音断句(说完 ~1s 自动停,或再按一次快捷键手动停)
  → SenseVoice-small int8:Rust 原生内核优先(napi + sherpa-onnx,DirectML GPU 加速)
     └ 无 GPU / 引擎缺失时自动回退 sherpa-onnx WASM(纯 CPU,零安装成本)
  → 文字(自带标点/ITN)
  → ctx.ui.pasteToEditor() 粘贴进输入框

GPU 路径:5 秒语音约 0.1 秒出字(会话启动时后台预热,首次按键即热)。 全程本机推理,无任何网络请求。

专有名词纠错

ASR 模型无法"学会"你的领域词,用纠错词典让转写自动修正:

/voice word 麦姆斯 MEMS           # 中文别名:精确/子串匹配(不做同音猜)
/voice word 雪帕 sherpa-onnx     # 精确/子串匹配
/voice word                      # 列出全部词条
/voice word rust Rust            # 拉丁别名按编辑距离模糊命中(rost/rustt → Rust)
/voice learn 谐振器              # 自动在上一次转写里找最像的错词并建议映射
/voice word del 拉斯特           # 删除一条

词条存于 ~/.pi/agent/voice-glossary.json,在粘贴前离线应用——无网络、无延迟。

隐私

音频只在本机内存中处理,不落盘、不上传、无遥测。唯一的网络行为是首次下载模型(走 HF-Mirror),之后可完全断网使用——隐私是本地方案的根本优势:你的声音永远是你的。

依赖

License

MIT