omp packages

@cltec/pi-splash-stats0.3.1

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

GitHub Actions Published 1 day ago Apache-2.0 ~794 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

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.

CI npm license

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.

During Prefill:

 ── ⠸ Prefilling... ██████████░░░░░░░░░░  50% · 2s · 20.0 tok/s ─────────────────────

During Decode:

 ── ⠸ Working... 2s · 45.6 tok/s · ≈123 tok ─────────────────────────────────────────

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

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, rate, and elapsed time. While the answer streams, Working... 2s · 45.6 tok/s · ≈123 tok shows the request-local generation time (from the first output chunk), an estimated count marked ≈ until an exact final count replaces it, and an estimated rate. The cumulative rate excludes time-to-first-output and the first output batch, appears only after a later batch. It uses estimated tokens, not backend timing; burst delivery and tokenization affect accuracy. 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.
  • 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.

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.

Requirements and compatibility

Requirement Detail
Node.js 22.18 or newer
Pi Tested against 1.6.0 and above

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.

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

Task Command Notes
Unit, wiring, and tooling tests npm test Offline; no Pi process, no npm pack, no network.
Package check npm run check:package Asserts the npm pack contents.
Full local check npm run check npm test && npm run check:package.
End-to-end npm run test:e2e Real Pi: checkout RPC, headless JSON, packed archive.
End-to-end in Docker ./e2e/docker.sh Same checks; no host Pi or Node.js needed.
One test file node --test test/extension.test.ts Replace 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. The native e2e command needs a compatible Pi binary.

If Pi is missing or the wrong version, start Docker and run from the checkout:

./e2e/docker.sh                   # Use the Pi baseline in scripts/quality.json
PI_VERSION=1.7.0 ./e2e/docker.sh   # Request an exact Pi version

The image build needs network access when uncached; the tests run without networking. The Docker runner exports the sanitized result to artifacts/e2e-result.json.

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

Open an issue at https://github.com/cltec/pi-splash-stats/issues for reproducible bugs and documentation gaps.

Documentation

Document Contents
docs/ARCHITECTURE.md Modules, request flow, transports, modes, and failure behavior.
docs/TESTING.md Test layers, e2e isolation, the real-Pi verification harness, and what is not covered.
docs/TROUBLESHOOTING.md Common local, e2e, packaging, and release-gate symptoms.
docs/adr/0001-thin-extension-and-layered-tests.md Why the adapter is thin and the tests are layered.
docs/adr/0002-transport-coverage.md Why summaries use a scoped fetch observer.
docs/RELEASING.md Release setup and maintainer procedure.
CONTRIBUTING.md Workflow, standards, and pull request checklist.
AGENTS.md Agent instructions: verified commands, invariants, boundaries.
SECURITY.md Reporting and security scope.
CHANGELOG.md Notable 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.