docs: update README with pi install instructions and package info

This commit is contained in:
2026-05-23 20:22:38 +02:00
parent 1cad690f61
commit 8b5e6bc417
+37 -12
View File
@@ -4,21 +4,33 @@ Emits a sound alert when the context window reaches or exceeds **100 000 tokens*
## Installation ## Installation
### Option 1: Auto-discovered (recommended) ### Via `pi install` (recommended)
```bash
pi install git:git.enne2.net/enne2/context-warn@main
```
Or pin to a specific tag:
```bash
pi install git:git.enne2.net/enne2/context-warn@v1.0.0
```
### Via `--extension` (test without installing)
```bash
pi -e git:git.enne2.net/enne2/context-warn
```
### Manual install
```bash ```bash
mkdir -p ~/.pi/agent/extensions/context-warn mkdir -p ~/.pi/agent/extensions/context-warn
cp -r /home/enne2/base/context-warn-extension/* ~/.pi/agent/extensions/context-warn/ cp -r ~/.pi/agent/git/git.enne2.net/enne2/context-warn/* ~/.pi/agent/extensions/context-warn/
``` ```
Then reload pi with `/reload`. Then reload pi with `/reload`.
### Option 2: One-off with --extension
```bash
pi -e /home/enne2/base/context-warn-extension/index.ts
```
## Features ## Features
- **Sound alert**: Plays a pre-bundled WAV alert sound via `aplay` (no runtime generation) - **Sound alert**: Plays a pre-bundled WAV alert sound via `aplay` (no runtime generation)
@@ -34,7 +46,7 @@ pi -e /home/enne2/base/context-warn-extension/index.ts
## Configuration ## Configuration
Edit these values at the top of `index.ts`: Edit these values at the top of `index.ts` in the installed package:
| Constant | Default | Description | | Constant | Default | Description |
|----------|---------|-------------| |----------|---------|-------------|
@@ -45,9 +57,10 @@ Edit these values at the top of `index.ts`:
## Dependencies ## Dependencies
- `aplay` (ALSA player) — for playing the WAV file - `aplay` (ALSA player) — for playing the WAV file
- `sox` — only needed to **generate** a new alert.wav (optional) - `sox` — only needed to **generate** a new `alert.wav` (optional)
Both are available on Fedora by default. On Ubuntu/Debian: Both are available on Fedora by default. On Ubuntu/Debian:
```bash ```bash
sudo apt install alsa-utils sox libsox-fmt-all sudo apt install alsa-utils sox libsox-fmt-all
``` ```
@@ -56,7 +69,7 @@ sudo apt install alsa-utils sox libsox-fmt-all
1. Listens to `turn_end` events (fired after every LLM response) 1. Listens to `turn_end` events (fired after every LLM response)
2. Calls `ctx.getContextUsage()` to check current token count 2. Calls `ctx.getContextUsage()` to check current token count
3. When tokens ≥ threshold, plays `alert.wav` via aplay 3. When tokens ≥ threshold, plays `alert.wav` via `aplay`
4. Shows a TUI notification and updates the status bar 4. Shows a TUI notification and updates the status bar
5. Resets alert state on `session_compact` 5. Resets alert state on `session_compact`
@@ -76,4 +89,16 @@ sox -n -t wav c.wav synth 0.55 sine 880 vol 0.65
sox a.wav b.wav c.wav alert.wav sox a.wav b.wav c.wav alert.wav
``` ```
Customize the tone by changing the frequency and volume parameters. ## Package
This is a pi package. To update to the latest version:
```bash
pi update git:git.enne2.net/enne2/context-warn
```
To remove:
```bash
pi remove git:git.enne2.net/enne2/context-warn
```