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, Git branch, session name, model name/provider/id, and a bounded
last user prompt snippet when available.
Assistant stopReason maps to notification status:
aborted → Pi aborted, warning.
error → Pi error, error.
otherwise → Pi done, info.
Notification backend selection:
Linux with notify-send available → notify-send.
WT_SESSION → Windows toast via powershell.exe.
KITTY_WINDOW_ID → OSC 99.
otherwise → OSC 777.
notify-send urgency mapping:
info → low.
warning / warn → normal.
error → critical.
notify:send relay always sends, independent of terminal focus.
Terminal OSC / Windows fallback messages get ⚠️ for warnings and ❌ for errors.