pi-ext
bugabingas pi extensions
owned by bugabinga
extensions/terminal-notifier/README.md
Rawterminal-notifier
Terminal notification bridge for Pi agent completion and extension events.
Install / load
Loaded through the root pi-ext package.
See root README.
Commands / tools / settings
Commands:
none.
Tools:
none.
Settings:
none.
Hooks:
session_start:
attaches terminal focus tracking.
agent_start:
records start time.
agent_end:
sends a completion notification when terminal focus is away.
session_shutdown:
removes focus listener and disables focus tracking.
Events:
- listens for
notify:send with { message, severity?, source? }.
- emits
notify:ui with { message, severity, source } before relaying
notify:send to terminal/native notification output.
Behavior
Uses DECSET ?1004 focus reports when stdin/stdout are TTYs.
Focus state is shared through globalThis and reference-counted.
Suppresses agent completion notifications while terminal is focused.
Agent completion notifications include status, elapsed time when available,
project basename, and model name/provider/id when available.
Assistant stopReason maps to notification status:
aborted → Pi aborted, warning.
error → Pi error, error.
- otherwise →
Pi done, info.
Notification backend selection:
WT_SESSION → Windows toast via powershell.exe.
KITTY_WINDOW_ID → OSC 99.
- otherwise → OSC 777.
notify:send relay always sends, independent of terminal focus.
Warning messages get ⚠️; error messages get ❌.
Markdown source
File outline
# terminal-notifier
Terminal notification bridge for Pi agent completion and extension events.
## Install / load
Loaded through the root pi-ext package.
See [root README](../../README.md).
## Commands / tools / settings
Commands:
none.
Tools:
none.
Settings:
none.
Hooks:
- `session_start`:
attaches terminal focus tracking.
- `agent_start`:
records start time.
- `agent_end`:
sends a completion notification when terminal focus is away.
- `session_shutdown`:
removes focus listener and disables focus tracking.
Events:
- listens for `notify:send` with `{ message, severity?, source?
}`.
- emits `notify:ui` with `{ message, severity, source }` before relaying
`notify:send` to terminal/native notification output.
## Behavior
Uses DECSET `?1004` focus reports when stdin/stdout are TTYs.
Focus state is shared through `globalThis` and reference-counted.
Suppresses agent completion notifications while terminal is focused.
Agent completion notifications include status, elapsed time when available,
project basename, and model name/provider/id when available.
Assistant `stopReason` maps to notification status:
- `aborted` → `Pi aborted`, warning.
- `error` → `Pi error`, error.
- otherwise → `Pi done`, info.
Notification backend selection:
- `WT_SESSION` → Windows toast via `powershell.exe`.
- `KITTY_WINDOW_ID` → OSC 99.
- otherwise → OSC 777.
`notify:send` relay always sends, independent of terminal focus.
Warning messages get `⚠️`; error messages get `❌`.