App: agent notifications on the web (system notification, toast, tab title count)
The app subscribes to the notification stream on every connection and delivers chat_notify notices: a toast when the page is focused (none if that chat is in view), a browser notification titled '<chat>: <title>' plus a '(n)' tab title count when it is not, and on insecure http pages a toast, the title count and a short chime. Low priority posts only when hidden. Replays within an hour show once; ids persist in the ledger. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# Agent notify reaches the web app
|
||||
|
||||
An agent's MCP `notify` call is recorded by the server as a `chat_notify` app
|
||||
notification (id `chat:<session>:notify:<shown id>`, priority low 2 / default 3
|
||||
/ high 4) on the existing notification stream (`subscribe_notifications`), so
|
||||
every connected client receives it and a reconnecting client replays the ones
|
||||
still active. ntfy delivery is unchanged.
|
||||
|
||||
The app (`lib/features/attention/notify/agent_notices.dart`) subscribes on every
|
||||
connection through the send-only path and decides per notice
|
||||
(`agent_notice.dart`, `agentNoticeDelivery`):
|
||||
|
||||
- focused page: an in-app toast with Open, nothing if that chat is in view;
|
||||
- unfocused or hidden page with browser permission: a system notification
|
||||
titled `<chat title>: <title>` (click focuses the tab and opens the chat) and a
|
||||
`(n) ` count in the tab title until focus returns; low priority only posts
|
||||
when the page is hidden, otherwise it waits as a toast;
|
||||
- no permission or an insecure http page: toast, title count and, for default
|
||||
and high priority live notices, a short Web Audio chime.
|
||||
|
||||
Replays older than one hour are recorded but not shown; at most five show. Shown
|
||||
ids persist in the notification ledger (`agent` map, two days, 200 entries), so
|
||||
reloads and reconnects never repeat one. Opening the chat clears the server copy
|
||||
on every device (chat seen).
|
||||
|
||||
Captures (`tool/capture`, fixture `?ui-review=1&agentNotice=<ms>`): secure
|
||||
focused toast, Open navigating to `/chat/ui-review`, no toast with the chat in
|
||||
view, insecure unfocused toast with `document.title == "(1) Pipelines"` and back
|
||||
to `Pipelines` on focus, and the Settings hints for secure and insecure pages.
|
||||
Browser system notifications themselves were not captured (headless Chrome,
|
||||
permission not granted); unit tests cover that path.
|
||||
Reference in New Issue
Block a user