# os-notifier Native-first OS notifications for direct interactive Pi completion. ## 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 in TUI mode. - `input` records direct interactive input origin. - `agent_start` starts duration measurement and assigns queued input origin. - `agent_end` sends an eligible completion notification while unfocused. - `session_shutdown` clears in-memory state and focus tracking. ## Eligibility Notifications require all of: - `ctx.mode === "tui"` - input source `interactive` - terminal unfocused at `agent_end` RPC, JSON, print, SDK-driven, extension-driven, and subagent-style turns stay silent. Interactive steering makes its active run eligible. Queued follow-up origins remain associated with their later run. Focused completions are discarded rather than deferred. ## Native delivery The extension attempts one OS bridge: - Linux: `notify-send` - macOS: `osascript` - Windows: PowerShell WinRT toast A spawn error or nonzero exit emits one terminal fallback. Kitty receives OSC 99; other terminals receive OSC 777. No startup probe or warning notification is emitted. Linux urgency maps `info` to low, `warning` to normal, and `error` to critical. macOS and Windows communicate outcome through the title because these bridges expose no equivalent urgency. OSC fallback prefixes warnings and errors. ## Content Notifications include outcome, duration, project, Git branch, session name, model, bounded user prompt, and bounded failure detail. Dynamic text is sanitized and passed without shell interpolation. Focus tracking uses DECSET `?1004`, shared through `globalThis` and reference-counted.