Notifications: agent notify reaches every device and clears everywhere
- Server: chat ntfy messages carry a sequence id derived from their app id; clearing a chat app notification also clears it in ntfy (PUT /<topic>/<seq>/clear, verified on ntfy v2.38.1). - Server: a turn that sent an agent notify does not also send chat_reply. - notify tool and MCP instructions: Pipelines already notifies at reply end and for questions/approvals; notify is for mid-turn or background news. - Shown notify items carry channels (apps/phone); the transcript row says where it went. - App: NotificationBridge.close(tag); web closes tracked Notifications and tells other tabs over a BroadcastChannel; native bridge cancels by tag and now supports macOS. AgentNotices closes on notifications_cleared and on resubscribe cleared ids, and a tap sends clear_notifications. - Docs: skill, chat reference, ntfy/notifications docs, app note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,9 +17,13 @@ The same settings decide what is sent on both paths.
|
||||
| Stage hook | a stage's own `notify` block fires ([ntfy reference](ntfy.md)) |
|
||||
| Chat needs you | a chat asks a question or requests approval |
|
||||
| Chat replied | an assistant turn ends (off by default) |
|
||||
| Agent notification | a chat's agent calls its `notify` tool (always on; a turn that notified sends no separate "Chat replied") |
|
||||
|
||||
Each event notifies once. Opening or dismissing it on one device clears it on
|
||||
the others.
|
||||
Each event notifies once, on every device signed in (each web tab or installed
|
||||
web app window, the Android app, the macOS app) and on ntfy. Opening the chat
|
||||
or run, tapping the notification, or dismissing it in the app or the Android
|
||||
notification shade clears it on every device, including the ntfy app for chat
|
||||
notifications (see [Clearing notifications across devices](ntfy.md#clearing-notifications-across-devices)).
|
||||
|
||||
Chat events do not need the chat to be open. When the last app or browser
|
||||
leaves a chat whose turn is still running, or which has an unanswered question
|
||||
|
||||
+26
-5
@@ -210,9 +210,29 @@ once, and on a disconnected device when it next connects. The protocol is
|
||||
`attention_acks_changed` frame with the change. Acknowledgements for deleted runs
|
||||
or sessions, or older than 30 days, are pruned.
|
||||
|
||||
This does **not** reach notifications the ntfy app has already shown on a phone:
|
||||
once ntfy delivered a message, the server cannot retract it, so those must still
|
||||
be swiped away in the ntfy app (or the Android notification shade).
|
||||
Every client removes its system notification when the clear reaches it:
|
||||
|
||||
- **Web** (every tab and installed web app window): the page closes the browser
|
||||
`Notification` with that tag, and tells the origin's other tabs to close
|
||||
theirs over a `BroadcastChannel`. A click on a browser notification sends
|
||||
`clear_notifications` for it. A browser *close* event is not reported back:
|
||||
browsers raise it for a notification daemon's timeout and for a same-tag
|
||||
replacement too, so treating it as a dismissal would clear the notification on
|
||||
every device seconds after it appeared.
|
||||
- **Android with Receive notifications in Pipelines**: the background service
|
||||
cancels it; a tap or a swipe (delete intent) sends `clear_notifications`.
|
||||
- **Android without the service, iOS and macOS** (the in-app
|
||||
`flutter_local_notifications` bridge while the app runs): it is cancelled /
|
||||
removed from the notification centre by its tag; a tap clears it. The plugin
|
||||
reports no dismissal, so a swipe there is not sent back.
|
||||
- **ntfy**: chat notifications (questions, approvals, replies and agent
|
||||
`notify`) are published with an ntfy sequence id derived from their app id
|
||||
(`X-Sequence-ID: pl-<24 hex of sha256(id)>`), and clearing one sends
|
||||
`PUT /<topic>/<sequence id>/clear`. ntfy (v2.15 or later; verified with
|
||||
v2.38.1) emits `message_clear` and its Android and web apps dismiss the
|
||||
notification. Run notifications carry no sequence id and stay in the ntfy app
|
||||
until swiped away. An older ntfy does not support clearing; a failed clear is
|
||||
only logged.
|
||||
|
||||
## App notification stream (no ntfy app needed)
|
||||
|
||||
@@ -248,8 +268,9 @@ N = {"id":"run:7:3:waiting","kind":"run_waiting","title":"Run needs your decisio
|
||||
`chat:<id>`. `priority` is 3 and `tags` empty, matching what ntfy receives,
|
||||
except `chat_notify`: an agent's `notify` tool call, whose priority is the
|
||||
tool's (`low` 2, `default` 3, `high` 4). Every subscribed client receives it,
|
||||
whichever chat it shows; the web app posts it as a browser notification or an
|
||||
in-app alert, so an agent's notify reaches the operator without ntfy.
|
||||
whichever chat it shows; each posts it as a system notification, so an
|
||||
agent's notify reaches the operator without ntfy. A turn that sent one does
|
||||
not also send its `chat_reply`.
|
||||
- The subscribe reply holds the active (uncleared) notifications newer than the
|
||||
`after` cursor (the last id the client holds), oldest first, at most 100;
|
||||
an empty, unknown or pruned cursor replays them all. Its `ids` lists
|
||||
|
||||
Reference in New Issue
Block a user