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-blackbox

v0.3.0

Published

Inspect and explain every tool call in the current Pi session

Downloads

410

Readme

pi-blackbox

中文说明

pi-blackbox records every model-issued tool call in the current Pi session, shows the live count in Pi's footer, and provides an interactive /blackbox inspector.

Features

  • Counts every tool_call event, including built-in tools such as read, write, edit, and bash, plus tools registered by other extensions.
  • Reconstructs tool calls from the current session branch after resume, fork, or tree navigation.
  • Publishes the blackbox extension status as <count> tool calls through Pi's native ctx.ui.setStatus() data source and displays it on the native statistics row with the same dim color.
  • Opens a viewport-sized /blackbox inspector with a fixed header and shortcut footer; press Enter to expand the selected call's complete arguments from their beginning.
  • Sends the selected call to the current session model for a concise explanation in the configured language without adding anything to the conversation.
  • Detects Chinese or English from the operating system on first launch and persists the choice in ~/.pi/agent/extensions/blackbox.json.

Install

As a published Pi package:

pi install npm:pi-blackbox

During local development:

pi install ./pi-blackbox

Alternatively, try it without installing:

pi -e ./pi-blackbox/src/index.ts

Run /reload in an existing Pi session after installing or changing the extension.

Usage

Enter /blackbox to see the newest tool call at the top. The title shows the active order. Then use:

| Key | Action | | --- | --- | | Up / Down | Select a tool call | | j / k | Move down/up; scroll a selected expanded item when it is taller than the viewport | | Enter | Expand or collapse its complete arguments | | e | Ask the current Pi model to explain its actual effect | | r | Reverse between newest-first and oldest-first order | | q, Esc, or Ctrl+C | Close the view |

The explanation prompt asks for a short and precise account of what the call reads, writes, creates, deletes, executes, or otherwise affects. It forbids execution and unsupported guesses; a short example is allowed only when the call is complex. The selected tool name and arguments are sent to the currently selected model.

Run /blackbox-explain-language to choose Auto-detect, a common language, or Other and enter any language name. The selection is persisted in ~/.pi/agent/extensions/blackbox.json:

{
  "explainLanguage": "Chinese"
}

On first launch, macOS reads AppleLanguages, Linux reads LC_ALL / LC_MESSAGES / LANG, and Windows reads the current user's preferred language list before trying PowerShell 7 (pwsh.exe), Windows PowerShell, and terminal locale variables. If the platform-specific source is unavailable, detection falls back to Intl. Automatic detection selects Chinese for a Chinese locale and English otherwise. Choosing Auto-detect reruns detection and saves the result.

pi-powerline-footer

Pi's default footer displays the count directly after its token/context statistics instead of on a separate extension-status row. To promote the same blackbox status to a dedicated pi-powerline-footer segment, merge this into ~/.pi/agent/settings.json (or the active project .pi/settings.json):

{
  "powerline": {
    "preset": "default",
    "customItems": [
      {
        "id": "blackbox",
        "statusKey": "blackbox",
        "position": "right",
        "color": "accent",
        "hideWhenMissing": true,
        "excludeFromExtensionStatuses": true
      }
    ]
  }
}

The displayed value remains exactly <count> tool calls; no prefix is added. hideWhenMissing keeps the item invisible when pi-blackbox is not loaded, while excludeFromExtensionStatuses prevents a duplicate in the aggregate extension-status segment.

If you already use powerline.customItems, append the object above instead of replacing the array. Restart Pi or run /reload after editing the settings.

Development

npm install
npm run verify