Expand description
Pure notification policy — SPEC_OS_NOTIFICATIONS_SYSTEM_2026_09_24.md §5.
PolicyState::step(input, now_ms, &settings) -> Vec<Action> is the whole
decision surface: no clocks, no I/O, no broker. router.rs owns the side
effects (publishing, the tick task). Keeping it pure is what makes the
debounce / dedupe / focus-gate / retract rules table-testable.
Phase 1: kinds InputWaiting / TurnCompleted / TurnErrored / Test,
per-kind enable, debounce, dedupe-by-group, focus gate, retract.
Phase 2: AgentCrashed / MessageNeedsReview / Summary, pause, rate
limits folding into a summary, and a tray state snapshot (§4.2, §5.1).
Structs§
- Attention
Item - One shown Attention item, for the tray’s “needs you” submenu. Titles are app-controlled templates, so they are safe to show in a native menu.
- Focus
Report - What one frontend window last reported about focus.
- Live 🔒
- Notification
- The payload Presenters render. Every string here is app-controlled or
router-sanitized. Exported to TS as
OsNotificationso it can’t shadow the DOM’s globalNotification. - Policy
State - Request
- A request from a source.
agent_name/bodyare already resolved and sanitized by the router — the policy never sees untrusted free text it would render as a title. - Settings
- Resolved settings snapshot the policy reads. Built by the router from
settings.jsonon every step (cheap; the config watcher holds it in memory). - Tray
State - Snapshot the tray renders (§4.2).
Enums§
- Action
- Family
- Input
- Notify
Kind - Closed set of notification kinds. A source cannot invent a new visual treatment — every kind has an app-controlled title template (§9.1).
- Preview
notify:os:preview(§9.2).- Priority
- When
notify:os:when(§6.0).
Constants§
- GLOBAL_
MAX - GLOBAL_
WINDOW_ MS - PER_
BLOCK_ WINDOW_ MS - Rate limits (§5.1 step 6). Attention is exempt from the per-block limit (an agent that finished and then immediately asks something must still reach you) but not from the global one.
Functions§
- summary_
title - tag_for
- 16 hex chars of FNV-1a over the group key — stable across restarts, short enough for every Windows toast Tag limit.
- title_
for - Title from a closed template set (§9.1). Only the agent name is interpolated, and it arrives pre-sanitized.