# os-notifier Native-first OS notifications for direct interactive Pi completion. ## Install / load Loaded through the root pi-ext package. Requires Pi 0.80.6 or newer for `agent_settled`. 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 candidate direct interactive input origin. - `before_agent_start` confirms the accepted input that starts a lifecycle. - `agent_start` starts duration measurement for the active lifecycle. - `agent_end` records the latest low-level outcome. - `agent_settled` sends the final eligible 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_settled` RPC, JSON, print, SDK-driven, extension-driven, and subagent-style turns stay silent. The accepted input that starts the lifecycle determines eligibility. Later steering and follow-ups do not reclassify extension-driven work. 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, nonzero exit, or five-second timeout 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. The accepted starting prompt remains available when a retry's final event omits user messages. Dynamic text is sanitized and passed without shell interpolation. Focus tracking uses DECSET `?1004`, shared through `globalThis` and reference-counted.