# @stenn/tps-monitor

Minimal tokens-per-second (TPS) display in the [pi coding agent](https://pi.dev) footer. Track model generation speed with a clean, color-coded indicator.

![pi-package](https://img.shields.io/badge/pi-package-blue)

## Features

- **Minimal display**: `⚡ 128 TPS` in the footer
- **Color-coded**: 
  - 🟢 Green (>100 TPS)
  - 🟡 Yellow (50-100 TPS)
  - 🔴 Red (<50 TPS)
- **Toggle on/off**: Use `/tps` command to enable/disable

## Installation

```bash
pi install npm:@stenn/tps-monitor
```

Or install locally in your project:

```bash
pi install -l npm:@stenn/tps-monitor
```

## Usage

Once installed, the TPS monitor automatically appears in the footer during model responses.

### Commands

| Command | Description |
|---------|-------------|
| `/tps` | Toggle TPS display on/off |

## How It Works

The extension hooks into pi's message lifecycle:

1. **Start**: Timer begins when the assistant starts generating
2. **End**: Calculates TPS from `output tokens / duration`
3. **Display**: Updates footer with the latest metric

## Requirements

- [pi coding agent](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent)
- Node.js 18+

## Development

```bash
# Local development
npm link

# Or install from local path
pi install ./path/to/tps-monitor
```

## License

MIT
