← Catalog

@cltec/pi-splash-stats

Pi extension that displays live inference statistics for OpenAI-compatible Splash servers.

Extension

Install

Install with PiG

pig install npm:@cltec/pi-splash-stats

Install with Pi

pi install npm:@cltec/pi-splash-stats
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.2.1 (README.md). PiG does not review it.

Pi Splash Stats

A Pi extension that shows live inference statistics for OpenAI-compatible Splash servers in the interactive terminal UI: a cache-aware prefill progress bar while the prompt is being processed, and a live estimated generation count and speed while the model streams its answer.

It is a passive observer. It enriches and watches the inference traffic Pi already sends to a verified Splash backend, then renders two transient status lines in the TUI. It changes no prompts, no tools, and no responses, and it stays completely silent in every non-interactive mode.

This extension is inspired by pi-llama-cpp-stats.

 ── ⠸ Prefilling... ██████████░░░░░░░░░░  50% · 2s · 20.0 tok/s ─────────────────────
  Generating... ≈123 tok (≈45.6 tok/s)

What you get

  • Cache-aware prefill progress. A 20-cell bar with percentage, elapsed time, and uncached throughput (Prefilling... ████░░░░ NN% · 2s · 20.0 tok/s). Cached tokens are not re-counted, so the bar reflects the work actually being done.
  • Live generation count and speed. While the answer streams, Generating... ≈123 tok (≈45.6 tok/s) shows estimates, each marked ≈. The cumulative rate excludes time-to-first-output and the first output batch, appears only after a later batch and at least 500 ms, and includes pauses between stream observations. It uses estimated tokens, not backend timing; burst delivery and tokenization affect accuracy. Very short responses and narrow terminals show the count alone. Final counts and native Splash throughput take precedence independently; unavailable final rates are omitted.
  • TUI only. The statistics appear only in the interactive terminal UI. RPC, print, and JSON modes produce no statistics messages, no terminal output, no notifications, and no transcript entries (SPECIFICATION.md §8.4, AC-13).
  • Identity-verified. It only observes and enriches requests to a Splash backend it has verified through the Splash discovery protocol. Requests to any other provider pass through untouched.
  • Bounded and safe. Updates are coalesced to at most 10 per second (phase changes and cleanup render immediately). If the UI API throws, the display is disabled without failing the request. If a stream is cut off abruptly, the display is cleared without an unhandled rejection. If discovery fails, the original request is sent unchanged.

Requirements and compatibility

RequirementDetail
Node.js22.18 or newer. CI runs Node 22 and 24 on Linux with the same commands; local verification here uses Node 22.
Pi1.6.0 baseline for the e2e checks, pinned in scripts/quality.json.
PlatformLinux is tested in CI. Other operating systems are not currently verified.
DependenciesNone. npm install is not required. E2E additionally needs a Pi binary and a system tar.
Networknpm test and npm run check are offline. At runtime the extension makes a single bounded, cached discovery request to the Splash backend to verify provider identity; it makes no other network calls.

Nothing is built. Pi loads the TypeScript directly, and the tests rely on Node's TypeScript stripping. There is no lint, typecheck, or build step; stripping does not typecheck.

Install

# From a local checkout
pi install /absolute/path/to/pi-splash-stats

# From Git
pi install git:github.com/cltec/pi-splash-stats

# From npm (only after publishing is explicitly enabled)
pi install npm:@cltec/pi-splash-stats

For one run without changing Pi settings, use pi -e /path/to/pi-splash-stats.

The manifest sets "private": false, but publication still requires the explicit repository gate. The npm: form requires a published version; see docs/RELEASING.md.

Usage

Install the extension and use Pi as usual. The statistics appear automatically while a chat to a verified Splash backend is in flight — no configuration, flags, commands, or launcher handshake. Activation depends only on the backend serving the current request, never on how Pi was launched (SPECIFICATION.md §2, Decision D1, AC-02/AC-15). The statistics are transient: they clear when the response completes or is aborted.

Two launch workflows both work and produce equivalent statistics for the same Splash-served model:

  • splash pi ... — the Splash launcher starts Pi already pointed at a running Splash model. The extension observes that model's requests exactly as it would for a directly launched Pi; it does not inspect the launcher, parent process, or a particular provider name. If you switch to a non-Splash (e.g. cloud) model, the stats clear immediately and subsequent requests are left untouched.
  • Pi launched directly — configure Pi with a Splash-served OpenAI-compatible model (including a server on a non-default port) and run Pi normally. The extension verifies the backend through the Splash discovery protocol and shows stats while that model streams. Arbitrary configured provider names do not prevent activation; a non-Splash provider simply shows no stats.

The extension reads no configuration, environment variables, or files, keeps no state between invocations, and starts no background work.

Remove

Use pi remove with the same source string you installed from. Pi matches sources exactly, so /absolute/path, git:..., and npm:... forms are distinct:

pi remove /absolute/path/to/pi-splash-stats
pi remove git:github.com/cltec/pi-splash-stats
pi remove npm:@cltec/pi-splash-stats

The extension keeps no configuration or state of its own. If you loaded it with pi -e, there is nothing to remove.

Development commands

TaskCommandNotes
Unit, wiring, and tooling testsnpm testOffline; no Pi process, no npm pack, no network.
Package checknpm run check:packageAsserts the npm pack contents.
Full local checknpm run checknpm test && npm run check:package.
End-to-endnpm run test:e2eReal Pi: checkout RPC, headless JSON, packed archive.
One test filenode --test test/extension.test.tsReplace with the file you are changing.

npm run check does not run e2e. Run e2e when changing extension wiring, the command contract, package contents, or the Pi baseline. No dependency installation is needed for any command, but e2e needs a compatible Pi binary.

The e2e runner creates a temporary home, config directory, and working directory and passes only an allowlisted environment. It runs Pi offline, makes no provider calls, bounds shutdown, cleans up, and writes a sanitized schema-1 result instead of raw logs.

  • Checkout: Pi loads src/index.ts with -e.
  • Headless JSON: Pi runs --mode json and the test asserts the extension emits no custom messages and exits cleanly.
  • Packed archive: the runner packs the current tree, or reuses an exact checked archive via PACKAGE_ARCHIVE=/absolute/file.tgz. It lists and extracts the tarball with a system tar, then loads the extracted directory through a temporary Pi settings.json packages entry and discovers the extension from the manifest. It does not run pi install or contact a registry; that install path is a known coverage limit.

Set E2E_RESULT_PATH to change the result file. scripts/summarize-e2e.mjs renders only known fields from it. See docs/TESTING.md.

A separate real-Pi verification harness drives the terminal UI and non-TUI modes end to end, including a packed-package journey that installs the npm pack artifact through the manifest. See .cursor/skills/verify-pi-splash-stats/SKILL.md.

Packaging

npm run check:package treats packaging as an allowlist, not a denylist. The package ships package.json, README.md, LICENSE, CHANGELOG.md, and non-hidden src/**/*.ts files, excluding *.test.ts, *.spec.ts, and AGENTS.md/CLAUDE.md/GEMINI.md. Agent instructions, tests, e2e files, docs, environment files, credentials, and tarballs must not be packed. When you add a resource directory that users need, add it to the files allowlist and update the check deliberately.

Releases

Merge a reviewed stable version bump and matching CHANGELOG.md entry into main to request a release. Automation verifies that exact commit with offline Node 22/24 checks and pinned-Pi e2e before creating or verifying its matching vX.Y.Z tag and explicitly dispatching Release. Unchanged versions do nothing; invalid or decreased versions and conflicting tags are rejected. Tags are never moved. There is no automatic merging. The manifest already sets "private": false; npm publication and GitHub Releases still require ENABLE_NPM_PUBLISH to be exactly true. Disabled means neither is created. Release-intent runs are serialized, but GitHub concurrency is not a durable queue: merge one release bump at a time and confirm its handoff. Retry the original run if dispatch fails after tagging.

When enabled, the workflow runs source smoke, packs the final release/package.tgz, re-runs e2e with PACKAGE_ARCHIVE pointed at that archive, uploads the checked artifact, and publishes those same bytes. E2E and offline steps may create temporary packs; only the final release tarball is preserved and published. Setup, OIDC trusted publishing, and the maintainer procedure live in docs/RELEASING.md.

Troubleshooting

Common local, e2e, packaging, and release-gate symptoms are listed in docs/TROUBLESHOOTING.md. Start with the failing command's own output and the sanitized e2e artifact; do not paste credentials, prompts, or real home-directory paths into an issue.

Support

Documentation

DocumentContents
docs/ARCHITECTURE.mdModules, request flow, transports, modes, and failure behavior.
docs/TESTING.mdTest layers, e2e isolation, the real-Pi verification harness, and what is not covered.
docs/TROUBLESHOOTING.mdCommon local, e2e, packaging, and release-gate symptoms.
docs/adr/0001-thin-extension-and-layered-tests.mdWhy the adapter is thin and the tests are layered.
docs/adr/0002-transport-coverage.mdWhy summaries use a scoped fetch observer.
docs/RELEASING.mdRelease setup and maintainer procedure.
CONTRIBUTING.mdWorkflow, standards, and pull request checklist.
AGENTS.mdAgent instructions: verified commands, invariants, boundaries.
SECURITY.mdReporting and security scope.
CHANGELOG.mdNotable changes.

Security

The extension runs no external commands and reads no configuration. At runtime it makes a single bounded, cached discovery request to the Splash backend and otherwise only observes the inference traffic Pi already sends. Extensions run inside the Pi process with the same operating-system permissions as Pi, so review any extension before installing it. Report vulnerabilities privately; see SECURITY.md.

License

Apache-2.0. See LICENSE.