← Catalog

pi-bell

Desktop notifications when a Pi agent run finishes, is aborted, or fails

Package

Install

Install with PiG

pig install npm:pi-bell

Install with Pi

pi install npm:pi-bell
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.

Video

Declared by the package manifest. Open the file ↗

Pi manifest JSON

The pi field of package.json.

{
  "video": "https://raw.githubusercontent.com/beasaltfish/pi-bell/master/demo.mp4",
  "extensions": [
    "./src/index.ts"
  ]
}

README

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

pi-bell

Desktop notifications for Pi agent runs: when a run finishes, when you abort it, and when it fails.

It fires once the run has really settled — after retries, compaction retries, and queued follow-ups — and covers terminals that have no OSC support.

pi-bell demo: install, type a prompt, switch away, get notified

The same clip as a video: demo.mp4. Regenerate either one with ./scripts/make-demo.sh <recording.mp4>.

Pi ✓   done · 42s · my-project
Pi ⚠   aborted · 5s · my-project
Pi ✕   failed · 4s · my-project — 401 unauthorized

Install

pi install npm:pi-bell
# or from git
pi install git:github.com/beasaltfish/pi-bell
# or try it for one run without installing
pi -e .

Restart Pi afterwards.

How it decides

Two things matter: whether Pi and you are on the same machine, and whether a terminal multiplexer sits in between.

EnvironmentChannel
local, no multiplexer, known terminalOSC escape sequence, the terminal shows it
local, no multiplexer, unknown terminalsystem notification (osascript, notify-send, Windows toast)
local tmux / screensystem notification — bypasses the multiplexer entirely
SSH, no multiplexerOSC — a system notification would fire on the remote host
SSH + tmuxOSC wrapped in a DCS passthrough

Compatibility

TerminalChannelNotes
WarpOSC 777needs notifications enabled in Warp's settings
iTerm2OSC 777
GhosttyOSC 777
WezTermOSC 777
kittyOSC 99
rxvt-unicodeOSC 777
VS Code integratedOSC 777unverified — if nothing appears, set PI_BELL_CHANNEL=system
Apple TerminalsystemOS shows it as coming from "Script Editor"
Alacrittysystem
Zed, IntelliJ, GNOME Terminal, Konsole, foot, Windows Terminalsystem
tmux / screen (local)systemno tmux config needed
tmux (over SSH)OSC + DCSrequires set -g allow-passthrough on in tmux

Zed and other terminals not in the OSC list automatically fall back to system notifications.

Environment variables

VariableValuesMeaning
PI_BELL_CHANNELosc | system | offSkip detection and force a channel
PI_BELL_TMUX_PASSTHROUGH1 | 01: send OSC through a local tmux (requires allow-passthrough). 0: never wrap, always prefer system
PI_BELL_SOUND_CMDany shell commandRun in the background whenever a notification is sent
# macOS
export PI_BELL_SOUND_CMD='afplay ~/Library/Sounds/Glass.aiff'
# Linux
export PI_BELL_SOUND_CMD='paplay /usr/share/sounds/freedesktop/stereo/complete.oga'

Known limitations

  • Remote tmux needs configuration. The DCS passthrough above only works with set -g allow-passthrough on. Local tmux does not need it.
  • An error before any assistant message is reported as success. If the run dies before the model ever replies (bad API key, DNS failure), there is no stopReason to read, so it is reported as done. The error state requires at least one assistant message with stopReason: "error".
  • macOS shows the sender as "Script Editor". osascript is the app delivering the notification, and the first one prompts for permission.
  • OSC is fire-and-forget. The terminal gives no acknowledgement, so a terminal that silently drops OSC 777 cannot be detected. If nothing shows up, set PI_BELL_CHANNEL=system.
  • Not sent outside TUI mode: in --print and --json the caller reads the result, and in RPC mode stdout is a JSON stream that an OSC sequence would corrupt.

Development

npm install
npm test      # node --test, no test framework dependency
npm run check # tsc --noEmit
pi -e .       # load the extension from this checkout

Author

Asten — @0xasten

License

MIT